chat.module.scss 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  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(
  199. to right,
  200. rgba(0, 0, 0, 0),
  201. rgba(0, 0, 0, 1),
  202. rgba(0, 0, 0, 0)
  203. );
  204. mask-image: $linear;
  205. @mixin show {
  206. transform: translateY(0);
  207. position: relative;
  208. transition: all ease 0.3s;
  209. opacity: 1;
  210. }
  211. @mixin hide {
  212. transform: translateY(-50%);
  213. position: absolute;
  214. transition: all ease 0.1s;
  215. opacity: 0;
  216. }
  217. &-tips {
  218. @include show;
  219. opacity: 0.5;
  220. }
  221. &-revert-btn {
  222. color: var(--primary);
  223. @include hide;
  224. }
  225. &:hover {
  226. opacity: 1;
  227. border-color: var(--primary);
  228. .clear-context-tips {
  229. @include hide;
  230. }
  231. .clear-context-revert-btn {
  232. @include show;
  233. }
  234. }
  235. }
  236. .chat {
  237. display: flex;
  238. flex-direction: column;
  239. position: relative;
  240. height: 100%;
  241. }
  242. .chat-body {
  243. flex: 1;
  244. overflow: auto;
  245. overflow-x: hidden;
  246. padding: 20px;
  247. padding-bottom: 40px;
  248. position: relative;
  249. overscroll-behavior: none;
  250. }
  251. .chat-body-main-title {
  252. cursor: pointer;
  253. &:hover {
  254. text-decoration: underline;
  255. }
  256. }
  257. @media only screen and (max-width: 600px) {
  258. .chat-body-title {
  259. text-align: center;
  260. }
  261. }
  262. .chat-message {
  263. display: flex;
  264. flex-direction: row;
  265. &:last-child {
  266. animation: slide-in ease 0.3s;
  267. }
  268. }
  269. .chat-message-user {
  270. display: flex;
  271. flex-direction: row-reverse;
  272. .chat-message-header {
  273. flex-direction: row-reverse;
  274. }
  275. }
  276. .chat-message-header {
  277. margin-top: 20px;
  278. display: flex;
  279. align-items: center;
  280. .chat-message-actions {
  281. display: flex;
  282. box-sizing: border-box;
  283. font-size: 12px;
  284. align-items: flex-end;
  285. justify-content: space-between;
  286. transition: all ease 0.3s;
  287. transform: scale(0.9) translateY(5px);
  288. margin: 0 10px;
  289. opacity: 0;
  290. pointer-events: none;
  291. .chat-input-actions {
  292. display: flex;
  293. flex-wrap: nowrap;
  294. }
  295. }
  296. }
  297. .chat-message-container {
  298. max-width: var(--message-max-width);
  299. display: flex;
  300. flex-direction: column;
  301. align-items: flex-start;
  302. &:hover {
  303. .chat-message-edit {
  304. opacity: 0.9;
  305. }
  306. .chat-message-actions {
  307. opacity: 1;
  308. pointer-events: all;
  309. transform: scale(1) translateY(0);
  310. }
  311. }
  312. }
  313. .chat-message-user > .chat-message-container {
  314. align-items: flex-end;
  315. }
  316. .chat-message-avatar {
  317. position: relative;
  318. .chat-message-edit {
  319. position: absolute;
  320. height: 100%;
  321. width: 100%;
  322. overflow: hidden;
  323. display: flex;
  324. align-items: center;
  325. justify-content: center;
  326. opacity: 0;
  327. transition: all ease 0.3s;
  328. button {
  329. padding: 7px;
  330. }
  331. }
  332. /* Specific styles for iOS devices */
  333. @media screen and (max-device-width: 812px) and (-webkit-min-device-pixel-ratio: 2) {
  334. @supports (-webkit-touch-callout: none) {
  335. .chat-message-edit {
  336. top: -8%;
  337. }
  338. }
  339. }
  340. }
  341. .chat-message-status {
  342. font-size: 12px;
  343. color: #aaa;
  344. line-height: 1.5;
  345. margin-top: 5px;
  346. }
  347. .chat-message-item {
  348. box-sizing: border-box;
  349. max-width: 100%;
  350. margin-top: 10px;
  351. border-radius: 10px;
  352. background-color: rgba(0, 0, 0, 0.05);
  353. padding: 10px;
  354. font-size: 14px;
  355. user-select: text;
  356. word-break: break-word;
  357. border: var(--border-in-light);
  358. position: relative;
  359. transition: all ease 0.3s;
  360. }
  361. .chat-message-item-image {
  362. width: 100%;
  363. margin-top: 10px;
  364. }
  365. .chat-message-item-images {
  366. width: 100%;
  367. display: grid;
  368. justify-content: left;
  369. grid-gap: 10px;
  370. grid-template-columns: repeat(var(--image-count), auto);
  371. margin-top: 10px;
  372. }
  373. .chat-message-item-image-multi {
  374. object-fit: cover;
  375. background-size: cover;
  376. background-position: center;
  377. background-repeat: no-repeat;
  378. }
  379. .chat-message-item-image,
  380. .chat-message-item-image-multi {
  381. box-sizing: border-box;
  382. border-radius: 10px;
  383. border: rgba($color: #888, $alpha: 0.2) 1px solid;
  384. }
  385. @media only screen and (max-width: 600px) {
  386. $calc-image-width: calc(100vw / 3 * 2 / var(--image-count));
  387. .chat-message-item-image-multi {
  388. width: $calc-image-width;
  389. height: $calc-image-width;
  390. }
  391. .chat-message-item-image {
  392. max-width: calc(100vw / 3 * 2);
  393. }
  394. }
  395. @media screen and (min-width: 600px) {
  396. $max-image-width: calc(
  397. calc(1200px - var(--sidebar-width)) / 3 * 2 / var(--image-count)
  398. );
  399. $image-width: calc(
  400. calc(var(--window-width) - var(--sidebar-width)) / 3 * 2 /
  401. var(--image-count)
  402. );
  403. .chat-message-item-image-multi {
  404. width: $image-width;
  405. height: $image-width;
  406. max-width: $max-image-width;
  407. max-height: $max-image-width;
  408. }
  409. .chat-message-item-image {
  410. max-width: calc(calc(1200px - var(--sidebar-width)) / 3 * 2);
  411. }
  412. }
  413. .chat-message-action-date {
  414. font-size: 12px;
  415. opacity: 0.2;
  416. white-space: nowrap;
  417. transition: all ease 0.6s;
  418. color: var(--black);
  419. text-align: right;
  420. width: 100%;
  421. box-sizing: border-box;
  422. padding-right: 10px;
  423. pointer-events: none;
  424. z-index: 1;
  425. }
  426. .chat-message-user > .chat-message-container > .chat-message-item {
  427. background-color: var(--second);
  428. &:hover {
  429. min-width: 0;
  430. }
  431. }
  432. .chat-input-panel {
  433. position: relative;
  434. width: 100%;
  435. padding: 20px;
  436. padding-top: 10px;
  437. box-sizing: border-box;
  438. flex-direction: column;
  439. border-top: var(--border-in-light);
  440. box-shadow: var(--card-shadow);
  441. .chat-input-actions {
  442. .chat-input-action {
  443. margin-bottom: 10px;
  444. }
  445. }
  446. }
  447. @mixin single-line {
  448. white-space: nowrap;
  449. overflow: hidden;
  450. text-overflow: ellipsis;
  451. }
  452. .prompt-hints {
  453. min-height: 20px;
  454. width: 100%;
  455. max-height: 50vh;
  456. overflow: auto;
  457. display: flex;
  458. flex-direction: column-reverse;
  459. background-color: var(--white);
  460. border: var(--border-in-light);
  461. border-radius: 10px;
  462. margin-bottom: 10px;
  463. box-shadow: var(--shadow);
  464. .prompt-hint {
  465. color: var(--black);
  466. padding: 6px 10px;
  467. animation: slide-in ease 0.3s;
  468. cursor: pointer;
  469. transition: all ease 0.3s;
  470. border: transparent 1px solid;
  471. margin: 4px;
  472. border-radius: 8px;
  473. &:not(:last-child) {
  474. margin-top: 0;
  475. }
  476. .hint-title {
  477. font-size: 12px;
  478. font-weight: bolder;
  479. @include single-line();
  480. }
  481. .hint-content {
  482. font-size: 12px;
  483. @include single-line();
  484. }
  485. &-selected,
  486. &:hover {
  487. border-color: var(--primary);
  488. }
  489. }
  490. }
  491. .chat-input-panel-inner {
  492. cursor: text;
  493. display: flex;
  494. flex: 1;
  495. border-radius: 10px;
  496. border: var(--border-in-light);
  497. }
  498. .chat-input-panel-inner-attach {
  499. padding-bottom: 80px;
  500. }
  501. .chat-input-panel-inner:has(.chat-input:focus) {
  502. border: 1px solid var(--primary);
  503. }
  504. .chat-input {
  505. height: 100%;
  506. width: 100%;
  507. border-radius: 10px;
  508. border: none;
  509. box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.03);
  510. background-color: var(--white);
  511. color: var(--black);
  512. font-family: inherit;
  513. padding: 10px 90px 10px 14px;
  514. resize: none;
  515. outline: none;
  516. box-sizing: border-box;
  517. min-height: 68px;
  518. }
  519. .chat-input:focus {
  520. }
  521. .chat-input-send {
  522. background-color: var(--primary);
  523. color: white;
  524. position: absolute;
  525. right: 30px;
  526. bottom: 32px;
  527. }
  528. @media only screen and (max-width: 600px) {
  529. .chat-input {
  530. font-size: 16px;
  531. }
  532. .chat-input-send {
  533. bottom: 30px;
  534. }
  535. }