chat.module.scss 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  1. @import "../styles/animation.scss";
  2. .chat-input-actions {
  3. display: flex;
  4. flex-wrap: wrap;
  5. .chat-input-action {
  6. display: inline-flex;
  7. border-radius: 20px;
  8. font-size: 12px;
  9. background-color: var(--white);
  10. color: var(--black);
  11. border: var(--border-in-light);
  12. padding: 4px 10px;
  13. animation: slide-in ease 0.3s;
  14. box-shadow: var(--card-shadow);
  15. transition: width ease 0.3s;
  16. align-items: center;
  17. height: 16px;
  18. width: var(--icon-width);
  19. overflow: hidden;
  20. &:not(:last-child) {
  21. margin-right: 5px;
  22. }
  23. .text {
  24. white-space: nowrap;
  25. padding-left: 5px;
  26. opacity: 0;
  27. transform: translateX(-5px);
  28. transition: all ease 0.3s;
  29. pointer-events: none;
  30. }
  31. &:hover {
  32. --delay: 0.5s;
  33. width: var(--full-width);
  34. transition-delay: var(--delay);
  35. .text {
  36. transition-delay: var(--delay);
  37. opacity: 1;
  38. transform: translate(0);
  39. }
  40. }
  41. .text,
  42. .icon {
  43. display: flex;
  44. align-items: center;
  45. justify-content: center;
  46. }
  47. }
  48. }
  49. .prompt-toast {
  50. position: absolute;
  51. bottom: -50px;
  52. z-index: 999;
  53. display: flex;
  54. justify-content: center;
  55. width: calc(100% - 40px);
  56. .prompt-toast-inner {
  57. display: flex;
  58. justify-content: center;
  59. align-items: center;
  60. font-size: 12px;
  61. background-color: var(--white);
  62. color: var(--black);
  63. border: var(--border-in-light);
  64. box-shadow: var(--card-shadow);
  65. padding: 10px 20px;
  66. border-radius: 100px;
  67. animation: slide-in-from-top ease 0.3s;
  68. .prompt-toast-content {
  69. margin-left: 10px;
  70. }
  71. }
  72. }
  73. .section-title {
  74. font-size: 12px;
  75. font-weight: bold;
  76. margin-bottom: 10px;
  77. display: flex;
  78. justify-content: space-between;
  79. align-items: center;
  80. .section-title-action {
  81. display: flex;
  82. align-items: center;
  83. }
  84. }
  85. .context-prompt {
  86. .context-prompt-insert {
  87. display: flex;
  88. justify-content: center;
  89. padding: 4px;
  90. opacity: 0.2;
  91. transition: all ease 0.3s;
  92. background-color: rgba(0, 0, 0, 0);
  93. cursor: pointer;
  94. border-radius: 4px;
  95. margin-top: 4px;
  96. margin-bottom: 4px;
  97. &:hover {
  98. opacity: 1;
  99. background-color: rgba(0, 0, 0, 0.05);
  100. }
  101. }
  102. .context-prompt-row {
  103. display: flex;
  104. justify-content: center;
  105. width: 100%;
  106. &:hover {
  107. .context-drag {
  108. opacity: 1;
  109. }
  110. }
  111. .context-drag {
  112. display: flex;
  113. align-items: center;
  114. opacity: 0.5;
  115. transition: all ease 0.3s;
  116. }
  117. .context-role {
  118. margin-right: 10px;
  119. }
  120. .context-content {
  121. flex: 1;
  122. max-width: 100%;
  123. text-align: left;
  124. }
  125. .context-delete-button {
  126. margin-left: 10px;
  127. }
  128. }
  129. .context-prompt-button {
  130. flex: 1;
  131. }
  132. }
  133. .memory-prompt {
  134. margin: 20px 0;
  135. .memory-prompt-content {
  136. background-color: var(--white);
  137. color: var(--black);
  138. border: var(--border-in-light);
  139. border-radius: 10px;
  140. padding: 10px;
  141. font-size: 12px;
  142. user-select: text;
  143. }
  144. }
  145. .clear-context {
  146. margin: 20px 0 0 0;
  147. padding: 4px 0;
  148. border-top: var(--border-in-light);
  149. border-bottom: var(--border-in-light);
  150. box-shadow: var(--card-shadow) inset;
  151. display: flex;
  152. justify-content: center;
  153. align-items: center;
  154. color: var(--black);
  155. transition: all ease 0.3s;
  156. cursor: pointer;
  157. overflow: hidden;
  158. position: relative;
  159. font-size: 12px;
  160. animation: slide-in ease 0.3s;
  161. $linear: linear-gradient(
  162. to right,
  163. rgba(0, 0, 0, 0),
  164. rgba(0, 0, 0, 1),
  165. rgba(0, 0, 0, 0)
  166. );
  167. mask-image: $linear;
  168. @mixin show {
  169. transform: translateY(0);
  170. position: relative;
  171. transition: all ease 0.3s;
  172. opacity: 1;
  173. }
  174. @mixin hide {
  175. transform: translateY(-50%);
  176. position: absolute;
  177. transition: all ease 0.1s;
  178. opacity: 0;
  179. }
  180. &-tips {
  181. @include show;
  182. opacity: 0.5;
  183. }
  184. &-revert-btn {
  185. color: var(--primary);
  186. @include hide;
  187. }
  188. &:hover {
  189. opacity: 1;
  190. border-color: var(--primary);
  191. .clear-context-tips {
  192. @include hide;
  193. }
  194. .clear-context-revert-btn {
  195. @include show;
  196. }
  197. }
  198. }
  199. .chat {
  200. display: flex;
  201. flex-direction: column;
  202. position: relative;
  203. height: 100%;
  204. }
  205. .chat-body {
  206. flex: 1;
  207. overflow: auto;
  208. overflow-x: hidden;
  209. padding: 20px;
  210. padding-bottom: 40px;
  211. position: relative;
  212. overscroll-behavior: none;
  213. }
  214. .chat-body-main-title {
  215. cursor: pointer;
  216. &:hover {
  217. text-decoration: underline;
  218. }
  219. }
  220. @media only screen and (max-width: 600px) {
  221. .chat-body-title {
  222. text-align: center;
  223. }
  224. }
  225. .chat-message {
  226. display: flex;
  227. flex-direction: row;
  228. &:last-child {
  229. animation: slide-in ease 0.3s;
  230. }
  231. }
  232. .chat-message-user {
  233. display: flex;
  234. flex-direction: row-reverse;
  235. .chat-message-header {
  236. flex-direction: row-reverse;
  237. }
  238. }
  239. .chat-message-header {
  240. margin-top: 20px;
  241. display: flex;
  242. align-items: center;
  243. .chat-message-actions {
  244. display: flex;
  245. box-sizing: border-box;
  246. font-size: 12px;
  247. align-items: flex-end;
  248. justify-content: space-between;
  249. transition: all ease 0.3s;
  250. transform: scale(0.9) translateY(5px);
  251. margin: 0 10px;
  252. opacity: 0;
  253. pointer-events: none;
  254. .chat-input-actions {
  255. display: flex;
  256. flex-wrap: nowrap;
  257. }
  258. }
  259. }
  260. .chat-message-container {
  261. max-width: var(--message-max-width);
  262. display: flex;
  263. flex-direction: column;
  264. align-items: flex-start;
  265. &:hover {
  266. .chat-message-edit {
  267. opacity: 0.9;
  268. }
  269. .chat-message-actions {
  270. opacity: 1;
  271. pointer-events: all;
  272. transform: scale(1) translateY(0);
  273. }
  274. }
  275. }
  276. .chat-message-user > .chat-message-container {
  277. align-items: flex-end;
  278. }
  279. .chat-message-avatar {
  280. position: relative;
  281. .chat-message-edit {
  282. position: absolute;
  283. height: 100%;
  284. width: 100%;
  285. overflow: hidden;
  286. display: flex;
  287. align-items: center;
  288. justify-content: center;
  289. opacity: 0;
  290. transition: all ease 0.3s;
  291. button {
  292. padding: 7px;
  293. }
  294. }
  295. /* Specific styles for iOS devices */
  296. @media screen and (max-device-width: 812px) and (-webkit-min-device-pixel-ratio: 2) {
  297. @supports (-webkit-touch-callout: none) {
  298. .chat-message-edit {
  299. top: -8%;
  300. }
  301. }
  302. }
  303. }
  304. .chat-message-status {
  305. font-size: 12px;
  306. color: #aaa;
  307. line-height: 1.5;
  308. margin-top: 5px;
  309. }
  310. .chat-message-item {
  311. box-sizing: border-box;
  312. max-width: 100%;
  313. margin-top: 10px;
  314. border-radius: 10px;
  315. background-color: rgba(0, 0, 0, 0.05);
  316. padding: 10px;
  317. font-size: 14px;
  318. user-select: text;
  319. word-break: break-word;
  320. border: var(--border-in-light);
  321. position: relative;
  322. transition: all ease 0.3s;
  323. }
  324. .chat-message-action-date {
  325. font-size: 12px;
  326. opacity: 0.2;
  327. white-space: nowrap;
  328. transition: all ease 0.6s;
  329. color: var(--black);
  330. text-align: right;
  331. width: 100%;
  332. box-sizing: border-box;
  333. padding-right: 10px;
  334. pointer-events: none;
  335. z-index: 1;
  336. }
  337. .chat-message-user > .chat-message-container > .chat-message-item {
  338. background-color: var(--second);
  339. &:hover {
  340. min-width: 0;
  341. }
  342. }
  343. .chat-input-panel {
  344. position: relative;
  345. width: 100%;
  346. padding: 20px;
  347. padding-top: 10px;
  348. box-sizing: border-box;
  349. flex-direction: column;
  350. border-top: var(--border-in-light);
  351. box-shadow: var(--card-shadow);
  352. .chat-input-actions {
  353. .chat-input-action {
  354. margin-bottom: 10px;
  355. }
  356. }
  357. }
  358. @mixin single-line {
  359. white-space: nowrap;
  360. overflow: hidden;
  361. text-overflow: ellipsis;
  362. }
  363. .prompt-hints {
  364. min-height: 20px;
  365. width: 100%;
  366. max-height: 50vh;
  367. overflow: auto;
  368. display: flex;
  369. flex-direction: column-reverse;
  370. background-color: var(--white);
  371. border: var(--border-in-light);
  372. border-radius: 10px;
  373. margin-bottom: 10px;
  374. box-shadow: var(--shadow);
  375. .prompt-hint {
  376. color: var(--black);
  377. padding: 6px 10px;
  378. animation: slide-in ease 0.3s;
  379. cursor: pointer;
  380. transition: all ease 0.3s;
  381. border: transparent 1px solid;
  382. margin: 4px;
  383. border-radius: 8px;
  384. &:not(:last-child) {
  385. margin-top: 0;
  386. }
  387. .hint-title {
  388. font-size: 12px;
  389. font-weight: bolder;
  390. @include single-line();
  391. }
  392. .hint-content {
  393. font-size: 12px;
  394. @include single-line();
  395. }
  396. &-selected,
  397. &:hover {
  398. border-color: var(--primary);
  399. }
  400. }
  401. }
  402. .chat-input-panel-inner {
  403. display: flex;
  404. flex: 1;
  405. }
  406. .chat-input {
  407. height: 100%;
  408. width: 100%;
  409. border-radius: 10px;
  410. border: var(--border-in-light);
  411. box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.03);
  412. background-color: var(--white);
  413. color: var(--black);
  414. font-family: inherit;
  415. padding: 10px 90px 10px 14px;
  416. resize: none;
  417. outline: none;
  418. box-sizing: border-box;
  419. min-height: 68px;
  420. }
  421. .chat-input:focus {
  422. border: 1px solid var(--primary);
  423. }
  424. .chat-input-send {
  425. background-color: var(--primary);
  426. color: white;
  427. position: absolute;
  428. right: 30px;
  429. bottom: 32px;
  430. }
  431. @media only screen and (max-width: 600px) {
  432. .chat-input {
  433. font-size: 16px;
  434. }
  435. .chat-input-send {
  436. bottom: 30px;
  437. }
  438. }