chat.module.scss 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  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. justify-content: space-between;
  43. gap: 5px;
  44. &-end {
  45. display: flex;
  46. margin-left: auto;
  47. gap: 5px;
  48. }
  49. .chat-input-action {
  50. display: inline-flex;
  51. border-radius: 20px;
  52. font-size: 12px;
  53. background-color: var(--white);
  54. color: var(--black);
  55. border: var(--border-in-light);
  56. padding: 4px 10px;
  57. animation: slide-in ease 0.3s;
  58. box-shadow: var(--card-shadow);
  59. transition: width ease 0.3s;
  60. align-items: center;
  61. height: 16px;
  62. width: var(--icon-width);
  63. overflow: hidden;
  64. .text {
  65. white-space: nowrap;
  66. padding-left: 5px;
  67. opacity: 0;
  68. transform: translateX(-5px);
  69. transition: all ease 0.3s;
  70. pointer-events: none;
  71. }
  72. &:hover {
  73. --delay: 0.5s;
  74. width: var(--full-width);
  75. transition-delay: var(--delay);
  76. .text {
  77. transition-delay: var(--delay);
  78. opacity: 1;
  79. transform: translate(0);
  80. }
  81. }
  82. .text,
  83. .icon {
  84. display: flex;
  85. align-items: center;
  86. justify-content: center;
  87. }
  88. }
  89. }
  90. .prompt-toast {
  91. position: absolute;
  92. bottom: -50px;
  93. z-index: 999;
  94. display: flex;
  95. justify-content: center;
  96. width: calc(100% - 40px);
  97. .prompt-toast-inner {
  98. display: flex;
  99. justify-content: center;
  100. align-items: center;
  101. font-size: 12px;
  102. background-color: var(--white);
  103. color: var(--black);
  104. border: var(--border-in-light);
  105. box-shadow: var(--card-shadow);
  106. padding: 10px 20px;
  107. border-radius: 100px;
  108. animation: slide-in-from-top ease 0.3s;
  109. .prompt-toast-content {
  110. margin-left: 10px;
  111. }
  112. }
  113. }
  114. .section-title {
  115. font-size: 12px;
  116. font-weight: bold;
  117. margin-bottom: 10px;
  118. display: flex;
  119. justify-content: space-between;
  120. align-items: center;
  121. .section-title-action {
  122. display: flex;
  123. align-items: center;
  124. }
  125. }
  126. .context-prompt {
  127. .context-prompt-insert {
  128. display: flex;
  129. justify-content: center;
  130. padding: 4px;
  131. opacity: 0.2;
  132. transition: all ease 0.3s;
  133. background-color: rgba(0, 0, 0, 0);
  134. cursor: pointer;
  135. border-radius: 4px;
  136. margin-top: 4px;
  137. margin-bottom: 4px;
  138. &:hover {
  139. opacity: 1;
  140. background-color: rgba(0, 0, 0, 0.05);
  141. }
  142. }
  143. .context-prompt-row {
  144. display: flex;
  145. justify-content: center;
  146. width: 100%;
  147. &:hover {
  148. .context-drag {
  149. opacity: 1;
  150. }
  151. }
  152. .context-drag {
  153. display: flex;
  154. align-items: center;
  155. opacity: 0.5;
  156. transition: all ease 0.3s;
  157. }
  158. .context-role {
  159. margin-right: 10px;
  160. }
  161. .context-content {
  162. flex: 1;
  163. max-width: 100%;
  164. text-align: left;
  165. }
  166. .context-delete-button {
  167. margin-left: 10px;
  168. }
  169. }
  170. .context-prompt-button {
  171. flex: 1;
  172. }
  173. }
  174. .memory-prompt {
  175. margin: 20px 0;
  176. .memory-prompt-content {
  177. background-color: var(--white);
  178. color: var(--black);
  179. border: var(--border-in-light);
  180. border-radius: 10px;
  181. padding: 10px;
  182. font-size: 12px;
  183. user-select: text;
  184. }
  185. }
  186. .clear-context {
  187. margin: 20px 0 0 0;
  188. padding: 4px 0;
  189. border-top: var(--border-in-light);
  190. border-bottom: var(--border-in-light);
  191. box-shadow: var(--card-shadow) inset;
  192. display: flex;
  193. justify-content: center;
  194. align-items: center;
  195. color: var(--black);
  196. transition: all ease 0.3s;
  197. cursor: pointer;
  198. overflow: hidden;
  199. position: relative;
  200. font-size: 12px;
  201. animation: slide-in ease 0.3s;
  202. $linear: linear-gradient(
  203. to right,
  204. rgba(0, 0, 0, 0),
  205. rgba(0, 0, 0, 1),
  206. rgba(0, 0, 0, 0)
  207. );
  208. mask-image: $linear;
  209. @mixin show {
  210. transform: translateY(0);
  211. position: relative;
  212. transition: all ease 0.3s;
  213. opacity: 1;
  214. }
  215. @mixin hide {
  216. transform: translateY(-50%);
  217. position: absolute;
  218. transition: all ease 0.1s;
  219. opacity: 0;
  220. }
  221. &-tips {
  222. @include show;
  223. opacity: 0.5;
  224. }
  225. &-revert-btn {
  226. color: var(--primary);
  227. @include hide;
  228. }
  229. &:hover {
  230. opacity: 1;
  231. border-color: var(--primary);
  232. .clear-context-tips {
  233. @include hide;
  234. }
  235. .clear-context-revert-btn {
  236. @include show;
  237. }
  238. }
  239. }
  240. .chat {
  241. display: flex;
  242. flex-direction: column;
  243. position: relative;
  244. height: 100%;
  245. }
  246. .chat-body {
  247. flex: 1;
  248. overflow: auto;
  249. overflow-x: hidden;
  250. padding: 20px;
  251. padding-bottom: 40px;
  252. position: relative;
  253. overscroll-behavior: none;
  254. }
  255. .chat-body-main-title {
  256. cursor: pointer;
  257. &:hover {
  258. text-decoration: underline;
  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. .chat-model-name {
  301. font-size: 12px;
  302. color: var(--black);
  303. margin-left: 6px;
  304. }
  305. }
  306. .chat-message-container {
  307. max-width: var(--message-max-width);
  308. display: flex;
  309. flex-direction: column;
  310. align-items: flex-start;
  311. &:hover {
  312. .chat-message-edit {
  313. opacity: 0.9;
  314. }
  315. .chat-message-actions {
  316. opacity: 1;
  317. pointer-events: all;
  318. transform: scale(1) translateY(0);
  319. }
  320. }
  321. }
  322. .chat-message-user > .chat-message-container {
  323. align-items: flex-end;
  324. }
  325. .chat-message-avatar {
  326. position: relative;
  327. .chat-message-edit {
  328. position: absolute;
  329. height: 100%;
  330. width: 100%;
  331. overflow: hidden;
  332. display: flex;
  333. align-items: center;
  334. justify-content: center;
  335. opacity: 0;
  336. transition: all ease 0.3s;
  337. button {
  338. padding: 7px;
  339. }
  340. }
  341. /* Specific styles for iOS devices */
  342. @media screen and (max-device-width: 812px) and (-webkit-min-device-pixel-ratio: 2) {
  343. @supports (-webkit-touch-callout: none) {
  344. .chat-message-edit {
  345. top: -8%;
  346. }
  347. }
  348. }
  349. }
  350. .chat-message-status {
  351. font-size: 12px;
  352. color: #aaa;
  353. line-height: 1.5;
  354. margin-top: 5px;
  355. }
  356. .chat-message-tools {
  357. font-size: 12px;
  358. color: #aaa;
  359. line-height: 1.5;
  360. margin-top: 5px;
  361. .chat-message-tool {
  362. display: flex;
  363. align-items: flex-end;
  364. svg {
  365. margin-left: 5px;
  366. margin-right: 5px;
  367. }
  368. }
  369. }
  370. .chat-message-item {
  371. box-sizing: border-box;
  372. max-width: 100%;
  373. margin-top: 10px;
  374. border-radius: 10px;
  375. background-color: rgba(0, 0, 0, 0.05);
  376. padding: 10px;
  377. font-size: 14px;
  378. user-select: text;
  379. word-break: break-word;
  380. border: var(--border-in-light);
  381. position: relative;
  382. transition: all ease 0.3s;
  383. }
  384. .chat-message-audio {
  385. display: flex;
  386. align-items: center;
  387. justify-content: space-between;
  388. border-radius: 10px;
  389. background-color: rgba(0, 0, 0, 0.05);
  390. border: var(--border-in-light);
  391. position: relative;
  392. transition: all ease 0.3s;
  393. margin-top: 10px;
  394. font-size: 14px;
  395. user-select: text;
  396. word-break: break-word;
  397. box-sizing: border-box;
  398. audio {
  399. height: 30px; /* 调整高度 */
  400. }
  401. }
  402. .chat-message-item-image {
  403. width: 100%;
  404. margin-top: 10px;
  405. }
  406. .chat-message-item-images {
  407. width: 100%;
  408. display: grid;
  409. justify-content: left;
  410. grid-gap: 10px;
  411. grid-template-columns: repeat(var(--image-count), auto);
  412. margin-top: 10px;
  413. }
  414. .chat-message-item-image-multi {
  415. object-fit: cover;
  416. background-size: cover;
  417. background-position: center;
  418. background-repeat: no-repeat;
  419. }
  420. .chat-message-item-image,
  421. .chat-message-item-image-multi {
  422. box-sizing: border-box;
  423. border-radius: 10px;
  424. border: rgba($color: #888, $alpha: 0.2) 1px solid;
  425. }
  426. @media only screen and (max-width: 600px) {
  427. $calc-image-width: calc(100vw / 3 * 2 / var(--image-count));
  428. .chat-message-item-image-multi {
  429. width: $calc-image-width;
  430. height: $calc-image-width;
  431. }
  432. .chat-message-item-image {
  433. max-width: calc(100vw / 3 * 2);
  434. }
  435. }
  436. @media screen and (min-width: 600px) {
  437. $max-image-width: calc(
  438. calc(1200px - var(--sidebar-width)) / 3 * 2 / var(--image-count)
  439. );
  440. $image-width: calc(
  441. calc(var(--window-width) - var(--sidebar-width)) / 3 * 2 /
  442. var(--image-count)
  443. );
  444. .chat-message-item-image-multi {
  445. width: $image-width;
  446. height: $image-width;
  447. max-width: $max-image-width;
  448. max-height: $max-image-width;
  449. }
  450. .chat-message-item-image {
  451. max-width: calc(calc(1200px - var(--sidebar-width)) / 3 * 2);
  452. }
  453. }
  454. .chat-message-action-date {
  455. font-size: 12px;
  456. opacity: 0.2;
  457. white-space: nowrap;
  458. transition: all ease 0.6s;
  459. color: var(--black);
  460. text-align: right;
  461. width: 100%;
  462. box-sizing: border-box;
  463. padding-right: 10px;
  464. pointer-events: none;
  465. z-index: 1;
  466. }
  467. .chat-message-user > .chat-message-container > .chat-message-item {
  468. background-color: var(--second);
  469. &:hover {
  470. min-width: 0;
  471. }
  472. }
  473. .chat-input-panel {
  474. position: relative;
  475. width: 100%;
  476. padding: 20px;
  477. padding-top: 10px;
  478. box-sizing: border-box;
  479. flex-direction: column;
  480. border-top: var(--border-in-light);
  481. box-shadow: var(--card-shadow);
  482. .chat-input-actions {
  483. .chat-input-action {
  484. margin-bottom: 10px;
  485. }
  486. }
  487. }
  488. @mixin single-line {
  489. white-space: nowrap;
  490. overflow: hidden;
  491. text-overflow: ellipsis;
  492. }
  493. .prompt-hints {
  494. min-height: 20px;
  495. width: 100%;
  496. max-height: 50vh;
  497. overflow: auto;
  498. display: flex;
  499. flex-direction: column-reverse;
  500. background-color: var(--white);
  501. border: var(--border-in-light);
  502. border-radius: 10px;
  503. margin-bottom: 10px;
  504. box-shadow: var(--shadow);
  505. .prompt-hint {
  506. color: var(--black);
  507. padding: 6px 10px;
  508. animation: slide-in ease 0.3s;
  509. cursor: pointer;
  510. transition: all ease 0.3s;
  511. border: transparent 1px solid;
  512. margin: 4px;
  513. border-radius: 8px;
  514. &:not(:last-child) {
  515. margin-top: 0;
  516. }
  517. .hint-title {
  518. font-size: 12px;
  519. font-weight: bolder;
  520. @include single-line();
  521. }
  522. .hint-content {
  523. font-size: 12px;
  524. @include single-line();
  525. }
  526. &-selected,
  527. &:hover {
  528. border-color: var(--primary);
  529. }
  530. }
  531. }
  532. .chat-input-panel-inner {
  533. cursor: text;
  534. display: flex;
  535. flex: 1;
  536. border-radius: 10px;
  537. border: var(--border-in-light);
  538. }
  539. .chat-input-panel-inner-attach {
  540. padding-bottom: 80px;
  541. }
  542. .chat-input-panel-inner:has(.chat-input:focus) {
  543. border: 1px solid var(--primary);
  544. }
  545. .chat-input {
  546. height: 100%;
  547. width: 100%;
  548. border-radius: 10px;
  549. border: none;
  550. box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.03);
  551. background-color: var(--white);
  552. color: var(--black);
  553. font-family: inherit;
  554. padding: 10px 90px 10px 14px;
  555. resize: none;
  556. outline: none;
  557. box-sizing: border-box;
  558. min-height: 68px;
  559. }
  560. .chat-input:focus {
  561. }
  562. .chat-input-send {
  563. background-color: var(--primary);
  564. color: white;
  565. position: absolute;
  566. right: 30px;
  567. bottom: 32px;
  568. }
  569. @media only screen and (max-width: 600px) {
  570. .chat-input {
  571. font-size: 16px;
  572. }
  573. .chat-input-send {
  574. bottom: 30px;
  575. }
  576. }
  577. .shortcut-key-container {
  578. padding: 10px;
  579. overflow-y: auto;
  580. display: flex;
  581. flex-direction: column;
  582. }
  583. .shortcut-key-grid {
  584. display: grid;
  585. grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  586. gap: 16px;
  587. }
  588. .shortcut-key-item {
  589. display: flex;
  590. justify-content: space-between;
  591. align-items: center;
  592. overflow: hidden;
  593. padding: 10px;
  594. background-color: var(--white);
  595. }
  596. .shortcut-key-title {
  597. font-size: 14px;
  598. color: var(--black);
  599. }
  600. .shortcut-key-keys {
  601. display: flex;
  602. gap: 8px;
  603. }
  604. .shortcut-key {
  605. display: flex;
  606. align-items: center;
  607. justify-content: center;
  608. border: var(--border-in-light);
  609. border-radius: 8px;
  610. padding: 4px;
  611. background-color: var(--gray);
  612. min-width: 32px;
  613. }
  614. .shortcut-key span {
  615. font-size: 12px;
  616. color: var(--black);
  617. }
  618. .chat-main {
  619. display: flex;
  620. height: 100%;
  621. width: 100%;
  622. position: relative;
  623. overflow: hidden;
  624. .chat-body-container {
  625. height: 100%;
  626. display: flex;
  627. flex-direction: column;
  628. flex: 1;
  629. width: 100%;
  630. }
  631. .chat-side-panel {
  632. position: absolute;
  633. inset: 0;
  634. background: var(--white);
  635. overflow: hidden;
  636. z-index: 10;
  637. transform: translateX(100%);
  638. transition: all ease 0.3s;
  639. &-show {
  640. transform: translateX(0);
  641. }
  642. }
  643. }