styles.css 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823
  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. .hidden {
  16. display: none !important;
  17. }
  18. .auth-view {
  19. position: fixed;
  20. inset: 0;
  21. background: linear-gradient(120deg, #4f46e5, #9333ea);
  22. display: flex;
  23. align-items: center;
  24. justify-content: center;
  25. padding: 20px;
  26. z-index: 20;
  27. }
  28. .auth-card {
  29. width: min(420px, 100%);
  30. background: #fff;
  31. border-radius: 16px;
  32. padding: 32px;
  33. box-shadow: var(--shadow);
  34. display: flex;
  35. flex-direction: column;
  36. gap: 16px;
  37. }
  38. .auth-card h1 {
  39. margin: 0;
  40. font-size: 24px;
  41. text-align: center;
  42. color: #111;
  43. }
  44. .auth-hint {
  45. margin: 0;
  46. font-size: 14px;
  47. color: var(--secondary-text);
  48. text-align: center;
  49. }
  50. .auth-form {
  51. display: flex;
  52. flex-direction: column;
  53. gap: 12px;
  54. }
  55. .auth-form label {
  56. font-size: 14px;
  57. color: var(--secondary-text);
  58. display: flex;
  59. flex-direction: column;
  60. gap: 4px;
  61. }
  62. .auth-form input {
  63. border-radius: 8px;
  64. border: 1px solid var(--border-color);
  65. padding: 10px;
  66. font-size: 14px;
  67. }
  68. .auth-switch {
  69. display: flex;
  70. justify-content: space-between;
  71. gap: 12px;
  72. }
  73. .header-actions {
  74. display: flex;
  75. align-items: center;
  76. gap: 8px;
  77. }
  78. .user-badge {
  79. font-size: 14px;
  80. color: var(--secondary-text);
  81. }
  82. .overlay {
  83. position: fixed;
  84. inset: 0;
  85. background: rgba(15, 23, 42, 0.45);
  86. display: flex;
  87. align-items: center;
  88. justify-content: center;
  89. padding: 20px;
  90. z-index: 30;
  91. }
  92. .overlay-content {
  93. width: min(720px, 100%);
  94. max-height: 90vh;
  95. overflow-y: auto;
  96. background: #fff;
  97. border-radius: 16px;
  98. padding: 24px;
  99. box-shadow: var(--shadow);
  100. display: flex;
  101. flex-direction: column;
  102. gap: 16px;
  103. }
  104. .overlay-header {
  105. display: flex;
  106. align-items: center;
  107. justify-content: space-between;
  108. }
  109. .icon-button {
  110. border: none;
  111. background: transparent;
  112. font-size: 20px;
  113. cursor: pointer;
  114. padding: 4px 8px;
  115. }
  116. .admin-form {
  117. border: 1px solid var(--border-color);
  118. border-radius: 12px;
  119. padding: 16px;
  120. background: #f8fafc;
  121. }
  122. .admin-form h3 {
  123. margin: 0 0 12px;
  124. font-size: 16px;
  125. }
  126. .admin-form-grid {
  127. display: grid;
  128. grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  129. gap: 12px;
  130. }
  131. .admin-form input {
  132. width: 100%;
  133. border-radius: 8px;
  134. border: 1px solid var(--border-color);
  135. padding: 8px 10px;
  136. }
  137. .admin-section {
  138. border: 1px solid var(--border-color);
  139. border-radius: 12px;
  140. padding: 16px;
  141. background: #fff;
  142. display: flex;
  143. flex-direction: column;
  144. gap: 12px;
  145. }
  146. .admin-section-header {
  147. display: flex;
  148. align-items: center;
  149. justify-content: space-between;
  150. gap: 12px;
  151. }
  152. .admin-search {
  153. display: flex;
  154. gap: 8px;
  155. }
  156. .admin-search input {
  157. border: 1px solid var(--border-color);
  158. border-radius: 8px;
  159. padding: 8px 10px;
  160. }
  161. .admin-list {
  162. display: flex;
  163. flex-direction: column;
  164. gap: 8px;
  165. }
  166. .admin-row {
  167. border: 1px solid var(--border-color);
  168. border-radius: 10px;
  169. padding: 12px;
  170. display: flex;
  171. justify-content: space-between;
  172. gap: 12px;
  173. background: #fdfdfd;
  174. }
  175. .admin-row-info {
  176. display: flex;
  177. flex-direction: column;
  178. gap: 4px;
  179. }
  180. .admin-row-info strong {
  181. font-size: 15px;
  182. color: #111;
  183. }
  184. .admin-row-meta {
  185. font-size: 13px;
  186. color: var(--secondary-text);
  187. }
  188. .admin-row-preview {
  189. font-size: 13px;
  190. color: var(--secondary-text);
  191. max-height: 60px;
  192. overflow: hidden;
  193. }
  194. .admin-row-actions {
  195. display: flex;
  196. flex-direction: column;
  197. gap: 6px;
  198. align-items: flex-end;
  199. }
  200. .empty-note {
  201. margin: 0;
  202. font-size: 14px;
  203. color: var(--secondary-text);
  204. text-align: center;
  205. }
  206. * {
  207. box-sizing: border-box;
  208. }
  209. body {
  210. margin: 0;
  211. font-family: "PingFang SC", "Microsoft YaHei", "Helvetica", "Arial", sans-serif;
  212. background: var(--bg-main);
  213. color: var(--text-color);
  214. height: 100vh;
  215. display: flex;
  216. }
  217. .app-shell {
  218. display: flex;
  219. flex: 1;
  220. max-height: 100vh;
  221. width: 100%;
  222. }
  223. .sidebar {
  224. width: 320px;
  225. background: var(--bg-sidebar);
  226. border-right: 1px solid var(--border-color);
  227. display: flex;
  228. flex-direction: column;
  229. overflow: hidden;
  230. }
  231. .sidebar-scroll {
  232. flex: 1;
  233. padding: 10px 16px 2px;
  234. overflow-y: auto;
  235. display: flex;
  236. flex-direction: column;
  237. gap: 18px;
  238. }
  239. .sidebar-history {
  240. border-top: 1px solid var(--border-color);
  241. padding: 3px ;
  242. background: #fff;
  243. display: flex;
  244. flex-direction: column;
  245. gap: 10px;
  246. overflow: auto; /* 允许滚动 */
  247. scrollbar-width: none; /* Firefox */
  248. }
  249. .sidebar-history::-webkit-scrollbar {
  250. display: none; /* Chrome 和 Safari */
  251. }
  252. .sidebar-history-header {
  253. display: flex;
  254. align-items: center;
  255. justify-content: space-between;
  256. gap: 8px;
  257. }
  258. .history-count {
  259. font-size: 12px;
  260. color: var(--secondary-text);
  261. }
  262. .sidebar-section {
  263. margin: 0;
  264. display: flex;
  265. flex-direction: column;
  266. gap: 6px;
  267. }
  268. .sidebar-actions {
  269. flex-direction: row;
  270. align-items: center;
  271. }
  272. .sidebar-actions .primary-button,
  273. .sidebar-actions .secondary-button {
  274. flex: 1;
  275. }
  276. .sidebar-label {
  277. font-size: 14px;
  278. font-weight: 600;
  279. color: var(--secondary-text);
  280. }
  281. .sidebar-input,
  282. .sidebar-range {
  283. width: 100%;
  284. padding: 8px 10px;
  285. border: 1px solid var(--border-color);
  286. border-radius: 8px;
  287. font-size: 14px;
  288. background: #fff;
  289. color: inherit;
  290. }
  291. .sidebar-range {
  292. height: 4px;
  293. padding: 0;
  294. }
  295. .sidebar-help {
  296. font-size: 13px;
  297. color: var(--secondary-text);
  298. }
  299. .sidebar-heading {
  300. margin: 0;
  301. font-size: 16px;
  302. font-weight: 600;
  303. }
  304. .primary-button,
  305. .secondary-button {
  306. border: none;
  307. border-radius: 8px;
  308. padding: 10px 14px;
  309. font-size: 14px;
  310. cursor: pointer;
  311. transition: all 0.2s ease;
  312. }
  313. .primary-button {
  314. background: var(--primary);
  315. color: var(--primary-text);
  316. }
  317. .primary-button:disabled {
  318. opacity: 0.6;
  319. cursor: not-allowed;
  320. }
  321. .primary-button:hover:not(:disabled) {
  322. background: var(--accent);
  323. }
  324. .secondary-button {
  325. background: #f1f3f5;
  326. color: var(--text-color);
  327. border: 1px solid var(--border-color);
  328. }
  329. .secondary-button:hover:not(:disabled) {
  330. background: #e6e9ef;
  331. }
  332. .secondary-button.small {
  333. font-size: 13px;
  334. padding: 6px 10px;
  335. }
  336. .secondary-button.danger {
  337. background: #dc3545;
  338. border-color: #dc3545;
  339. color: #fff;
  340. }
  341. .secondary-button.danger:hover:not(:disabled) {
  342. background: #c82333;
  343. }
  344. .history-list {
  345. display: flex;
  346. flex-direction: column;
  347. gap: 6px;
  348. max-height: 240px;
  349. overflow-y: auto;
  350. }
  351. .history-row {
  352. display: grid;
  353. grid-template-columns: 1fr auto auto;
  354. gap: 4px;
  355. align-items: center;
  356. padding: 4px 10px;
  357. border: 1px solid var(--border-color);
  358. border-radius: 8px;
  359. background: #fff;
  360. }
  361. .history-row.active {
  362. border-color: var(--accent);
  363. box-shadow: 0 0 0 1px rgba(13, 110, 253, 0.12);
  364. }
  365. .history-title-link {
  366. border: none;
  367. background: none;
  368. padding: 0;
  369. margin: 0;
  370. font-size: 14px;
  371. font-weight: 500;
  372. text-align: left;
  373. color: var(--accent);
  374. cursor: pointer;
  375. display: flex;
  376. flex-direction: column;
  377. align-items: flex-start;
  378. gap: 2px;
  379. width: 100%;
  380. text-decoration: none;
  381. }
  382. .history-title-link:hover,
  383. .history-title-link:focus-visible {
  384. text-decoration: underline;
  385. }
  386. .history-row.active .history-title-link {
  387. color: var(--text-color);
  388. font-weight: 600;
  389. }
  390. .history-title-text,
  391. .history-subtitle {
  392. white-space: nowrap;
  393. overflow: hidden;
  394. text-overflow: ellipsis;
  395. max-width: 100%;
  396. }
  397. .history-subtitle {
  398. font-size: 11px;
  399. color: var(--secondary-text);
  400. }
  401. .history-icon-button {
  402. border: none;
  403. background: #f8f9fb;
  404. border-radius: 6px;
  405. padding: 6px 8px;
  406. cursor: pointer;
  407. font-size: 16px;
  408. line-height: 1;
  409. }
  410. .history-icon-button:hover {
  411. background: #e6e9ef;
  412. }
  413. .history-pagination {
  414. display: flex;
  415. justify-content: space-between;
  416. gap: 2px;
  417. margin-bottom: 5px;
  418. margin-left: 10px;
  419. margin-right: 10px;
  420. }
  421. .history-pagination .secondary-button {
  422. padding: 3px 3px;
  423. font-size: 11px;
  424. border-radius: 6px;
  425. }
  426. .main-panel {
  427. flex: 1;
  428. display: flex;
  429. flex-direction: column;
  430. background: var(--bg-panel);
  431. box-shadow: var(--shadow);
  432. }
  433. .app-header {
  434. padding: 20px 24px;
  435. border-bottom: 1px solid var(--border-color);
  436. }
  437. .app-header h1 {
  438. margin: 0;
  439. font-size: 22px;
  440. font-weight: 600;
  441. }
  442. .chat-messages {
  443. flex: 1;
  444. padding: 24px;
  445. overflow-y: auto;
  446. display: flex;
  447. flex-direction: column;
  448. gap: 16px;
  449. background: linear-gradient(180deg, rgba(243, 247, 255, 0.8), rgba(255, 255, 255, 0.9));
  450. }
  451. .message {
  452. padding: 16px;
  453. border-radius: 12px;
  454. border: 1px solid var(--border-color);
  455. max-width: 860px;
  456. display: flex;
  457. flex-direction: column;
  458. gap: 10px;
  459. }
  460. .message.notice {
  461. background: #fff8e1;
  462. border-style: dashed;
  463. color: #8c6b00;
  464. align-self: center;
  465. }
  466. .message.user {
  467. background: var(--user-message);
  468. align-self: flex-end;
  469. }
  470. .message.assistant {
  471. background: var(--assistant-message);
  472. align-self: flex-start;
  473. }
  474. .message-header {
  475. font-size: 13px;
  476. font-weight: 600;
  477. color: var(--secondary-text);
  478. }
  479. .message-content {
  480. font-size: 14px;
  481. line-height: 1.6;
  482. color: var(--text-color);
  483. white-space: normal;
  484. word-break: break-word;
  485. }
  486. .message-content ul {
  487. margin: 8px 0 8px 18px;
  488. padding-left: 16px;
  489. }
  490. .message-content li {
  491. margin-bottom: 4px;
  492. }
  493. .message-content blockquote {
  494. margin: 10px 0;
  495. padding-left: 14px;
  496. border-left: 3px solid var(--border-color);
  497. color: var(--secondary-text);
  498. }
  499. .message-content h1,
  500. .message-content h2,
  501. .message-content h3,
  502. .message-content h4,
  503. .message-content h5,
  504. .message-content h6 {
  505. margin: 12px 0 6px;
  506. font-weight: 600;
  507. }
  508. .message-content h1 { font-size: 20px; }
  509. .message-content h2 { font-size: 18px; }
  510. .message-content h3 { font-size: 16px; }
  511. .message-content h4 { font-size: 15px; }
  512. .message-content h5,
  513. .message-content h6 { font-size: 14px; }
  514. .message-content pre {
  515. background: #0d1117;
  516. color: #e6edf3;
  517. padding: 12px;
  518. border-radius: 10px;
  519. overflow-x: auto;
  520. font-family: "JetBrains Mono", "Fira Code", "Menlo", "Consolas", monospace;
  521. font-size: 13px;
  522. line-height: 1.5;
  523. margin: 10px 0;
  524. }
  525. .message-content code {
  526. font-family: "JetBrains Mono", "Fira Code", "Menlo", "Consolas", monospace;
  527. background: rgba(13, 110, 253, 0.12);
  528. color: #0d47a1;
  529. padding: 2px 6px;
  530. border-radius: 6px;
  531. font-size: 13px;
  532. }
  533. .message-content pre code {
  534. display: block;
  535. background: transparent;
  536. color: inherit;
  537. padding: 0;
  538. }
  539. .message-content img {
  540. max-width: 100%;
  541. border-radius: 8px;
  542. margin: 6px 0;
  543. }
  544. .message-actions {
  545. display: flex;
  546. justify-content: flex-end;
  547. gap: 6px;
  548. }
  549. .message-button {
  550. border: none;
  551. background: var(--primary);
  552. color: var(--primary-text);
  553. border-radius: 6px;
  554. padding: 3px 8px;
  555. font-size: 11px;
  556. font-weight: 500;
  557. cursor: pointer;
  558. white-space: nowrap;
  559. transition: background 0.2s ease;
  560. }
  561. .message-button:hover {
  562. background: var(--accent);
  563. }
  564. .chat-form {
  565. padding: 16px 20px;
  566. border-top: 1px solid var(--border-color);
  567. display: flex;
  568. flex-direction: column;
  569. gap: 10px;
  570. background: #fff;
  571. }
  572. .chat-textarea {
  573. width: 100%;
  574. border-radius: 12px;
  575. border: 1px solid var(--border-color);
  576. padding: 10px;
  577. font-size: 14px;
  578. resize: vertical;
  579. min-height: 70px;
  580. }
  581. .chat-form-footer {
  582. display: flex;
  583. align-items: center;
  584. gap: 10px;
  585. }
  586. .file-input-label {
  587. display: inline-flex;
  588. align-items: center;
  589. padding: 6px 12px;
  590. border-radius: 8px;
  591. border: 1px dashed var(--border-color);
  592. color: var(--secondary-text);
  593. cursor: pointer;
  594. background: #fafbfc;
  595. }
  596. .file-input {
  597. display: none;
  598. }
  599. .chat-status {
  600. min-height: 20px;
  601. font-size: 13px;
  602. color: var(--secondary-text);
  603. display: flex;
  604. align-items: center;
  605. gap: 8px;
  606. }
  607. .chat-status.running {
  608. color: var(--accent);
  609. }
  610. .chat-status.running::before {
  611. content: "";
  612. width: 14px;
  613. height: 14px;
  614. border-radius: 50%;
  615. border: 2px solid currentColor;
  616. border-top-color: transparent;
  617. animation: chat-spin 0.8s linear infinite;
  618. }
  619. .chat-status.error {
  620. color: #dc3545;
  621. }
  622. .toast {
  623. position: fixed;
  624. bottom: 24px;
  625. left: 50%;
  626. transform: translateX(-50%);
  627. background: rgba(33, 37, 41, 0.9);
  628. color: #fff;
  629. padding: 12px 18px;
  630. border-radius: 12px;
  631. font-size: 14px;
  632. box-shadow: var(--shadow);
  633. opacity: 0;
  634. transition: opacity 0.3s ease, transform 0.3s ease;
  635. pointer-events: none;
  636. z-index: 999;
  637. }
  638. .toast.show {
  639. opacity: 1;
  640. transform: translate(-50%, 0);
  641. }
  642. .toast.success {
  643. background: #28a745;
  644. }
  645. .toast.error {
  646. background: #dc3545;
  647. }
  648. .hidden {
  649. display: none;
  650. }
  651. .clamped {
  652. display: -webkit-box;
  653. -webkit-line-clamp: 3;
  654. -webkit-box-orient: vertical;
  655. overflow: hidden;
  656. }
  657. mark.hl {
  658. background: #fff3a3;
  659. color: inherit;
  660. padding: 0 2px;
  661. border-radius: 3px;
  662. }
  663. @keyframes chat-spin {
  664. from {
  665. transform: rotate(0deg);
  666. }
  667. to {
  668. transform: rotate(360deg);
  669. }
  670. }
  671. @media (max-width: 960px) {
  672. .app-shell {
  673. flex-direction: column;
  674. }
  675. .sidebar {
  676. width: 100%;
  677. border-right: none;
  678. border-bottom: 1px solid var(--border-color);
  679. }
  680. .sidebar-scroll {
  681. display: grid;
  682. grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  683. gap: 16px;
  684. }
  685. .main-panel {
  686. box-shadow: none;
  687. }
  688. .history-list {
  689. max-height: 180px;
  690. }
  691. .sidebar-actions {
  692. flex-direction: column;
  693. }
  694. }
  695. @media (max-width: 600px) {
  696. .chat-form-footer {
  697. flex-direction: column;
  698. align-items: stretch;
  699. }
  700. .chat-form-footer .primary-button {
  701. width: 100%;
  702. }
  703. .file-input-label {
  704. width: 100%;
  705. justify-content: center;
  706. }
  707. }
  708. :root {