From 8188f08f1b4235a026cdbd94dcde1ccf9a190bff Mon Sep 17 00:00:00 2001 From: lhl Date: Sat, 12 Sep 2026 18:59:38 +0800 Subject: [PATCH] =?UTF-8?q?feat(frontend):=20=E5=BC=95=E5=85=A5=20Vite=20d?= =?UTF-8?q?ev=20server(HMR)+=E4=BB=A3=E7=90=86;=20chat.css=20=E7=BA=B3?= =?UTF-8?q?=E5=85=A5=E5=89=8D=E7=AB=AF=E6=BA=90;=20esbuild=20=E6=94=B9=20o?= =?UTF-8?q?utdir=20=E4=BA=A7=E5=87=BA=20chat.js/chat.css?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 + frontend/esbuild.config.mjs | 7 +- frontend/package-lock.json | 1035 +++++++++++++++++++- frontend/package.json | 5 +- frontend/scripts/gen-dev-html.mjs | 21 + frontend/src/chat.css | 478 +++++++++ frontend/src/main.ts | 1 + frontend/src/vite-env.d.ts | 1 + frontend/tsconfig.json | 14 +- frontend/vite.config.ts | 15 + src/genesis/server/static/chat.css | 1450 +++++++++++++++++++++------- 11 files changed, 2693 insertions(+), 338 deletions(-) create mode 100644 frontend/scripts/gen-dev-html.mjs create mode 100644 frontend/src/chat.css create mode 100644 frontend/src/vite-env.d.ts create mode 100644 frontend/vite.config.ts diff --git a/.gitignore b/.gitignore index e02f73f..7ac1c3e 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,7 @@ conversations/ # ---- 前端构建(依赖不入库;打包产物 src/genesis/server/static/chat.js 入库)---- frontend/node_modules/ frontend/*.log +# ---- 前端 dev 产物(Vite dev 入口 / 构建输出均不入库)---- +frontend/index.html +frontend/dist/ +frontend/.vite-verify/ diff --git a/frontend/esbuild.config.mjs b/frontend/esbuild.config.mjs index ae69da8..120bbff 100644 --- a/frontend/esbuild.config.mjs +++ b/frontend/esbuild.config.mjs @@ -1,13 +1,14 @@ -import { build, context } from 'esbuild'; +import { build, context } from 'esbuild'; const watch = process.argv.includes('--watch'); const options = { - entryPoints: ['src/main.ts'], + entryPoints: { chat: 'src/main.ts' }, + outdir: '../src/genesis/server/static', + entryNames: '[name]', bundle: true, format: 'esm', target: ['es2020'], platform: 'browser', - outfile: '../src/genesis/server/static/chat.js', minify: false, sourcemap: false, logLevel: 'info', diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 40e5d2a..4bc4497 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -10,7 +10,8 @@ "devDependencies": { "@types/node": "^22.20.2", "esbuild": "^0.24.0", - "typescript": "^5.6.0" + "typescript": "^5.6.0", + "vite": "^5.4.0" } }, "node_modules/@esbuild/aix-ppc64": { @@ -438,6 +439,422 @@ "node": ">=18" } }, + "node_modules/@napi-rs/lzma-linux-x64-gnu": { + "version": "1.5.1", + "resolved": "https://registry.npmmirror.com/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz", + "integrity": "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.63.2.tgz", + "integrity": "sha512-Xa6RDoWa+hNiX6PgsljlH6W75RaONx3y6PVlbLhkEWW+GaPQ3dP5gwbL/erAzQHWwkvW5UxdD5l87Qx2FAQ/4A==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.63.2.tgz", + "integrity": "sha512-vNASxsghMfQ5s+v3PrpnJd+ryL/26lxCCaGI+sDJ7VzmHiYXIrrVltsDhaawxLM1WcoMU2oYlbPHLaYQtBzhcg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.63.2.tgz", + "integrity": "sha512-0dWDjmlrpZAgjPD/aPzUDhBW8APLRjAni5bOrM76wiiZm+E+KTMVKNhAzaTBohz8UyO2fKNAl0+fygbe2HZXOA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.63.2.tgz", + "integrity": "sha512-N58uktcwzk3+qT4KHEuNdIxX1N01RWrkfVoml69EAbSaNDL+sbNVLx2RMl4Qd23lpA0fgPvyh5hHb4weD5WKmg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.63.2.tgz", + "integrity": "sha512-HWF2zH8EAp2scWRpt2PGe6iUGz7zi04waXsdRr3zb4DWCk2ImIo5FZu0jjmD53nP/DGSvnW0e7/1ToCNZs2lZw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.63.2.tgz", + "integrity": "sha512-MkvcwHMnzPSMOQEwB6wHnLzmc+hT8BGc5bW/Mhmjjgx3wbj6VBnlc47XsK74kD0K9MikFfXpQqyz4NUXaUW62A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.63.2.tgz", + "integrity": "sha512-xe1bCKPJaKsD0tfd7Rb6bGfUogJTpKbTEEthsfdb7hTfTRNJVQTdirabQx0o6ERVba/smkM720soMY+0QnrlSQ==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.63.2.tgz", + "integrity": "sha512-yOM7LdK0p6gk6+Q773OEwtlsikT1TL3yMmYsTtRlDRPha5vV2DC5x7LqRWDr6f3cSYNMKVqxzffXv8ivxNBIFQ==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.63.2.tgz", + "integrity": "sha512-qiWuJJV3DybA2IfzvRimeKXGrGuVPv1zobSY/26KnP3HbV0VcNb3ECzgvtbvF3xjSMkcooou6HASXZuLdjnhpQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.63.2.tgz", + "integrity": "sha512-akcZquRzCY/KpUoZAMBhGf7oi4LmXq1BzRA5CPAC3rkUf28Y/sAYV3jSL+JKd7cwEyFvR5G0XVZ0gaMedP+60A==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.63.2.tgz", + "integrity": "sha512-fNwYHrPyYyxauPzX/cpYw8Z7LQpp+DGA0KCoswA0aVFBpmdMil9XgjB8V3Ny64Ihu797+GKcuJqnsOKEmor7fA==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.63.2.tgz", + "integrity": "sha512-XfvsgzR7DZqREdst7K1Mj3ilSUM5xLAHJcIMDFPKdxTs9q5VHOT8aMA+a683fqBu7DQl8+Sd9HCsQYL8EMY9qA==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.63.2.tgz", + "integrity": "sha512-Pp7gVZggEFlbcuztay+/U0gVG9S1XAh8i7I1Re/htbAzo43P5wHZHw6pTyzotISqlKohoh9RpIfnOz3RbemK1w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.63.2.tgz", + "integrity": "sha512-zkgL2xff6i7u5hau/m6FGeS8gRkLEdgLw522WGmdWWlLd9btmNl3S80mcEjtGq+kvgUekQ3+BOYLLLcPlS2LIA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.63.2.tgz", + "integrity": "sha512-qOheJomrkVCbbHFJ7L3J97cnhfogKqguAQphv26+3ZsAQIF1L19b+dArl//s8rjJHJLz9byykyM8NBP4nmSa1g==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.63.2.tgz", + "integrity": "sha512-XlxLD54wQhH3FciCgMofxBw27NzUe818gJH410qWvc41UT0ZFcgxVjyX5/EK8MPTupjeVWqN5oy+9pCA9mqfCA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.63.2.tgz", + "integrity": "sha512-vdryWeRb2bLJZf0Fv/W8se6nvsHe2PkTCxV0meheK3nQE+G90VCJcke51Miy1yQRsfm2uqIyjXOu4wmUzbTtkQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.63.2.tgz", + "integrity": "sha512-bcq2h2pkKmH2po4cZV8VWzO4lL40STyu/nLoFpYMQp9C2tCVNTdcVv86MwSsn3D5s1FBe2Ty1atqvVAUTMimNg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.63.2.tgz", + "integrity": "sha512-EGoo5DMVMRkTId8fuTDaoxVlR5ZTsKULUezRjd9gCw5eeY+DjCvDpZAOlNUvKPGX+7rS1RWx6j+yOpNPx0cUgQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.63.2.tgz", + "integrity": "sha512-MErl12k7BFHZG1TI9QF/3lSSZARzq9KgNy/FjnqFMCkv+N4RSSzoUCA5h2mqHX4Mox3WaTVKblyzhQ1zRb2ZuQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.63.2.tgz", + "integrity": "sha512-ILs8k07Wh4p0PsNY4wYLEaXZKMOpVhrG5QDB0yHhGhuzOfDlnyHN6sflL4El/MpUP1y8uY2lUZrv4oBS6pTT3g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.63.2.tgz", + "integrity": "sha512-hKgB3nz/TKD3Wv78XEsyXzQsNjvhOHmwKQTvXADGOyU/cIClZDO7DsoggbdmJDPGp5V80tA3Vfv61PaKTLH3LA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.63.2.tgz", + "integrity": "sha512-T4wf1mudIDxN8Q/CWIBJC1u5gQUc+r5mPvlwoSbIvNkyVTP2TAFeobEmst5AQ4gMyAz4sSByVdoTDfvTmGK/8g==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.63.2.tgz", + "integrity": "sha512-tC3IY7qoaD9Ll3/8WJQn49j5V2f/NuI9S41NOE2iM5MPs3sPIvOkVToLcz/7Bz4pyF7PSvrtwu8I/pUrGOSecQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.63.2.tgz", + "integrity": "sha512-6NHnk/K3eq2ZFYcU1X8g67s9qIJRCOTT92gwLMVBp08dB2uuuwI1/Q/empzL2Bfr2f2WRLJVwpp90RmacQyFkw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmmirror.com/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/node": { "version": "22.20.2", "resolved": "https://registry.npmmirror.com/@types/node/-/node-22.20.2.tgz", @@ -489,6 +906,132 @@ "@esbuild/win32-x64": "0.24.2" } }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.19", + "resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.19.tgz", + "integrity": "sha512-Y2tUNy4ouw6tq5oDSKeQYGOyhkUBhNOcGV/02KC+6kd9eDGqdZd++mjMiIDilrBYvjEnCYvVtsuHCuP+okSfug==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmmirror.com/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/postcss": { + "version": "8.5.28", + "resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.5.28.tgz", + "integrity": "sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.18", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/rollup": { + "version": "4.63.2", + "resolved": "https://registry.npmmirror.com/rollup/-/rollup-4.63.2.tgz", + "integrity": "sha512-l5eyksV4tPBj6lJyEa37YzIOCSOV7lkZzEHUdpjWZbtD7wTcFYmEYXSgm5bT4vV+dZLb9rBG1W9GROOG4NS4Ew==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.9" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@napi-rs/lzma-linux-x64-gnu": "1.5.1", + "@rollup/rollup-android-arm-eabi": "4.63.2", + "@rollup/rollup-android-arm64": "4.63.2", + "@rollup/rollup-darwin-arm64": "4.63.2", + "@rollup/rollup-darwin-x64": "4.63.2", + "@rollup/rollup-freebsd-arm64": "4.63.2", + "@rollup/rollup-freebsd-x64": "4.63.2", + "@rollup/rollup-linux-arm-gnueabihf": "4.63.2", + "@rollup/rollup-linux-arm-musleabihf": "4.63.2", + "@rollup/rollup-linux-arm64-gnu": "4.63.2", + "@rollup/rollup-linux-arm64-musl": "4.63.2", + "@rollup/rollup-linux-loong64-gnu": "4.63.2", + "@rollup/rollup-linux-loong64-musl": "4.63.2", + "@rollup/rollup-linux-ppc64-gnu": "4.63.2", + "@rollup/rollup-linux-ppc64-musl": "4.63.2", + "@rollup/rollup-linux-riscv64-gnu": "4.63.2", + "@rollup/rollup-linux-riscv64-musl": "4.63.2", + "@rollup/rollup-linux-s390x-gnu": "4.63.2", + "@rollup/rollup-linux-x64-gnu": "4.63.2", + "@rollup/rollup-linux-x64-musl": "4.63.2", + "@rollup/rollup-openbsd-x64": "4.63.2", + "@rollup/rollup-openharmony-arm64": "4.63.2", + "@rollup/rollup-win32-arm64-msvc": "4.63.2", + "@rollup/rollup-win32-ia32-msvc": "4.63.2", + "@rollup/rollup-win32-x64-gnu": "4.63.2", + "@rollup/rollup-win32-x64-msvc": "4.63.2", + "fsevents": "~2.3.2" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmmirror.com/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/typescript": { "version": "5.9.3", "resolved": "https://registry.npmmirror.com/typescript/-/typescript-5.9.3.tgz", @@ -509,6 +1052,496 @@ "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", "dev": true, "license": "MIT" + }, + "node_modules/vite": { + "version": "5.4.21", + "resolved": "https://registry.npmmirror.com/vite/-/vite-5.4.21.tgz", + "integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.21.3", + "postcss": "^8.4.43", + "rollup": "^4.20.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || >=20.0.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + }, + "node_modules/vite/node_modules/@esbuild/aix-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", + "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/android-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/android-arm/-/android-arm-0.21.5.tgz", + "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/android-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", + "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/android-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/android-x64/-/android-x64-0.21.5.tgz", + "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/darwin-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", + "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/darwin-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", + "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/freebsd-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", + "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/freebsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", + "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", + "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", + "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", + "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-loong64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", + "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-mips64el": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", + "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", + "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-riscv64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", + "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-s390x": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", + "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/linux-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", + "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/netbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", + "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/openbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", + "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/sunos-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", + "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/win32-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", + "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/win32-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", + "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/@esbuild/win32-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", + "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/vite/node_modules/esbuild": { + "version": "0.21.5", + "resolved": "https://registry.npmmirror.com/esbuild/-/esbuild-0.21.5.tgz", + "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.21.5", + "@esbuild/android-arm": "0.21.5", + "@esbuild/android-arm64": "0.21.5", + "@esbuild/android-x64": "0.21.5", + "@esbuild/darwin-arm64": "0.21.5", + "@esbuild/darwin-x64": "0.21.5", + "@esbuild/freebsd-arm64": "0.21.5", + "@esbuild/freebsd-x64": "0.21.5", + "@esbuild/linux-arm": "0.21.5", + "@esbuild/linux-arm64": "0.21.5", + "@esbuild/linux-ia32": "0.21.5", + "@esbuild/linux-loong64": "0.21.5", + "@esbuild/linux-mips64el": "0.21.5", + "@esbuild/linux-ppc64": "0.21.5", + "@esbuild/linux-riscv64": "0.21.5", + "@esbuild/linux-s390x": "0.21.5", + "@esbuild/linux-x64": "0.21.5", + "@esbuild/netbsd-x64": "0.21.5", + "@esbuild/openbsd-x64": "0.21.5", + "@esbuild/sunos-x64": "0.21.5", + "@esbuild/win32-arm64": "0.21.5", + "@esbuild/win32-ia32": "0.21.5", + "@esbuild/win32-x64": "0.21.5" + } } } } diff --git a/frontend/package.json b/frontend/package.json index a2fa373..a449ce9 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -4,6 +4,8 @@ "version": "0.0.0", "type": "module", "scripts": { + "predev": "node scripts/gen-dev-html.mjs", + "dev": "vite", "build": "node esbuild.config.mjs", "watch": "node esbuild.config.mjs --watch", "typecheck": "tsc --noEmit", @@ -15,6 +17,7 @@ "devDependencies": { "@types/node": "^22.20.2", "esbuild": "^0.24.0", - "typescript": "^5.6.0" + "typescript": "^5.6.0", + "vite": "^5.4.0" } } diff --git a/frontend/scripts/gen-dev-html.mjs b/frontend/scripts/gen-dev-html.mjs new file mode 100644 index 0000000..1c32433 --- /dev/null +++ b/frontend/scripts/gen-dev-html.mjs @@ -0,0 +1,21 @@ +// 由规范页面 src/genesis/server/static/chat.html 生成本地开发用 frontend/index.html +// (仅用于 Vite dev;写入 index.html 供 Vite 作为入口,产物不入库) +import { readFileSync, writeFileSync } from 'node:fs'; +import { fileURLToPath } from 'node:url'; +import { dirname, resolve } from 'node:path'; + +const here = dirname(fileURLToPath(import.meta.url)); +const frontend = resolve(here, '..'); +const canonical = resolve(frontend, '../src/genesis/server/static/chat.html'); + +let html = readFileSync(canonical, 'utf8'); +html = html + // 入口脚本 -> 指向 TS 源(Vite HMR) + .replace(/') + // 移除生产 CSS 链接(dev 由 main.ts 导入 chat.css,启用样式 HMR) + .replace(/\s*/, '') + // 去掉资源版本占位 + .replace(/\?v=__ASSET_VER__/g, ''); + +writeFileSync(resolve(frontend, 'index.html'), html); +console.log('generated frontend/index.html from src/genesis/server/static/chat.html'); diff --git a/frontend/src/chat.css b/frontend/src/chat.css new file mode 100644 index 0000000..7f0b5a7 --- /dev/null +++ b/frontend/src/chat.css @@ -0,0 +1,478 @@ +/* src/genesis/server/static/chat.css + v1 深色重塑 - 深色指挥中心 + 文档工作台混合风格 + spec: docs/superpowers/specs/2026-08-30-frontend-beautify-design.md §一 / §二 + plan: docs/superpowers/plans/2026-08-30-frontend-beautify.md Task 2 +*/ +:root { + /* === 颜色 (spec §一) === */ + --bg-base: #0B0F17; + --bg-surface: #141A24; + --bg-elevated: #1B2330; + --bg-input: #0F141C; + --border-subtle: rgba(255, 255, 255, 0.08); + --border-strong: rgba(255, 255, 255, 0.14); + --text-primary: #E5EAF0; + --text-secondary: #8B95A7; + --text-muted: #5C6677; + --accent: #5EEAD4; + --accent-soft: rgba(94, 234, 212, 0.15); + --success: #34D399; + --warning: #FBBF24; + --danger: #F87171; + --info: #60A5FA; + + /* === 字体 (系统字体栈,spec §一 Q2 决策) === */ + --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", + "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif; + --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, + "Liberation Mono", monospace; + + /* === 间距 (spec §一) === */ + --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; + --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; + + /* === 圆角 (spec §一) === */ + --r-sm: 6px; --r-md: 10px; --r-lg: 14px; + + /* === 动效 (spec §一) === */ + --ease: cubic-bezier(.2, 0, 0, 1); + --dur: .18s; + + /* 输入区几何(单一来源,供消息区对齐) */ + --send-size: 40px; + --composer-gap: 10px; + --composer-gutter: calc(var(--send-size) + var(--composer-gap)); + + /* 抽屉 */ + --drawer-w: 520px; + --mask-bg: rgba(0, 0, 0, 0.5); +} + +/* === 全局 === */ +* { 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(--bg-base); color: var(--text-primary); + -webkit-font-smoothing: antialiased; + font-size: 14px; +} +::-webkit-scrollbar { width: 8px; height: 8px; } +::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; } +::-webkit-scrollbar-thumb:hover { background: var(--text-muted); } +::-webkit-scrollbar-track { background: transparent; } + +/* === 侧边栏 (spec §2.1) === */ +#sidebar { + width: 264px; background: var(--bg-surface); color: var(--text-primary); + display: flex; flex-direction: column; flex-shrink: 0; + border-right: 1px solid var(--border-subtle); + transition: width .25s var(--ease); + position: relative; +} +#sidebar.collapsed { width: 56px; } +#sidebar.collapsed #sidebar-toggle { /* 折叠态位置不再切换,按钮统一在侧边栏内下边 */ } +.brand { + display: flex; align-items: center; gap: 12px; + padding: 16px 12px 12px 16px; margin: 0 8px 8px; + border-bottom: 1px solid var(--border-subtle); + 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: var(--bg-base); font-size: 17px; font-weight: 900; + background: var(--accent); + transition: transform var(--dur) var(--ease); +} +.brand:hover .brand-logo { transform: scale(1.1); box-shadow: 0 0 24px var(--accent-soft); } +.brand-name { font-size: 17px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; color: var(--text-primary); } +.brand-sub { display: block; font-size: 11px; font-weight: 500; color: var(--text-muted); margin-top: 2px; letter-spacing: 0; } +#sidebar.collapsed .brand-name { display: none; } +#sidebar-toggle { + position: absolute; top: auto; bottom: 14px; left: 14px; z-index: 5; + width: 28px; height: 28px; border-radius: 50%; + background: var(--bg-elevated); border: 1px solid var(--border-strong); + color: var(--text-secondary); cursor: pointer; font-size: 14px; line-height: 1; + display: flex; align-items: center; justify-content: center; + transition: all var(--dur) var(--ease); +} +#sidebar-toggle:hover { color: var(--accent); border-color: var(--accent); } +#new-chat { + margin: var(--sp-2) var(--sp-4) var(--sp-3); background: var(--accent); color: var(--bg-base); + border: none; padding: 10px 14px; border-radius: var(--r-md); + cursor: pointer; font-size: 14px; font-weight: 700; letter-spacing: .01em; + transition: all var(--dur) var(--ease); + display: flex; align-items: center; justify-content: center; gap: 6px; +} +#new-chat:hover { box-shadow: 0 0 24px var(--accent-soft); transform: translateY(-1px); } +#new-chat:active { transform: translateY(0); } +#sidebar.collapsed #new-chat { margin: var(--sp-2) 10px var(--sp-3); padding: 10px 0; } +#new-chat .ic-plus { display: inline-block; font-weight: 900; } +#sidebar.collapsed #new-chat .nc-text { display: none; } +/* 侧边栏分区(项目 / 其他会话) */ +.side-section { display: flex; flex-direction: column; min-height: 0; } +#sidebar.collapsed .side-section { display: none; } +.side-head { + display: flex; align-items: center; justify-content: space-between; + margin: var(--sp-3) var(--sp-4) var(--sp-2); +} +.side-title { + font-family: var(--font-mono); font-size: 11px; font-weight: 500; + letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); +} +.side-add { + background: transparent; border: 1px solid var(--border-strong); border-radius: var(--r-sm); + color: var(--text-secondary); cursor: pointer; width: 22px; height: 22px; line-height: 1; + font-size: 15px; display: flex; align-items: center; justify-content: center; + transition: all var(--dur) var(--ease); +} +.side-add:hover { border-color: var(--accent); color: var(--accent); } +#project-tree, #other-session-list { padding: 0 8px 8px; overflow-y: auto; } +#project-tree { flex: 0 1 auto; } +#sec-others { flex: 1; min-height: 0; } +/* 项目分组 */ +.proj-group { margin: 2px 0; } +.proj-row { + display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-radius: var(--r-md); + cursor: pointer; transition: all var(--dur) var(--ease); border: 1px solid transparent; +} +.proj-row:hover { background: var(--bg-elevated); } +.proj-group.current .proj-row { background: var(--bg-elevated); border-color: var(--accent); } +.proj-group.has-active .proj-row .proj-name { color: var(--accent); font-weight: 700; } +.proj-caret { font-size: 10px; color: var(--text-muted); width: 12px; flex-shrink: 0; } +.proj-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; + font-size: 13px; color: var(--text-primary); } +.proj-config { + flex-shrink: 0; opacity: 0; transition: opacity .15s ease; background: transparent; + border: none; color: var(--text-muted); cursor: pointer; width: 22px; height: 22px; border-radius: 6px; + font-size: 13px; display: flex; align-items: center; justify-content: center; +} +.proj-row:hover .proj-config { opacity: .8; } +.proj-config:hover { opacity: 1 !important; background: var(--bg-base); color: var(--accent); } +.proj-sessions { padding-left: 14px; } +.sess { + padding: 9px 12px; border-radius: var(--r-md); margin: 2px 0; + cursor: pointer; position: relative; border: 1px solid transparent; + transition: all var(--dur) var(--ease); + display: flex; align-items: center; gap: 6px; +} +.sess:hover { background: var(--bg-elevated); } +.sess:hover::before { + content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; + background: var(--accent); border-radius: 0 2px 2px 0; +} +.sess.active { background: var(--bg-elevated); } +.sess.active::before { + content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; + background: var(--accent); border-radius: 0 2px 2px 0; +} +.sess .info { flex: 1; min-width: 0; overflow: hidden; } +.sess .name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); } +.sess.active .name { font-weight: 700; } +.sess .meta { font-size: 11px; color: var(--text-muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-mono); } +.sess .del { + flex-shrink: 0; opacity: 0; transition: opacity .15s ease; + background: transparent; border: none; color: var(--text-muted); 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(--danger); color: var(--bg-base); } +.sess .avatar { display: none; } + +/* === 主区 + 顶栏 (spec §2.2) === */ +#main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg-base); } +header { + height: 48px; position: sticky; top: 0; z-index: 10; + padding: 0 var(--sp-4); display: flex; align-items: center; gap: 14px; + background: rgba(20, 26, 36, 0.78); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); + border-bottom: 1px solid var(--border-subtle); +} +header h1 { font-size: 16px; font-weight: 700; letter-spacing: -.02em; margin: 0; color: var(--text-primary); } +.proj-switcher { position: relative; } +.ps-current { + display: flex; align-items: center; gap: 8px; + background: transparent; border: 1px solid var(--border-strong); + border-radius: var(--r-md); padding: 7px 12px; cursor: pointer; + font-size: 13px; font-weight: 500; color: var(--text-primary); + transition: all var(--dur) var(--ease); +} +.ps-current:hover { border-color: var(--accent); } +.ps-current .ps-label { font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); } +.ps-current .ps-name { max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.ps-current .ps-caret { font-size: 10px; color: var(--text-muted); } +.ps-menu { + position: absolute; bottom: calc(100% + 6px); top: auto; left: 0; min-width: 240px; + background: var(--bg-surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); + box-shadow: 0 8px 32px rgba(0,0,0,.4); padding: 6px; z-index: 20; + display: none; +} +.ps-menu.open { display: block; animation: zoomIn .2s var(--ease); } +.ps-item { + padding: 8px 12px; border-radius: var(--r-sm); cursor: pointer; font-size: 13px; color: var(--text-secondary); + display: flex; align-items: center; gap: 8px; transition: background .15s var(--ease); +} +.ps-item:hover { background: var(--bg-elevated); color: var(--text-primary); } +.ps-item.active { background: var(--bg-elevated); color: var(--accent); font-weight: 700; } +.ps-item .ps-check { margin-left: auto; color: var(--accent); font-weight: 900; opacity: 0; } +.ps-item.active .ps-check { opacity: 1; } +.ps-sep { height: 1px; background: var(--border-subtle); margin: 4px 6px; } +.ps-manage { color: var(--accent); font-weight: 600; } +#sid-badge { + margin-left: auto; + background: var(--bg-elevated); color: var(--text-primary); + border: 1px solid var(--border-subtle); + border-radius: 999px; padding: 4px 14px; font-size: 12px; font-weight: 500; + max-width: 32%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; + font-family: var(--font-mono); +} + +/* === RAG 控制条 (spec §2.2) === */ +#rag-bar { + display: flex; align-items: center; gap: 8px; + background: transparent; border: 1px solid var(--border-subtle); + border-radius: 999px; padding: 3px 10px; + font-size: 12px; color: var(--text-secondary); + font-family: var(--font-mono); +} +#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(--accent); + margin: 0; +} +#rag-bar input[type=checkbox]:disabled + span { color: var(--text-muted); cursor: not-allowed; } +#rag-bar .rag-stats { color: var(--text-muted); } +#rag-bar .rag-stats.ready { color: var(--accent); font-weight: 600; } +#rag-bar .rag-stats.zero { color: var(--text-muted); } +#rag-bar button { + background: var(--accent); color: var(--bg-base); border: none; + border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 700; + cursor: pointer; transition: all var(--dur) var(--ease); +} +#rag-bar button:disabled { background: var(--bg-elevated); color: var(--text-muted); cursor: not-allowed; } +#rag-bar button:hover:not(:disabled) { box-shadow: 0 0 16px var(--accent-soft); } + +/* === 聊天区 (spec §2.3) === */ +#chat { flex: 1; overflow-y: auto; padding: var(--sp-6) var(--sp-4); max-width: none; width: 100%; margin: 0; } +.msg { display: flex; margin: var(--sp-3) 0; padding-right: var(--composer-gutter); animation: zoomIn .25s var(--ease); position: relative; } +.msg .bubble { + max-width: 100%; padding: 11px 16px; border-radius: var(--r-lg); + white-space: pre-wrap; line-height: 1.65; font-size: 14px; letter-spacing: .01em; +} +.msg.user { justify-content: flex-end; } +.msg.user .bubble { + background: var(--bg-surface); + color: var(--text-primary); + border-bottom-right-radius: 6px; + border-left: 2px solid var(--accent); + padding-left: 18px; /* 抵消左边框占用的空间,避免文字偏移 */ +} +.msg.assistant { align-items: flex-start; } +.msg.assistant .bubble { + background: var(--bg-surface); + border: 1px solid var(--border-subtle); + border-bottom-left-radius: 6px; + color: var(--text-primary); +} + +.msg.progress .bubble { + background: var(--bg-input); border: 1px dashed var(--accent-soft); + font-size: 13px; color: var(--text-secondary); + font-family: var(--font-mono); +} +.msg.error .bubble { + background: rgba(248, 113, 113, 0.12); border: 1px solid var(--danger); color: var(--danger); +} +.progress-item { display: block; } +.progress-item.ok::before { content: "✔ "; color: var(--success); font-weight: 700; } +.progress-item.warn::before { content: "⚠ "; color: var(--warning); font-weight: 700; } +.actions { margin-top: 8px; } +.actions a { + display: inline-block; margin: 4px 6px 0 0; background: var(--accent); color: var(--bg-base); + padding: 6px 14px; border-radius: 999px; text-decoration: none; font-size: 13px; font-weight: 700; + transition: all var(--dur) var(--ease); +} +.actions a:hover { box-shadow: 0 0 16px var(--accent-soft); transform: translateY(-1px); } +.typing { color: var(--text-muted); font-size: 13px; animation: auraPulse 1.4s ease-in-out infinite; font-family: var(--font-mono); } + +/* === 上传条 (spec §2.4) === */ +#upload-bar { background: var(--bg-surface); border-top: 1px solid var(--border-subtle); padding: var(--sp-3) var(--sp-6); 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(--border-strong); border-radius: var(--r-md); + background: var(--bg-input); color: var(--text-primary); cursor: pointer; outline: none; + transition: all var(--dur) var(--ease); + font-family: var(--font-ui); +} +#upload-bar select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); } +.file-pick { + display: inline-block; padding: 8px 14px; border: 1px solid var(--border-strong); border-radius: var(--r-md); + background: var(--bg-input); color: var(--text-secondary); font-size: 13px; font-weight: 500; + cursor: pointer; transition: all var(--dur) var(--ease); +} +.file-pick:hover { border-color: var(--accent); color: var(--accent); } +#upload-btn { + background: transparent; border: 1px solid var(--border-strong); color: var(--text-primary); + border-radius: var(--r-md); padding: 8px 16px; cursor: pointer; font-size: 13px; font-weight: 600; + transition: all var(--dur) var(--ease); +} +#upload-btn:hover { background: var(--accent); border-color: var(--accent); color: var(--bg-base); } +#upload-status { color: var(--text-muted); font-size: 12px; font-family: var(--font-mono); } +#proj-hint { + color: var(--warning); font-size: 12px; background: rgba(251,191,36,.1); border: 1px solid var(--warning); + border-left-width: 4px; border-radius: var(--r-sm); 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; } + +/* === 输入区 (spec §2.5) === */ +#composer { border-top: none; background: transparent; padding: var(--sp-3) var(--sp-4) var(--sp-4); } +#composer-inner { max-width: none; margin: 0; display: flex; gap: var(--composer-gap); align-items: flex-end; } +#input { + flex: 1; border: 1px solid var(--border-strong); border-radius: var(--r-md); + padding: 11px 14px; font-size: 14px; outline: none; background: var(--bg-input); + transition: all var(--dur) var(--ease); color: var(--text-primary); + font-family: var(--font-ui); + resize: none; min-height: 42px; max-height: 160px; line-height: 1.5; overflow-y: auto; +} +#input:focus { border-color: var(--accent); background: var(--bg-elevated); box-shadow: 0 0 0 2px var(--accent-soft); } +#input::placeholder { color: var(--text-muted); } +#send { + background: var(--accent); color: var(--bg-base); border: none; border-radius: 50%; + width: var(--send-size); height: var(--send-size); padding: 0; cursor: pointer; flex-shrink: 0; + display: flex; align-items: center; justify-content: center; + transition: all var(--dur) var(--ease); +} +#send svg { display: block; } +#send:hover:not(:disabled) { box-shadow: 0 0 24px var(--accent-soft); transform: translateY(-1px); } +#send:active:not(:disabled) { transform: translateY(0); } +#send:disabled { opacity: .3; cursor: not-allowed; } + +/* === 项目抽屉 (spec §2.6) === */ +#proj-drawer { + position: fixed; top: 0; right: 0; height: 100vh; width: var(--drawer-w); + background: var(--bg-surface); border-left: 1px solid var(--border-subtle); + box-shadow: -8px 0 32px rgba(0,0,0,.5); + transform: translateX(100%); transition: transform .3s var(--ease); + 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(--border-subtle); background: var(--bg-surface); + flex-shrink: 0; +} +.drawer-head h2 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; margin: 0; color: var(--text-primary); flex: 1; } +.drawer-close { + background: transparent; border: 1px solid var(--border-subtle); color: var(--text-secondary); + width: 32px; height: 32px; border-radius: 50%; cursor: pointer; + font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center; + transition: all var(--dur) var(--ease); +} +.drawer-close:hover { background: var(--danger); border-color: var(--danger); color: var(--bg-base); } +.drawer-body { flex: 1; display: flex; min-height: 0; } +/* 抽屉蒙版 */ +.drawer-mask { + position: fixed; inset: 0; z-index: 99; background: var(--mask-bg); + opacity: 0; visibility: hidden; + transition: opacity .3s var(--ease), visibility .3s var(--ease); +} +.drawer-mask.show { opacity: 1; visibility: visible; } +.drawer-form { flex: 1; overflow-y: auto; padding: var(--sp-4) var(--sp-5); display: flex; flex-direction: column; gap: 10px; } +.drawer-form label { + font-family: var(--font-mono); + font-size: 11px; font-weight: 500; color: var(--text-muted); + text-transform: uppercase; letter-spacing: .1em; margin-bottom: 2px; display: block; +} +.drawer-form input { + width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); + font-size: 13px; color: var(--text-primary); background: var(--bg-input); + transition: all var(--dur) var(--ease); + font-family: var(--font-ui); +} +.drawer-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); } +.drawer-form input:read-only { background: var(--bg-base); color: var(--text-muted); } +.drawer-form .field { display: flex; flex-direction: column; } +.drawer-form .drawer-hint { margin: 0 0 6px; } +.drawer-form details.advanced { border: 1px solid var(--border-subtle); border-radius: var(--r-sm); padding: 8px 12px; } +.drawer-form details.advanced > summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text-secondary); 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(--danger) !important; box-shadow: 0 0 0 2px rgba(248,113,113,.25) !important; } +.drawer-actions { display: flex; gap: 8px; margin-top: 8px; } +.drawer-actions button { flex: 1; padding: 10px; border: none; border-radius: var(--r-sm); cursor: pointer; font-size: 13px; font-weight: 600; transition: all var(--dur) var(--ease); } +.btn-save { background: var(--accent); color: var(--bg-base); } +.btn-save:hover { box-shadow: 0 0 16px var(--accent-soft); } +.btn-delete { background: transparent; color: var(--danger); border: 1px solid var(--danger) !important; } +.btn-delete:hover { background: var(--danger); color: var(--bg-base); } +.drawer-hint { font-size: 11px; color: var(--text-muted); line-height: 1.5; padding: 8px 0; } + +/* === 动效 + 响应式 === */ +@keyframes auraPulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } } +@keyframes zoomIn { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: scale(1); } } +@media (max-width: 860px) { + #sidebar { width: 220px; } + #sidebar.collapsed { width: 48px; } + #sid-badge { max-width: 24%; } + #proj-drawer { width: 100vw; } + .drawer-mask { display: none; } +} + +/* === 顶栏会话名 === */ +#session-title { font-size: 15px; font-weight: 700; letter-spacing: -.02em; color: var(--text-primary); + white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; } + +/* === 聊天区改为纵向 flex(空态垂直居中) === */ +#chat { display: flex; flex-direction: column; } + +/* === 空态(豆包式) === */ +.empty-state { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; + justify-content: center; text-align: center; padding: 32px 16px; gap: 10px; min-height: 0; } +.empty-state .es-logo { width: 56px; height: 56px; border-radius: 16px; display: flex; align-items: center; + justify-content: center; font-size: 26px; font-weight: 900; color: var(--bg-base); + background: var(--accent); box-shadow: 0 0 32px var(--accent-soft); } +.empty-state .es-title { font-size: 24px; font-weight: 700; margin: 6px 0 0; letter-spacing: -.02em; } +.empty-state .es-sub { font-size: 13px; color: var(--text-secondary); line-height: 1.7; margin: 0; max-width: 560px; } +.empty-state .suggests { display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)); gap: 10px; + margin-top: 16px; width: 100%; max-width: 620px; } +.suggest-card { text-align: left; padding: 12px 16px; border-radius: var(--r-md); + background: var(--bg-surface); border: 1px solid var(--border-subtle); color: var(--text-primary); + font-size: 13px; font-family: var(--font-ui); cursor: pointer; transition: all var(--dur) var(--ease); } +.suggest-card:hover { border-color: var(--accent); background: var(--bg-elevated); transform: translateY(-1px); } +.suggest-card::before { content: "\2192 "; color: var(--accent); font-weight: 700; } + +/* === 底部工具栏 === */ +#composer-toolbar { max-width: none; margin: 10px 0 0; display: flex; align-items: center; + gap: 8px; flex-wrap: wrap; } +.tb-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; + background: transparent; border: 1px solid var(--border-strong); border-radius: var(--r-md); + color: var(--text-secondary); font-size: 13px; font-weight: 500; font-family: var(--font-ui); + cursor: pointer; transition: all var(--dur) var(--ease); } +.tb-btn:hover { border-color: var(--accent); color: var(--accent); } +.tb-btn .tb-ic { font-size: 14px; line-height: 1; } +.tb-btn .tb-caret { font-size: 10px; color: var(--text-muted); } +.proj-switcher { position: relative; } +#upload-panel { max-width: none; margin: 10px 0 0; } + +/* === 会话项「⋯」与重命名菜单 === */ +.sess .kebab { flex-shrink: 0; opacity: 0; transition: opacity .15s ease; background: transparent; + border: none; color: var(--text-muted); cursor: pointer; width: 24px; height: 24px; border-radius: 6px; + font-size: 15px; line-height: 1; display: flex; align-items: center; justify-content: center; } +.sess:hover .kebab { opacity: .7; } +.sess .kebab:hover { opacity: 1 !important; background: var(--bg-base); color: var(--accent); } +.rename-input { flex: 1; min-width: 0; background: var(--bg-input); border: 1px solid var(--accent); + border-radius: var(--r-sm); color: var(--text-primary); font-size: 13px; padding: 3px 6px; + font-family: var(--font-ui); outline: none; } +.sess-menu { position: fixed; z-index: 120; background: var(--bg-surface); border: 1px solid var(--border-strong); + border-radius: var(--r-md); box-shadow: 0 8px 32px rgba(0,0,0,.5); padding: 4px; min-width: 140px; } +.sess-menu .sm-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; + background: transparent; border: none; border-radius: var(--r-sm); color: var(--text-secondary); + font-size: 13px; font-family: var(--font-ui); cursor: pointer; text-align: left; } +.sess-menu .sm-item:hover { background: var(--bg-elevated); color: var(--accent); } +.sess-menu .sm-ic { color: var(--accent); } +@media (max-width: 640px) { .empty-state .suggests { grid-template-columns: 1fr; } } diff --git a/frontend/src/main.ts b/frontend/src/main.ts index 541cc08..ab940f7 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -1,4 +1,5 @@ // Genesis Chat UI 业务逻辑(TypeScript 版;由 esbuild 打包为 /static/chat.js) +import './chat.css'; import { api } from './api.ts'; import { must, maybe, esc, setText } from './dom.ts'; import * as GenesisState from './state.ts'; diff --git a/frontend/src/vite-env.d.ts b/frontend/src/vite-env.d.ts new file mode 100644 index 0000000..710dd75 --- /dev/null +++ b/frontend/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index 33b7942..63b01a3 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -1,9 +1,13 @@ -{ +{ "compilerOptions": { "target": "ES2020", "module": "ESNext", "moduleResolution": "bundler", - "lib": ["ES2020", "DOM", "DOM.Iterable"], + "lib": [ + "ES2020", + "DOM", + "DOM.Iterable" + ], "strict": true, "allowImportingTsExtensions": true, "verbatimModuleSyntax": true, @@ -12,5 +16,9 @@ "skipLibCheck": true, "forceConsistentCasingInFileNames": true }, - "include": ["src", "tests"] + "include": [ + "src", + "tests", + "vite.config.ts" + ] } diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts new file mode 100644 index 0000000..31d2e9c --- /dev/null +++ b/frontend/vite.config.ts @@ -0,0 +1,15 @@ +import { defineConfig } from 'vite'; + +// 开发用 Vite dev server:提供 HMR,并把 API / 静态资源代理到本地 FastAPI(:8000)。 +// 生产构建仍走 esbuild(npm run build)。 +export default defineConfig({ + root: '.', + server: { + host: '127.0.0.1', + port: 5173, + proxy: { + '/api': { target: 'http://127.0.0.1:8000', changeOrigin: true, ws: true }, + '/static': { target: 'http://127.0.0.1:8000', changeOrigin: true }, + }, + }, +}); diff --git a/src/genesis/server/static/chat.css b/src/genesis/server/static/chat.css index 7f0b5a7..fae243a 100644 --- a/src/genesis/server/static/chat.css +++ b/src/genesis/server/static/chat.css @@ -1,10 +1,5 @@ -/* src/genesis/server/static/chat.css - v1 深色重塑 - 深色指挥中心 + 文档工作台混合风格 - spec: docs/superpowers/specs/2026-08-30-frontend-beautify-design.md §一 / §二 - plan: docs/superpowers/plans/2026-08-30-frontend-beautify.md Task 2 -*/ +/* src/chat.css */ :root { - /* === 颜色 (spec §一) === */ --bg-base: #0B0F17; --bg-surface: #141A24; --bg-elevated: #1B2330; @@ -20,459 +15,1254 @@ --warning: #FBBF24; --danger: #F87171; --info: #60A5FA; - - /* === 字体 (系统字体栈,spec §一 Q2 决策) === */ - --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", - "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif; - --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, - "Liberation Mono", monospace; - - /* === 间距 (spec §一) === */ - --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; - --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; - - /* === 圆角 (spec §一) === */ - --r-sm: 6px; --r-md: 10px; --r-lg: 14px; - - /* === 动效 (spec §一) === */ + --font-ui: + -apple-system, + BlinkMacSystemFont, + "Segoe UI", + "PingFang SC", + "Microsoft YaHei", + "Noto Sans CJK SC", + system-ui, + sans-serif; + --font-mono: + ui-monospace, + SFMono-Regular, + "SF Mono", + Menlo, + Consolas, + "Liberation Mono", + monospace; + --sp-1: 4px; + --sp-2: 8px; + --sp-3: 12px; + --sp-4: 16px; + --sp-5: 20px; + --sp-6: 24px; + --r-sm: 6px; + --r-md: 10px; + --r-lg: 14px; --ease: cubic-bezier(.2, 0, 0, 1); --dur: .18s; - - /* 输入区几何(单一来源,供消息区对齐) */ --send-size: 40px; --composer-gap: 10px; --composer-gutter: calc(var(--send-size) + var(--composer-gap)); - - /* 抽屉 */ --drawer-w: 520px; --mask-bg: rgba(0, 0, 0, 0.5); } - -/* === 全局 === */ -* { box-sizing: border-box; } -html, body { height: 100%; } +* { + 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(--bg-base); color: var(--text-primary); + margin: 0; + height: 100vh; + display: flex; + flex-direction: row; + background: var(--bg-base); + color: var(--text-primary); -webkit-font-smoothing: antialiased; font-size: 14px; } -::-webkit-scrollbar { width: 8px; height: 8px; } -::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; } -::-webkit-scrollbar-thumb:hover { background: var(--text-muted); } -::-webkit-scrollbar-track { background: transparent; } - -/* === 侧边栏 (spec §2.1) === */ +::-webkit-scrollbar { + width: 8px; + height: 8px; +} +::-webkit-scrollbar-thumb { + background: var(--border-strong); + border-radius: 8px; +} +::-webkit-scrollbar-thumb:hover { + background: var(--text-muted); +} +::-webkit-scrollbar-track { + background: transparent; +} #sidebar { - width: 264px; background: var(--bg-surface); color: var(--text-primary); - display: flex; flex-direction: column; flex-shrink: 0; + width: 264px; + background: var(--bg-surface); + color: var(--text-primary); + display: flex; + flex-direction: column; + flex-shrink: 0; border-right: 1px solid var(--border-subtle); transition: width .25s var(--ease); position: relative; } -#sidebar.collapsed { width: 56px; } -#sidebar.collapsed #sidebar-toggle { /* 折叠态位置不再切换,按钮统一在侧边栏内下边 */ } +#sidebar.collapsed { + width: 56px; +} +#sidebar.collapsed #sidebar-toggle { +} .brand { - display: flex; align-items: center; gap: 12px; - padding: 16px 12px 12px 16px; margin: 0 8px 8px; + display: flex; + align-items: center; + gap: 12px; + padding: 16px 12px 12px 16px; + margin: 0 8px 8px; border-bottom: 1px solid var(--border-subtle); min-height: 64px; } -#sidebar.collapsed .brand { padding: 16px 8px; justify-content: center; gap: 0; } +#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: var(--bg-base); font-size: 17px; font-weight: 900; + width: 36px; + height: 36px; + border-radius: 10px; + flex-shrink: 0; + display: flex; + align-items: center; + justify-content: center; + color: var(--bg-base); + font-size: 17px; + font-weight: 900; background: var(--accent); transition: transform var(--dur) var(--ease); } -.brand:hover .brand-logo { transform: scale(1.1); box-shadow: 0 0 24px var(--accent-soft); } -.brand-name { font-size: 17px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; color: var(--text-primary); } -.brand-sub { display: block; font-size: 11px; font-weight: 500; color: var(--text-muted); margin-top: 2px; letter-spacing: 0; } -#sidebar.collapsed .brand-name { display: none; } +.brand:hover .brand-logo { + transform: scale(1.1); + box-shadow: 0 0 24px var(--accent-soft); +} +.brand-name { + font-size: 17px; + font-weight: 700; + letter-spacing: -.02em; + line-height: 1.1; + color: var(--text-primary); +} +.brand-sub { + display: block; + font-size: 11px; + font-weight: 500; + color: var(--text-muted); + margin-top: 2px; + letter-spacing: 0; +} +#sidebar.collapsed .brand-name { + display: none; +} #sidebar-toggle { - position: absolute; top: auto; bottom: 14px; left: 14px; z-index: 5; - width: 28px; height: 28px; border-radius: 50%; - background: var(--bg-elevated); border: 1px solid var(--border-strong); - color: var(--text-secondary); cursor: pointer; font-size: 14px; line-height: 1; - display: flex; align-items: center; justify-content: center; + position: absolute; + top: auto; + bottom: 14px; + left: 14px; + z-index: 5; + width: 28px; + height: 28px; + border-radius: 50%; + background: var(--bg-elevated); + border: 1px solid var(--border-strong); + color: var(--text-secondary); + cursor: pointer; + font-size: 14px; + line-height: 1; + display: flex; + align-items: center; + justify-content: center; transition: all var(--dur) var(--ease); } -#sidebar-toggle:hover { color: var(--accent); border-color: var(--accent); } +#sidebar-toggle:hover { + color: var(--accent); + border-color: var(--accent); +} #new-chat { - margin: var(--sp-2) var(--sp-4) var(--sp-3); background: var(--accent); color: var(--bg-base); - border: none; padding: 10px 14px; border-radius: var(--r-md); - cursor: pointer; font-size: 14px; font-weight: 700; letter-spacing: .01em; + margin: var(--sp-2) var(--sp-4) var(--sp-3); + background: var(--accent); + color: var(--bg-base); + border: none; + padding: 10px 14px; + border-radius: var(--r-md); + cursor: pointer; + font-size: 14px; + font-weight: 700; + letter-spacing: .01em; transition: all var(--dur) var(--ease); - display: flex; align-items: center; justify-content: center; gap: 6px; + display: flex; + align-items: center; + justify-content: center; + gap: 6px; +} +#new-chat:hover { + box-shadow: 0 0 24px var(--accent-soft); + transform: translateY(-1px); +} +#new-chat:active { + transform: translateY(0); +} +#sidebar.collapsed #new-chat { + margin: var(--sp-2) 10px var(--sp-3); + padding: 10px 0; +} +#new-chat .ic-plus { + display: inline-block; + font-weight: 900; +} +#sidebar.collapsed #new-chat .nc-text { + display: none; +} +.side-section { + display: flex; + flex-direction: column; + min-height: 0; +} +#sidebar.collapsed .side-section { + display: none; } -#new-chat:hover { box-shadow: 0 0 24px var(--accent-soft); transform: translateY(-1px); } -#new-chat:active { transform: translateY(0); } -#sidebar.collapsed #new-chat { margin: var(--sp-2) 10px var(--sp-3); padding: 10px 0; } -#new-chat .ic-plus { display: inline-block; font-weight: 900; } -#sidebar.collapsed #new-chat .nc-text { display: none; } -/* 侧边栏分区(项目 / 其他会话) */ -.side-section { display: flex; flex-direction: column; min-height: 0; } -#sidebar.collapsed .side-section { display: none; } .side-head { - display: flex; align-items: center; justify-content: space-between; + display: flex; + align-items: center; + justify-content: space-between; margin: var(--sp-3) var(--sp-4) var(--sp-2); } .side-title { - font-family: var(--font-mono); font-size: 11px; font-weight: 500; - letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); + font-family: var(--font-mono); + font-size: 11px; + font-weight: 500; + letter-spacing: .12em; + text-transform: uppercase; + color: var(--text-muted); } .side-add { - background: transparent; border: 1px solid var(--border-strong); border-radius: var(--r-sm); - color: var(--text-secondary); cursor: pointer; width: 22px; height: 22px; line-height: 1; - font-size: 15px; display: flex; align-items: center; justify-content: center; + background: transparent; + border: 1px solid var(--border-strong); + border-radius: var(--r-sm); + color: var(--text-secondary); + cursor: pointer; + width: 22px; + height: 22px; + line-height: 1; + font-size: 15px; + display: flex; + align-items: center; + justify-content: center; transition: all var(--dur) var(--ease); } -.side-add:hover { border-color: var(--accent); color: var(--accent); } -#project-tree, #other-session-list { padding: 0 8px 8px; overflow-y: auto; } -#project-tree { flex: 0 1 auto; } -#sec-others { flex: 1; min-height: 0; } -/* 项目分组 */ -.proj-group { margin: 2px 0; } +.side-add:hover { + border-color: var(--accent); + color: var(--accent); +} +#project-tree, +#other-session-list { + padding: 0 8px 8px; + overflow-y: auto; +} +#project-tree { + flex: 0 1 auto; +} +#sec-others { + flex: 1; + min-height: 0; +} +.proj-group { + margin: 2px 0; +} .proj-row { - display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-radius: var(--r-md); - cursor: pointer; transition: all var(--dur) var(--ease); border: 1px solid transparent; + display: flex; + align-items: center; + gap: 6px; + padding: 7px 8px; + border-radius: var(--r-md); + cursor: pointer; + transition: all var(--dur) var(--ease); + border: 1px solid transparent; +} +.proj-row:hover { + background: var(--bg-elevated); +} +.proj-group.current .proj-row { + background: var(--bg-elevated); + border-color: var(--accent); +} +.proj-group.has-active .proj-row .proj-name { + color: var(--accent); + font-weight: 700; +} +.proj-caret { + font-size: 10px; + color: var(--text-muted); + width: 12px; + flex-shrink: 0; +} +.proj-name { + flex: 1; + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-size: 13px; + color: var(--text-primary); } -.proj-row:hover { background: var(--bg-elevated); } -.proj-group.current .proj-row { background: var(--bg-elevated); border-color: var(--accent); } -.proj-group.has-active .proj-row .proj-name { color: var(--accent); font-weight: 700; } -.proj-caret { font-size: 10px; color: var(--text-muted); width: 12px; flex-shrink: 0; } -.proj-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; - font-size: 13px; color: var(--text-primary); } .proj-config { - flex-shrink: 0; opacity: 0; transition: opacity .15s ease; background: transparent; - border: none; color: var(--text-muted); cursor: pointer; width: 22px; height: 22px; border-radius: 6px; - font-size: 13px; display: flex; align-items: center; justify-content: center; + flex-shrink: 0; + opacity: 0; + transition: opacity .15s ease; + background: transparent; + border: none; + color: var(--text-muted); + cursor: pointer; + width: 22px; + height: 22px; + border-radius: 6px; + font-size: 13px; + display: flex; + align-items: center; + justify-content: center; +} +.proj-row:hover .proj-config { + opacity: .8; +} +.proj-config:hover { + opacity: 1 !important; + background: var(--bg-base); + color: var(--accent); +} +.proj-sessions { + padding-left: 14px; } -.proj-row:hover .proj-config { opacity: .8; } -.proj-config:hover { opacity: 1 !important; background: var(--bg-base); color: var(--accent); } -.proj-sessions { padding-left: 14px; } .sess { - padding: 9px 12px; border-radius: var(--r-md); margin: 2px 0; - cursor: pointer; position: relative; border: 1px solid transparent; + padding: 9px 12px; + border-radius: var(--r-md); + margin: 2px 0; + cursor: pointer; + position: relative; + border: 1px solid transparent; transition: all var(--dur) var(--ease); - display: flex; align-items: center; gap: 6px; + display: flex; + align-items: center; + gap: 6px; +} +.sess:hover { + background: var(--bg-elevated); } -.sess:hover { background: var(--bg-elevated); } .sess:hover::before { - content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; - background: var(--accent); border-radius: 0 2px 2px 0; + content: ""; + position: absolute; + left: 0; + top: 8px; + bottom: 8px; + width: 2px; + background: var(--accent); + border-radius: 0 2px 2px 0; +} +.sess.active { + background: var(--bg-elevated); } -.sess.active { background: var(--bg-elevated); } .sess.active::before { - content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; - background: var(--accent); border-radius: 0 2px 2px 0; + content: ""; + position: absolute; + left: 0; + top: 8px; + bottom: 8px; + width: 2px; + background: var(--accent); + border-radius: 0 2px 2px 0; } -.sess .info { flex: 1; min-width: 0; overflow: hidden; } -.sess .name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); } -.sess.active .name { font-weight: 700; } -.sess .meta { font-size: 11px; color: var(--text-muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-mono); } -.sess .del { - flex-shrink: 0; opacity: 0; transition: opacity .15s ease; - background: transparent; border: none; color: var(--text-muted); cursor: pointer; - width: 24px; height: 24px; border-radius: 6px; font-size: 16px; line-height: 1; - display: flex; align-items: center; justify-content: center; +.sess .info { + flex: 1; + min-width: 0; + overflow: hidden; } -.sess:hover .del { opacity: .7; } -.sess .del:hover { opacity: 1 !important; background: var(--danger); color: var(--bg-base); } -.sess .avatar { display: none; } - -/* === 主区 + 顶栏 (spec §2.2) === */ -#main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg-base); } -header { - height: 48px; position: sticky; top: 0; z-index: 10; - padding: 0 var(--sp-4); display: flex; align-items: center; gap: 14px; - background: rgba(20, 26, 36, 0.78); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); - border-bottom: 1px solid var(--border-subtle); +.sess .name { + font-size: 13px; + font-weight: 500; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + color: var(--text-primary); } -header h1 { font-size: 16px; font-weight: 700; letter-spacing: -.02em; margin: 0; color: var(--text-primary); } -.proj-switcher { position: relative; } -.ps-current { - display: flex; align-items: center; gap: 8px; - background: transparent; border: 1px solid var(--border-strong); - border-radius: var(--r-md); padding: 7px 12px; cursor: pointer; - font-size: 13px; font-weight: 500; color: var(--text-primary); - transition: all var(--dur) var(--ease); +.sess.active .name { + font-weight: 700; } -.ps-current:hover { border-color: var(--accent); } -.ps-current .ps-label { font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); } -.ps-current .ps-name { max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } -.ps-current .ps-caret { font-size: 10px; color: var(--text-muted); } +.sess .meta { + font-size: 11px; + color: var(--text-muted); + margin-top: 1px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + font-family: var(--font-mono); +} +.sess .del { + flex-shrink: 0; + opacity: 0; + transition: opacity .15s ease; + background: transparent; + border: none; + color: var(--text-muted); + 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(--danger); + color: var(--bg-base); +} +.sess .avatar { + display: none; +} +#main { + flex: 1; + display: flex; + flex-direction: column; + min-width: 0; + background: var(--bg-base); +} +header { + height: 48px; + position: sticky; + top: 0; + z-index: 10; + padding: 0 var(--sp-4); + display: flex; + align-items: center; + gap: 14px; + background: rgba(20, 26, 36, 0.78); + backdrop-filter: blur(12px); + -webkit-backdrop-filter: blur(12px); + border-bottom: 1px solid var(--border-subtle); +} +header h1 { + font-size: 16px; + font-weight: 700; + letter-spacing: -.02em; + margin: 0; + color: var(--text-primary); +} +.proj-switcher { + position: relative; +} +.ps-current { + display: flex; + align-items: center; + gap: 8px; + background: transparent; + border: 1px solid var(--border-strong); + border-radius: var(--r-md); + padding: 7px 12px; + cursor: pointer; + font-size: 13px; + font-weight: 500; + color: var(--text-primary); + transition: all var(--dur) var(--ease); +} +.ps-current:hover { + border-color: var(--accent); +} +.ps-current .ps-label { + font-family: var(--font-mono); + font-size: 10px; + font-weight: 500; + letter-spacing: .12em; + text-transform: uppercase; + color: var(--text-muted); +} +.ps-current .ps-name { + max-width: 160px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} +.ps-current .ps-caret { + font-size: 10px; + color: var(--text-muted); +} .ps-menu { - position: absolute; bottom: calc(100% + 6px); top: auto; left: 0; min-width: 240px; - background: var(--bg-surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); - box-shadow: 0 8px 32px rgba(0,0,0,.4); padding: 6px; z-index: 20; + position: absolute; + bottom: calc(100% + 6px); + top: auto; + left: 0; + min-width: 240px; + background: var(--bg-surface); + border: 1px solid var(--border-strong); + border-radius: var(--r-md); + box-shadow: 0 8px 32px rgba(0, 0, 0, .4); + padding: 6px; + z-index: 20; display: none; } -.ps-menu.open { display: block; animation: zoomIn .2s var(--ease); } +.ps-menu.open { + display: block; + animation: zoomIn .2s var(--ease); +} .ps-item { - padding: 8px 12px; border-radius: var(--r-sm); cursor: pointer; font-size: 13px; color: var(--text-secondary); - display: flex; align-items: center; gap: 8px; transition: background .15s var(--ease); -} -.ps-item:hover { background: var(--bg-elevated); color: var(--text-primary); } -.ps-item.active { background: var(--bg-elevated); color: var(--accent); font-weight: 700; } -.ps-item .ps-check { margin-left: auto; color: var(--accent); font-weight: 900; opacity: 0; } -.ps-item.active .ps-check { opacity: 1; } -.ps-sep { height: 1px; background: var(--border-subtle); margin: 4px 6px; } -.ps-manage { color: var(--accent); font-weight: 600; } + padding: 8px 12px; + border-radius: var(--r-sm); + cursor: pointer; + font-size: 13px; + color: var(--text-secondary); + display: flex; + align-items: center; + gap: 8px; + transition: background .15s var(--ease); +} +.ps-item:hover { + background: var(--bg-elevated); + color: var(--text-primary); +} +.ps-item.active { + background: var(--bg-elevated); + color: var(--accent); + font-weight: 700; +} +.ps-item .ps-check { + margin-left: auto; + color: var(--accent); + font-weight: 900; + opacity: 0; +} +.ps-item.active .ps-check { + opacity: 1; +} +.ps-sep { + height: 1px; + background: var(--border-subtle); + margin: 4px 6px; +} +.ps-manage { + color: var(--accent); + font-weight: 600; +} #sid-badge { margin-left: auto; - background: var(--bg-elevated); color: var(--text-primary); + background: var(--bg-elevated); + color: var(--text-primary); border: 1px solid var(--border-subtle); - border-radius: 999px; padding: 4px 14px; font-size: 12px; font-weight: 500; - max-width: 32%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; + border-radius: 999px; + padding: 4px 14px; + font-size: 12px; + font-weight: 500; + max-width: 32%; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; font-family: var(--font-mono); } - -/* === RAG 控制条 (spec §2.2) === */ #rag-bar { - display: flex; align-items: center; gap: 8px; - background: transparent; border: 1px solid var(--border-subtle); - border-radius: 999px; padding: 3px 10px; - font-size: 12px; color: var(--text-secondary); + display: flex; + align-items: center; + gap: 8px; + background: transparent; + border: 1px solid var(--border-subtle); + border-radius: 999px; + padding: 3px 10px; + font-size: 12px; + color: var(--text-secondary); font-family: var(--font-mono); } #rag-bar label.rag-switch { - display: inline-flex; align-items: center; gap: 6px; - cursor: pointer; user-select: none; + 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(--accent); + width: 14px; + height: 14px; + accent-color: var(--accent); margin: 0; } -#rag-bar input[type=checkbox]:disabled + span { color: var(--text-muted); cursor: not-allowed; } -#rag-bar .rag-stats { color: var(--text-muted); } -#rag-bar .rag-stats.ready { color: var(--accent); font-weight: 600; } -#rag-bar .rag-stats.zero { color: var(--text-muted); } +#rag-bar input[type=checkbox]:disabled + span { + color: var(--text-muted); + cursor: not-allowed; +} +#rag-bar .rag-stats { + color: var(--text-muted); +} +#rag-bar .rag-stats.ready { + color: var(--accent); + font-weight: 600; +} +#rag-bar .rag-stats.zero { + color: var(--text-muted); +} #rag-bar button { - background: var(--accent); color: var(--bg-base); border: none; - border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 700; - cursor: pointer; transition: all var(--dur) var(--ease); + background: var(--accent); + color: var(--bg-base); + border: none; + border-radius: 999px; + padding: 4px 12px; + font-size: 12px; + font-weight: 700; + cursor: pointer; + transition: all var(--dur) var(--ease); +} +#rag-bar button:disabled { + background: var(--bg-elevated); + color: var(--text-muted); + cursor: not-allowed; +} +#rag-bar button:hover:not(:disabled) { + box-shadow: 0 0 16px var(--accent-soft); +} +#chat { + flex: 1; + overflow-y: auto; + padding: var(--sp-6) var(--sp-4); + max-width: none; + width: 100%; + margin: 0; +} +.msg { + display: flex; + margin: var(--sp-3) 0; + padding-right: var(--composer-gutter); + animation: zoomIn .25s var(--ease); + position: relative; } -#rag-bar button:disabled { background: var(--bg-elevated); color: var(--text-muted); cursor: not-allowed; } -#rag-bar button:hover:not(:disabled) { box-shadow: 0 0 16px var(--accent-soft); } - -/* === 聊天区 (spec §2.3) === */ -#chat { flex: 1; overflow-y: auto; padding: var(--sp-6) var(--sp-4); max-width: none; width: 100%; margin: 0; } -.msg { display: flex; margin: var(--sp-3) 0; padding-right: var(--composer-gutter); animation: zoomIn .25s var(--ease); position: relative; } .msg .bubble { - max-width: 100%; padding: 11px 16px; border-radius: var(--r-lg); - white-space: pre-wrap; line-height: 1.65; font-size: 14px; letter-spacing: .01em; + max-width: 100%; + padding: 11px 16px; + border-radius: var(--r-lg); + white-space: pre-wrap; + line-height: 1.65; + font-size: 14px; + letter-spacing: .01em; +} +.msg.user { + justify-content: flex-end; } -.msg.user { justify-content: flex-end; } .msg.user .bubble { background: var(--bg-surface); color: var(--text-primary); border-bottom-right-radius: 6px; border-left: 2px solid var(--accent); - padding-left: 18px; /* 抵消左边框占用的空间,避免文字偏移 */ + padding-left: 18px; +} +.msg.assistant { + align-items: flex-start; } -.msg.assistant { align-items: flex-start; } .msg.assistant .bubble { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-bottom-left-radius: 6px; color: var(--text-primary); } - .msg.progress .bubble { - background: var(--bg-input); border: 1px dashed var(--accent-soft); - font-size: 13px; color: var(--text-secondary); + background: var(--bg-input); + border: 1px dashed var(--accent-soft); + font-size: 13px; + color: var(--text-secondary); font-family: var(--font-mono); } .msg.error .bubble { - background: rgba(248, 113, 113, 0.12); border: 1px solid var(--danger); color: var(--danger); + background: rgba(248, 113, 113, 0.12); + border: 1px solid var(--danger); + color: var(--danger); +} +.progress-item { + display: block; +} +.progress-item.ok::before { + content: "\2714 "; + color: var(--success); + font-weight: 700; +} +.progress-item.warn::before { + content: "\26a0 "; + color: var(--warning); + font-weight: 700; +} +.actions { + margin-top: 8px; } -.progress-item { display: block; } -.progress-item.ok::before { content: "✔ "; color: var(--success); font-weight: 700; } -.progress-item.warn::before { content: "⚠ "; color: var(--warning); font-weight: 700; } -.actions { margin-top: 8px; } .actions a { - display: inline-block; margin: 4px 6px 0 0; background: var(--accent); color: var(--bg-base); - padding: 6px 14px; border-radius: 999px; text-decoration: none; font-size: 13px; font-weight: 700; + display: inline-block; + margin: 4px 6px 0 0; + background: var(--accent); + color: var(--bg-base); + padding: 6px 14px; + border-radius: 999px; + text-decoration: none; + font-size: 13px; + font-weight: 700; transition: all var(--dur) var(--ease); } -.actions a:hover { box-shadow: 0 0 16px var(--accent-soft); transform: translateY(-1px); } -.typing { color: var(--text-muted); font-size: 13px; animation: auraPulse 1.4s ease-in-out infinite; font-family: var(--font-mono); } - -/* === 上传条 (spec §2.4) === */ -#upload-bar { background: var(--bg-surface); border-top: 1px solid var(--border-subtle); padding: var(--sp-3) var(--sp-6); font-size: 13px; } -#upload-bar-inner { max-width: 880px; margin: 0 auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } +.actions a:hover { + box-shadow: 0 0 16px var(--accent-soft); + transform: translateY(-1px); +} +.typing { + color: var(--text-muted); + font-size: 13px; + animation: auraPulse 1.4s ease-in-out infinite; + font-family: var(--font-mono); +} +#upload-bar { + background: var(--bg-surface); + border-top: 1px solid var(--border-subtle); + padding: var(--sp-3) var(--sp-6); + 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(--border-strong); border-radius: var(--r-md); - background: var(--bg-input); color: var(--text-primary); cursor: pointer; outline: none; + font-size: 13px; + padding: 8px 12px; + border: 1px solid var(--border-strong); + border-radius: var(--r-md); + background: var(--bg-input); + color: var(--text-primary); + cursor: pointer; + outline: none; transition: all var(--dur) var(--ease); font-family: var(--font-ui); } -#upload-bar select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); } +#upload-bar select:focus { + border-color: var(--accent); + box-shadow: 0 0 0 2px var(--accent-soft); +} .file-pick { - display: inline-block; padding: 8px 14px; border: 1px solid var(--border-strong); border-radius: var(--r-md); - background: var(--bg-input); color: var(--text-secondary); font-size: 13px; font-weight: 500; - cursor: pointer; transition: all var(--dur) var(--ease); + display: inline-block; + padding: 8px 14px; + border: 1px solid var(--border-strong); + border-radius: var(--r-md); + background: var(--bg-input); + color: var(--text-secondary); + font-size: 13px; + font-weight: 500; + cursor: pointer; + transition: all var(--dur) var(--ease); +} +.file-pick:hover { + border-color: var(--accent); + color: var(--accent); } -.file-pick:hover { border-color: var(--accent); color: var(--accent); } #upload-btn { - background: transparent; border: 1px solid var(--border-strong); color: var(--text-primary); - border-radius: var(--r-md); padding: 8px 16px; cursor: pointer; font-size: 13px; font-weight: 600; + background: transparent; + border: 1px solid var(--border-strong); + color: var(--text-primary); + border-radius: var(--r-md); + padding: 8px 16px; + cursor: pointer; + font-size: 13px; + font-weight: 600; transition: all var(--dur) var(--ease); } -#upload-btn:hover { background: var(--accent); border-color: var(--accent); color: var(--bg-base); } -#upload-status { color: var(--text-muted); font-size: 12px; font-family: var(--font-mono); } +#upload-btn:hover { + background: var(--accent); + border-color: var(--accent); + color: var(--bg-base); +} +#upload-status { + color: var(--text-muted); + font-size: 12px; + font-family: var(--font-mono); +} #proj-hint { - color: var(--warning); font-size: 12px; background: rgba(251,191,36,.1); border: 1px solid var(--warning); - border-left-width: 4px; border-radius: var(--r-sm); padding: 4px 10px; + color: var(--warning); + font-size: 12px; + background: rgba(251, 191, 36, .1); + border: 1px solid var(--warning); + border-left-width: 4px; + border-radius: var(--r-sm); + 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 { + border-top: none; + background: transparent; + padding: var(--sp-3) var(--sp-4) var(--sp-4); +} +#composer-inner { + max-width: none; + margin: 0; + display: flex; + gap: var(--composer-gap); + align-items: flex-end; } -label.vh { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; } - -/* === 输入区 (spec §2.5) === */ -#composer { border-top: none; background: transparent; padding: var(--sp-3) var(--sp-4) var(--sp-4); } -#composer-inner { max-width: none; margin: 0; display: flex; gap: var(--composer-gap); align-items: flex-end; } #input { - flex: 1; border: 1px solid var(--border-strong); border-radius: var(--r-md); - padding: 11px 14px; font-size: 14px; outline: none; background: var(--bg-input); - transition: all var(--dur) var(--ease); color: var(--text-primary); + flex: 1; + border: 1px solid var(--border-strong); + border-radius: var(--r-md); + padding: 11px 14px; + font-size: 14px; + outline: none; + background: var(--bg-input); + transition: all var(--dur) var(--ease); + color: var(--text-primary); font-family: var(--font-ui); - resize: none; min-height: 42px; max-height: 160px; line-height: 1.5; overflow-y: auto; + resize: none; + min-height: 42px; + max-height: 160px; + line-height: 1.5; + overflow-y: auto; +} +#input:focus { + border-color: var(--accent); + background: var(--bg-elevated); + box-shadow: 0 0 0 2px var(--accent-soft); +} +#input::placeholder { + color: var(--text-muted); } -#input:focus { border-color: var(--accent); background: var(--bg-elevated); box-shadow: 0 0 0 2px var(--accent-soft); } -#input::placeholder { color: var(--text-muted); } #send { - background: var(--accent); color: var(--bg-base); border: none; border-radius: 50%; - width: var(--send-size); height: var(--send-size); padding: 0; cursor: pointer; flex-shrink: 0; - display: flex; align-items: center; justify-content: center; + background: var(--accent); + color: var(--bg-base); + border: none; + border-radius: 50%; + width: var(--send-size); + height: var(--send-size); + padding: 0; + cursor: pointer; + flex-shrink: 0; + display: flex; + align-items: center; + justify-content: center; transition: all var(--dur) var(--ease); } -#send svg { display: block; } -#send:hover:not(:disabled) { box-shadow: 0 0 24px var(--accent-soft); transform: translateY(-1px); } -#send:active:not(:disabled) { transform: translateY(0); } -#send:disabled { opacity: .3; cursor: not-allowed; } - -/* === 项目抽屉 (spec §2.6) === */ +#send svg { + display: block; +} +#send:hover:not(:disabled) { + box-shadow: 0 0 24px var(--accent-soft); + transform: translateY(-1px); +} +#send:active:not(:disabled) { + transform: translateY(0); +} +#send:disabled { + opacity: .3; + cursor: not-allowed; +} #proj-drawer { - position: fixed; top: 0; right: 0; height: 100vh; width: var(--drawer-w); - background: var(--bg-surface); border-left: 1px solid var(--border-subtle); - box-shadow: -8px 0 32px rgba(0,0,0,.5); - transform: translateX(100%); transition: transform .3s var(--ease); - z-index: 100; display: flex; flex-direction: column; + position: fixed; + top: 0; + right: 0; + height: 100vh; + width: var(--drawer-w); + background: var(--bg-surface); + border-left: 1px solid var(--border-subtle); + box-shadow: -8px 0 32px rgba(0, 0, 0, .5); + transform: translateX(100%); + transition: transform .3s var(--ease); + z-index: 100; + display: flex; + flex-direction: column; +} +#proj-drawer.open { + transform: translateX(0); } -#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(--border-subtle); background: var(--bg-surface); + height: 56px; + padding: 0 20px; + display: flex; + align-items: center; + gap: 12px; + border-bottom: 1px solid var(--border-subtle); + background: var(--bg-surface); flex-shrink: 0; } -.drawer-head h2 { font-size: 15px; font-weight: 700; letter-spacing: -.01em; margin: 0; color: var(--text-primary); flex: 1; } +.drawer-head h2 { + font-size: 15px; + font-weight: 700; + letter-spacing: -.01em; + margin: 0; + color: var(--text-primary); + flex: 1; +} .drawer-close { - background: transparent; border: 1px solid var(--border-subtle); color: var(--text-secondary); - width: 32px; height: 32px; border-radius: 50%; cursor: pointer; - font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center; + background: transparent; + border: 1px solid var(--border-subtle); + color: var(--text-secondary); + width: 32px; + height: 32px; + border-radius: 50%; + cursor: pointer; + font-size: 18px; + line-height: 1; + display: flex; + align-items: center; + justify-content: center; transition: all var(--dur) var(--ease); } -.drawer-close:hover { background: var(--danger); border-color: var(--danger); color: var(--bg-base); } -.drawer-body { flex: 1; display: flex; min-height: 0; } -/* 抽屉蒙版 */ +.drawer-close:hover { + background: var(--danger); + border-color: var(--danger); + color: var(--bg-base); +} +.drawer-body { + flex: 1; + display: flex; + min-height: 0; +} .drawer-mask { - position: fixed; inset: 0; z-index: 99; background: var(--mask-bg); - opacity: 0; visibility: hidden; + position: fixed; + inset: 0; + z-index: 99; + background: var(--mask-bg); + opacity: 0; + visibility: hidden; transition: opacity .3s var(--ease), visibility .3s var(--ease); } -.drawer-mask.show { opacity: 1; visibility: visible; } -.drawer-form { flex: 1; overflow-y: auto; padding: var(--sp-4) var(--sp-5); display: flex; flex-direction: column; gap: 10px; } +.drawer-mask.show { + opacity: 1; + visibility: visible; +} +.drawer-form { + flex: 1; + overflow-y: auto; + padding: var(--sp-4) var(--sp-5); + display: flex; + flex-direction: column; + gap: 10px; +} .drawer-form label { font-family: var(--font-mono); - font-size: 11px; font-weight: 500; color: var(--text-muted); - text-transform: uppercase; letter-spacing: .1em; margin-bottom: 2px; display: block; + font-size: 11px; + font-weight: 500; + color: var(--text-muted); + text-transform: uppercase; + letter-spacing: .1em; + margin-bottom: 2px; + display: block; } .drawer-form input { - width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); - font-size: 13px; color: var(--text-primary); background: var(--bg-input); + width: 100%; + padding: 8px 11px; + border: 1px solid var(--border-strong); + border-radius: var(--r-sm); + font-size: 13px; + color: var(--text-primary); + background: var(--bg-input); transition: all var(--dur) var(--ease); font-family: var(--font-ui); } -.drawer-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); } -.drawer-form input:read-only { background: var(--bg-base); color: var(--text-muted); } -.drawer-form .field { display: flex; flex-direction: column; } -.drawer-form .drawer-hint { margin: 0 0 6px; } -.drawer-form details.advanced { border: 1px solid var(--border-subtle); border-radius: var(--r-sm); padding: 8px 12px; } -.drawer-form details.advanced > summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text-secondary); 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(--danger) !important; box-shadow: 0 0 0 2px rgba(248,113,113,.25) !important; } -.drawer-actions { display: flex; gap: 8px; margin-top: 8px; } -.drawer-actions button { flex: 1; padding: 10px; border: none; border-radius: var(--r-sm); cursor: pointer; font-size: 13px; font-weight: 600; transition: all var(--dur) var(--ease); } -.btn-save { background: var(--accent); color: var(--bg-base); } -.btn-save:hover { box-shadow: 0 0 16px var(--accent-soft); } -.btn-delete { background: transparent; color: var(--danger); border: 1px solid var(--danger) !important; } -.btn-delete:hover { background: var(--danger); color: var(--bg-base); } -.drawer-hint { font-size: 11px; color: var(--text-muted); line-height: 1.5; padding: 8px 0; } - -/* === 动效 + 响应式 === */ -@keyframes auraPulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } } -@keyframes zoomIn { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: scale(1); } } +.drawer-form input:focus { + outline: none; + border-color: var(--accent); + box-shadow: 0 0 0 2px var(--accent-soft); +} +.drawer-form input:read-only { + background: var(--bg-base); + color: var(--text-muted); +} +.drawer-form .field { + display: flex; + flex-direction: column; +} +.drawer-form .drawer-hint { + margin: 0 0 6px; +} +.drawer-form details.advanced { + border: 1px solid var(--border-subtle); + border-radius: var(--r-sm); + padding: 8px 12px; +} +.drawer-form details.advanced > summary { + cursor: pointer; + font-size: 12px; + font-weight: 600; + color: var(--text-secondary); + 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(--danger) !important; + box-shadow: 0 0 0 2px rgba(248, 113, 113, .25) !important; +} +.drawer-actions { + display: flex; + gap: 8px; + margin-top: 8px; +} +.drawer-actions button { + flex: 1; + padding: 10px; + border: none; + border-radius: var(--r-sm); + cursor: pointer; + font-size: 13px; + font-weight: 600; + transition: all var(--dur) var(--ease); +} +.btn-save { + background: var(--accent); + color: var(--bg-base); +} +.btn-save:hover { + box-shadow: 0 0 16px var(--accent-soft); +} +.btn-delete { + background: transparent; + color: var(--danger); + border: 1px solid var(--danger) !important; +} +.btn-delete:hover { + background: var(--danger); + color: var(--bg-base); +} +.drawer-hint { + font-size: 11px; + color: var(--text-muted); + line-height: 1.5; + padding: 8px 0; +} +@keyframes auraPulse { + 0%, 100% { + opacity: 1; + } + 50% { + opacity: .45; + } +} +@keyframes zoomIn { + from { + opacity: 0; + transform: scale(.98); + } + to { + opacity: 1; + transform: scale(1); + } +} @media (max-width: 860px) { - #sidebar { width: 220px; } - #sidebar.collapsed { width: 48px; } - #sid-badge { max-width: 24%; } - #proj-drawer { width: 100vw; } - .drawer-mask { display: none; } + #sidebar { + width: 220px; + } + #sidebar.collapsed { + width: 48px; + } + #sid-badge { + max-width: 24%; + } + #proj-drawer { + width: 100vw; + } + .drawer-mask { + display: none; + } +} +#session-title { + font-size: 15px; + font-weight: 700; + letter-spacing: -.02em; + color: var(--text-primary); + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + max-width: 100%; +} +#chat { + display: flex; + flex-direction: column; +} +.empty-state { + flex: 1 1 auto; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + text-align: center; + padding: 32px 16px; + gap: 10px; + min-height: 0; +} +.empty-state .es-logo { + width: 56px; + height: 56px; + border-radius: 16px; + display: flex; + align-items: center; + justify-content: center; + font-size: 26px; + font-weight: 900; + color: var(--bg-base); + background: var(--accent); + box-shadow: 0 0 32px var(--accent-soft); +} +.empty-state .es-title { + font-size: 24px; + font-weight: 700; + margin: 6px 0 0; + letter-spacing: -.02em; +} +.empty-state .es-sub { + font-size: 13px; + color: var(--text-secondary); + line-height: 1.7; + margin: 0; + max-width: 560px; +} +.empty-state .suggests { + display: grid; + grid-template-columns: repeat(2, minmax(180px, 1fr)); + gap: 10px; + margin-top: 16px; + width: 100%; + max-width: 620px; +} +.suggest-card { + text-align: left; + padding: 12px 16px; + border-radius: var(--r-md); + background: var(--bg-surface); + border: 1px solid var(--border-subtle); + color: var(--text-primary); + font-size: 13px; + font-family: var(--font-ui); + cursor: pointer; + transition: all var(--dur) var(--ease); +} +.suggest-card:hover { + border-color: var(--accent); + background: var(--bg-elevated); + transform: translateY(-1px); +} +.suggest-card::before { + content: "\2192 "; + color: var(--accent); + font-weight: 700; +} +#composer-toolbar { + max-width: none; + margin: 10px 0 0; + display: flex; + align-items: center; + gap: 8px; + flex-wrap: wrap; +} +.tb-btn { + display: inline-flex; + align-items: center; + gap: 6px; + padding: 7px 12px; + background: transparent; + border: 1px solid var(--border-strong); + border-radius: var(--r-md); + color: var(--text-secondary); + font-size: 13px; + font-weight: 500; + font-family: var(--font-ui); + cursor: pointer; + transition: all var(--dur) var(--ease); +} +.tb-btn:hover { + border-color: var(--accent); + color: var(--accent); +} +.tb-btn .tb-ic { + font-size: 14px; + line-height: 1; +} +.tb-btn .tb-caret { + font-size: 10px; + color: var(--text-muted); +} +.proj-switcher { + position: relative; +} +#upload-panel { + max-width: none; + margin: 10px 0 0; +} +.sess .kebab { + flex-shrink: 0; + opacity: 0; + transition: opacity .15s ease; + background: transparent; + border: none; + color: var(--text-muted); + cursor: pointer; + width: 24px; + height: 24px; + border-radius: 6px; + font-size: 15px; + line-height: 1; + display: flex; + align-items: center; + justify-content: center; +} +.sess:hover .kebab { + opacity: .7; +} +.sess .kebab:hover { + opacity: 1 !important; + background: var(--bg-base); + color: var(--accent); +} +.rename-input { + flex: 1; + min-width: 0; + background: var(--bg-input); + border: 1px solid var(--accent); + border-radius: var(--r-sm); + color: var(--text-primary); + font-size: 13px; + padding: 3px 6px; + font-family: var(--font-ui); + outline: none; +} +.sess-menu { + position: fixed; + z-index: 120; + background: var(--bg-surface); + border: 1px solid var(--border-strong); + border-radius: var(--r-md); + box-shadow: 0 8px 32px rgba(0, 0, 0, .5); + padding: 4px; + min-width: 140px; +} +.sess-menu .sm-item { + display: flex; + align-items: center; + gap: 8px; + width: 100%; + padding: 8px 12px; + background: transparent; + border: none; + border-radius: var(--r-sm); + color: var(--text-secondary); + font-size: 13px; + font-family: var(--font-ui); + cursor: pointer; + text-align: left; +} +.sess-menu .sm-item:hover { + background: var(--bg-elevated); + color: var(--accent); +} +.sess-menu .sm-ic { + color: var(--accent); +} +@media (max-width: 640px) { + .empty-state .suggests { + grid-template-columns: 1fr; + } } - -/* === 顶栏会话名 === */ -#session-title { font-size: 15px; font-weight: 700; letter-spacing: -.02em; color: var(--text-primary); - white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; } - -/* === 聊天区改为纵向 flex(空态垂直居中) === */ -#chat { display: flex; flex-direction: column; } - -/* === 空态(豆包式) === */ -.empty-state { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; - justify-content: center; text-align: center; padding: 32px 16px; gap: 10px; min-height: 0; } -.empty-state .es-logo { width: 56px; height: 56px; border-radius: 16px; display: flex; align-items: center; - justify-content: center; font-size: 26px; font-weight: 900; color: var(--bg-base); - background: var(--accent); box-shadow: 0 0 32px var(--accent-soft); } -.empty-state .es-title { font-size: 24px; font-weight: 700; margin: 6px 0 0; letter-spacing: -.02em; } -.empty-state .es-sub { font-size: 13px; color: var(--text-secondary); line-height: 1.7; margin: 0; max-width: 560px; } -.empty-state .suggests { display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)); gap: 10px; - margin-top: 16px; width: 100%; max-width: 620px; } -.suggest-card { text-align: left; padding: 12px 16px; border-radius: var(--r-md); - background: var(--bg-surface); border: 1px solid var(--border-subtle); color: var(--text-primary); - font-size: 13px; font-family: var(--font-ui); cursor: pointer; transition: all var(--dur) var(--ease); } -.suggest-card:hover { border-color: var(--accent); background: var(--bg-elevated); transform: translateY(-1px); } -.suggest-card::before { content: "\2192 "; color: var(--accent); font-weight: 700; } - -/* === 底部工具栏 === */ -#composer-toolbar { max-width: none; margin: 10px 0 0; display: flex; align-items: center; - gap: 8px; flex-wrap: wrap; } -.tb-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; - background: transparent; border: 1px solid var(--border-strong); border-radius: var(--r-md); - color: var(--text-secondary); font-size: 13px; font-weight: 500; font-family: var(--font-ui); - cursor: pointer; transition: all var(--dur) var(--ease); } -.tb-btn:hover { border-color: var(--accent); color: var(--accent); } -.tb-btn .tb-ic { font-size: 14px; line-height: 1; } -.tb-btn .tb-caret { font-size: 10px; color: var(--text-muted); } -.proj-switcher { position: relative; } -#upload-panel { max-width: none; margin: 10px 0 0; } - -/* === 会话项「⋯」与重命名菜单 === */ -.sess .kebab { flex-shrink: 0; opacity: 0; transition: opacity .15s ease; background: transparent; - border: none; color: var(--text-muted); cursor: pointer; width: 24px; height: 24px; border-radius: 6px; - font-size: 15px; line-height: 1; display: flex; align-items: center; justify-content: center; } -.sess:hover .kebab { opacity: .7; } -.sess .kebab:hover { opacity: 1 !important; background: var(--bg-base); color: var(--accent); } -.rename-input { flex: 1; min-width: 0; background: var(--bg-input); border: 1px solid var(--accent); - border-radius: var(--r-sm); color: var(--text-primary); font-size: 13px; padding: 3px 6px; - font-family: var(--font-ui); outline: none; } -.sess-menu { position: fixed; z-index: 120; background: var(--bg-surface); border: 1px solid var(--border-strong); - border-radius: var(--r-md); box-shadow: 0 8px 32px rgba(0,0,0,.5); padding: 4px; min-width: 140px; } -.sess-menu .sm-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; - background: transparent; border: none; border-radius: var(--r-sm); color: var(--text-secondary); - font-size: 13px; font-family: var(--font-ui); cursor: pointer; text-align: left; } -.sess-menu .sm-item:hover { background: var(--bg-elevated); color: var(--accent); } -.sess-menu .sm-ic { color: var(--accent); } -@media (max-width: 640px) { .empty-state .suggests { grid-template-columns: 1fr; } }