chat.module.scss 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  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. }
  296. .chat-message-status {
  297. font-size: 12px;
  298. color: #aaa;
  299. line-height: 1.5;
  300. margin-top: 5px;
  301. }
  302. .chat-message-item {
  303. box-sizing: border-box;
  304. max-width: 100%;
  305. margin-top: 10px;
  306. border-radius: 10px;
  307. background-color: rgba(0, 0, 0, 0.05);
  308. padding: 10px;
  309. font-size: 14px;
  310. user-select: text;
  311. word-break: break-word;
  312. border: var(--border-in-light);
  313. position: relative;
  314. transition: all ease 0.3s;
  315. }
  316. .chat-message-action-date {
  317. font-size: 12px;
  318. opacity: 0.2;
  319. white-space: nowrap;
  320. transition: all ease 0.6s;
  321. color: var(--black);
  322. text-align: right;
  323. width: 100%;
  324. box-sizing: border-box;
  325. padding-right: 10px;
  326. pointer-events: none;
  327. z-index: 1;
  328. }
  329. .chat-message-user > .chat-message-container > .chat-message-item {
  330. background-color: var(--second);
  331. &:hover {
  332. min-width: 0;
  333. }
  334. }
  335. .chat-input-panel {
  336. position: relative;
  337. width: 100%;
  338. padding: 20px;
  339. padding-top: 10px;
  340. box-sizing: border-box;
  341. flex-direction: column;
  342. border-top: var(--border-in-light);
  343. box-shadow: var(--card-shadow);
  344. .chat-input-actions {
  345. .chat-input-action {
  346. margin-bottom: 10px;
  347. }
  348. }
  349. }
  350. @mixin single-line {
  351. white-space: nowrap;
  352. overflow: hidden;
  353. text-overflow: ellipsis;
  354. }
  355. .prompt-hints {
  356. min-height: 20px;
  357. width: 100%;
  358. max-height: 50vh;
  359. overflow: auto;
  360. display: flex;
  361. flex-direction: column-reverse;
  362. background-color: var(--white);
  363. border: var(--border-in-light);
  364. border-radius: 10px;
  365. margin-bottom: 10px;
  366. box-shadow: var(--shadow);
  367. .prompt-hint {
  368. color: var(--black);
  369. padding: 6px 10px;
  370. animation: slide-in ease 0.3s;
  371. cursor: pointer;
  372. transition: all ease 0.3s;
  373. border: transparent 1px solid;
  374. margin: 4px;
  375. border-radius: 8px;
  376. &:not(:last-child) {
  377. margin-top: 0;
  378. }
  379. .hint-title {
  380. font-size: 12px;
  381. font-weight: bolder;
  382. @include single-line();
  383. }
  384. .hint-content {
  385. font-size: 12px;
  386. @include single-line();
  387. }
  388. &-selected,
  389. &:hover {
  390. border-color: var(--primary);
  391. }
  392. }
  393. }
  394. .chat-input-panel-inner {
  395. display: flex;
  396. flex: 1;
  397. }
  398. .chat-input {
  399. height: 100%;
  400. width: 100%;
  401. border-radius: 10px;
  402. border: var(--border-in-light);
  403. box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.03);
  404. background-color: var(--white);
  405. color: var(--black);
  406. font-family: inherit;
  407. padding: 10px 90px 10px 14px;
  408. resize: none;
  409. outline: none;
  410. box-sizing: border-box;
  411. min-height: 68px;
  412. }
  413. .chat-input:focus {
  414. border: 1px solid var(--primary);
  415. }
  416. .chat-input-send {
  417. background-color: var(--primary);
  418. color: white;
  419. position: absolute;
  420. right: 30px;
  421. bottom: 32px;
  422. }
  423. @media only screen and (max-width: 600px) {
  424. .chat-input {
  425. font-size: 16px;
  426. }
  427. .chat-input-send {
  428. bottom: 30px;
  429. }
  430. }