styles.css 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580
  1. :root {
  2. color-scheme: light dark;
  3. --bg-main: #f5f6f8;
  4. --bg-sidebar: #ffffff;
  5. --bg-panel: #ffffff;
  6. --border-color: #d8dce4;
  7. --primary: #1f77ff;
  8. --primary-text: #ffffff;
  9. --accent: #0d6efd;
  10. --text-color: #1a1a1a;
  11. --secondary-text: #6c757d;
  12. --user-message: #e9f2ff;
  13. --assistant-message: #f1f3f5;
  14. --shadow: 0 2px 12px rgba(15, 23, 42, 0.08);
  15. }
  16. * {
  17. box-sizing: border-box;
  18. }
  19. body {
  20. margin: 0;
  21. font-family: "PingFang SC", "Microsoft YaHei", "Helvetica", "Arial", sans-serif;
  22. background: var(--bg-main);
  23. color: var(--text-color);
  24. height: 100vh;
  25. display: flex;
  26. }
  27. .app-shell {
  28. display: flex;
  29. flex: 1;
  30. max-height: 100vh;
  31. width: 100%;
  32. }
  33. .sidebar {
  34. width: 320px;
  35. background: var(--bg-sidebar);
  36. border-right: 1px solid var(--border-color);
  37. display: flex;
  38. flex-direction: column;
  39. overflow: hidden;
  40. }
  41. .sidebar-scroll {
  42. flex: 1;
  43. padding: 10px 16px 2px;
  44. overflow-y: auto;
  45. display: flex;
  46. flex-direction: column;
  47. gap: 18px;
  48. }
  49. .sidebar-history {
  50. border-top: 1px solid var(--border-color);
  51. padding: 3px ;
  52. background: #fff;
  53. display: flex;
  54. flex-direction: column;
  55. gap: 10px;
  56. overflow: auto; /* 允许滚动 */
  57. scrollbar-width: none; /* Firefox */
  58. }
  59. .sidebar-history::-webkit-scrollbar {
  60. display: none; /* Chrome 和 Safari */
  61. }
  62. .sidebar-history-header {
  63. display: flex;
  64. align-items: center;
  65. justify-content: space-between;
  66. gap: 8px;
  67. }
  68. .history-count {
  69. font-size: 12px;
  70. color: var(--secondary-text);
  71. }
  72. .sidebar-section {
  73. margin: 0;
  74. display: flex;
  75. flex-direction: column;
  76. gap: 6px;
  77. }
  78. .sidebar-actions {
  79. flex-direction: row;
  80. align-items: center;
  81. }
  82. .sidebar-actions .primary-button,
  83. .sidebar-actions .secondary-button {
  84. flex: 1;
  85. }
  86. .sidebar-label {
  87. font-size: 14px;
  88. font-weight: 600;
  89. color: var(--secondary-text);
  90. }
  91. .sidebar-input,
  92. .sidebar-range {
  93. width: 100%;
  94. padding: 8px 10px;
  95. border: 1px solid var(--border-color);
  96. border-radius: 8px;
  97. font-size: 14px;
  98. background: #fff;
  99. color: inherit;
  100. }
  101. .sidebar-range {
  102. height: 4px;
  103. padding: 0;
  104. }
  105. .sidebar-help {
  106. font-size: 13px;
  107. color: var(--secondary-text);
  108. }
  109. .sidebar-heading {
  110. margin: 0;
  111. font-size: 16px;
  112. font-weight: 600;
  113. }
  114. .primary-button,
  115. .secondary-button {
  116. border: none;
  117. border-radius: 8px;
  118. padding: 10px 14px;
  119. font-size: 14px;
  120. cursor: pointer;
  121. transition: all 0.2s ease;
  122. }
  123. .primary-button {
  124. background: var(--primary);
  125. color: var(--primary-text);
  126. }
  127. .primary-button:disabled {
  128. opacity: 0.6;
  129. cursor: not-allowed;
  130. }
  131. .primary-button:hover:not(:disabled) {
  132. background: var(--accent);
  133. }
  134. .secondary-button {
  135. background: #f1f3f5;
  136. color: var(--text-color);
  137. border: 1px solid var(--border-color);
  138. }
  139. .secondary-button:hover:not(:disabled) {
  140. background: #e6e9ef;
  141. }
  142. .history-list {
  143. display: flex;
  144. flex-direction: column;
  145. gap: 6px;
  146. max-height: 240px;
  147. overflow-y: auto;
  148. }
  149. .history-row {
  150. display: grid;
  151. grid-template-columns: 1fr auto auto;
  152. gap: 4px;
  153. align-items: center;
  154. padding: 4px 10px;
  155. border: 1px solid var(--border-color);
  156. border-radius: 8px;
  157. background: #fff;
  158. }
  159. .history-row.active {
  160. border-color: var(--accent);
  161. box-shadow: 0 0 0 1px rgba(13, 110, 253, 0.12);
  162. }
  163. .history-title-link {
  164. border: none;
  165. background: none;
  166. padding: 0;
  167. margin: 0;
  168. font-size: 14px;
  169. font-weight: 500;
  170. text-align: left;
  171. color: var(--accent);
  172. cursor: pointer;
  173. display: flex;
  174. flex-direction: column;
  175. align-items: flex-start;
  176. gap: 2px;
  177. width: 100%;
  178. text-decoration: none;
  179. }
  180. .history-title-link:hover,
  181. .history-title-link:focus-visible {
  182. text-decoration: underline;
  183. }
  184. .history-row.active .history-title-link {
  185. color: var(--text-color);
  186. font-weight: 600;
  187. }
  188. .history-title-text,
  189. .history-subtitle {
  190. white-space: nowrap;
  191. overflow: hidden;
  192. text-overflow: ellipsis;
  193. max-width: 100%;
  194. }
  195. .history-subtitle {
  196. font-size: 11px;
  197. color: var(--secondary-text);
  198. }
  199. .history-icon-button {
  200. border: none;
  201. background: #f8f9fb;
  202. border-radius: 6px;
  203. padding: 6px 8px;
  204. cursor: pointer;
  205. font-size: 16px;
  206. line-height: 1;
  207. }
  208. .history-icon-button:hover {
  209. background: #e6e9ef;
  210. }
  211. .history-pagination {
  212. display: flex;
  213. justify-content: space-between;
  214. gap: 2px;
  215. margin-bottom: 5px;
  216. margin-left: 10px;
  217. margin-right: 10px;
  218. }
  219. .history-pagination .secondary-button {
  220. padding: 3px 3px;
  221. font-size: 11px;
  222. border-radius: 6px;
  223. }
  224. .main-panel {
  225. flex: 1;
  226. display: flex;
  227. flex-direction: column;
  228. background: var(--bg-panel);
  229. box-shadow: var(--shadow);
  230. }
  231. .app-header {
  232. padding: 20px 24px;
  233. border-bottom: 1px solid var(--border-color);
  234. }
  235. .app-header h1 {
  236. margin: 0;
  237. font-size: 22px;
  238. font-weight: 600;
  239. }
  240. .chat-messages {
  241. flex: 1;
  242. padding: 24px;
  243. overflow-y: auto;
  244. display: flex;
  245. flex-direction: column;
  246. gap: 16px;
  247. background: linear-gradient(180deg, rgba(243, 247, 255, 0.8), rgba(255, 255, 255, 0.9));
  248. }
  249. .message {
  250. padding: 16px;
  251. border-radius: 12px;
  252. border: 1px solid var(--border-color);
  253. max-width: 860px;
  254. display: flex;
  255. flex-direction: column;
  256. gap: 10px;
  257. }
  258. .message.user {
  259. background: var(--user-message);
  260. align-self: flex-end;
  261. }
  262. .message.assistant {
  263. background: var(--assistant-message);
  264. align-self: flex-start;
  265. }
  266. .message-header {
  267. font-size: 13px;
  268. font-weight: 600;
  269. color: var(--secondary-text);
  270. }
  271. .message-content {
  272. font-size: 14px;
  273. line-height: 1.6;
  274. color: var(--text-color);
  275. white-space: normal;
  276. word-break: break-word;
  277. }
  278. .message-content ul {
  279. margin: 8px 0 8px 18px;
  280. padding-left: 16px;
  281. }
  282. .message-content li {
  283. margin-bottom: 4px;
  284. }
  285. .message-content blockquote {
  286. margin: 10px 0;
  287. padding-left: 14px;
  288. border-left: 3px solid var(--border-color);
  289. color: var(--secondary-text);
  290. }
  291. .message-content h1,
  292. .message-content h2,
  293. .message-content h3,
  294. .message-content h4,
  295. .message-content h5,
  296. .message-content h6 {
  297. margin: 12px 0 6px;
  298. font-weight: 600;
  299. }
  300. .message-content h1 { font-size: 20px; }
  301. .message-content h2 { font-size: 18px; }
  302. .message-content h3 { font-size: 16px; }
  303. .message-content h4 { font-size: 15px; }
  304. .message-content h5,
  305. .message-content h6 { font-size: 14px; }
  306. .message-content pre {
  307. background: #0d1117;
  308. color: #e6edf3;
  309. padding: 12px;
  310. border-radius: 10px;
  311. overflow-x: auto;
  312. font-family: "JetBrains Mono", "Fira Code", "Menlo", "Consolas", monospace;
  313. font-size: 13px;
  314. line-height: 1.5;
  315. margin: 10px 0;
  316. }
  317. .message-content code {
  318. font-family: "JetBrains Mono", "Fira Code", "Menlo", "Consolas", monospace;
  319. background: rgba(13, 110, 253, 0.12);
  320. color: #0d47a1;
  321. padding: 2px 6px;
  322. border-radius: 6px;
  323. font-size: 13px;
  324. }
  325. .message-content pre code {
  326. display: block;
  327. background: transparent;
  328. color: inherit;
  329. padding: 0;
  330. }
  331. .message-content img {
  332. max-width: 100%;
  333. border-radius: 8px;
  334. margin: 6px 0;
  335. }
  336. .message-actions {
  337. display: flex;
  338. justify-content: flex-end;
  339. gap: 6px;
  340. }
  341. .message-button {
  342. border: none;
  343. background: var(--primary);
  344. color: var(--primary-text);
  345. border-radius: 6px;
  346. padding: 3px 8px;
  347. font-size: 11px;
  348. font-weight: 500;
  349. cursor: pointer;
  350. white-space: nowrap;
  351. transition: background 0.2s ease;
  352. }
  353. .message-button:hover {
  354. background: var(--accent);
  355. }
  356. .chat-form {
  357. padding: 16px 20px;
  358. border-top: 1px solid var(--border-color);
  359. display: flex;
  360. flex-direction: column;
  361. gap: 10px;
  362. background: #fff;
  363. }
  364. .chat-textarea {
  365. width: 100%;
  366. border-radius: 12px;
  367. border: 1px solid var(--border-color);
  368. padding: 10px;
  369. font-size: 14px;
  370. resize: vertical;
  371. min-height: 70px;
  372. }
  373. .chat-form-footer {
  374. display: flex;
  375. align-items: center;
  376. gap: 10px;
  377. }
  378. .file-input-label {
  379. display: inline-flex;
  380. align-items: center;
  381. padding: 6px 12px;
  382. border-radius: 8px;
  383. border: 1px dashed var(--border-color);
  384. color: var(--secondary-text);
  385. cursor: pointer;
  386. background: #fafbfc;
  387. }
  388. .file-input {
  389. display: none;
  390. }
  391. .chat-status {
  392. min-height: 20px;
  393. font-size: 13px;
  394. color: var(--secondary-text);
  395. display: flex;
  396. align-items: center;
  397. gap: 8px;
  398. }
  399. .chat-status.running {
  400. color: var(--accent);
  401. }
  402. .chat-status.running::before {
  403. content: "";
  404. width: 14px;
  405. height: 14px;
  406. border-radius: 50%;
  407. border: 2px solid currentColor;
  408. border-top-color: transparent;
  409. animation: chat-spin 0.8s linear infinite;
  410. }
  411. .chat-status.error {
  412. color: #dc3545;
  413. }
  414. .toast {
  415. position: fixed;
  416. bottom: 24px;
  417. left: 50%;
  418. transform: translateX(-50%);
  419. background: rgba(33, 37, 41, 0.9);
  420. color: #fff;
  421. padding: 12px 18px;
  422. border-radius: 12px;
  423. font-size: 14px;
  424. box-shadow: var(--shadow);
  425. opacity: 0;
  426. transition: opacity 0.3s ease, transform 0.3s ease;
  427. pointer-events: none;
  428. z-index: 999;
  429. }
  430. .toast.show {
  431. opacity: 1;
  432. transform: translate(-50%, 0);
  433. }
  434. .toast.success {
  435. background: #28a745;
  436. }
  437. .toast.error {
  438. background: #dc3545;
  439. }
  440. .hidden {
  441. display: none;
  442. }
  443. .clamped {
  444. display: -webkit-box;
  445. -webkit-line-clamp: 3;
  446. -webkit-box-orient: vertical;
  447. overflow: hidden;
  448. }
  449. mark.hl {
  450. background: #fff3a3;
  451. color: inherit;
  452. padding: 0 2px;
  453. border-radius: 3px;
  454. }
  455. @keyframes chat-spin {
  456. from {
  457. transform: rotate(0deg);
  458. }
  459. to {
  460. transform: rotate(360deg);
  461. }
  462. }
  463. @media (max-width: 960px) {
  464. .app-shell {
  465. flex-direction: column;
  466. }
  467. .sidebar {
  468. width: 100%;
  469. border-right: none;
  470. border-bottom: 1px solid var(--border-color);
  471. }
  472. .sidebar-scroll {
  473. display: grid;
  474. grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  475. gap: 16px;
  476. }
  477. .main-panel {
  478. box-shadow: none;
  479. }
  480. .history-list {
  481. max-height: 180px;
  482. }
  483. .sidebar-actions {
  484. flex-direction: column;
  485. }
  486. }
  487. @media (max-width: 600px) {
  488. .chat-form-footer {
  489. flex-direction: column;
  490. align-items: stretch;
  491. }
  492. .chat-form-footer .primary-button {
  493. width: 100%;
  494. }
  495. .file-input-label {
  496. width: 100%;
  497. justify-content: center;
  498. }
  499. }