chat.module.scss 12 KB

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