diff --git a/src/genesis/server/static/chat.css b/src/genesis/server/static/chat.css new file mode 100644 index 0000000..ebcf84d --- /dev/null +++ b/src/genesis/server/static/chat.css @@ -0,0 +1,205 @@ +/* src/genesis/server/static/chat.css + v0 拆分骨架 - 视觉与原 chat.html 内联样式完全一致 + v1 视觉重塑见 docs/superpowers/plans/2026-08-30-frontend-beautify.md Task 2 +*/ +:root { + --blue: #1a73e8; + --blue-dark: #1967d2; + --blue-soft: #d2e3fc; + --red: #ea4335; + --red-soft: #fce8e6; + --yellow: #fbbc05; + --green: #34a853; + --gray-50: #f8f9fa; + --gray-100: #f1f3f4; + --gray-200: #e8eaed; + --gray-300: #dadce0; + --gray-500: #5f6368; + --gray-700: #3c4043; + --gray-900: #202124; + --blue-50: #e8f0fe; + --blue-100: #d2e3fc; + --radius-lg: 12px; + --radius-xl: 16px; + --shadow-1: 0 1px 2px rgba(60,64,67,.30), 0 1px 3px 1px rgba(60,64,67,.15); + --shadow-2: 0 1px 2px rgba(60,64,67,.30), 0 2px 6px 2px rgba(60,64,67,.15); + --shadow-3: 0 1px 3px rgba(60,64,67,.30), 0 4px 8px 3px rgba(60,64,67,.15); + --glow-blue: 0 0 0 1px rgba(26,115,232,.12), 0 8px 24px rgba(26,115,232,.18); + --ease: all .2s cubic-bezier(.2,0,0,1); + --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', 'Microsoft YaHei', sans-serif; +} +* { box-sizing: border-box; } +html, body { height: 100%; } +body { + font-family: var(--font-ui); + margin: 0; height: 100vh; display: flex; flex-direction: row; + background: var(--gray-50); color: var(--gray-900); + -webkit-font-smoothing: antialiased; +} +::-webkit-scrollbar { width: 8px; height: 8px; } +::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 8px; } +::-webkit-scrollbar-thumb:hover { background: var(--gray-500); } +::-webkit-scrollbar-track { background: transparent; } + +/* Sidebar */ +#sidebar { width: 264px; background: #fff; color: var(--gray-900); display: flex; flex-direction: column; flex-shrink: 0; border-right: 1px solid var(--gray-200); transition: width .25s ease; position: relative; } +#sidebar.collapsed { width: 56px; } +#sidebar.collapsed #sidebar-toggle { top: auto; bottom: 14px; right: auto; left: 14px; } +#sidebar.collapsed #session-list { padding-bottom: 52px; } +.brand { display: flex; align-items: center; gap: 12px; padding: 16px 12px 12px 16px; margin: 0 8px 8px; border-bottom: 1px solid var(--gray-100); min-height: 64px; } +#sidebar.collapsed .brand { padding: 16px 8px; justify-content: center; gap: 0; } +.brand-logo { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 17px; font-weight: 900; background: linear-gradient(135deg, #1a73e8, #4285f4); box-shadow: var(--glow-blue); transition: var(--ease); } +.brand:hover .brand-logo { transform: scale(1.1); } +.brand-name { font-size: 17px; font-weight: 900; letter-spacing: -.02em; line-height: 1.1; } +#sidebar.collapsed .brand-name { display: none; } +.brand-sub { display: block; font-size: 11px; font-weight: 600; color: var(--gray-500); margin-top: 2px; letter-spacing: 0; } +#sidebar-toggle { position: absolute; top: 18px; right: -14px; z-index: 5; width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 1px solid var(--gray-200); box-shadow: var(--shadow-1); color: var(--gray-700); cursor: pointer; font-size: 14px; line-height: 1; display: flex; align-items: center; justify-content: center; transition: var(--ease); } +#sidebar-toggle:hover { color: var(--blue); border-color: var(--blue-100); } +#sidebar.collapsed #sidebar-toggle { transform: rotate(180deg); } +#new-chat { margin: 6px 16px 10px; background: var(--blue); color: #fff; border: none; padding: 10px 14px; border-radius: var(--radius-lg); cursor: pointer; font-size: 14px; font-weight: 600; letter-spacing: .01em; box-shadow: 0 1px 2px rgba(26,115,232,.4); transition: var(--ease); display: flex; align-items: center; justify-content: center; gap: 6px; } +#new-chat:hover { background: var(--blue-dark); box-shadow: 0 2px 6px rgba(26,115,232,.45); transform: translateY(-1px); } +#new-chat:active { transform: translateY(0); } +#sidebar.collapsed #new-chat { margin: 6px 10px 10px; padding: 10px 0; } +#new-chat .ic-plus { display: inline-block; font-weight: 900; } +#sidebar.collapsed #new-chat .nc-text { display: none; } +#sidebar h2 { font-size: 9px; font-weight: 900; letter-spacing: .2em; text-transform: uppercase; color: var(--gray-500); margin: 10px 16px 6px; } +#sidebar.collapsed h2 { display: none; } +#session-list { flex: 1; overflow-y: auto; padding: 0 8px 8px; } +.sess { padding: 9px 12px; border-radius: var(--radius-lg); margin: 2px 0; cursor: pointer; position: relative; border: 1px solid transparent; transition: var(--ease); display: flex; align-items: center; gap: 6px; } +.sess:hover { background: var(--gray-50); } +.sess.active { background: var(--blue-50); border-color: var(--blue-100); } +.sess.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--blue); } +.sess .info { flex: 1; min-width: 0; overflow: hidden; } +.sess .name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.sess.active .name { font-weight: 700; } +.sess .meta { font-size: 11px; color: var(--gray-500); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.sess .del { flex-shrink: 0; opacity: 0; transition: opacity .15s ease; background: transparent; border: none; color: var(--gray-500); cursor: pointer; width: 24px; height: 24px; border-radius: 6px; font-size: 16px; line-height: 1; display: flex; align-items: center; justify-content: center; } +.sess:hover .del { opacity: .7; } +.sess .del:hover { opacity: 1 !important; background: var(--red-soft); color: var(--red); } +#sidebar.collapsed .sess { justify-content: center; padding: 9px 6px; } +#sidebar.collapsed .sess .info, #sidebar.collapsed .sess .del { display: none; } +#sidebar.collapsed .sess .avatar { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--gray-100); color: var(--gray-700); font-size: 12px; font-weight: 700; } +.sess .avatar { display: none; } +#sidebar.collapsed .sess .avatar { display: flex; } +#sidebar.collapsed .sess.active .avatar { background: var(--blue); color: #fff; } + +/* Main */ +#main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--gray-50); } +header { height: 56px; position: sticky; top: 0; z-index: 10; padding: 0 24px; display: flex; align-items: center; gap: 14px; background: rgba(255,255,255,.78); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--gray-200); } +header h1 { font-size: 16px; font-weight: 900; letter-spacing: -.02em; margin: 0; color: var(--gray-900); } +.proj-switcher { position: relative; } +.ps-current { display: flex; align-items: center; gap: 8px; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: var(--radius-lg); padding: 7px 12px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--gray-700); transition: var(--ease); } +.ps-current:hover { background: #fff; border-color: var(--blue-100); color: var(--blue-dark); } +.ps-current .ps-label { font-size: 11px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; color: var(--gray-500); } +.ps-current .ps-name { max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.ps-current .ps-caret { font-size: 10px; color: var(--gray-500); } +.ps-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 240px; background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-lg); box-shadow: var(--shadow-3); padding: 6px; z-index: 20; display: none; } +.ps-menu.open { display: block; animation: zoomIn .2s ease; } +.ps-item { padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--gray-700); display: flex; align-items: center; gap: 8px; transition: background .15s ease; } +.ps-item:hover { background: var(--blue-50); color: var(--blue-dark); } +.ps-item.active { background: var(--blue-50); color: var(--blue-dark); font-weight: 700; } +.ps-item .ps-check { margin-left: auto; color: var(--blue); font-weight: 900; opacity: 0; } +.ps-item.active .ps-check { opacity: 1; } +.ps-sep { height: 1px; background: var(--gray-100); margin: 4px 6px; } +.ps-manage { color: var(--blue); font-weight: 600; } +#sid-badge { margin-left: auto; background: var(--blue-50); color: var(--blue-dark); border: 1px solid var(--blue-100); border-radius: 999px; padding: 4px 14px; font-size: 12px; font-weight: 600; max-width: 46%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } + +/* RAG */ +#rag-bar { display: flex; align-items: center; gap: 8px; background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--gray-700); } +#rag-bar label.rag-switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; } +#rag-bar input[type=checkbox] { width: 14px; height: 14px; accent-color: var(--blue); margin: 0; } +#rag-bar input[type=checkbox]:disabled + span { color: var(--gray-500); cursor: not-allowed; } +#rag-bar .rag-stats { font-variant-numeric: tabular-nums; color: var(--gray-500); } +#rag-bar .rag-stats.ready { color: var(--blue-dark); font-weight: 600; } +#rag-bar .rag-stats.zero { color: var(--gray-500); } +#rag-bar button { background: var(--blue); color: #fff; border: none; border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 700; cursor: pointer; } +#rag-bar button:disabled { background: var(--gray-200); color: var(--gray-500); cursor: not-allowed; } +#rag-bar button:hover:not(:disabled) { background: var(--blue-dark); } + +/* Chat */ +#chat { flex: 1; overflow-y: auto; padding: 24px 24px 32px; max-width: 880px; width: 100%; margin: 0 auto; } +.msg { display: flex; margin: 12px 0; animation: zoomIn .25s ease; } +.msg .bubble { max-width: 74%; padding: 11px 16px; border-radius: var(--radius-xl); white-space: pre-wrap; line-height: 1.6; font-size: 14px; letter-spacing: .01em; } +.msg.user { justify-content: flex-end; } +.msg.user .bubble { background: linear-gradient(135deg, #1a73e8, #4285f4); color: #fff; border-bottom-right-radius: 6px; box-shadow: var(--shadow-2); } +.msg.assistant { align-items: flex-start; } +.msg.assistant .bubble { background: #fff; border: 1px solid var(--gray-200); border-bottom-left-radius: 6px; box-shadow: var(--shadow-1); } +.msg.assistant::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin: 16px 8px 0 0; background: var(--blue); box-shadow: 0 0 0 0 rgba(26,115,232,.4); animation: auraPulse 2.2s ease-in-out infinite; } +.msg.progress .bubble { background: var(--blue-50); border: 1px dashed var(--blue-soft); font-size: 13px; color: var(--gray-700); } +.msg.error .bubble { background: var(--red-soft); border: 1px solid #f5c6c0; color: #b31412; } +.progress-item { display: block; } +.progress-item.ok::before { content: "✔ "; color: var(--green); font-weight: 700; } +.progress-item.warn::before { content: "⚠ "; color: #b06000; font-weight: 700; } +.actions { margin-top: 8px; } +.actions a { display: inline-block; margin: 4px 6px 0 0; background: var(--blue); color: #fff; padding: 6px 14px; border-radius: 999px; text-decoration: none; font-size: 13px; font-weight: 600; box-shadow: 0 1px 2px rgba(26,115,232,.4); transition: var(--ease); } +.actions a:hover { background: var(--blue-dark); transform: translateY(-1px); } +.typing { color: var(--gray-500); font-size: 13px; font-style: italic; animation: auraPulse 1.4s ease-in-out infinite; } + +/* Upload */ +#upload-bar { background: #fff; border-top: 1px solid var(--gray-200); padding: 10px 24px; font-size: 13px; } +#upload-bar-inner { max-width: 880px; margin: 0 auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } +#upload-bar select { font-size: 13px; padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius-lg); background: #fff; color: var(--gray-900); cursor: pointer; outline: none; transition: var(--ease); } +#upload-bar select:focus { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-50); } +.file-pick { display: inline-block; padding: 8px 14px; border: 1px solid var(--gray-300); border-radius: var(--radius-lg); background: var(--gray-50); color: var(--gray-700); font-size: 13px; font-weight: 600; cursor: pointer; transition: var(--ease); } +.file-pick:hover { background: var(--blue-50); color: var(--blue-dark); border-color: var(--blue-100); } +#upload-btn { background: var(--gray-100); border: 1px solid var(--gray-200); color: var(--gray-700); border-radius: var(--radius-lg); padding: 8px 16px; cursor: pointer; font-size: 13px; font-weight: 600; transition: var(--ease); } +#upload-btn:hover { background: var(--blue); border-color: var(--blue); color: #fff; } +#upload-status { color: var(--gray-500); font-size: 12px; } +#proj-hint { color: #b06000; font-size: 12px; background: #fef7e0; border: 1px solid #fde293; border-radius: 8px; padding: 4px 10px; } +label.vh { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; } + +/* Composer */ +#composer { border-top: 1px solid var(--gray-200); background: #fff; padding: 14px 24px 18px; } +#composer-inner { max-width: 880px; margin: 0 auto; display: flex; gap: 10px; align-items: center; } +#input { flex: 1; border: 1px solid var(--gray-300); border-radius: 999px; padding: 11px 18px; font-size: 14px; outline: none; background: var(--gray-50); transition: var(--ease); color: var(--gray-900); } +#input:focus { border-color: var(--blue); background: #fff; box-shadow: 0 0 0 3px var(--blue-50); } +#input::placeholder { color: var(--gray-500); } +#send { background: var(--blue); color: #fff; border: none; border-radius: 999px; padding: 11px 24px; cursor: pointer; font-size: 14px; font-weight: 700; box-shadow: 0 1px 2px rgba(26,115,232,.4); transition: var(--ease); } +#send:hover:not(:disabled) { background: var(--blue-dark); box-shadow: var(--shadow-2); transform: translateY(-1px); } +#send:active:not(:disabled) { transform: translateY(0); } +#send:disabled { opacity: .45; cursor: not-allowed; } + +/* Drawer */ +#proj-drawer { position: fixed; top: 0; right: 0; height: 100vh; width: 460px; background: #fff; border-left: 1px solid var(--gray-200); box-shadow: -8px 0 32px rgba(60,64,67,.12); transform: translateX(100%); transition: transform .3s cubic-bezier(.2,0,0,1); z-index: 100; display: flex; flex-direction: column; } +#proj-drawer.open { transform: translateX(0); } +.drawer-head { height: 56px; padding: 0 20px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--gray-200); background: rgba(255,255,255,.95); backdrop-filter: blur(8px); flex-shrink: 0; } +.drawer-head h2 { font-size: 15px; font-weight: 900; letter-spacing: -.01em; margin: 0; color: var(--gray-900); flex: 1; } +.drawer-close { background: var(--gray-100); border: none; color: var(--gray-700); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center; transition: var(--ease); } +.drawer-close:hover { background: var(--red-soft); color: var(--red); } +.drawer-body { flex: 1; display: flex; min-height: 0; } +.drawer-list { width: 38%; border-right: 1px solid var(--gray-100); overflow-y: auto; padding: 10px 8px; background: var(--gray-50); display: flex; flex-direction: column; gap: 2px; } +.drawer-item { padding: 10px 12px; border-radius: 10px; cursor: pointer; font-size: 13px; color: var(--gray-700); border: 1px solid transparent; transition: var(--ease); display: flex; align-items: center; gap: 8px; } +.drawer-item:hover { background: #fff; border-color: var(--gray-200); } +.drawer-item.active { background: #fff; border-color: var(--blue-100); color: var(--blue-dark); font-weight: 700; box-shadow: var(--shadow-1); } +.drawer-item .di-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.drawer-item .di-new { color: var(--blue); } +.drawer-item.di-create { border: 1px dashed var(--blue-100); background: var(--blue-50); color: var(--blue-dark); font-weight: 700; justify-content: center; gap: 4px; } +.drawer-item.di-create:hover { background: var(--blue-100); border-color: var(--blue); } +.drawer-form { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; } +.drawer-form label { font-size: 11px; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 2px; display: block; } +.drawer-form input { width: 100%; padding: 8px 11px; border: 1px solid var(--gray-200); border-radius: 8px; font-size: 13px; color: var(--gray-900); background: #fff; transition: var(--ease); } +.drawer-form input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-50); } +.drawer-form input:read-only { background: var(--gray-50); color: var(--gray-500); } +.drawer-form .field { display: flex; flex-direction: column; } +.drawer-form .drawer-hint { margin: 0 0 6px; } +.drawer-form details.advanced { border: 1px solid var(--gray-200); border-radius: 8px; padding: 8px 12px; background: var(--gray-50); } +.drawer-form details.advanced > summary { cursor: pointer; font-size: 12px; font-weight: 700; color: var(--gray-700); letter-spacing: .02em; } +.drawer-form details.advanced[open] { padding-bottom: 10px; } +.drawer-form details.advanced .field { margin-top: 8px; } +.drawer-form input.invalid { border-color: var(--red) !important; box-shadow: 0 0 0 2px var(--red-soft) !important; } +.drawer-actions { display: flex; gap: 8px; margin-top: 8px; } +.drawer-actions button { flex: 1; padding: 10px; border: none; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; transition: var(--ease); } +.btn-save { background: var(--blue); color: #fff; } +.btn-save:hover { background: var(--blue-dark); } +.btn-delete { background: var(--red-soft); color: var(--red); border: 1px solid #f5c6c0 !important; } +.btn-delete:hover { background: var(--red); color: #fff; } +.drawer-hint { font-size: 11px; color: var(--gray-500); line-height: 1.5; padding: 8px 0; } + +@keyframes auraPulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } } +@keyframes zoomIn { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: scale(1); } } +@media (max-width: 860px) { + #sidebar { width: 220px; } + #sidebar.collapsed { width: 48px; } + #sid-badge { display: none; } + #proj-drawer { width: 100vw; } +} diff --git a/src/genesis/server/static/chat.html b/src/genesis/server/static/chat.html index 7d80831..f4dc148 100644 --- a/src/genesis/server/static/chat.html +++ b/src/genesis/server/static/chat.html @@ -4,392 +4,7 @@