chat.css 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779
  1. .chat-container {
  2. display: flex;
  3. flex-direction: column;
  4. height: calc(100vh - 60px); /* 减去header高度 */
  5. background: #fcfcfd; /* 更浅的背景色,接近白色 */
  6. }
  7. .chat-messages {
  8. flex: 1;
  9. overflow-y: auto;
  10. padding: 20px;
  11. display: flex;
  12. flex-direction: column;
  13. gap: 16px;
  14. scroll-behavior: smooth;
  15. background: #fcfcfd; /* 与容器背景保持一致 */
  16. }
  17. .message {
  18. display: flex;
  19. align-items: flex-start;
  20. max-width: 85%;
  21. margin-bottom: 4px;
  22. }
  23. .message.user {
  24. margin-left: auto;
  25. }
  26. .message-content {
  27. position: relative;
  28. padding: 12px 16px;
  29. border-radius: 12px;
  30. background: #fff;
  31. box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  32. transition: all 0.3s ease;
  33. }
  34. .message.assistant .message-content {
  35. background: #f0f4f8; /* AI消息背景色 */
  36. border-top-left-radius: 4px;
  37. }
  38. .message.user .message-content {
  39. background: #e8f4ff; /* 用户消息背景色 */
  40. border-top-right-radius: 4px;
  41. }
  42. .message p {
  43. margin: 0;
  44. line-height: 1.5;
  45. color: #333;
  46. }
  47. .chat-input-container {
  48. position: sticky !important; /* 确保固定在底部 */
  49. bottom: 0 !important;
  50. padding: 16px !important;
  51. background: #fff !important;
  52. border-top: 1px solid #f0f0f0 !important;
  53. z-index: 1 !important; /* 确保在消息上方 */
  54. }
  55. .input-wrapper {
  56. position: relative !important;
  57. display: flex !important;
  58. gap: 8px !important;
  59. background: #f0f4f8 !important;
  60. border-radius: 8px !important;
  61. padding: 8px 12px !important;
  62. transition: all 0.3s ease-out !important;
  63. will-change: min-height, max-height !important;
  64. min-height: 40px !important; /* 设置最小高度 */
  65. max-height: 120px !important; /* 设置最大高度 */
  66. }
  67. .input-wrapper:focus-within {
  68. box-shadow: 0 0 0 1px #1a73e8;
  69. }
  70. #chat-input {
  71. flex: 1 !important;
  72. border: none !important;
  73. background: transparent !important;
  74. resize: none !important;
  75. padding: 8px !important;
  76. font-size: 14px !important;
  77. line-height: 1.5 !important;
  78. min-height: 24px !important; /* 设置最小高度 */
  79. max-height: 100px !important; /* 设置最大高度 */
  80. outline: none !important;
  81. color: #333 !important;
  82. overflow-y: auto !important; /* 允许内容超出时滚动 */
  83. }
  84. /* 确保输入框placeholder样式一致 */
  85. #chat-input::placeholder {
  86. opacity: 1 !important;
  87. color: #999 !important;
  88. line-height: 24px !important;
  89. }
  90. /* 输入框禁用状态样式 */
  91. #chat-input:disabled {
  92. cursor: not-allowed !important;
  93. color: #999 !important;
  94. background: #f5f5f5 !important;
  95. }
  96. .input-buttons {
  97. display: flex;
  98. align-items: center;
  99. gap: 8px;
  100. }
  101. .icon-button {
  102. position: relative;
  103. overflow: hidden;
  104. background: none;
  105. border: none;
  106. padding: 6px;
  107. cursor: pointer;
  108. color: #666;
  109. border-radius: 4px;
  110. transition: all 0.2s;
  111. }
  112. .icon-button::after {
  113. content: "";
  114. position: absolute;
  115. top: 50%;
  116. left: 50%;
  117. width: 100%;
  118. height: 100%;
  119. background: currentColor;
  120. border-radius: 50%;
  121. transform: translate(-50%, -50%) scale(0);
  122. opacity: 0;
  123. transition: all 0.2s ease;
  124. }
  125. .icon-button:hover::after {
  126. transform: translate(-50%, -50%) scale(1.5);
  127. opacity: 0.1;
  128. }
  129. /* 快捷指令面板 */
  130. .prompt-panel {
  131. position: absolute;
  132. bottom: 80px;
  133. left: 16px;
  134. right: 16px;
  135. background: #fff;
  136. border-radius: 8px;
  137. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  138. display: none;
  139. }
  140. .prompt-panel.show {
  141. display: block;
  142. animation: slideUp 0.2s ease-out;
  143. }
  144. .prompt-header {
  145. display: flex;
  146. justify-content: space-between;
  147. align-items: center;
  148. padding: 12px 16px;
  149. border-bottom: 1px solid #eee;
  150. }
  151. .prompt-header h3 {
  152. margin: 0;
  153. font-size: 16px;
  154. color: #333;
  155. }
  156. .close-prompt {
  157. background: none;
  158. border: none;
  159. font-size: 20px;
  160. color: #666;
  161. cursor: pointer;
  162. padding: 4px 8px;
  163. }
  164. .prompt-list {
  165. padding: 8px;
  166. max-height: 300px;
  167. overflow-y: auto;
  168. }
  169. .prompt-item {
  170. width: 100%;
  171. padding: 12px;
  172. text-align: left;
  173. background: none;
  174. border: none;
  175. border-radius: 6px;
  176. cursor: pointer;
  177. transition: all 0.2s;
  178. }
  179. .prompt-item:hover {
  180. background: #f5f5f5;
  181. }
  182. @keyframes slideUp {
  183. from {
  184. transform: translateY(20px);
  185. opacity: 0;
  186. }
  187. to {
  188. transform: translateY(0);
  189. opacity: 1;
  190. }
  191. }
  192. /* 滚动条样式 */
  193. .chat-messages::-webkit-scrollbar {
  194. width: 6px;
  195. }
  196. .chat-messages::-webkit-scrollbar-track {
  197. background: transparent;
  198. }
  199. .chat-messages::-webkit-scrollbar-thumb {
  200. background: #ddd;
  201. border-radius: 3px;
  202. }
  203. .chat-messages::-webkit-scrollbar-thumb:hover {
  204. background: #ccc;
  205. }
  206. /* 打字动画相关样式 */
  207. .message-content.typing {
  208. display: flex;
  209. flex-direction: column;
  210. }
  211. .message-content.typing p {
  212. display: inline;
  213. white-space: pre-wrap;
  214. word-break: break-word;
  215. }
  216. .message-content.typing p::after {
  217. content: "|";
  218. display: inline;
  219. margin-left: 1px;
  220. font-weight: bold;
  221. animation: blink 1s infinite;
  222. vertical-align: baseline;
  223. }
  224. @keyframes blink {
  225. 0%,
  226. 100% {
  227. opacity: 1;
  228. }
  229. 50% {
  230. opacity: 0;
  231. }
  232. }
  233. /* 加载动画样式 */
  234. .typing-indicator {
  235. display: flex;
  236. gap: 4px;
  237. padding: 4px 8px;
  238. }
  239. .typing-indicator span {
  240. width: 8px;
  241. height: 8px;
  242. background: #90a4ae;
  243. border-radius: 50%;
  244. animation: bounce 1.4s infinite ease-in-out;
  245. }
  246. .typing-indicator span:nth-child(1) {
  247. animation-delay: -0.32s;
  248. }
  249. .typing-indicator span:nth-child(2) {
  250. animation-delay: -0.16s;
  251. }
  252. @keyframes bounce {
  253. 0%,
  254. 80%,
  255. 100% {
  256. transform: scale(0);
  257. }
  258. 40% {
  259. transform: scale(1);
  260. }
  261. }
  262. /* 消息内容的过渡效果 */
  263. .message-content {
  264. transition: opacity 0.3s ease;
  265. }
  266. .message-content.loading {
  267. min-width: 60px;
  268. min-height: 24px;
  269. }
  270. /* 消息时间戳样式 */
  271. .message-timestamp {
  272. font-size: 12px;
  273. color: #999;
  274. line-height: 24px; /* 与按钮高度一致 */
  275. margin: 0; /* 移除可能的外边距 */
  276. padding: 0 2px; /* 添加少许水平内边距 */
  277. }
  278. /* 消息hover效果 */
  279. .message-content:hover {
  280. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  281. }
  282. /* 添加头像占位 */
  283. .message.assistant::before {
  284. content: "";
  285. width: 32px;
  286. height: 32px;
  287. min-width: 32px;
  288. margin-right: 8px;
  289. border-radius: 50%;
  290. background: #fff url("../images/icon128.png") center/cover no-repeat;
  291. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  292. transition: all 0.3s ease;
  293. }
  294. /* 头像悬停效果 */
  295. .message.assistant:hover::before {
  296. transform: scale(1.1);
  297. box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  298. }
  299. /* 消息分组 */
  300. .message + .message.assistant,
  301. .message + .message.user {
  302. margin-top: 2px;
  303. }
  304. .message:not(:first-child) {
  305. margin-top: 16px;
  306. }
  307. /* 添加新消息指示器 */
  308. .new-messages-indicator {
  309. position: absolute;
  310. bottom: 80px;
  311. left: 50%;
  312. transform: translateX(-50%);
  313. background: rgba(33, 150, 243, 0.9);
  314. color: #fff;
  315. padding: 8px 16px;
  316. border-radius: 20px;
  317. font-size: 14px;
  318. cursor: pointer;
  319. opacity: 0;
  320. transition: all 0.3s ease;
  321. pointer-events: none;
  322. }
  323. .new-messages-indicator.show {
  324. opacity: 1;
  325. pointer-events: auto;
  326. }
  327. /* 消息格式化样式 */
  328. .message-content p {
  329. margin: 0;
  330. line-height: 1.5;
  331. }
  332. .message-content pre {
  333. background: #f6f8fa;
  334. padding: 12px;
  335. border-radius: 6px;
  336. overflow-x: auto;
  337. margin: 8px 0;
  338. }
  339. .message-content code {
  340. font-family: monospace;
  341. background: #f6f8fa;
  342. padding: 2px 4px;
  343. border-radius: 4px;
  344. font-size: 0.9em;
  345. }
  346. .message-content pre code {
  347. padding: 0;
  348. background: none;
  349. }
  350. .message-content a {
  351. color: #1a73e8;
  352. text-decoration: none;
  353. }
  354. .message-content a:hover {
  355. text-decoration: underline;
  356. }
  357. .message-content strong {
  358. font-weight: 600;
  359. }
  360. .message-content em {
  361. font-style: italic;
  362. }
  363. /* 消息操作栏样式 */
  364. .message-actions {
  365. display: flex;
  366. justify-content: flex-end;
  367. align-items: center; /* 确保垂直居中对齐 */
  368. gap: 8px;
  369. margin-top: 4px;
  370. min-height: 24px; /* 设置最小高度确保一致性 */
  371. }
  372. /* 复制按钮样式 */
  373. .copy-button {
  374. display: flex;
  375. align-items: center;
  376. gap: 4px;
  377. height: 24px; /* 固定高度 */
  378. padding: 0 6px; /* 调整水平内边距 */
  379. font-size: 12px;
  380. color: #666;
  381. background: none;
  382. border: none;
  383. border-radius: 4px;
  384. cursor: pointer;
  385. transition: all 0.2s ease;
  386. }
  387. .copy-button:hover {
  388. background: rgba(0, 0, 0, 0.05);
  389. color: #1a73e8;
  390. }
  391. .copy-button svg {
  392. width: 14px;
  393. height: 14px;
  394. }
  395. /* 复制成功提示 */
  396. .copy-button.copied {
  397. color: #00c853;
  398. pointer-events: none;
  399. }
  400. /* Markdown样式 */
  401. .message-content h1,
  402. .message-content h2,
  403. .message-content h3,
  404. .message-content h4,
  405. .message-content h5,
  406. .message-content h6 {
  407. margin: 16px 0 8px;
  408. font-weight: 600;
  409. line-height: 1.25;
  410. color: #333;
  411. }
  412. .message-content h1 {
  413. font-size: 1.5em;
  414. }
  415. .message-content h2 {
  416. font-size: 1.3em;
  417. }
  418. .message-content h3 {
  419. font-size: 1.2em;
  420. }
  421. .message-content h4 {
  422. font-size: 1.1em;
  423. }
  424. .message-content h5 {
  425. font-size: 1em;
  426. }
  427. .message-content h6 {
  428. font-size: 0.9em;
  429. }
  430. .message-content ul,
  431. .message-content ol {
  432. margin: 8px 0;
  433. padding-left: 20px;
  434. }
  435. .message-content li {
  436. margin: 4px 0;
  437. }
  438. .message-content blockquote {
  439. margin: 8px 0;
  440. padding: 8px 16px;
  441. border-left: 4px solid #ddd;
  442. background: rgba(0, 0, 0, 0.02);
  443. color: #666;
  444. }
  445. .message-content hr {
  446. margin: 16px 0;
  447. border: none;
  448. border-top: 1px solid #eee;
  449. }
  450. /* 调整代码块样式 */
  451. .message-content pre {
  452. background: #f6f8fa;
  453. padding: 16px;
  454. border-radius: 6px;
  455. overflow-x: auto;
  456. margin: 8px 0;
  457. }
  458. .message-content pre code {
  459. padding: 0;
  460. background: none;
  461. font-size: 0.9em;
  462. line-height: 1.5;
  463. }
  464. /* 打断按钮样式 */
  465. .stop-button {
  466. display: none; /* 默认隐藏 */
  467. padding: 6px 12px;
  468. color: #666;
  469. background: none;
  470. border: 1px solid #ddd;
  471. border-radius: 4px;
  472. cursor: pointer;
  473. font-size: 12px;
  474. transition: all 0.2s ease;
  475. }
  476. .stop-button.show {
  477. display: flex;
  478. align-items: center;
  479. gap: 4px;
  480. }
  481. .stop-button:hover {
  482. color: #d32f2f;
  483. border-color: #d32f2f;
  484. background: rgba(211, 47, 47, 0.05);
  485. }
  486. .stop-button svg {
  487. width: 14px;
  488. height: 14px;
  489. }
  490. /* 中断消息样式 */
  491. .message.assistant .message-content.interrupted {
  492. background: #fff1f0;
  493. border-left: 4px solid #ff4d4f;
  494. border-top-left-radius: 0;
  495. padding-left: 12px;
  496. color: #cf1322;
  497. }
  498. .message-content.interrupted .message-timestamp {
  499. color: rgba(207, 19, 34, 0.6);
  500. }
  501. .input-wrapper.generating {
  502. background: #f5f5f5;
  503. }
  504. /* 修改:只禁用输入框和其他按钮 */
  505. .input-wrapper.generating #chat-input,
  506. .input-wrapper.generating .icon-button {
  507. pointer-events: none;
  508. opacity: 0.5; /* 添加透明度表示禁用状态 */
  509. }
  510. .input-wrapper.generating #chat-input::placeholder {
  511. color: #999;
  512. opacity: 0.8;
  513. }
  514. /* 确保只有停止按钮可以点击 */
  515. .input-wrapper.generating .stop-button {
  516. pointer-events: auto;
  517. opacity: 1; /* 保持完全不透明 */
  518. cursor: pointer;
  519. }
  520. /* 页面信息卡片 */
  521. .page-info-card {
  522. display: flex;
  523. align-items: center;
  524. gap: 12px;
  525. padding: 12px 16px;
  526. margin: 0 16px 8px; /* 保持底部间距为8px */
  527. background: #fff;
  528. border-radius: 8px;
  529. box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  530. }
  531. /* 网站图标 */
  532. .page-favicon {
  533. width: 16px;
  534. height: 16px;
  535. flex-shrink: 0;
  536. }
  537. /* 页面标题容器 */
  538. .page-title-container {
  539. flex: 1;
  540. position: relative;
  541. overflow: hidden;
  542. white-space: nowrap;
  543. scrollbar-width: none;
  544. -ms-overflow-style: none;
  545. }
  546. /* 隐藏滚动条但保持可滚动 */
  547. .page-title-container::-webkit-scrollbar {
  548. display: none;
  549. }
  550. /* 页面标题 */
  551. .page-title {
  552. font-size: 14px;
  553. color: #333;
  554. margin: 0;
  555. display: inline-block;
  556. position: relative; /* 添加相对定位 */
  557. padding-right: 20px;
  558. /* 移除这些可能导致标题消失的样式 */
  559. /* padding-left: 100%; */
  560. /* transform: translateX(-100%); */
  561. }
  562. /* 当容器被hover时启动滚动动画 */
  563. .page-title-container:hover .page-title {
  564. animation: scrollText 20s linear infinite; /* 增加动画时间到20秒 */
  565. }
  566. /* 修改滚动动画逻辑 */
  567. @keyframes scrollText {
  568. from {
  569. transform: translateX(0);
  570. }
  571. to {
  572. transform: translateX(-100%);
  573. }
  574. }
  575. /* 优化渐变遮罩 */
  576. .page-title-container::after {
  577. content: "";
  578. position: absolute;
  579. top: 0;
  580. right: 0;
  581. width: 30px; /* 减小遮罩宽度 */
  582. height: 100%;
  583. background: linear-gradient(
  584. to right,
  585. rgba(255, 255, 255, 0),
  586. rgba(255, 255, 255, 0.8)
  587. ); /* 降低不透明度 */
  588. pointer-events: none;
  589. }
  590. /* 添加左侧渐变遮罩 */
  591. .page-title-container::before {
  592. content: "";
  593. position: absolute;
  594. top: 0;
  595. left: 0;
  596. width: 30px; /* 减小遮罩宽度 */
  597. height: 100%;
  598. background: linear-gradient(
  599. to left,
  600. rgba(255, 255, 255, 0),
  601. rgba(255, 255, 255, 0.8)
  602. ); /* 降低不透明度 */
  603. pointer-events: none;
  604. z-index: 1;
  605. }
  606. /* 滚动时显示左侧遮罩 */
  607. .page-title-container:hover::before {
  608. opacity: 1;
  609. }
  610. /* 总结按钮 */
  611. .summarize-button {
  612. position: relative; /* 添加相对定位 */
  613. padding: 6px 12px;
  614. color: #1a73e8;
  615. background: #e8f0fe;
  616. border: none;
  617. border-radius: 4px;
  618. font-size: 13px;
  619. cursor: pointer;
  620. transition: all 0.2s ease;
  621. flex-shrink: 0;
  622. overflow: hidden; /* 确保星星不会溢出按钮区域 */
  623. }
  624. /* 星星元素 */
  625. .summarize-button::after {
  626. content: "✦";
  627. position: absolute;
  628. top: 0;
  629. right: 2px;
  630. font-size: 10px;
  631. opacity: 0;
  632. transform: translateY(10px);
  633. transition: all 0.3s ease;
  634. }
  635. /* 鼠标悬停时的动画效果 */
  636. .summarize-button:hover {
  637. background: #d2e3fc;
  638. transform: translateY(-1px);
  639. }
  640. .summarize-button:hover::after {
  641. opacity: 1;
  642. transform: translateY(0);
  643. animation: twinkle 1s infinite;
  644. }
  645. /* 点击效果 */
  646. .summarize-button:active {
  647. transform: translateY(0);
  648. }
  649. /* 星星闪烁动画 */
  650. @keyframes twinkle {
  651. 0% {
  652. opacity: 1;
  653. transform: scale(1) rotate(0deg);
  654. }
  655. 50% {
  656. opacity: 0.5;
  657. transform: scale(1.2) rotate(180deg);
  658. }
  659. 100% {
  660. opacity: 1;
  661. transform: scale(1) rotate(360deg);
  662. }
  663. }
  664. /* 输入框过渡动画 */
  665. .input-transition {
  666. transition: height 0.3s ease-out !important;
  667. will-change: height !important; /* 优化动画性能 */
  668. }
  669. #chat-input {
  670. flex: 1 !important;
  671. border: none !important;
  672. background: transparent !important;
  673. resize: none !important;
  674. padding: 8px !important;
  675. font-size: 14px !important;
  676. line-height: 1.5 !important;
  677. min-height: 24px !important;
  678. max-height: 100px !important;
  679. outline: none !important;
  680. color: #333 !important;
  681. overflow-y: auto !important;
  682. }