chat.module.scss 8.0 KB

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