chat.css 14 KB

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