chat.module.scss 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860
  1. @import "../styles/animation.scss";
  2. .attach-images {
  3. position: absolute;
  4. left: 30px;
  5. bottom: 32px;
  6. display: flex;
  7. }
  8. .attach-image {
  9. cursor: default;
  10. width: 64px;
  11. height: 64px;
  12. border: rgba($color: #888, $alpha: 0.2) 1px solid;
  13. border-radius: 5px;
  14. margin-right: 10px;
  15. background-size: cover;
  16. background-position: center;
  17. background-color: var(--white);
  18. .attach-image-mask {
  19. width: 100%;
  20. height: 100%;
  21. opacity: 0;
  22. transition: all ease 0.2s;
  23. }
  24. .attach-image-mask:hover {
  25. opacity: 1;
  26. }
  27. .delete-image {
  28. width: 24px;
  29. height: 24px;
  30. cursor: pointer;
  31. display: flex;
  32. align-items: center;
  33. justify-content: center;
  34. border-radius: 5px;
  35. float: right;
  36. background-color: var(--white);
  37. }
  38. }
  39. .chat-input-actions {
  40. display: flex;
  41. flex-wrap: wrap;
  42. .chat-input-action {
  43. display: inline-flex;
  44. border-radius: 20px;
  45. font-size: 12px;
  46. background-color: var(--white);
  47. color: var(--black);
  48. border: var(--border-in-light);
  49. padding: 4px 10px;
  50. animation: slide-in ease 0.3s;
  51. box-shadow: var(--card-shadow);
  52. transition: width ease 0.3s;
  53. align-items: center;
  54. height: 16px;
  55. width: var(--icon-width);
  56. overflow: hidden;
  57. &:not(:last-child) {
  58. margin-right: 5px;
  59. }
  60. .text {
  61. white-space: nowrap;
  62. padding-left: 5px;
  63. opacity: 0;
  64. transform: translateX(-5px);
  65. transition: all ease 0.3s;
  66. pointer-events: none;
  67. }
  68. &:hover {
  69. --delay: 0.5s;
  70. width: var(--full-width);
  71. transition-delay: var(--delay);
  72. .text {
  73. transition-delay: var(--delay);
  74. opacity: 1;
  75. transform: translate(0);
  76. }
  77. }
  78. .text,
  79. .icon {
  80. display: flex;
  81. align-items: center;
  82. justify-content: center;
  83. }
  84. }
  85. }
  86. .prompt-toast {
  87. position: absolute;
  88. bottom: -50px;
  89. z-index: 999;
  90. display: flex;
  91. justify-content: center;
  92. width: calc(100% - 40px);
  93. .prompt-toast-inner {
  94. display: flex;
  95. justify-content: center;
  96. align-items: center;
  97. font-size: 12px;
  98. background-color: var(--white);
  99. color: var(--black);
  100. border: var(--border-in-light);
  101. box-shadow: var(--card-shadow);
  102. padding: 10px 20px;
  103. border-radius: 100px;
  104. animation: slide-in-from-top ease 0.3s;
  105. .prompt-toast-content {
  106. margin-left: 10px;
  107. }
  108. }
  109. }
  110. .section-title {
  111. font-size: 12px;
  112. font-weight: bold;
  113. margin-bottom: 10px;
  114. display: flex;
  115. justify-content: space-between;
  116. align-items: center;
  117. .section-title-action {
  118. display: flex;
  119. align-items: center;
  120. }
  121. }
  122. .context-prompt {
  123. .context-prompt-insert {
  124. display: flex;
  125. justify-content: center;
  126. padding: 4px;
  127. opacity: 0.2;
  128. transition: all ease 0.3s;
  129. background-color: rgba(0, 0, 0, 0);
  130. cursor: pointer;
  131. border-radius: 4px;
  132. margin-top: 4px;
  133. margin-bottom: 4px;
  134. &:hover {
  135. opacity: 1;
  136. background-color: rgba(0, 0, 0, 0.05);
  137. }
  138. }
  139. .context-prompt-row {
  140. display: flex;
  141. justify-content: center;
  142. width: 100%;
  143. &:hover {
  144. .context-drag {
  145. opacity: 1;
  146. }
  147. }
  148. .context-drag {
  149. display: flex;
  150. align-items: center;
  151. opacity: 0.5;
  152. transition: all ease 0.3s;
  153. }
  154. .context-role {
  155. margin-right: 10px;
  156. }
  157. .context-content {
  158. flex: 1;
  159. max-width: 100%;
  160. text-align: left;
  161. }
  162. .context-delete-button {
  163. margin-left: 10px;
  164. }
  165. }
  166. .context-prompt-button {
  167. flex: 1;
  168. }
  169. }
  170. .memory-prompt {
  171. margin: 20px 0;
  172. .memory-prompt-content {
  173. background-color: var(--white);
  174. color: var(--black);
  175. border: var(--border-in-light);
  176. border-radius: 10px;
  177. padding: 10px;
  178. font-size: 12px;
  179. user-select: text;
  180. }
  181. }
  182. .clear-context {
  183. margin: 20px 0 0 0;
  184. padding: 4px 0;
  185. border-top: var(--border-in-light);
  186. border-bottom: var(--border-in-light);
  187. box-shadow: var(--card-shadow) inset;
  188. display: flex;
  189. justify-content: center;
  190. align-items: center;
  191. color: var(--black);
  192. transition: all ease 0.3s;
  193. cursor: pointer;
  194. overflow: hidden;
  195. position: relative;
  196. font-size: 12px;
  197. animation: slide-in ease 0.3s;
  198. $linear: linear-gradient(to right,
  199. rgba(0, 0, 0, 0),
  200. rgba(0, 0, 0, 1),
  201. rgba(0, 0, 0, 0));
  202. mask-image: $linear;
  203. @mixin show {
  204. transform: translateY(0);
  205. position: relative;
  206. transition: all ease 0.3s;
  207. opacity: 1;
  208. }
  209. @mixin hide {
  210. transform: translateY(-50%);
  211. position: absolute;
  212. transition: all ease 0.1s;
  213. opacity: 0;
  214. }
  215. &-tips {
  216. @include show;
  217. opacity: 0.5;
  218. }
  219. &-revert-btn {
  220. color: var(--primary);
  221. @include hide;
  222. }
  223. &:hover {
  224. opacity: 1;
  225. border-color: var(--primary);
  226. .clear-context-tips {
  227. @include hide;
  228. }
  229. .clear-context-revert-btn {
  230. @include show;
  231. }
  232. }
  233. }
  234. .chat {
  235. display: flex;
  236. flex-direction: column;
  237. position: relative;
  238. height: 100%;
  239. background-image: url("/chat-bg.jpg");
  240. /* 使背景图片按比例填充容器 */
  241. background-size: cover;
  242. /* 居中显示背景图片 */
  243. background-position: center;
  244. /* 避免重复 */
  245. background-repeat: no-repeat;
  246. }
  247. .chat-body {
  248. flex: 1;
  249. overflow: auto;
  250. overflow-x: hidden;
  251. padding: 20px;
  252. padding-bottom: 40px;
  253. }
  254. .chat-body-main-title {
  255. cursor: pointer;
  256. color: #FFFFFF !important;
  257. &:hover {
  258. text-decoration: none;
  259. }
  260. }
  261. @media only screen and (max-width: 600px) {
  262. .chat-body-title {
  263. text-align: center;
  264. }
  265. }
  266. .chat-message {
  267. display: flex;
  268. flex-direction: row;
  269. &:last-child {
  270. animation: slide-in ease 0.3s;
  271. }
  272. }
  273. .chat-message-user {
  274. display: flex;
  275. flex-direction: row-reverse;
  276. .chat-message-header {
  277. flex-direction: row-reverse;
  278. }
  279. }
  280. .chat-message-header {
  281. margin-top: 20px;
  282. display: flex;
  283. align-items: center;
  284. .chat-message-actions {
  285. display: flex;
  286. box-sizing: border-box;
  287. font-size: 12px;
  288. align-items: flex-end;
  289. justify-content: space-between;
  290. transition: all ease 0.3s;
  291. transform: scale(0.9) translateY(5px);
  292. margin: 0 10px;
  293. opacity: 0;
  294. pointer-events: none;
  295. .chat-input-actions {
  296. display: flex;
  297. flex-wrap: nowrap;
  298. }
  299. }
  300. }
  301. .chat-message-container {
  302. max-width: var(--message-max-width);
  303. display: flex;
  304. flex-direction: column;
  305. align-items: flex-start;
  306. &:hover {
  307. .chat-message-edit {
  308. opacity: 0.9;
  309. }
  310. .chat-message-actions {
  311. opacity: 1;
  312. pointer-events: all;
  313. transform: scale(1) translateY(0);
  314. }
  315. }
  316. }
  317. .chat-message-user>.chat-message-container {
  318. align-items: flex-end;
  319. }
  320. .chat-message-avatar {
  321. position: relative;
  322. .chat-message-edit {
  323. position: absolute;
  324. height: 100%;
  325. width: 100%;
  326. overflow: hidden;
  327. display: flex;
  328. align-items: center;
  329. justify-content: center;
  330. opacity: 0;
  331. transition: all ease 0.3s;
  332. button {
  333. padding: 7px;
  334. }
  335. }
  336. /* Specific styles for iOS devices */
  337. @media screen and (max-device-width: 812px) and (-webkit-min-device-pixel-ratio: 2) {
  338. @supports (-webkit-touch-callout: none) {
  339. .chat-message-edit {
  340. top: -8%;
  341. }
  342. }
  343. }
  344. }
  345. .chat-message-status {
  346. font-size: 12px;
  347. color: #aaa;
  348. line-height: 1.5;
  349. margin-top: 5px;
  350. background-color: white;
  351. padding: 5px;
  352. border-radius: 5px;
  353. }
  354. .chat-message-item {
  355. box-sizing: border-box;
  356. max-width: 100%;
  357. margin-top: 10px;
  358. border-radius: 10px;
  359. background-color: #FFFFFF;
  360. padding: 10px;
  361. font-size: 14px;
  362. user-select: text;
  363. word-break: break-word;
  364. border: var(--border-in-light);
  365. position: relative;
  366. transition: all ease 0.3s;
  367. }
  368. .chat-message-item-image {
  369. width: 100%;
  370. margin-top: 10px;
  371. }
  372. .chat-message-item-images {
  373. width: 100%;
  374. display: grid;
  375. justify-content: left;
  376. grid-gap: 10px;
  377. grid-template-columns: repeat(var(--image-count), auto);
  378. margin-top: 10px;
  379. }
  380. .chat-message-item-image-multi {
  381. object-fit: cover;
  382. background-size: cover;
  383. background-position: center;
  384. background-repeat: no-repeat;
  385. }
  386. .chat-message-item-image,
  387. .chat-message-item-image-multi {
  388. box-sizing: border-box;
  389. border-radius: 10px;
  390. border: rgba($color: #888, $alpha: 0.2) 1px solid;
  391. }
  392. @media only screen and (max-width: 600px) {
  393. $calc-image-width: calc(100vw / 3 * 2 / var(--image-count));
  394. .chat-message-item-image-multi {
  395. width: $calc-image-width;
  396. height: $calc-image-width;
  397. }
  398. .chat-message-item-image {
  399. max-width: calc(100vw / 3 * 2);
  400. }
  401. }
  402. @media screen and (min-width: 600px) {
  403. $max-image-width: calc(calc(1200px - var(--sidebar-width)) / 3 * 2 / var(--image-count));
  404. $image-width: calc(calc(var(--window-width) - var(--sidebar-width)) / 3 * 2 / var(--image-count));
  405. .chat-message-item-image-multi {
  406. width: $image-width;
  407. height: $image-width;
  408. max-width: $max-image-width;
  409. max-height: $max-image-width;
  410. }
  411. .chat-message-item-image {
  412. max-width: calc(calc(1200px - var(--sidebar-width)) / 3 * 2);
  413. }
  414. }
  415. .chat-message-action-date {
  416. font-size: 12px;
  417. opacity: 0.2;
  418. white-space: nowrap;
  419. transition: all ease 0.6s;
  420. color: var(--black);
  421. text-align: right;
  422. width: 100%;
  423. box-sizing: border-box;
  424. padding-right: 10px;
  425. pointer-events: none;
  426. z-index: 1;
  427. }
  428. .chat-message-user>.chat-message-container>.chat-message-item {
  429. background-color: var(--second);
  430. &:hover {
  431. min-width: 0;
  432. }
  433. }
  434. .chat-input-panel {
  435. position: relative;
  436. width: 100%;
  437. padding: 10px 16px;
  438. box-sizing: border-box;
  439. flex-direction: column;
  440. box-shadow: var(--card-shadow);
  441. background: rgba(155, 155, 255, .2);
  442. -webkit-backdrop-filter: blur(1px);
  443. backdrop-filter: blur(1px);
  444. border-top: 1px solid rgba(55, 155, 255, .5);
  445. .chat-input-actions {
  446. .chat-input-action {
  447. margin-bottom: 10px;
  448. }
  449. }
  450. }
  451. @mixin single-line {
  452. white-space: nowrap;
  453. overflow: hidden;
  454. text-overflow: ellipsis;
  455. }
  456. .prompt-hints {
  457. min-height: 20px;
  458. width: 100%;
  459. max-height: 50vh;
  460. overflow: auto;
  461. display: flex;
  462. flex-direction: column-reverse;
  463. background-color: var(--white);
  464. border: var(--border-in-light);
  465. border-radius: 10px;
  466. margin-bottom: 10px;
  467. box-shadow: var(--shadow);
  468. .prompt-hint {
  469. color: var(--black);
  470. padding: 6px 10px;
  471. animation: slide-in ease 0.3s;
  472. cursor: pointer;
  473. transition: all ease 0.3s;
  474. border: transparent 1px solid;
  475. margin: 4px;
  476. border-radius: 8px;
  477. &:not(:last-child) {
  478. margin-top: 0;
  479. }
  480. .hint-title {
  481. font-size: 12px;
  482. font-weight: bolder;
  483. @include single-line();
  484. }
  485. .hint-content {
  486. font-size: 12px;
  487. @include single-line();
  488. }
  489. &-selected,
  490. &:hover {
  491. border-color: var(--primary);
  492. }
  493. }
  494. }
  495. .chat-input-panel-inner {
  496. cursor: text;
  497. display: flex;
  498. flex-direction: column; // 垂直布局
  499. flex: 1;
  500. border-radius: 16px;
  501. border: var(--border-in-light);
  502. position: relative;
  503. // min-height: 100px;
  504. max-height: 120px;
  505. overflow-y: auto;
  506. overflow: hidden;
  507. }
  508. .chat-input-panel-inner-attach {
  509. padding-bottom: 80px;
  510. }
  511. .chat-input-panel-inner:has(.chat-input:focus) {
  512. border: 1px solid var(--primary);
  513. }
  514. .chat-input-panel-inner:has(.chat-input2:focus) {
  515. border-color: #495fe6;
  516. }
  517. .chat-input {
  518. flex: 1;
  519. height: 100%;
  520. width: 100%;
  521. // border-radius: 16px;
  522. border: none;
  523. background: hsla(0,0%,100%,.1);
  524. box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.03);
  525. color: var(--black) !important;
  526. font-family: inherit;
  527. padding: 10px 80px 10px 14px;
  528. resize: none;
  529. outline: none;
  530. box-sizing: border-box;
  531. min-height: 60px;
  532. font-size: 14px;
  533. line-height: 1.5;
  534. background-color: #FFFFFF;
  535. // 文字颜色
  536. color: #000;
  537. }
  538. .chat-input2 {
  539. @extend .chat-input;
  540. }
  541. // placeholder颜色
  542. .chat-input::placeholder {
  543. color: #FFFFFF;
  544. }
  545. .chat-input-send {
  546. background-color: var(--primary);
  547. color: white;
  548. position: absolute;
  549. right: 10px;
  550. bottom: 10px;
  551. }
  552. // 新增:输入框内部按钮区域样式
  553. .chat-input-bottom-bar {
  554. display: flex;
  555. justify-content: space-between;
  556. align-items: center;
  557. padding: 8px 16px 16px 16px;
  558. flex-shrink: 0;
  559. // border-top: 1px solid #f3f4f6;
  560. margin-top: auto;
  561. // 确保按钮区域布局稳定
  562. position: relative;
  563. // 移动端优化
  564. @media only screen and (max-width: 600px) {
  565. justify-content: flex-start;
  566. gap: 8px;
  567. flex-wrap: wrap;
  568. // 左侧选项区域
  569. > div:first-child {
  570. flex: 1;
  571. min-width: 0;
  572. }
  573. // 右侧按钮区域(包含上传和发送按钮)
  574. > div:last-child {
  575. flex-shrink: 0;
  576. display: flex;
  577. align-items: center;
  578. gap: 8px;
  579. }
  580. }
  581. .left-options {
  582. display: flex;
  583. align-items: center;
  584. gap: 8px;
  585. .option-item { // 未使用
  586. display: flex;
  587. height: 28px;
  588. border-radius: 16px;
  589. font-size: 12px;
  590. padding: 0px 12px;
  591. justify-content: center;
  592. align-items: center;
  593. margin-right: 10px;
  594. cursor: pointer;
  595. background: #f3f4f6; // 默认状态
  596. color: #000000; // 默认状态
  597. // border: 1px solid transparent; // 默认状态
  598. transition: all 0.2s ease;
  599. user-select: none;
  600. // 激活状态
  601. &.active {
  602. background: #dee9fc;
  603. color: #3875f6;
  604. // border: 1px solid #3875f6;
  605. }
  606. &:hover {
  607. background-color: #f9fafb;
  608. color: #374151;
  609. }
  610. // .chevron {
  611. // margin-left: 4px;
  612. // font-size: 10px;
  613. // opacity: 0.6;
  614. // }
  615. }
  616. }
  617. .middle-action {
  618. .primary-button {
  619. display: flex;
  620. align-items: center;
  621. gap: 6px;
  622. padding: 6px 12px;
  623. background: #dbeafe;
  624. color: #1e40af;
  625. border: none;
  626. border-radius: 8px;
  627. font-size: 12px;
  628. cursor: pointer;
  629. transition: all 0.2s ease;
  630. &:hover {
  631. background: #bfdbfe;
  632. }
  633. .chevron {
  634. font-size: 10px;
  635. opacity: 0.7;
  636. }
  637. }
  638. }
  639. .right-actions {
  640. display: flex;
  641. align-items: center;
  642. gap: 8px;
  643. .action-icon {
  644. width: 24px;
  645. height: 24px;
  646. display: flex;
  647. align-items: center;
  648. justify-content: center;
  649. border-radius: 50%;
  650. cursor: pointer;
  651. transition: all 0.2s ease;
  652. &:hover {
  653. background-color: #f3f4f6;
  654. }
  655. &.send-button {
  656. background: #6b7280;
  657. color: white;
  658. &:hover {
  659. background: #4b5563;
  660. }
  661. }
  662. }
  663. }
  664. }
  665. @media only screen and (max-width: 600px) {
  666. .chat-input {
  667. font-size: 16px;
  668. }
  669. .chat-input-send {
  670. bottom: 10px;
  671. }
  672. // 移动端输入框内部优化
  673. .chat-input-panel-inner {
  674. // min-height: 100px;
  675. // max-height: 120px;
  676. }
  677. // 针对特定手机屏幕的额外优化
  678. @media only screen and (max-width: 480px) {
  679. // 针对DeepSeekHomeChat组件的按钮优化
  680. .chat-input-panel + div[style*="display: flex"] {
  681. padding: 4px 8px !important;
  682. gap: 4px !important;
  683. > div:first-child {
  684. gap: 8px !important;
  685. flex-wrap: wrap !important;
  686. > div {
  687. padding: 0 8px !important;
  688. height: 26px !important;
  689. font-size: 11px !important;
  690. margin-right: 8px !important;
  691. img {
  692. height: 18px !important;
  693. }
  694. }
  695. }
  696. > div:last-child {
  697. width: 28px !important;
  698. height: 28px !important;
  699. flex-shrink: 0 !important;
  700. }
  701. }
  702. }
  703. // 移动端输入框优化
  704. .chat-input2 {
  705. font-size: 16px; // 防止iOS缩放
  706. line-height: 1.4;
  707. padding: 12px 16px;
  708. }
  709. // 通用移动端按钮容器优化
  710. .chat-input-panel + div[style*="display: flex"] {
  711. display: flex !important;
  712. justify-content: space-between !important;
  713. align-items: center !important;
  714. flex-wrap: nowrap !important;
  715. padding: 6px 12px !important;
  716. gap: 8px !important;
  717. > div:first-child {
  718. display: flex !important;
  719. align-items: center !important;
  720. gap: 8px !important;
  721. flex-wrap: wrap !important;
  722. flex: 1 !important;
  723. min-width: 0 !important;
  724. }
  725. > div:last-child {
  726. flex-shrink: 0 !important;
  727. display: flex !important;
  728. align-items: center !important;
  729. justify-content: center !important;
  730. }
  731. }
  732. }