chat.css 14 KB

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