🤖 Open-source, local-first alternative to Grok Bot, OpenAI dots and Claude Duet. Your own AI bots on any model: GPT, Claude, Gemini, Grok, DeepSeek, Kimi, GLM and 70+ more through one Modelflare key. Reach them in the app, WeChat or Feishu; they remember you, work in the background, run commands and use your computer. Pay per use.
Python ai-agentai-assistantchatbotclaudecomputer-usedeepseekdesktop-appdshelectronfeishugeminigptgrokllmlocal-firstmodelflaremulti-modelopenai-compatiblepersonal-ai-agentwechat
feat: 发布 0.1.21,重做渠道连接,界面改用中性色,官网合作伙伴页改版
dyk98dcd47b4a6942
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 7bbf2a1..4bc4040 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -4,6 +4,22 @@这里只写用户能感受到的变化。更早的版本见 [GitHub 发布页](https://github.com/modelflare-ai/AnyModelBot/releases)。+## 0.1.21 - 2026-11-03++### 新增++- **连接聊天渠道更简单:** 设置里的连接重新做了。每个 App 都写明怎么连,按步骤扫码或填 Token 就行;还要等第一条消息完成绑定时,也会直接提示。同一个 App 可以再加账号。++### 改进与修复++- **删除机器人时说清楚影响:** 确认框会写明它负责的聊天渠道之后由哪个机器人回复;如果是最后一个机器人,也会提醒这些消息不会有回复。+- **移除发现页的 Bot:** 在同一个确认框里勾选是否保留数据。+- **界面更干净:** 窗口底色去掉了光晕,操作统一用中性色,字号不再用半像素,Windows 上文字更清楚。+- **余额提示:** 余额不多时,侧栏只提示一句,具体金额点头像查看。+- **毛玻璃跟随系统:** 不再有单独的设置项,跟随系统的“降低透明度”。+- 新建机器人时,侧栏实时显示头像和名字,建好后不会闪到别的机器人。+- 下拉菜单会跟着页面滚动,发现页的排版也做了调整。+## 0.1.20 - 2026-11-03### 新增diff --git a/CHANGELOG_en.md b/CHANGELOG_en.mdindex f6ec053..8f38298 100644--- a/CHANGELOG_en.md+++ b/CHANGELOG_en.md@@ -4,6 +4,22 @@This covers changes you'll notice in the app. For older versions, see the [GitHub releases](https://github.com/modelflare-ai/AnyModelBot/releases).+## 0.1.21 - 2026-11-03++### New++- **Easier channel setup:** Connections in Settings have been rebuilt. Each app shows how to connect, so you just follow the steps to scan a code or enter a token. If it's still waiting for a first message to finish linking, it tells you. You can also add more accounts for the same app.++### Improvements and fixes++- **Clearer bot deletion:** The confirmation now says which bot will answer that bot's chat channels afterward. If it's your last bot, it warns you that those messages won't get a reply.+- **Removing Discover bots:** A checkbox in the same confirmation lets you keep the bot's data.+- **Cleaner look:** The window background no longer has a glow, actions use neutral colors, and font sizes no longer use half pixels, so text is sharper on Windows.+- **Balance alert:** When your balance runs low, the sidebar just says so. Select your avatar to see the amount.+- **Frosted glass follows your system:** The setting is gone, and the app now follows your system's reduce transparency setting.+- While you create a bot, the sidebar shows its avatar and name as you type, and it no longer flashes to another bot when it's done.+- Dropdown menus now follow the page as it scrolls, and the Discover layout has been refined.+## 0.1.20 - 2026-11-03### Newdiff --git a/CHANGELOG_ja.md b/CHANGELOG_ja.mdindex 5941fcc..354eef6 100644--- a/CHANGELOG_ja.md+++ b/CHANGELOG_ja.md@@ -4,6 +4,22 @@アプリを使っていて気付く変更をまとめています。以前のバージョンは [GitHub Releases](https://github.com/modelflare-ai/AnyModelBot/releases) をご覧ください。+## 0.1.21 - 2026-11-03++### 新機能++- **チャネルの接続がより簡単に:** 設定の接続画面を作り直しました。アプリごとに接続方法を表示するので、手順に沿ってコードをスキャンするかトークンを入力するだけです。最初のメッセージを待って紐付けを完了する場合も、その旨を表示します。同じアプリにアカウントを追加することもできます。++### 改善と修正++- **Bot を削除するときの影響を明示:** 確認画面に、その Bot が担当していたチャネルに今後どの Bot が返信するかを表示します。最後の Bot の場合は、それらのメッセージに返信がなくなることも知らせます。+- **「見つける」の Bot の削除:** 同じ確認画面のチェックボックスでデータを残すか選べます。+- **すっきりした画面:** ウィンドウ背景の光彩をなくし、操作はニュートラルな色に統一しました。文字サイズに 0.5 ピクセル単位を使わなくなり、Windows で文字がより鮮明になります。+- **残高の通知:** 残高が少なくなると、サイドバーにはその旨だけを表示します。金額はアバターを選ぶと確認できます。+- **すりガラス効果はシステムに連動:** 個別の設定をなくし、システムの「透明度を下げる」設定に従います。+- Bot の作成中は、サイドバーにアバターと名前をリアルタイムで表示し、作成後に別の Bot の画面が一瞬表示されることもなくなりました。+- ドロップダウンメニューがページのスクロールに追従するようになり、「見つける」のレイアウトも調整しました。+## 0.1.20 - 2026-11-03### 新機能diff --git a/CHANGELOG_ko.md b/CHANGELOG_ko.mdindex 6660a51..d471996 100644--- a/CHANGELOG_ko.md+++ b/CHANGELOG_ko.md@@ -4,6 +4,22 @@앱을 사용하면서 확인할 수 있는 변경 사항입니다. 이전 버전은 [GitHub 릴리스](https://github.com/modelflare-ai/AnyModelBot/releases)를 확인하세요.+## 0.1.21 - 2026-11-03++### 새로운 기능++- **더 쉬워진 채널 연결:** 설정의 연결 화면을 새로 만들었습니다. 앱마다 연결 방법을 보여 주므로 안내에 따라 코드를 스캔하거나 토큰을 입력하면 됩니다. 첫 메시지를 기다려 연결을 마쳐야 할 때도 바로 알려 줍니다. 같은 앱에 계정을 더 추가할 수도 있습니다.++### 개선 및 수정++- **봇을 삭제할 때 영향을 명확히 안내:** 확인 창에 그 봇이 맡던 채널에 앞으로 어떤 봇이 답할지 표시합니다. 마지막 봇이면 해당 메시지에 답이 오지 않는다고 알려 줍니다.+- **둘러보기 봇 제거:** 같은 확인 창의 체크박스로 데이터를 남길지 고를 수 있습니다.+- **더 깔끔한 화면:** 창 배경의 빛 번짐을 없애고 동작은 중립색으로 통일했습니다. 글자 크기에 0.5픽셀 단위를 쓰지 않아 Windows에서 글자가 더 선명합니다.+- **잔액 알림:** 잔액이 적어지면 사이드바에는 그 사실만 표시합니다. 금액은 아바타를 선택하면 볼 수 있습니다.+- **반투명 효과는 시스템 설정을 따름:** 별도 설정을 없애고 시스템의 투명도 줄이기 설정을 따릅니다.+- 봇을 만드는 동안 사이드바에 아바타와 이름을 바로 보여 주며, 만든 뒤 다른 봇 화면이 잠깐 나타나지 않습니다.+- 드롭다운 메뉴가 페이지 스크롤을 따라가고, 둘러보기 화면의 배치도 다듬었습니다.+## 0.1.20 - 2026-11-03### 새로운 기능diff --git a/CHANGELOG_ru.md b/CHANGELOG_ru.mdindex 7f394e5..5e72225 100644--- a/CHANGELOG_ru.md+++ b/CHANGELOG_ru.md@@ -4,6 +4,22 @@Здесь описаны заметные пользователю изменения приложения. Предыдущие версии — на странице [выпусков GitHub](https://github.com/modelflare-ai/AnyModelBot/releases).+## 0.1.21 - 2026-11-03++### Новое++- **Каналы подключать проще:** экран подключений в настройках сделан заново. Для каждого приложения показано, как его подключить: следуйте шагам, чтобы отсканировать код или ввести токен. Если для завершения привязки нужно дождаться первого сообщения, приложение об этом скажет. Для одного приложения можно добавить несколько аккаунтов.++### Улучшения и исправления++- **Понятное удаление ботов:** в подтверждении указано, какой бот будет отвечать в каналах удаляемого бота. Если это последний бот, приложение предупредит, что на эти сообщения ответа не будет.+- **Удаление ботов из «Обзора»:** флажок в том же подтверждении позволяет сохранить данные бота.+- **Более чистый вид:** фон окна больше не светится, действия оформлены в нейтральных цветах, а размеры шрифта больше не дробные, поэтому текст в Windows выглядит чётче.+- **Уведомление о балансе:** когда баланс заканчивается, на боковой панели появляется только короткое предупреждение. Сумму можно посмотреть, нажав на аватар.+- **Матовое стекло следует за системой:** отдельной настройки больше нет, приложение учитывает системный параметр снижения прозрачности.+- При создании бота его аватар и имя сразу видны на боковой панели, а после создания не мелькает другой бот.+- Выпадающие меню теперь следуют за прокруткой страницы, а раздел «Обзор» получил более аккуратную вёрстку.+## 0.1.20 - 2026-11-03### Новоеdiff --git a/docs/development.md b/docs/development.mdindex 7dad277..e17ae06 100644--- a/docs/development.md+++ b/docs/development.md@@ -212,7 +212,7 @@ docker exec amb cat /data/ui-token # 打开 http://<主机>:3600/?token=<令## 飞书应用配置-最省事的办法:设置 › 连接 → 飞书 →「添加账号」,用飞书扫码,自动创建机器人应用,然后在飞书里给它发条消息。+最省事的办法:设置 › 连接 → 飞书 →「连接」,用飞书扫码,自动创建机器人应用,然后在飞书里给它发条消息。想用已有的企业自建应用,点「用已有应用」,按下面的步骤配置:@@ -222,7 +222,7 @@ docker exec amb cat /data/ui-token # 打开 http://<主机>:3600/?token=<令- `im:message:send_as_bot`(以应用身份发消息)- `cardkit:card:write`(创建与更新卡片,用于流式回复)- `im:message.history:readonly`(读取会话历史消息:飞书长连接不补推离线时发来的消息,程序启动、断线重连时从历史里补上 7 天内有过来往的单聊里、24 小时内的消息,每个会话最多 20 条;没开也能用,只是补不上,会提示一次)-3. 先在本程序 设置 › 连接 → 飞书 →「添加账号」→「用已有应用」里填入 App ID / App Secret 并保存(长连接需要程序在线才能保存下一步)。+3. 先在本程序 设置 › 连接 → 飞书 →「连接」→「改用已有应用」里填入 App ID / App Secret 并保存(长连接需要程序在线才能保存下一步)。4. 事件与回调 → 订阅方式选「**使用长连接接收事件**」,添加事件 `im.message.receive_v1`。5. 发布版本并在可用范围内添加自己,然后用你自己的飞书私聊机器人发一句话:连上后第一个发消息的人就是飞书主人(见「谁能使用机器人」)。@@ -230,7 +230,7 @@ docker exec amb cat /data/ui-token # 打开 http://<主机>:3600/?token=<令## 微信(iLink)-- 设置 › 连接 → 微信 →「添加账号」→「扫码登录」,用微信扫描二维码并确认;或命令行 `npm run weixin:login`(终端显示二维码,同时保存 PNG 到数据目录)。+- 设置 › 连接 → 微信 →「连接」,用微信扫描二维码并确认;或命令行 `npm run weixin:login`(终端显示二维码,同时保存 PNG 到数据目录)。- 登录态、同步游标、context_token 保存在数据目录,重启后自动续用。- 平台限制:用户每发来一条消息后 24 小时内最多可回复 10 条;回复在生成结束后一次发出,超过 4000 字自动分段;生成期间显示“正在输入”。- 图片、文件、视频:用户发来(或引用)的会从微信 CDN 下载解密(单个最大 50 MB)。代理模式下存进机器人工作区的 `inbox/`,消息里写明路径,代理可以读取、处理或当生图的参考图;能看图的模型(Claude、GPT-5/6、Gemini、Grok 4、Kimi K3、Muse Spark 等)同时直接收到图片本身,其余模型只拿到路径。Linux 版代理暂不直接收图(sharp 在 Electron 下会崩溃),只给路径。机器人交付的文件(present)按图片或文件发回微信。diff --git a/docs/development_en.md b/docs/development_en.mdindex b908832..634ee19 100644--- a/docs/development_en.md+++ b/docs/development_en.md@@ -212,7 +212,7 @@ Each bot can turn computer use on or off, choose a backend and an approval mode## Feishu app setup-The easiest way: Settings › Connections → Feishu → Add account, scan with Feishu to create the bot app, then send it a message in Feishu.+The easiest way: Settings › Connections → Feishu → Connect, scan with Feishu to create the bot app, then send it a message in Feishu.To use a custom enterprise app you already have, choose "Use my own app" and set it up like this:@@ -222,7 +222,7 @@ To use a custom enterprise app you already have, choose "Use my own app" and set- `im:message:send_as_bot` (send messages as the app)- `cardkit:card:write` (create and update cards, used for streaming replies)- `im:message.history:readonly` (read chat history: the long connection doesn't re-push messages sent while the app was offline, so on start and after a reconnect the app catches up from history on chats active in the last 7 days, taking messages from the last 24 hours, at most 20 per chat. Without it everything else works, but nothing is caught up, and the app says so once)-3. First enter the App ID / App Secret in this app under Settings › Connections → Feishu → Add account → Use my own app, and save (the long connection must be online before the next step can be saved).+3. First enter the App ID / App Secret in this app under Settings › Connections → Feishu → Connect → Use my own app, and save (the long connection must be online before the next step can be saved).4. Events & callbacks → subscription mode: "**Receive events through persistent connection**", and add the event `im.message.receive_v1`.5. Publish a version, add yourself to the availability scope, then send the bot one line from your own Feishu: the first person to message it after it is connected becomes its Feishu owner (see "Who can use a bot").@@ -230,7 +230,7 @@ Note: only one-to-one (p2p) chats are handled for now; group messages are ignore## WeChat (iLink)-- Settings › Connections → WeChat → Add account → "Scan to log in", scan the QR code with WeChat and confirm; or run `npm run weixin:login` (the QR code is shown in the terminal and saved as a PNG in the data directory).+- Settings › Connections → WeChat → Connect, scan the QR code with WeChat and confirm; or run `npm run weixin:login` (the QR code is shown in the terminal and saved as a PNG in the data directory).- Sign-in state, sync cursor and context_token are kept in the data directory and resume after a restart.- Platform limits: after each user message, at most 10 replies can be sent within 24 hours; replies are sent in one go once generation finishes and are split above 4000 characters; "typing…" is shown while generating.- Images, files, videos: whatever the user sends (or quotes) is downloaded from the WeChat CDN and decrypted (up to 50 MB each). In agent mode it is saved in the bot workspace's `inbox/` and the message names the path, so the agent can read it, process it or use it as a reference image for generation. Vision-capable models (Claude, GPT-5/6, Gemini, Grok 4, Kimi K3, Muse Spark and others) also receive the image itself; other models only get the path. On Linux the agent does not receive images directly yet (sharp crashes under Electron) and only gets the path. Files the bot delivers (present) go back to WeChat as images or files.diff --git a/package-lock.json b/package-lock.jsonindex 5f41394..9515691 100644--- a/package-lock.json+++ b/package-lock.json@@ -1,12 +1,12 @@{"name": "anymodel-bot",- "version": "0.1.20",+ "version": "0.1.21","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "anymodel-bot",- "version": "0.1.20",+ "version": "0.1.21","license": "MIT","dependencies": {"@larksuiteoapi/node-sdk": "1.76.0",diff --git a/package.json b/package.jsonindex a9627c6..f2fdb5f 100644--- a/package.json+++ b/package.json@@ -1,7 +1,7 @@{"name": "anymodel-bot","productName": "anymodel bot",- "version": "0.1.20",+ "version": "0.1.21","private": true,"description": "anymodel bot:任意模型的个人 AI 助手(飞书 + 微信 iLink),内置 magpie 模型网关","license": "MIT",diff --git a/scripts/e2e-agent.mjs b/scripts/e2e-agent.mjsindex f63a234..9f60935 100644--- a/scripts/e2e-agent.mjs+++ b/scripts/e2e-agent.mjs@@ -22,7 +22,8 @@// reinstall (POST /amb/api/pwsh/install) must bring PowerShell 7 back (psver=7).// --tool: the mock model asks for one shell tool call before answering each message (exercises tool spawning).// --managed: use the bundled magpie gateway (as users do) with "Modelflare" pointed at the mock-// (AMB_MODELFLARE_BASE_URL) and connected through the API; otherwise the app calls the mock directly.+// (AMB_MODELFLARE_BASE_URL, AMB_MODELFLARE_ISSUER), signing in through the API the way the app does; the mock+// plays the browser's redirect back. Otherwise the app calls the mock directly.// --stream: send the message through the UI's SSE endpoint (/chat/stream) instead of /chat.// --reasoning: the mock streams reasoning_content deltas before the answer (like reasoning models).// --observe-ms N: keep the app running N ms after the reply (process monitor keeps logging), then@@ -103,10 +104,45 @@ function freePort() {});}+// ---------- mock Modelflare account (--managed): sign-in and the connected-app API, same shapes as test/helpers.ts ----------+const accountKeys = [];+let accountKeySeq = 0;+function serveAccount(req, res, body) {+ const u = new URL(req.url, "http://mock");+ const json = (o, status = 200) => {+ res.writeHead(status, { "content-type": "application/json" }).end(JSON.stringify(o));+ return true;+ };+ const keyOut = (k) => ({ ...k, key_tail: `sk-e2e-${k.id}`.slice(-4), status: "enabled", unlimited: k.limit_usd === null, remain_usd: k.limit_usd });+ if (u.pathname === "/.well-known/openid-configuration") {+ return json({ issuer: llmUrl, authorization_endpoint: `${llmUrl}/oauth/authorize`, token_endpoint: `${llmUrl}/oauth/token`, revocation_endpoint: `${llmUrl}/oauth/revoke` });+ }+ if (u.pathname === "/oauth/token" && req.method === "POST") {+ return json({ access_token: "at-e2e", refresh_token: "rt-e2e", token_type: "Bearer", expires_in: 3600, scope: "openid profile offline_access account api_keys" });+ }+ if (u.pathname === "/oauth/revoke") return json({});+ if (!u.pathname.startsWith("/api/connected-app/")) return false;+ const p = u.pathname.slice("/api/connected-app".length);+ if (p === "/account") return json({ success: true, data: { display_name: "E2E", username: "e2e", group: "default", balance_usd: 10, used_usd: 0, billed_to_enterprise: false, quota_per_unit: 500000 } });+ if (p === "/api-keys" && req.method === "POST") {+ const b = JSON.parse(body || "{}");+ const k = { id: ++accountKeySeq, name: b.name, limit_usd: b.limit_usd ?? null, used_usd: 0, created_at: Math.floor(Date.now() / 1000) };+ accountKeys.push(k);+ return json({ success: true, data: { ...keyOut(k), key: `sk-e2e-${k.id}` } });+ }+ if (p === "/api-keys" && req.method === "GET") return json({ success: true, data: accountKeys.map(keyOut) });+ if (p.startsWith("/api-keys/")) {+ const k = accountKeys.find((x) => x.id === Number(p.slice("/api-keys/".length)));+ return json(k ? { success: true, data: keyOut(k) } : { success: false, message: "not found" }, k ? 200 : 404);+ }+ return json({ success: true, data: [] });+}+// ---------- mock model ----------const llm = http.createServer(async (req, res) => {const chunks = [];for await (const c of req) chunks.push(c);+ if (managed && serveAccount(req, res, Buffer.concat(chunks).toString("utf8"))) return;let b = {};try {b = JSON.parse(Buffer.concat(chunks).toString("utf8") || "{}");@@ -165,7 +201,7 @@ const base = `http://127.0.0.1:${port}`;const env = {...process.env,AMB_DATA_DIR: dataDir,- ...(managed ? { AMB_MODELFLARE_BASE_URL: llmUrl + "/v1" } : { AMB_MAGPIE_BASE_URL: llmUrl + "/v1", AMB_MAGPIE_API_KEY: "mock-key", AMB_DEFAULT_MODEL: MODEL }),+ ...(managed ? { AMB_MODELFLARE_BASE_URL: llmUrl + "/v1", AMB_MODELFLARE_ISSUER: llmUrl } : { AMB_MAGPIE_BASE_URL: llmUrl + "/v1", AMB_MAGPIE_API_KEY: "mock-key", AMB_DEFAULT_MODEL: MODEL }),AMB_UI_PORT: String(port),AMB_UI_TOKEN: token,AMB_LOG_LEVEL: "debug",@@ -280,14 +316,27 @@ try {api("/amb/api/agent", {}, 5000).then((r) => jl("agent-status.jsonl", r.body), (e) => jl("agent-status.jsonl", { error: String(e?.message ?? e) }));}, 2000);- // 2b) managed: connect "Modelflare" (= the mock) through the API, like onboarding does+ // 2b) managed: sign in to "Modelflare" (= the mock) through the API, like onboarding doesif (managed) {for (let i = 0; i < 60 && summary.status?.gateway?.state !== "running"; i++) {await new Promise((r) => setTimeout(r, 500));summary.status = (await api("/amb/api/status")).body;}- const c = await api("/amb/api/modelflare", { method: "PUT", body: JSON.stringify({ apiKey: "mf-e2e-key-0123456789", line: "auto" }) }, 60_000);- summary.connect = { status: c.status, connected: c.body?.connected, error: c.body?.error, models: c.body?.models };+ const login = await api("/amb/api/account/login", { method: "POST", body: "{}" }, 60_000);+ if (!login.body?.loginUrl) throw new Error(`sign-in did not start: ${JSON.stringify(login)}`);+ // What the browser does once the user approves: come back to the app's local callback with the code and state+ const auth = new URL(login.body.loginUrl);+ const back = new URL(auth.searchParams.get("redirect_uri"));+ back.searchParams.set("code", "e2e-code");+ back.searchParams.set("state", auth.searchParams.get("state"));+ await fetch(back);+ let account = {};+ for (let i = 0; i < 120 && account.state !== "signed_in" && !account.error; i++) {+ await new Promise((r) => setTimeout(r, 500));+ account = (await api("/amb/api/account")).body ?? {};+ }+ const c = await api("/amb/api/modelflare", {}, 30_000);+ summary.connect = { status: c.status, state: account.state, connected: c.body?.connected, error: account.error || c.body?.error };say("modelflare connect:", JSON.stringify(summary.connect));summary.models = (await api("/amb/api/models", {}, 30_000)).body?.models;say("models:", JSON.stringify(summary.models));diff --git a/site/README.md b/site/README.mdindex 8a9ee80..5022fd5 100644--- a/site/README.md+++ b/site/README.md@@ -24,8 +24,8 @@ Astro 5 静态站,Preact 只用在价格表、计算器(含可搜索的模- **换脑**:每 7 秒一道斜波扫过,扫到的脸眨一下眼、睁开就换成另一个机器人的眼睛色;右上角同时换成下一个真实模型 ID(价格快照里每家厂商取一个)。讲的是"任意模型,还是这群机器人"(内容切换)。- **打瞌睡**:9 秒没人动,慢慢闭眼、目光耷拉;指针一动,从指针那里一圈圈醒过来(机器人的状态,同 `[data-doze]`)。睡着时不换脑。- 只在页脚进视口、标签页可见时跑;"减少动态效果"时画一张静止的字标;无 JS 时整块不显示。配色:深色是灰面罩 + 发光的眼睛;浅色是淡彩面罩 + 墨色眼睛——每张脸的面罩用它那个角色的辉光色调进底色、从字标顶到底由浅变深,一圈极细的边,整块像一片粉彩马赛克,"换脑"时整片换色调(不用整块墨色,也不出现白底上的荧光色)。字标盒子贴着字形(宽屏 7.4:1、手机 1.3:1),画布上下各出血 16px 给探头的脸,不额外留白。-- **附属页**:`/pricing`(价格卡、订阅制对照、价格表、计算器)、`/download`(页头一个按系统识别的主按钮,和平台卡一起落在背景同首页 Hero 的圆角大卡片里;Windows、macOS、Linux 三张卡;Docker、CLI 两张卡;校验)、`/security`、`/changelog`、`/privacy`、`/licenses`,以及 `/partners`(合作伙伴:首屏 + 佣金示意、怎么获得佣金、适合谁、为什么好推广、申请表。佣金比例、价格和结算规则不写,一对一谈)。-- **合作申请表**(`views/PartnersView.astro`,逻辑在 `lib/partner-form.ts`、`scripts/partner-form.ts`):构建时配了 `PARTNER_APPLY_URL` 就向它 POST JSON(`type`、`name`、`company`、`contact`、`audience`、`message`、`lang`、`source`,跨域要放行 `anymodel.bot`,返回 2xx 才算成功);没配时不假装提交成功,而是把填好的内容变成一封邮件,让申请人发到 `[email protected]`。地址加 `?apply=preview` 可以走一遍成功流程但不发送。+- **附属页**:`/pricing`(价格卡、订阅制对照、价格表、计算器)、`/download`(页头一个按系统识别的主按钮,和平台卡一起落在背景同首页 Hero 的圆角大卡片里;Windows、macOS、Linux 三张卡;Docker、CLI 两张卡;校验)、`/security`、`/changelog`、`/privacy`、`/licenses`,以及 `/partners`(合作伙伴:首屏 + 佣金示意、怎么获得佣金、适合谁、为什么好推广、申请入口。佣金比例、价格和结算规则不写,一对一谈)。+- **合作申请**(`views/PartnersView.astro`):官网不收表单。页面上的申请按钮都跳到 Modelflare 控制台的 AnyModelBot 合作页(`MF.partnerApply`,`/affiliate-program?tab=anymodelbot`,没登录时先去登录),因为专属优惠券和佣金都挂在 Modelflare 账号上。页面上也留了邮箱 `[email protected]`。- **导航**(`components/Nav.astro`):通栏,和正文同一个容器——logo、下载按钮分别对齐内容的左右边线,链接居中:机器人 · 功能 · 模型 · 数据(首页锚点)· 价格(独立页)· 文档。停在顶上时透明,滚动后铺半透明底色和一根底线。一套尺寸到底:所有控件(含下载按钮)都是 32 高的胶囊,文字 14、图标 16,控件之间 2px、工具组和下载之间 12px。- **顶部公告条**(`components/SiteBanner.astro`,内容在 `src/data/announcements.ts`):发版条(版本取自 `releases.json`,按访客系统直接下载对应安装包,发布后显示 30 天)+ 宣传 / 公告,多条时轮播、可翻页;支持时间窗、截止倒计时、按 id 记住关闭;浏览器语言和页面不一致时附带语言切换。地址加 `?banner=preview` 可预览全部条目。埋点 `banner_view` / `banner_click` / `banner_dismiss`。@@ -37,7 +37,7 @@ Astro 5 静态站,Preact 只用在价格表、计算器(含可搜索的模|---|---|---|| `tokens.css`、`base.css`、`components.css`、`eyes.css` | `layouts/Base.astro`(每页) | token、重置、按钮 / 卡片 / 表格 / 对话框 / 价格卡等共用组件、导航、附属页骨架、Eyes 标记 || `footer.css` | `components/Footer.astro`(每页) | 页脚与眼睛田 |-| `hero-scene.css` | `components/HeroSky.astro`(首页 Hero、下载页页头) | Hero 背景的取色、各层和动画:顶光、天空、光晕、地平线 |+| `hero-scene.css` | `components/HeroSky.astro`(首页 Hero、下载页和合作伙伴页的首屏) | Hero 背景的取色、各层和动画:顶光、天空、光晕、地平线;附属页首屏的外框 `.scene-top` || `models-key.css` | `components/ModelsHeadArt.astro`(首页第 4 节) | 章节头两侧的厂商图标砖、公式胶囊 || `home.css` | `views/Home.astro` | 首屏、第 2 节,以及小窗口标题栏、聊天、手机 mock、电脑操作示意和动画时间线状态(这些演示导览也在用) || `sections.css` | `views/Home.astro` | 第 3–8 节的版式与动效(两章故事、换脑舞台、价格面板、数据去向、切换台、问答、收尾) |@@ -139,7 +139,7 @@ Astro 5 静态站,Preact 只用在价格表、计算器(含可搜索的模- 沿边框巡游的扫光;- 漂浮的光斑、粒子;- 跟随指针的点阵、聚光灯。-- **唯一的例外**:Hero 顶部的天空(用户 2026-10-31 明确要求)——深色:一条静止的银河和一千多颗亮度悬殊的星(用户 2026-11-01 要求更像星空,生成规则见 `components/HeroSky.astro`),其中约七十颗星慢慢明暗闪烁(3–7 秒一周期、各自错开),两颗流星隔十几、二十秒才划过一次、每次不到一秒;浅色:三朵白云极慢地从左往右飘(横穿一次 3–5 分钟),约六成四角形细小闪光偶尔亮起、转一下再隐去;"减少动态效果"时全部静止。保持"极其简单",不要加量、不要扩展到别处。下载页页头用同一片天空和地平线,动画也一样(用户 2026-11-03 要求,`components/HeroSky.astro`、`styles/hero-scene.css`);其它页面不用。+- **唯一的例外**:Hero 顶部的天空(用户 2026-10-31 明确要求)——深色:一条静止的银河和一千多颗亮度悬殊的星(用户 2026-11-01 要求更像星空,生成规则见 `components/HeroSky.astro`),其中约七十颗星慢慢明暗闪烁(3–7 秒一周期、各自错开),两颗流星隔十几、二十秒才划过一次、每次不到一秒;浅色:三朵白云极慢地从左往右飘(横穿一次 3–5 分钟),约六成四角形细小闪光偶尔亮起、转一下再隐去;"减少动态效果"时全部静止。保持"极其简单",不要加量、不要扩展到别处。下载页和合作伙伴页的首屏用同一片天空和地平线,动画也一样(用户 2026-11-03 要求和首页统一,`components/HeroSky.astro`、`styles/hero-scene.css`);其它页面不用。- **第二个例外**:首页第 4 节章节头两侧的厂商图标砖(用户 2026-10-31 明确要求"logo 有微弱的浮动效果")——每块砖上下浮动 ±3px,周期 6–10 秒、起点各不相同;"减少动态效果"时静止。不要加大幅度,也不要套到别的图标上。- **第三个例外**:Hero 背景里的模型厂商标志(`components/HeroLogos.astro` + `styles/hero-logos.css`,用户 2026-10-31 明确要求"logo 做微弱浮动、尽量淡化")——标题两侧各五枚单色标志,最清楚的一枚是正文色的 12%(浅色 11%;压到 7% 时用户说看不到,更早的版本又嫌明显),远的更小更淡、略虚;各自轻轻漂(上下 8px、左右 3px、转 ±1.5°),5–8.5 秒一个来回、起点错开;只在文字两侧的空白里,不压标题、按钮和舞台;中等宽度只留外侧几枚,窄屏不放;"减少动态效果"时静止。不要加量、不要加颜色、不要扩展到 Hero 以外。- 说不出含义、只是"让画面动起来"的效果,一律不加。App 端同一条规矩,见 `ui/design/README.md` 的「动效」。@@ -224,7 +224,7 @@ docker compose -f deploy/compose.yml --env-file deploy/.env up -d --build| 值 | 来源 ||---|---|-| `SITE_DOMAIN`、`GITHUB_URL`、`SECURITY_EMAIL`、`PARTNER_APPLY_URL`(可选)、`ANALYTICS_SCRIPT_URL`、`ANALYTICS_SITE_ID`、`DOCKER_IMAGE` | `deploy/.env` |+| `SITE_DOMAIN`、`GITHUB_URL`、`SECURITY_EMAIL`、`ANALYTICS_SCRIPT_URL`、`ANALYTICS_SITE_ID`、`DOCKER_IMAGE` | `deploy/.env` || 版本、发布日期、各平台下载地址 / SHA-256 / 大小 | GitHub 最新 Release 自动生成(`scripts/releases-from-github.ts`;也可以手改 `src/data/releases.json`) |统计用自托管的 Umami(无 Cookie、`data-do-not-track`);开发模式不加载统计脚本。diff --git a/site/deploy/compose.yml b/site/deploy/compose.ymlindex 95c1efc..fb60de5 100644--- a/site/deploy/compose.yml+++ b/site/deploy/compose.yml@@ -12,7 +12,6 @@ services:SITE_DOMAIN: ${SITE_DOMAIN:-}GITHUB_URL: ${GITHUB_URL:-}SECURITY_EMAIL: ${SECURITY_EMAIL:-}- PARTNER_APPLY_URL: ${PARTNER_APPLY_URL:-}ANALYTICS_SCRIPT_URL: ${ANALYTICS_SCRIPT_URL:-}ANALYTICS_SITE_ID: ${ANALYTICS_SITE_ID:-}DOCKER_IMAGE: ${DOCKER_IMAGE:-}diff --git a/site/src/components/HeroSky.astro b/site/src/components/HeroSky.astroindex 8327309..0e159d4 100644--- a/site/src/components/HeroSky.astro+++ b/site/src/components/HeroSky.astro@@ -1,5 +1,5 @@----// Hero 的天空,首页 Hero 和下载页页头共用。样式和动画(星闪、云飘、流星)都在 styles/hero-scene.css;背景动画的例外只给这两处(README"动效的硬规矩")。+// Hero 的天空,首页 Hero、下载页和合作伙伴页的首屏共用。样式和动画(星闪、云飘、流星)都在 styles/hero-scene.css;背景动画的例外只给这三处(README"动效的硬规矩")。import "../styles/hero-scene.css";// 顶部天空:都在 1600 × 640 的画布上伪随机生成,每次构建都一样。两套,按主题只显示一套(hero-scene.css 的 .hero__sky):// 深色·星空(用户 2026-11-01 要求"更像星空")。夜空的观感靠的不是点多,而是这三点,改的时候别丢:diff --git a/site/src/data/changelog.en.md b/site/src/data/changelog.en.mdindex 6ef5b81..d37e4af 100644--- a/site/src/data/changelog.en.md+++ b/site/src/data/changelog.en.md@@ -4,6 +4,22 @@This covers changes you'll notice in the app. For older versions, see the [GitHub releases](https://github.com/modelflare-ai/AnyModelBot/releases).+## 0.1.21 - 2026-11-03++### New++- **Easier channel setup:** Connections in Settings have been rebuilt. Each app shows how to connect, so you just follow the steps to scan a code or enter a token. If it's still waiting for a first message to finish linking, it tells you. You can also add more accounts for the same app.++### Improvements and fixes++- **Clearer bot deletion:** The confirmation now says which bot will answer that bot's chat channels afterward. If it's your last bot, it warns you that those messages won't get a reply.+- **Removing Discover bots:** A checkbox in the same confirmation lets you keep the bot's data.+- **Cleaner look:** The window background no longer has a glow, actions use neutral colors, and font sizes no longer use half pixels, so text is sharper on Windows.+- **Balance alert:** When your balance runs low, the sidebar just says so. Select your avatar to see the amount.+- **Frosted glass follows your system:** The setting is gone, and the app now follows your system's reduce transparency setting.+- While you create a bot, the sidebar shows its avatar and name as you type, and it no longer flashes to another bot when it's done.+- Dropdown menus now follow the page as it scrolls, and the Discover layout has been refined.+## 0.1.20 - 2026-11-03### Newdiff --git a/site/src/data/changelog.ja.md b/site/src/data/changelog.ja.mdindex 5941fcc..354eef6 100644--- a/site/src/data/changelog.ja.md+++ b/site/src/data/changelog.ja.md@@ -4,6 +4,22 @@アプリを使っていて気付く変更をまとめています。以前のバージョンは [GitHub Releases](https://github.com/modelflare-ai/AnyModelBot/releases) をご覧ください。+## 0.1.21 - 2026-11-03++### 新機能++- **チャネルの接続がより簡単に:** 設定の接続画面を作り直しました。アプリごとに接続方法を表示するので、手順に沿ってコードをスキャンするかトークンを入力するだけです。最初のメッセージを待って紐付けを完了する場合も、その旨を表示します。同じアプリにアカウントを追加することもできます。++### 改善と修正++- **Bot を削除するときの影響を明示:** 確認画面に、その Bot が担当していたチャネルに今後どの Bot が返信するかを表示します。最後の Bot の場合は、それらのメッセージに返信がなくなることも知らせます。+- **「見つける」の Bot の削除:** 同じ確認画面のチェックボックスでデータを残すか選べます。+- **すっきりした画面:** ウィンドウ背景の光彩をなくし、操作はニュートラルな色に統一しました。文字サイズに 0.5 ピクセル単位を使わなくなり、Windows で文字がより鮮明になります。+- **残高の通知:** 残高が少なくなると、サイドバーにはその旨だけを表示します。金額はアバターを選ぶと確認できます。+- **すりガラス効果はシステムに連動:** 個別の設定をなくし、システムの「透明度を下げる」設定に従います。+- Bot の作成中は、サイドバーにアバターと名前をリアルタイムで表示し、作成後に別の Bot の画面が一瞬表示されることもなくなりました。+- ドロップダウンメニューがページのスクロールに追従するようになり、「見つける」のレイアウトも調整しました。+## 0.1.20 - 2026-11-03### 新機能diff --git a/site/src/data/changelog.ko.md b/site/src/data/changelog.ko.mdindex 6660a51..d471996 100644--- a/site/src/data/changelog.ko.md+++ b/site/src/data/changelog.ko.md@@ -4,6 +4,22 @@앱을 사용하면서 확인할 수 있는 변경 사항입니다. 이전 버전은 [GitHub 릴리스](https://github.com/modelflare-ai/AnyModelBot/releases)를 확인하세요.+## 0.1.21 - 2026-11-03++### 새로운 기능++- **더 쉬워진 채널 연결:** 설정의 연결 화면을 새로 만들었습니다. 앱마다 연결 방법을 보여 주므로 안내에 따라 코드를 스캔하거나 토큰을 입력하면 됩니다. 첫 메시지를 기다려 연결을 마쳐야 할 때도 바로 알려 줍니다. 같은 앱에 계정을 더 추가할 수도 있습니다.++### 개선 및 수정++- **봇을 삭제할 때 영향을 명확히 안내:** 확인 창에 그 봇이 맡던 채널에 앞으로 어떤 봇이 답할지 표시합니다. 마지막 봇이면 해당 메시지에 답이 오지 않는다고 알려 줍니다.+- **둘러보기 봇 제거:** 같은 확인 창의 체크박스로 데이터를 남길지 고를 수 있습니다.+- **더 깔끔한 화면:** 창 배경의 빛 번짐을 없애고 동작은 중립색으로 통일했습니다. 글자 크기에 0.5픽셀 단위를 쓰지 않아 Windows에서 글자가 더 선명합니다.+- **잔액 알림:** 잔액이 적어지면 사이드바에는 그 사실만 표시합니다. 금액은 아바타를 선택하면 볼 수 있습니다.+- **반투명 효과는 시스템 설정을 따름:** 별도 설정을 없애고 시스템의 투명도 줄이기 설정을 따릅니다.+- 봇을 만드는 동안 사이드바에 아바타와 이름을 바로 보여 주며, 만든 뒤 다른 봇 화면이 잠깐 나타나지 않습니다.+- 드롭다운 메뉴가 페이지 스크롤을 따라가고, 둘러보기 화면의 배치도 다듬었습니다.+## 0.1.20 - 2026-11-03### 새로운 기능diff --git a/site/src/data/changelog.md b/site/src/data/changelog.mdindex 7bbf2a1..4bc4040 100644--- a/site/src/data/changelog.md+++ b/site/src/data/changelog.md@@ -4,6 +4,22 @@这里只写用户能感受到的变化。更早的版本见 [GitHub 发布页](https://github.com/modelflare-ai/AnyModelBot/releases)。+## 0.1.21 - 2026-11-03++### 新增++- **连接聊天渠道更简单:** 设置里的连接重新做了。每个 App 都写明怎么连,按步骤扫码或填 Token 就行;还要等第一条消息完成绑定时,也会直接提示。同一个 App 可以再加账号。++### 改进与修复++- **删除机器人时说清楚影响:** 确认框会写明它负责的聊天渠道之后由哪个机器人回复;如果是最后一个机器人,也会提醒这些消息不会有回复。+- **移除发现页的 Bot:** 在同一个确认框里勾选是否保留数据。+- **界面更干净:** 窗口底色去掉了光晕,操作统一用中性色,字号不再用半像素,Windows 上文字更清楚。+- **余额提示:** 余额不多时,侧栏只提示一句,具体金额点头像查看。+- **毛玻璃跟随系统:** 不再有单独的设置项,跟随系统的“降低透明度”。+- 新建机器人时,侧栏实时显示头像和名字,建好后不会闪到别的机器人。+- 下拉菜单会跟着页面滚动,发现页的排版也做了调整。+## 0.1.20 - 2026-11-03### 新增diff --git a/site/src/data/changelog.ru.md b/site/src/data/changelog.ru.mdindex 7f394e5..5e72225 100644--- a/site/src/data/changelog.ru.md+++ b/site/src/data/changelog.ru.md@@ -4,6 +4,22 @@Здесь описаны заметные пользователю изменения приложения. Предыдущие версии — на странице [выпусков GitHub](https://github.com/modelflare-ai/AnyModelBot/releases).+## 0.1.21 - 2026-11-03++### Новое++- **Каналы подключать проще:** экран подключений в настройках сделан заново. Для каждого приложения показано, как его подключить: следуйте шагам, чтобы отсканировать код или ввести токен. Если для завершения привязки нужно дождаться первого сообщения, приложение об этом скажет. Для одного приложения можно добавить несколько аккаунтов.++### Улучшения и исправления++- **Понятное удаление ботов:** в подтверждении указано, какой бот будет отвечать в каналах удаляемого бота. Если это последний бот, приложение предупредит, что на эти сообщения ответа не будет.+- **Удаление ботов из «Обзора»:** флажок в том же подтверждении позволяет сохранить данные бота.+- **Более чистый вид:** фон окна больше не светится, действия оформлены в нейтральных цветах, а размеры шрифта больше не дробные, поэтому текст в Windows выглядит чётче.+- **Уведомление о балансе:** когда баланс заканчивается, на боковой панели появляется только короткое предупреждение. Сумму можно посмотреть, нажав на аватар.+- **Матовое стекло следует за системой:** отдельной настройки больше нет, приложение учитывает системный параметр снижения прозрачности.+- При создании бота его аватар и имя сразу видны на боковой панели, а после создания не мелькает другой бот.+- Выпадающие меню теперь следуют за прокруткой страницы, а раздел «Обзор» получил более аккуратную вёрстку.+## 0.1.20 - 2026-11-03### Новоеdiff --git a/site/src/i18n/locales/en/partners/index.ts b/site/src/i18n/locales/en/partners/index.tsindex 1be5da3..479d103 100644--- a/site/src/i18n/locales/en/partners/index.ts+++ b/site/src/i18n/locales/en/partners/index.ts@@ -75,41 +75,12 @@ export default {"title": "Join the partner program,","lead": "Share some basics and how to reach you. We'll get in touch to settle the partnership and commission.","mailLabel": "Or email us directly",- "optional": "Optional",- "type": "Which describes you best",- "types": {- "training": "Training provider or instructor",- "creator": "Content creator or community",- "sales": "Service provider or channel partner",- "other": "Other"- },- "name": "Your name",- "company": "Company or organization",- "contact": "How to reach you",- "contactHint": "Email, phone or Telegram",- "audience": "Your clients or audience",- "audienceHint": "For example: corporate training, about 500 learners a year",- "message": "How you'd like to work together",- "messageHint": "A sentence or two is fine",- "submit": "Submit application",- "sending": "Submitting…",- "consent": "We only use this to contact you and assess the partnership.",- "privacy": "Privacy notice",- "errors": {- "type": "Please choose one",- "name": "Please enter your name",- "contact": "Please tell us how to reach you"- },- "failed": "That didn't go through. Try again, or email us at {email}.",- "done": {- "title": "Application received",- "body": "We'll get in touch using the contact details you left."+ "panel": {+ "title": "Apply with your Modelflare account",+ "body": "The application is in the Modelflare console: sign in and submit it there. Once you're approved, your personal coupon and commission figures are there too.",+ "action": "Fill in the application"},"mail": {- "title": "One more step",- "body": "Please send the text below to {email}. We'll get in touch once we receive it.",- "open": "Open email app",- "back": "Go back and edit","subject": "AnyModelBot partner application"},"dim": "we'll work with you one-on-one.",diff --git a/site/src/i18n/locales/ja/partners/index.ts b/site/src/i18n/locales/ja/partners/index.tsindex 71f308f..763bd0c 100644--- a/site/src/i18n/locales/ja/partners/index.ts+++ b/site/src/i18n/locales/ja/partners/index.ts@@ -75,41 +75,12 @@ export default {"title": "パートナープログラムに参加して、","lead": "基本情報と連絡先をご記入ください。こちらからご連絡し、協業の形とコミッションを決めます。","mailLabel": "メールでも受け付けています",- "optional": "任意",- "type": "当てはまるものを選択",- "types": {- "training": "研修機関・講師",- "creator": "クリエイター・コミュニティ",- "sales": "法人向けサービス事業者・販売パートナー",- "other": "その他"- },- "name": "お名前",- "company": "会社・組織名",- "contact": "連絡先",- "contactHint": "メール、電話番号または Telegram",- "audience": "お客様や読者",- "audienceHint": "例:企業研修、年間約 500 名の受講者",- "message": "協業のイメージ",- "messageHint": "簡単で構いません",- "submit": "申し込む",- "sending": "送信中…",- "consent": "ご記入の情報は、ご連絡と協業の検討にのみ使用します。",- "privacy": "プライバシーについて",- "errors": {- "type": "1 つ選択してください",- "name": "お名前を入力してください",- "contact": "連絡先を入力してください"- },- "failed": "送信できませんでした。もう一度お試しいただくか、{email} までメールでご連絡ください。",- "done": {- "title": "お申し込みを受け付けました",- "body": "ご記入の連絡先にご連絡します。"+ "panel": {+ "title": "Modelflare アカウントで申し込む",+ "body": "お申し込みは Modelflare のコンソールで行います。ログインするとすぐに送信できます。承認後は、専用クーポンとコミッションのデータもコンソールで確認できます。",+ "action": "申し込みフォームへ"},"mail": {- "title": "あと少しです",- "body": "以下の内容を {email} までお送りください。受信後にご連絡します。",- "open": "メールアプリを開く",- "back": "戻って修正する","subject": "AnyModelBot パートナー申し込み"},"dim": "個別にサポートを受けましょう。",diff --git a/site/src/i18n/locales/ko/partners/index.ts b/site/src/i18n/locales/ko/partners/index.tsindex 4d7e148..ffc4de0 100644--- a/site/src/i18n/locales/ko/partners/index.ts+++ b/site/src/i18n/locales/ko/partners/index.ts@@ -75,41 +75,12 @@ export default {"title": "파트너 프로그램에 참여하세요,","lead": "기본 정보와 연락처를 남겨 주세요. 연락드려 협력 방식과 수수료를 정합니다.","mailLabel": "메일로 바로 문의할 수도 있습니다",- "optional": "선택",- "type": "어디에 해당하나요",- "types": {- "training": "교육 기관과 강사",- "creator": "콘텐츠 크리에이터와 커뮤니티",- "sales": "기업 서비스 업체와 채널 파트너",- "other": "기타"- },- "name": "이름",- "company": "회사 또는 기관",- "contact": "연락처",- "contactHint": "이메일, 전화번호 또는 Telegram",- "audience": "고객 또는 독자",- "audienceHint": "예: 기업 교육, 연간 수강생 약 500명",- "message": "협력하고 싶은 방식",- "messageHint": "간단히 적어 주셔도 됩니다",- "submit": "신청하기",- "sending": "제출 중…",- "consent": "이 정보는 연락과 협력 검토에만 사용합니다.",- "privacy": "개인정보 안내",- "errors": {- "type": "하나를 선택해 주세요",- "name": "이름을 입력해 주세요",- "contact": "연락처를 입력해 주세요"- },- "failed": "제출하지 못했습니다. 다시 시도하거나 {email}로 메일을 보내 주세요.",- "done": {- "title": "신청이 접수되었습니다",- "body": "남겨 주신 연락처로 연락드리겠습니다."+ "panel": {+ "title": "Modelflare 계정으로 신청",+ "body": "신청은 Modelflare 콘솔에서 합니다. 로그인하면 바로 제출할 수 있습니다. 승인 후에는 전용 쿠폰과 수수료 내역도 콘솔에서 확인할 수 있습니다.",+ "action": "신청서 작성하기"},"mail": {- "title": "한 단계만 더",- "body": "아래 내용을 {email}로 보내 주세요. 받는 대로 연락드리겠습니다.",- "open": "메일 앱 열기",- "back": "돌아가서 수정","subject": "AnyModelBot 파트너 신청"},"dim": "일대일로 함께합니다.",diff --git a/site/src/i18n/locales/ru/partners/index.ts b/site/src/i18n/locales/ru/partners/index.tsindex 1580e12..0e5f518 100644--- a/site/src/i18n/locales/ru/partners/index.ts+++ b/site/src/i18n/locales/ru/partners/index.ts@@ -75,41 +75,12 @@ export default {"title": "Вступайте в программу,","lead": "Укажите основные сведения и контакты. Мы свяжемся с вами и согласуем формат сотрудничества и комиссию.","mailLabel": "Или напишите нам напрямую",- "optional": "Необязательно",- "type": "Что вам подходит",- "types": {- "training": "Учебный центр или преподаватель",- "creator": "Автор контента или сообщество",- "sales": "Интегратор или партнёр по продажам",- "other": "Другое"- },- "name": "Как к вам обращаться",- "company": "Компания или организация",- "contact": "Как с вами связаться",- "contactHint": "Email, телефон или Telegram",- "audience": "Ваши клиенты или аудитория",- "audienceHint": "Например: корпоративное обучение, около 500 учеников в год",- "message": "Как вы хотите сотрудничать",- "messageHint": "Достаточно пары предложений",- "submit": "Отправить заявку",- "sending": "Отправляем…",- "consent": "Мы используем эти данные только для связи с вами и оценки сотрудничества.",- "privacy": "О конфиденциальности",- "errors": {- "type": "Выберите один вариант",- "name": "Укажите, как к вам обращаться",- "contact": "Укажите, как с вами связаться"- },- "failed": "Не удалось отправить заявку. Попробуйте ещё раз или напишите на {email}.",- "done": {- "title": "Заявка получена",- "body": "Мы свяжемся с вами по указанным контактам."+ "panel": {+ "title": "Заявка через аккаунт Modelflare",+ "body": "Заявка заполняется в консоли Modelflare: войдите и отправьте её там. После одобрения там же будут ваш персональный купон и данные о комиссии.",+ "action": "Заполнить заявку"},"mail": {- "title": "Остался один шаг",- "body": "Отправьте текст ниже на {email}. Мы свяжемся с вами, когда получим письмо.",- "open": "Открыть почту",- "back": "Вернуться и изменить","subject": "Заявка на партнёрство AnyModelBot"},"dim": "мы работаем с вами лично.",diff --git a/site/src/i18n/locales/zh/partners/index.ts b/site/src/i18n/locales/zh/partners/index.tsindex 12b908d..94a2ee6 100644--- a/site/src/i18n/locales/zh/partners/index.ts+++ b/site/src/i18n/locales/zh/partners/index.ts@@ -75,41 +75,12 @@ export default {"title": "加入合作伙伴计划,","lead": "留下基础信息和联系方式,我们会和你联系,确定合作方式和佣金。","mailLabel": "也可以直接发邮件",- "optional": "选填",- "type": "你属于哪一类",- "types": {- "training": "培训机构和讲师",- "creator": "内容创作者和社群",- "sales": "企业服务商和渠道伙伴",- "other": "其他"- },- "name": "怎么称呼你",- "company": "公司或机构",- "contact": "联系方式",- "contactHint": "微信、手机号或邮箱",- "audience": "你的客户或受众",- "audienceHint": "比如:企业内训,每年约 500 名学员",- "message": "你打算怎么合作",- "messageHint": "简单说说就行",- "submit": "提交申请",- "sending": "提交中…",- "consent": "我们只用这些信息联系你和评估合作。",- "privacy": "隐私说明",- "errors": {- "type": "请选择一类",- "name": "请填写称呼",- "contact": "请留下联系方式"- },- "failed": "提交没成功。可以再试一次,或直接发邮件到 {email}。",- "done": {- "title": "申请已收到",- "body": "我们会通过你留下的联系方式和你沟通。"+ "panel": {+ "title": "用 Modelflare 账号申请",+ "body": "申请在 Modelflare 控制台填写,登录后就能提交。通过后,你的专属优惠券和佣金数据也都在那里查看。",+ "action": "去填写申请"},"mail": {- "title": "还差一步",- "body": "请把下面的内容发送到 {email},我们收到后会联系你。",- "open": "打开邮件应用",- "back": "返回修改","subject": "AnyModelBot 合作申请"},"dim": "我们一对一对接。",diff --git a/site/src/lib/banner-sky.ts b/site/src/lib/banner-sky.tsdeleted file mode 100644index 3e297be..0000000--- a/site/src/lib/banner-sky.ts+++ /dev/null@@ -1,21 +0,0 @@-// 大圆角卡的静态星空:1200 × 360 的画布上伪随机撒点(每次构建都一样、不成网格)。-// 深色用小星点,浅色用四角形的细小闪光,由样式按主题切换。全部静止。-export const GLINT = "M0-1C.1-.1.1-.1 1 0C.1.1.1.1 0 1C-.1.1-.1.1-1 0C-.1-.1-.1-.1 0-1Z";--export function bannerSky(seed = 3112026) {- let h = seed;- const rnd = () => (h = (Math.imul(h, 1103515245) + 12345) >>> 0) / 2 ** 32;- const dots: { x: number; y: number; r: number; o: number }[] = [];- while (dots.length < 90) {- const x = +(rnd() * 1200).toFixed(1), y = +(rnd() * 360).toFixed(1);- if (rnd() < 0.05) dots.push({ x, y, r: 3.8, o: 0.08 }, { x, y, r: 1.2, o: 0.9 });- else dots.push({ x, y, r: +(0.5 + rnd() * 0.6).toFixed(2), o: +(0.25 + rnd() * 0.45).toFixed(2) });- }- const glints = Array.from({ length: 12 }, () => ({- x: +(rnd() * 1200).toFixed(1),- y: +(24 + rnd() * 260).toFixed(1),- s: +(3 + rnd() * 4).toFixed(1),- o: +(0.45 + rnd() * 0.4).toFixed(2),- }));- return { dots, glints };-}diff --git a/site/src/lib/partner-form.ts b/site/src/lib/partner-form.tsdeleted file mode 100644index c78241c..0000000--- a/site/src/lib/partner-form.ts+++ /dev/null@@ -1,55 +0,0 @@-// 合作申请表的纯逻辑(样式在 pages.css,页面交互在 scripts/partner-form.ts)。-// 提交的 JSON 就是 applicationPayload 的返回值,后台接入时按它来收。-export const PARTNER_TYPES = ["training", "creator", "sales", "other"] as const;-export type PartnerType = (typeof PARTNER_TYPES)[number];--/** 每个文本字段的最大长度:表单的 maxlength 和 readApplication 用同一份 */-export const PARTNER_LIMITS = { name: 80, company: 120, contact: 120, audience: 200, message: 1000 } as const;-type TextField = keyof typeof PARTNER_LIMITS;-const TEXT_FIELDS = Object.keys(PARTNER_LIMITS) as TextField[];--export interface PartnerApplication extends Record<TextField, string> {- type: PartnerType | "";-}-export type RequiredField = "type" | "name" | "contact";--export function readApplication(raw: Record<string, unknown>): PartnerApplication {- const type = PARTNER_TYPES.find((t) => t === raw.type) ?? "";- const text = Object.fromEntries(TEXT_FIELDS.map((k) => [k, String(raw[k] ?? "").trim().slice(0, PARTNER_LIMITS[k])])) as Record<TextField, string>;- return { type, ...text };-}--/** 没填的必填项,顺序和表单一致(第一个用来聚焦) */-export function missingFields(app: PartnerApplication): RequiredField[] {- return (["type", "name", "contact"] as const).filter((k) => !app[k]);-}--export function applicationPayload(app: PartnerApplication, lang: string) {- return { ...app, lang, source: "site-partners" };-}--export interface MailText {- subject: string;- /** 字段名 → 显示名,邮件正文按这个顺序写 */- labels: Record<"type" | TextField, string>;- types: Record<PartnerType, string>;-}--/** 没接后台时让申请人发邮件的正文:只写填了的项 */-export function mailBody(app: PartnerApplication, text: MailText): string {- return (Object.keys(text.labels) as (keyof MailText["labels"])[])- .map((k) => {- const value = k === "type" ? (app.type ? text.types[app.type] : "") : app[k];- return value ? `${text.labels[k]}: ${value}` : "";- })- .filter(Boolean)- .join("\n");-}--/** 中文转义后很长,过长的地址有些邮件应用打不开:超过上限就只带主题,正文由申请人从页面上复制 */-const MAILTO_MAX = 1800;-export function mailtoHref(email: string, subject: string, body: string): string {- const base = `mailto:${email}?subject=${encodeURIComponent(subject)}`;- const full = `${base}&body=${encodeURIComponent(body)}`;- return full.length <= MAILTO_MAX ? full : base;-}diff --git a/site/src/lib/site.ts b/site/src/lib/site.tsindex 53f373c..5193d9e 100644--- a/site/src/lib/site.ts+++ b/site/src/lib/site.ts@@ -14,8 +14,6 @@ export const SECURITY_EMAIL = env("SECURITY_EMAIL");const optional = (k: string) => (import.meta.env[k] as string | undefined) || process.env[k] || "";export const ANALYTICS_SCRIPT_URL = optional("ANALYTICS_SCRIPT_URL");export const ANALYTICS_SITE_ID = optional("ANALYTICS_SITE_ID");-/** 合作申请的提交地址:没配置时,表单让申请人把内容发到 PARTNERS_EMAIL,不会假装提交成功 */-export const PARTNER_APPLY_URL = optional("PARTNER_APPLY_URL");export const PARTNERS_EMAIL = "[email protected]";export const ORIGIN = `https://${SITE_DOMAIN}`;/** GitHub 星数的初始值:构建时取(scripts/fetch-github-stars.ts);页面打开后由 scripts/stars.ts 换成站内 /stars.json 的值 */@@ -29,6 +27,8 @@ export const MF = {home: mf("https://modelflare.dev/"),pricing: mf("https://modelflare.dev/pricing"),docs: mf("https://docs.modelflare.dev/"),+ /** 合作伙伴申请:Modelflare 控制台里的 AnyModelBot 合作页,没登录时先去登录 */+ partnerApply: mf("https://modelflare.dev/affiliate-program?tab=anymodelbot"),};const Bin = z.object({ url: z.string().min(1), sha256: z.string().min(1), sizeMB: z.number().nonnegative() });diff --git a/site/src/scripts/partner-form.ts b/site/src/scripts/partner-form.tsdeleted file mode 100644index 15ff578..0000000--- a/site/src/scripts/partner-form.ts+++ /dev/null@@ -1,93 +0,0 @@-// 合作申请表(/partners)。表单和各个状态都写在 HTML 里,这里只负责校验、提交和切换显示。-// - 配了 PARTNER_APPLY_URL:POST JSON,成功才显示“已收到”,失败留在表单上,填的内容不丢。-// - 没配:不假装提交成功,显示邮件内容,让申请人自己发出去。-// - 地址加 ?apply=preview:走一遍成功流程但不发送,用来看样式(和 ?banner=preview 同一种做法)。-import { track } from "./client";-import { applicationPayload, mailBody, mailtoHref, missingFields, readApplication, type MailText, type RequiredField } from "../lib/partner-form";--const TIMEOUT_MS = 15_000;--function mount(form: HTMLFormElement) {- const root = form.closest<HTMLElement>("[data-partner-apply]")!;- const done = root.querySelector<HTMLElement>("[data-partner-done]")!;- const mail = root.querySelector<HTMLElement>("[data-partner-mail]")!;- const failed = form.querySelector<HTMLElement>("[data-partner-failed]")!;- const submit = form.querySelector<HTMLButtonElement>("button[type=submit]")!;- const email = form.dataset.email!;- const text = JSON.parse(form.dataset.mail!) as MailText;- let sending = false;-- const show = (panel: HTMLElement) => {- for (const el of [form, done, mail]) el.hidden = el !== panel;- panel.querySelector<HTMLElement>("[data-partner-focus]")?.focus();- };- const markField = (name: string, invalid: boolean) => {- const field = form.querySelector<HTMLElement>(`[data-field="${name}"]`);- if (!field) return;- field.toggleAttribute("data-invalid", invalid);- field.querySelector<HTMLElement>(".pt-err")!.hidden = !invalid;- field.querySelectorAll("input").forEach((i) => (invalid ? i.setAttribute("aria-invalid", "true") : i.removeAttribute("aria-invalid")));- };- const showMissing = (missing: RequiredField[]) => {- (["type", "name", "contact"] as const).forEach((k) => markField(k, missing.includes(k)));- if (missing[0]) form.querySelector<HTMLInputElement>(`[data-field="${missing[0]}"] input`)?.focus();- };-- form.addEventListener("input", (e) => {- const field = (e.target as Element).closest<HTMLElement>("[data-field]");- if (field?.hasAttribute("data-invalid")) markField(field.dataset.field!, false);- });-- form.addEventListener("submit", async (e) => {- e.preventDefault();- if (sending) return;- const raw = Object.fromEntries(new FormData(form));- // 蜜罐:正常人看不到这个输入框,填了的当作机器人,不发送- if (raw.website) { show(done); return; }- const app = readApplication(raw);- const missing = missingFields(app);- showMissing(missing);- if (missing.length) return;- failed.hidden = true;-- if (new URLSearchParams(location.search).get("apply") === "preview") { show(done); return; }-- const endpoint = form.dataset.endpoint;- if (!endpoint) {- const body = mailBody(app, text);- mail.querySelector("code")!.textContent = body;- mail.querySelector<HTMLAnchorElement>("[data-partner-open]")!.href = mailtoHref(email, text.subject, body);- show(mail);- track("partner_apply", { via: "email", type: app.type });- return;- }-- sending = true;- submit.disabled = true;- submit.textContent = submit.dataset.sending!;- try {- const res = await fetch(endpoint, {- method: "POST",- headers: { "Content-Type": "application/json" },- body: JSON.stringify(applicationPayload(app, form.dataset.lang!)),- signal: AbortSignal.timeout(TIMEOUT_MS),- });- if (!res.ok) throw new Error(`HTTP ${res.status}`);- form.reset();- show(done);- track("partner_apply", { via: "api", type: app.type });- } catch {- failed.hidden = false;- track("partner_apply_failed", { type: app.type });- } finally {- sending = false;- submit.disabled = false;- submit.textContent = submit.dataset.label!;- }- });-- root.querySelector("[data-partner-back]")?.addEventListener("click", () => show(form));-}--const form = document.querySelector<HTMLFormElement>("[data-partner-form]");-if (form) mount(form);diff --git a/site/src/styles/hero-scene.css b/site/src/styles/hero-scene.cssindex 3f3579b..a9ab9a2 100644--- a/site/src/styles/hero-scene.css+++ b/site/src/styles/hero-scene.css@@ -1,7 +1,7 @@@layer tokens, base, components, app, utilities;-/* Hero 的背景:取色(.hero-scene)+ 顶光 → 天空 → 光晕 → 地平线。首页 Hero(sections/Hero.astro)和下载页页头(views/DownloadView.astro)共用;- 外框和磨砂颗粒各自写(首页 .hero__bg,下载页 .dl-top),各层的用意见 home.css 的"1 Hero"。- 动画也写在这里(文件末尾),两处一样:背景动画的例外只给这两处(README"动效的硬规矩";下载页是用户 2026-11-03 要求的)。 */+/* Hero 的背景:取色(.hero-scene)+ 顶光 → 天空 → 光晕 → 地平线。首页 Hero(sections/Hero.astro)、下载页和合作伙伴页的首屏共用;+ 外框和磨砂颗粒首页写在 .hero__bg,附属页共用下面的 .scene-top,各层的用意见 home.css 的"1 Hero"。+ 动画也写在这里(文件末尾),三处一样:背景动画的例外只给这三处(README"动效的硬规矩";下载页、合作伙伴页是用户 2026-11-03 要求和首页统一的)。 */@layer app {.hero-scene {--hero-top: clamp(40px, 7vw, 104px);@@ -13,6 +13,8 @@--hero-rim: rgba(255, 255, 255, .6);--hero-glow-a: 14%;--hero-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)' opacity='.05'/%3E%3C/svg%3E");+ --hero-em-glow: color-mix(in srgb, var(--lime) 22%, transparent);+ --hero-cta-glow: color-mix(in srgb, var(--lime) 45%, transparent);--hero-panel-bg: linear-gradient(var(--hero-panel-top), var(--bg-feature) 46%);}[data-theme="light"] .hero-scene {@@ -22,6 +24,8 @@--hero-rim: #ffffff;--hero-glow-a: 4%;--hero-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)' opacity='.035'/%3E%3C/svg%3E");+ --hero-em-glow: oklch(.8 .12 var(--hero-hue) / .35);+ --hero-cta-glow: rgba(17, 24, 39, .16);/* 浅色·蓝天:顶上是一片清透的浅天蓝(不是灰),往下越来越淡,到说明文字附近已经回到卡片的白;用 px 定位而不是百分比,Hero 高矮不同时蓝天的厚度不变。白云和闪光都靠这层蓝才立得住 */--hero-panel-bg: linear-gradient(@@ -117,6 +121,25 @@}[data-theme="light"] .hero__horizon::before { box-shadow: inset 0 1px 0 var(--hero-rim), inset 0 4px 12px -4px color-mix(in srgb, var(--hz-glow) 14%, transparent); }+ /* 附属页的首屏(下载、合作伙伴):一块四周留 8px 的圆角大卡片,顶边压到导航下面;页头在上,舞台(平台卡、佣金通知)在下。+ 地平线放在 .scene-stage 里,位置跟着舞台走,不用算页头有多高:--stage-h 取 100%,上面 .hero__glow、.hero__horizon 的 top 就只剩 --hz-y(顶沿比舞台顶边高多少)。+ 叠放次序:背景各层 → 磨砂颗粒(z 1)→ 页头、舞台内容(z 2)。 */+ .scene-top {+ --scene-inset: 8px; --stage-h: 100%; --hz-y: -24px; --hz-w: max(2600px, 190%);+ position: relative; isolation: isolate; overflow: clip;+ margin: calc(var(--scene-inset) - var(--nav-h)) var(--scene-inset) 0;+ padding: calc(var(--nav-h) - var(--scene-inset) + var(--hero-top)) 0 var(--stack-head);+ border-radius: var(--r-feature); background: var(--hero-panel-bg); box-shadow: inset 0 0 0 1px var(--line);+ }+ .scene-top::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: var(--hero-grain); }+ /* 大卡片比页面窄一圈,内容宽度补回来,和下面几节的左右边对齐 */+ .scene-top > .container { width: min(var(--container), 100% + 2 * var(--scene-inset) - 2 * var(--gutter)); }+ .scene-stage { position: relative; }+ .scene-top > .container > :not(.scene-stage), .scene-stage > :not(.hero__glow, .hero__horizon) { position: relative; z-index: 2; }+ @media (max-width: 767px) {+ .scene-top { --scene-inset: 6px; --hz-w: 1500px; border-radius: var(--r-card); }+ }+/* 动画:入场时地平线从下面升起、光晕亮起来,之后静止不循环;天空的说明见上面 .hero__sky。"减少动态效果"时都不放 */@media (prefers-reduced-motion: no-preference) {.hero__horizon { animation: hero-sunrise 2s var(--ease-out) 100ms backwards; }diff --git a/site/src/styles/home.css b/site/src/styles/home.cssindex 8c66dab..10702f8 100644--- a/site/src/styles/home.css+++ b/site/src/styles/home.css@@ -70,8 +70,6 @@--hz-y: 210px; /* 地平线顶沿在舞台里的高度 */--hz-w: max(2600px, 190%);--hero-aura: oklch(.6 .08 var(--hero-hue) / .07);- --hero-em-glow: color-mix(in srgb, var(--lime) 22%, transparent);- --hero-cta-glow: color-mix(in srgb, var(--lime) 45%, transparent);position: relative; margin-top: calc(-1 * var(--nav-h));padding-top: calc(var(--nav-h) + var(--hero-top)); overflow: clip;transition: --hz-glow 1.4s var(--ease-inout), --hero-hue 1.4s var(--ease-inout);@@ -81,8 +79,6 @@/* 浅色:顶光就是卡片本身的白,机器人色再压一半;完全不用黄绿 */[data-theme="light"] .hero {--hero-aura: oklch(.95 .012 var(--hero-hue) / .45); /* 换幕时只有一点点冷暖,底色仍是白 / 灰 */- --hero-em-glow: oklch(.8 .12 var(--hero-hue) / .35);- --hero-cta-glow: rgba(17, 24, 39, .16);}.hero__bg {position: absolute; inset: 8px 8px 0; overflow: hidden; pointer-events: none; border-radius: var(--r-feature); isolation: isolate;diff --git a/site/src/styles/pages.css b/site/src/styles/pages.cssindex e3def78..99939ab 100644--- a/site/src/styles/pages.css+++ b/site/src/styles/pages.css@@ -4,23 +4,8 @@/* —— 下载 ——版式和首页同一套:居中的页头 + 一个主操作,下面是等宽的卡片。层次靠留白和细线,不靠色块、边条;品牌色只给页头的主按钮和“你的系统”。结构见 views/DownloadView.astro。 */- /* 页头和平台卡落在一块圆角大卡片里,背景和首页 Hero 同一套(hero-scene.css)。四周留 8px,顶边压到导航下面。- 地平线放在 .dl-stage 里,位置跟着平台卡走,不用算页头有多高:--stage-h 取 100%,公共规则里的 top 就只剩 --hz-y(顶沿比卡片顶边高多少)。- 叠放次序:背景各层 → 磨砂颗粒(z 1)→ 页头、卡片(z 2)。背景的动画和首页一样,写在 hero-scene.css。 */+ /* 页头和平台卡落在一块圆角大卡片里(.scene-top,在 hero-scene.css),背景和动画都和首页 Hero 同一套 */.dl-page { padding-top: 0; }- .dl-top {- --dl-inset: 8px; --stage-h: 100%; --hz-y: -24px; --hz-w: max(2600px, 190%);- position: relative; isolation: isolate; overflow: clip;- margin: calc(var(--dl-inset) - var(--nav-h)) var(--dl-inset) 0;- padding: calc(var(--nav-h) - var(--dl-inset) + var(--hero-top)) 0 var(--stack-head);- border-radius: var(--r-feature); background: var(--hero-panel-bg); box-shadow: inset 0 0 0 1px var(--line);- }- .dl-top::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: var(--hero-grain); }- /* 大卡片比页面窄一圈,内容宽度补回来,和下面几节的左右边对齐 */- .dl-top > .container { width: min(var(--container), 100% + 2 * var(--dl-inset) - 2 * var(--gutter)); }- .dl-stage { position: relative; }- .dl-hero, .dl-plats, .dl-note { position: relative; z-index: 2; }-.dl-hero { display: grid; justify-items: center; margin-bottom: var(--stack-head); text-align: center; }.dl-hero__mark { margin-bottom: var(--space-6); }.dl-hero .lead { max-width: 34em; margin-top: var(--space-4); }@@ -82,7 +67,6 @@.dl-ways { grid-template-columns: minmax(0, 1fr); }}@media (max-width: 767px) {- .dl-top { --dl-inset: 6px; --hz-w: 1500px; border-radius: var(--r-card); }.dl-sums { padding-inline: var(--space-4); }.dl-sums__row { grid-template-columns: minmax(0, 1fr) auto; }.dl-sums__hash { grid-column: 1 / -1; grid-row: 2; }@@ -90,68 +74,58 @@}/* —— 合作伙伴 ——- 和首页同一种语言:首屏是一张大圆角卡(顶光 + 星空 + 地平线上探头的机器人),章节头用 SectionHead,层次靠字号、留白和细线。- 品牌色只给主按钮、标题高亮、第三步和“获得佣金”这条通知。结构见 views/PartnersView.astro。- 动效只有一个:佣金示意的三条通知依次到达(内容出现,只播一次);背景全部静止。 */- .pt-page { padding-top: clamp(12px, 2vw, 24px); }+ 和首页同一种语言:首屏和首页 Hero 同一套(.scene-top:居中的页头 → 地平线托着三条佣金通知),章节头用 SectionHead,层次靠字号、留白和细线。+ 品牌色只给主按钮、标题关键词、第三步和“获得佣金”这条通知。结构见 views/PartnersView.astro。+ 内容的动效只有一个:三条通知依次到达(只播一次);背景的动画和首页 Hero 一样,写在 hero-scene.css。 */+ .pt-page { padding-top: 0; }.pt-body { color: var(--text-2); font-size: var(--fs-body); line-height: 1.7; text-wrap: pretty; }- .pt-body a, .pt-form__foot a, .pt-mail a { color: var(--text); text-decoration: underline 1px var(--line-strong); text-underline-offset: 4px; }- .pt-body a:hover, .pt-form__foot a:hover, .pt-mail a:hover { text-decoration-color: currentColor; }+ .pt-body a, .pt-mail a { color: var(--text); text-decoration: underline 1px var(--line-strong); text-underline-offset: 4px; }+ .pt-body a:hover, .pt-mail a:hover { text-decoration-color: currentColor; }.pt-sec { margin-top: clamp(80px, 10vw, 136px); }- /* 首屏 */- .pt-hero {- --pt-hz: 60px;- --pt-bot: 72px;- --pt-base: linear-gradient(180deg, #0d0e12, var(--bg-feature) 64%);- --pt-beam: rgba(255, 255, 255, .085);- --pt-star: #dfe6ff;- --pt-ground: linear-gradient(180deg, #16171d, #0e0f13 55%);- --pt-rim: rgba(255, 255, 255, .14);- --pt-edge: var(--line);- position: relative; display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: center; gap: var(--grid-gap);- padding: clamp(48px, 6vw, 88px) clamp(24px, 5vw, 72px) calc(var(--pt-hz) + var(--pt-bot) * .5 + clamp(40px, 5vw, 64px));- border-radius: var(--r-banner); overflow: hidden; isolation: isolate;- background: var(--grain), radial-gradient(60% 80% at 30% -10%, var(--pt-beam), transparent 70%), var(--pt-base);+ /* 首屏页头:和首页 Hero 同一列——小胶囊 → 标题 → 说明 → 按钮 → 要点,居中;标题背后的星有意稀一些(HeroSky) */+ .pt-hero { display: grid; justify-items: center; margin-bottom: var(--stack-head); text-align: center; }+ /* 小胶囊:和首页的同一种,六个机器人叠成一排 + 一句话,这里不是链接 */+ .pt-eyebrow {+ display: inline-flex; align-items: center; gap: 10px; height: 36px; margin-bottom: var(--space-6); padding: 0 14px 0 5px;+ border-radius: var(--r-btn); background: var(--grain), var(--glass); box-shadow: var(--glass-ring);+ font-size: var(--fs-sm); font-weight: 500; -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);}- [data-theme="light"] .pt-hero {- --pt-base: linear-gradient(180deg, #ffffff, #f7f8fa 70%);- --pt-beam: #ffffff;- --pt-star: #a3abc0;- --pt-ground: #eef0f3;- --pt-rim: #ffffff;- --pt-edge: var(--glass-edge);- box-shadow: var(--glass-ring), inset 0 1px 0 #ffffff, 0 1px 2px rgba(17, 24, 39, .05), 0 30px 70px -36px rgba(17, 24, 39, .22);+ .pt-crew { display: inline-flex; }+ .pt-crew .bot-face { margin-left: -8px; border-radius: 50%; background: var(--bg-raised); box-shadow: 0 0 0 2px var(--hero-panel-top); }+ .pt-crew .bot-face:first-child { margin-left: 0; }+ /* 标题:第一行渐隐的渐变字,第二行是关键词(品牌色 + 光晕),和首页 Hero 同一种。渐变字上下多留一点内边距,字形的上下沿不会被裁掉 */+ .pt-hero h1 { display: grid; justify-items: center; font-size: clamp(42px, 5.4vw, 72px); line-height: 1.06; letter-spacing: -.04em; text-wrap: balance; }+ :is(:lang(zh), :lang(ja), :lang(ko)) .pt-hero h1 { font-size: clamp(36px, 5vw, 68px); line-height: 1.2; letter-spacing: -.02em; }+ :lang(ru) .pt-hero h1 { font-size: clamp(32px, 4.2vw, 56px); line-height: 1.14; letter-spacing: -.03em; }+ .pt-hero h1 > :is(span, em) {+ display: block; padding-block: .1em; margin-block: -.1em; font-style: normal;+ color: transparent; -webkit-text-fill-color: transparent; -webkit-background-clip: text; background-clip: text;}- .pt-hero::after { content: ""; position: absolute; inset: 0; z-index: 3; border-radius: inherit; pointer-events: none; box-shadow: inset 0 0 0 1px var(--pt-edge); }- .pt-hero__sky { position: absolute; inset: 0 0 auto; z-index: 0; height: 78%; color: var(--pt-star); pointer-events: none; -webkit-mask-image: linear-gradient(#000 30%, transparent); mask-image: linear-gradient(#000 30%, transparent); }- .pt-hero__sky svg { display: block; width: 100%; height: 100%; fill: currentColor; }- .pt-hero__sky .glint, [data-theme="light"] .pt-hero__sky .dot { display: none; }- [data-theme="light"] .pt-hero__sky .glint { display: inline; }- .pt-hero__copy, .pt-feed { position: relative; z-index: 4; min-width: 0; }- .pt-hero__copy { display: grid; justify-items: start; }- .pt-hero h1 { margin-top: var(--space-6); font-size: clamp(40px, 5vw, 68px); line-height: 1.08; letter-spacing: -.035em; }- :is(:lang(zh), :lang(ja), :lang(ko)) .pt-hero h1 { font-size: clamp(34px, 4.2vw, 58px); line-height: 1.26; letter-spacing: 0; }- :lang(ru) .pt-hero h1 { font-size: clamp(32px, 3.8vw, 52px); line-height: 1.14; }- .pt-hero h1 > span { display: block; }- .pt-hero .lead { max-width: 34em; margin-top: var(--space-6); text-wrap: pretty; }- .pt-hero__cta { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-8); }- .pt-hero__points { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); margin-top: var(--space-8); color: var(--text-2); font-size: var(--fs-sm); line-height: 1.5; }- .pt-hero__points li { display: inline-flex; align-items: center; gap: var(--space-2); }- .pt-hero__points .icon { flex: none; width: 16px; height: 16px; color: var(--accent-fg); }- /* 地平线和探头的机器人:和首页收尾横幅同一种 */- .pt-hero__bots { position: absolute; left: 0; right: 0; bottom: calc(var(--pt-hz) - var(--pt-bot) * .48); z-index: 1; display: flex; justify-content: center; gap: clamp(8px, 2.4vw, 28px); }- .pt-hero__horizon { position: absolute; left: 50%; top: calc(100% - var(--pt-hz)); z-index: 2; width: 180%; height: 420px; translate: -50% 0; border-radius: 50%; pointer-events: none; background: var(--pt-ground); box-shadow: inset 0 1px 0 var(--pt-rim); }-- /* 佣金示意:三条通知,一路走到“获得佣金” */- .pt-feed { display: grid; gap: var(--space-2); margin: 0; }- .pt-feed ol { display: grid; gap: var(--space-3); }- .pt-feed__item { display: flex; align-items: center; gap: var(--space-3); margin-inline-start: calc(var(--i) * 16px); padding: 14px 16px; border-radius: 18px; background: var(--grain), var(--glass-strong); box-shadow: var(--glass-ring), 0 18px 40px -24px var(--shadow-c); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); font-size: var(--fs-body-sm); line-height: 1.5; }+ .pt-hero h1 > span { background-image: linear-gradient(180deg, var(--text) 32%, color-mix(in srgb, var(--text) 60%, transparent)); }+ .pt-hero h1 > em { position: relative; background-image: linear-gradient(180deg, var(--lime-200), var(--lime) 70%); }+ /* 浅色下黄绿的字发脏,关键词改用天天的蓝(和首页 Hero 第一幕一样) */+ [data-theme="light"] .pt-hero h1 > em { background-image: linear-gradient(180deg, oklch(.56 .17 var(--hero-hue)), oklch(.44 .15 calc(var(--hero-hue) + 18))); }+ .pt-hero h1 > em::before { content: ""; position: absolute; inset: 18% -6% -4%; z-index: -1; border-radius: 50%; background: radial-gradient(closest-side, var(--hero-em-glow), transparent); filter: blur(16px); }+ .pt-hero .lead { max-width: 36em; margin-top: var(--space-6); text-wrap: balance; }+ :is(:lang(zh), :lang(ja), :lang(ko)) .pt-hero .lead { max-width: 34em; }+ .pt-hero__cta { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3); margin-top: var(--space-8); }+ .pt-hero__cta .btn--primary { box-shadow: 0 16px 44px -14px var(--hero-cta-glow); }+ .pt-hero__points { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2) var(--space-6); margin-top: var(--space-6); color: var(--text-2); font-size: var(--fs-sm); line-height: 1.5; }+ .pt-hero__points li { display: inline-flex; align-items: center; gap: 6px; }+ .pt-hero__points .icon { flex: none; width: 14px; height: 14px; color: oklch(.8 .13 var(--hero-hue)); }+ [data-theme="light"] .pt-hero__points .icon { color: oklch(.52 .15 var(--hero-hue)); }++ /* 舞台:地平线托着三条通知,一路走到“获得佣金”;一条细线把它们连起来 */+ .pt-feed { display: grid; gap: var(--space-3); margin: 0; }+ .pt-feed ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }+ .pt-feed__item { position: relative; display: flex; align-items: center; gap: var(--space-4); padding: var(--space-6); border-radius: var(--r-card); background: var(--grain), var(--glass-strong); box-shadow: var(--glass-ring), 0 24px 60px -32px var(--shadow-c); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); font-size: var(--fs-body-sm); line-height: 1.5; }+ .pt-feed__item:not(:last-child)::after { content: ""; position: absolute; top: 50%; left: 100%; width: var(--space-4); height: 1px; background: var(--line-strong); }.pt-feed__item .bot-face { flex: none; }.pt-feed__coin { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--signal-bg); color: var(--signal-fg); }.pt-feed__coin .icon { width: 20px; height: 20px; }- .pt-feed__item--earn { font-weight: 600; font-size: var(--fs-body); box-shadow: inset 0 0 0 1.5px var(--accent-fg), 0 18px 40px -24px var(--shadow-c); }- .pt-feed figcaption { justify-self: end; color: var(--text-2); font-size: var(--fs-xs); }+ .pt-feed__item--earn { font-weight: 600; font-size: var(--fs-body); box-shadow: inset 0 0 0 1.5px var(--accent-fg), 0 24px 60px -32px var(--shadow-c); }+ .pt-feed figcaption { justify-self: center; color: var(--text-2); font-size: var(--fs-xs); }@media (prefers-reduced-motion: no-preference) {.pt-feed__item { animation: pt-arrive .55s var(--ease-out) calc(var(--i) * 480ms + 240ms) backwards; }}@@ -190,7 +164,7 @@.pt-stays .icon { width: 14px; height: 14px; color: var(--accent-fg); }.pt-bots { flex: none; display: flex; gap: clamp(8px, 1.4vw, 20px); }- /* 申请:左边说明和邮箱,右边表单 */+ /* 申请:左边说明和邮箱,右边去 Modelflare 控制台的入口 */.pt-apply { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--grid-gap); align-items: start; }.pt-apply__intro { display: grid; gap: var(--space-6); }.pt-apply__points { display: grid; gap: var(--space-3); }@@ -201,39 +175,15 @@.pt-mail { display: flex; align-items: center; gap: var(--space-2); font-size: var(--fs-body); overflow-wrap: anywhere; }.pt-mail .copy-btn { padding: 0 8px; }- .pt-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6) var(--space-4); padding: clamp(20px, 3vw, 36px); border-radius: var(--r-feature); }- .pt-form[hidden], .pt-panel[hidden] { display: none; }- .pt-field { display: grid; align-content: start; gap: var(--space-2); min-width: 0; margin: 0; padding: 0; border: 0; }- :is(.pt-field--wide, .pt-failed, .pt-form__foot) { grid-column: 1 / -1; }- .pt-label { display: flex; justify-content: space-between; gap: var(--space-3); width: 100%; padding: 0; font-size: var(--fs-body-sm); font-weight: 500; line-height: 1.5; }- fieldset > .pt-label { margin-bottom: var(--space-2); }- .pt-opt { flex: none; color: var(--text-2); font-size: var(--fs-sm); font-weight: 400; }- .pt-input { width: 100%; height: 48px; padding: 0 14px; border: 0; border-radius: var(--r-field); background: var(--bg-sunken); box-shadow: inset 0 0 0 1px var(--line); color: var(--text); font-size: var(--fs-body); }- .pt-input::placeholder { color: var(--text-2); opacity: .8; }- .pt-input--area { display: block; height: auto; min-height: 120px; padding-block: 12px; line-height: 1.6; resize: vertical; }- .pt-input:focus-visible { outline: none; box-shadow: inset 0 0 0 1.5px var(--accent-fg), 0 0 0 4px var(--accent-wash); }- [data-invalid] > .pt-input { box-shadow: inset 0 0 0 1.5px var(--danger); }- .pt-err, .pt-failed { color: var(--danger); font-size: var(--fs-sm); line-height: 1.5; }- .pt-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }- .pt-chip { position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: var(--r-btn); color: var(--text-2); font-size: var(--fs-body-sm); box-shadow: inset 0 0 0 1px var(--line); transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast); }- .pt-chip:hover { color: var(--text); background: var(--hover); }- .pt-chip input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }- .pt-chip:has(input:checked) { color: var(--text); font-weight: 500; background: var(--accent-wash); box-shadow: inset 0 0 0 1.5px var(--accent-fg); }- .pt-chip:has(input:focus-visible) { box-shadow: inset 0 0 0 1.5px var(--accent-fg), 0 0 0 4px var(--accent-wash); }- [data-invalid] .pt-chip:not(:has(input:checked)) { box-shadow: inset 0 0 0 1px var(--danger); }- .pt-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }- .pt-form__foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-6); margin-top: var(--space-2); }- .pt-form__foot p { flex: 1 1 16em; color: var(--text-2); font-size: var(--fs-sm); line-height: 1.6; }-- /* 提交后的状态:已收到 / 还差一步(发邮件) */+ /* 入口卡片 */.pt-panel { display: grid; justify-items: start; gap: var(--space-4); padding: clamp(24px, 3vw, 40px); border-radius: var(--r-feature); }- .pt-panel .h3:focus { outline: none; }- .pt-panel .code { width: 100%; }- .pt-panel .code code { font-size: var(--fs-sm); }.pt-panel__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-2); }@media (max-width: 1023px) {- .pt-hero, .pt-who, .pt-apply { grid-template-columns: minmax(0, 1fr); }+ .pt-who, .pt-apply { grid-template-columns: minmax(0, 1fr); }+ /* 通知改成竖排,细线往下连到下一条(对准机器人头像的中心) */+ .pt-feed ol { grid-template-columns: minmax(0, 1fr); width: min(100%, 560px); margin-inline: auto; }+ .pt-feed__item:not(:last-child)::after { top: 100%; left: calc(var(--space-6) + 20px); width: 1px; height: var(--space-4); }.pt-bento__card--models, .pt-bento__card--data { grid-column: span 12; }.pt-bento__card--bots { flex-direction: column; align-items: flex-start; }/* 三步改成竖排:节点在左,细线往下连到下一步 */@@ -244,12 +194,15 @@.pt-path > li:not(:last-child)::after { top: 56px; bottom: calc(8px - var(--space-8)); left: 24px; right: auto; width: 1px; height: auto; }}@media (max-width: 767px) {- .pt-hero { --pt-hz: 48px; --pt-bot: 50px; padding-inline: 20px; border-radius: var(--r-feature); }- .pt-hero__bots { gap: 4px; }- .pt-hero__bots .bot-face { --s: 50px !important; }- .pt-hero__cta, .pt-hero__cta .btn, .pt-path__cta, .pt-form__foot .btn, .pt-panel__actions, .pt-panel__actions .btn { width: 100%; }- .pt-feed__item { margin-inline-start: 0; }- .pt-form { grid-template-columns: minmax(0, 1fr); }+ .pt-eyebrow { margin-bottom: var(--space-4); font-size: var(--fs-xs); }+ .pt-crew .bot-face:nth-child(n + 4) { display: none; }+ .pt-hero h1 { font-size: clamp(34px, 9.4vw, 44px); }+ :is(:lang(zh), :lang(ja), :lang(ko)) .pt-hero h1 { font-size: clamp(30px, 8.6vw, 40px); }+ :lang(ru) .pt-hero h1 { font-size: clamp(28px, 7.6vw, 36px); }+ .pt-hero .lead { margin-top: var(--space-4); }+ .pt-hero__cta, .pt-hero__cta .btn, .pt-path__cta, .pt-panel__actions, .pt-panel__actions .btn { width: 100%; }+ .pt-feed__item { padding: var(--space-4); }+ .pt-feed__item:not(:last-child)::after { left: calc(var(--space-4) + 20px); }.pt-tile { width: 48px; height: 48px; }.pt-bots { flex-wrap: wrap; gap: var(--space-2); }.pt-bots .bot-face { --s: 44px !important; }diff --git a/site/src/views/DownloadView.astro b/site/src/views/DownloadView.astroindex 313a592..c2ce655 100644--- a/site/src/views/DownloadView.astro+++ b/site/src/views/DownloadView.astro@@ -1,7 +1,7 @@---// 下载页。版式和首页同一套:居中的页头 + 一个主操作,下面是等宽的卡片,层次靠留白和细线。样式在 pages.css 的"下载"。// 页头:标记 → 标题 → 一句话 → 按系统识别的下载按钮(client.ts 的 [data-dl])→ 版本、更新日志、发布页。-// 页头和平台卡落在一块圆角大卡片(.dl-top)里,背景和首页 Hero 同一套(hero-scene.css):夜空 / 晴空 → 顶光 → 地平线托着平台卡。动画也和首页一样(星闪、流星、云飘、闪光,地平线入场时升起)。+// 页头和平台卡落在一块圆角大卡片(.scene-top)里,背景和首页 Hero 同一套(hero-scene.css):夜空 / 晴空 → 顶光 → 地平线托着平台卡。动画也和首页一样(星闪、流星、云飘、闪光,地平线入场时升起)。// 平台:Windows、macOS、Linux 三张卡,结构相同(macOS 一张卡两颗按钮:Apple 芯片、Intel);识别出的系统标"你的系统"。// 其它安装方式:Docker、命令行两张卡,每张三步。首页的 Docker 入口链到 #docker。// 校验:完整的 SHA-256 只放在这一节,不进平台卡。@@ -47,7 +47,7 @@ const verify = [---<Base lang={lang} path="/download" title={`${d.pageTitle} — AnyModelBot`} description={d.pageDescription}><div class="page dl-page">- <div class="dl-top hero-scene">+ <div class="scene-top hero-scene"><div class="hero__beam"></div><HeroSky /><div class="container">@@ -59,7 +59,7 @@ const verify = [<p class="dl-hero__meta"><span set:html={fmt(d.meta, { version: mono(releases.version), publishedAt: mono(published) })} /> · <a href={href(lang, "/changelog")}>{d.changelog}</a> · <a href={`${GITHUB_URL}/releases`} target="_blank" rel="noopener">{d.releases}</a></p>{t.home.hero.appUiNote && <p class="small muted">{t.home.hero.appUiNote}</p>}</header>- <div class="dl-stage">+ <div class="scene-stage"><div class="hero__glow"></div><div class="hero__horizon"></div><ul class="dl-plats" id="platforms" role="list" data-placement="download-page">diff --git a/site/src/views/PartnersView.astro b/site/src/views/PartnersView.astroindex 6d0c172..10bdee9 100644--- a/site/src/views/PartnersView.astro+++ b/site/src/views/PartnersView.astro@@ -1,19 +1,18 @@----// 合作伙伴页:告诉大家推广 AnyModelBot 能获得持续佣金,并收集申请。佣金比例、价格和结算规则不写,一对一谈。-// 版式和首页同一种语言:首屏大圆角卡 → 三步 → 适合谁 → 为什么好推广 → 申请。章节头用 SectionHead,样式在 pages.css 的“合作伙伴”。-// 申请表的交互在 scripts/partner-form.ts:配了 PARTNER_APPLY_URL 才直接提交,没配时让申请人把内容发到邮箱。-// 机器人不绑定任何一类合作方:只在地平线上探头、主持章节、送通知,以及代表“可以自定义”。+// 合作伙伴页:告诉大家推广 AnyModelBot 能获得持续佣金,并把人带到 Modelflare 控制台申请。佣金比例、价格和结算规则不写,一对一谈。+// 版式和首页同一种语言:首屏(背景和动画同首页 Hero:居中的页头 → 地平线托着三条佣金通知)→ 三步 → 适合谁 → 为什么好推广 → 申请。章节头用 SectionHead,样式在 pages.css 的“合作伙伴”。+// 这里不收表单:优惠券和佣金都挂在 Modelflare 账号上,所以申请要登录后在控制台填(MF.partnerApply)。+// 机器人不绑定任何一类合作方:只在小胶囊里排排站、主持章节、送通知,以及代表“可以自定义”。import Base from "../layouts/Base.astro";import BotFace from "../components/BotFace.astro";+import HeroSky from "../components/HeroSky.astro";import Icon from "../components/Icon.astro";import SectionHead from "../components/SectionHead.astro";import VendorLogo from "../components/VendorLogo.astro";import VendorSprite from "../components/VendorSprite.astro";import { buildVars, dict, fmt, href, type Lang } from "../i18n";-import { GLINT, bannerSky } from "../lib/banner-sky";import { CHAR_KEYS } from "../lib/bots";-import { PARTNER_LIMITS, PARTNER_TYPES, type MailText } from "../lib/partner-form";-import { PARTNERS_EMAIL, PARTNER_APPLY_URL, pricing } from "../lib/site";+import { MF, PARTNERS_EMAIL, pricing } from "../lib/site";import { vendorLogo } from "../lib/vendors";import "../styles/pages.css";interface Props { lang: Lang }@@ -22,193 +21,132 @@ const t = dict(lang);const p = t.partners;const a = p.apply;const vars = buildVars(lang);-const sky = bannerSky();const whoIcons = ["monitor", "chat", "server"] as const;// 模型数最多的几家,有标志的才放const count = (vd: string) => pricing.rows.filter((r) => r.vendor === vd).length;const vendors = pricing.vendors.filter((vd) => vendorLogo(vd)).map((vd, i) => ({ vd, n: count(vd), i })).sort((x, y) => y.n - x.n || x.i - y.i).map((x) => x.vd).slice(0, 9);const [dataItem, keyItem, botsItem] = p.why.items;-const inputs = [- { name: "name", label: a.name, error: a.errors.name, autocomplete: "name" },- { name: "company", label: a.company, autocomplete: "organization" },- { name: "contact", label: a.contact, hint: a.contactHint, error: a.errors.contact, wide: true },- { name: "audience", label: a.audience, hint: a.audienceHint, autocomplete: "off", wide: true },-] as const;-const mailText: MailText = {- subject: a.mail.subject,- labels: { type: a.type, name: a.name, company: a.company, contact: a.contact, audience: a.audience, message: a.message },- types: a.types,-};---<Base lang={lang} path="/partners" title={p.pageTitle} description={p.pageDescription}><VendorSprite vendors={vendors} color />- <div class="container page pt-page">- <header class="pt-hero">- <div class="pt-hero__sky" aria-hidden="true">- <svg viewBox="0 0 1200 360" preserveAspectRatio="xMidYMin slice" focusable="false">- <g class="dot">{sky.dots.map((s) => <circle cx={s.x} cy={s.y} r={s.r} opacity={s.o} />)}</g>- <g class="glint">{sky.glints.map((g) => <path d={GLINT} transform={`translate(${g.x} ${g.y}) scale(${g.s})`} opacity={g.o} />)}</g>- </svg>- </div>-- <div class="pt-hero__copy">- <p class="badge badge--accent">{p.eyebrow}</p>- <h1><span>{p.h1}</span> <mark class="hl">{p.h1Hl}</mark></h1>- <p class="lead">{p.lead}</p>- <div class="pt-hero__cta">- <a class="btn btn--primary" href="#apply" data-track="cta_click" data-track-location="partners-hero">{p.cta}</a>- <a class="btn btn--secondary" href={href(lang, "/")} data-track="cta_click" data-track-location="partners-product">{p.ctaProduct}</a>- </div>- <ul class="pt-hero__points" role="list">- {p.points.map((x) => <li><Icon name="check" />{x}</li>)}- </ul>- </div>-- <figure class="pt-feed">- <ol role="list">- <li class="pt-feed__item" style="--i:0"><BotFace char={CHAR_KEYS[0]} size={40} lively /><span>{p.feed.items[0]}</span></li>- <li class="pt-feed__item" style="--i:1"><BotFace char={CHAR_KEYS[1]} size={40} lively /><span>{p.feed.items[1]}</span></li>- <li class="pt-feed__item pt-feed__item--earn" style="--i:2"><span class="pt-feed__coin"><Icon name="check" /></span><span>{p.feed.items[2]}</span></li>- </ol>- <figcaption>{p.feed.note}</figcaption>- </figure>-- <div class="pt-hero__bots" aria-hidden="true">{CHAR_KEYS.map((k) => <BotFace char={k} size={72} lively pokeable />)}</div>- <div class="pt-hero__horizon" aria-hidden="true"></div>- </header>-- <section class="pt-sec" aria-labelledby="pt-steps-h">- <SectionHead n={1} label={p.kicker.path} id="pt-steps-h" title={p.steps.title} dim={p.steps.dim} host="blue" />- <ol class="pt-path" role="list">- {p.steps.items.map((x, i) => (- <li>- <span class="pt-path__no" aria-hidden="true">{String(i + 1).padStart(2, "0")}</span>- <h3 class="h3">{x.title}</h3>- <p class="pt-body">{x.body}</p>- </li>- ))}- </ol>- <a class="btn btn--primary pt-path__cta" href="#apply" data-track="cta_click" data-track-location="partners-steps">{p.cta}</a>- </section>-- <section class="pt-sec" aria-labelledby="pt-who-h">- <SectionHead n={2} label={p.kicker.who} id="pt-who-h" title={p.who.title} dim={p.who.dim} host="yellow" />- <ul class="pt-who" role="list">- {p.who.items.map((x, i) => (- <li class="card pt-who__card">- <span class="dl-ico"><Icon name={whoIcons[i]} size={22} /></span>- <h3 class="h3">{x.title}</h3>- <p class="pt-body">{x.body}</p>- <p class="pt-who__gain"><Icon name="arrow" />{x.gain}</p>- </li>- ))}- </ul>- </section>-- <section class="pt-sec" aria-labelledby="pt-why-h">- <SectionHead n={3} label={p.kicker.why} id="pt-why-h" title={p.why.title} dim={p.why.dim} />- <div class="pt-bento">- <article class="card pt-bento__card pt-bento__card--models">- <div>- <h3 class="h3">{keyItem.title}</h3>- <p class="pt-body">{fmt(keyItem.body, vars)}</p>+ <div class="page pt-page">+ <div class="scene-top hero-scene">+ <div class="hero__beam"></div>+ <HeroSky />+ <div class="container">+ <header class="pt-hero">+ <p class="pt-eyebrow"><span class="pt-crew">{CHAR_KEYS.map((k) => <BotFace char={k} size={22} />)}</span><span>{p.eyebrow}</span></p>+ <h1><span>{p.h1}</span> <em>{p.h1Hl}</em></h1>+ <p class="lead">{p.lead}</p>+ <div class="pt-hero__cta">+ <a class="btn btn--primary" href={MF.partnerApply} target="_blank" rel="noopener" data-track="cta_click" data-track-location="partners-hero">{p.cta}</a>+ <a class="btn btn--secondary" href={href(lang, "/")} data-track="cta_click" data-track-location="partners-product">{p.ctaProduct}</a></div>- <ul class="pt-tiles" role="list" aria-hidden="true">- {vendors.map((vd) => <li class="pt-tile"><VendorLogo vendor={vd} size={26} /></li>)}+ <ul class="pt-hero__points" role="list">+ {p.points.map((x) => <li><Icon name="check" />{x}</li>)}</ul>- </article>- <article class="card pt-bento__card pt-bento__card--data">- <div>- <h3 class="h3">{dataItem.title}</h3>- <p class="pt-body">{dataItem.body} <a href={href(lang, "/security")}>{p.why.dataLink}</a></p>- </div>- <ul class="pt-stays" role="list">- {p.why.stays.map((x) => <li><Icon name="lock" />{x}</li>)}- </ul>- </article>- <article class="card pt-bento__card pt-bento__card--bots">- <div>- <h3 class="h3">{botsItem.title}</h3>- <p class="pt-body">{botsItem.body}</p>- </div>- <div class="pt-bots" aria-hidden="true">{CHAR_KEYS.map((k) => <BotFace char={k} size={64} lively pokeable />)}</div>- </article>- </div>- </section>-- <section class="pt-sec" id="apply" aria-labelledby="pt-apply-h" data-partner-apply>- <SectionHead n={4} label={p.kicker.apply} id="pt-apply-h" title={a.title} dim={a.dim} host="purple" />- <div class="pt-apply">- <div class="pt-apply__intro">- <p class="lead">{a.lead}</p>- <ul class="pt-apply__points" role="list">- {a.points.map((x) => <li><Icon name="check" />{x}</li>)}- </ul>- <div class="pt-apply__mail">- <p>{a.mailLabel}</p>- <p class="pt-mail">- <a href={`mailto:${PARTNERS_EMAIL}?subject=${encodeURIComponent(a.mail.subject)}`} data-track="cta_click" data-track-location="partners-email">{PARTNERS_EMAIL}</a>- <button type="button" class="copy-btn" data-copy-text={PARTNERS_EMAIL} aria-label={t.ui.copy} title={t.ui.copy}><Icon name="copy" /></button>- </p>- </div>+ </header>+ <div class="scene-stage">+ <div class="hero__glow"></div>+ <div class="hero__horizon"></div>+ <figure class="pt-feed">+ <ol role="list">+ <li class="pt-feed__item" style="--i:0"><BotFace char={CHAR_KEYS[0]} size={40} lively /><span>{p.feed.items[0]}</span></li>+ <li class="pt-feed__item" style="--i:1"><BotFace char={CHAR_KEYS[1]} size={40} lively /><span>{p.feed.items[1]}</span></li>+ <li class="pt-feed__item pt-feed__item--earn" style="--i:2"><span class="pt-feed__coin"><Icon name="check" /></span><span>{p.feed.items[2]}</span></li>+ </ol>+ <figcaption>{p.feed.note}</figcaption>+ </figure></div>+ </div>+ </div>- <div>- <form class="card pt-form" data-partner-form data-endpoint={PARTNER_APPLY_URL || undefined} data-email={PARTNERS_EMAIL} data-lang={lang} data-mail={JSON.stringify(mailText)} novalidate>- <fieldset class="pt-field pt-field--wide" data-field="type">- <legend class="pt-label">{a.type}</legend>- <div class="pt-chips">- {PARTNER_TYPES.map((k) => <label class="pt-chip"><input type="radio" name="type" value={k} aria-describedby="pt-err-type" /><span>{a.types[k]}</span></label>)}- </div>- <p class="pt-err" id="pt-err-type" hidden>{a.errors.type}</p>- </fieldset>+ <div class="container">+ <section class="pt-sec" aria-labelledby="pt-steps-h">+ <SectionHead n={1} label={p.kicker.path} id="pt-steps-h" title={p.steps.title} dim={p.steps.dim} host="blue" />+ <ol class="pt-path" role="list">+ {p.steps.items.map((x, i) => (+ <li>+ <span class="pt-path__no" aria-hidden="true">{String(i + 1).padStart(2, "0")}</span>+ <h3 class="h3">{x.title}</h3>+ <p class="pt-body">{x.body}</p>+ </li>+ ))}+ </ol>+ <a class="btn btn--primary pt-path__cta" href={MF.partnerApply} target="_blank" rel="noopener" data-track="cta_click" data-track-location="partners-steps">{p.cta}</a>+ </section>- {inputs.map((f) => {- const error = "error" in f ? f.error : undefined;- return (- <div class:list={["pt-field", { "pt-field--wide": "wide" in f }]} data-field={f.name}>- <label class="pt-label" for={`pt-${f.name}`}>{f.label}{!error && <span class="pt-opt">{a.optional}</span>}</label>- <input class="pt-input" id={`pt-${f.name}`} name={f.name} type="text" maxlength={PARTNER_LIMITS[f.name]} autocomplete={"autocomplete" in f ? f.autocomplete : undefined} placeholder={"hint" in f ? f.hint : undefined} aria-required={error ? "true" : undefined} aria-describedby={error ? `pt-err-${f.name}` : undefined} />- {error && <p class="pt-err" id={`pt-err-${f.name}`} hidden>{error}</p>}- </div>- );- })}+ <section class="pt-sec" aria-labelledby="pt-who-h">+ <SectionHead n={2} label={p.kicker.who} id="pt-who-h" title={p.who.title} dim={p.who.dim} host="yellow" />+ <ul class="pt-who" role="list">+ {p.who.items.map((x, i) => (+ <li class="card pt-who__card">+ <span class="dl-ico"><Icon name={whoIcons[i]} size={22} /></span>+ <h3 class="h3">{x.title}</h3>+ <p class="pt-body">{x.body}</p>+ <p class="pt-who__gain"><Icon name="arrow" />{x.gain}</p>+ </li>+ ))}+ </ul>+ </section>- <div class="pt-field pt-field--wide">- <label class="pt-label" for="pt-message">{a.message}<span class="pt-opt">{a.optional}</span></label>- <textarea class="pt-input pt-input--area" id="pt-message" name="message" rows="4" maxlength={PARTNER_LIMITS.message} placeholder={a.messageHint}></textarea>+ <section class="pt-sec" aria-labelledby="pt-why-h">+ <SectionHead n={3} label={p.kicker.why} id="pt-why-h" title={p.why.title} dim={p.why.dim} />+ <div class="pt-bento">+ <article class="card pt-bento__card pt-bento__card--models">+ <div>+ <h3 class="h3">{keyItem.title}</h3>+ <p class="pt-body">{fmt(keyItem.body, vars)}</p></div>-- {/* 蜜罐:正常人看不到,机器人会填 */}- <div class="pt-hp" aria-hidden="true"><label>Website <input type="text" name="website" tabindex="-1" autocomplete="off" /></label></div>-- <p class="pt-failed" data-partner-failed role="alert" hidden>{fmt(a.failed, { email: PARTNERS_EMAIL })}</p>- <div class="pt-form__foot">- <button class="btn btn--primary" type="submit" data-label={a.submit} data-sending={a.sending}>{a.submit}</button>- <p>{a.consent} <a href={href(lang, "/privacy")}>{a.privacy}</a></p>+ <ul class="pt-tiles" role="list" aria-hidden="true">+ {vendors.map((vd) => <li class="pt-tile"><VendorLogo vendor={vd} size={26} /></li>)}+ </ul>+ </article>+ <article class="card pt-bento__card pt-bento__card--data">+ <div>+ <h3 class="h3">{dataItem.title}</h3>+ <p class="pt-body">{dataItem.body} <a href={href(lang, "/security")}>{p.why.dataLink}</a></p>+ </div>+ <ul class="pt-stays" role="list">+ {p.why.stays.map((x) => <li><Icon name="lock" />{x}</li>)}+ </ul>+ </article>+ <article class="card pt-bento__card pt-bento__card--bots">+ <div>+ <h3 class="h3">{botsItem.title}</h3>+ <p class="pt-body">{botsItem.body}</p></div>- </form>+ <div class="pt-bots" aria-hidden="true">{CHAR_KEYS.map((k) => <BotFace char={k} size={64} lively pokeable />)}</div>+ </article>+ </div>+ </section>- <div class="card pt-panel" data-partner-done hidden>- <span class="dl-ico"><Icon name="check" size={22} /></span>- <h3 class="h3" tabindex="-1" data-partner-focus>{a.done.title}</h3>- <p class="pt-body">{a.done.body}</p>+ <section class="pt-sec" id="apply" aria-labelledby="pt-apply-h">+ <SectionHead n={4} label={p.kicker.apply} id="pt-apply-h" title={a.title} dim={a.dim} host="purple" />+ <div class="pt-apply">+ <div class="pt-apply__intro">+ <p class="lead">{a.lead}</p>+ <ul class="pt-apply__points" role="list">+ {a.points.map((x) => <li><Icon name="check" />{x}</li>)}+ </ul>+ <div class="pt-apply__mail">+ <p>{a.mailLabel}</p>+ <p class="pt-mail">+ <a href={`mailto:${PARTNERS_EMAIL}?subject=${encodeURIComponent(a.mail.subject)}`} data-track="cta_click" data-track-location="partners-email">{PARTNERS_EMAIL}</a>+ <button type="button" class="copy-btn" data-copy-text={PARTNERS_EMAIL} aria-label={t.ui.copy} title={t.ui.copy}><Icon name="copy" /></button>+ </p>+ </div></div>- <div class="card pt-panel" data-partner-mail hidden>- <h3 class="h3" tabindex="-1" data-partner-focus>{a.mail.title}</h3>- <p class="pt-body">{fmt(a.mail.body, { email: PARTNERS_EMAIL })}</p>- <div class="code"><code></code><button type="button" class="copy-btn" data-copy-code aria-label={t.ui.copy} title={t.ui.copy}><Icon name="copy" /></button></div>+ <div class="card pt-panel">+ <h3 class="h3">{a.panel.title}</h3>+ <p class="pt-body">{a.panel.body}</p><div class="pt-panel__actions">- <a class="btn btn--primary" href="#apply" data-partner-open>{a.mail.open}</a>- <button class="btn btn--secondary" type="button" data-partner-back>{a.mail.back}</button>+ <a class="btn btn--primary" href={MF.partnerApply} target="_blank" rel="noopener" data-track="cta_click" data-track-location="partners-apply">{a.panel.action}</a></div></div></div>- </div>- </section>+ </section>+ </div></div>- <script>- import "../scripts/partner-form";- </script></Base>diff --git a/site/tests/partner-form.test.ts b/site/tests/partner-form.test.tsdeleted file mode 100644index ff127ee..0000000--- a/site/tests/partner-form.test.ts+++ /dev/null@@ -1,41 +0,0 @@-import { describe, expect, it } from "vitest";-import { PARTNER_LIMITS, applicationPayload, mailBody, mailtoHref, missingFields, readApplication, type MailText } from "../src/lib/partner-form";--const text: MailText = {- subject: "合作申请",- labels: { type: "类型", name: "称呼", company: "机构", contact: "联系方式", audience: "受众", message: "想法" },- types: { training: "培训", creator: "内容", sales: "销售", other: "其他" },-};--describe("partner application", () => {- it("trims fields, caps their length and drops an unknown type", () => {- const app = readApplication({ type: "hacker", name: " 小王 ", contact: "x".repeat(500) });- expect(app.type).toBe("");- expect(app.name).toBe("小王");- expect(app.company).toBe("");- expect(app.contact).toHaveLength(PARTNER_LIMITS.contact);- });-- it("requires type, name and contact, in form order", () => {- expect(missingFields(readApplication({}))).toEqual(["type", "name", "contact"]);- expect(missingFields(readApplication({ type: "sales", name: " ", contact: "[email protected]" }))).toEqual(["name"]);- expect(missingFields(readApplication({ type: "other", name: "A", contact: "[email protected]" }))).toEqual([]);- });-- it("builds the payload without the honeypot", () => {- const payload = applicationPayload(readApplication({ type: "training", name: "A", contact: "[email protected]", website: "spam" }), "en");- expect(payload).toEqual({ type: "training", name: "A", company: "", contact: "[email protected]", audience: "", message: "", lang: "en", source: "site-partners" });- });-- it("writes only the filled fields into the email, with readable labels", () => {- const body = mailBody(readApplication({ type: "training", name: "小王", contact: "wx123" }), text);- expect(body).toBe("类型: 培训\n称呼: 小王\n联系方式: wx123");- });-- it("keeps the body in the mailto link unless it gets too long", () => {- const short = mailtoHref("[email protected]", "主题", "正文");- expect(short).toBe(`mailto:[email protected]?subject=${encodeURIComponent("主题")}&body=${encodeURIComponent("正文")}`);- const long = mailtoHref("[email protected]", "主题", "正".repeat(1000));- expect(long).toBe(`mailto:[email protected]?subject=${encodeURIComponent("主题")}`);- });-});diff --git a/src/app.ts b/src/app.tsindex 8d2adc8..9361a62 100644--- a/src/app.ts+++ b/src/app.ts@@ -1073,6 +1073,8 @@ export class App {enabled: a.enabled,status: status[a.channel],requests: this.store.listAccess({ botId: a.key, channel: a.channel, status: "pending" }).length,+ // 还没有主人:连上之后第一个发单聊消息的人成为主人,界面据此提示"等第一条消息"+ hasOwner: !!this.access.owner(a.key, a.channel),};});}@@ -1176,12 +1178,12 @@ export class App {channelStatus(key: string): { feishu: ChannelStatus; weixin: ChannelStatus & { login?: unknown; quota?: unknown } } & Record<MessengerId, ChannelStatus> {const ch = this.channels.get(key);const fsAccount = this.store.getChannelAccount(key, "feishu");- const feishu: ChannelStatus & { account?: { appId: string; saved: { appSecret: string } } } = !fsAccount?.credentials.appId+ const feishu: ChannelStatus & { account?: { appId: string; brand: string; saved: { appSecret: string } } } = !fsAccount?.credentials.appId? { state: "disabled", detail: t("channel.feishu_no_credentials"), since: 0 }: ch?.feishuError? { state: "error", detail: ch.feishuError, since: Date.now() }: ch?.feishu?.status ?? { state: "disabled", since: 0 };- if (fsAccount?.credentials.appId) feishu.account = { appId: fsAccount.credentials.appId, saved: { appSecret: mask(fsAccount.credentials.appSecret) } };+ if (fsAccount?.credentials.appId) feishu.account = { appId: fsAccount.credentials.appId, brand: fsAccount.credentials.brand === "lark" ? "lark" : "feishu", saved: { appSecret: mask(fsAccount.credentials.appSecret) } };const acct = this.store.getWeixinAccount(key);const wx = ch?.weixin?.status ?? (acct ? { state: "disabled" as const, since: 0 } : { state: "login_required" as const, detail: t("channel.wx_login_required"), since: 0 });const quota = ch?.weixindiff --git a/test/channel-accounts.e2e.test.ts b/test/channel-accounts.e2e.test.tsindex 91d7bd6..b255c5d 100644--- a/test/channel-accounts.e2e.test.ts+++ b/test/channel-accounts.e2e.test.ts@@ -71,10 +71,12 @@ describe("一个账号,所有机器人共用", () => {expect(await account(key)).toBeUndefined();expect((await api(`/channel-accounts/${key}/telegram`, { method: "PUT", body: { token: "1:SECRET-TOKEN-VALUE" } })).status).toBe(200);const a = await account(key);- expect(a).toMatchObject({ channel: "telegram", number: 1, defaultBot: "default", enabled: true });+ expect(a).toMatchObject({ channel: "telegram", number: 1, defaultBot: "default", enabled: true, hasOwner: false });expect(JSON.stringify((await api("/channel-accounts")).json)).not.toContain("SECRET-TOKEN-VALUE");await say(key, "boss", "你好");expect(shown(key, "boss")).toBe("[mock-a] 你说:你好");+ // 第一个发消息的人成为主人:连接页不再提示"等第一条消息"+ expect((await account(key)).hasOwner).toBe(true);});it("/bot 列出所有机器人,标出现在是哪个,不碰模型", async () => {@@ -239,7 +241,7 @@ describe("升级:老数据变成全局账号", () => {expect(app.channels.get(bot.id)!.weixin).toBeUndefined();// 已经有账号叫 WORK:Telegram 的默认名字让开expect(app.store.getChannelAccount(bot.id, "telegram")!.label).toBe("WORK 2");- expect((await api(`/channel-accounts/${bot.id}/channels`)).json.feishu.account).toEqual({ appId: "cli_old", saved: { appSecret: "****cret" } });+ expect((await api(`/channel-accounts/${bot.id}/channels`)).json.feishu.account).toEqual({ appId: "cli_old", brand: "feishu", saved: { appSecret: "****cret" } });await api(`/channel-accounts/${bot.id}/feishu`, { method: "DELETE" });await app.restartBot(bot.id);expect(app.store.getChannelAccount(bot.id, "feishu")).toBeUndefined();diff --git a/test/e2e.test.ts b/test/e2e.test.tsindex 7f4d157..0e9b8be 100644--- a/test/e2e.test.ts+++ b/test/e2e.test.ts@@ -234,7 +234,7 @@ describe("Web 界面 / API", () => {expect(f.status).toBe(200);const g = await api(`/channel-accounts/${id}/channels`);expect(JSON.stringify(g.json)).not.toContain("very-secret-value");- expect(g.json.feishu.account).toEqual({ appId: "cli_x", saved: { appSecret: "****alue" } });+ expect(g.json.feishu.account).toEqual({ appId: "cli_x", brand: "feishu", saved: { appSecret: "****alue" } });expect(JSON.stringify((await api("/channel-accounts")).json)).not.toContain("very-secret-value");const chat = await api(`/bots/${id}/chat`, { method: "POST", body: { text: "hi" } });expect(chat.json.reply).toBe("[mock-b] 你说:hi");diff --git a/ui/components/guide.js b/ui/components/guide.jsindex 52b2d7f..c4e3bbc 100644--- a/ui/components/guide.js+++ b/ui/components/guide.js@@ -52,19 +52,19 @@ export function GuideChecklist({ bot, onSend }) {const done = g.done.includes(s.id);const style = { "--anim-delay": `calc(var(--stagger) * ${i} / 3)` };if (done) {- return html`<li key=${s.id} class="guide-step done anim-rise-in" style=${style}>+ return html`<li key=${s.id} class="guide-step done anim-fade-in" style=${style}><span class="n"><${Icon} name="check" size="xs" strong /></span><span class="title">${txt(s, "title")}</span></li>`;}if (s.id !== shown) {- return html`<li key=${s.id} class="anim-rise-in" style=${style}>+ return html`<li key=${s.id} class="anim-fade-in" style=${style}><button type="button" class="guide-step" onClick=${() => setOpen(s.id)}><span class="n num">${i + 1}</span><span class="title">${txt(s, "title")}</span><${Icon} name="chevRight" size="sm" /></button></li>`;}const sample = txt(s, "try");- return html`<li key=${s.id} class="guide-step open anim-rise-in" style=${style}>+ return html`<li key=${s.id} class="guide-step open anim-fade-in" style=${style}><span class="n num">${i + 1}</span><div class="body"><div class="title">${txt(s, "title")}</div>@@ -106,7 +106,7 @@ export function GuidePill({ onGo }) {const finished = n === steps.length;if (finished && !(last && last.all)) return null;const cur = currentStep(g);- return html`<button type="button" ref=${ref} class=${`guide-pill${last && !finished ? " bumped" : ""}`} key=${last ? last.at : 0}+ return html`<button type="button" ref=${ref} class="guide-pill"aria-haspopup="menu" aria-expanded=${open} title=${t("guide.title")} onClick=${() => setOpen((v) => !v)}><${Progress} steps=${steps} done=${g.done} /><span class="v">${finished ? t("guide.allDone") : t("guide.title")}</span>@@ -126,8 +126,8 @@ export function GuidePill({ onGo }) {]} />`}`;}-/** 全部完成:撒一把彩带(颜色是六个机器人的眼睛色和品牌黄绿) */-const CONFETTI = ["--accent-solid", "--bot-blue-eye", "--bot-yellow-glow", "--bot-green-glow", "--bot-red-eye", "--bot-purple-eye", "--bot-orange-eye"];+/** 全部完成:撒一把彩带(颜色是六个机器人的眼睛色和光色) */+const CONFETTI = ["--bot-blue-eye", "--bot-yellow-glow", "--bot-green-glow", "--bot-red-eye", "--bot-purple-eye", "--bot-orange-eye"];function confetti() {if (reducedMotion()) return;const layer = document.createElement("div");@@ -309,7 +309,7 @@ export function MediaDemo({ onLoad }) {}, [big]);return html`<div class="guide-demo"><${ActivityLine} label=${done ? t("guide.demo.label") : t("guide.demo.generating")} phase=${done ? "done" : "gen"} live=${!done} />- ${done && html`<div class="msg-files anim-rise-in">+ ${done && html`<div class="msg-files anim-fade-in"><button type="button" class=${`msg-img${big ? " big" : ""}`} aria-expanded=${big} title=${big ? t("guide.demo.zoomOut") : t("guide.demo.zoomIn")} onClick=${() => setBig((v) => !v)}><img src="/amb/static/assets/guide-demo.svg" alt=${t("guide.demo.alt")} onLoad=${onLoad} /></button>diff --git a/ui/components/ui.js b/ui/components/ui.jsindex 00e3740..8f3f6bd 100644--- a/ui/components/ui.js+++ b/ui/components/ui.js@@ -1,6 +1,6 @@// 共用组件:图标、按钮、分段控件、弹出菜单、确认框、提示胶囊、复制按钮、骨架。// 样式在 ui/design/components/*.css;这里的组件只是给常用组合一个带逻辑的写法,直接写 class 也可以。-import { h } from "preact";+import { h, render } from "preact";import { useEffect, useLayoutEffect, useRef, useState, useCallback } from "preact/hooks";import htm from "htm";import { useStore, toasts, dismissToast, dialog } from "../lib/store.js";@@ -372,16 +372,42 @@ export function usePopPosition(anchor, open, { width = 280, prefer = "down", aliconst up = prefer === "up" ? above > 160 || above > below : below < Math.min(maxHeight, 220) && above > below;let left = align === "right" ? r.right - width : r.left;left = Math.max(edge, Math.min(left, vw - width - edge));- const ox = Math.max(12, Math.min(width - 12, r.left + (r.width || 0) / 2 - left));- setPos(up ? { left, bottom: vh - r.top + gap, up: true, ox, max: Math.min(maxHeight, above) } : { left, top: r.bottom + gap, up: false, ox, max: Math.min(maxHeight, below) });+ const next = up ? { left, bottom: vh - r.top + gap, max: Math.min(maxHeight, above) } : { left, top: r.bottom + gap, max: Math.min(maxHeight, below) };+ setPos((p) => (p && p.left === next.left && p.top === next.top && p.bottom === next.bottom && p.max === next.max ? p : next));};compute();+ // 任何一层滚动(capture 才收得到)或窗口变化,都跟着锚点走window.addEventListener("resize", compute);- return () => window.removeEventListener("resize", compute);+ window.addEventListener("scroll", compute, true);+ return () => {+ window.removeEventListener("resize", compute);+ window.removeEventListener("scroll", compute, true);+ };}, [open, anchor]);return pos;}+/**+ * 渲染到 <body> 下面的一层。祖先带 backdrop-filter / transform(对话框、抽屉、正在入场的页面)时,+ * position: fixed 是相对它们算的,还会被它们裁切,所以浮层都放到最外面。+ */+function Portal({ children }) {+ const host = useRef(null);+ if (!host.current) host.current = document.createElement("div");+ useLayoutEffect(() => {+ const el = host.current;+ document.body.appendChild(el);+ return () => {+ render(null, el);+ el.remove();+ };+ }, []);+ useLayoutEffect(() => {+ render(children, host.current);+ });+ return null;+}+export function Popover({ anchor, onClose, class: cls = "", width = 280, prefer, align, maxHeight, children, label, keepFocus }) {const ref = useRef(null);const anchorRef = useRef(anchor && anchor.nodeType ? anchor : null);@@ -398,8 +424,10 @@ export function Popover({ anchor, onClose, class: cls = "", width = 280, prefer,return () => prev?.focus?.({ preventScroll: true });}, []);if (!pos) return null;- const style = { left: pos.left + "px", width: width + "px", "--ox": pos.ox + "px", maxHeight: pos.max + "px", ...(pos.up ? { bottom: pos.bottom + "px" } : { top: pos.top + "px" }) };- return html`<div class=${`pop ${cls}${pos.up ? " up" : ""}`} ref=${ref} style=${style} role="dialog" aria-label=${label}>${children}</div>`;+ const style = { left: pos.left + "px", width: width + "px", maxHeight: pos.max + "px", ...(pos.bottom !== undefined ? { bottom: pos.bottom + "px" } : { top: pos.top + "px" }) };+ // 局部主题(样例页的双主题对照)跟着锚点+ const theme = anchor?.closest?.("[data-theme]:not(html)")?.dataset.theme;+ return html`<${Portal}><div class=${`pop ${cls}`} ref=${ref} style=${style} role="dialog" aria-label=${label} data-theme=${theme}>${children}</div><//>`;}/**@@ -448,7 +476,7 @@ export function Menu({ anchor, items, onClose, width = 240, prefer, align, label}/** 行右侧的菜单按钮(magpie .proto.pick) */-export function MenuButton({ value, options, onChange, disabled, label, width = 260 }) {+export function MenuButton({ value, options, onChange, disabled, label, width = 260, align = "right" }) {const [open, setOpen] = useState(false);const ref = useRef(null);const cur = options.find((o) => o[0] === value);@@ -456,7 +484,7 @@ export function MenuButton({ value, options, onChange, disabled, label, width =onClick=${() => setOpen((v) => !v)}><span class="v">${cur ? cur[1] : value || "—"}</span><${Icon} name="chevDown" /></button>- ${open && html`<${Menu} anchor=${ref.current} width=${width} align="right" label=${label} onClose=${() => setOpen(false)}+ ${open && html`<${Menu} anchor=${ref.current} width=${width} align=${align} label=${label} onClose=${() => setOpen(false)}items=${options.map(([v, text, note]) => ({ label: text, note, cur: v === value, onSelect: () => v !== value && onChange(v) }))} />`}`;}@@ -498,14 +526,17 @@ export const Badge = ({ s }) => {};/** 自绘确认框:焦点先在"取消"(安全选项),Esc 关闭,Tab 在框内循环 */-export function Sheet({ title, onClose, children, wide, label, leaving }) {+/** sticky:点遮罩不关(扫码、填表进行到一半时,误点不该把流程丢掉);Esc 和关闭钮照常 */+export function Sheet({ title, onClose, children, wide, label, leaving, closable = true, sticky = false }) {const ref = useRef(null);useEffect(() => {const prev = document.activeElement;- requestAnimationFrame(() => (ref.current?.querySelector("[data-autofocus]") || ref.current?.querySelector("button, input, textarea"))?.focus());+ requestAnimationFrame(() => (ref.current?.querySelector("[data-autofocus]") || ref.current?.querySelector("input, textarea") || ref.current?.querySelector("button"))?.focus());const key = (e) => {if (e.isComposing || e.keyCode === 229) return;if (e.key === "Escape") {+ // 对话框里开着下拉时,Esc 先关下拉(useDismiss)+ if (document.querySelector(".pop")) return;e.stopPropagation();onClose();}@@ -528,9 +559,9 @@ export function Sheet({ title, onClose, children, wide, label, leaving }) {prev?.focus?.({ preventScroll: true });};}, []);- return html`<div class=${cx("scrim", leaving && "leaving")} onPointerDown=${(e) => e.target === e.currentTarget && onClose()}>+ return html`<div class=${cx("scrim", leaving && "leaving")} onPointerDown=${(e) => !sticky && e.target === e.currentTarget && onClose()}><div class=${`sheet${wide ? " wide" : ""}`} ref=${ref} role="dialog" aria-modal="true" aria-label=${label || title}>- ${title && html`<h2>${title}</h2>`}+ ${title && html`<div class="sheet-head"><h2>${title}</h2>${closable && html`<${IconButton} icon="close" iconSize="md" class="sheet-close" label=${t("common.close")} onClick=${onClose} />`}</div>`}${children}</div></div>`;@@ -548,8 +579,9 @@ export function DialogHost() {dialog.set(null);d.resolve(v);};- return html`<${Sheet} title=${d.title} leaving=${leaving} onClose=${() => done(false)}>+ return html`<${Sheet} title=${d.title} leaving=${leaving} closable=${false} onClose=${() => done(false)}>${d.body && html`<p class="body">${d.body}</p>`}+ ${d.check && html`<label class="sheet-check"><input type="checkbox" checked=${d.check.value} onChange=${(e) => (d.check.value = e.target.checked)} /><span>${d.check.label}</span></label>`}<div class="actions"><${Button} data-autofocus onClick=${() => done(false)}>${d.cancelLabel || t("common.cancel")}<//><${Button} variant=${d.danger ? "danger" : "primary"} onClick=${() => done(true)}>${d.confirmLabel || t("common.confirm")}<//>diff --git a/ui/css/botapp.css b/ui/css/botapp.cssindex 47d2d58..eec2de2 100644--- a/ui/css/botapp.css+++ b/ui/css/botapp.css@@ -1,17 +1,20 @@/* 目录 Bot:发现页、专属界面容器(screens/discover.js、screens/bot-app.js)。 */-.discover { height: 100%; overflow: auto; padding: var(--space-6); display: grid; gap: var(--space-4); align-content: start; }-.discover-head { display: grid; gap: var(--space-1); }+.discover { --discover-w: 960px; --page-px: max(var(--page-gutter), calc((100% - var(--discover-w)) / 2)); height: 100%; overflow: auto; padding: var(--page-top) var(--page-px) var(--page-bottom); display: grid; gap: var(--space-4); align-content: start; }+.discover-head { display: grid; gap: var(--space-1); -webkit-app-region: drag; }+.discover-head > * { -webkit-app-region: no-drag; }.discover-head h1, .discover-head p { margin: 0; }-.discover-search { margin-top: var(--space-3); }+.discover-head p { font-size: var(--fs-md); color: var(--muted); }+.discover-part { margin: var(--space-4) 0 0; font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--fg-2); }+.discover-search { margin: var(--space-3) 0 0; }.discover-grid { --discover-col: 260px; display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fill, minmax(min(var(--discover-col), 100%), 1fr)); }.discover-card { all: unset; cursor: pointer; display: grid; gap: var(--space-3); min-width: 0; }.discover-card:focus-visible .discover-thumb { outline: 2px solid var(--accent); }-.discover-thumb { display: grid; place-items: center; aspect-ratio: 16 / 10; overflow: hidden; background: var(--well); border-radius: var(--r-lg); transition: transform var(--dur-base) var(--ease-out); }+.discover-thumb { display: grid; place-items: center; aspect-ratio: 16 / 10; overflow: hidden; background: var(--well); border-radius: var(--r-lg); transition: opacity var(--t-fast); }.discover-thumb img { width: 100%; height: 100%; object-fit: cover; }-.discover-card:hover .discover-thumb { transform: translateY(-1px); /* 微调:悬停抬起 */ }+.discover-card:hover .discover-thumb { opacity: .88; }.discover-meta { display: flex; gap: var(--space-2); align-items: center; min-width: 0; }.discover-text { display: grid; min-width: 0; }-.discover-text .title { font-weight: var(--fw-medium); }+.discover-text .title { font-size: var(--fs-lg); font-weight: var(--fw-medium); }.botapp { --botapp-side-w: var(--panel-w); height: 100%; display: grid; grid-template-columns: minmax(0, 1fr); min-height: 0; }.botapp.with-side { grid-template-columns: minmax(0, 1fr) var(--botapp-side-w); }@@ -33,11 +36,10 @@.side-group { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3) var(--side-row-px) var(--space-1); }.side-group .text { color: var(--fg-2); }-.thread-new-dot { width: var(--space-2); height: var(--space-2); border-radius: var(--r-full); background: var(--accent); flex: none; }+.thread-new-dot { width: var(--space-2); height: var(--space-2); border-radius: var(--r-full); background: var(--signal); flex: none; }.thread-icon { display: grid; place-items: center; width: var(--space-8); }@media (max-width: 720px) {.botapp.with-side { grid-template-columns: minmax(0, 1fr); }.botapp.with-side .botapp-main { display: none; }- .discover { padding: var(--space-4); }}diff --git a/ui/css/chat.css b/ui/css/chat.cssindex 0a80459..4a8a15a 100644--- a/ui/css/chat.css+++ b/ui/css/chat.css@@ -1,7 +1,7 @@/* 对话页。布局与顶栏参考 Grok Bot,对话流与输入框参考 Codex:顶栏 52(头像 + 名称 | 新对话 · 信息面板),760 阅读列;用户消息是浅灰气泡,机器人回复是整列正文;底部是两行输入框(文字区 + 工具栏:更多 | 模型 · 发送)。- 顶栏和输入框都是盖在对话流上的毛玻璃:消息从它们底下滚过,透出来是模糊的。 */+ 顶栏和输入框盖在对话流上:几乎不透,消息从底下滚过去只隐约看得到。 */@layer app {/* 对话列和输入框同宽、同一个居中列(两侧至少 --page-gutter)。输入框浮在主区底部,对话列的下边距和"回到底部"的位置都从它的高度算出来,改输入框的内边距时这里跟着变。 */@@ -17,18 +17,18 @@position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column;}-/* —— 顶栏:对话页里浮在滚动内容上;内容滚到它底下时(.scrolled)才出现细线和投影 —— */+/* —— 顶栏:对话页里盖在滚动内容上;内容滚到它底下时(.scrolled)才出现一条细线,不加投影 —— */.chat-head {flex: none; display: flex; align-items: center; gap: var(--bar-gap); height: var(--head-h); padding: 0 var(--head-px);-webkit-app-region: drag;}.chat > .chat-head {position: absolute; z-index: var(--z-float); top: 0; left: 0; right: 0;- background: var(--grain), var(--glass-chrome); backdrop-filter: var(--glass-filter);- box-shadow: 0 .5px 0 transparent;+ background: var(--glass-chrome); backdrop-filter: var(--glass-filter);+ box-shadow: 0 var(--hairline) 0 transparent;transition: box-shadow var(--t-base);}-.chat.scrolled > .chat-head { box-shadow: 0 .5px 0 var(--glass-edge), var(--shadow-xs); }+.chat.scrolled > .chat-head { box-shadow: 0 var(--hairline) 0 var(--glass-edge); }.chat-head > * { -webkit-app-region: no-drag; }.chat-head .grow { -webkit-app-region: drag; align-self: stretch; }.chat-head .icon-btn { --ib-size: var(--ctl-md); } /* 16 的图标四周各 6:最右的图标外沿落在 --head-px + 6 = 16,和左边的头像对称 */@@ -73,15 +73,8 @@ button.head-bot:active { background: var(--pill-press); }.msg-row.assistant .msg { color: var(--fg); line-height: var(--lh-prose); }.msg-row.pending .msg { opacity: .85; }-/* —— 对话流的动效:一句话"发出 → 思考 → 输出 → 收尾",每一步只动一样东西,幅度小、不循环抢眼 ——- 发出:气泡从输入框的方向浮上来。透明度先到位(base),位移和一点点缩放用弹性曲线慢一拍收尾(slow),- 缩放的原点在右下角,像是从发送钮那边送出去的 */-.msg-row.user.enter {- --pop-dy: 12px; --pop-scale: .96; transform-origin: 100% 100%;- animation: fade-in var(--dur-base) var(--ease-out), pop-in var(--dur-slow) var(--ease-spring);-}-/* 流里新插进来的提问 / 审批卡、文件、出错提示:轻轻浮起 */-.msg-row.assistant.enter { --rise: 6px; animation: rise-in var(--dur-moderate) var(--ease-out); }+/* —— 对话流的动效:一句话"发出 → 思考 → 输出 → 收尾",每一步只动一样东西,只淡入淡出,不位移、不缩放 —— */+.msg-row.user.enter, .msg-row.assistant.enter { animation: fade-in var(--dur-base) var(--ease-out); }/* 思考:工作状态行比你的气泡晚一拍(--stagger)淡入,先看到"发出去了",再看到"在想" */.msg-row.live > .work { animation: fade-in var(--dur-moderate) var(--ease-out) var(--stagger) backwards; }/* 输出:新出现的段落、列表项淡入,已经在的不重播;只在输出中,回复结束后不再有动画 */@@ -246,8 +239,8 @@ button.act-head:active { background: var(--pill-hover); }.msg-files { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-2); }.msg-row .msg + .msg-files { margin-top: var(--space-3); }.msg-row :is(.msg, .msg-files) + .notice { margin-top: var(--space-3); }-/* 回合中交付的:轻轻浮起(已经在的不重播) */-.msg-row.live .msg-files > * { --rise: 6px; animation: rise-in var(--dur-moderate) var(--ease-out); }+/* 回合中交付的:淡入(已经在的不重播) */+.msg-row.live .msg-files > * { animation: fade-in var(--dur-moderate) var(--ease-out); }.file-card {display: flex; align-items: center; gap: var(--space-3); width: min(360px, 100%); padding: var(--space-2-5) var(--space-3-5) var(--space-2-5) var(--space-2-5);background: var(--well); border-radius: var(--r-well); color: var(--fg); text-align: left; transition: background var(--t-fast);@@ -263,61 +256,58 @@ a.file-card:active, .file-card:has(> .file-open:active) { background: var(--well.file-card .fsub { margin-top: var(--space-0-5); font-size: var(--fs-xs); color: var(--muted); }.file-card.off .fname { color: var(--muted); }/* 图片直接显示:缩略图保持比例,限宽限高(读出来之前先占一小块 --well);点开看大图 */-.msg-img { display: block; max-width: 100%; overflow: hidden; border-radius: var(--r-well); background: var(--well); cursor: zoom-in; transition: transform var(--t-fast); }-.msg-img:active { transform: scale(var(--press)); }+.msg-img { display: block; max-width: 100%; overflow: hidden; border-radius: var(--r-well); background: var(--well); cursor: zoom-in; }.msg-img img { display: block; width: auto; height: auto; min-width: 48px; min-height: 48px; max-width: min(320px, 100%); max-height: 240px; }.msg-row .notice { max-width: min(var(--bubble-w), 100%); }.chat-empty { margin: auto; padding-top: 16vh; display: grid; justify-items: center; gap: var(--space-2-5); text-align: center; color: var(--muted); }/* 头像和标题之间多留一点:大头像会呼吸、会动,贴太近显得挤 */.chat-empty h2 { margin-top: var(--space-2); font-size: var(--fs-2xl); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); line-height: var(--lh-tight); color: var(--fg); }-.chat-empty > p { max-width: 440px; margin: 0; font-size: var(--fs-md); line-height: var(--lh-normal); }+.chat-empty > p { max-width: 440px; margin: 0; font-size: var(--fs-lg); line-height: var(--lh-normal); }.chips { display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: center; margin-top: var(--space-2-5); }/* 建议:和次级按钮一样是一层静默填充,不描边、不浮起 */.chip {height: var(--ctl-md); padding: 0 var(--space-3-5); border-radius: var(--r-full); background: var(--pill);- font-size: var(--fs-sm); color: var(--fg-2); transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);+ font-size: var(--fs-sm); color: var(--fg-2); transition: background var(--t-fast), color var(--t-fast);}.chip:hover { background: var(--pill-hover); color: var(--fg); }-.chip:active { background: var(--pill-press); transform: scale(var(--press)); }+.chip:active { background: var(--pill-press); }/* —— 回到底部:玻璃小圆钮 —— */.to-bottom {position: absolute; z-index: var(--z-float); left: 50%; bottom: calc(var(--dock-pb) + var(--composer-h) + var(--space-6)); translate: -50% 0;width: var(--ctl-lg); height: var(--ctl-lg); border-radius: 50%; display: grid; place-items: center;- background: var(--grain), var(--glass-float); backdrop-filter: var(--glass-filter-sm); color: var(--fg-2); box-shadow: var(--shadow-float);- --rise: 6px; animation: rise-in var(--dur-base) var(--ease-out);- transition: color var(--t-fast), scale var(--t-fast);+ background: var(--glass-float); backdrop-filter: var(--glass-filter-sm); color: var(--fg-2); box-shadow: var(--shadow-float);+ animation: fade-in var(--dur-base) var(--ease-out);+ transition: color var(--t-fast);}-.to-bottom.leaving { animation: sink-out var(--dur-base) var(--ease-in) forwards; pointer-events: none; }+.to-bottom.leaving { animation: fade-out var(--dur-base) var(--ease-in) forwards; pointer-events: none; }.to-bottom:hover { color: var(--fg); }-.to-bottom:active { scale: var(--press-strong); }-.to-bottom .new { position: absolute; top: 0; right: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-solid); box-shadow: 0 0 0 2px var(--surface-solid), 0 0 0 2.5px var(--accent-line); } /* 描边:圆点外的缺口和墨色细边,黄绿点才压得住白底 */-.to-bottom .new { --scale-from: 0; animation: scale-in var(--dur-slow) var(--ease-back); }+.to-bottom .new { position: absolute; top: 0; right: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 2px var(--surface-solid); } /* 描边:压在圆钮上的缺口(和底同色),不是边框 */+.to-bottom .new { animation: fade-in var(--dur-base) var(--ease-out); }-/* —— 输入框:文字区 + 工具栏两行,一块浮在对话流上的玻璃(和菜单、提示同一种材质:细边 + 投影,不额外描边)。- 认得出它靠的是:浮起的投影、常显的占位文字(3:1)、工具栏和发送钮,以及固定在底部的位置。- 状态:输入时浮得更高(投影更大);拖入文件时 accent 描边 + 光晕 + 一层黄绿 —— */-/* 底座是透明的、不接收指针;上边留得够高,输入框聚焦时的投影不会被 overflow 裁掉 */+/* —— 输入框:文字区 + 工具栏两行,盖在对话流上的一块面(参考 Codex、Grok):一道细边 + 很淡的投影。+ 聚焦时只是边深一级,投影不变大;拖入文件时 accent 描边 + 一层淡灰 —— */+/* 底座是透明的、不接收指针 */.composer-dock {position: absolute; z-index: var(--z-float); left: 0; right: 0; bottom: 0; padding: var(--space-12) 0 var(--dock-pb); pointer-events: none;overflow: hidden; scrollbar-gutter: stable;}.composer {- --composer-edge: var(--glass-edge);- --composer-edge-w: .5px;- --composer-shadow: var(--shadow-md);+ --composer-edge: var(--line);+ --composer-edge-w: 1px;+ --composer-shadow: var(--drop-float);--composer-tint: transparent;pointer-events: auto; position: relative;width: var(--col, auto); margin: 0 auto;display: flex; flex-direction: column;- background: var(--grain), linear-gradient(var(--composer-tint), var(--composer-tint)), var(--glass-float);+ background: linear-gradient(var(--composer-tint), var(--composer-tint)), var(--glass-float);backdrop-filter: var(--glass-filter); border-radius: var(--r-3xl);- box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 var(--composer-edge-w) var(--composer-edge), var(--composer-shadow); /* 描边:浮层玻璃的细边;拖入文件时换成 accent */- transition: box-shadow var(--t-moderate); /* 聚焦时浮高一点:投影慢慢长出来,不是一下变大 */+ box-shadow: 0 0 0 var(--composer-edge-w) var(--composer-edge), var(--composer-shadow); /* 描边:输入框的边;聚焦时深一级,拖入文件时换成 accent */+ transition: box-shadow var(--t-fast);}-.composer:focus-within { --composer-shadow: var(--shadow-lg); }-.composer.drag { --composer-edge: var(--accent); --composer-edge-w: 1.5px; --composer-shadow: var(--ring), var(--shadow-md); --composer-tint: var(--accent-wash); }+.composer:focus-within { --composer-edge: var(--line-strong); }+.composer.drag { --composer-edge: var(--accent); --composer-edge-w: 1.5px; --composer-shadow: var(--ring); --composer-tint: var(--pill); }.composer textarea {display: block; width: 100%; min-width: 0; border: 0; outline: none; background: transparent; resize: none;font-size: var(--fs-xl); line-height: var(--composer-line); padding: var(--space-3-5) var(--space-4) var(--space-1);@@ -330,17 +320,17 @@ a.file-card:active, .file-card:has(> .file-open:active) { background: var(--well/* 加号钮和发送钮一样是 32 的圆:加号落在 --composer-pad + 8 = 16,和上面文字的起点对齐;模型胶囊矮一档(28),不和两端的圆钮抢 */.composer :is(.plus, .model-chip) {flex: none; height: var(--ctl-md); display: inline-flex; align-items: center; justify-content: center; color: var(--ctl-fg);- transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);+ transition: background var(--t-fast), color var(--t-fast);}.composer :is(.plus, .model-chip):hover { background: var(--pill); color: var(--fg); }.composer :is(.plus, .model-chip)[aria-expanded="true"] { background: var(--pill-hover); color: var(--fg); }-.composer :is(.plus, .model-chip):active { background: var(--pill-press); transform: scale(var(--press)); }+.composer :is(.plus, .model-chip):active { background: var(--pill-press); }.composer .plus { width: var(--ctl-lg); height: var(--ctl-lg); border-radius: 50%; }-.composer .plus .ic { transition: transform var(--t-moderate); }+.composer .plus .ic { transition: transform var(--t-fast); }.composer .plus[aria-expanded="true"] .ic { transform: rotate(45deg); }.composer .model-chip { max-width: 240px; padding: 0 var(--space-2) 0 var(--space-2-5); border-radius: var(--r-full); gap: var(--space-1); font-size: var(--fs-sm); }.composer .model-chip .v { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }-.composer .model-chip .ic { --ic-size: var(--ic-xs); transition: transform var(--t-base); }+.composer .model-chip .ic { --ic-size: var(--ic-xs); transition: transform var(--t-fast); }.composer .model-chip[aria-expanded="true"] .ic:last-child { transform: rotate(180deg); }.composer .model-chip .ic.lead { --ic-size: var(--ic-sm); }.composer .model-chip.perm { max-width: 160px; }@@ -350,22 +340,17 @@ a.file-card:active, .file-card:has(> .file-open:active) { background: var(--well.composer .model-chip.perm.full:hover { background: linear-gradient(var(--pill), var(--pill)), var(--red-wash); }.composer .model-chip.perm.full[aria-expanded="true"] { background: linear-gradient(var(--pill-hover), var(--pill-hover)), var(--red-wash); }.composer .model-chip.perm.full:active { background: linear-gradient(var(--pill-press), var(--pill-press)), var(--red-wash); }-/* 发送:空的时候是中性的灰钮(不用半透明的墨色或黄绿,会发浑),箭头也小一号;能发了才亮起品牌色,- 箭头带一点回弹放大到位("可以发了");悬停时箭头往上提一点。- 发出后换成停止方块,方块从小弹到位;回复结束,箭头从下面升回来(.back:发过一次之后才有,打开页面时不动) */+/* 发送:空的时候是中性的灰钮(不用半透明的主操作色,会发浑);能发了才变成主操作色。+ 发出后换成停止方块,回复结束换回箭头,都只是淡入 */.send {width: var(--ctl-lg); height: var(--ctl-lg); border-radius: 50%; flex: none; display: grid; place-items: center;- background: var(--send-bg); color: var(--send-fg); box-shadow: var(--primary-edge);- transition: background var(--t-base), color var(--t-base), box-shadow var(--t-base), transform var(--t-fast);+ background: var(--send-bg); color: var(--send-fg);+ transition: background var(--t-fast), color var(--t-fast);}-.send .ic { transition: transform var(--t-base), scale var(--dur-base) var(--ease-back); }-.send:disabled .ic { scale: .86; }-.send.stop .ic { --scale-from: .4; animation: scale-in var(--dur-slow) var(--ease-spring); }-.send.back .ic { --rise: 4px; animation: rise-in var(--dur-moderate) var(--ease-out); }+.send.stop .ic, .send.back .ic { animation: fade-in var(--dur-base) var(--ease-out); }.send:hover:not(:disabled) { background: var(--primary-hover); }-.send:hover:not(:disabled):not(.stop) .ic { transform: translateY(-1px); }-.send:active:not(:disabled) { background: var(--primary-press); transform: scale(var(--press-strong)); }-.send:disabled:not([aria-busy="true"]) { background: var(--pill); color: var(--faint); box-shadow: none; }+.send:active:not(:disabled) { background: var(--primary-press); }+.send:disabled:not([aria-busy="true"]) { background: var(--pill); color: var(--faint); }/* 正在停止:保持本色转圈,只是不可点(同 Button 的 loading) */.send[aria-busy="true"] { cursor: progress; }.send .spinner { width: 12px; height: 12px; }@@ -377,10 +362,10 @@ a.file-card:active, .file-card:has(> .file-open:active) { background: var(--well.task-pill {display: inline-flex; align-items: center; gap: var(--space-1-5); max-width: 100%; height: var(--ctl-md); padding: 0 var(--space-2-5) 0 var(--space-3);border-radius: var(--r-full); background: var(--pill); font-size: var(--fs-sm); color: var(--fg-2);- transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);+ transition: background var(--t-fast), color var(--t-fast);}.task-pill:hover { background: var(--pill-hover); color: var(--fg); }-.task-pill:active { background: var(--pill-press); transform: scale(var(--press)); }+.task-pill:active { background: var(--pill-press); }.task-pill .l { display: flex; min-width: 0; white-space: nowrap; }.task-pill .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--fg); font-weight: var(--fw-medium); }.task-pill .chev { flex: none; color: var(--muted); transition: transform var(--t-fast); }diff --git a/ui/css/guide.css b/ui/css/guide.cssindex 24ea828..36f1e2a 100644--- a/ui/css/guide.css+++ b/ui/css/guide.css@@ -3,11 +3,10 @@要点的地方亮一圈 accent(和键盘焦点同一种语言),输入框借用拖入文件时的样子。 */@layer app {-/* —— 进度格:做完的格子是主操作色,点亮时弹一下 —— */+/* —— 进度格:做完的格子是主操作色 —— */.guide-bar { display: grid; grid-template-columns: repeat(var(--n, 6), minmax(0, 1fr)); gap: var(--space-1); }.guide-bar i { height: 4px; border-radius: 2px; background: var(--pill-hover); }-.guide-bar i.on { background: var(--primary); animation: guide-seg var(--dur-slow) var(--ease-back) both; animation-delay: calc(var(--stagger) * var(--i, 0) / 4); }-@keyframes guide-seg { from { opacity: .3; transform: scaleY(calc(1 + 1.2 * var(--motion))); } }+.guide-bar i.on { background: var(--primary); }/* —— 对话空状态里的清单卡 —— */.chat-empty.with-guide { padding-top: var(--space-12); }@@ -33,11 +32,11 @@ button.guide-step > .ic { color: var(--muted); }flex: none; display: grid; place-items: center; width: var(--ctl-xs); height: var(--ctl-xs); border-radius: 50%;background: var(--pill-hover); color: var(--muted); font-size: var(--fs-2xs); font-weight: var(--fw-semibold);}-.guide-step.done .n { background: var(--primary); color: var(--on-primary); }+.guide-step.done .n { background: var(--pill-press); color: var(--fg-2); }.guide-step.done .title { color: var(--muted); font-weight: var(--fw-regular); }-/* 当前这一步:铺一层 --accent-wash(状态,不是又一层容器),序号亮成黄绿片 */-.guide-step.open { align-items: flex-start; padding: var(--space-2-5) var(--space-2); background: var(--accent-wash); }-.guide-step.open .n { background: var(--accent-solid); color: var(--on-accent); box-shadow: 0 0 0 .5px var(--accent-line); } /* 描边:黄绿圆点在白底上只有 1.15:1,要一道墨色细边 */+/* 当前这一步:底色深一级(状态,不是又一层容器),序号换成主操作色 */+.guide-step.open { align-items: flex-start; padding: var(--space-2-5) var(--space-2); background: var(--well-hover); }+.guide-step.open .n { background: var(--primary); color: var(--on-primary); }.guide-step .body { flex: 1; min-width: 0; display: grid; gap: var(--space-1-5); }.guide-step.open .title { font-weight: var(--fw-semibold); }.guide-step .desc { margin: 0; color: var(--fg-2); line-height: var(--lh-normal); }@@ -48,34 +47,29 @@ button.guide-step > .ic { color: var(--muted); }/* —— 侧栏左下角的清单入口:账户行上面,和侧栏的行对齐 —— */.guide-pill {flex: none; display: flex; align-items: center; gap: var(--space-2-5); height: var(--ctl-xl); margin: 0 var(--side-inset);- padding: 0 var(--side-row-px); border-radius: var(--r-lg); background: var(--accent-wash);+ padding: 0 var(--side-row-px); border-radius: var(--r-lg); background: var(--side-hover);font-size: var(--fs-md); color: var(--fg); text-align: left;transition: background var(--t-fast);}-.guide-pill:hover { background: var(--side-hover); }+.guide-pill:hover { background: var(--side-press); }.guide-pill:active { background: var(--side-press); }-.guide-pill[aria-expanded="true"] { background: var(--side-active); box-shadow: var(--shadow-tile); }+.guide-pill[aria-expanded="true"] { background: var(--side-active); }.guide-pill .guide-bar { flex: none; grid-template-columns: repeat(var(--n, 6), 4px); gap: var(--space-0-5); }.guide-pill .guide-bar i { height: 14px; }.guide-pill .v { flex: 1; min-width: 0; font-weight: var(--fw-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }.guide-pill .num { font-size: var(--fs-xs); color: var(--muted); }-.guide-pill.bumped { animation: bump var(--dur-slow) var(--ease-out); }/* —— 引导卡片:浮层玻璃,放在要点的地方旁边(.up / .down / .left),小三角指过去 —— */.guide-coach {- position: fixed; z-index: calc(var(--z-popover) - 1); width: min(300px, calc(100vw - 2 * var(--pane-gap)));+ position: fixed; z-index: calc(var(--z-modal) - 1); width: min(300px, calc(100vw - 2 * var(--pane-gap)));padding: var(--card-pad); display: grid; gap: var(--space-2-5); color: var(--fg);- background: var(--grain), var(--glass-pop); backdrop-filter: var(--glass-filter-lg);+ background: var(--glass-pop); backdrop-filter: var(--glass-filter-lg);border-radius: var(--r-pane); box-shadow: var(--shadow-pop);- --pop-scale: .96;- animation: fade-in var(--dur-base) var(--ease-out), pop-in var(--dur-slower) var(--ease-spring);+ animation: fade-in var(--dur-base) var(--ease-out);}.guide-coach.glide { transition: left var(--t-moderate), top var(--t-moderate); }-.guide-coach.up { transform-origin: var(--ax) 100%; --pop-dy: 6px; }-.guide-coach.down { transform-origin: var(--ax) 0; }-.guide-coach.left { transform-origin: 100% var(--ay); --pop-dy: 0px; }/* 小三角:转 45° 的方块只露出卡片外面那一半 */-.guide-coach-arrow { position: absolute; width: 12px; height: 12px; rotate: 45deg; background: var(--grain), var(--glass-pop); backdrop-filter: var(--glass-filter-lg); }+.guide-coach-arrow { position: absolute; width: 12px; height: 12px; rotate: 45deg; background: var(--glass-pop); backdrop-filter: var(--glass-filter-lg); }.guide-coach.up .guide-coach-arrow { left: var(--ax); bottom: 0; translate: -50% 50%; clip-path: polygon(100% 0, 100% 100%, 0 100%); }.guide-coach.down .guide-coach-arrow { left: var(--ax); top: 0; translate: -50% -50%; clip-path: polygon(0 0, 100% 0, 0 100%); }.guide-coach.left .guide-coach-arrow { top: var(--ay); right: 0; translate: 50% -50%; clip-path: polygon(0 0, 100% 0, 100% 100%); }@@ -83,9 +77,8 @@ button.guide-step > .ic { color: var(--muted); }.guide-coach-top .icon-btn { margin-right: calc(-1 * var(--space-1-5)); }.guide-done {display: inline-flex; align-items: center; gap: var(--space-1); height: var(--ctl-xs); padding: 0 var(--space-2); border-radius: var(--r-full);- background: var(--accent-solid); color: var(--on-accent); font-size: var(--fs-2xs); font-weight: var(--fw-semibold);- box-shadow: 0 0 0 .5px var(--accent-line); /* 描边:黄绿填充面在白底上要一道墨色细边 */- animation: fade-in var(--dur-base) var(--ease-out), pop-in var(--dur-slower) var(--ease-back);+ background: var(--green-soft); color: var(--green); font-size: var(--fs-2xs); font-weight: var(--fw-semibold);+ animation: fade-in var(--dur-base) var(--ease-out);}.guide-coach-body { display: grid; gap: var(--space-2); }.guide-coach h3 { margin: 0; font-size: var(--fs-xl); font-weight: var(--fw-semibold); line-height: var(--lh-tight); }@@ -109,7 +102,7 @@ button.guide-step > .ic { color: var(--muted); }@keyframes guide-ping { 50% { outline-offset: calc(var(--space-0-5) + var(--space-1) * var(--motion)); outline-color: var(--accent-soft); } }/* 信息面板里的行装在会裁切的分组里:外圈往里收,不呼吸 */.row.guide-spot { outline-offset: calc(-1 * var(--space-0-5)); animation: none; }-.composer.guide-spot { --composer-edge: var(--accent); --composer-edge-w: 1.5px; --composer-shadow: var(--ring), var(--shadow-md); --composer-tint: var(--accent-wash); }+.composer.guide-spot { --composer-edge: var(--accent); --composer-edge-w: 1.5px; --composer-shadow: var(--ring); --composer-tint: var(--pill); }/* —— 生图的预置演示(MediaDemo):和真的回复同一套样子(工作状态行、chat.css 的 .msg-files / .msg-img),下面一行说明是自带的示例图;点开在原地放大(限高,放大后仍在一屏里) —— */diff --git a/ui/css/settings.css b/ui/css/settings.cssindex ac5de60..064beaf 100644--- a/ui/css/settings.css+++ b/ui/css/settings.css@@ -18,7 +18,7 @@.settings { --page-px: max(var(--page-gutter), calc((100% - var(--page-w)) / 2)); flex: 1; min-height: 0; overflow-y: auto; }.set-head {display: flex; align-items: center; gap: var(--space-3);- padding: var(--page-top) var(--page-px) var(--space-2);+ padding: var(--page-top) var(--page-px) 0;-webkit-app-region: drag;}.set-head > * { -webkit-app-region: no-drag; }@@ -28,29 +28,33 @@.set-sub { font-size: var(--fs-md); color: var(--muted); }/* 返回钮往左探出,箭头的笔画落在内容列的左边上(和分组标题、标签、卡片同一条线) */.set-back { --ib-size: var(--ctl-lg); --ib-r: var(--r-full); --ib-fg: var(--ctl-fg); margin-left: calc(-1 * var(--space-2-5)); }-.set-body { padding: var(--space-2) var(--page-px) var(--page-bottom); }+.set-body { padding: 0 var(--page-px) var(--page-bottom); }-/* 分组标题与卡片:标题、输入框标签、卡片共用内容列的左边 */-.settings .list-head { margin: var(--section-gap) 0 var(--heading-gap); font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--fg); }-.settings .list-head:first-child { margin-top: var(--space-6); }+/* 分组标题与卡片:标题、输入框标签、卡片共用内容列的左边。层次:页面标题 24 → 分组标题 13 半粗 → 行名 14 常规(分组标题是小标签,不和行名比大小) */+.settings .list-head, .set-part, .new-sugg .list-head { margin: var(--section-gap) 0 var(--heading-gap); font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--fg-2); }+.settings .list-head:first-child, .set-part:first-child { margin-top: var(--space-6); }+/* 这一组共同的说明:贴着标题,不进组里 */+.set-note { margin: calc(-1 * var(--space-1)) 0 var(--heading-gap); font-size: var(--fs-xs); color: var(--muted); line-height: var(--lh-normal); }.settings .list + .list { margin-top: var(--space-3); }/* 分组下方的风险提示(完全权限):紧跟在组的下面,不放进组里 */.settings .list + .notice { margin-top: var(--space-2); align-items: flex-start; padding: var(--space-3); }.settings .list + .notice > .ic { margin-top: 3px; } /* 微调:图标对齐第一行文字(14px 图标 / 约 20px 行高) */-/* 行:上下 10,一行的行和"名称 + 说明"两行的行都是 60 高(14 × 1.4 + 2 + 12.5 × 1.4 + 20 ≈ 59)。- 名称用常规字重、说明用 --muted:一页十几行时不发闷,层次交给分组标题的字重和说明的颜色 */-.settings .row { --row-h: 60px; --row-py: var(--space-2-5); --row-pl: var(--space-4); --row-pr: var(--space-4); --row-gap: var(--space-4); }+/* 行:上下 8,一行的行和"名称 + 说明"两行的行都是 56 高(14 × 1.4 + 2 + 12 × 1.4 + 16 ≈ 54)。+ 名称用常规字重、说明用 --muted:一页十几行时不发闷。放不下时控件换到下一行、靠右(长分段、窄窗口) */+.settings .row { --row-h: 56px; --row-py: var(--space-2); --row-pl: var(--space-4); --row-pr: var(--space-4); --row-gap: var(--space-2) var(--space-4); flex-wrap: wrap; }+.settings .row .who { flex: 1 1 240px; }+.settings .row .ctl { max-width: 100%; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }+.settings .row > .ctl:empty { display: none; }+.settings .row.compact { --row-h: 44px; --row-py: var(--space-1-5); } /* 故障排查的结果行 */.settings .row .name { font-size: var(--fs-lg); font-weight: var(--fw-regular); line-height: var(--lh-snug); }-.settings .row .sub { font-size: var(--fs-sm); line-height: var(--lh-snug); max-width: 460px; white-space: normal; }+.settings .row .sub { font-size: var(--fs-xs); line-height: var(--lh-snug); max-width: 480px; white-space: normal; }+.settings .row:has(> .ctl:empty) .sub { max-width: none; }.settings .pick { height: var(--ctl-md); padding: 0 var(--space-2) 0 var(--space-3); border-radius: var(--r-lg); }.settings .seg { --seg-r: var(--r-lg); }.settings .seg button { height: var(--ctl-sm); }-.set-part { margin: var(--section-gap) 0 var(--heading-gap); font-size: var(--fs-lg); font-weight: var(--fw-semibold); }-.set-part:first-child { margin-top: var(--space-6); }.set-body > .list:first-child { margin-top: var(--space-6); }.set-none { margin: var(--section-gap) 0; font-size: var(--fs-md); color: var(--muted); }.balance { font-size: var(--fs-lg); font-weight: var(--fw-semibold); font-variant-numeric: tabular-nums; }-.balance.low { color: var(--red); }/* 免打扰的起止:两个整点选择 + 中间一条短横,开关和它们隔开一点 */.settings .row .range-dash { color: var(--muted); font-variant-numeric: tabular-nums; }.settings .row .ctl .pick ~ .switch { margin-left: var(--space-2); }@@ -58,31 +62,38 @@.settings input.field.font-in { width: min(220px, 36vw); --field-h: var(--ctl-md); }.settings input.field.key-in { width: min(220px, 36vw); --field-h: var(--ctl-md); }-/* 外观预览(设置 › 外观顶部):一组 --well,里面一问一答 + 一行代码,用对话页同样的字号与字体 token,- 跟着字体大小、界面字体、代码字体和代码换行实时变 */-.ap-preview {- display: grid; gap: var(--space-3); margin-top: var(--space-6); padding: var(--card-pad);- background: var(--well); border-radius: var(--r-well);-}-.set-body > .ap-preview + .list { margin-top: var(--space-3); }-.ap-bubble {- justify-self: end; max-width: 80%; padding: var(--space-2-5) var(--space-4); border-radius: var(--r-bubble);- background: var(--bubble-user); font-size: var(--fs-xl); line-height: var(--lh-relaxed);-}-.ap-reply { font-size: var(--fs-xl); line-height: var(--lh-relaxed); }-.ap-reply b { font-weight: var(--fw-semibold); }-.ap-code {- margin: 0; font: var(--fs-sm)/var(--lh-relaxed) var(--code); color: var(--fg-2);- white-space: var(--code-wrap); overflow-wrap: anywhere; overflow-x: auto;-}+/* 外观的主题:三张缩略图。局部 data-theme 让缩略图用那个主题的真实颜色;选中是一圈 accent,不铺底 */+.theme-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); border-radius: var(--r-well); }+.theme-card { --focus-offset: var(--space-1); display: grid; gap: var(--space-2); justify-items: center; font-size: var(--fs-md); color: var(--fg-2); border-radius: var(--r-well); transition: color var(--t-fast); }+.theme-card:hover { color: var(--fg); }+.theme-card.on { color: var(--fg); font-weight: var(--fw-medium); }+.theme-thumb { position: relative; display: block; width: 100%; height: 104px; overflow: hidden; border-radius: var(--r-well); box-shadow: 0 0 0 1px var(--line); transition: box-shadow var(--t-fast); } /* 描边:缩略图的窗口轮廓 */+.theme-card:hover .theme-thumb { box-shadow: 0 0 0 1px var(--ctl-edge); } /* 描边:悬停时轮廓深一级 */+.theme-card.on .theme-thumb { box-shadow: 0 0 0 2px var(--accent); } /* 描边:选中 */+.tsk { position: absolute; inset: 0; display: flex; gap: var(--space-1); padding: var(--space-1) var(--space-1) var(--space-1) 0; }+.theme-thumb.split .tsk + .tsk { clip-path: inset(0 0 0 50%); }+.tsk-side { flex: 0 0 24%; }+.tsk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: var(--space-1); padding: var(--space-2); border-radius: var(--r-sm); background: var(--surface-solid); }+.tsk-bubble { align-self: flex-end; width: 44%; height: var(--space-2); border-radius: var(--r-full); background: var(--bubble-user); }+.tsk-line { width: 76%; height: var(--space-1); border-radius: var(--r-full); background: var(--line); }+.tsk-line.short { width: 50%; }+.tsk-box { height: var(--space-3); margin-top: var(--space-1); border-radius: var(--r-full); background: var(--pill-hover); }+/* 文字预览:「文字」这组的最后一块,用对话页同样的字号与字体 token,跟着字体大小、字体、代码字体和代码换行实时变 */+.text-sample { display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-4) var(--space-4); border-top: 1px solid var(--line-2); }+.text-sample p { font-size: var(--fs-xl); line-height: var(--lh-relaxed); }+.text-sample b { font-weight: var(--fw-semibold); }+.text-sample pre { margin: 0; font: var(--fs-sm)/var(--lh-relaxed) var(--code); color: var(--fg-2); white-space: var(--code-wrap); overflow-wrap: anywhere; overflow-x: auto; }++/* Modelflare 顶部:账户一行 + 余额。余额的数字和说明是 .bal(shell.css),右边是充值 */+.acct-bal { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-4); border-top: 1px solid var(--line-2); }+.acct-bal .btn { flex: none; }+.acct-bal.flash { animation: flash var(--dur-flash) var(--ease-out); }/* 用量:近 N 天的日柱状图 + 模型排行 */.usage-days { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: end; gap: var(--space-1); height: 120px; padding: var(--space-2) 0; }.usage-days .bar { display: grid; align-content: end; justify-items: center; gap: var(--space-1); height: 100%; font-size: var(--fs-2xs); color: var(--muted); }-.usage-days .bar i {- display: block; width: 100%; min-height: 2px; border-radius: var(--r-sm) var(--r-sm) 0 0; background: var(--accent-solid);- box-shadow: inset 0 0 0 var(--hairline) var(--accent-line); /* 描边:黄绿柱子在白底上只有 1.15:1,要一道细边才看得出高度(同应用标志) */-}+.usage-days .bar i { display: block; width: 100%; min-height: 2px; border-radius: var(--r-sm) var(--r-sm) 0 0; background: var(--fg-2); transition: background var(--t-fast); }+.usage-days .bar:hover i { background: var(--fg); }.usage-models { display: grid; gap: var(--space-1); font-size: var(--fs-sm); }.usage-models div { display: flex; justify-content: space-between; gap: var(--space-3); }.usage-models .v { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }@@ -90,8 +101,8 @@.notif { display: grid; gap: var(--space-1); padding: var(--space-3) 0; border-bottom: 1px solid var(--line-2); }.notif:last-child { border-bottom: 0; }.notif b { font-weight: var(--fw-semibold); }-/* 未读点用 --accent(浅色墨、深色黄绿):6px 的黄绿点在浅色玻璃上几乎看不见 */-.notif.unread b::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: var(--space-1-5); border-radius: 50%; background: var(--accent); vertical-align: middle; }+/* 未读点用 --signal(浅色墨、深色黄绿):6px 的黄绿点在浅色玻璃上几乎看不见 */+.notif.unread b::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: var(--space-1-5); border-radius: 50%; background: var(--signal); vertical-align: middle; }.notif p { font-size: var(--fs-sm); color: var(--fg-2); white-space: pre-wrap; }.notif time { font-size: var(--fs-2xs); color: var(--muted); }@@ -147,37 +158,44 @@ button.need-head:hover, button.need-head:hover .need-who b { color: var(--fg); }.set-field .field { --field-h: var(--ctl-xl); --field-px: var(--space-3); --field-r: var(--r-lg); font-size: var(--fs-lg); }.set-field textarea.field { min-height: 120px; padding: var(--space-2-5) var(--field-px); line-height: var(--lh-relaxed); }+/* 对话框里的表单:表单项之间一个 --space-3,和对话框自己的节奏一样;分组标题贴着下面的内容 */+.sheet form { display: grid; gap: var(--space-3); }+.sheet .set-field { margin-bottom: 0; }+.settings .sheet .list-head, .sheet .list-head { margin: var(--space-2) 0 0; }+/* 选择按钮按内容宽:撑满的话箭头贴着文字、菜单也对不上按钮 */+.set-field .pick { justify-self: start; }+/* 新建机器人(参考 Grok Bot 的创建页):居中的表单,下面是模板卡片 */.new-bot { flex: 1; min-height: 0; display: flex; flex-direction: column; }.new-bot .head-bot.static:hover { background: none; }.new-body { flex: 1; min-height: 0; overflow-y: auto; display: grid; justify-items: center; align-content: start; gap: var(--space-12); padding: var(--page-top) var(--page-gutter) var(--page-bottom); }.new-form { width: min(460px, 100%); display: grid; justify-items: center; }.new-title { margin-top: var(--space-4); font-size: var(--fs-4xl); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tighter); line-height: var(--lh-tight); text-align: center; }-.new-lead { margin: var(--space-2) 0 var(--space-6); font-size: var(--fs-md); color: var(--muted); line-height: var(--lh-relaxed); text-align: center; }+.new-lead { margin: var(--space-2) 0 var(--space-6); font-size: var(--fs-lg); color: var(--muted); line-height: var(--lh-relaxed); text-align: center; }.new-form .set-field { width: 100%; }.new-form .btn { min-width: 140px; }.new-sugg { width: min(720px, 100%); }-.new-sugg .list-head { margin: 0 0 var(--heading-gap); font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--fg); }+.new-sugg .list-head { margin-top: 0; }.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(216px, 1fr)); gap: var(--space-3); }-/* 模板卡:一块 --well,不描边、不浮起。悬停底色深一级,按下再深一级并轻微缩小;- 选中是一层黄绿 + 图标亮成黄绿片(图标平时只是一个字形,不套底) */+/* 模板卡:一块 --well,不描边、不浮起。悬停底色深一级,按下再深一级;+ 选中是底色再深一级 + 图标换成主操作色的一片(图标平时只是一个字形,不套底) */.tpl {display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: var(--space-3); row-gap: var(--space-0-5); align-content: start;padding: var(--card-pad); border-radius: var(--r-well); text-align: left;background: var(--well);- transition: background var(--t-fast), transform var(--t-fast);+ transition: background var(--t-fast);}.tpl:hover { background: var(--well-hover); }-.tpl:active { background: var(--well-press); transform: scale(var(--press)); }-.tpl.on, .tpl.on:hover { background: var(--accent-wash); }+.tpl:active { background: var(--well-press); }+.tpl.on, .tpl.on:hover { background: var(--well-press); }.tpl-ic {grid-row: span 2; width: var(--ctl-xl); height: var(--ctl-xl); border-radius: var(--r-lg); display: grid; place-items: center; color: var(--fg-2);transition: background var(--t-base), color var(--t-base);}.tpl:hover .tpl-ic { color: var(--fg); }-.tpl.on .tpl-ic { background: var(--accent-solid); color: var(--on-accent); box-shadow: inset 0 0 0 var(--hairline) var(--accent-line); } /* 描边:黄绿在白底上只有 1.15:1,要一道墨色细边 */+.tpl.on .tpl-ic { background: var(--primary); color: var(--on-primary); }.tpl-name { font-size: var(--fs-lg); font-weight: var(--fw-medium); line-height: var(--lh-snug); }-.tpl-desc { font-size: var(--fs-sm); color: var(--muted); line-height: var(--lh-snug); }+.tpl-desc { font-size: var(--fs-xs); color: var(--muted); line-height: var(--lh-snug); }/* onboarding */.onboard {@@ -186,14 +204,14 @@ button.need-head:hover, button.need-head:hover .need-who b { color: var(--fg); }-webkit-app-region: drag;}.onboard > * { -webkit-app-region: no-drag; }-.onboard-col { width: min(400px, 100%); display: grid; gap: var(--space-3-5); --rise: 4px; animation: rise-in var(--dur-moderate) var(--ease-out); }+.onboard-col { width: min(400px, 100%); display: grid; gap: var(--space-3-5); animation: fade-in var(--dur-base) var(--ease-out); }.onboard-hero { display: grid; justify-items: center; gap: var(--space-2-5); text-align: center; margin-bottom: var(--space-1-5); }.onboard-hero h1 { font-size: var(--fs-3xl); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tighter); }-.onboard-hero p { font-size: var(--fs-md); color: var(--muted); line-height: var(--lh-relaxed); }-/* 引导页的卡片是浮在环境光上的一块玻璃,和对话框同一种面(同一个圆角、同一种材质) */+.onboard-hero p { font-size: var(--fs-lg); color: var(--muted); line-height: var(--lh-relaxed); }+/* 引导页的卡片和主区同一层:白 / 浅一档的面,一道细线,没有投影 */.onboard .list {padding: var(--card-pad); display: grid; gap: var(--space-2-5); border-radius: var(--r-pane);- background: var(--grain), var(--glass-sheet); box-shadow: var(--shadow-pop);+ background: var(--surface-solid); box-shadow: var(--shadow-pane);}.onboard .err-text { font-size: var(--fs-sm); color: var(--red); line-height: var(--lh-normal); display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }.onboard .media-pick { display: grid; gap: var(--space-1); }@@ -219,5 +237,25 @@ button.need-head:hover, button.need-head:hover .need-who b { color: var(--fg); }.picklist button .check { color: var(--accent); }/* 头像角色(components/avatar.js 的 AvatarPicker):新建页在介绍语下面一排,机器人设置里是"身份"的第一项 */-.new-form .avatar-picker { justify-content: center; margin: calc(var(--space-2) * -1) 0 var(--space-6); }+.new-form .avatar-picker { margin: calc(var(--space-2) * -1) 0 var(--space-6); }++/* 连接弹窗(screens/connections.js)。步骤:编号 + 一句话。跟踪进度时,做完的打勾变灰,正在做的加重,没轮到的变灰 */+.conn-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); justify-self: stretch; text-align: left; font-size: var(--fs-md); line-height: var(--lh-normal); color: var(--fg-2); }+.conn-steps li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-2); align-items: start; }+.conn-steps .n { display: grid; place-items: center; width: var(--space-5); height: var(--space-5); border-radius: var(--r-full); background: var(--well); font-size: var(--fs-2xs); color: var(--muted); }+.conn-steps .txt { overflow-wrap: anywhere; }+.conn-steps code { font-family: var(--code); font-size: var(--fs-xs); }+.conn-steps .now .n { background: var(--primary); color: var(--on-primary); }+.conn-steps .now .txt { color: var(--fg); font-weight: var(--fw-medium); }+.conn-steps .done .txt, .conn-steps .todo .txt { color: var(--muted); }+/* 扫过之后二维码压暗,上面一个勾:不用读字也知道这一步过了 */+.qr-box { position: relative; display: block; }+.qr-box .qr-img { transition: opacity var(--t-fast); }+.qr-box.scanned .qr-img { opacity: .2; }+.qr-check { position: absolute; inset: 0; display: grid; place-items: center; color: var(--fg); animation: fade-in var(--dur-base) var(--ease-out); }+.conn-form, .conn-done, .conn-method { display: grid; gap: var(--space-3); }+.conn-form .set-field, .conn-done .set-field { margin-bottom: 0; }+.conn-done { animation: fade-in var(--dur-base) var(--ease-out); }+.conn-note { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-2); align-items: start; font-size: var(--fs-xs); line-height: var(--lh-normal); color: var(--fg-2); }+.conn-state { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); font-size: var(--fs-xs); color: var(--muted); }}diff --git a/ui/css/shell.css b/ui/css/shell.cssindex 275da2e..403ad0f 100644--- a/ui/css/shell.css+++ b/ui/css/shell.css@@ -1,8 +1,7 @@/* Shell:sidebar 280 | main 1fr | info panel 320(按需)。没有顶栏。- 窗口最底层是环境光(--bg + 左上的品牌黄绿光 + 跟着当前机器人变的色相光),- 侧栏是直接盖在环境光上的毛玻璃;主区和信息面板是浮在上面的圆角面板(--pane-gap 间隙)。+ 窗口最底层是一层纯色 --bg,不放光晕、不随机器人变色(用户 2026-11-03 要求);+ 侧栏就是窗口底色,和窗口是同一个平面;主区和信息面板是圆角面板,只有一道细线(--pane-gap 间隙)。侧栏、信息面板和主区之间的空隙是分隔条(README「分隔条」):拖动调宽,双击恢复。 */-@property --aura-hue { syntax: "<number>"; inherits: true; initial-value: 250; }/* 列宽注册成 <length>,才能平滑过渡:信息面板开合、双击恢复默认宽度、键盘调宽时列宽滑过去,主区跟着让位。不继承:过渡的每一帧只重算 .app 和两条分隔条(它们显式 inherit),不牵动整棵对话的样式 */@property --side-col { syntax: "<length>"; inherits: false; initial-value: 280px; }@@ -10,17 +9,8 @@@layer app {#app { height: 100%; }-/* —— 环境光:.app、引导页、设计库样例(.aura-bg)共用。--aura-hue 由 main.js 按当前机器人设置,换机器人时慢慢过渡 —— */-.app, .onboard, .aura-bg {- --aura: oklch(var(--aura-l) var(--aura-c) var(--aura-hue) / var(--aura-a));- --aura-2: oklch(var(--aura-l) calc(var(--aura-c) * .7) calc(var(--aura-hue) + 70) / calc(var(--aura-a) * .55));- background:- radial-gradient(70% 50% at 0% 0%, var(--aura-brand), transparent 72%),- radial-gradient(60% 75% at 0% 100%, var(--aura), transparent 72%),- radial-gradient(55% 60% at 100% 0%, var(--aura-2), transparent 70%),- var(--bg);- transition: --aura-hue var(--dur-ambient) var(--ease-in-out);-}+/* —— 窗口底色:.app、引导页、设计库样例(.window-bg)共用 —— */+.app, .onboard, .window-bg { background: var(--bg); }/* 引导页的语言切换(onboarding.js 的 LangSwitch):在引导列顶上靠右,不碰窗口角上的红绿灯 / 窗口按钮;左边的地球图标是标识,展开时不跟着箭头转 */.onboard-lang { justify-self: end; }@@ -35,14 +25,14 @@display: grid; height: 100vh;grid-template-columns: var(--side-col) minmax(0, 1fr) var(--panel-track);grid-template-rows: minmax(0, 1fr);- transition: --aura-hue var(--dur-ambient) var(--ease-in-out), --side-col var(--dur-slow) var(--ease-spring), --panel-track var(--dur-slow) var(--ease-spring);+ transition: --side-col var(--dur-slow) var(--ease-spring), --panel-track var(--dur-slow) var(--ease-spring);}.app > .side { grid-area: 1 / 1; }.app > .main { grid-area: 1 / 2; }.app > .panel { grid-area: 1 / 3; }.app.with-panel { --panel-track: var(--panel-col); }/* 拖分隔条时列宽跟手,不过渡 */-:root[data-resizing] .app { transition: --aura-hue var(--dur-ambient) var(--ease-in-out); }+:root[data-resizing] .app { transition: none; }/* 分隔条在空隙的正中,比空隙宽一点(两边各探进 2px,更好抓);细线只画在面板直边那一段(上下让出面板的圆角) */.app > .splitter { --side-col: inherit; --panel-track: inherit; z-index: calc(var(--z-float) + 1); --split-inset: calc(var(--pane-gap) + var(--r-pane)); }.app > .split-side { --split-x: calc(var(--side-col) - var(--pane-gap) / 2); }@@ -50,23 +40,22 @@/* "已保存" sits in the window's bottom-left corner, over the sidebar above the account button,so it never covers the floating composer: left edge on the sidebar rows' line, one --side-inset above the account row */.app .toasts { left: var(--side-inset); bottom: calc(var(--side-inset) * 2 + var(--ctl-2xl)); }-/* 主区:浮在环境光上的面板。不要给它加 backdrop-filter / transform——里面的菜单是 position: fixed */+/* 主区:窗口底色上的一块面板,只有一道细线、没有投影。不要给它加 backdrop-filter / transform——里面的菜单是 position: fixed */.main {position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column;margin: var(--pane-gap) var(--pane-gap) var(--pane-gap) 0;- border-radius: var(--r-pane); background: var(--surface); box-shadow: var(--shadow-pane); overflow: hidden; /* 描边:浮在环境光上的面板,浅色下和环境光只差 1.1:1,要一道细线(--hairline)的边 */+ border-radius: var(--r-pane); background: var(--surface); box-shadow: var(--shadow-pane); overflow: hidden; /* 描边:--shadow-pane 就是一道细线,面板靠它和底色分开 */}-.view { --rise: 4px; animation: rise-in var(--dur-moderate) var(--ease-out); }+.view { animation: fade-in var(--dur-base) var(--ease-out); }/* —— Sidebar(参考 Grok Bot):新建按钮 | 常驻搜索 | 机器人行 | 账户。- 行的状态:悬停叠一层淡灰,按下再深一级,选中是浮起的白色玻璃片(--side-active + --shadow-tile)——- 悬停偏暗、选中偏亮,两种状态一眼分得开 —— */+ 行的状态:悬停一层淡灰,选中深一级(--side-active),都是平的,没有投影、不浮起(参考 Codex、Grok) —— */.side {--ib-bg-hover: var(--side-hover);--ib-bg-press: var(--side-press);--ib-bg-on: var(--side-active);min-height: 0; display: flex; flex-direction: column;- background: var(--grain), var(--glass-side);+ background: var(--glass-side);}/* 顶部按钮和主区顶栏在同一条中线上:主区离窗口上沿 --pane-gap,这里也先让出 --pane-gap。右边让到新建按钮的图标(28 的按钮里 16 的图标,四周各 6)落在行文字的右边线上(--side-inset + --side-row-px),@@ -86,50 +75,49 @@.side-back:hover { background: var(--side-hover); color: var(--fg); }.side-back:active { background: var(--side-press); }.side-top .icon-btn { --ib-size: var(--ctl-md); --ib-fg: var(--ctl-fg); }-.side-top .icon-btn.on { box-shadow: var(--shadow-tile); }/* 搜索框和行同宽、和返回按钮同高;搜索图标 14 + 间隙 12 = 导航图标 16 + 间隙 10,搜索文字和导航文字对齐 */.side-search {flex: none; display: flex; align-items: center; gap: var(--space-3); height: var(--ctl-lg); margin: 0 var(--side-inset) var(--side-inset); padding: 0 var(--side-row-px);border-radius: var(--r-lg); background: var(--pill); color: var(--muted);- transition: box-shadow var(--t-fast), background var(--t-fast), color var(--t-fast);+ transition: background var(--t-fast), color var(--t-fast);}.side-search:hover { background: var(--pill-hover); }-.side-search:focus-within { background: var(--card); color: var(--fg-2); box-shadow: inset 0 0 0 1px var(--accent), var(--ring); }+.side-search:focus-within { background: var(--card); color: var(--fg-2); box-shadow: inset 0 0 0 1px var(--line-strong); }.side-search input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: none; background: transparent; font-size: var(--fs-md); color: var(--fg); }.side-search input::placeholder { color: var(--muted); }.side-search input::-webkit-search-cancel-button { display: none; }-/* 上边留一行的间隙,选中行的投影不被滚动容器裁掉。+/* 上边留一行的间隙。右边用外边距而不是内边距:滚动条落在行的右边上,不落进侧栏和主区之间的空隙(那里是分隔条) */.side-list {flex: 1; min-height: 0; overflow-y: auto; padding: var(--side-row-gap) 0 var(--side-inset) var(--side-inset); margin-right: var(--side-inset);display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: var(--side-row-gap);}.side-list > .hint { padding: var(--space-2) var(--side-row-px); }-/* 机器人列表和设置导航在侧栏里互换时(进出设置)轻轻浮上来,两个方向一样 */-.side-list { --rise: 3px; animation: rise-in var(--dur-moderate) var(--ease-out); }+/* 机器人列表和设置导航在侧栏里互换时淡入 */+.side-list { animation: fade-in var(--dur-base) var(--ease-out); }.nav-item {--focus-offset: -2px;display: flex; align-items: center; gap: var(--space-2-5); height: var(--ctl-lg); padding: 0 var(--side-row-px);border-radius: var(--r-lg); font-size: var(--fs-md); color: var(--fg-2); text-align: left;- transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);+ transition: background var(--t-fast), color var(--t-fast);}.nav-item .ic { color: var(--muted); transition: color var(--t-fast); }.nav-item:hover { background: var(--side-hover); color: var(--fg); }.nav-item:active { background: var(--side-press); }-.nav-item.sel { background: var(--side-active); box-shadow: var(--shadow-tile); color: var(--fg); font-weight: var(--fw-medium); }+.nav-item.sel { background: var(--side-active); color: var(--fg); font-weight: var(--fw-medium); }.nav-item.sel .ic, .nav-item:hover .ic { color: var(--fg); }.thread {--focus-offset: -2px;min-width: 0;display: flex; align-items: center; gap: var(--space-3); width: 100%; height: 60px; padding: 0 var(--side-row-px);border-radius: var(--r-xl); text-align: left; position: relative;- transition: background var(--t-fast), box-shadow var(--t-fast);+ transition: background var(--t-fast);}/* 行外面包一层 .thread-item,"更多"按钮叠在行上:指针在按钮上时整行仍是悬停的样子 */.thread:hover, .thread-item:hover > .thread { background: var(--side-hover); }button.thread:active { background: var(--side-press); }-.thread.sel, .thread-item > .thread.sel, button.thread.sel:active { background: var(--side-active); box-shadow: var(--shadow-tile); }+.thread.sel, .thread-item > .thread.sel, button.thread.sel:active { background: var(--side-active); }.thread .body { min-width: 0; flex: 1; display: grid; gap: var(--space-0-5); }.thread .line { display: flex; align-items: baseline; gap: var(--space-2); min-width: 0; }.thread .title { flex: 1; min-width: 0; font-size: var(--fs-lg); font-weight: var(--fw-medium); color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: var(--lh-tight); }@@ -150,22 +138,22 @@ button.thread:active { background: var(--side-press); }.thread-more {--ib-size: var(--ctl-sm); --ib-fg: var(--muted);position: absolute; top: var(--space-2); right: var(--space-1-5);- opacity: 0; transition: opacity var(--t-fast), background var(--t-fast), color var(--t-fast), transform var(--t-fast);+ opacity: 0; transition: opacity var(--t-fast), background var(--t-fast), color var(--t-fast);}.thread-item:hover > .thread-more, .thread-more:focus-visible, .thread-more[aria-expanded="true"] { opacity: 1; }.thread-item:is(:hover, :has(> .thread-more:focus-visible), :has(> .thread-more[aria-expanded="true"])) .when { opacity: 0; }.thread-skel { flex: 1; display: grid; gap: var(--space-1-5); }/* 「需要你」(screens/needs-you.js):机器人列表上方一行,只在有事时出现。黄点在头像那一列的中线上,- 文字和机器人名对齐,件数和机器人行的计数在同一条竖线上;选中时和机器人行一样是浮起的玻璃片 */+ 文字和机器人名对齐,件数和机器人行的计数在同一条竖线上;选中时和机器人行一样深一级 */.needs-row {--focus-offset: -2px;display: flex; align-items: center; gap: var(--space-3); width: 100%; height: var(--ctl-xl); padding: 0 var(--side-row-px);border-radius: var(--r-xl); text-align: left; font-size: var(--fs-lg); font-weight: var(--fw-medium); color: var(--fg);- transition: background var(--t-fast), box-shadow var(--t-fast);+ transition: background var(--t-fast);}.needs-row:hover { background: var(--side-hover); }.needs-row:active { background: var(--side-press); }-.needs-row.sel, .needs-row.sel:active { background: var(--side-active); box-shadow: var(--shadow-tile); }+.needs-row.sel, .needs-row.sel:active { background: var(--side-active); }.needs-row .mark { width: 38px; flex: none; display: grid; place-items: center; } /* 和侧栏头像一样宽 */.needs-row .label { flex: 1; min-width: 0; }.needs-row .badge.count { --badge-bg: var(--amber-soft); --badge-fg: var(--amber); }@@ -181,11 +169,11 @@ button.thread:active { background: var(--side-press); }.account {--focus-offset: -2px;display: flex; align-items: center; gap: var(--space-2-5); min-width: 0; flex: 1; height: var(--ctl-2xl); padding: 0 var(--side-row-px);- border-radius: var(--r-xl); text-align: left; transition: background var(--t-fast), box-shadow var(--t-fast);+ border-radius: var(--r-xl); text-align: left; transition: background var(--t-fast);}.account:hover { background: var(--side-hover); }.account:active { background: var(--side-press); }-.account.on { background: var(--side-active); box-shadow: var(--shadow-tile); }+.account.on { background: var(--side-active); }.account .me {width: var(--ctl-md); height: var(--ctl-md); border-radius: 50%; flex: none; display: grid; place-items: center;background: var(--pill);@@ -193,39 +181,28 @@ button.thread:active { background: var(--side-press); }}.account .who { flex: 1; min-width: 0; font-size: var(--fs-md); font-weight: var(--fw-medium); color: var(--fg); line-height: var(--lh-snug); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }/* 账户浮层:余额只在这里显示,点头像才弹出(常驻显示会让人觉得一直在花钱) */-.account-pop { display: grid; gap: var(--space-2-5); padding: var(--space-3); }-.account-pop-name { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }-.account-pop-bal { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }-.account-pop-label { font-size: var(--fs-2xs); color: var(--muted); }-/* 余额不足:和其他出错的提示行一样只铺一层淡红(--red-wash),字用 --fg,前面一个红点;- 悬停、按下时淡红加深一级,不加下划线(整条都是链接) */-.low-balance {- --low-wash: var(--red-wash);- flex: none; display: flex; align-items: center; gap: var(--space-2);- margin: 0 var(--side-inset); padding: var(--space-2) var(--side-row-px); border-radius: var(--r-lg);- font-size: var(--fs-sm); line-height: var(--lh-snug); color: var(--fg); background: var(--low-wash);- transition: background var(--t-fast);-}-.low-balance::before { content: ""; width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--red); }-.low-balance:hover { --low-wash: color-mix(in srgb, var(--red) 14%, transparent); text-decoration: none; }-.low-balance:active { --low-wash: color-mix(in srgb, var(--red) 20%, transparent); }-/* 有新版本:和余额提示一个位置、一样的字号,但不是出错,铺强调色的淡底,前面一个强调色的点;- 文字整段是链接,右边的叉只关掉这个版本的提示 */-.side-update {- flex: none; display: flex; align-items: center; gap: var(--space-1);- margin: 0 var(--side-inset) var(--space-1); padding-right: var(--space-1); border-radius: var(--r-lg);- background: var(--accent-wash);- transition: background var(--t-fast);-}-.side-update:hover { background: var(--side-hover); }-.side-update:active { background: var(--side-press); }-.side-update a {- flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--space-2);- padding: var(--space-2) 0 var(--space-2) var(--side-row-px);- font-size: var(--fs-sm); line-height: var(--lh-snug); color: var(--fg);-}-.side-update a:hover { text-decoration: none; }-.side-update a::before { content: ""; width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--accent); }+.account-pop { display: grid; gap: var(--space-3); padding: var(--space-3); }+.account-pop-name { font-size: var(--fs-md); font-weight: var(--fw-medium); color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }+.account-pop-bal { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3); }+/* 余额(账户浮层、设置 › Modelflare):一个安静的数字,低于提醒线时也不变色(红字像欠费),下面一行小字说明,前面一个琥珀色小点 */+.bal { display: grid; gap: var(--space-1); min-width: 0; }+.bal-label { font-size: var(--fs-xs); color: var(--muted); }+.bal-amount { font-size: var(--fs-3xl); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); line-height: var(--lh-tight); font-variant-numeric: tabular-nums; color: var(--fg); overflow-wrap: anywhere; }+.bal-note { display: flex; align-items: center; gap: var(--space-1-5); font-size: var(--fs-xs); line-height: var(--lh-snug); color: var(--muted); }+/* 侧栏底部的提示(余额不多了、有新版本):一行安静的灰底,语气交给前面的小点,不铺红、不铺品牌色。+ 小点落在头像那条竖线上;整行可点,悬停深一级;右边是一句动作(充值)或关闭钮 */+.side-note {+ flex: none; display: flex; align-items: center; gap: var(--space-1); min-height: var(--ctl-lg);+ margin: 0 var(--side-inset) var(--space-1); border-radius: var(--r-lg); background: var(--side-hover);+ font-size: var(--fs-md); line-height: var(--lh-snug); color: var(--fg); transition: background var(--t-fast);+}+.side-note:hover { background: var(--side-press); }+.side-note:hover, .side-note:hover a { text-decoration: none; color: var(--fg); }+.side-note > .icon-btn { margin-right: var(--space-1); }+.side-note-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--space-2); min-height: var(--ctl-lg); padding: 0 var(--space-2-5); color: var(--fg); }+.side-note .v { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }+.side-note .go { flex: none; font-size: var(--fs-xs); color: var(--muted); }+.dot.new { --dot-bg: var(--signal); }/* —— 窗口标题栏:桌面版没有系统标题栏,侧栏顶部这一行(--pane-gap + --head-h)就是标题栏。左上角归谁看平台:macOS 是红绿灯(应用名在菜单栏里,这里不再放 Logo),Windows 是应用图标 + 名称(Windows 的习惯)。@@ -280,10 +257,10 @@ button.thread:active { background: var(--side-press); }.panel {width: calc(var(--panel-col) - var(--pane-gap)); min-height: 0; display: flex; flex-direction: column;margin: var(--pane-gap) var(--pane-gap) var(--pane-gap) 0;- border-radius: var(--r-pane); background: var(--grain), var(--glass-panel); box-shadow: var(--shadow-pane); overflow: hidden;- animation: fade-in var(--dur-slow) var(--ease-out);+ border-radius: var(--r-pane); background: var(--glass-panel); box-shadow: var(--shadow-pane); overflow: hidden;+ animation: fade-in var(--dur-base) var(--ease-out);}-.panel.leaving { animation: fade-out var(--dur-slow) var(--ease-in) forwards; pointer-events: none; }+.panel.leaving { animation: fade-out var(--dur-base) var(--ease-in) forwards; pointer-events: none; }.panel-head {height: var(--head-h); flex: none; display: flex; align-items: center; gap: var(--bar-gap); padding: 0 var(--head-px) 0 var(--pane-px);-webkit-app-region: drag;@@ -291,7 +268,7 @@ button.thread:active { background: var(--side-press); }.panel-head > * { -webkit-app-region: no-drag; }.panel-head .title { flex: 1; min-width: 0; font-size: var(--fs-lg); font-weight: var(--fw-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }.panel-head .icon-btn { --ib-size: var(--ctl-md); } /* 16 的图标四周各 6:图标外沿落在 --head-px + 6 = --pane-px 上,和标题左边对称 */-/* 行是贴着面板的玻璃片:片离面板边缘 8,行里再缩进 8,文字落在 --pane-px,和面板标题对齐 */+/* 行的悬停底离面板边缘 8,行里再缩进 8,文字落在 --pane-px,和面板标题对齐 */.panel-body { flex: 1; overflow-y: auto; padding: 0 var(--space-2) var(--space-6); }.panel-body .list-head { margin: var(--section-gap-sm) var(--space-2) var(--space-1); }.panel-body .list-head:first-child { margin-top: var(--space-2); }@@ -307,10 +284,6 @@ button.thread:active { background: var(--side-press); }/* 待审批:卡片和行一样贴着面板,上方的说明缩进到行文字那条线 */.panel-body .approval > .hint { padding: 0 var(--space-2); }.panel-body .row > .hint { flex: none; white-space: nowrap; }-.panel-qr {- width: 180px; height: 180px; image-rendering: pixelated; background: var(--qr-bg);- padding: var(--space-2); border-radius: var(--r-lg);-}/* 会话记录预览(信息面板 → 最近会话) */.transcript { display: grid; gap: var(--space-2); max-height: 60vh; overflow: auto; }.transcript-msg { justify-self: start; max-width: 85%; }@@ -385,7 +358,7 @@ a.text { display: inline-flex; align-items: center; text-decoration: none; }.app.with-panel { --panel-track: 0px; }.app > .panel {position: fixed; z-index: var(--z-drawer); top: var(--pane-gap); right: var(--pane-gap); bottom: var(--pane-gap); margin: 0;- background: var(--grain), var(--glass-pop); backdrop-filter: var(--glass-filter-lg); box-shadow: var(--shadow-pop);+ background: var(--glass-pop); backdrop-filter: var(--glass-filter-lg); box-shadow: var(--shadow-pop);animation: slide-in var(--dur-moderate) var(--ease-out);}.app > .panel.leaving { animation: slide-out var(--dur-base) var(--ease-in) forwards; }diff --git a/ui/design/README.md b/ui/design/README.mdindex 5b2c738..97017d6 100644--- a/ui/design/README.md+++ b/ui/design/README.md@@ -2,7 +2,7 @@界面样式的唯一来源。无构建步骤:原生 CSS(`@layer` + 自定义属性)+ Preact/htm 组件。-- 样例页:本机服务的 `/amb/static/design/index.html`。token 表直接从 `tokens/*.css` 解析,不会和代码脱节;支持浅色/深色和双主题对照,也能模拟"减少动态效果";设置 › 外观里的偏好(字体大小、字体、动画、毛玻璃)在样例页里同样生效。+- 样例页:本机服务的 `/amb/static/design/index.html`。token 表直接从 `tokens/*.css` 解析,不会和代码脱节;支持浅色/深色和双主题对照,也能模拟"减少动态效果";设置 › 外观里的偏好(字体大小、字体、动画)在样例页里同样生效。- 守卫测试:`test/design-system.unit.test.ts`。`npm test` 时检查规范有没有被破坏(规则见文末)。## 目录@@ -20,7 +20,7 @@ ui/design/typography.css 文字角色 .t-*(在 utilities 层)utilities.css .stack .cluster .grow .truncate .tone-* .sr-onlycomponents/ 一个组件一个文件:icon glass button field badge list seg switch stops popover model-family sheet splitter toast notice feedback avatar- motion.js ms("--dur-base")、usePresence()、reducedMotion()+ motion.js ms("--dur-base")、usePresence()、useListPresence()、reducedMotion()index.html / gallery.* 样例页ui/css/ 页面样式(shell / chat / settings / guide),放在 app 层ui/components/ui.js 组件的 JS 写法:Icon Button IconButton Notice Skeleton Seg Switch Stops Menu MenuButton Sheet …@@ -40,22 +40,22 @@ ui/components/ui.js 组件的 JS 写法:Icon Button IconButton Notice Ske## Token-**分两层。** 原始值(`--lime-500`、`--space-3`、`--r-md`)描述"有什么";语义 token(`--accent-solid`、`--line`、`--muted`)描述"用在哪"。+**分两层。** 原始值(`--lime-500`、`--space-3`、`--r-md`)描述"有什么";语义 token(`--primary`、`--line`、`--muted`)描述"用在哪"。| 类别 | 规则 ||---|---|| 颜色 | 页面和组件**只用语义色**。原始色板只在 `semantic.css` 里引用。新颜色先加语义 token(两个主题都要给值),再用。 |-| 字号 | 9 级 `--fs-2xs … --fs-4xl`(11 / 11.5 / 12.5 / 13 / 14 / 15 / 17 / 20 / 22),都乘以 `--fs-scale`(设置 › 外观 › 字体大小)。新界面优先用文字角色 `.t-*`;跟着文字走的长度(比如输入框行高 `--composer-line`)也乘 `--fs-scale`。 |+| 字号 | 9 级 `--fs-2xs … --fs-4xl`(11 / 12 / 13 / 13 / 14 / 15 / 18 / 20 / 24,不用半像素,控件和界面正文同为 13),都乘以 `--fs-scale`(设置 › 外观 › 字体大小)。新界面优先用文字角色 `.t-*`;跟着文字走的长度(比如输入框行高 `--composer-line`)也乘 `--fs-scale`。 || 字重与字距 | `--fw-semibold` 只给标题:页面、分组、对话框、顶栏与面板标题、提问卡的问题、正文里的标题、11px 小标签。名称一类(机器人名、文件名、模板名、账户名、信息面板的行)用 `--fw-medium`;设置页的行名称用常规字重,层次交给分组标题和 `--muted` 的说明。大标题用 `--tracking-tighter`(-.015em)、二级标题 `--tracking-tight`(-.01em)——中文字形本来就满,不要收得更紧;行高用 `--lh-*`,不写 1.45 这类散值。 || 字体 | 只用 `--font` / `--code`。它们默认是各平台的系统字体 `--font-system` / `--code-system`,用户可以换成衬线 `--font-serif` 或自定义字体(见「用户偏好」)。 || 圆角 | `--r-xs … --r-3xl`、`--r-full`。同一种面用同一个圆角角色:`--r-well`(内容里的一组)、`--r-pane`(面板与浮层)、`--r-bubble`(消息气泡),见「容器与层次」。嵌套时内层 = 外层 − 内边距(`.seg`、`.pop` 里的列表项就是这样算的)。圆形用 `50%`。 || 间距 | 4 的倍数 `--space-1 … --space-16`,另有 `-0-5 / -1-5 / -2-5 / -3-5` 半步。页面和组件先用按用途命名的间距角色(见下文「间距」)。写死的像素只允许 0、≤1px 的细线,以及同一行带 `/* 微调:… */` 注释的光学微调。 || 控件高度 | `--ctl-xs … --ctl-2xl`(22 / 24 / 28 / 32 / 36 / 44)。 |-| 细线 | `--hairline`:一个物理像素(普通屏 1px,高分屏 .5px)。面板、玻璃浮层、黄绿填充面的细边都用它——写死 `.5px` 在 1x 屏上会被抗锯齿成一道若有若无的虚影。 |+| 细线 | `--hairline`:一个物理像素(普通屏 1px,高分屏 .5px)。面板、浮层的细边都用它——写死 `.5px` 在 1x 屏上会被抗锯齿成一道若有若无的虚影。 || 层次 | `--well` / `--well-hover` / `--well-press`(内容里的一组,只有这一层);`--line-2`(行间细线);`--ctl-edge` / `--ctl-edge-hover`(输入框的边,≥ 3:1);`--red-wash` / `--amber-wash`(提示行的淡底)。规则见「容器与层次」。 |-| 投影 | `--shadow-xs / sm / md / lg`;`--shadow-pane`(浮在环境光上的面板)、`--shadow-tile`(侧栏选中项,只有投影)、`--shadow-float` / `--shadow-pop`(玻璃的边 + 投影)、`--primary-edge`、`--seg-edge`(分段 thumb、开关圆钮,只有投影)。深色下更重,都是主题 token。内容里的组不加投影。 |+| 投影 | 分三档,只给浮在内容上的东西,都很淡:`--shadow-float`(输入框、回到底部、提示胶囊)、`--shadow-pop`(菜单、引导卡片、抽屉)、`--shadow-modal`(对话框、命令面板)。`--shadow-pane` 只有一道细线(面板)。`--seg-edge` 是分段 thumb、开关圆钮的一点点影子。见「容器与层次」。 || 层级 | 只用 `--z-*`;同一窗格内的浮动件用 `calc(var(--z-float) ± 1)`。 |-| 焦点 | 输入框:accent 描边(浅色墨、深色黄绿)+ `box-shadow: var(--ring)` 黄绿光晕(错误时 `--ring-danger`);其他控件:全局 `:focus-visible` 2px 描边、外移 2px,装在会裁切的容器里时用 `--focus-offset` 往里收。 |+| 焦点 | 输入框:accent 描边(浅色墨、深色近白)+ `box-shadow: var(--ring)` 中性光晕(错误时 `--ring-danger`);其他控件:全局 `:focus-visible` 2px 描边、外移 2px,装在会裁切的容器里时用 `--focus-offset` 往里收。 |现有语义色名(`--bg --card --pill --line --fg --muted --accent …`)沿用 magpie 的叫法,分组见 `semantic.css` 里的 `/* —— 组 —— */` 注释。@@ -73,9 +73,9 @@ ui/components/ui.js 组件的 JS 写法:Icon Button IconButton Notice Ske| 侧栏行内边距 | `--side-row-px` | 10 | 机器人行、设置导航、账户、返回、搜索框 || 侧栏行间隙 | `--side-row-gap` | 2 | 相邻两行 || 内容列边距 | `--page-gutter` | 24(窗口窄于 1000px 时 16) | 对话列、输入框、设置页、新建页、引导页两侧至少留这么多 |-| 页面上 / 下边距 | `--page-top` / `--page-bottom` | 48 / 64 | 设置页、新建页、引导页 |+| 页面上 / 下边距 | `--page-top` / `--page-bottom` | 40 / 64 | 设置页、新建页、引导页 || 分组间距 | `--section-gap` / `--section-gap-sm` | 32 / 20 | 页面里 / 窄面板里分组标题的上方 |-| 标题到内容 | `--heading-gap` | 10 | 页面分组标题的下方 |+| 标题到内容 | `--heading-gap` | 8 | 页面分组标题的下方 || 卡片内边距 | `--card-pad` | 16 | 提问 / 审批卡、引导页卡片、侧栏空状态、模板卡 || 对话框内边距 | `--sheet-pad` | 20 | `.sheet` || 按钮组间隙 | `--ctl-gap` | 8 | 对话框、卡片、展开编辑区里的一组操作 |@@ -99,63 +99,75 @@ ui/components/ui.js 组件的 JS 写法:Icon Button IconButton Notice Ske## 品牌色-品牌色是 Modelflare 的**信号黄绿 `#d7ff00` + 墨色 `#161a00`**。界面骨架是纯灰阶(布局参考 Grok Bot / Codex),颜色留给两样东西:品牌信号和机器人头像。+品牌色是 Modelflare 的**信号黄绿 `#d7ff00` + 墨色 `#161a00`**。界面骨架是纯灰阶(布局参考 Grok Bot / Codex),颜色留给机器人头像和状态。-**一句话:墨色负责操作,黄绿是"亮起的信号"。** 黄绿在白底上只有 1.15:1,所以它永远是**填充面**或**墨色上的光**,不当浅色背景上的文字和细线用。+**一句话:操作是中性的(浅色墨、深色近白),黄绿只是很小的信号,不做底色。** 用户 2026-11-03 要求减少酸性色,尤其是作为背景色。| 角色 | token | 浅色 | 深色 ||---|---|---|---|-| 主操作:主按钮、打开的开关 | `--primary` / `--on-primary` | 墨底白字 | 黄绿底墨字 |-| 发送 / 停止 | `--send-bg` / `--send-fg` | 墨色圆钮 + **黄绿箭头** | 黄绿圆钮 + 墨色箭头 |-| 焦点、勾选、指示点、链接 | `--accent` | 墨色 | 黄绿 |-| 输入框聚焦光晕 | `--ring`(`--accent-soft`) | 黄绿光晕 | 弱黄绿光晕 |-| 荧光笔:选中文字、定位闪烁 | `--mark` / `--on-mark` | 浅黄绿底墨字 | 暗黄绿底 |-| 品牌填充:应用标志、"已保存" | `--accent-solid` / `--on-accent` | 黄绿底墨字 | 同左 |+| 主操作:主按钮、打开的开关、滑块 | `--primary` / `--on-primary` | 墨底白字 | 近白底墨字 |+| 发送 / 停止 | `--send-bg` / `--send-fg` | 墨色圆钮 + 黄绿箭头 | 近白圆钮 + 墨色箭头 |+| 焦点、勾选、链接 | `--accent` | 墨色 | 近白 |+| 输入框聚焦光晕 | `--ring`(`--accent-soft`) | 中性 | 中性 |+| 选中文字、定位闪烁 | `--mark` / `--on-mark` | 一层灰 | 一层白 |+| "有新东西"的小点:未读、上新、回到底部、新版本 | `--signal` | 墨色 | 黄绿 |+| 品牌填充:只给应用标志 | `--brand` / `--on-brand` / `--brand-line` | 黄绿底墨字 | 同左 |-不要用品牌色的地方:分段控件的 thumb、菜单当前项、选中的侧栏行、用户气泡(都是中性灰);状态(成功、工作中)用 `--green`,不要用黄绿冒充。+黄绿能出现的地方只有上面三处(浅色的发送箭头、深色的小点、应用标志),外加模型选择器的彩蛋(两个滑块都拉满时才有)。**不要用黄绿铺底**:按钮、提示胶囊、选中态、进度、图表都用中性色;状态(成功、工作中)用 `--green`,不要用黄绿冒充。++**余额**(账户浮层、设置 › Modelflare,`Balance` 组件):一个安静的数字。低于提醒线时数字不变色(红字像欠费),只多一行带琥珀色小点的小字;侧栏底部是一行灰底提示(`.side-note`),不写金额。## 材质-窗口是分层的,越往上越"实":+窗口只有几种面,越往上越亮。层次靠底色和一道细线,不靠投影和透明(参考 Codex、Grok)。| 层 | 是什么 | token ||---|---|---|-| 环境光 | 窗口最底层:`--bg` + 左上的品牌黄绿光 + 跟着当前机器人角色变色的色相光(切换机器人时 `--dur-ambient` 慢慢过渡)。`.app`、引导页、样例页的 `.aura-bg` 共用 | `--bg --aura-brand --aura-l --aura-c --aura-a`,色相 `--aura-hue` 由 `main.js` 设 |-| 侧栏 | 直接盖在环境光上的毛玻璃(底下是平滑的光,不需要模糊) | `--glass-side` |-| 主区、信息面板 | 浮在环境光上的圆角面板,四周留 `--pane-gap` | `--surface`、`--glass-panel`,`--shadow-pane` |-| 顶栏、输入框、回到底部 | 盖在滚动内容上的玻璃,内容从底下滚过是模糊的 | `--glass-chrome`、`--glass-float` + `--glass-filter` |-| 菜单、命令面板、提示、对话框 | 最上层的玻璃,模糊最重 | `--glass-pop`、`--glass-sheet` + `--glass-filter-lg`,`--shadow-pop` |+| 窗口底色 | 窗口最底层,侧栏就是它:一层纯色的中性灰,不放光晕、不随机器人变色(用户 2026-11-03 要求)。`.app`、引导页、样例页的 `.window-bg` 共用 | `--bg`(`--glass-side` 是透明) |+| 主区、信息面板、引导页卡片 | 窗口底色上的圆角面板,四周留 `--pane-gap` | `--surface`、`--glass-panel`,`--shadow-pane` |+| 顶栏、输入框、回到底部 | 盖在滚动内容上,几乎不透,内容从底下滚过只隐约看得到 | `--glass-chrome`、`--glass-float` + `--glass-filter` |+| 菜单、命令面板、提示、对话框 | 最上层,基本是实色 | `--glass-pop`、`--glass-sheet` + `--glass-filter-lg` |-一块玻璃 = 半透明底 + 背景模糊 + 磨砂颗粒 `--grain` + 顶边高光 `--glass-hi` 与细描边 `--glass-edge`。写法:+写法:```css-.pop { background: var(--grain), var(--glass-pop); backdrop-filter: var(--glass-filter-lg); box-shadow: var(--shadow-pop); }+.pop { background: var(--glass-pop); backdrop-filter: var(--glass-filter-lg); box-shadow: var(--shadow-pop); }<div class="glass" style="--glass-bg: var(--glass-chrome)">…</div> /* 临时用:.glass + --glass-bg / --glass-blur / --glass-shadow */```+不用磨砂颗粒,也不用顶边高光:干净比质感重要。+- **填充、悬停、描边都是半透明的一层**(`--pill*`、`--side-*`、`--line*`、`--sel*`),放在玻璃和实色上都对。不要在玻璃上用实色灰。-- **`backdrop-filter` 会让元素变成 `position: fixed` 子元素的包含块**。里面会渲染菜单、对话框的容器(侧栏、主区、`.chat`)不要加,模糊只加在叶子级的浮层上。-- 关掉毛玻璃(`<html data-glass="off">`:设置 › 外观 › 毛玻璃效果;跟随系统时看"降低透明度" `prefers-reduced-transparency`),材质换成接近实色、`--glass-filter*` 变成 `none`,层次靠浮层的细边和投影。+- **`backdrop-filter` 和 `transform` 会让元素变成 `position: fixed` 子元素的包含块**。对话框(`.scrim`)还是渲染在原地的,所以侧栏、主区、`.chat` 不要加;下拉不受影响,`Popover` 挂在 `<body>` 下。+- 系统开了"降低透明度"(`prefers-reduced-transparency`,解析成 `<html data-glass="off">`)时,盖在内容上的几样换成实色、`--glass-filter*` 变成 `none`。不做成用户设置:材质本来就几乎不透,开关看不出差别(用户 2026-11-03 定的,Cursor 也没有这个选项)。- **模糊只给浮层**:对话框、命令面板后面的遮罩只压暗、不模糊——对话框自己的玻璃已经模糊了一层,两层叠在一起既糊又费 GPU。## 容器与层次-一句话:**成组靠底色和间距,不靠描边;一组里面不再套一组。**+一句话:**成组靠底色和间距,不靠描边;一组里面不再套一组;投影只给真正浮在内容上的东西。**-| 层 | 是什么 | 怎么画 |-|---|---|---|-| 面板 | 主区、信息面板(浮在环境光上) | `--surface` / `--glass-panel` + `--shadow-pane`(带 .5px 的边:浅色下面板和环境光只差 1.1:1)、`--r-pane` |-| 一组(只有这一层) | 设置分组 `.list`、对话里的提问 / 审批卡 `.card`、代码块、文件、模板卡、行内提示、信息面板里展开的编辑区和待审批 | `--well` 底色 + `--r-well`,**不描边、不加投影**;可点的组悬停 `--well-hover`、按下 `--well-press` |-| 组里的东西 | 行、命令、选项、按钮、输入框 | 直接排在组里:行与行之间一条 `--line-2` 细线(真需要分开时才加);命令就是一行等宽字;选项是可悬停的行 |-| 浮层 | 对话输入框、回到底部、菜单、命令面板、对话框、提示胶囊、引导页卡片 | 玻璃材质(见「材质」):`--glass-edge` 细边 + 投影是浮层自己的边,不另加描边 |+| 层 | 是什么 | 底色 | 边 | 投影 |+|---|---|---|---|---|+| 0 窗口 | 窗口底色、侧栏 | `--bg` | 无 | 无 |+| 1 面板 | 主区、信息面板、引导页卡片 | `--surface` / `--glass-panel` | 一道细线 `--shadow-pane` | 无 |+| 2 组(只有这一层) | 设置分组 `.list`、提问 / 审批卡 `.card`、代码块、文件、模板卡、行内提示、展开的编辑区 | `--well`,可点的组悬停 `--well-hover`、按下 `--well-press` | 无 | 无 |+| 组里的东西 | 行、命令、选项、按钮、输入框 | 直接排在组里,行与行之间一条 `--line-2` | 只有输入框有 | 无 |+| 顶栏 | 盖在滚动内容上 | `--glass-chrome` | 滚动后下面一条细线 | 无 |+| 3 常驻浮件 | 对话输入框、回到底部、提示胶囊 | `--glass-float` / `--glass-pop` | 一道细线 | `--shadow-float`,很淡 |+| 4 临时弹出 | 菜单、引导卡片、窄窗口的抽屉 | `--glass-pop` | 一道细线 | `--shadow-pop` |+| 5 模态 | 对话框、命令面板,后面有遮罩 | `--glass-sheet` / `--glass-pop` | 一道细线 | `--shadow-modal` |-- **不嵌套**:`--well` 里不再放 `--well`、卡片或描边框。审批卡里的 `write_file …` 就是一行等宽字;选项字母平时只是一列字,选中才填成一块(这是状态,不是容器);图标不套底片(模板卡选中时图标亮成黄绿片,也是状态)。对话框里不再套卡片:"更换密钥"的表单直接排在对话框的内边距里。信息面板上的行直接排在面板上,只有展开的编辑区和待审批是一层 `--well`。+- **选中、悬停都是平的**:侧栏行、设置导航是同一种灰深一级(`--side-hover` → `--side-active`),没有投影、不浮起。+- **一层只有一种写法**:要加新东西时先想它在第几层,照那一层写,不要自己调投影。+- **深色下越往上越亮**:`--bg` → `--surface` → `--glass-float` / `--glass-pop` → `--glass-sheet`,投影只是辅助。++- **不嵌套**:`--well` 里不再放 `--well`、卡片或描边框。审批卡里的 `write_file …` 就是一行等宽字;选项字母平时只是一列字,选中才填成一块(这是状态,不是容器);图标不套底片(模板卡选中时图标换成主操作色的一片,也是状态)。对话框里不再套卡片:"更换密钥"的表单直接排在对话框的内边距里。信息面板上的行直接排在面板上,只有展开的编辑区和待审批是一层 `--well`。- **描边只给两种东西**:1. 文字输入框 `.field`:`--ctl-edge`,对它可能落在的每一种表面(主区、信息面板、对话框、`--well`)都 ≥ 3:1(两个主题都约 3.2:1),底色透明;悬停 `--ctl-edge-hover`,聚焦换 accent + `--ring`。这是界面里唯一常驻的边——看到边就知道"这里能打字"。- 2. 浮层玻璃的细边 `--glass-edge`,以及黄绿填充面的墨色细边 `--accent-line`(黄绿在白底上只有 1.15:1:应用标志、"已保存"、选中模板的图标)。+ 2. 浮层玻璃的细边 `--glass-edge`,以及应用标志的墨色细边 `--brand-line`(黄绿在白底上只有 1.15:1)。- **分隔线**只用在行与行之间(列表行、表格行、菜单分隔、正文 `hr`、"用时"下面),≤ 1px 的 `--line-2`(表头下沿用 `--line`)。表格不画格子:没有外框、竖线和表头底色,第一列贴着正文左边。- **不加侧边色条**:提示 `.notice` 是一行淡底(`--red-wash` / `--amber-wash` / `--well`)+ 左边一个图标 + `--fg` 的字(在淡底上 ≥ 14:1);语气靠图标颜色,不要"淡红底 + 红边 + 左侧粗红条",也不要淡红底上的红字(对比度不够)。引文 `blockquote` 的灰色竖线是排版记号,可以留。-- **描边和投影不叠在同一个元素上**:内容里的组两样都不要;浮层只有"玻璃细边 + 投影"这一种写法;侧栏选中项、分段 thumb、开关圆钮只有投影。+- **描边和投影不另外叠加**:内容里的组两样都不要;浮层只用上面那三档(细线已经在里面);分段 thumb、开关圆钮只有 `--seg-edge`。- **状态用点,不用彩色胶囊**:`.badge` 是"状态点 + 文字"(和设置页的「● 已连接」同一种写法);只有计数 `.badge.count` 保留一小块底。- **小标签**:分组名、菜单分组一律 `.t-label`(11px semibold、`--muted`),不全大写、不加字距、不用 `--faint`(读不清)。- **同一种面同一个圆角**:`--r-well`(12)、`--r-pane`(14)、`--r-bubble`(20)。@@ -164,7 +176,7 @@ ui/components/ui.js 组件的 JS 写法:Icon Button IconButton Notice Ske**可交互的东西要认得出来**(非文字对比度 ≥ 3:1,或者有等效的提示):- 输入框:`--ctl-edge` 本身 ≥ 3:1。-- 对话输入框是浮层,认得出它靠浮起的投影、常显的占位文字(`--placeholder`,3:1)、工具栏和发送钮、固定在底部的位置,输入时投影变大;侧栏搜索框靠放大镜图标 + 占位文字 + 底色,聚焦时 accent 描边 + 光晕。+- 对话输入框认得出它靠一道细边、常显的占位文字(`--placeholder`,3:1)、工具栏和发送钮、固定在底部的位置,输入时边深一级;侧栏搜索框靠放大镜图标 + 占位文字 + 底色,聚焦时一道 `--line-strong` 的边。- 按钮、分段、开关、下拉靠文字和填充;键盘焦点一律 2px accent 描边(`:focus-visible`),输入框是 accent 描边 + `--ring`。真的需要一道边时,在**同一行**写 `/* 描边:理由 */`,守卫测试认这个注释(`ui/` 下除 token 文件外的所有 CSS)。@@ -175,16 +187,16 @@ ui/components/ui.js 组件的 JS 写法:Icon Button IconButton Notice Ske| 状态 | 怎么表现 | 用什么 ||---|---|---|-| 悬停 | 叠一层半透明,静默控件的字从 `--ctl-fg` 变 `--fg`;可点的组(模板卡)底色深一级,不浮起、不加描边 | `--pill` → `--pill-hover`,`--well` → `--well-hover`;侧栏里也是一层淡灰 `--side-hover`(侧栏本来就接近白色,再亮一层看不出来),和选中的白色玻璃片一暗一亮 |-| 按下 | 再深一级,并轻微缩小(`--press` / `--press-strong`);列表行只变色不缩放 | `--pill-press`、`--sel-press`、`--side-press` |+| 悬停 | 叠一层半透明,静默控件的字从 `--ctl-fg` 变 `--fg`;可点的组(模板卡)底色深一级,不浮起、不加描边 | `--pill` → `--pill-hover`,`--well` → `--well-hover`;侧栏里是一层淡灰 `--side-hover` |+| 按下 | 再深一级,不缩小、不回弹 | `--pill-press`、`--sel-press`、`--side-press` || 键盘焦点 | `:focus-visible` 2px `--accent` 描边;输入框是描边 + 光晕 | `--focus-offset`、`--ring` || 打开 | 菜单展开时触发它的按钮保持"按住"的样子,箭头翻转,加号转成叉 | `[aria-expanded="true"]`,`.icon-btn.on` |-| 选中 / 当前 | 侧栏行和设置导航是浮起的玻璃片;菜单当前项打勾;模板卡铺一层 `--accent-wash`、图标亮成黄绿片;头像选择是底色深一级 + 名字变实(头像在"听")。都不描边 | `--side-active` + `--shadow-tile`,`--accent-wash`,`--pill-press` |-| 禁用 | `--o-disabled`,不响应悬停和按下;主按钮和发送钮退成中性灰(半透明的墨色或黄绿会发浑) | `:disabled` |+| 选中 / 当前 | 侧栏行和设置导航是同一种灰深一级,没有投影;菜单当前项打勾;模板卡底色深一级、图标换成主操作色的一片;头像选择是底色深一级 + 名字变实(头像在"听")。都不描边 | `--side-active`,`--well-press`,`--pill-press` |+| 禁用 | `--o-disabled`,不响应悬停和按下;主按钮和发送钮退成中性灰(半透明的主操作色会发浑) | `:disabled` || 加载 | 转圈,颜色不变,只是不可点(`aria-busy`) | `Button loading` || 错误 | 红描边,聚焦时红光晕 | `.err` / `aria-invalid`,`--ring-danger` || 只读 | 次级底,聚焦不发光 | `[readonly]` |-| 滚动边缘 | 内容滚到顶栏底下时,顶栏才出现细线和投影 | `.chat.scrolled` |+| 滚动边缘 | 内容滚到顶栏底下时,顶栏才出现一条细线 | `.chat.scrolled` |## 分隔条@@ -195,7 +207,7 @@ ui/components/ui.js 组件的 JS 写法:Icon Button IconButton Notice Ske| 位置 | 就是面板之间那道 `--pane-gap` 空隙,分隔条的中线落在空隙正中;能抓住的宽度 `--split-hit`(12)比空隙宽一点,两边各探进面板 2px。Electron 里是 `no-drag`,盖在顶栏的拖动区上也抓得住 || 平时 | 看不见,指针移上去只变成 ↔(`col-resize`) || 悬停 | 停住 `--dur-intent` 后空隙中间从中点长出一道 2px 的细线 `--split-line`;只是划过去不闪,移开立刻消失。细线只画在面板直边那一段(上下让出 `--pane-gap + --r-pane`) |-| 拖动 | 细线换成 `--split-line-on`(`--accent`:浅色墨、深色黄绿);整个窗口都是 ↔、不会选中文字(`<html data-resizing>`);宽度跟手(直接写 CSS 变量,不经过渲染,列宽不过渡);离默认宽度 6px 以内吸附回默认;到了最窄 / 最宽,指针换成单向箭头 |+| 拖动 | 细线换成 `--split-line-on`(`--accent`:浅色墨、深色近白);整个窗口都是 ↔、不会选中文字(`<html data-resizing>`);宽度跟手(直接写 CSS 变量,不经过渲染,列宽不过渡);离默认宽度 6px 以内吸附回默认;到了最窄 / 最宽,指针换成单向箭头 || 范围 | `--side-w-min … min(--side-w-max, --side-w-cap)`(220 … 400,且不超过窗口的 36%),信息面板 `--panel-w-min … min(--panel-w-max, --panel-w-cap)`(280 … 440,34%);拖动时还要给主区留至少 `--main-w-min` || 恢复 | 双击分隔条恢复默认宽度,列宽用 `--dur-slow` + `--ease-spring` 滑回去 || 键盘 | `role="separator"`,可以 Tab 到;焦点就是那道 accent 细线(不画外描边)。← → 一次 8px、Shift 一次 32px,Home / End 最窄 / 最宽,Enter 恢复默认 |@@ -228,8 +240,8 @@ ui/components/ui.js 组件的 JS 写法:Icon Button IconButton Notice Ske| `data-font` | `system / serif / custom` | `--font`;`custom` 时 `prefs.js` 在 `<html>` 上内联 `--font: "自定义", var(--font-system)`。自定义代码字体同样内联 `--code` || `data-width` | `normal / wide / full` | `--col-w`、`--bubble-w`(对话列和输入框) || `data-code-wrap` | `on / off` | `--code-wrap`(代码块的 `white-space`) |-| `data-glass` | `on / off` | 材质(见「材质」) |-| `data-motion` | `full / reduce / off` | `--motion`、`--press*`、`--dur-*`(见「动效」) |+| `data-glass` | `on / off` | 不是用户设置,只跟随系统的"降低透明度";翻译成材质(见「材质」) |+| `data-motion` | `full / reduce / off` | `--motion`、`--dur-*`(见「动效」) |- 首帧前 `index.html` 的内联脚本按同样的规则先套一遍,避免闪;改解析规则时它和 `prefs.js` 的 `apply()` 一起改。- "跟随系统"在 JS 里解析:属性永远是解析后的值,CSS 里不写 `@media (prefers-reduced-*)`。@@ -239,13 +251,13 @@ ui/components/ui.js 组件的 JS 写法:Icon Button IconButton Notice Ske每个组件把可调的地方开放成自己的变量。**变体、尺寸和上下文覆盖都只改变量,不改属性**:```css-.btn.primary { --btn-bg: var(--accent-solid); --btn-fg: var(--on-accent); … } /* 变体 */+.btn.primary { --btn-bg: var(--primary); --btn-fg: var(--on-primary); … } /* 变体 */.notice .btn { --btn-h: var(--ctl-sm); --btn-px: var(--space-2-5); } /* 上下文 */```| 组件 | 类名 API | 变量 ||---|---|---|-| 按钮 | `.btn [primary\|ghost\|danger] [sm\|lg] [block]` | `--btn-h --btn-px --btn-r --btn-fs --btn-bg --btn-bg-hover --btn-bg-press --btn-fg --btn-fg-hover --btn-edge` |+| 按钮 | `.btn [primary\|ghost\|danger] [sm\|lg] [block]` | `--btn-h --btn-px --btn-r --btn-fs --btn-bg --btn-bg-hover --btn-bg-press --btn-fg --btn-fg-hover` || 毛玻璃 | `.glass`(组件自己是玻璃时直接写三行,见「材质」) | `--glass-bg --glass-blur --glass-shadow` || 图标 | `Icon`(`svg.ic [ic-xs\|ic-sm\|ic-md\|ic-lg\|ic-xl] [ic-strong]`),见下文「图标」 | `--ic-size --ic-w` || 图标按钮 | `.icon-btn [xs] [on]`;`IconButton` 的 `iconSize` 缺省 `sm` | `--ib-size --ib-r --ib-fg --ib-fg-hover --ib-bg-hover --ib-bg-on --ib-bg-press` |@@ -254,12 +266,12 @@ ui/components/ui.js 组件的 JS 写法:Icon Button IconButton Notice Ske| 状态 / 计数 / 点 | `.badge [ok\|err\|warn\|off]`(状态点 + 文字),`.badge.count [warn]`(计数,唯一带底的徽标),`.dot [ok\|err\|warn]` | `--badge-fg`(点的颜色;计数的字色)`--badge-bg`(只对计数),`--dot-bg` || 列表行 | `.list > .row [compact] [clickable] [off] [flash]`,`.row-edit`,`.list-head`;`.list` 是一块 `--well`,行间 `--line-2` | `--row-h --row-py --row-pl --row-pr --row-gap` || 分段 | `Seg` 组件(`.seg > .thumb + button`),两个以上的选项 | `--seg-r --seg-pad --seg-thumb --seg-on` |-| 开关 | `Switch` 组件(`button.switch[role=switch] [sm]`),只有开 / 关 | `--switch-w --switch-h --switch-pad --switch-track --switch-track-hover --switch-dot --switch-stretch` |+| 开关 | `Switch` 组件(`button.switch[role=switch] [sm]`),只有开 / 关 | `--switch-w --switch-h --switch-pad --switch-track --switch-track-hover --switch-dot` || 档位滑块 | `Stops` 组件(`.stops[role=slider] [custom] > .stops-fill + .stops-dot + .stops-knob`),几档离散的值;`value = -1` 不在任何一档上 | `--stops-h --stops-pad --stops-track --stops-fill-bg --stops-knob-bg --stops-dot-bg --stops-dot-on` |-| 菜单 | `.pick`,`.pop [up]`,`.palette`,`Menu` / `MenuButton` / `Popover` | `--pop-r --pop-pad` |-| 对话框 | `Sheet` / `confirmSheet()`(`.scrim > .sheet [wide]`) | `--sheet-w --sheet-r` |+| 菜单 | `.pick`,`.pop`,`.palette`,`Menu` / `MenuButton` / `Popover`。`Popover` 挂在 `<body>` 下,滚动时跟着锚点,只淡入 | `--pop-r --pop-pad` |+| 对话框 | `Sheet` / `confirmSheet()`(`.scrim > .sheet [wide]`);标题行右边是关闭钮(确认框没有);扫码、等待授权的内容放在 `.qr-flow` 里居中 | `--sheet-w --sheet-r` || 分隔条 | `Splitter`(`.splitter [dragging]`),见下文「分隔条」 | `--split-x --split-hit --split-line-w --split-inset --split-line-on`;悬停色是语义 token `--split-line` |-| 提示胶囊 | `toast()` / `saved()` / `failed()`(`.toast [ok\|err\|warn]`) | `--toast-bg --toast-fg --toast-edge` |+| 提示胶囊 | `toast()` / `saved()` / `failed()`(`.toast [ok\|err\|warn]`) | `--toast-bg --toast-fg` || 行内提示 | `Notice`(自带图标)/ `.notice [amber\|red]`:淡底 + 图标 + `--fg` 字,不描边 | `--notice-bg --notice-ic` || 加载 | `Spinner`、`Skeleton`(`.skel [circle]`)、`.empty-state` | — || 头像 | `BotAvatar [bot\|char] [state] [cue] [lively] [pokeable] [greet] [neutral]`、`AvatarPicker`、`AppMark`;6 个内置角色,见下文「头像」 | `--avatar-aura --avatar-shadow`(主题),角色颜色 `--bot-*`(原画色,两个主题相同) |@@ -278,7 +290,7 @@ JS 组件(`ui/components/ui.js`)只是给常用组合一个带逻辑的写| lg | `"lg"` | 20 | 模板卡 || xl | `"xl"` | 24 | 文件卡片 |-- **线宽按显示像素算**:`--ic-stroke`(1.25px)对所有尺寸都一样,12px 的箭头和 24px 的文件图标一样细;`icon.css` 把它换算回画布单位(× 16 / 尺寸)。只有实心面上的图标加 `strong`(`--ic-stroke-strong` 1.6px):发送钮的箭头、完成圆点里的勾——细线压在墨色 / 黄绿上会发虚。不要再传任意的 `stroke`。+- **线宽按显示像素算**:`--ic-stroke`(1.25px)对所有尺寸都一样,12px 的箭头和 24px 的文件图标一样细;`icon.css` 把它换算回画布单位(× 16 / 尺寸)。只有实心面上的图标加 `strong`(`--ic-stroke-strong` 1.6px):发送钮的箭头、完成圆点里的勾——细线压在实心面上会发虚。不要再传任意的 `stroke`。- **只用这五档**,不写 13、15、17 这类中间值。图标和旁边的文字差不多高或略高一点:12.5–13px 的控件文字配 14,侧栏和顶栏配 16。- **上下文改尺寸只改 `--ic-size`**(`.pick .ic { --ic-size: var(--ic-xs) }`),不要直接写 `width / height`——那样线宽会跟着缩放。`icon.css` 全部包在 `:where()` 里,任何上下文选择器都能盖过 `size` 属性。- **实心的小部件**(信息 / 警告的点、省略号、停止方块、调色盘的色点)在 `P` 里写成 `{ s: 描边, f: 实心 }`,用 `dot(x, y, r)` 画圆点,不靠加粗线头冒充圆点。@@ -288,40 +300,38 @@ JS 组件(`ui/components/ui.js`)只是给常用组合一个带逻辑的写| 用途 | 时长 | 缓动 ||---|---|---|-| 悬停、按下、颜色变化 | `--dur-fast` 120ms(`--t-fast`) | `--ease-out` |-| 出现 / 消失、提示胶囊、遮罩 | `--dur-base` 180ms | 入场 `--ease-out`,退场 `--ease-in` |-| 视图切换、面板、分段 thumb | `--dur-moderate` 240ms | `--ease-out` |-| 布局滑动:信息面板开合、分隔条恢复默认 / 键盘调宽 | `--dur-slow` 360ms | `--ease-spring` |+| 悬停、按下、颜色变化,下拉菜单出现 | `--dur-fast` 100ms(`--t-fast`) | `--ease-out` |+| 出现 / 消失、提示胶囊、对话框、视图切换 | `--dur-base` 140ms | 入场 `--ease-out`,退场 `--ease-in` |+| 分段 thumb | `--dur-moderate` 180ms | `--ease-out` |+| 布局滑动:信息面板开合、分隔条恢复默认 / 键盘调宽 | `--dur-slow` 240ms | `--ease-spring` || 悬停意图:停住多久才亮起提示(分隔条的细线) | `--dur-intent` 240ms | 只延迟出现,移开立刻消失 |-| 对话框 / 弹出层的弹性入场 | `--dur-slow` 360ms / `--dur-slower` 420ms | `--ease-spring` || 循环(转圈、骨架、文字微光、呼吸、光标) | `--dur-spin --dur-shimmer --dur-sheen --dur-pulse --dur-blink` | `linear` / `--ease-in-out` |-- **关键帧库**(`base/motion.css`):`fade-in/out`、`rise-in`、`sink-out`、`slide-in/out`、`pop-in/out`、`scale-in`、`bump`、`flash`、`spin`、`shimmer`、`sheen`(文字微光,配 `background-clip: text`)、`breathe`、`blink`。关键帧只描述起止,时长缓动由使用处给 token。-- **位移量是 token**:`--rise`、`--slide`、`--pop-dy`、`--pop-scale`、`--scale-from`,组件可以局部覆盖(`.toast { --rise: 6px }`)。-- **减少 / 关闭动画**:看 `<html data-motion>`(`full | reduce | off`,设置 › 外观 › 动画;跟随系统时看 `prefers-reduced-motion`)。关键帧里的位移都乘以 `--motion`;`reduce` 时 `--motion: 0`,所有入场自动退化成纯淡入,按下不缩放,过渡几乎瞬时;`off` 时 `--dur-fast … --dur-slower` 也变成 `--dur-off`,出现 / 消失 / 视图切换瞬时完成,只留转圈、骨架、光标这类"正在进行"的循环和定位闪烁。新写的关键帧也要乘 `--motion`;CSS 里不要再写 `@media (prefers-reduced-motion)`,JS 用 `reducedMotion()`(`design/motion.js`)。-- **退场动画**:用 `usePresence(open)`(`design/motion.js`)让组件在退场时长内保持挂载,并给元素加 `.leaving` / `.anim-*-out`。`DialogHost` 是参考实现。+- **简约**(用户 2026-11-03 要求):出现 / 消失只淡入淡出,不位移、不缩放、不回弹;按下只深一级底色。唯一的位移是窄窗口的信息面板抽屉;机器人头像的动作不算在内。+- **关键帧库**(`base/motion.css`):`fade-in/out`、`slide-in/out`(只给抽屉)、`flash`、`spin`、`shimmer`、`sheen`(文字微光,配 `background-clip: text`)、`breathe`、`blink`。关键帧只描述起止,时长缓动由使用处给 token。+- **减少 / 关闭动画**:看 `<html data-motion>`(`full | reduce | off`,设置 › 外观 › 动画;跟随系统时看 `prefers-reduced-motion`)。抽屉的位移乘以 `--motion`;`reduce` 时 `--motion: 0`,抽屉退化成纯淡入,过渡几乎瞬时;`off` 时 `--dur-fast … --dur-slow` 也变成 `--dur-off`,出现 / 消失 / 视图切换瞬时完成,只留转圈、骨架、光标这类"正在进行"的循环和定位闪烁。新写的关键帧也要乘 `--motion`;CSS 里不要再写 `@media (prefers-reduced-motion)`,JS 用 `reducedMotion()`(`design/motion.js`)。+- **退场动画**:用 `usePresence(open)`(`design/motion.js`)让组件在退场时长内保持挂载,并给元素加 `.leaving` / `.anim-*-out`。`DialogHost` 是参考实现。列表里的行增删用 `useListPresence(items)`:新行淡入,删掉的行留在原位淡出,见侧栏的机器人列表。- **JS 里不写死毫秒数**:`ms("--dur-base")` 读 token(toast 的移除时机就是这样同步的)。- **每个动画都要有明确的表意**:只用来表达状态变化(出现 / 消失、选中、成功 / 失败)、对操作的反馈、真实在进行的过程(加载、生成、传输)、机器人的状态。**严禁背景 / 装饰层的动画**——背景、光晕、边框、纹理一律静止:不做自己循环的光圈 / 光框扩散("隧道"、涟漪、雷达波)、呼吸的光晕、沿边框巡游的扫光、漂浮的光斑 / 粒子、跟随指针的点阵 / 聚光灯。说不出"它在告诉用户什么"的动画一律不加(官网同一条,见 `site/README.md`)。- 只给 `transform` 和 `opacity` 做动画;空闲列表保持安静(头像空闲时只在指针靠近时看过去、悬停时抖一下天线,不自己动)。唯一的例外是对话里很快答完时工作状态行的收起(`.work.gone`,grid `1fr → 0fr`,只播一次),为的是正文不跳。-**对话流的编排**(`ui/css/chat.css`):发出 → 思考 → 输出 → 收尾,每一步只动一样东西,幅度小,循环都放慢、对比只差一档,余光里知道"在动"就够了。+**对话流的编排**(`ui/css/chat.css`):发出 → 思考 → 输出 → 收尾,每一步只动一样东西,只淡入淡出,循环都放慢、对比只差一档,余光里知道"在动"就够了。| 环节 | 动什么 | 怎么动 ||---|---|---|-| 发出 | 你的气泡 | `fade-in`(base)+ `pop-in`(slow,spring),从下方 12px、缩放 .96,原点右下角(从发送钮那边送出去) |-| 思考 | 工作状态行 | 比气泡晚 `--stagger` 淡入;"思考中"是 `sheen` 微光:`--muted` 底上一道 `--fg-2` 的光,`--dur-sheen` 扫过去再停一拍 |+| 发出 | 你的气泡 | `fade-in`(base) |+| 思考 | 工作状态行 | 比气泡晚 `--stagger` 淡入;"思考中"是 `sheen` 微光 || 输出 | 新段落 / 列表项 | 新挂载的块淡入(moderate),已在的不重播;最后一段末尾一个 `breathe` 小点(代码块、表格结尾不画) || 收尾 | 状态行、操作 | "用时"换字淡入、细线淡入;短于 3 秒的整行平滑收起;最后一条回复的复制 / 时刻晚一拍淡入 |-| 插入 | 提问 / 审批卡、出错提示 | `rise-in`(6px,moderate) |-| 说话与交付 | 模型在回合中间说的话、交付的文件 | 说的话按顺序写进回复正文(同"输出"),处理过程里不再重复;文件挂在正文下面,回合中交付时 `rise-in`,图片读完前先占一小块 `--well` |-| 输入框 | 投影、发送钮 | 聚焦时投影 moderate 长大;空时箭头小一号,有字时 `--ease-back` 回弹到位;发出后停止方块 `scale-in`,结束后箭头 `rise-in` 升回(只在发过之后);点发送 / 停止不抢输入框焦点 |-| 其他 | 首次加载、回到底部 | 历史读到后整列淡入一次;回到底部 `rise-in` 出现、`sink-out` 退场,新消息点 `scale-in` |+| 插入 | 提问 / 审批卡、出错提示、交付的文件 | `fade-in` |+| 输入框 | 边、发送钮 | 聚焦时边深一级;发送、停止互换时图标淡入;点发送 / 停止不抢输入框焦点 |+| 其他 | 首次加载、回到底部 | 历史读到后整列淡入一次;回到底部淡入淡出 |## 头像-6 个内置毛绒角色(原图在 `anymodelbot_design/logo avator/`),蓝色的**天天是默认头像**:默认机器人、新建页的默认选择、启动和连接页的吉祥物都是它。+内置毛绒角色分两组:6 个基础角色(原图在 `anymodelbot_design/logo avator/`)和 12 个领域专家(原图在它下面的 `专家/`)。蓝色的**天天是默认头像**:默认机器人、新建页的默认选择、启动和连接页的吉祥物都是它。-角色只决定长相和小动作,不决定机器人做什么:不要给角色写岗位或"适合配给谁",模板也不绑定角色。+角色只决定长相和小动作,不决定机器人做什么:不要给基础角色写岗位或"适合配给谁",模板也不绑定角色。领域专家的形象带领域(用户 2026-11-03 要的),选了也只换长相,人设、模型和能力不变。| 角色 | key | 招牌动作 ||---|---|---|@@ -332,7 +342,24 @@ JS 组件(`ui/components/ui.js`)只是给常用组合一个带逻辑的写| 晶晶 | `purple` | 宝石浮起来转、霓虹线一明一暗 || 飞飞 | `orange` | 眼睛大范围搜寻、护目镜反光 |-- **选择**:机器人设置的 `settings.avatar`(新建页和机器人设置里选);没选过时 `charOf(bot)` 由 id 稳定地挑一个,`default` 机器人是天天。+领域专家(选择器里单独一组,名字下面写领域):++| 角色 | key | 领域 | 招牌动作 |+|---|---|---|---|+| 衡衡 | `law` | 法律 | 天平左右晃 |+| 安安 | `health` | 医疗健康 | 爱心一跳一跳 |+| 元元 | `finance` | 金融 | 金币闪一下,完成时翻两圈 |+| 码码 | `code` | 编程 | 霓虹线一明一暗(发光层),完成时闪三下 |+| 彩彩 | `design` | 设计 | 调色盘左右晃 |+| 墨墨 | `writing` | 写作 | 羽毛被风吹,完成时竖高一点 |+| 学学 | `education` | 教育 | 帽子不动:流苏垂到头上,帽子一动就断开 |+| 泡泡 | `science` | 科研 | 烧瓶一亮一亮,完成时长高一点 |+| 数数 | `data` | 数据分析 | 柱子一亮一亮,完成时长高一点 |+| 响响 | `marketing` | 营销 | 喇叭跟着节拍震 |+| 香香 | `cooking` | 烹饪 | 厨师帽左右晃 |+| 通通 | `translate` | 翻译 | 地球仪慢慢转,完成时转两圈 |++- **选择**:机器人设置的 `settings.avatar`(新建页和机器人设置里选);没选过时 `charOf(bot)` 由 id 稳定地在基础角色里挑一个(不能用全部角色,否则加角色时老机器人的头像会变),`default` 机器人是天天。- **持续状态** `state`:`idle`、`listening`(你在输入)、`thinking`(还没出字)、`replying`、`working`(后台任务)、`waiting`(等你批准)、`sleep`(连不上本机服务)。- **一次性反应** `cue={ kind, at }`:`hello`(新建 / 打招呼,`greet` 在挂载时播)、`done`(忙 → 不忙时自动播)、`error`、以及戳头像触发的 `poke` / `love`(连戳三下)/ `dizzy`(戳六下)。时长是 `tokens/motion.css` 的 `--bot-*`。- **lively**:只给大头像(空态、新建页、启动页):呼吸、眨眼、四处看、脚下有影子。小于 36px 不画粒子。diff --git a/ui/design/base/motion.css b/ui/design/base/motion.cssindex edbacb6..ce76881 100644--- a/ui/design/base/motion.css+++ b/ui/design/base/motion.css@@ -1,18 +1,10 @@-/* 关键帧库 + 动画工具类。关键帧只描述"从哪来/到哪去",时长和缓动由使用处给 token。+/* 关键帧库 + 动画工具类。出现 / 消失只有淡入淡出(抽屉的 slide 除外),时长和缓动由使用处给 token。位移乘以 --motion:减少动态效果时只剩淡入淡出。 */@keyframes fade-in { from { opacity: 0; } }@keyframes fade-out { to { opacity: 0; } }-@keyframes rise-in { from { opacity: 0; transform: translateY(calc(var(--rise) * var(--motion))); } }-@keyframes sink-out { to { opacity: 0; transform: translateY(calc(var(--rise) * var(--motion))); } }@keyframes slide-in { from { opacity: 0; transform: translateX(calc(var(--slide) * var(--motion))); } }@keyframes slide-out { to { opacity: 0; transform: translateX(calc(var(--slide) * var(--motion))); } }-/* 弹出层:只管位移与缩放,配合 fade-in 一起用(两者时长不同) */-@keyframes pop-in { from { transform: translateY(calc(var(--pop-dy) * var(--motion))) scale(calc(1 - (1 - var(--pop-scale)) * var(--motion))); } }-/* 小东西原地出现:图标替换、提示点 */-@keyframes scale-in { from { opacity: 0; transform: scale(calc(1 - (1 - var(--scale-from)) * var(--motion))); } }-@keyframes pop-out { to { opacity: 0; transform: translateY(calc(var(--pop-dy) * var(--motion) / 2)) scale(calc(1 - (1 - var(--pop-scale)) * var(--motion) / 2)); } }/* 一次性反馈 */-@keyframes bump { 40% { transform: scale(calc(1 + .12 * var(--motion))); } }@keyframes flash { 0%, 35% { background: var(--mark); } }/* 循环 */@keyframes spin { to { transform: rotate(360deg); } }@@ -24,16 +16,10 @@/* 工具类:可用 --anim-dur / --anim-ease / --anim-delay 微调 */.anim-fade-in { animation: fade-in var(--anim-dur, var(--dur-base)) var(--anim-ease, var(--ease-out)) var(--anim-delay, 0s) both; }-.anim-rise-in { animation: rise-in var(--anim-dur, var(--dur-moderate)) var(--anim-ease, var(--ease-out)) var(--anim-delay, 0s) both; }.anim-slide-in { animation: slide-in var(--anim-dur, var(--dur-moderate)) var(--anim-ease, var(--ease-out)) var(--anim-delay, 0s) both; }-.anim-scale-in { animation: scale-in var(--anim-dur, var(--dur-slow)) var(--anim-ease, var(--ease-spring)) var(--anim-delay, 0s) both; }-.anim-pop-in { animation: fade-in var(--dur-base) var(--ease-out), pop-in var(--anim-dur, var(--dur-slower)) var(--anim-ease, var(--ease-spring)); }.anim-fade-out { animation: fade-out var(--anim-dur, var(--dur-base)) var(--anim-ease, var(--ease-in)) forwards; pointer-events: none; }.anim-slide-out { animation: slide-out var(--anim-dur, var(--dur-base)) var(--anim-ease, var(--ease-in)) forwards; pointer-events: none; }-.anim-sink-out { animation: sink-out var(--anim-dur, var(--dur-base)) var(--anim-ease, var(--ease-in)) forwards; pointer-events: none; }-.anim-pop-out { animation: pop-out var(--anim-dur, var(--dur-base)) var(--anim-ease, var(--ease-in)) forwards; pointer-events: none; }.anim-flash { animation: flash var(--dur-flash) var(--ease-out); }-.anim-bump { animation: bump var(--dur-slow) var(--ease-out); }/* 减少 / 关闭动画(<html data-motion>,见 tokens/motion.css):过渡几乎瞬时,不平滑滚动 */:root:is([data-motion="reduce"], [data-motion="off"]) :is(*, ::before, ::after) { transition-duration: var(--dur-off) !important; scroll-behavior: auto !important; }diff --git a/ui/design/base/reset.css b/ui/design/base/reset.cssindex ee2deed..503f0a7 100644--- a/ui/design/base/reset.css+++ b/ui/design/base/reset.css@@ -19,7 +19,7 @@ button { font: inherit; color: inherit; background: none; border: 0; padding: 0;input, textarea { font: inherit; color: inherit; }a { color: var(--accent); text-decoration: none; }a:hover { text-decoration: underline; }-/* 荧光笔:选中文字用品牌黄绿 */+/* 选中文字:一层中性灰 */::selection { background: var(--mark); color: var(--on-mark); }code, .mono { font-family: var(--code); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }/* 键盘焦点:2px accent 描边,外移 2px(描边跟着圆角走)。@@ -27,5 +27,5 @@ code, .mono { font-family: var(--code); font-size: var(--fs-xs); font-variant-nubutton:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible, [tabindex]:focus-visible {outline: 2px solid var(--accent); outline-offset: var(--focus-offset, 2px);}-/* 滚动条:细、半透明,盖在玻璃和环境光上都不突兀(macOS 的浮动滚动条不受影响) */+/* 滚动条:细、半透明,盖在玻璃和窗口底色上都不突兀(macOS 的浮动滚动条不受影响) */* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }diff --git a/ui/design/components/button.css b/ui/design/components/button.cssindex a30bdf8..5815e20 100644--- a/ui/design/components/button.css+++ b/ui/design/components/button.css@@ -1,6 +1,6 @@/* 按钮。.text 改编自 yetone/magpie internal/gui/assets/app.css(MIT,© 2026 yetone)。定制方式:在变体或上下文里覆盖 --btn-* / --ib-* 变量,不要直接改属性。- 状态(见 README「状态」):悬停叠一层、按下再深一级并轻微缩小、键盘焦点外描边、禁用变淡且不响应、+ 状态(见 README「状态」):悬停叠一层、按下再深一级(不缩小)、键盘焦点外描边、禁用变淡且不响应、加载(aria-busy)保持本色只是不可点。 *//* —— .btn [primary | ghost | danger] [sm | lg] [block] —— */@@ -14,34 +14,33 @@--btn-bg-press: var(--pill-press);--btn-fg: var(--fg);--btn-fg-hover: var(--btn-fg);- --btn-edge: 0 0 transparent;display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1-5);height: var(--btn-h); padding: 0 var(--btn-px); border-radius: var(--btn-r);font-size: var(--btn-fs); font-weight: var(--fw-medium); white-space: nowrap;- background: var(--btn-bg); color: var(--btn-fg); box-shadow: var(--btn-edge);- transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast), opacity var(--t-fast);+ background: var(--btn-bg); color: var(--btn-fg);+ transition: background var(--t-fast), color var(--t-fast), opacity var(--t-fast);}.btn:hover:not(:disabled) { background: var(--btn-bg-hover); color: var(--btn-fg-hover); }-.btn:active:not(:disabled) { background: var(--btn-bg-press); transform: scale(var(--press)); }+.btn:active:not(:disabled) { background: var(--btn-bg-press); }.btn:disabled { opacity: var(--o-disabled); }/* 加载中:Button 的 loading 同时设 disabled 和 aria-busy——颜色不变,只是不可点 */.btn[aria-busy="true"] { opacity: 1; cursor: progress; }.btn .spinner { width: 14px; height: 14px; }-/* 主按钮:浅色墨底白字,深色黄绿底墨字;带一道顶边高光 */+/* 主按钮:浅色墨底白字,深色近白底墨字;平的,没有高光和投影 */.btn.primary {--btn-bg: var(--primary); --btn-bg-hover: var(--primary-hover); --btn-bg-press: var(--primary-press);- --btn-fg: var(--on-primary); --btn-edge: var(--primary-edge);+ --btn-fg: var(--on-primary);}-/* 不可用时退成中性灰:半透明的墨色或黄绿都会发浑 */-.btn.primary:disabled:not([aria-busy="true"]) { --btn-bg: var(--pill); --btn-fg: var(--faint); --btn-edge: 0 0 transparent; opacity: 1; }+/* 不可用时退成中性灰:半透明的主操作色会发浑 */+.btn.primary:disabled:not([aria-busy="true"]) { --btn-bg: var(--pill); --btn-fg: var(--faint); opacity: 1; }.btn.ghost { --btn-bg: transparent; --btn-bg-hover: var(--pill); --btn-bg-press: var(--pill-hover); --btn-fg: var(--ctl-fg); --btn-fg-hover: var(--fg); }.btn.danger {--btn-bg: var(--red); --btn-bg-hover: color-mix(in srgb, var(--red) 88%, var(--fg)); --btn-bg-press: color-mix(in srgb, var(--red) 78%, var(--fg));- --btn-fg: var(--on-danger); --btn-edge: inset 0 1px 0 color-mix(in srgb, var(--white) 16%, transparent);+ --btn-fg: var(--on-danger);}.btn.sm { --btn-h: var(--ctl-sm); --btn-px: var(--space-2-5); }-.btn.lg { --btn-h: var(--ctl-xl); --btn-fs: var(--fs-md); --btn-r: var(--r-lg); }+.btn.lg { --btn-h: var(--ctl-xl); --btn-fs: var(--fs-lg); --btn-r: var(--r-lg); }.btn.block { width: 100%; }/* —— 图标按钮 .icon-btn [xs] [on]:on / aria-expanded 是"打开着",比悬停深一级 —— */@@ -55,11 +54,11 @@--ib-bg-press: var(--pill-press);width: var(--ib-size); height: var(--ib-size); border-radius: var(--ib-r); flex: none;display: inline-flex; align-items: center; justify-content: center;- color: var(--ib-fg); transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);+ color: var(--ib-fg); transition: background var(--t-fast), color var(--t-fast);}.icon-btn:hover:not(:disabled) { background: var(--ib-bg-hover); color: var(--ib-fg-hover); }.icon-btn.on:not(:disabled), .icon-btn[aria-expanded="true"]:not(:disabled) { background: var(--ib-bg-on); color: var(--ib-fg-hover); } /* 打开时悬停也保持打开的样子 */-.icon-btn:active:not(:disabled) { background: var(--ib-bg-press); transform: scale(var(--press-strong)); }+.icon-btn:active:not(:disabled) { background: var(--ib-bg-press); }.icon-btn:disabled { opacity: var(--o-disabled); }.icon-btn.xs { --ib-size: 18px; --ib-r: var(--r-sm); }@@ -77,5 +76,5 @@.text.accent { color: var(--accent); }.text.accent:hover:not(:disabled) { color: var(--accent); }-/* 复制成功:变绿并弹一下 */-.icon-btn.copy.done { color: var(--green); background: var(--green-soft); animation: bump var(--dur-slow) var(--ease-out); }+/* 复制成功:变绿 */+.icon-btn.copy.done { color: var(--green); background: var(--green-soft); }diff --git a/ui/design/components/glass.css b/ui/design/components/glass.cssindex 69c26cc..f42fbba 100644--- a/ui/design/components/glass.css+++ b/ui/design/components/glass.css@@ -1,12 +1,12 @@-/* 毛玻璃 .glass:半透明底 + 背景模糊 + 磨砂颗粒 + 顶边高光与细描边。+/* 盖在内容上的一层 .glass:几乎不透的底 + 背景模糊 + 一道细线(和很淡的投影)。材质由三个变量决定(缺省是浮在内容上的输入框材质):--glass-bg 材质色:--glass-chrome | --glass-float | --glass-panel | --glass-pop | --glass-sheet--glass-blur 模糊:--glass-filter-sm | --glass-filter | --glass-filter-lg- --glass-shadow 边与投影:--shadow-float | --shadow-pop+ --glass-shadow 边与投影:--shadow-pane | --shadow-float | --shadow-pop | --shadow-modal组件自己就是玻璃时(.pop .palette .sheet .toast,页面里的顶栏和输入框)直接写同样三行,不必加这个类。注意:backdrop-filter 会让元素成为 position: fixed 子元素的包含块——里面会渲染菜单的容器(侧栏、主区)不要加。 */.glass {- background: var(--grain), var(--glass-bg, var(--glass-float));+ background: var(--glass-bg, var(--glass-float));backdrop-filter: var(--glass-blur, var(--glass-filter));box-shadow: var(--glass-shadow, var(--shadow-float));}diff --git a/ui/design/components/popover.css b/ui/design/components/popover.cssindex 7339acd..97d8ade 100644--- a/ui/design/components/popover.css+++ b/ui/design/components/popover.css@@ -6,27 +6,25 @@.pick {display: inline-flex; align-items: center; gap: var(--space-1); height: var(--ctl-sm); max-width: 260px;padding: 0 var(--space-1-5) 0 var(--space-2-5); border-radius: var(--r-md); background: var(--pill); color: var(--fg);- font-size: var(--fs-sm); transition: background var(--t-fast), transform var(--t-fast);+ font-size: var(--fs-sm); transition: background var(--t-fast);}.pick:hover:not(:disabled), .pick[aria-expanded="true"] { background: var(--pill-hover); }-.pick:active:not(:disabled) { background: var(--pill-press); transform: scale(var(--press)); }+.pick:active:not(:disabled) { background: var(--pill-press); }.pick:disabled { opacity: var(--o-disabled); }.pick .v { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }-.pick .ic { --ic-size: var(--ic-xs); color: var(--muted); transition: transform var(--t-base); }+.pick .ic { --ic-size: var(--ic-xs); color: var(--muted); transition: transform var(--t-fast); }.pick[aria-expanded="true"] .ic { transform: rotate(180deg); }-/* —— 弹出层:从锚点方向(--ox)弹出;向上打开时加 .up —— */+/* —— 弹出层:只淡入,不位移、不缩放。挂在 <body> 下(ui.js 的 Popover),定位不受祖先的 backdrop-filter / transform 影响 —— */.pop {--pop-r: var(--r-xl);--pop-pad: var(--space-1);- position: fixed; z-index: var(--z-popover); width: 280px; max-height: 360px;+ position: fixed; z-index: var(--z-popover); width: 280px; max-height: 360px; -webkit-app-region: no-drag;display: flex; flex-direction: column;- background: var(--grain), var(--glass-pop); backdrop-filter: var(--glass-filter-lg);+ background: var(--glass-pop); backdrop-filter: var(--glass-filter-lg);border-radius: var(--pop-r); box-shadow: var(--shadow-pop); overflow: hidden;- transform-origin: var(--ox, 24px) top;- animation: fade-in var(--dur-base) var(--ease-out), pop-in var(--dur-slower) var(--ease-spring);+ animation: fade-in var(--dur-fast) var(--ease-out);}-.pop.up { transform-origin: var(--ox, 24px) bottom; --pop-dy: 6px; }.pop.model-picker { width: 340px; max-height: 420px; }.pop.model-picker li:not(.group):not(.sep) { min-height: 34px; }@@ -106,12 +104,11 @@.palette {--pop-r: var(--r-pane);--pop-pad: var(--space-1);- position: fixed; z-index: var(--z-palette); left: 50%; top: 14vh; width: min(520px, calc(100vw - 2 * var(--float-inset))); translate: -50% 0;+ -webkit-app-region: no-drag; position: fixed; z-index: var(--z-palette); left: 50%; top: 14vh; width: min(520px, calc(100vw - 2 * var(--float-inset))); translate: -50% 0;max-height: 60vh; display: flex; flex-direction: column;- background: var(--grain), var(--glass-pop); backdrop-filter: var(--glass-filter-lg);- border-radius: var(--pop-r); box-shadow: var(--shadow-pop); overflow: hidden;- --pop-dy: -10px; --pop-scale: .97;- animation: fade-in var(--dur-base) var(--ease-out), pop-in var(--dur-slower) var(--ease-spring);+ background: var(--glass-pop); backdrop-filter: var(--glass-filter-lg);+ border-radius: var(--pop-r); box-shadow: var(--shadow-modal); overflow: hidden;+ animation: fade-in var(--dur-fast) var(--ease-out);}.palette .search input { height: 46px; font-size: var(--fs-lg); }.palette li { min-height: 36px; font-size: var(--fs-md); }diff --git a/ui/design/components/sheet.css b/ui/design/components/sheet.cssindex 137a91f..36e6b2e 100644--- a/ui/design/components/sheet.css+++ b/ui/design/components/sheet.css@@ -3,7 +3,7 @@对话框里不再套卡片:表单、说明直接排在对话框的内边距里。退场时给 .scrim 加 .leaving(见 design/motion.js 的 usePresence)。 */.scrim {- position: fixed; inset: 0; z-index: var(--z-modal); background: var(--scrim);+ position: fixed; inset: 0; z-index: var(--z-modal); background: var(--scrim); -webkit-app-region: no-drag;display: grid; place-items: center; padding: var(--float-inset);animation: fade-in var(--dur-base) var(--ease-out);}@@ -11,16 +11,30 @@--sheet-w: 440px;--sheet-r: var(--r-pane);width: min(var(--sheet-w), 100%); max-height: calc(100vh - 2 * var(--float-inset)); overflow: auto;- background: var(--grain), var(--glass-sheet); backdrop-filter: var(--glass-filter-lg);- border-radius: var(--sheet-r); box-shadow: var(--shadow-pop);+ background: var(--glass-sheet); backdrop-filter: var(--glass-filter-lg);+ border-radius: var(--sheet-r); box-shadow: var(--shadow-modal);padding: var(--sheet-pad); display: grid; gap: var(--space-3);- animation: pop-in var(--dur-slow) var(--ease-spring);}.sheet.wide { --sheet-w: 640px; }-.sheet h2 { font-size: var(--fs-xl); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); }+/* 标题一行:右边是关闭钮(确认框没有,它有"取消")。关闭钮往外探一点,图标的右沿落在内容的右边上 */+.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }+.sheet h2 { min-width: 0; font-size: var(--fs-xl); font-weight: var(--fw-semibold); letter-spacing: var(--tracking-tight); line-height: var(--lh-snug); overflow-wrap: anywhere; }+.sheet-close { --ib-size: var(--ctl-md); margin: calc(-1 * var(--space-1)) calc(-1 * var(--space-1-5)) 0 0; }+.sheet p { line-height: var(--lh-normal); }.sheet .body { color: var(--fg-2); line-height: var(--lh-relaxed); overflow-wrap: anywhere; }.sheet .actions { display: flex; justify-content: flex-end; gap: var(--ctl-gap); margin-top: var(--space-1); }+/* 确认框里的勾选项(confirmSheet 的 check) */+.sheet-check { display: flex; align-items: flex-start; gap: var(--space-2); font-size: var(--fs-md); line-height: var(--lh-normal); color: var(--fg-2); }+.sheet-check input { margin-top: var(--space-0-5); accent-color: var(--accent); }.sheet pre.doc { white-space: pre-wrap; font: var(--fs-xs)/var(--lh-normal) var(--code); color: var(--fg-2); margin: 0; max-height: 60vh; overflow: auto; }.scrim.leaving { animation: fade-out var(--dur-base) var(--ease-in) forwards; pointer-events: none; }-.scrim.leaving .sheet { animation: pop-out var(--dur-base) var(--ease-in) forwards; }++/* 扫码和等待授权:内容在对话框里居中。二维码任何主题下都是白底,四周留白才好扫;还没拿到时先占一块一样大的位置,不跳 */+.qr-flow { display: grid; justify-items: center; gap: var(--space-3); padding: var(--space-2) 0; text-align: center; }+.qr-flow p { max-width: 36em; }+.qr-img { display: block; width: 200px; height: 200px; padding: var(--space-3); border-radius: var(--r-xl); background: var(--qr-bg); image-rendering: pixelated; box-shadow: 0 0 0 1px var(--line); } /* 描边:白底二维码放在浅色对话框上要一道细边 */+.qr-img.empty { display: grid; place-items: center; background: var(--well); box-shadow: none; }+.qr-wait, .qr-status { display: inline-flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: var(--space-1-5); font-size: var(--fs-xs); line-height: var(--lh-snug); color: var(--muted); }+.qr-code { display: flex; align-items: center; gap: var(--ctl-gap); }+.qr-code .field { width: 140px; }diff --git a/ui/design/components/splitter.css b/ui/design/components/splitter.cssindex 907c053..6474c3a 100644--- a/ui/design/components/splitter.css+++ b/ui/design/components/splitter.css@@ -16,12 +16,12 @@.splitter::after {content: ""; position: absolute; top: var(--split-inset); bottom: var(--split-inset); left: 50%; width: var(--split-line-w);translate: -50% 0; border-radius: var(--r-full); background: var(--split-line);- opacity: 0; transform: scaleY(calc(1 - .4 * var(--motion)));- transition: opacity var(--t-base), transform var(--dur-slow) var(--ease-spring), background var(--t-fast);+ opacity: 0;+ transition: opacity var(--t-base), background var(--t-fast);}/* 悬停:停够 --dur-intent 才亮;移开立刻消失 */-.splitter:hover::after { opacity: 1; transform: none; transition-delay: var(--dur-intent); }-.splitter.dragging::after, .splitter:focus-visible::after { opacity: 1; transform: none; background: var(--split-line-on); transition-delay: 0s; }+.splitter:hover::after { opacity: 1; transition-delay: var(--dur-intent); }+.splitter.dragging::after, .splitter:focus-visible::after { opacity: 1; background: var(--split-line-on); transition-delay: 0s; }/* 键盘焦点就是那道 accent 细线,不再画一圈外描边 */.splitter:focus-visible { outline: none; }diff --git a/ui/design/components/stops.css b/ui/design/components/stops.cssindex 8d2cae7..918fd0b 100644--- a/ui/design/components/stops.css+++ b/ui/design/components/stops.css@@ -1,5 +1,5 @@/* 档位滑块:几档离散的值(模型选择器里的性价比、模型智能)。和开关一个样子:圆头轨道、圆钮在轨道里,- 填充 = 主操作色(浅色墨、深色黄绿),从左头一直填到圆钮。每一档一个小点,填充上的点用前景色。+ 填充 = 主操作色(浅色墨、深色近白),从左头一直填到圆钮。每一档一个小点,填充上的点用前景色。比开关粗一号:圆钮四周留 4px,拉到头时圆钮和轨道的圆头是同心圆(圆钮半径 = 轨道半径 − 留白)。不在任何一档上(.custom):没有圆钮和填充,只剩轨道和点。结构:<div role="slider" class="stops" style="--stops-at: 0…1"> .stops-fill .stops-dot(--stops-i)×n .stops-knob@@ -38,7 +38,7 @@position: absolute; top: var(--stops-pad); left: var(--stops-pad); width: var(--stops-knob-d); height: var(--stops-knob-d); border-radius: 50%;background: var(--stops-knob-bg); box-shadow: var(--seg-edge); pointer-events: none;transform: translateX(calc(var(--stops-run) * var(--stops-at)));- transition: transform var(--dur-moderate) var(--ease-spring), opacity var(--t-base);+ transition: transform var(--t-base), opacity var(--t-base);}/* 拖动时跟手,不弹 */.stops.dragging :is(.stops-fill, .stops-knob) { transition: none; }diff --git a/ui/design/components/switch.css b/ui/design/components/switch.cssindex 494096a..29dd518 100644--- a/ui/design/components/switch.css+++ b/ui/design/components/switch.css@@ -1,6 +1,6 @@/* 开关:只有"开 / 关"两态的设置用它,两个以上的选项用 Seg。- 打开 = 主操作色(浅色墨、深色黄绿),圆钮带一点弹性滑过去。- 状态:悬停轨道加深一级;按下圆钮被"按扁"拉长;键盘焦点外描边;禁用变淡。+ 打开 = 主操作色(浅色墨、深色近白),圆钮滑过去。+ 状态:悬停轨道加深一级;键盘焦点外描边;禁用变淡。结构:<button role="switch" class="switch" aria-checked="true|false">,圆钮是 ::after。 */.switch {--switch-w: 34px;@@ -9,7 +9,6 @@--switch-track: var(--switch-off);--switch-track-hover: var(--switch-off-hover);--switch-dot: var(--switch-knob);- --switch-stretch: 3px; /* 按下时圆钮拉长多少 */position: relative; flex: none; width: var(--switch-w); height: var(--switch-h); border-radius: var(--r-full);background: var(--switch-track);transition: background var(--t-base);@@ -18,12 +17,10 @@content: ""; position: absolute; top: var(--switch-pad); left: var(--switch-pad);width: calc(var(--switch-h) - 2 * var(--switch-pad)); height: calc(var(--switch-h) - 2 * var(--switch-pad)); border-radius: var(--r-full);background: var(--switch-dot); box-shadow: var(--seg-edge);- transition: transform var(--dur-moderate) var(--ease-spring), width var(--dur-moderate) var(--ease-spring), background var(--t-base);+ transition: transform var(--t-base), background var(--t-base);}.switch:hover:not(:disabled) { background: var(--switch-track-hover); }.switch[aria-checked="true"] { --switch-track: var(--primary); --switch-track-hover: var(--primary-hover); --switch-dot: var(--switch-knob-on); }.switch[aria-checked="true"]::after { transform: translateX(calc(var(--switch-w) - var(--switch-h))); }-.switch:active:not(:disabled)::after { width: calc(var(--switch-h) - 2 * var(--switch-pad) + var(--switch-stretch)); }-.switch[aria-checked="true"]:active:not(:disabled)::after { transform: translateX(calc(var(--switch-w) - var(--switch-h) - var(--switch-stretch))); }.switch:disabled { opacity: var(--o-disabled); }-.switch.sm { --switch-w: 28px; --switch-h: 16px; --switch-stretch: 2px; }+.switch.sm { --switch-w: 28px; --switch-h: 16px; }diff --git a/ui/design/components/toast.css b/ui/design/components/toast.cssindex 9a70625..3c79c8b 100644--- a/ui/design/components/toast.css+++ b/ui/design/components/toast.css@@ -7,21 +7,20 @@.toast {--toast-bg: var(--glass-pop);--toast-fg: var(--fg);- --toast-edge: var(--glass-edge);pointer-events: auto; font-size: var(--fs-sm); line-height: 16px; font-weight: var(--fw-medium);padding: var(--space-1) var(--space-3); border-radius: var(--r-full);max-width: min(480px, calc(100vw - 2 * var(--float-inset)));- background: var(--grain), var(--toast-bg); color: var(--toast-fg); backdrop-filter: var(--glass-filter-sm);- box-shadow: inset 0 1px 0 var(--glass-hi), 0 0 0 var(--hairline) var(--toast-edge), var(--shadow-md); /* 描边:浮层玻璃的细边 */+ background: var(--toast-bg); color: var(--toast-fg); backdrop-filter: var(--glass-filter-sm);+ box-shadow: var(--shadow-float);display: flex; gap: var(--space-2); align-items: center;- --rise: 6px;- animation: rise-in var(--dur-base) var(--ease-out);+ animation: fade-in var(--dur-base) var(--ease-out);}-.toast.ok { --toast-bg: var(--accent-solid); --toast-fg: var(--on-accent); --toast-edge: var(--accent-line); } /* "已保存":黄绿信号;黄绿在白底上只有 1.15:1,要一道墨色细边 */+/* "已保存":普通的玻璃胶囊,前面一个绿点 */+.toast.ok::before { content: ""; width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--green); }/* 出错 / 注意:只换底色,边仍是中性的玻璃细边(不要"淡红底 + 红边"两层都染色) */.toast.err { --toast-bg: color-mix(in srgb, var(--red-soft) 88%, transparent); --toast-fg: var(--red); }.toast.warn { --toast-bg: color-mix(in srgb, var(--amber-soft) 88%, transparent); --toast-fg: var(--amber); }-.toast.leaving { --rise: 4px; animation: sink-out var(--dur-base) var(--ease-in) forwards; }+.toast.leaving { animation: fade-out var(--dur-base) var(--ease-in) forwards; }.toast .icon-btn {--ib-fg: currentColor; --ib-fg-hover: currentColor;--ib-bg-hover: color-mix(in srgb, currentColor 12%, transparent); --ib-bg-press: color-mix(in srgb, currentColor 20%, transparent);diff --git a/ui/design/gallery.css b/ui/design/gallery.cssindex 7be25f2..be2bedc 100644--- a/ui/design/gallery.css+++ b/ui/design/gallery.css@@ -3,7 +3,7 @@.gal { display: grid; grid-template-columns: 196px minmax(0, 1fr); height: 100vh; background: var(--bg); }.gal-nav {display: grid; align-content: start; gap: var(--space-0-5); overflow-y: auto;- padding: var(--space-5) var(--space-3); background: var(--grain), var(--glass-side); border-right: var(--hairline) solid var(--line-2);+ padding: var(--space-5) var(--space-3); background: var(--glass-side); border-right: var(--hairline) solid var(--line-2);}.gal-nav .brand { display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-2) var(--space-4); font-weight: var(--fw-semibold); }.gal-nav .t-label { padding: var(--space-3) var(--space-2-5) var(--space-1); }@@ -63,7 +63,7 @@box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fg) 12%, transparent); /* 描边:色块样例,白色、透明色也要看得出边界 */}.gal-chip code { font-size: var(--fs-2xs); color: var(--muted); overflow-wrap: anywhere; }-.gal-bar { height: 10px; width: var(--w); border-radius: 2px; background: var(--accent-solid); box-shadow: inset 0 0 0 1px var(--accent-line); } /* 描边:黄绿样例条要一道墨色细边 */+.gal-bar { height: 10px; width: var(--w); border-radius: 2px; background: var(--primary); }.gal-radius { width: 64px; height: 40px; border-radius: var(--r); background: var(--pill); box-shadow: inset 0 0 0 1px var(--line); } /* 描边:圆角样例,画出轮廓才看得出圆角 */.gal-height { height: var(--h); width: 120px; border-radius: var(--r-sm); background: var(--pill); box-shadow: inset 0 0 0 1px var(--line); } /* 描边:高度样例 */.gal-elev { display: grid; place-items: end start; width: 150px; height: 84px; padding: var(--space-2-5); border-radius: var(--r-xl); background: var(--card); box-shadow: var(--sh); }@@ -80,14 +80,14 @@.gal-curve path { fill: none; stroke: var(--accent); stroke-width: 2; }.gal-icon { display: grid; justify-items: center; align-content: center; gap: var(--space-1-5); min-width: 76px; min-height: 52px; color: var(--fg-2); }.gal-anim { display: grid; justify-items: center; gap: var(--space-2); width: 120px; }-.gal-anim-box { width: 72px; height: 48px; border-radius: var(--r-lg); background: var(--accent-solid); box-shadow: inset 0 0 0 1px var(--accent-line); } /* 描边:黄绿样例块要一道墨色细边 */+.gal-anim-box { width: 72px; height: 48px; border-radius: var(--r-lg); background: var(--primary); }/* —— 页面模式 —— */.gal-chat { display: flex; flex-direction: column; width: 100%; }.gal-chat > .msg-row:first-child { margin-top: 0; }.gal-demo .composer { width: 100%; }-/* —— 材质:环境光 + 底下的彩色内容 + 六块玻璃 —— */+/* —— 材质:窗口底色 + 底下的彩色内容 + 六块玻璃 —— */.gal-stage { position: relative; height: 300px; overflow: hidden; width: 100%; }.gal-stage-under {position: absolute; inset: 0; padding: var(--space-4) var(--space-5); display: grid; align-content: start; gap: var(--space-2-5);@@ -105,7 +105,7 @@.gal-state > .gal-strip + .gal-strip { border-top: var(--hairline) solid var(--line); }.gal-strip-in { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-4) var(--space-5); padding: var(--space-4) var(--space-5) var(--space-3-5); }.ctx-surface > .gal-strip-in { background: var(--surface); }-.ctx-side > .gal-strip-in { background: var(--grain), var(--glass-side); }+.ctx-side > .gal-strip-in { background: var(--glass-side); }.gal-cell { display: grid; justify-items: start; gap: var(--space-2); }.gal-cell-stage { min-height: var(--ctl-lg); display: flex; align-items: center; }.gal-cell > .t-meta { font-size: var(--fs-2xs); }@@ -128,7 +128,7 @@.gal-split {--gal-col: clamp(var(--gal-split-w-min), var(--gal-split-w-user, var(--gal-split-w)), var(--gal-split-w-max));position: relative; display: grid; grid-template-columns: var(--gal-col) minmax(0, 1fr); height: 160px;- background: var(--grain), var(--glass-side);+ background: var(--glass-side);}.gal-split-a { display: grid; place-items: center; }.gal-split-b { display: grid; place-items: center; margin: var(--pane-gap) var(--pane-gap) var(--pane-gap) 0; border-radius: var(--r-pane); background: var(--surface); box-shadow: var(--shadow-pane); } /* 描边:和主区同一种面板 */diff --git a/ui/design/gallery.js b/ui/design/gallery.jsindex 97a9f45..f437f24 100644--- a/ui/design/gallery.js+++ b/ui/design/gallery.js@@ -9,7 +9,7 @@ import { PausedLine, TaskChip, TaskGroup, TaskRow } from "../components/tasks.jsimport { Markdown } from "../components/markdown.js";import { useStore, toast, saved, failed, confirmSheet } from "../lib/store.js";import { themeMode, setThemeMode } from "../lib/theme.js";-import "../lib/prefs.js"; // 外观偏好(字体大小、动画、毛玻璃…)在样例页里也生效+import "../lib/prefs.js"; // 外观偏好(字体大小、动画…)在样例页里也生效import { usePresence } from "./motion.js";const Compare = createContext(false);@@ -213,19 +213,19 @@ function AvatarPickerDemo() {return html`<${AvatarPicker} value=${v} fallback=${MAIN_CHAR} onChange=${setV} />`;}-// —— 材质:环境光上叠几层玻璃,底下放有颜色的内容,才看得出透光和模糊 ——+// —— 材质:窗口底色上叠几层玻璃,底下放有颜色的内容,才看得出透光和模糊 ——const MATERIALS = [- ["--glass-side", "侧栏", "只盖在环境光上,不模糊"],+ ["--glass-side", "侧栏", "只盖在窗口底色上,不模糊"],["--glass-chrome", "顶栏", "--glass-filter"],["--glass-float", "输入框 · 回到底部", "--glass-filter"],["--glass-panel", "信息面板", "停靠时不模糊"],["--glass-pop", "菜单 · 命令面板 · 提示", "--glass-filter-lg"],- ["--glass-sheet", "对话框 · 引导卡片", "--glass-filter-lg"],+ ["--glass-sheet", "对话框", "--glass-filter-lg"],];function GlassStage() {- return html`<div class="gal-stage aura-bg" style="--aura-hue: 225">+ return html`<div class="gal-stage window-bg"><div class="gal-stage-under" aria-hidden="true">- ${["--accent-solid", "--green", "--red", "--amber", "--primary", "--accent-solid", "--green", "--red", "--amber", "--primary"].map((c, i) => html`<div class="cluster">+ ${["--brand", "--green", "--red", "--amber", "--primary", "--brand", "--green", "--red", "--amber", "--primary"].map((c, i) => html`<div class="cluster"><i class="gal-stage-swatch" style=${{ "--sw": `var(${c})` }}></i><span>${["今日结论:周五前上线新版引导页", "客服话术改用新模板", "设计稿定稿(小林,周三)", "联调支付回调(阿杰,周四)", "价格以控制台为准"][i % 5]}</span></div>`)}</div>@@ -330,7 +330,7 @@ const STATE_ROWS = [["聚焦", () => html`<label class="side-search is-focus" style="width: 200px; margin: 0"><${Icon} name="search" size="sm" /><input value="日报" tabindex="-1" /></label>`],["账户 · 悬停", () => html`<button type="button" class="account is-hover" style="width: 200px"><span class="me">R</span><span class="who">root</span></button>`],["账户 · 打开", () => html`<button type="button" class="account on" style="width: 200px"><span class="me">R</span><span class="who">root</span></button>`]] },- { name: "余额不足提示", note: ".low-balance · 一层淡红 + 红点,字用 --fg;悬停、按下淡红加深", ctx: "side", cells: basic((c) => html`<a class=${`low-balance ${c}`} href="#states" style="width: 220px; margin: 0">余额只剩 $0.42,去充值 ↗</a>`) },+ { name: "侧栏提示", note: ".side-note · 一行淡灰 + 小点;悬停、按下深一级,不铺红、不铺品牌色", ctx: "side", cells: basic((c) => html`<a class=${`side-note ${c}`} href="#states" style="width: 220px; margin: 0"><span class="side-note-main"><span class="dot warn"></span><span class="v">余额不多了</span><span class="go">充值 ↗</span></span></a>`) },{ name: "选角色", note: ".avatar-opt · 选中比悬停深一级、名字变实,不描边", cells: [...basic((c) => html`<button type="button" class=${`avatar-opt ${c}`}><${BotAvatar} char="green" size=${36} /><span class="avatar-name">${BOT_CHARS.green.name}</span></button>`),["选中", () => html`<button type="button" class="avatar-opt on" aria-checked="true" role="radio"><${BotAvatar} char="blue" size=${36} /><span class="avatar-name">${BOT_CHARS.blue.name}</span></button>`]] },@@ -338,12 +338,12 @@ const STATE_ROWS = [["空", () => html`<button type="button" class="send" disabled aria-label="发送"><${Icon} name="up" size="md" strong /></button>`],...basic((c) => html`<button type="button" class=${`send ${c}`} aria-label="发送"><${Icon} name="up" size="md" strong /></button>`),["停止", () => html`<button type="button" class="send stop" aria-label="停止"><${Icon} name="stop" size="md" /></button>`]] },- { name: "对话输入框", note: ".composer · 输入中描边更实、投影更大;拖入文件时 accent 描边 + 一层黄绿", cells: [["默认", () => composer("")], ["悬停", () => composer("is-hover")], ["输入中", () => composer("is-focus")], ["拖入文件", () => composer("drag")]] },+ { name: "对话输入框", note: ".composer · 输入中描边更实、投影更大;拖入文件时 accent 描边 + 一层淡灰", cells: [["默认", () => composer("")], ["悬停", () => composer("is-hover")], ["输入中", () => composer("is-focus")], ["拖入文件", () => composer("drag")]] },{ name: "输入框工具", note: ".composer .model-chip / .plus · 打开时箭头翻转、加号转成叉", cells: [...basic((c) => html`<div class="composer gal-bare"><button type="button" class=${`model-chip ${c}`}><span class="v">claude-sonnet-5-5</span><${Icon} name="chevDown" /></button></div>`),["打开", () => html`<div class="composer gal-bare"><button type="button" class="model-chip" aria-expanded="true"><span class="v">claude-sonnet-5-5</span><${Icon} name="chevDown" /></button></div>`],["加号 · 打开", () => html`<div class="composer gal-bare"><button type="button" class="plus" aria-expanded="true" aria-label="更多"><${Icon} name="plus" size="md" /></button></div>`]] },- { name: "模板卡", note: ".tpl · 一块 --well;悬停底色深一级,选中是一层黄绿 + 黄绿图标,不描边", cells: [+ { name: "模板卡", note: ".tpl · 一块 --well;悬停底色深一级,选中是底色深一级 + 主操作色的图标片,不描边", cells: [...basic((c) => html`<button type="button" class=${`tpl ${c}`} style="width: 190px"><span class="tpl-ic"><${Icon} name="chat" size="lg" /></span><span class="tpl-name">群聊日报</span><span class="tpl-desc">每天整理群消息</span></button>`),["选中", () => html`<button type="button" class="tpl on" style="width: 190px"><span class="tpl-ic"><${Icon} name="chat" size="lg" /></span><span class="tpl-name">群聊日报</span><span class="tpl-desc">每天整理群消息</span></button>`]] },{ name: "建议胶囊", note: ".chip", cells: basic((c) => html`<button type="button" class=${`chip ${c}`}>你能帮我做什么?</button>`) },@@ -357,7 +357,7 @@ const STATE_ROWS = [function StateRow({ name, note, ctx = "surface", cells }) {return html`<figure class="gal-specimen gal-state"><figcaption><b>${name}</b>${note && html`<span class="t-meta">${note}</span>`}</figcaption>- ${["light", "dark"].map((t) => html`<div class=${`gal-strip aura-bg ctx-${ctx}`} data-theme=${t} style=${{ "--aura-hue": ctx === "side" ? "155" : "225" }}>+ ${["light", "dark"].map((t) => html`<div class=${`gal-strip window-bg ctx-${ctx}`} data-theme=${t}><div class="gal-strip-in">${cells.map(([label, el]) => html`<div class="gal-cell"><div class="gal-cell-stage">${el()}</div><span class="t-meta">${label}</span></div>`)}</div></div>`)}</figure>`;@@ -402,7 +402,7 @@ function WinApp({ screen = "chat", open: initial = false }) {<div class="onboard-hero"><${BotAvatar} char=${MAIN_CHAR} size=${56} /><h1>任意模型,一个助手</h1></div></div><${GalCaption} /></main>`;const settings = screen === "settings";- return html`<div class=${`app${open ? " with-panel" : ""}`} style=${{ "--aura-hue": "225" }}>+ return html`<div class=${`app${open ? " with-panel" : ""}`}><aside class="side">${settings? html`<div class="side-top start"><button type="button" class="side-back"><${Icon} name="arrowLeft" size="md" />返回应用</button></div>`@@ -521,9 +521,9 @@ function Gallery() {<${ColorRows} tokens=${[...group(prim, "品牌"), ...group(prim, "状态色"), ...group(prim, "黑白")]} />`}<//>- <${Section} id="material" title="材质" lead="窗口最底层是环境光(--bg + 左上的品牌黄绿光 + 跟着当前机器人变的色相光)。侧栏直接盖在环境光上;主区和信息面板是浮起的面板;顶栏、输入框、菜单、对话框是盖在内容上的毛玻璃——半透明底 + 背景模糊 + 磨砂颗粒 + 顶边高光与细描边。系统开了「降低透明度」时,材质换成接近实色。">+ <${Section} id="material" title="材质" lead="窗口最底层是一层纯色 --bg,侧栏就是它。主区和信息面板是面板,只有一道细线;顶栏、输入框、菜单、对话框盖在内容上,几乎不透。系统开了「降低透明度」时,材质换成接近实色。"><${Demo} flush title="六种材质" note="底下是会滚过去的内容:顶栏、输入框、菜单、对话框会把它模糊掉" code=${`<div class="glass" style="--glass-bg: var(--glass-pop); --glass-blur: var(--glass-filter-lg); --glass-shadow: var(--shadow-pop)">…</div>-.pop { background: var(--grain), var(--glass-pop); backdrop-filter: var(--glass-filter-lg); box-shadow: var(--shadow-pop); } /* 组件自己就是玻璃时直接写三行 */`}>+.pop { background: var(--glass-pop); backdrop-filter: var(--glass-filter-lg); box-shadow: var(--shadow-pop); } /* 组件自己就是玻璃时直接写三行 */`}>${() => html`<${GlassStage} />`}<//><//>@@ -547,9 +547,9 @@ function Gallery() {<h3 class="t-label">控件高度</h3><${ScaleRows} tokens=${group(prim, "控件高度")} sample=${(t) => html`<div class="gal-height" style=${{ "--h": `var(${t.name})` }}></div>`} />`}<//>- <${Section} id="elevation" title="投影与层级" lead="投影是主题 token(深色下更重);层级只用 --z-*,同一窗格内的浮动件用 calc(var(--z-float) ± 1)。">+ <${Section} id="elevation" title="投影与层级" lead="投影只给浮在内容上的东西,很淡,分三档;面板只有一道细线。层级只用 --z-*,同一窗格内的浮动件用 calc(var(--z-float) ± 1)。"><${Demo} title="投影">- ${() => html`${["--shadow-xs", "--shadow-sm", "--shadow-md", "--shadow-lg", "--shadow-pane", "--shadow-tile", "--shadow-float", "--shadow-pop", "--primary-edge"].map((s) => html`<div class="gal-elev" style=${{ "--sh": `var(${s})` }}><code class="t-meta">${s}</code></div>`)}`}+ ${() => html`${["--shadow-pane", "--shadow-float", "--shadow-pop", "--shadow-modal"].map((s) => html`<div class="gal-elev" style=${{ "--sh": `var(${s})` }}><code class="t-meta">${s}</code></div>`)}`}<//>${prim && html`<${ScaleRows} tokens=${group(prim, "层级")} sample=${() => ""} />`}<//>@@ -560,16 +560,16 @@ function Gallery() {</div><div style=${reduced ? { "--motion": "0" } : {}}><h3 class="t-label">时长</h3>- <div class="gal-rows">${motion.filter((t) => /^--dur-(fast|base|moderate|slow|slower)$/.test(t.name)).map((t) => html`<div class="gal-row scale" key=${t.name}>+ <div class="gal-rows">${motion.filter((t) => /^--dur-(fast|base|moderate|slow)$/.test(t.name)).map((t) => html`<div class="gal-row scale" key=${t.name}><${TokenName} t=${t} /><code class="t-meta">${t.src}</code><${Runner} d=${t.name} /></div>`)}</div><h3 class="t-label">缓动</h3><div class="gal-rows">${motion.filter((t) => t.name.startsWith("--ease-")).map((t) => html`<div class="gal-row scale" key=${t.name}>- <${TokenName} t=${t} /><svg class="gal-curve" viewBox="0 0 56 56"><rect width="56" height="56" /><path d=${bezierPath(t.src)} /></svg><${Runner} d="--dur-slower" e=${t.name} /></div>`)}</div>+ <${TokenName} t=${t} /><svg class="gal-curve" viewBox="0 0 56 56"><rect width="56" height="56" /><path d=${bezierPath(t.src)} /></svg><${Runner} d="--dur-slow" e=${t.name} /></div>`)}</div><h3 class="t-label">关键帧库</h3>- <${Demo} code=${`<div class="anim-rise-in">…</div> /* 可用 --anim-dur / --anim-ease / --anim-delay 微调 */-.toast { --rise: 6px; animation: rise-in var(--dur-base) var(--ease-out); } /* 组件里直接用关键帧 + token */+ <${Demo} code=${`<div class="anim-fade-in">…</div> /* 可用 --anim-dur / --anim-ease / --anim-delay 微调 */+.toast { animation: fade-in var(--dur-base) var(--ease-out); } /* 组件里直接用关键帧 + token */const { mounted, leaving } = usePresence(open); /* design/motion.js:退场动画播完再卸载 */`}>- ${() => html`${[["anim-fade-in", "fade-in"], ["anim-rise-in", "rise-in"], ["anim-slide-in", "slide-in"], ["anim-pop-in", "pop-in"], ["anim-scale-in", "scale-in"], ["anim-sink-out", "sink-out"], ["anim-pop-out", "pop-out"], ["anim-bump", "bump"], ["anim-flash", "flash"]].map(([c, l]) => html`<${Replay} cls=${c} label=${l} />`)}+ ${() => html`${[["anim-fade-in", "fade-in"], ["anim-slide-in", "slide-in"], ["anim-fade-out", "fade-out"], ["anim-slide-out", "slide-out"], ["anim-flash", "flash"]].map(([c, l]) => html`<${Replay} cls=${c} label=${l} />`)}<div class="gal-anim"><${Spinner} /><span class="t-meta">spin</span></div><div class="gal-anim"><span class="typing"><i></i><i></i><i></i></span><span class="t-meta">breathe(stagger)</span></div><div class="gal-anim"><span><span class="caret"></span></span><span class="t-meta">blink</span></div>@@ -614,7 +614,7 @@ const { mounted, leaving } = usePresence(open); /* design/motion.js:退场<${Section} id="menus" title="菜单与分段"><${Demo} title="Seg" note="两个以上的选项;中性 thumb 按值滑动">${() => html`<${SegDemo} />`}<//>- <${Demo} title="Switch" note="只有开 / 关两态;打开 = 主操作色(浅色墨、深色黄绿)" code=${`<${"${Switch}"} label="长期记忆" value=\${on} onChange=\${setOn} />`}>${() => html`<${SwitchDemo} />`}<//>+ <${Demo} title="Switch" note="只有开 / 关两态;打开 = 主操作色(浅色墨、深色近白)" code=${`<${"${Switch}"} label="长期记忆" value=\${on} onChange=\${setOn} />`}>${() => html`<${SwitchDemo} />`}<//><${Demo} title="Stops" note="几档离散的值(模型选择器的性价比、模型智能);← → 一档,Home / End 两头;value = -1 时不在任何一档上" code=${`<${"${Stops}"} label="性价比" count={3} value=\${i} onChange=\${setI} />`}>${() => html`<${StopsDemo} />`}<//><${Demo} title="MenuButton · Menu" note="↑↓ 选择,Enter 执行,Esc 关闭">${() => html`<${MenuButtonDemo} /><${MenuDemo} />`}<//><//>@@ -719,7 +719,7 @@ const { mounted, leaving } = usePresence(open); /* design/motion.js:退场<${Section} id="needs" title="需要你" lead="所有机器人里在等你的事:提问和审批在前,再是失败、没送到、登录,问要不要改为执行的最后。侧栏那一行和托盘角标只在有事时出现;一件一块,操作在行里,点标题行展开任务详情。"><${Demo} title="侧栏" note="NeedsRow:件数为 0 时不画">- ${() => html`<div class="gal-strip-in" style="width: 264px; padding: var(--space-2); border-radius: var(--r-pane); background: var(--grain), var(--glass-side)">+ ${() => html`<div class="gal-strip-in" style="width: 264px; padding: var(--space-2); border-radius: var(--r-pane); background: var(--glass-side)"><${NeedsRow} count=${3} onClick=${() => {}} /><${NeedsRow} count=${2} on onClick=${() => {}} /><${NeedsRow} count=${0} /></div>`}<//>@@ -730,17 +730,17 @@ const { mounted, leaving } = usePresence(open); /* design/motion.js:退场<${Section} id="rules" title="规则" lead="信息面板「任务」组里一条规则一行:时间表 · 标题,下面一句状态和下次运行(「观察中,明天 08:00 再运行」)。观察够了要不要改为执行,在「需要你」里问(从不推送)。点开是同一块里的详情和运行记录,记录一次一行、不画分隔线,再点开一行看报告。"><${Demo} title="行" note="RuleRow:观察中 / 执行中 / 暂停 / 提醒">- ${() => html`<div class="panel-body" style="width: 340px; flex: none; padding: var(--space-2); border-radius: var(--r-pane); background: var(--grain), var(--glass-panel)">+ ${() => html`<div class="panel-body" style="width: 340px; flex: none; padding: var(--space-2); border-radius: var(--r-pane); background: var(--glass-panel)"><div class="list">${RULES.map((r) => html`<${RuleRow} rule=${r} open=${false} onToggle=${() => {}} />`)}</div></div>`}<//><${Demo} title="暂停" note="PausedLine:后台工作暂停时信息面板最上面这一行,没暂停时不画">- ${() => html`<div class="panel-body" style="width: 340px; flex: none; padding: var(--space-2); border-radius: var(--r-pane); background: var(--grain), var(--glass-panel)">+ ${() => html`<div class="panel-body" style="width: 340px; flex: none; padding: var(--space-2); border-radius: var(--r-pane); background: var(--glass-panel)"><${PausedLine} onResume=${async () => {}} /></div>`}<//><${Demo} title="详情与运行记录" note="RuleDetail:原话、模式、立即运行、运行记录(本会发送 / 保持安静 / 失败 / 跳过)">- ${() => html`<div class="panel-body" style="width: 340px; flex: none; padding: var(--space-2); border-radius: var(--r-pane); background: var(--grain), var(--glass-panel)">+ ${() => html`<div class="panel-body" style="width: 340px; flex: none; padding: var(--space-2); border-radius: var(--r-pane); background: var(--glass-panel)"><div class="list"><div class="row-edit rule-edit"><${RuleDetail} rule=${RULES[0]} runs=${RULE_RUNS} /></div></div></div>`}<//>@@ -748,12 +748,12 @@ const { mounted, leaving } = usePresence(open); /* design/motion.js:退场<${Section} id="tasks" title="任务" lead="信息面板的「任务」组就是一个机器人的全部任务和规则:进行中、等你的在前,规则其次,结束了的收在最后一行里,点开才列出来(留 30 天)。一个任务一行,第二行是一句话(「已进行 12 分钟,花了约 $0.08」「15:33 完成」),点开是同一块里的详情:来自、最新进展、预算(可以改)、文件夹(大小、打开)、要清理时的日期和保留、每次运行折叠的处理过程。什么都没有时整组不画。"><${Demo} title="「任务」组" note="TaskGroup:进行中 / 进行中,有个问题等你回答(问了个有默认回答的问题,接着在做)/ 等你回答 / 规则 / 已结束 1(点开列出结束了的,那个文件夹 3 天后清理)">- ${() => html`<div class="panel-body" style="width: 340px; flex: none; padding: var(--space-2); border-radius: var(--r-pane); background: var(--grain), var(--glass-panel)">+ ${() => html`<div class="panel-body" style="width: 340px; flex: none; padding: var(--space-2); border-radius: var(--r-pane); background: var(--glass-panel)"><${TaskGroup} botId="b" tasks=${TASKS} rules=${[RULES[0]]} ended=${ENDED} details=${{ t1: TASK_DETAIL, t4: ASKING_DETAIL, t2: ASK_DETAIL, t3: ENDED_DETAIL }} /></div>`}<//><${Demo} title="问了还在做" note="TaskRow 展开:问题(下面一句不回复就按中文做)· 最新进展 · 预算 · 运行中;对话里的胶囊点开是同一份详情">- ${() => html`<div class="panel-body" style="width: 340px; flex: none; padding: var(--space-2); border-radius: var(--r-pane); background: var(--grain), var(--glass-panel)">+ ${() => html`<div class="panel-body" style="width: 340px; flex: none; padding: var(--space-2); border-radius: var(--r-pane); background: var(--glass-panel)"><div class="list"><${TaskRow} task=${ASKING} open data=${ASKING_DETAIL} onToggle=${() => {}} onOpenConv=${() => {}} /></div></div>`}<//>@@ -762,7 +762,7 @@ const { mounted, leaving } = usePresence(open); /* design/motion.js:退场<div class="msg-row assistant"><${TaskChip} task=${ASKING} data=${ASKING_DETAIL} /></div></div>`}<//><${Demo} title="详情" note="TaskRow 展开:来自 · 最新进展 · 预算 约 $0.08 / $1.00(改) · 文件夹 2.3 MB(打开) · 第 1 次运行,已进行 12 分钟 · 停止 / 导出">- ${() => html`<div class="panel-body" style="width: 340px; flex: none; padding: var(--space-2); border-radius: var(--r-pane); background: var(--grain), var(--glass-panel)">+ ${() => html`<div class="panel-body" style="width: 340px; flex: none; padding: var(--space-2); border-radius: var(--r-pane); background: var(--glass-panel)"><div class="list"><${TaskRow} task=${TASKS[0]} open data=${TASK_DETAIL} onToggle=${() => {}} onOpenConv=${() => {}} /></div></div>`}<//>@@ -773,7 +773,7 @@ const { mounted, leaving } = usePresence(open); /* design/motion.js:退场<${WinCase} name="信息面板开着" note="信息面板贴住右上角,主区照旧浮着" open /><${WinCase} name="窗口窄:信息面板是抽屉" note="1000 宽;抽屉贴住右上角,主区在它底下不动" w=${1000} open /><${WinCase} name="设置" note="内容滚到窗口上沿,从按钮底下过" screen="settings" />- <${WinCase} name="引导页" note="没有面板,按钮直接在环境光上" w=${1000} screen="onboard" />+ <${WinCase} name="引导页" note="没有面板,按钮直接在窗口底色上" w=${1000} screen="onboard" /><//><${Section} id="custom" title="定制" lead="不改组件源码:在上下文里覆盖组件变量;需要一块不同主题的区域时,加 data-theme。">diff --git a/ui/design/motion.js b/ui/design/motion.jsindex f9a4e5a..7be3f4e 100644--- a/ui/design/motion.js+++ b/ui/design/motion.js@@ -1,6 +1,6 @@// 动效的 JS 一侧:读取 CSS 时长 token、尊重"减少 / 关闭动画"、让退场动画播完再卸载。// 时长只在 tokens/motion.css 里定义一次,JS 用 ms("--dur-base") 读,不要再写死毫秒数。-import { useEffect, useState } from "preact/hooks";+import { useEffect, useLayoutEffect, useRef, useState } from "preact/hooks";const mq = window.matchMedia("(prefers-reduced-motion: reduce)");@@ -34,3 +34,35 @@ export function usePresence(open, exit = "--dur-base") {}, [open]);return { mounted: open || state !== "closed", leaving: !open && state !== "closed" };}++/**+ * 列表里的行增删:新出现的行 state 是 "enter"(at 是它出现的时刻),被删的行留在原位 state 是 "leave",淡出 exit 时长后才真的消失。+ * 第一次拿到列表不算新增。传完整的列表,不要传搜索过滤后的,否则搜索也会算成增删。+ * const rows = useListPresence(bots); // [{ item, state, at }]+ */+export function useListPresence(items, exit = "--dur-base") {+ const prev = useRef(null);+ const timers = useRef(new Set());+ const [fx, setFx] = useState({ enter: {}, leave: [] });+ useLayoutEffect(() => {+ const before = prev.current;+ if (items) prev.current = items;+ if (!before || !items) return;+ const now = new Set(items.map((x) => x.id));+ const had = new Set(before.map((x) => x.id));+ const entered = items.filter((x) => !had.has(x.id)).map((x) => x.id);+ const left = before.flatMap((item, index) => (now.has(item.id) ? [] : [{ item, index }]));+ if (!entered.length && !left.length) return;+ const at = Date.now();+ setFx((f) => ({ enter: { ...f.enter, ...Object.fromEntries(entered.map((id) => [id, at])) }, leave: [...f.leave, ...left] }));+ const timer = setTimeout(() => {+ timers.current.delete(timer);+ setFx((f) => ({ enter: Object.fromEntries(Object.entries(f.enter).filter(([id]) => !entered.includes(id))), leave: f.leave.filter((l) => !left.includes(l)) }));+ }, ms(exit, 180));+ timers.current.add(timer);+ }, [items]);+ useEffect(() => () => timers.current.forEach(clearTimeout), []);+ const rows = (items || []).map((item) => ({ item, state: fx.enter[item.id] ? "enter" : "", at: fx.enter[item.id] }));+ for (const { item, index } of fx.leave) if (!rows.some((r) => r.item.id === item.id)) rows.splice(Math.min(index, rows.length), 0, { item, state: "leave" });+ return rows;+}diff --git a/ui/design/tokens/motion.css b/ui/design/tokens/motion.cssindex e5a4cc4..4d7e0f5 100644--- a/ui/design/tokens/motion.css+++ b/ui/design/tokens/motion.css@@ -1,21 +1,19 @@/* 动效 token。原则:- - 状态反馈(悬停、按下、颜色)用 fast;出现/消失用 base;整块视图或面板用 moderate;- 弹出层与对话框的弹性入场用 slow/slower + spring。- - 入场用 ease-out(或 spring),退场用 ease-in,循环用 ease-in-out 或 linear。- - 位移量也是 token(--rise / --slide / --pop-*),组件可以局部覆盖;关键帧把它们乘以 --motion,- 减少动态效果时 --motion = 0,所有入场自动退化成纯淡入;关闭动画时连淡入也没有(见文末 data-motion)。 */+ - 简约(用户 2026-11-03 要求):出现 / 消失只淡入淡出,不位移、不缩放、不回弹;按下只深一级底色,不缩小。+ - 状态反馈(悬停、按下、颜色)用 fast;出现/消失、视图切换用 base;只有布局滑动(信息面板开合)用 slow。+ - 入场用 ease-out,退场用 ease-in,循环用 ease-in-out 或 linear。--ease-back 只给机器人头像。+ - 唯一的位移是窄窗口的信息面板抽屉(--slide),乘以 --motion;关闭动画时连淡入也没有(见文末 data-motion)。 */:root {- --dur-fast: 120ms;- --dur-base: 180ms;- --dur-moderate: 240ms;- --dur-slow: 360ms;- --dur-slower: 420ms;+ --dur-fast: 100ms;+ --dur-base: 140ms;+ --dur-moderate: 180ms;+ --dur-slow: 240ms;--ease-out: cubic-bezier(.2, .8, .2, 1);--ease-in: cubic-bezier(.4, 0, 1, 1);--ease-in-out: cubic-bezier(.42, 0, .58, 1);--ease-spring: cubic-bezier(.16, 1, .3, 1);- --ease-back: cubic-bezier(.34, 1.56, .64, 1); /* 越过一点再回来:头像的弹跳 */+ --ease-back: cubic-bezier(.34, 1.56, .64, 1); /* 越过一点再回来:只给机器人头像 *//* 时长 + 缓动的组合:transition: background var(--t-fast), color var(--t-fast) */--t-fast: var(--dur-fast) var(--ease-out);@@ -32,7 +30,6 @@--dur-egg-spark: 3.2s; /* 彩蛋:光点亮起、上浮、熄灭一次 */--dur-pulse: 1.4s;--dur-flash: 1.2s;- --dur-ambient: 1.2s; /* 环境光换色(切换机器人时) */--stagger: 150ms;--dur-intent: 240ms; /* 悬停意图:指针停这么久才亮起提示(分隔条的细线),只是划过去不闪 */--dur-off: .01ms; /* 减少动态效果时代替 0:时长为 0 的过渡不触发 transitionend */@@ -47,21 +44,13 @@/* 位移量 */--motion: 1;- --rise: 6px;- --slide: 12px;- --pop-dy: -6px;- --pop-scale: .94;- --scale-from: .6; /* scale-in 的起点:发送钮里换图标、小圆点出现 */- --press: .96;- --press-strong: .94;+ --slide: 12px; /* 窄窗口的信息面板抽屉 */}/* 动画偏好:<html data-motion> 由 lib/prefs.js 解析(设置 › 外观 › 动画;跟随系统时看 prefers-reduced-motion)。- reduce:位移归零,入场只剩淡入,按下不缩放,过渡几乎瞬时(base/motion.css)。+ reduce:位移归零,过渡几乎瞬时(base/motion.css)。off:在 reduce 之上,出现 / 消失 / 视图切换也瞬时完成;只留表示"正在进行"的循环(转圈、骨架、光标)和定位闪烁。 */:root:is([data-motion="reduce"], [data-motion="off"]) {--motion: 0;- --press: 1;- --press-strong: 1;--dur-spin: 1.6s;}:root[data-motion="off"] {@@ -69,8 +58,6 @@--dur-base: var(--dur-off);--dur-moderate: var(--dur-off);--dur-slow: var(--dur-off);- --dur-slower: var(--dur-off);- --dur-ambient: var(--dur-off);--dur-intent: 0ms;--stagger: 0ms;}diff --git a/ui/design/tokens/primitives.css b/ui/design/tokens/primitives.cssindex 83bbc6a..875a152 100644--- a/ui/design/tokens/primitives.css+++ b/ui/design/tokens/primitives.css@@ -95,16 +95,16 @@--space-12: 48px;--space-16: 64px;- /* —— 字号:9 级。桌面应用的密度,小号保留半像素;都乘以 --fs-scale(设置 › 外观 › 字体大小,见 semantic.css「用户偏好」) —— */+ /* —— 字号:9 级。不用半像素(Windows 上发虚);控件和界面正文都是 13,都乘以 --fs-scale(设置 › 外观 › 字体大小) —— */--fs-2xs: calc(11px * var(--fs-scale)); /* 分组标题、徽标、快捷键 */- --fs-xs: calc(11.5px * var(--fs-scale)); /* 次要说明、元信息、等宽值 */- --fs-sm: calc(12.5px * var(--fs-scale)); /* 控件:按钮、菜单项、分段、输入框 */+ --fs-xs: calc(12px * var(--fs-scale)); /* 次要说明、元信息、等宽值 */+ --fs-sm: calc(13px * var(--fs-scale)); /* 控件:按钮、菜单项、分段、输入框 */--fs-md: calc(13px * var(--fs-scale)); /* 界面正文 */--fs-lg: calc(14px * var(--fs-scale)); /* 列表标题、面板标题 */--fs-xl: calc(15px * var(--fs-scale)); /* 对话正文、对话框标题 */- --fs-2xl: calc(17px * var(--fs-scale)); /* 空状态标题 */+ --fs-2xl: calc(18px * var(--fs-scale)); /* 空状态标题 */--fs-3xl: calc(20px * var(--fs-scale)); /* 引导页标题 */- --fs-4xl: calc(22px * var(--fs-scale)); /* 页面大标题(设置、机器人设置、新建页):比引导页标题大一档就够,不压过内容 */+ --fs-4xl: calc(24px * var(--fs-scale)); /* 页面大标题(设置、机器人设置、新建页):比引导页标题大一档就够,不压过内容 *//* —— 字重、行高、字距 —— */--fw-regular: 400;@@ -148,13 +148,13 @@--ic-stroke: 1.25; /* 常规线宽 */--ic-stroke-strong: 1.6; /* 实心面上的图标:发送钮的箭头、完成圆点里的勾 */- /* —— 层级:同一窗格内的浮动件 < 抽屉 < 弹出层 < 模态 < 命令面板 < 提示 —— */+ /* —— 层级:同一窗格内的浮动件 < 抽屉 < 模态 < 命令面板 < 弹出层 < 提示。弹出层挂在 <body> 下,对话框里的下拉也要盖在遮罩上 —— */--z-raised: 1;--z-float: 5;--z-drawer: 30;- --z-popover: 40;--z-modal: 50;--z-palette: 56;+ --z-popover: 58;--z-toast: 60;/* —— 细线:一个物理像素。高分屏 .5px,普通屏 1px(.5px 在 1x 屏上会被抗锯齿成半透明的虚影甚至消失) —— */@@ -188,7 +188,7 @@--col-w-wide: 960px; /* 设置 › 外观 › 对话宽度「宽」 */--bubble-w-wide: 760px; /* 对话列加宽(宽 / 铺满)时用户气泡的最大宽度 */--head-h: 52px; /* 对话顶栏、信息面板顶栏 */- --page-w: 680px; /* 设置页、机器人设置的内容列 */+ --page-w: 720px; /* 设置页、机器人设置的内容列 */--titlebar-inset: 84px; /* macOS 桌面版:侧栏顶部给红绿灯让出的宽度 */--caption-w-fallback: 138px; /* Windows 桌面版:右上角最小化 / 最大化 / 关闭(3 × 46)的宽度,拿不到 env(titlebar-area-*) 时用 */--brand-mark: 20px; /* Windows 桌面版:侧栏左上角的应用图标 */diff --git a/ui/design/tokens/semantic.css b/ui/design/tokens/semantic.cssindex 7f067d2..97e3fdc 100644--- a/ui/design/tokens/semantic.css+++ b/ui/design/tokens/semantic.css@@ -2,9 +2,9 @@中性灰、圆角与动效改编自 yetone/magpie internal/gui/assets/app.css(MIT,© 2026 yetone)。中性色按主题逐个精调,直接写在这里,不经过原始色板。- 空间结构(见 README「材质」):窗口最底层是环境光(--bg + 柔光),侧栏是直接盖在上面的毛玻璃,- 主区和信息面板是浮在环境光上的面板;顶栏、输入框、菜单、对话框是盖在内容上的玻璃。- 所以填充、悬停、描边都是半透明的一层,放在玻璃和实色上都对。+ 层次(见 README「容器与层次」,参考 Codex、Grok):窗口底色和侧栏是同一个平面;主区和信息面板是白 / 浅一档的面板,+ 只有一道细线;内容里的组靠底色深一级。投影只给真正浮在内容上的东西,而且很淡。+ 填充、悬停、描边都是半透明的一层,放在哪种底上都对。容器(见 README「容器与层次」):内容里的一组东西靠底色深一级(--well)和间距成组,不画描边、不加投影,也不在一组里面再套一组;行与行之间需要分开时只用一条细线(--line-2)。描边只留给两种东西:@@ -15,25 +15,19 @@:root, [data-theme="light"] {color-scheme: light;- /* —— 环境:窗口最底层的柔光,玻璃透出它;色相光跟着当前机器人变(shell.css 的 .app) —— */- --bg: #efefed; /* 窗口底色、引导页 */- --aura-brand: color-mix(in srgb, var(--lime-500) 30%, transparent); /* 左上角的品牌黄绿光 */- --aura-l: .88; /* 机器人色相光:OKLCH 亮度 */- --aura-c: .06; /* 彩度 */- --aura-a: .85; /* 不透明度 */+ /* —— 环境:窗口底色是一层纯色的中性灰,不放光晕、不随机器人变色 —— */+ --bg: #f5f5f6; /* 窗口底色、引导页 */- /* —— 材质:毛玻璃 = 半透明底 + 背景模糊(--glass-filter*)+ 磨砂颗粒 + 顶边高光与细描边 —— */- --surface: rgba(255, 255, 255, .86); /* 主区:对话、设置。底下是平滑的环境光,不需要模糊 */- --surface-solid: #ffffff; /* 主区上需要实色的地方 */- --glass-side: rgba(255, 255, 255, .42); /* 侧栏 */- --glass-chrome: rgba(255, 255, 255, .72); /* 盖在滚动内容上的顶栏 */- --glass-float: rgba(255, 255, 255, .68); /* 输入框、回到底部 */- --glass-panel: rgba(255, 255, 255, .66); /* 信息面板 */- --glass-pop: rgba(252, 252, 252, .74); /* 菜单、命令面板、提示 */- --glass-sheet: rgba(255, 255, 255, .84); /* 对话框 */- --glass-edge: rgba(0, 0, 0, .08); /* 玻璃的细描边 */- --glass-hi: rgba(255, 255, 255, .8); /* 玻璃顶边的高光 */- --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)' opacity='.035'/%3E%3C/svg%3E"); /* 磨砂颗粒 */+ /* —— 材质:层次靠底色和一道细线。半透明只留给盖在滚动内容上的东西(顶栏、输入框、浮层),也几乎不透 —— */+ --surface: #ffffff; /* 主区:对话、设置 */+ --surface-solid: #ffffff; /* 主区上需要实色的地方 */+ --glass-side: transparent; /* 侧栏:直接是窗口底色,和窗口是同一个平面 */+ --glass-chrome: rgba(255, 255, 255, .88); /* 盖在滚动内容上的顶栏 */+ --glass-float: rgba(255, 255, 255, .94); /* 输入框、回到底部 */+ --glass-panel: #ffffff; /* 信息面板:和主区同一层 */+ --glass-pop: rgba(255, 255, 255, .97); /* 菜单、命令面板、提示 */+ --glass-sheet: #ffffff; /* 对话框 */+ --glass-edge: rgba(0, 0, 0, .08); /* 细线:面板和浮层的边 *//* —— 表面:分组的底色与静默填充。填充都是半透明的一层 —— */--card: #ffffff; /* 实色面:聚焦的侧栏搜索框、样例页的演示区 */@@ -45,11 +39,11 @@--pill-press: rgba(0, 0, 0, .1);--seg-track: rgba(0, 0, 0, .055);--seg-thumb-bg: var(--white);- --side-hover: rgba(0, 0, 0, .042); /* 侧栏行:悬停叠一层淡灰(侧栏本来就接近白色,再亮一层几乎看不出来) */+ --side-hover: rgba(0, 0, 0, .04); /* 侧栏行:悬停一层淡灰 */--side-press: rgba(0, 0, 0, .07);- --side-active: rgba(255, 255, 255, .92); /* 选中:浮起的白色玻璃片。悬停暗一点、选中亮一点,一眼分得开 */- --side-solid: #f4f4f2; /* 侧栏的近似实色:压在侧栏头像上的状态点要挖一圈和底一样的缺口 */- --side-solid-on: #fefefe; /* 选中的行上的近似实色 */+ --side-active: rgba(0, 0, 0, .065); /* 选中:同一种灰深一级,没有投影、不浮起 */+ --side-solid: #f5f5f6; /* 侧栏的实色:压在侧栏头像上的状态点要挖一圈和底一样的缺口 */+ --side-solid-on: #e5e5e6; /* 选中的行上的实色 */--bubble-user: rgba(0, 0, 0, .05); /* 用户消息气泡;机器人回复不加气泡 */--bubble-ai: rgba(0, 0, 0, .035); /* 信息面板里的会话记录等次要气泡 */--qr-bg: var(--white); /* 二维码在任何主题下都要白底 */@@ -61,6 +55,7 @@/* —— 线 —— */--line: rgba(0, 0, 0, .1); /* 表格表头的下沿、正文里的分隔线 hr */--line-2: rgba(0, 0, 0, .06); /* 行与行之间的细线:列表行、表格行、菜单里的分隔 */+ --line-strong: rgba(0, 0, 0, .18); /* 聚焦时的边:对话输入框、侧栏搜索框 */--split-line: rgba(0, 0, 0, .2); /* 分隔条:指针停住时空隙中间亮起的细线(拖动、键盘焦点时换成 --accent) */--ctl-edge: rgba(0, 0, 0, .44); /* 文字输入框的边:对主区、信息面板、对话框和 --well 都 ≥ 3:1(3.2:1) */--ctl-edge-hover: rgba(0, 0, 0, .6);@@ -68,30 +63,26 @@/* —— 文字 —— */--fg: #1a1a1a;--fg-2: #4d4d4d;- --muted: #737373; /* 玻璃上的次要文字,侧栏最浅处约 4:1 */+ --muted: #6b6b6b; /* 玻璃上的次要文字,侧栏最浅处约 4:1 */--faint: #b3b3b3;--ctl-fg: #5e5e5e; /* 静默控件上的图标与文字 */--placeholder: #949494;- /* —— 品牌:墨色负责操作,Modelflare 黄绿是"亮起的信号"(用法见 README「品牌色」) —— */- --primary: var(--olive-950); /* 主按钮、打开的开关:浅色下是 Modelflare 墨色 */- --primary-hover: color-mix(in srgb, var(--olive-950) 84%, var(--white));- --primary-press: color-mix(in srgb, var(--olive-950) 72%, var(--white));+ /* —— 品牌:操作一律是中性的墨色 / 近白,黄绿只留给应用标志和几个很小的信号,不做底色(用法见 README「品牌色」) —— */+ --primary: #1a1a1a; /* 主按钮、打开的开关:浅色下是墨色 */+ --primary-hover: color-mix(in srgb, #1a1a1a 92%, var(--white));+ --primary-press: color-mix(in srgb, #1a1a1a 86%, var(--white));--on-primary: var(--white);- --primary-edge: inset 0 1px 0 rgba(255, 255, 255, .16), 0 1px 2px rgba(22, 26, 0, .28); /* 主按钮的顶边高光 + 落影 */- --send-bg: var(--olive-950); /* 发送 / 停止:墨色圆钮 + 黄绿箭头 */+ --send-bg: #1a1a1a; /* 发送 / 停止:墨色圆钮 + 黄绿箭头(墨色上的一点光) */--send-fg: var(--lime-500);- --accent: var(--olive-950); /* 焦点描边、勾选、指示点、链接 */- --accent-solid: var(--lime-500); /* 黄绿填充面:应用标志、"已保存"、选中模板的图标 */- --on-accent: var(--olive-950); /* 黄绿面上的字,15.39:1 */- --accent-line: color-mix(in srgb, var(--olive-500) 35%, transparent);+ --accent: #1a1a1a; /* 焦点描边、勾选、链接 */+ --signal: #1a1a1a; /* "有新东西"的小点:未读、上新、回到底部。黄绿在白底上看不见,浅色下用墨色 */--brand: var(--lime-500); /* 品牌填充:只给应用标志 */--on-brand: var(--olive-950);--brand-line: color-mix(in srgb, var(--olive-500) 35%, transparent);- --accent-soft: color-mix(in srgb, var(--lime-500) 45%, transparent); /* 焦点光晕 */- --accent-wash: color-mix(in srgb, var(--lime-500) 14%, transparent); /* 选中卡片的底 */- --mark: color-mix(in srgb, var(--lime-500) 55%, var(--white)); /* 荧光笔:文字选区、定位闪烁 */- --on-mark: var(--olive-950);+ --accent-soft: rgba(0, 0, 0, .1); /* 焦点光晕:中性 */+ --mark: rgba(0, 0, 0, .12); /* 选中文字、定位闪烁:中性 */+ --on-mark: var(--fg);--sel: rgba(0, 0, 0, .055); /* 菜单、命令面板的当前项(悬停或键盘) */--sel-press: rgba(0, 0, 0, .09);--switch-off: rgba(0, 0, 0, .13);@@ -110,14 +101,11 @@--red-wash: color-mix(in srgb, var(--red-600) 8%, transparent); /* 出错的提示行:只铺一层淡红,字用 --fg,图标用 --red */--amber-wash: color-mix(in srgb, var(--amber-700) 8%, transparent); /* 需要注意的提示行 */- /* —— 投影:xs/sm 贴面,md 浮起的胶囊,lg 弹出层与对话框,pane 浮在环境光上的面板 —— */- --shadow-xs: 0 1px 2px rgba(0, 0, 0, .05);- --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05), 0 3px 10px rgba(0, 0, 0, .05);- --shadow-md: 0 2px 6px rgba(0, 0, 0, .05), 0 10px 28px rgba(0, 0, 0, .09);- --shadow-lg: 0 4px 12px rgba(0, 0, 0, .06), 0 24px 60px rgba(0, 0, 0, .16);- --shadow-pane: 0 0 0 var(--hairline) rgba(0, 0, 0, .1), 0 1px 3px rgba(0, 0, 0, .04), 0 8px 30px rgba(0, 0, 0, .04);- --shadow-tile: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 6px rgba(0, 0, 0, .035); /* 侧栏选中项:浮起的玻璃片(只有投影,不描边) */- --seg-edge: 0 1px 2px rgba(0, 0, 0, .14); /* 分段 thumb、开关圆钮:只有投影,不描边 */+ /* —— 投影:只有浮在内容上的东西才有,而且很淡。窗口、面板、组、选中项都没有(见 README「容器与层次」) —— */+ --drop-float: 0 1px 3px rgba(0, 0, 0, .05); /* 常驻的浮件:输入框、回到底部、提示胶囊 */+ --drop-pop: 0 4px 16px rgba(0, 0, 0, .08); /* 临时弹出:菜单、引导卡片、抽屉 */+ --drop-modal: 0 12px 40px rgba(0, 0, 0, .14); /* 模态:对话框、命令面板 */+ --seg-edge: 0 1px 2px rgba(0, 0, 0, .1); /* 分段 thumb、开关圆钮:白色小件放在灰底上要一点点影子 *//* —— 机器人头像:角色颜色在 primitives 的 --bot-*,这里只给随主题变的光晕和影子 —— */--avatar-aura: 30%; /* 工作中头像背后的辉光(角色辉光色的混合比例) */@@ -127,11 +115,12 @@/* 由其他语义 token 推导的值:每个主题作用域都要重新计算,否则子树会继承外层主题算好的结果 */:root, [data-theme] {--code-bg: color-mix(in srgb, var(--fg) 7%, transparent);- --ring: 0 0 0 3px var(--accent-soft); /* 焦点光晕,配合 accent 色描边 */- --ring-danger: 0 0 0 3px color-mix(in srgb, var(--red) 18%, transparent);- --glass-ring: inset 0 1px 0 var(--glass-hi), 0 0 0 var(--hairline) var(--glass-edge); /* 玻璃的边:顶边高光 + 细描边 */- --shadow-float: var(--glass-ring), var(--shadow-md); /* 浮在内容上的玻璃:输入框、回到底部、提示 */- --shadow-pop: var(--glass-ring), var(--shadow-lg); /* 菜单、命令面板、对话框 */+ --ring: 0 0 0 2px var(--accent-soft); /* 焦点光晕,配合 accent 色描边 */+ --ring-danger: 0 0 0 2px color-mix(in srgb, var(--red) 18%, transparent);+ --shadow-pane: 0 0 0 var(--hairline) var(--glass-edge); /* 面板:只有一道细线 */+ --shadow-float: 0 0 0 var(--hairline) var(--glass-edge), var(--drop-float); /* 常驻的浮件 */+ --shadow-pop: 0 0 0 var(--hairline) var(--glass-edge), var(--drop-pop); /* 临时弹出 */+ --shadow-modal: 0 0 0 var(--hairline) var(--glass-edge), var(--drop-modal); /* 模态 */}/* 间距角色:按用途命名,取值都来自 primitives.css 的 --space-*,与主题无关(见 README「间距」)。一个角色只用一个值,兄弟表面靠它们对齐:侧栏顶部、对话顶栏、信息面板顶栏在同一条中线上;@@ -150,11 +139,11 @@/* —— 页面:居中的内容列(对话列、输入框、设置页、新建页、引导页) —— */--page-gutter: var(--space-6); /* 内容列两侧至少留这么多;窗口窄于 1000px 时 16 */- --page-top: var(--space-12); /* 设置页标题、新建页、引导页离上沿 */+ --page-top: var(--space-10); /* 设置页标题、新建页、引导页离上沿 */--page-bottom: var(--space-16); /* 滚到底时下面留的空 */--section-gap: var(--space-8); /* 页面里两个分组之间(分组标题的上方) */--section-gap-sm: var(--space-5); /* 窄面板里两个分组之间:信息面板、默认的 .list-head */- --heading-gap: var(--space-2-5); /* 页面分组标题到它下面的内容 */+ --heading-gap: var(--space-2); /* 页面分组标题到它下面的内容 *//* —— 卡片与浮层 —— */--card-pad: var(--space-4); /* 内容卡片:对话里的提问 / 审批卡、引导页卡片、侧栏空状态、模板卡 */@@ -193,7 +182,7 @@自定义代码字体同样内联 --codedata-width normal | wide | full 对话宽度(--col-w)data-code-wrap on | off 代码块自动换行(--code-wrap)- data-glass on | off 毛玻璃;off 时材质换成实色(见下一段)+ data-glass on | off 不是用户设置,只跟随系统的"降低透明度";off 时材质换成实色(见下一段)data-motion full | reduce | off 动画(tokens/motion.css) */:root {--fs-scale: 1;@@ -210,23 +199,17 @@[data-theme="dark"] {color-scheme: dark;- --bg: #0c0c0c;- --aura-brand: color-mix(in srgb, var(--lime-500) 8%, transparent);- --aura-l: .4;- --aura-c: .1;- --aura-a: .55;+ --bg: #0e0e0e;- --surface: rgba(23, 23, 23, .86); /* 比侧栏亮一档:深色下面板要浮得出来 */- --surface-solid: #151515;- --glass-side: rgba(16, 16, 16, .4);- --glass-chrome: rgba(22, 22, 22, .7);- --glass-float: rgba(42, 42, 42, .62);- --glass-panel: rgba(26, 26, 26, .68);- --glass-pop: rgba(36, 36, 36, .72);- --glass-sheet: rgba(30, 30, 30, .86);+ --surface: #191919; /* 比窗口底色亮一档;越靠上越亮 */+ --surface-solid: #191919;+ --glass-side: transparent;+ --glass-chrome: rgba(25, 25, 25, .88);+ --glass-float: rgba(35, 35, 35, .94);+ --glass-panel: #191919;+ --glass-pop: rgba(40, 40, 40, .98);+ --glass-sheet: #222222;--glass-edge: rgba(255, 255, 255, .09);- --glass-hi: rgba(255, 255, 255, .07);- --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)' opacity='.05'/%3E%3C/svg%3E");--card: rgba(255, 255, 255, .045);--well: rgba(255, 255, 255, .045);@@ -238,9 +221,9 @@--seg-track: rgba(255, 255, 255, .05);--seg-thumb-bg: rgba(255, 255, 255, .14);--side-hover: rgba(255, 255, 255, .05);- --side-press: rgba(255, 255, 255, .035);- --side-active: rgba(255, 255, 255, .09);- --side-solid: #121212;+ --side-press: rgba(255, 255, 255, .075);+ --side-active: rgba(255, 255, 255, .085);+ --side-solid: #0e0e0e;--side-solid-on: #232323;--bubble-user: rgba(255, 255, 255, .075);--bubble-ai: rgba(255, 255, 255, .05);@@ -251,6 +234,7 @@--line: rgba(255, 255, 255, .1);--line-2: rgba(255, 255, 255, .065);+ --line-strong: rgba(255, 255, 255, .22);--split-line: rgba(255, 255, 255, .22);--ctl-edge: rgba(255, 255, 255, .36); /* 3.2:1 */--ctl-edge-hover: rgba(255, 255, 255, .5);@@ -262,26 +246,24 @@--ctl-fg: #a3a3a3;--placeholder: #707070;- --primary: var(--lime-500); /* 深色下主操作直接是黄绿,和 Modelflare 官网一致 */- --primary-hover: var(--lime-300);- --primary-press: var(--lime-600);- --on-primary: var(--olive-950);- --primary-edge: inset 0 1px 0 rgba(255, 255, 255, .45), 0 1px 2px rgba(0, 0, 0, .4);- --send-bg: var(--lime-500);- --send-fg: var(--olive-950);- --accent: var(--lime-500);+ --primary: #ececec; /* 深色下主操作是近白 */+ --primary-hover: #f7f7f7;+ --primary-press: #dedede;+ --on-primary: #141414;+ --send-bg: #ececec;+ --send-fg: #141414;+ --accent: #ececec;+ --signal: var(--lime-500); /* 深色下这几个小点是黄绿 */--brand-line: color-mix(in srgb, var(--lime-500) 30%, transparent);- --accent-soft: color-mix(in srgb, var(--lime-500) 14%, transparent);- --accent-line: color-mix(in srgb, var(--lime-500) 30%, transparent);- --accent-wash: color-mix(in srgb, var(--lime-500) 7%, transparent);- --mark: color-mix(in srgb, var(--lime-500) 32%, transparent);+ --accent-soft: rgba(255, 255, 255, .14);+ --mark: rgba(255, 255, 255, .2);--on-mark: var(--fg);--sel: rgba(255, 255, 255, .08);--sel-press: rgba(255, 255, 255, .115);--switch-off: rgba(255, 255, 255, .16);--switch-off-hover: rgba(255, 255, 255, .22);--switch-knob: #d4d4d4;- --switch-knob-on: var(--olive-950);+ --switch-knob-on: #141414;--green: var(--green-300);--green-soft: var(--green-900);@@ -293,43 +275,31 @@--red-wash: color-mix(in srgb, var(--red-300) 9%, transparent);--amber-wash: color-mix(in srgb, var(--amber-300) 8%, transparent);- --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);- --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 3px 10px rgba(0, 0, 0, .25);- --shadow-md: 0 2px 8px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .42);- --shadow-lg: 0 4px 14px rgba(0, 0, 0, .35), 0 28px 70px rgba(0, 0, 0, .6);- --shadow-pane: 0 0 0 var(--hairline) rgba(255, 255, 255, .08), 0 8px 30px rgba(0, 0, 0, .35);- --shadow-tile: inset 0 1px 0 rgba(255, 255, 255, .05), 0 1px 2px rgba(0, 0, 0, .3);- --seg-edge: inset 0 var(--hairline) 0 rgba(255, 255, 255, .1), 0 1px 2px rgba(0, 0, 0, .3);+ --drop-float: 0 1px 3px rgba(0, 0, 0, .25);+ --drop-pop: 0 4px 16px rgba(0, 0, 0, .35);+ --drop-modal: 0 12px 40px rgba(0, 0, 0, .5);+ --seg-edge: none;--avatar-aura: 52%;--avatar-shadow: rgba(0, 0, 0, .5);}-/* 关掉毛玻璃(data-glass="off":设置 › 外观 › 毛玻璃效果,跟随系统时看"降低透明度" prefers-reduced-transparency):- 玻璃换成接近实色的材质、不再模糊背景,层次靠描边和投影。局部主题作用域也要跟着换,所以两种写法都要 */+/* 系统开了"降低透明度"时(data-glass="off",prefers-reduced-transparency):+ 盖在内容上的几样也换成实色、不再模糊背景。局部主题作用域也要跟着换,所以两种写法都要 */:root[data-glass="off"] {--glass-filter: none;--glass-filter-lg: none;--glass-filter-sm: none;}:root[data-glass="off"][data-theme="light"], :root[data-glass="off"] [data-theme="light"] {- --surface: #fbfbfb;- --glass-side: #f2f2f1;- --side-solid: #f2f2f1;- --glass-chrome: #fbfbfb;+ --glass-chrome: #ffffff;--glass-float: #ffffff;- --glass-panel: #f8f8f8;- --glass-pop: #fcfcfc;- --glass-sheet: #ffffff;+ --glass-pop: #ffffff;}:root[data-glass="off"][data-theme="dark"], :root[data-glass="off"] [data-theme="dark"] {- --surface: #161616;- --glass-side: #121212;- --glass-chrome: #161616;- --glass-float: #262626;- --glass-panel: #1a1a1a;- --glass-pop: #242424;- --glass-sheet: #1e1e1e;+ --glass-chrome: #191919;+ --glass-float: #232323;+ --glass-pop: #282828;}/* Locale-specific system fallbacks also apply when a custom font lacks these glyphs. */diff --git a/ui/index.html b/ui/index.htmlindex 46cbc6c..ec6a665 100644--- a/ui/index.html+++ b/ui/index.html@@ -38,7 +38,7 @@root.setAttribute("data-width", /^(wide|full)$/.test(p.width) ? p.width : "normal");root.setAttribute("data-code-wrap", p.codeWrap === true ? "on" : "off");root.setAttribute("data-motion", p.motion === "off" ? "off" : p.motion === "on" ? "full" : mq("(prefers-reduced-motion: reduce)") ? "reduce" : "full");- root.setAttribute("data-glass", p.glass === "on" || p.glass === "off" ? p.glass : mq("(prefers-reduced-transparency: reduce)") ? "off" : "on");+ root.setAttribute("data-glass", mq("(prefers-reduced-transparency: reduce)") ? "off" : "on");var px = function (v) { return typeof v === "number" && v >= 120 && v <= 1200 ? Math.round(v) + "px" : ""; };if (px(p.sideW)) root.style.setProperty("--side-w-user", px(p.sideW));if (px(p.panelW)) root.style.setProperty("--panel-w-user", px(p.panelW));diff --git a/ui/lib/access.js b/ui/lib/access.jsindex 23d1d16..9212ae6 100644--- a/ui/lib/access.js+++ b/ui/lib/access.js@@ -4,5 +4,11 @@ import { t, has } from "./i18n.js";export const channelName = (c) => (has(`access.channel.${c}`) ? t(`access.channel.${c}`) : c);+/** 渠道账号显示的名字。默认别名就是渠道名(「微信」「微信 2」),不写两遍 */+export const accountName = (a) => {+ const name = channelName(a.channel);+ return a.label.startsWith(name) ? a.label : `${name} · ${a.label}`;+};+/** 允许名单里每个人是怎么来的 */export const sourceLabel = (s) => (has(`access.source.${s}`) ? t(`access.source.${s}`) : s);diff --git a/ui/lib/bots.js b/ui/lib/bots.jsnew file mode 100644index 0000000..4bcd18b--- /dev/null+++ b/ui/lib/bots.js@@ -0,0 +1,42 @@+// 删除机器人:侧栏和机器人设置共用一份确认和请求,两处说法、行为都一样。+import { api } from "./api.js";+import { channelName } from "./access.js";+import { confirmSheet, failed, toast } from "./store.js";+import { t } from "./i18n.js";++/**+ * 它默认回复的渠道账号之后交给谁(后端的规则见 src/core/routes.ts:默认机器人没了,交给第一个机器人)。+ * 这件事删掉之后才发现会很意外,所以在确认框里说清楚。查不到就不提。+ */+async function handoverNote(bot) {+ const [{ accounts }, { bots }] = await Promise.all([api("/channel-accounts"), api("/bots")]).catch(() => [{ accounts: [] }, { bots: [] }]);+ const mine = accounts.filter((a) => a.defaultBot === bot.id);+ if (!mine.length) return "";+ const names = [...new Set(mine.map((a) => channelName(a.channel)))].join(t("sidebar.delete.listSep"));+ const heir = bots.find((b) => b.id !== bot.id);+ return heir ? t("sidebar.delete.handover", { channels: names, bot: heir.name }) : t("sidebar.delete.handoverNone", { channels: names });+}++/** 问过用户后删除。目录 Bot 是「移除」:还能在发现页找到,可以选择保留数据。返回是否真的删了 */+export async function deleteBot(bot) {+ const fromCatalog = bot.origin === "catalog";+ const note = await handoverNote(bot);+ const body = t(fromCatalog ? "botapp.remove.body" : "sidebar.delete.body");+ const keep = fromCatalog ? { label: t("botapp.remove.keep"), value: true } : null;+ const ok = await confirmSheet({+ title: t(fromCatalog ? "botapp.remove.title" : "sidebar.delete.title", { name: bot.name }),+ body: note ? `${body} ${note}` : body,+ confirmLabel: t(fromCatalog ? "botapp.remove.confirm" : "sidebar.delete.confirm"),+ danger: true,+ check: keep,+ });+ if (!ok) return false;+ try {+ await api(`/bots/${bot.id}${keep?.value ? "?keepData=1" : ""}`, { method: "DELETE" });+ toast(t(fromCatalog ? "botapp.remove.done" : "sidebar.delete.done", { name: bot.name }));+ return true;+ } catch (e) {+ failed(e);+ return false;+ }+}diff --git a/ui/lib/prefs.js b/ui/lib/prefs.jsindex d179d95..c4fdeee 100644--- a/ui/lib/prefs.js+++ b/ui/lib/prefs.js@@ -15,7 +15,6 @@ export const PREF_DEFAULTS = Object.freeze({width: "normal", // 对话宽度:normal | wide | fullcodeWrap: false, // 代码块自动换行motion: "system", // 动画:system | on | off- glass: "system", // 毛玻璃:system | on | offsendKey: "enter", // 发送:enter(Shift+Enter 换行)| mod(⌘/Ctrl+Enter 发送,Enter 换行)notify: false, // 窗口不在前台时,回复完成 / 需要确认弹系统通知sideW: 0, // 侧栏宽度(px),拖分隔条调的;0 = 默认(tokens 的 --side-w,窄窗口时更窄)@@ -23,14 +22,13 @@ export const PREF_DEFAULTS = Object.freeze({updateDismissed: "", // 侧栏叉掉的新版本提示是哪个版本;更新的版本照样提示});/** "恢复默认外观"重置的键(对话习惯不动) */-export const APPEARANCE_KEYS = ["text", "font", "fontName", "codeFont", "width", "codeWrap", "motion", "glass"];+export const APPEARANCE_KEYS = ["text", "font", "fontName", "codeFont", "width", "codeWrap", "motion"];const CHOICES = {text: ["sm", "md", "lg", "xl"],font: ["system", "serif", "custom"],width: ["normal", "wide", "full"],motion: ["system", "on", "off"],- glass: ["system", "on", "off"],sendKey: ["enter", "mod"],};@@ -92,7 +90,7 @@ function apply(p) {d.width = p.width;d.codeWrap = p.codeWrap ? "on" : "off";d.motion = p.motion === "off" ? "off" : p.motion === "on" ? "full" : mqMotion.matches ? "reduce" : "full";- d.glass = p.glass === "system" ? (mqGlass.matches ? "off" : "on") : p.glass;+ d.glass = mqGlass.matches ? "off" : "on"; // 没有设置项,只跟随系统的"降低透明度"// 拖过的宽度:<html> 上内联 --side-w-user / --panel-w-user(shell.css 取 var(--side-w-user, var(--side-w)))for (const [k, prop] of [["sideW", "--side-w-user"], ["panelW", "--panel-w-user"]])if (p[k]) root.style.setProperty(prop, `${p[k]}px`);diff --git a/ui/lib/store.js b/ui/lib/store.jsindex 4e21700..4862b4e 100644--- a/ui/lib/store.js+++ b/ui/lib/store.js@@ -44,7 +44,7 @@ export const failed = (e) => toast(typeof e === "string" ? e : e?.message || t("// —— confirm sheet ——export const dialog = createStore(null);-/** confirm({ title, body, confirmLabel, danger }) → Promise<boolean> */+/** confirm({ title, body, confirmLabel, danger, check }) → Promise<boolean>。check:{ label, value },框里多一个勾选项,选择写回 check.value */export function confirmSheet(opts) {return new Promise((resolve) => dialog.set({ ...opts, resolve }));}diff --git a/ui/locales/en/botSettings.js b/ui/locales/en/botSettings.jsindex cf26718..a38b252 100644--- a/ui/locales/en/botSettings.js+++ b/ui/locales/en/botSettings.js@@ -77,11 +77,6 @@ export default {delete: "Delete bot",deleteSub: "Permanently delete this bot and all its conversations",},- delete: {- title: "Delete “{name}”?",- body: "This permanently deletes the bot and all its conversations. This can't be undone.",- confirm: "Delete permanently",- },access: {head: "Who can use it",policy: "Only the owner and people you allow",diff --git a/ui/locales/en/botapp.js b/ui/locales/en/botapp.jsindex 572040f..f24fbf8 100644--- a/ui/locales/en/botapp.js+++ b/ui/locales/en/botapp.js@@ -34,10 +34,8 @@ export default {title: "Remove {name}?",body: "It leaves the sidebar. You can still find it in Discover.",confirm: "Remove",- keepTitle: "Keep its data?",- keepBody: "If you keep it, you can pick up where you left off next time. Otherwise its folder is deleted.",- keep: "Keep",- discard: "Don't keep",+ keep: "Keep its data so you can pick up where you left off",+ done: "Removed {name}. You can find it again in Discover",},errors: {catalog_not_found: "This bot wasn't found.",diff --git a/ui/locales/en/guide.js b/ui/locales/en/guide.jsindex 78da652..39fcf1b 100644--- a/ui/locales/en/guide.js+++ b/ui/locales/en/guide.js@@ -55,7 +55,7 @@ export default {weixin: {title: "Connect {name} to WeChat",desc: "Scan a QR code, then message it directly in WeChat. No new app to install, and it's online whenever your computer is on.",- how: ["Click the bot's name at the top to open the info panel, then “Manage chat channels”", "On the WeChat row, click “Add account” → “Scan to log in”", "Scan the code with WeChat and confirm on your phone"],+ how: ["Click the bot's name at the top to open the info panel, then “Manage chat channels”", "On the WeChat row, click “Connect”", "Scan the code with WeChat and confirm on your phone"],note: "WeChat's rule: for each message you send, it can reply up to 10 times within 24 hours. For Feishu, Telegram, Slack or Discord, add an account in the same place. All bots share accounts, and you can send /bot and a name in a chat to switch bots.",doneText: "Send it a message in WeChat. To talk to a different bot, send /bot.",},diff --git a/ui/locales/en/info.js b/ui/locales/en/info.jsindex c542d78..636e7e0 100644--- a/ui/locales/en/info.js+++ b/ui/locales/en/info.js@@ -31,7 +31,6 @@ export default {disconnect: "Disconnect",disconnectTitle: "Disconnect Feishu?",disconnectBody: "This removes the bot's Feishu App ID and App Secret.",- setupHint: "In the Feishu Open Platform, enable the Bot capability, set event subscription to “Receive events through long connection”, and subscribe to {event}. Permissions: {p1}, {p2}, {p3}, {p4}.",},messenger: {bindHint: "Send the bot a message from your own account to finish binding.",@@ -43,18 +42,15 @@ export default {telegram: {sub: "Receives messages over long polling",token: "Bot token",- setupHint: "In Telegram, message {bot}, send {cmd} to create a bot, and paste the token it gives you. Direct messages only for now. Messages sent while the app is closed are picked up for up to 24 hours.",},slack: {sub: "Receives messages over Socket Mode",botToken: "Bot token",appToken: "App-level token",- setupHint: "At api.slack.com/apps, create an app, turn on Socket Mode and generate an app-level token with {conn}. Add the bot scopes {s1}, {s2}, {s3} and {s4}, subscribe to {event}, allow messages in App Home, then install it to your workspace. Direct messages only for now. Messages sent while the app is closed aren't received.",},discord: {sub: "Receives messages over the Gateway",token: "Bot token",- setupHint: "In the Discord Developer Portal, create an application, add a bot and copy its token. Under OAuth2 → URL Generator, tick bot and add it to a server you're in, then send it a direct message. Direct messages only for now. Messages sent while the app is closed aren't received.",},},weixin: {diff --git a/ui/locales/en/settings.js b/ui/locales/en/settings.jsindex ef541f0..cee3fcd 100644--- a/ui/locales/en/settings.js+++ b/ui/locales/en/settings.js@@ -14,24 +14,19 @@ export default {},connections: {feishu: "Feishu messages",- channelSub: "Shared by all bots, and you can add several accounts. Send /bot and a name once in a chat to talk to a different bot",+ channelSub: "Message your bots from these apps. All bots share the accounts, and sending /bot and a name in a chat switches to another bot.",channelKeys: "{channel} channel chat connection account bot /bot",- addAccount: "Add account",manage: "Manage",defaultIs: "{bot} replies by default",requests: "{count} access requests",- addChannelTitle: "Add a {channel} account",defaultBot: "Default bot",defaultBotHint: "It answers new chats. Send /bot in a chat to see the bots, and /bot and a name once to switch; that chat stays with the new bot.",removeAccount: "Remove this account",removeChannelBody: "No bot will be able to send or receive through this account, and its allow list is cleared. Chat history is kept.",- notionSub: "Shared by all bots, and you can add several accounts. Read-only bots can only read, and no bot can delete pages",- feishuSub: "Shared by all bots, and you can add several accounts. Reads your chats and messages as you, read-only",+ notionSub: "Pages and databases. Read-only bots can only read, and no bot can delete pages",+ feishuSub: "Reads your chats and messages as you, read-only",notionKeys: "notion notes docs database connection account authorize",feishuKeys: "feishu lark messages chats connection account authorize",- oneClick: "Authorize",- notionOther: "Use a token",- feishuOther: "Use my own app",viaToken: "Token",viaOAuth: "Authorized",needsReauth: "Authorization expired. Authorize again",@@ -41,7 +36,6 @@ export default {removeTitle: "Remove {name}?",removeBody: "No bot will be able to use this account. You can add it again later.",notionOAuthTitle: "Authorize Notion",- notionOAuthBody: "Notion's authorization page is open in your browser. Approve it, then come back here.",oauthFailed: "Couldn't open the authorization page. Try again later",openAgain: "Didn't open? Click here",waiting: "Waiting for your approval…",@@ -53,15 +47,96 @@ export default {feishuTitle: "Add a Feishu account",feishuAppHint: "The app needs user permissions for reading messages. You'll scan a code to authorize next.",next: "Next",- feishuChatStep: "Scan with Feishu to create your bot app. Then send it a message in Feishu to start chatting.",- feishuStepCreate: "Step 1: scan with Feishu to create your personal app",- feishuStepAuthorize: "Step 2: scan with Feishu to let it read your chats and messages",qrAlt: "Feishu authorization QR code",openInBrowser: "Open in browser ↗",retry: "Try again",renameHint: "You can use this name when you talk to a bot, like \"check my work Feishu\".",nameLabel: "Name",save: "Save",+ dataSub: "Bots can read these accounts for you. All bots share them and you can add several, so you can say \"check my work Feishu messages\".",+ connect: "Connect",+ addOne: "Add another",+ addAnother: "Add another account",+ addAnotherSub: "One app can have several accounts",+ how: {+ weixin: "Scan a QR code with WeChat on your phone",+ feishu: "Scan with Feishu on your phone. The app is created for you",+ telegram: "Create a bot with @BotFather and paste its token",+ slack: "Create a Slack app and paste two tokens",+ discord: "Create a Discord app and paste its bot token"+ },+ connectTitle: "Connect {channel}",+ connectedTitle: "{channel} connected",+ connectingTitle: "Connecting {channel}…",+ failedTitle: "{channel} didn't connect",+ waitingScan: "Waiting for you to scan…",+ waitingOwner: "Send the first message to finish linking",+ useToken: "Use a token instead",+ useOneClick: "Use one-click authorization",+ useApp: "Use my own app",+ useScan: "Scan a code instead",+ feishuPortal: "Feishu Open Platform ↗",+ oauthTimedOut: "This took too long and the authorization page has expired. Start again.",+ steps: {+ weixin: [+ "Scan the code below with “Scan” in WeChat on your phone",+ "Confirm on your phone"+ ],+ feishu: [+ "Scan the code below with Feishu on your phone",+ "Follow the prompts to create your bot app"+ ],+ feishuApp: [+ "On {link}, turn on “Bot”, choose “Receive events through a persistent connection” under event subscriptions, and subscribe to {event}",+ "Turn on these permissions: {p1}, {p2}, {p3}, {p4}",+ "Enter the App ID and App Secret below"+ ],+ telegram: [+ "Find {bot} in Telegram and send {cmd} to create a bot",+ "Enter the token it gives you below"+ ],+ slack: [+ "On {link}, create an app, turn on Socket Mode, and generate an App-Level Token with {conn}",+ "Give the Bot Token {s1}, {s2}, {s3} and {s4}, and subscribe to the {event} event",+ "Allow messages in App Home, then install the app to your workspace",+ "Enter both tokens below"+ ],+ discord: [+ "In the {link}, create an app, add a Bot, and copy its token",+ "Use the OAuth2 URL Generator with bot checked to add it to a server you're in",+ "Enter the token below, then send it a direct message in Discord"+ ],+ notion: [+ "On the browser page that just opened, choose what to share and approve",+ "Come back here. The account appears on its own"+ ],+ feishuData: [+ "Scan with Feishu on your phone to create your personal app",+ "Scan again to let it read your chats and messages"+ ],+ feishuDataApp: [+ "Scan with Feishu on your phone to let it read your chats and messages"+ ]+ },+ tryIt: "Send it a message in {channel}",+ switchBot: "To talk to a different bot, send /bot and its name",+ ownerWaiting: "Waiting for your first message. Whoever messages first becomes the owner, and everyone else needs the owner's approval.",+ ownerBound: "{who} is the owner. You can start chatting.",+ ownerLogin: "Your {channel} account is the owner. You can start chatting.",+ openChat: "Open {channel} ↗",+ done: "Done",+ fix: "Change connection details",+ limit: {+ weixin: "WeChat's rule: for each message you send, it can reply up to 10 times within 24 hours.",+ telegram: "Only direct chats are handled for now. Messages sent while the app is closed are picked up within 24 hours.",+ slack: "Only direct chats are handled for now. Messages sent while the app is closed aren't received.",+ discord: "Only direct chats are handled for now. Messages sent while the app is closed aren't received."+ },+ connection: "Connection",+ viaScan: "WeChat QR code",+ changeApp: "Change app",+ changeToken: "Change token",+ removed: "Removed {name}"},gateway: {running: "Running",@@ -82,10 +157,22 @@ export default {search: "Search settings",nav: "Settings sections",},+ groups: {+ theme: "Theme",+ text: "Text",+ layout: "Layout",+ effects: "Effects",+ desktop: "Desktop app",+ account: "Account",+ models: "Models",+ line: "Connection",+ channels: "Chat channels",+ data: "Data accounts",+ },searchResults: "Search results",noMatch: "No matching settings",preview: {- ask: "Rewrite this request using async / await",+ label: "Preview",reply: "Sure, and error handling gets clearer too. With {b} on, the line below wraps:",},logout: {@@ -184,11 +271,6 @@ export default {sub: "When off, transitions, pop-ups and bot avatars stay still. System follows your Reduce motion setting",keys: "animation motion transition reduce motion",},- glass: {- name: "Frosted glass",- sub: "When off, the sidebar, menus and dialogs use solid colors for clearer text and longer battery life. System follows your Reduce transparency setting",- keys: "glass frosted blur transparency reduce transparency battery performance lag",- },resetAppearance: {name: "Reset appearance",subDesktop: "Restore theme, fonts, zoom and all the settings above to their defaults",@@ -285,6 +367,8 @@ export default {},cuStatus: {name: "Computer use backend",+ ready: "Available",+ notReady: "Unavailable",keys: "computer use cua accessibility screen recording",},cuNotice: {diff --git a/ui/locales/en/sidebar.js b/ui/locales/en/sidebar.jsindex af50a81..4c36f12 100644--- a/ui/locales/en/sidebar.js+++ b/ui/locales/en/sidebar.js@@ -7,11 +7,16 @@ export default {accountDetails: "Account and usage",balance: "Balance",topUp: "Top up ↗",- lowBalance: "Only {amount} left — top up ↗",+ lowBalance: "Balance is running low",+ belowLine: "Below your {amount} alert",update: "Version {version} is available — download ↗",updateDismiss: "Don't remind me about this version",renamed: "Renamed",delete: {+ done: "Deleted {name}",+ handover: "{bot} will answer {channels} from now on.",+ handoverNone: "This is your last bot, so messages in {channels} won't get a reply until you create a new one.",+ listSep: ", ",title: "Delete “{name}”?",body: "This permanently deletes the bot and all its conversations. This can't be undone.",confirm: "Delete permanently",diff --git a/ui/locales/ja/botSettings.js b/ui/locales/ja/botSettings.jsindex 51d7f1f..09f53c2 100644--- a/ui/locales/ja/botSettings.js+++ b/ui/locales/ja/botSettings.js@@ -76,11 +76,6 @@ export default {"delete": "ボットを削除","deleteSub": "このボットとすべての会話を完全に削除します"},- "delete": {- "title": "「{name}」を削除しますか?",- "body": "ボットとすべての会話を完全に削除します。この操作は取り消せません。",- "confirm": "完全に削除"- },"access": {"head": "利用できる人","policy": "所有者と、許可した人だけが利用できます",diff --git a/ui/locales/ja/botapp.js b/ui/locales/ja/botapp.jsindex 2d2d43f..198dd08 100644--- a/ui/locales/ja/botapp.js+++ b/ui/locales/ja/botapp.js@@ -34,10 +34,8 @@ export default {title: "{name} を削除しますか?",body: "サイドバーから消えますが、発見ページからまた見つけられます。",confirm: "削除",- keepTitle: "データを残しますか?",- keepBody: "残すと、次回は前回の続きから使えます。残さない場合はフォルダーを削除します。",- keep: "残す",- discard: "残さない",+ keep: "データを残して、次回は続きから使えるようにする",+ done: "{name} を削除しました。発見ページからまた見つけられます",},errors: {catalog_not_found: "この Bot は見つかりません。",diff --git a/ui/locales/ja/guide.js b/ui/locales/ja/guide.jsindex be8683f..eeadf31 100644--- a/ui/locales/ja/guide.js+++ b/ui/locales/ja/guide.js@@ -60,7 +60,7 @@ export default {"desc": "QR コードを読み取れば、WeChat から直接話しかけられます。新しいアプリは不要で、パソコンが起動していれば利用できます。","how": ["上部のボット名をクリックして情報パネルを開き、「チャットの接続先を管理」を選びます",- "WeChat の行で「アカウントを追加」→「QR コードでログイン」をクリックします",+ "WeChat の行で「接続」をクリックします","WeChat でコードを読み取り、スマートフォンで確認します"],"note": "WeChat の仕様上、送ったメッセージごとに 24 時間以内、最大 10 回の返信が可能です。Feishu、Telegram、Slack、Discord のアカウントも同じ場所から追加できます。アカウントはすべてのボットで共有し、チャットで /bot と名前を送るとボットを切り替えられます。",diff --git a/ui/locales/ja/info.js b/ui/locales/ja/info.jsindex 66b7ebb..5be54e2 100644--- a/ui/locales/ja/info.js+++ b/ui/locales/ja/info.js@@ -30,7 +30,6 @@ export default {"disconnect": "接続を解除","disconnectTitle": "Feishu との接続を解除しますか?","disconnectBody": "このボットの Feishu App ID と App Secret を削除します。",- "setupHint": "Feishu Open Platform で Bot 機能を有効にし、イベントの受信方法を「Receive events through long connection」に設定して、{event} を購読してください。必要な権限:{p1}、{p2}、{p3}、{p4}。"},"messenger": {"bindHint": "自分のアカウントからボットにメッセージを送り、紐付けを完了してください。",@@ -42,18 +41,15 @@ export default {"telegram": {"sub": "ロングポーリングでメッセージを受信します","token": "Bot トークン",- "setupHint": "Telegram で {bot} に {cmd} を送り、ボットを作成して、発行されたトークンを貼り付けてください。現在はダイレクトメッセージのみに対応しています。アプリを閉じている間のメッセージは、最大 24 時間分まで取得できます。"},"slack": {"sub": "Socket Mode でメッセージを受信します","botToken": "Bot トークン","appToken": "アプリレベルトークン",- "setupHint": "api.slack.com/apps でアプリを作成し、Socket Mode を有効にして、{conn} を持つアプリレベルトークンを発行してください。Bot のスコープに {s1}、{s2}、{s3}、{s4} を追加し、{event} を購読して、App Home でのメッセージを許可した後、ワークスペースにインストールします。現在はダイレクトメッセージのみに対応しています。アプリを閉じている間のメッセージは受信できません。"},"discord": {"sub": "Gateway 経由でメッセージを受信します","token": "Bot トークン",- "setupHint": "Discord Developer Portal でアプリケーションを作成し、Bot を追加してトークンをコピーしてください。「OAuth2 → URL Generator」で bot を選択し、自分が参加しているサーバーに追加してから、ダイレクトメッセージを送ります。現在はダイレクトメッセージのみに対応しています。アプリを閉じている間のメッセージは受信できません。"}},"weixin": {diff --git a/ui/locales/ja/settings.js b/ui/locales/ja/settings.jsindex 3c0b4ba..ebf66b9 100644--- a/ui/locales/ja/settings.js+++ b/ui/locales/ja/settings.js@@ -13,24 +13,19 @@ export default {},"connections": {"feishu": "Feishu メッセージ",- "channelSub": "すべてのボットで共有し、複数のアカウントを追加できます。チャットで /bot と名前を一度送ると、話す相手のボットを切り替えられます",+ "channelSub": "これらのアプリからボットにメッセージを送れます。アカウントはすべてのボットで共有され、チャットで /bot と名前を送ると別のボットに切り替わります。","channelKeys": "{channel} チャネル チャット 接続 アカウント ボット /bot",- "addAccount": "アカウントを追加","manage": "管理","defaultIs": "既定では {bot} が返信します","requests": "アクセス申請 {count} 件",- "addChannelTitle": "{channel} アカウントを追加","defaultBot": "既定のボット","defaultBotHint": "新しいチャットに返信するボットです。/bot で一覧を表示し、/bot と名前を一度送ると切り替わります。そのチャットでは以後、選んだボットが返信します。","removeAccount": "このアカウントを削除","removeChannelBody": "どのボットもこのアカウントで送受信できなくなり、許可リストも消去されます。チャット履歴は保持されます。",- "notionSub": "すべてのボットで共有し、複数のアカウントを追加できます。読み取り専用のボットは閲覧のみ可能で、どのボットもページは削除できません",- "feishuSub": "すべてのボットで共有し、複数のアカウントを追加できます。あなたの権限でチャットやメッセージを読み取ります。書き込みは行いません",+ "notionSub": "ページとデータベース。読み取り専用のボットは読むだけで、どのボットもページを削除できません",+ "feishuSub": "あなたの権限でチャットとメッセージを読み取ります(読み取り専用)","notionKeys": "Notion ノート 文書 データベース 接続 アカウント 認可","feishuKeys": "Feishu Lark メッセージ チャット 接続 アカウント 認可",- "oneClick": "アクセスを許可",- "notionOther": "トークンを使う",- "feishuOther": "自分のアプリを使う","viaToken": "トークン","viaOAuth": "認可済み","needsReauth": "認可の有効期限が切れました。再認可してください",@@ -40,7 +35,6 @@ export default {"removeTitle": "{name} を削除しますか?","removeBody": "どのボットもこのアカウントを利用できなくなります。後から再追加できます。","notionOAuthTitle": "Notion へのアクセスを許可",- "notionOAuthBody": "ブラウザーで Notion の認可ページを開きました。許可した後、この画面に戻ってください。","oauthFailed": "認可ページを開けませんでした。時間をおいて再試行してください","openAgain": "開かない場合はこちら","waiting": "許可を待っています…",@@ -52,15 +46,96 @@ export default {"feishuTitle": "Feishu アカウントを追加","feishuAppHint": "アプリにはメッセージを読み取るユーザー権限が必要です。次にコードを読み取って認可します。","next": "次へ",- "feishuChatStep": "Feishu でコードを読み取り、ボットアプリを作成します。その後 Feishu でメッセージを送ると、会話を始められます。",- "feishuStepCreate": "手順 1:Feishu でコードを読み取り、個人用アプリを作成",- "feishuStepAuthorize": "手順 2:Feishu でコードを読み取り、チャットとメッセージへのアクセスを許可","qrAlt": "Feishu 認可用 QR コード","openInBrowser": "ブラウザーで開く ↗","retry": "再試行","renameHint": "「仕事用の Feishu を確認して」のように、ボットに話しかける際にこの名前を使えます。","nameLabel": "名前",- "save": "保存"+ "save": "保存",+ "dataSub": "ボットがあなたに代わってこれらのアカウントを読み取れます。すべてのボットで共有され、複数追加できます。「仕事の Feishu のメッセージを見て」のように頼めます。",+ "connect": "接続",+ "addOne": "もう1つ追加",+ "addAnother": "アカウントをもう1つ追加",+ "addAnotherSub": "同じアプリに複数のアカウントを接続できます",+ "how": {+ "weixin": "スマートフォンの WeChat で QR コードをスキャン",+ "feishu": "スマートフォンの Feishu でスキャン(アプリは自動で作成)",+ "telegram": "@BotFather でボットを作成し、トークンを入力",+ "slack": "Slack アプリを作成し、トークンを2つ入力",+ "discord": "Discord アプリを作成し、ボットトークンを入力"+ },+ "connectTitle": "{channel} に接続",+ "connectedTitle": "{channel} に接続しました",+ "connectingTitle": "{channel} に接続中…",+ "failedTitle": "{channel} に接続できませんでした",+ "waitingScan": "スキャンを待っています…",+ "waitingOwner": "最初のメッセージを送ると紐付けが完了します",+ "useToken": "トークンを使う",+ "useOneClick": "ワンクリック認証を使う",+ "useApp": "自分のアプリを使う",+ "useScan": "スキャンで接続する",+ "feishuPortal": "Feishu オープンプラットフォーム ↗",+ "oauthTimedOut": "時間がかかりすぎたため、認証ページの期限が切れました。もう一度やり直してください。",+ "steps": {+ "weixin": [+ "スマートフォンの WeChat の「スキャン」で下の QR コードを読み取る",+ "スマートフォンで確認する"+ ],+ "feishu": [+ "スマートフォンの Feishu で下の QR コードを読み取る",+ "案内に従ってボットアプリを作成する"+ ],+ "feishuApp": [+ "{link} で「ボット」を有効にし、イベント購読で「長時間接続でイベントを受信」を選んで {event} を購読する",+ "権限を有効にする:{p1}、{p2}、{p3}、{p4}",+ "App ID と App Secret を下に入力する"+ ],+ "telegram": [+ "Telegram で {bot} を探し、{cmd} を送ってボットを作成する",+ "受け取ったトークンを下に入力する"+ ],+ "slack": [+ "{link} でアプリを作成し、Socket Mode を有効にして {conn} 付きの App-Level Token を生成する",+ "Bot Token に {s1}、{s2}、{s3}、{s4} を追加し、イベント {event} を購読する",+ "App Home でメッセージを許可し、ワークスペースにインストールする",+ "2つのトークンを下に入力する"+ ],+ "discord": [+ "{link} でアプリを作成して Bot を追加し、トークンをコピーする",+ "OAuth2 の URL Generator で bot を選び、参加しているサーバーに追加する",+ "トークンを下に入力し、Discord でボットに DM を送る"+ ],+ "notion": [+ "開いたブラウザーのページで内容を選び、同意する",+ "ここに戻ると、アカウントが自動で表示されます"+ ],+ "feishuData": [+ "スマートフォンの Feishu でスキャンして個人アプリを作成する",+ "もう一度スキャンして、チャットとメッセージの読み取りを許可する"+ ],+ "feishuDataApp": [+ "スマートフォンの Feishu でスキャンして、チャットとメッセージの読み取りを許可する"+ ]+ },+ "tryIt": "{channel} でメッセージを送ってみる",+ "switchBot": "別のボットと話すには /bot と名前を送る",+ "ownerWaiting": "最初のメッセージを待っています。最初にメッセージを送った人が所有者になり、他の人は所有者の許可が必要です。",+ "ownerBound": "「{who}」が所有者です。チャットを始められます。",+ "ownerLogin": "あなたの {channel} が所有者です。チャットを始められます。",+ "openChat": "{channel} を開く ↗",+ "done": "完了",+ "fix": "接続情報を変更",+ "limit": {+ "weixin": "WeChat の規定:メッセージ1件につき、24時間以内に最大10件まで返信できます。",+ "telegram": "現在は1対1のチャットのみ対応しています。アプリを閉じている間のメッセージは、24時間以内なら後から受信できます。",+ "slack": "現在は1対1のチャットのみ対応しています。アプリを閉じている間のメッセージは受信できません。",+ "discord": "現在は1対1のチャットのみ対応しています。アプリを閉じている間のメッセージは受信できません。"+ },+ "connection": "接続方法",+ "viaScan": "WeChat の QR コード",+ "changeApp": "アプリを変更",+ "changeToken": "トークンを変更",+ "removed": "{name} を削除しました"},"gateway": {"running": "稼働中",@@ -97,10 +172,22 @@ export default {"search": "設定を検索","nav": "設定カテゴリ"},+ "groups": {+ "theme": "テーマ",+ "text": "文字",+ "layout": "レイアウト",+ "effects": "効果",+ "desktop": "デスクトップアプリ",+ "account": "アカウント",+ "models": "モデル",+ "line": "接続",+ "channels": "チャットチャネル",+ "data": "データアカウント",+ },"searchResults": "検索結果","noMatch": "一致する設定がありません","preview": {- "ask": "このリクエストを async / await を使って書き直して",+ "label": "プレビュー","reply": "エラー処理も読みやすくなります。{b} を有効にすると、下の行が折り返されます。"},"logout": {@@ -199,11 +286,6 @@ export default {"sub": "オフにすると、画面切り替え、ポップアップ、ボットのアバターが動かなくなります。「システム」は「視差効果を減らす」設定に従います","keys": "アニメーション 動き 切り替え 視差効果を減らす"},- "glass": {- "name": "すりガラス効果",- "sub": "オフにすると、サイドバー、メニュー、ダイアログを不透明にし、文字を読みやすくして消費電力を抑えます。「システム」は「透明度を下げる」設定に従います",- "keys": "ガラス ぼかし 透明 透明度 バッテリー 性能 遅い"- },"resetAppearance": {"name": "外観をリセット","subDesktop": "テーマ、フォント、ズーム、上記の設定をすべて既定値に戻します",@@ -306,6 +388,8 @@ export default {},"cuStatus": {"name": "コンピューター操作のバックエンド",+ "ready": "利用可能",+ "notReady": "利用不可","keys": "コンピューター操作 CUA アクセシビリティ 画面収録"},"cuNotice": {diff --git a/ui/locales/ja/sidebar.js b/ui/locales/ja/sidebar.jsindex 42ace3a..aecc2de 100644--- a/ui/locales/ja/sidebar.js+++ b/ui/locales/ja/sidebar.js@@ -7,11 +7,16 @@ export default {"accountDetails": "アカウントと利用状況","balance": "残高","topUp": "チャージ ↗",- "lowBalance": "残高 {amount} — チャージ ↗",+ "lowBalance": "残高が少なくなっています",+ "belowLine": "通知ライン {amount} を下回っています","update": "バージョン {version} を利用できます — ダウンロード ↗","updateDismiss": "このバージョンの通知を表示しない","renamed": "名前を変更しました","delete": {+ "done": "「{name}」を削除しました",+ "handover": "{channels} には今後「{bot}」が返信します。",+ "handoverNone": "これが最後のボットです。新しいボットを作るまで、{channels} のメッセージには返信されません。",+ "listSep": "、","title": "「{name}」を削除しますか?","body": "ボットとすべての会話を完全に削除します。この操作は取り消せません。","confirm": "完全に削除"diff --git a/ui/locales/ko/botSettings.js b/ui/locales/ko/botSettings.jsindex e0d7f4e..4ae94cd 100644--- a/ui/locales/ko/botSettings.js+++ b/ui/locales/ko/botSettings.js@@ -76,11 +76,6 @@ export default {"delete": "봇 삭제","deleteSub": "이 봇과 모든 대화를 영구적으로 삭제합니다"},- "delete": {- "title": "‘{name}’을(를) 삭제할까요?",- "body": "봇과 모든 대화가 영구적으로 삭제됩니다. 이 작업은 되돌릴 수 없습니다.",- "confirm": "영구 삭제"- },"access": {"head": "사용 가능한 사람","policy": "소유자와 허용한 사람만 사용 가능",diff --git a/ui/locales/ko/botapp.js b/ui/locales/ko/botapp.jsindex 9529dee..cedceda 100644--- a/ui/locales/ko/botapp.js+++ b/ui/locales/ko/botapp.js@@ -34,10 +34,8 @@ export default {title: "{name}을(를) 제거할까요?",body: "사이드바에서 사라지지만 둘러보기에서 다시 찾을 수 있습니다.",confirm: "제거",- keepTitle: "데이터를 보관할까요?",- keepBody: "보관하면 다음에 이어서 쓸 수 있습니다. 보관하지 않으면 폴더가 삭제됩니다.",- keep: "보관",- discard: "보관 안 함",+ keep: "데이터를 보관해 다음에 이어서 쓰기",+ done: "{name}을(를) 제거했습니다. 둘러보기에서 다시 찾을 수 있습니다",},errors: {catalog_not_found: "이 봇을 찾을 수 없습니다.",diff --git a/ui/locales/ko/guide.js b/ui/locales/ko/guide.jsindex 3f58eba..fe62852 100644--- a/ui/locales/ko/guide.js+++ b/ui/locales/ko/guide.js@@ -60,7 +60,7 @@ export default {"desc": "QR 코드를 스캔하면 WeChat에서 바로 대화할 수 있습니다. 새 앱을 설치할 필요 없이 컴퓨터가 켜져 있는 동안 이용할 수 있습니다.","how": ["상단의 봇 이름을 눌러 정보 패널을 열고 ‘채팅 채널 관리’ 선택",- "WeChat 항목에서 ‘계정 추가’ → ‘QR 코드로 로그인’ 선택",+ "WeChat 항목에서 ‘연결’ 선택","WeChat으로 QR 코드를 스캔하고 휴대폰에서 확인"],"note": "WeChat 규정에 따라 메시지를 보낼 때마다 24시간 이내에 최대 10회의 답장을 받을 수 있습니다. Feishu, Telegram, Slack, Discord도 같은 곳에서 계정을 추가하세요. 모든 봇이 계정을 공유하며 대화에서 /bot과 이름을 보내면 봇을 변경할 수 있습니다.",diff --git a/ui/locales/ko/info.js b/ui/locales/ko/info.jsindex b8c6dc7..9a6159e 100644--- a/ui/locales/ko/info.js+++ b/ui/locales/ko/info.js@@ -30,7 +30,6 @@ export default {"disconnect": "연결 해제","disconnectTitle": "Feishu 연결을 해제할까요?","disconnectBody": "봇의 Feishu App ID와 App Secret이 삭제됩니다.",- "setupHint": "Feishu Open Platform에서 봇 기능을 켜고 이벤트 구독을 ‘Receive events through long connection’으로 설정한 뒤 {event}를 구독하세요. 필요한 권한: {p1}, {p2}, {p3}, {p4}."},"messenger": {"bindHint": "본인의 계정에서 봇에게 메시지를 보내 연결을 완료하세요.",@@ -42,18 +41,15 @@ export default {"telegram": {"sub": "롱 폴링으로 메시지를 수신합니다","token": "봇 토큰",- "setupHint": "Telegram에서 {bot}에게 {cmd}를 보내 봇을 만든 다음 발급된 토큰을 붙여 넣으세요. 현재는 개인 메시지만 지원합니다. 앱이 닫혀 있는 동안 보낸 메시지는 최대 24시간 이내에 수신할 수 있습니다."},"slack": {"sub": "Socket Mode로 메시지를 수신합니다","botToken": "봇 토큰","appToken": "앱 수준 토큰",- "setupHint": "api.slack.com/apps에서 앱을 만들고 Socket Mode를 켠 뒤 {conn} 권한으로 앱 수준 토큰을 생성하세요. 봇 권한 {s1}, {s2}, {s3}, {s4}를 추가하고 {event}를 구독한 다음 App Home에서 메시지를 허용하고 워크스페이스에 설치하세요. 현재는 개인 메시지만 지원합니다. 앱이 닫혀 있는 동안의 메시지는 수신되지 않습니다."},"discord": {"sub": "Gateway로 메시지를 수신합니다","token": "봇 토큰",- "setupHint": "Discord Developer Portal에서 애플리케이션과 봇을 만들고 토큰을 복사하세요. OAuth2 → URL Generator에서 bot을 선택해 참여 중인 서버에 추가한 뒤 개인 메시지를 보내세요. 현재는 개인 메시지만 지원합니다. 앱이 닫혀 있는 동안의 메시지는 수신되지 않습니다."}},"weixin": {diff --git a/ui/locales/ko/settings.js b/ui/locales/ko/settings.jsindex e874625..886e4de 100644--- a/ui/locales/ko/settings.js+++ b/ui/locales/ko/settings.js@@ -13,24 +13,19 @@ export default {},"connections": {"feishu": "Feishu 메시지",- "channelSub": "모든 봇이 공유하며 여러 계정을 추가할 수 있습니다. 대화에서 /bot과 이름을 한 번 보내면 다른 봇으로 전환됩니다",+ "channelSub": "이 앱들에서 봇에게 메시지를 보낼 수 있습니다. 계정은 모든 봇이 함께 쓰며, 채팅에서 /bot과 이름을 보내면 다른 봇으로 바뀝니다.","channelKeys": "{channel} 채널 채팅 연결 계정 봇 /bot",- "addAccount": "계정 추가","manage": "관리","defaultIs": "기본 응답 봇: {bot}","requests": "접근 요청 {count}개",- "addChannelTitle": "{channel} 계정 추가","defaultBot": "기본 봇","defaultBotHint": "새 대화에 응답할 봇입니다. 대화에서 /bot으로 목록을 보고 /bot과 이름을 한 번 보내면 해당 대화가 선택한 봇으로 전환됩니다.","removeAccount": "이 계정 삭제","removeChannelBody": "모든 봇이 이 계정으로 메시지를 주고받을 수 없게 되며 허용 목록도 삭제됩니다. 대화 기록은 유지됩니다.",- "notionSub": "모든 봇이 공유하며 여러 계정을 추가할 수 있습니다. 읽기 전용 봇은 읽기만 가능하고 어떤 봇도 페이지를 삭제할 수 없습니다",- "feishuSub": "모든 봇이 공유하며 여러 계정을 추가할 수 있습니다. 내 계정으로 채팅과 메시지를 읽으며 변경은 하지 않습니다",+ "notionSub": "페이지와 데이터베이스. 읽기 전용 봇은 읽기만 할 수 있고, 어떤 봇도 페이지를 삭제할 수 없습니다",+ "feishuSub": "내 권한으로 대화와 메시지를 읽습니다(읽기 전용)","notionKeys": "notion 노션 노트 문서 데이터베이스 연결 계정 인증","feishuKeys": "feishu lark 메시지 채팅 연결 계정 인증",- "oneClick": "접근 허용",- "notionOther": "토큰 사용",- "feishuOther": "내 앱 사용","viaToken": "토큰","viaOAuth": "인증됨","needsReauth": "인증이 만료되었습니다. 다시 인증해 주세요",@@ -40,7 +35,6 @@ export default {"removeTitle": "{name}을(를) 삭제할까요?","removeBody": "모든 봇이 이 계정을 사용할 수 없게 됩니다. 나중에 다시 추가할 수 있습니다.","notionOAuthTitle": "Notion 접근 허용",- "notionOAuthBody": "브라우저에서 Notion 인증 페이지를 열었습니다. 접근을 허용한 뒤 여기로 돌아오세요.","oauthFailed": "인증 페이지를 열지 못했습니다. 나중에 다시 시도해 주세요","openAgain": "열리지 않았나요? 여기를 누르세요","waiting": "접근 허용을 기다리는 중…",@@ -52,15 +46,96 @@ export default {"feishuTitle": "Feishu 계정 추가","feishuAppHint": "앱에 메시지 읽기 사용자 권한이 필요합니다. 다음 단계에서 QR 코드를 스캔해 인증합니다.","next": "다음",- "feishuChatStep": "Feishu로 스캔해 봇 앱을 만드세요. 그런 다음 Feishu에서 봇에게 메시지를 보내 대화를 시작하세요.",- "feishuStepCreate": "1단계: Feishu로 스캔해 개인 앱 만들기",- "feishuStepAuthorize": "2단계: Feishu로 스캔해 채팅 및 메시지 읽기 허용","qrAlt": "Feishu 인증 QR 코드","openInBrowser": "브라우저에서 열기 ↗","retry": "다시 시도","renameHint": "봇과 대화할 때 이 이름을 사용할 수 있습니다. 예: ‘업무용 Feishu 확인해 줘’","nameLabel": "이름",- "save": "저장"+ "save": "저장",+ "dataSub": "봇이 이 계정들을 대신 읽을 수 있습니다. 모든 봇이 함께 쓰고 여러 개 추가할 수 있으며, “회사 Feishu 메시지 확인해 줘”처럼 말하면 됩니다.",+ "connect": "연결",+ "addOne": "하나 더 추가",+ "addAnother": "계정 하나 더 추가",+ "addAnotherSub": "같은 앱에 여러 계정을 연결할 수 있습니다",+ "how": {+ "weixin": "휴대폰 WeChat으로 QR 코드 스캔",+ "feishu": "휴대폰 Feishu로 스캔(앱은 자동으로 생성)",+ "telegram": "@BotFather에서 봇을 만들고 토큰 입력",+ "slack": "Slack 앱을 만들고 토큰 2개 입력",+ "discord": "Discord 앱을 만들고 봇 토큰 입력"+ },+ "connectTitle": "{channel} 연결",+ "connectedTitle": "{channel} 연결됨",+ "connectingTitle": "{channel} 연결 중…",+ "failedTitle": "{channel} 연결 실패",+ "waitingScan": "스캔을 기다리는 중…",+ "waitingOwner": "첫 메시지를 보내면 연동이 완료됩니다",+ "useToken": "토큰으로 연결",+ "useOneClick": "원클릭 인증으로 연결",+ "useApp": "내 앱으로 연결",+ "useScan": "스캔으로 연결",+ "feishuPortal": "Feishu 오픈 플랫폼 ↗",+ "oauthTimedOut": "시간이 너무 오래 걸려 인증 페이지가 만료되었습니다. 다시 시작하세요.",+ "steps": {+ "weixin": [+ "휴대폰 WeChat의 ‘스캔’으로 아래 QR 코드 스캔",+ "휴대폰에서 확인"+ ],+ "feishu": [+ "휴대폰 Feishu로 아래 QR 코드 스캔",+ "안내에 따라 봇 앱 만들기"+ ],+ "feishuApp": [+ "{link}에서 ‘봇’을 켜고, 이벤트 구독에서 ‘장기 연결로 이벤트 수신’을 선택한 뒤 {event} 구독",+ "권한 켜기: {p1}, {p2}, {p3}, {p4}",+ "App ID와 App Secret을 아래에 입력"+ ],+ "telegram": [+ "Telegram에서 {bot}을 찾아 {cmd}를 보내 봇 만들기",+ "받은 토큰을 아래에 입력"+ ],+ "slack": [+ "{link}에서 앱을 만들고 Socket Mode를 켠 뒤 {conn} 권한의 App-Level Token 생성",+ "Bot Token에 {s1}, {s2}, {s3}, {s4}를 추가하고 이벤트 {event} 구독",+ "App Home에서 메시지를 허용하고 워크스페이스에 설치",+ "토큰 2개를 아래에 입력"+ ],+ "discord": [+ "{link}에서 앱을 만들고 Bot을 추가한 뒤 토큰 복사",+ "OAuth2 URL Generator에서 bot을 선택해 내가 속한 서버에 추가",+ "토큰을 아래에 입력한 뒤 Discord에서 봇에게 DM 보내기"+ ],+ "notion": [+ "열린 브라우저 페이지에서 내용을 고르고 동의",+ "여기로 돌아오면 계정이 자동으로 나타납니다"+ ],+ "feishuData": [+ "휴대폰 Feishu로 스캔해 개인 앱 만들기",+ "한 번 더 스캔해 대화와 메시지 읽기 허용"+ ],+ "feishuDataApp": [+ "휴대폰 Feishu로 스캔해 대화와 메시지 읽기 허용"+ ]+ },+ "tryIt": "{channel}에서 메시지를 보내 보세요",+ "switchBot": "다른 봇과 대화하려면 /bot과 이름을 보내세요",+ "ownerWaiting": "첫 메시지를 기다리는 중입니다. 먼저 메시지를 보낸 사람이 소유자가 되고, 다른 사람은 소유자의 허용이 필요합니다.",+ "ownerBound": "‘{who}’ 님이 소유자입니다. 이제 대화할 수 있습니다.",+ "ownerLogin": "내 {channel} 계정이 소유자입니다. 이제 대화할 수 있습니다.",+ "openChat": "{channel} 열기 ↗",+ "done": "완료",+ "fix": "연결 정보 변경",+ "limit": {+ "weixin": "WeChat 규정: 메시지 1건당 24시간 안에 최대 10건까지 답할 수 있습니다.",+ "telegram": "지금은 1:1 대화만 처리합니다. 앱이 꺼져 있을 때 온 메시지는 24시간 안이면 나중에 받을 수 있습니다.",+ "slack": "지금은 1:1 대화만 처리합니다. 앱이 꺼져 있을 때 온 메시지는 받을 수 없습니다.",+ "discord": "지금은 1:1 대화만 처리합니다. 앱이 꺼져 있을 때 온 메시지는 받을 수 없습니다."+ },+ "connection": "연결 방식",+ "viaScan": "WeChat QR 코드",+ "changeApp": "앱 변경",+ "changeToken": "토큰 변경",+ "removed": "{name} 제거됨"},"gateway": {"running": "실행 중",@@ -97,10 +172,22 @@ export default {"search": "설정 검색","nav": "설정 항목"},+ "groups": {+ "theme": "테마",+ "text": "글자",+ "layout": "레이아웃",+ "effects": "효과",+ "desktop": "데스크톱 앱",+ "account": "계정",+ "models": "모델",+ "line": "연결",+ "channels": "채팅 채널",+ "data": "데이터 계정",+ },"searchResults": "검색 결과","noMatch": "일치하는 설정이 없습니다","preview": {- "ask": "이 요청을 async / await로 다시 작성해 줘",+ "label": "미리 보기","reply": "좋아요. 오류 처리도 더 명확해집니다. {b}을(를) 켜면 아래 줄이 자동으로 줄바꿈됩니다:"},"logout": {@@ -199,11 +286,6 @@ export default {"sub": "끄면 화면 전환, 팝업, 봇 아바타의 움직임이 멈춥니다. 시스템 선택 시 동작 줄이기 설정을 따릅니다","keys": "애니메이션 동작 움직임 전환 줄이기"},- "glass": {- "name": "반투명 유리 효과",- "sub": "끄면 사이드바, 메뉴, 대화상자를 단색으로 표시해 글자가 선명해지고 배터리를 절약합니다. 시스템 선택 시 투명도 줄이기 설정을 따릅니다",- "keys": "유리 흐림 블러 투명도 배터리 성능 느림"- },"resetAppearance": {"name": "화면 설정 초기화","subDesktop": "테마, 글꼴, 배율 및 위의 모든 설정을 기본값으로 되돌립니다",@@ -306,6 +388,8 @@ export default {},"cuStatus": {"name": "컴퓨터 사용 백엔드",+ "ready": "사용 가능",+ "notReady": "사용 불가","keys": "컴퓨터 사용 cua 손쉬운 사용 화면 기록"},"cuNotice": {diff --git a/ui/locales/ko/sidebar.js b/ui/locales/ko/sidebar.jsindex c1c84a8..b191f66 100644--- a/ui/locales/ko/sidebar.js+++ b/ui/locales/ko/sidebar.js@@ -6,11 +6,16 @@ export default {"accountDetails": "계정 및 사용량","balance": "잔액","topUp": "충전 ↗",- "lowBalance": "잔액 {amount} — 충전 ↗",+ "lowBalance": "잔액이 얼마 남지 않았습니다",+ "belowLine": "알림 기준 {amount} 미만","update": "{version} 버전을 사용할 수 있습니다 — 다운로드 ↗","updateDismiss": "이 버전 알림 숨기기","renamed": "이름이 변경되었습니다","delete": {+ "done": "‘{name}’ 삭제됨",+ "handover": "{channels}에는 앞으로 ‘{bot}’ 봇이 답합니다.",+ "handoverNone": "마지막 봇입니다. 새 봇을 만들 때까지 {channels} 메시지에는 답이 없습니다.",+ "listSep": ", ","title": "“{name}”을(를) 삭제할까요?","body": "봇과 모든 대화가 영구적으로 삭제됩니다. 이 작업은 되돌릴 수 없습니다.","confirm": "영구 삭제"diff --git a/ui/locales/ru/botSettings.js b/ui/locales/ru/botSettings.jsindex f54adde..6b871f4 100644--- a/ui/locales/ru/botSettings.js+++ b/ui/locales/ru/botSettings.js@@ -84,11 +84,6 @@ export default {delete: "Удалить бота",deleteSub: "Безвозвратно удалить бота и все его разговоры",},- delete: {- title: "Удалить «{name}»?",- body: "Бот и все его разговоры будут удалены безвозвратно. Это действие нельзя отменить.",- confirm: "Удалить навсегда",- },access: {head: "Кто может пользоваться",policy: "Только владелец и те, кому вы разрешили",diff --git a/ui/locales/ru/botapp.js b/ui/locales/ru/botapp.jsindex 6879cb3..20c97ef 100644--- a/ui/locales/ru/botapp.js+++ b/ui/locales/ru/botapp.js@@ -34,10 +34,8 @@ export default {title: "Удалить {name}?",body: "Он исчезнет из боковой панели, но его можно снова найти в обзоре.",confirm: "Удалить",- keepTitle: "Сохранить его данные?",- keepBody: "Если сохранить, в следующий раз можно продолжить с того же места. Иначе его папка будет удалена.",- keep: "Сохранить",- discard: "Не сохранять",+ keep: "Сохранить его данные, чтобы потом продолжить с того же места",+ done: "{name} удалён. Его можно снова найти в обзоре",},errors: {catalog_not_found: "Этот бот не найден.",diff --git a/ui/locales/ru/guide.js b/ui/locales/ru/guide.jsindex 5ff4541..d69752b 100644--- a/ui/locales/ru/guide.js+++ b/ui/locales/ru/guide.js@@ -61,7 +61,7 @@ export default {desc: "Отсканируйте QR-код и пишите боту прямо в WeChat. Новое приложение не нужно; бот доступен, пока включён компьютер.",how: ["Нажмите имя бота вверху, чтобы открыть панель сведений, затем «Управление каналами связи»",- "В строке WeChat нажмите «Добавить аккаунт» → «Войти по QR-коду»",+ "В строке WeChat нажмите «Подключить»","Отсканируйте код в WeChat и подтвердите вход на телефоне",],note: "Правило WeChat: на каждое ваше сообщение бот может ответить до 10 раз в течение 24 часов. Аккаунты Feishu, Telegram, Slack и Discord добавляются там же. Все боты используют общие аккаунты; для смены бота отправьте в чате /bot и имя.",diff --git a/ui/locales/ru/info.js b/ui/locales/ru/info.jsindex 6cdd9c9..f2d9ea8 100644--- a/ui/locales/ru/info.js+++ b/ui/locales/ru/info.js@@ -33,8 +33,6 @@ export default {disconnect: "Отключить",disconnectTitle: "Отключить Feishu?",disconnectBody: "App ID и App Secret Feishu этого бота будут удалены.",- setupHint:- "На открытой платформе Feishu включите возможность Bot, выберите получение событий через постоянное соединение (Receive events through long connection) и подпишитесь на {event}. Разрешения: {p1}, {p2}, {p3}, {p4}.",},messenger: {bindHint:@@ -49,21 +47,15 @@ export default {telegram: {sub: "Получает сообщения через long polling",token: "Токен бота",- setupHint:- "В Telegram напишите {bot}, отправьте {cmd} для создания бота и вставьте полученный токен. Пока поддерживаются только личные сообщения. Сообщения, отправленные при закрытом приложении, можно получить в течение 24 часов.",},slack: {sub: "Получает сообщения через Socket Mode",botToken: "Токен бота",appToken: "Токен уровня приложения",- setupHint:- "На api.slack.com/apps создайте приложение, включите Socket Mode и создайте токен уровня приложения с {conn}. Добавьте боту разрешения {s1}, {s2}, {s3} и {s4}, подпишитесь на {event}, разрешите сообщения в App Home и установите приложение в рабочее пространство. Пока поддерживаются только личные сообщения. Сообщения, отправленные при закрытом приложении, не поступят.",},discord: {sub: "Получает сообщения через Gateway",token: "Токен бота",- setupHint:- "В Discord Developer Portal создайте приложение, добавьте бота и скопируйте его токен. В OAuth2 → URL Generator отметьте bot, добавьте бота на сервер, в котором состоите, и напишите ему личное сообщение. Пока поддерживаются только личные сообщения. Сообщения, отправленные при закрытом приложении, не поступят.",},},weixin: {diff --git a/ui/locales/ru/settings.js b/ui/locales/ru/settings.jsindex 63d778d..ad5a5a9 100644--- a/ui/locales/ru/settings.js+++ b/ui/locales/ru/settings.js@@ -13,30 +13,19 @@ export default {},connections: {feishu: "Сообщения Feishu",- channelSub:- "Общие для всех ботов; можно добавить несколько аккаунтов. Чтобы выбрать другого бота, отправьте в чате /bot и его имя",+ channelSub: "Пишите ботам из этих приложений. Аккаунты общие для всех ботов; чтобы выбрать другого бота, отправьте в чате /bot и его имя.",channelKeys: "{channel} канал чат подключение аккаунт бот /bot",- addAccount: "Добавить аккаунт",manage: "Управление",defaultIs: "По умолчанию отвечает {bot}",requests: "Запросов на доступ: {count}",- addChannelTitle: "Добавить аккаунт {channel}",defaultBot: "Бот по умолчанию",- defaultBotHint:- "Отвечает в новых чатах. Отправьте /bot для списка ботов или /bot и имя для переключения. Этот чат останется с выбранным ботом.",+ defaultBotHint: "Отвечает в новых чатах. Отправьте /bot для списка ботов или /bot и имя для переключения. Этот чат останется с выбранным ботом.",removeAccount: "Удалить этот аккаунт",- removeChannelBody:- "Ни один бот больше не сможет отправлять и получать сообщения через этот аккаунт; список разрешённых пользователей будет очищен. История чатов сохранится.",- notionSub:- "Общее для всех ботов; можно добавить несколько аккаунтов. Боты в режиме «Только чтение» могут лишь читать; удалять страницы не может ни один бот",- feishuSub:- "Общее для всех ботов; можно добавить несколько аккаунтов. Читает ваши чаты и сообщения от вашего имени, без права записи",- notionKeys:- "notion заметки документы база данных подключение аккаунт авторизация",+ removeChannelBody: "Ни один бот больше не сможет отправлять и получать сообщения через этот аккаунт; список разрешённых пользователей будет очищен. История чатов сохранится.",+ notionSub: "Страницы и базы данных. Боты в режиме «Только чтение» могут лишь читать; удалять страницы не может ни один бот",+ feishuSub: "Читает ваши чаты и сообщения от вашего имени, только чтение",+ notionKeys: "notion заметки документы база данных подключение аккаунт авторизация",feishuKeys: "feishu lark сообщения чаты подключение аккаунт авторизация",- oneClick: "Авторизовать",- notionOther: "Использовать токен",- feishuOther: "Использовать своё приложение",viaToken: "Токен",viaOAuth: "Авторизовано",needsReauth: "Срок авторизации истёк. Авторизуйте снова",@@ -44,37 +33,109 @@ export default {rename: "Переименовать",remove: "Удалить",removeTitle: "Удалить {name}?",- removeBody:- "Боты больше не смогут пользоваться этим аккаунтом. Его можно добавить снова.",+ removeBody: "Боты больше не смогут пользоваться этим аккаунтом. Его можно добавить снова.",notionOAuthTitle: "Авторизовать Notion",- notionOAuthBody:- "В браузере открыта страница авторизации Notion. Подтвердите доступ и вернитесь сюда.",oauthFailed: "Не удалось открыть страницу авторизации. Попробуйте позже",openAgain: "Не открылась? Нажмите здесь",waiting: "Ожидаем вашего подтверждения…",notionTokenTitle: "Подключить Notion по токену",- notionTokenHint:- "Личный токен доступа открывает всё, что доступно вам; внутреннее подключение — только страницы, которыми с ним поделились.",+ notionTokenHint: "Личный токен доступа открывает всё, что доступно вам; внутреннее подключение — только страницы, которыми с ним поделились.",createToken: "Создать токен ↗",tokenLabel: "Токен",add: "Добавить",feishuTitle: "Добавить аккаунт Feishu",- feishuAppHint:- "Приложению нужны пользовательские права на чтение сообщений. Далее отсканируйте код для авторизации.",+ feishuAppHint: "Приложению нужны пользовательские права на чтение сообщений. Далее отсканируйте код для авторизации.",next: "Далее",- feishuChatStep:- "Отсканируйте код в Feishu, чтобы создать приложение бота. Затем отправьте ему сообщение в Feishu.",- feishuStepCreate:- "Шаг 1: отсканируйте код в Feishu, чтобы создать личное приложение",- feishuStepAuthorize:- "Шаг 2: отсканируйте код в Feishu, чтобы разрешить чтение чатов и сообщений",qrAlt: "QR-код авторизации Feishu",openInBrowser: "Открыть в браузере ↗",retry: "Повторить",- renameHint:- "Это имя можно использовать в общении с ботом, например: «проверь мой рабочий Feishu».",+ renameHint: "Это имя можно использовать в общении с ботом, например: «проверь мой рабочий Feishu».",nameLabel: "Имя",save: "Сохранить",+ dataSub: "Боты могут читать эти аккаунты за вас. Они общие для всех ботов, можно добавить несколько. Например, скажите: «проверь сообщения в рабочем Feishu».",+ connect: "Подключить",+ addOne: "Добавить ещё",+ addAnother: "Добавить ещё один аккаунт",+ addAnotherSub: "В одном приложении можно подключить несколько аккаунтов",+ how: {+ weixin: "Отсканируйте QR-код в WeChat на телефоне",+ feishu: "Отсканируйте код в Feishu на телефоне, приложение создастся само",+ telegram: "Создайте бота в @BotFather и введите токен",+ slack: "Создайте приложение Slack и введите два токена",+ discord: "Создайте приложение Discord и введите токен бота"+ },+ connectTitle: "Подключение: {channel}",+ connectedTitle: "Подключено: {channel}",+ connectingTitle: "Подключаем: {channel}…",+ failedTitle: "Не удалось подключить: {channel}",+ waitingScan: "Ждём сканирования…",+ waitingOwner: "Отправьте первое сообщение, чтобы завершить привязку",+ useToken: "Использовать токен",+ useOneClick: "Авторизовать в один клик",+ useApp: "Использовать своё приложение",+ useScan: "Подключить по QR-коду",+ feishuPortal: "Открытая платформа Feishu ↗",+ oauthTimedOut: "Прошло слишком много времени, страница авторизации устарела. Начните заново.",+ steps: {+ weixin: [+ "Отсканируйте QR-код ниже через «Сканировать» в WeChat на телефоне",+ "Подтвердите вход на телефоне"+ ],+ feishu: [+ "Отсканируйте QR-код ниже в Feishu на телефоне",+ "Следуйте подсказкам, чтобы создать приложение бота"+ ],+ feishuApp: [+ "На {link} включите «Бота», в подписке на события выберите «Получать события по долгому соединению» и подпишитесь на {event}",+ "Включите разрешения: {p1}, {p2}, {p3}, {p4}",+ "Введите App ID и App Secret ниже"+ ],+ telegram: [+ "Найдите в Telegram {bot} и отправьте {cmd}, чтобы создать бота",+ "Введите полученный токен ниже"+ ],+ slack: [+ "На {link} создайте приложение, включите Socket Mode и создайте App-Level Token с {conn}",+ "Добавьте Bot Token права {s1}, {s2}, {s3}, {s4} и подпишитесь на событие {event}",+ "Разрешите сообщения в App Home и установите приложение в рабочее пространство",+ "Введите оба токена ниже"+ ],+ discord: [+ "В {link} создайте приложение, добавьте Bot и скопируйте токен",+ "В OAuth2 URL Generator отметьте bot и добавьте его на свой сервер",+ "Введите токен ниже и напишите боту в личные сообщения Discord"+ ],+ notion: [+ "На открывшейся странице браузера выберите содержимое и подтвердите доступ",+ "Вернитесь сюда: аккаунт появится автоматически"+ ],+ feishuData: [+ "Отсканируйте код в Feishu на телефоне, чтобы создать личное приложение",+ "Отсканируйте ещё раз, чтобы разрешить чтение чатов и сообщений"+ ],+ feishuDataApp: [+ "Отсканируйте код в Feishu на телефоне, чтобы разрешить чтение чатов и сообщений"+ ]+ },+ tryIt: "Отправьте ему сообщение: {channel}",+ switchBot: "Чтобы поговорить с другим ботом, отправьте /bot и его имя",+ ownerWaiting: "Ждём первое сообщение. Кто напишет первым, станет владельцем; остальным нужно разрешение владельца.",+ ownerBound: "Владелец: {who}. Можно начинать общение.",+ ownerLogin: "Ваш аккаунт {channel} стал владельцем. Можно начинать общение.",+ openChat: "Открыть {channel} ↗",+ done: "Готово",+ fix: "Изменить данные подключения",+ limit: {+ weixin: "Правило WeChat: на каждое ваше сообщение бот может ответить до 10 раз в течение 24 часов.",+ telegram: "Пока обрабатываются только личные чаты. Сообщения, отправленные при закрытом приложении, можно получить в течение 24 часов.",+ slack: "Пока обрабатываются только личные чаты. Сообщения, отправленные при закрытом приложении, не будут получены.",+ discord: "Пока обрабатываются только личные чаты. Сообщения, отправленные при закрытом приложении, не будут получены."+ },+ connection: "Подключение",+ viaScan: "QR-код WeChat",+ changeApp: "Сменить приложение",+ changeToken: "Сменить токен",+ removed: "{name}: удалено"},gateway: {running: "Работает",@@ -95,10 +156,22 @@ export default {search: "Поиск настроек",nav: "Разделы настроек",},+ groups: {+ theme: "Тема",+ text: "Текст",+ layout: "Макет",+ effects: "Эффекты",+ desktop: "Приложение для компьютера",+ account: "Аккаунт",+ models: "Модели",+ line: "Подключение",+ channels: "Каналы чата",+ data: "Аккаунты с данными",+ },searchResults: "Результаты поиска",noMatch: "Подходящих настроек нет",preview: {- ask: "Перепиши этот запрос с async / await",+ label: "Предпросмотр",reply:"Конечно. Обработка ошибок тоже станет понятнее. При включённом {b} строка ниже переносится:",},@@ -205,11 +278,6 @@ export default {sub: "При отключении переходы, всплывающие окна и аватары неподвижны. Системный режим учитывает настройку уменьшения движения",keys: "анимация движение переход уменьшение",},- glass: {- name: "Матовое стекло",- sub: "При отключении боковая панель, меню и диалоги используют сплошной фон: текст чётче, батарея расходуется меньше. Системный режим учитывает настройку уменьшения прозрачности",- keys: "стекло матовое размытие прозрачность батарея производительность тормозит",- },resetAppearance: {name: "Сбросить оформление",subDesktop: "Восстановить тему, шрифты, масштаб и все настройки выше",@@ -317,6 +385,8 @@ export default {},cuStatus: {name: "Механизм управления компьютером",+ ready: "Доступно",+ notReady: "Недоступно",keys: "компьютер управление cua специальные возможности запись экрана",},cuNotice: { name: "Системные разрешения", keys: "разрешение права" },diff --git a/ui/locales/ru/sidebar.js b/ui/locales/ru/sidebar.jsindex d3bccd1..42714a7 100644--- a/ui/locales/ru/sidebar.js+++ b/ui/locales/ru/sidebar.js@@ -7,11 +7,16 @@ export default {accountDetails: "Аккаунт и использование",balance: "Баланс",topUp: "Пополнить ↗",- lowBalance: "Осталось {amount} — пополнить ↗",+ lowBalance: "Баланс заканчивается",+ belowLine: "Ниже порога {amount}",update: "Доступна версия {version} — скачать ↗",updateDismiss: "Больше не напоминать об этой версии",renamed: "Имя изменено",delete: {+ done: "«{name}» удалён",+ handover: "В {channels} теперь будет отвечать «{bot}».",+ handoverNone: "Это последний бот: пока вы не создадите нового, на сообщения в {channels} никто не ответит.",+ listSep: ", ",title: "Удалить «{name}»?",body: "Бот и все его разговоры будут удалены навсегда. Отменить это действие нельзя.",confirm: "Удалить навсегда",diff --git a/ui/locales/zh-CN/botSettings.js b/ui/locales/zh-CN/botSettings.jsindex d553706..5bf68de 100644--- a/ui/locales/zh-CN/botSettings.js+++ b/ui/locales/zh-CN/botSettings.js@@ -77,11 +77,6 @@ export default {delete: "删除机器人",deleteSub: "永久删除这个机器人及其全部会话",},- delete: {- title: "删除「{name}」?",- body: "会永久删除这个机器人及其全部会话,无法恢复。",- confirm: "永久删除",- },access: {head: "谁能使用",policy: "只有主人和你允许的人",diff --git a/ui/locales/zh-CN/botapp.js b/ui/locales/zh-CN/botapp.jsindex f77c223..0dc8589 100644--- a/ui/locales/zh-CN/botapp.js+++ b/ui/locales/zh-CN/botapp.js@@ -34,10 +34,8 @@ export default {title: "移除 {name}?",body: "它会从侧边栏消失,之后还能在发现页找到。",confirm: "移除",- keepTitle: "保留它的数据吗?",- keepBody: "保留的话,以后再用能接着上次的内容。不保留会删掉它的文件夹。",- keep: "保留",- discard: "不保留",+ keep: "保留它的数据,以后再用能接着上次的内容",+ done: "已移除 {name},之后还能在发现页找到",},errors: {catalog_not_found: "找不到这个 Bot。",diff --git a/ui/locales/zh-CN/guide.js b/ui/locales/zh-CN/guide.jsindex 5017c5b..5c6ba8a 100644--- a/ui/locales/zh-CN/guide.js+++ b/ui/locales/zh-CN/guide.js@@ -59,7 +59,7 @@ export default {weixin: {title: "把{name}接到微信",desc: "扫码后,在微信里直接私聊它,不用装新 App。电脑开着,它就在线。",- how: ["点顶部的机器人名字,打开信息面板,点「管理聊天渠道」", "在「微信」那一行点「添加账号」→「扫码登录」", "用微信扫码,在手机上确认"],+ how: ["点顶部的机器人名字,打开信息面板,点「管理聊天渠道」", "在「微信」那一行点「连接」", "用微信扫码,在手机上确认"],note: "微信的规定:你每发一条消息,它 24 小时内最多回 10 条。用飞书、Telegram、Slack、Discord 的话,在同一处添加账号。账号所有机器人共用,聊天时发 /bot 名字 换一个机器人。",doneText: "在微信里给它发条消息试试。想换一个机器人聊,发 /bot。",},diff --git a/ui/locales/zh-CN/info.js b/ui/locales/zh-CN/info.jsindex 27c5682..f566ba5 100644--- a/ui/locales/zh-CN/info.js+++ b/ui/locales/zh-CN/info.js@@ -33,8 +33,6 @@ export default {disconnect: "断开",disconnectTitle: "断开飞书?",disconnectBody: "会清除这个机器人的飞书 App ID 与 App Secret。",- /** {event} {p1} {p2} {p3} 是 <code> 包着的事件名 / 权限名 */- setupHint: "在飞书开放平台启用「机器人」,事件订阅选「使用长连接接收事件」并订阅 {event};权限:{p1}、{p2}、{p3}、{p4}。",},messenger: {bindHint: "用你自己的账号给机器人发一句话,就完成绑定。",@@ -46,20 +44,15 @@ export default {telegram: {sub: "长轮询接收消息",token: "Bot Token",- /** {bot} {cmd} 是 <code> 包着的账号名 / 命令 */- setupHint: "在 Telegram 里找 {bot},发 {cmd} 创建机器人,把它给的 token 填到这里。目前只处理单聊;应用没开时发来的消息,24 小时内都能补上。",},slack: {sub: "Socket Mode 接收消息",botToken: "Bot Token",appToken: "App-Level Token",- /** {conn} {s1}…{s4} 是权限名,{event} 是事件名 */- setupHint: "在 api.slack.com/apps 创建应用,打开 Socket Mode,生成带 {conn} 的 App-Level Token;给 Bot Token 加 {s1}、{s2}、{s3}、{s4},事件订阅 {event},在 App Home 允许发消息,再安装到工作区。目前只处理单聊;应用没开时发来的消息收不到。",},discord: {sub: "Gateway 长连接接收消息",token: "Bot Token",- setupHint: "在 Discord Developer Portal 创建应用并添加 Bot,复制 token;用 OAuth2 的 URL Generator 勾选 bot,把它加到你所在的服务器,然后私聊它。目前只处理单聊;应用没开时发来的消息收不到。",},},weixin: {diff --git a/ui/locales/zh-CN/settings.js b/ui/locales/zh-CN/settings.jsindex 74527ec..66e5932 100644--- a/ui/locales/zh-CN/settings.js+++ b/ui/locales/zh-CN/settings.js@@ -14,24 +14,19 @@ export default {},connections: {feishu: "飞书消息",- channelSub: "所有机器人共用,可以加多个账号。聊天时发一次 /bot 名字,就换一个机器人聊",+ channelSub: "在这些 App 里给机器人发消息。账号所有机器人共用,聊天时发 /bot 名字 就能换一个机器人。",channelKeys: "{channel} 渠道 聊天 连接 账号 机器人 /bot",- addAccount: "添加账号",manage: "管理",defaultIs: "默认由 {bot} 回复",requests: "{count} 个使用请求",- addChannelTitle: "添加{channel}账号",defaultBot: "默认机器人",defaultBotHint: "新会话先由它回复。聊天时发 /bot 看有哪些机器人,发一次 /bot 名字就换过去,之后这个会话一直和它聊。",removeAccount: "移除这个账号",removeChannelBody: "所有机器人都不能再从这个账号收发消息,它的允许名单也会清掉。聊天记录保留。",- notionSub: "所有机器人共用,可以加多个账号。只读机器人只能读取,机器人都不能删除页面",- feishuSub: "所有机器人共用,可以加多个账号。用你的身份读会话和消息,只读",+ notionSub: "页面和数据库。只读机器人只能读取,机器人都不能删除页面",+ feishuSub: "用你的身份读会话和消息,只读",notionKeys: "notion 笔记 文档 数据库 连接 账号 授权",feishuKeys: "飞书 feishu lark 消息 会话 连接 账号 授权",- oneClick: "一键授权",- notionOther: "用令牌",- feishuOther: "用已有应用",viaToken: "令牌",viaOAuth: "已授权",needsReauth: "授权已失效,需要重新授权",@@ -41,7 +36,6 @@ export default {removeTitle: "移除 {name}?",removeBody: "所有机器人都不能再用这个账号。之后可以重新添加。",notionOAuthTitle: "授权 Notion",- notionOAuthBody: "已在浏览器里打开 Notion 的授权页,同意后回到这里。",oauthFailed: "打不开授权页,请稍后再试",openAgain: "没打开?点这里",waiting: "正在等你授权…",@@ -53,15 +47,96 @@ export default {feishuTitle: "添加飞书账号",feishuAppHint: "应用要开通读消息的用户权限。填完后再扫码授权。",next: "下一步",- feishuChatStep: "用飞书扫码,创建你的机器人应用。完成后在飞书里给它发条消息就能聊。",- feishuStepCreate: "第 1 步:用飞书扫码,创建你的个人应用",- feishuStepAuthorize: "第 2 步:用飞书扫码,授权读取你的会话和消息",qrAlt: "飞书授权二维码",openInBrowser: "在浏览器里打开 ↗",retry: "重试",renameHint: "对机器人说账号时可以用这个名字,比如「看我工作飞书的消息」。",nameLabel: "名字",save: "保存",+ dataSub: "机器人能替你读取这些账号。所有机器人共用,可以加多个账号,比如对它说「看我工作飞书的消息」。",+ connect: "连接",+ addOne: "再加一个",+ addAnother: "再加一个账号",+ addAnotherSub: "同一个 App 可以连多个账号",+ how: {+ weixin: "用手机微信扫码",+ feishu: "用手机飞书扫码,应用自动创建",+ telegram: "在 @BotFather 创建机器人,填 Token",+ slack: "创建 Slack 应用,填两个 Token",+ discord: "创建 Discord 应用,填 Bot Token"+ },+ connectTitle: "连接{channel}",+ connectedTitle: "{channel}已连接",+ connectingTitle: "正在连接{channel}…",+ failedTitle: "{channel}没有连上",+ waitingScan: "等你扫码…",+ waitingOwner: "等第一条消息完成绑定",+ useToken: "改用令牌",+ useOneClick: "改用一键授权",+ useApp: "改用已有应用",+ useScan: "改用扫码",+ feishuPortal: "飞书开放平台 ↗",+ oauthTimedOut: "等太久了,授权页已经失效,请重新开始。",+ steps: {+ weixin: [+ "用手机微信的「扫一扫」扫下面的二维码",+ "在手机上点确认"+ ],+ feishu: [+ "用手机飞书扫下面的二维码",+ "按提示创建你的机器人应用"+ ],+ feishuApp: [+ "在 {link} 启用「机器人」,事件订阅选「使用长连接接收事件」并订阅 {event}",+ "开通权限:{p1}、{p2}、{p3}、{p4}",+ "把 App ID 和 App Secret 填到下面"+ ],+ telegram: [+ "在 Telegram 里找 {bot},发 {cmd} 创建机器人",+ "把它给你的 Token 填到下面"+ ],+ slack: [+ "在 {link} 创建应用,打开 Socket Mode,生成带 {conn} 的 App-Level Token",+ "给 Bot Token 加 {s1}、{s2}、{s3}、{s4},事件订阅 {event}",+ "在 App Home 允许发消息,再安装到工作区",+ "把两个 Token 填到下面"+ ],+ discord: [+ "在 {link} 创建应用并添加 Bot,复制 Token",+ "用 OAuth2 的 URL Generator 勾选 bot,把它加到你所在的服务器",+ "把 Token 填到下面,然后在 Discord 里私聊它"+ ],+ notion: [+ "在刚打开的浏览器页面里选好内容,点同意",+ "回到这里,账号会自动出现"+ ],+ feishuData: [+ "用手机飞书扫码,创建你的个人应用",+ "再扫一次,授权读取你的会话和消息"+ ],+ feishuDataApp: [+ "用手机飞书扫码,授权读取你的会话和消息"+ ]+ },+ tryIt: "在{channel}里给它发一句话试试",+ switchBot: "想换一个机器人聊,发 /bot 名字",+ ownerWaiting: "等你发第一条消息。第一个发消息的人会成为主人,其他人要经主人允许才能用。",+ ownerBound: "「{who}」是主人,可以开始聊了。",+ ownerLogin: "你的{channel}已经是主人,可以开始聊了。",+ openChat: "打开{channel} ↗",+ done: "完成",+ fix: "修改连接方式",+ limit: {+ weixin: "微信的规定:你每发一条消息,它 24 小时内最多回 10 条。",+ telegram: "目前只处理单聊。应用没开时发来的消息,24 小时内都能补上。",+ slack: "目前只处理单聊。应用没开时发来的消息收不到。",+ discord: "目前只处理单聊。应用没开时发来的消息收不到。"+ },+ connection: "连接方式",+ viaScan: "微信扫码",+ changeApp: "更换应用",+ changeToken: "更换 Token",+ removed: "已移除 {name}"},gateway: {running: "运行中",@@ -82,10 +157,22 @@ export default {search: "查找设置",nav: "设置分页",},+ groups: {+ theme: "主题",+ text: "文字",+ layout: "版面",+ effects: "效果",+ desktop: "桌面应用",+ account: "账户",+ models: "模型",+ line: "连接",+ channels: "聊天渠道",+ data: "数据账号",+ },searchResults: "搜索结果",noMatch: "没有匹配的设置",preview: {- ask: "帮我把这段请求改成 async / await 的写法",+ label: "预览",reply: "好的,改写后错误处理也更直观。下面这行在开启{b}后会折行显示:",},logout: {@@ -184,11 +271,6 @@ export default {sub: "关闭后界面切换、弹出和机器人头像都不再动;跟随系统时遵循「减少动态效果」",keys: "动画 动效 过渡 减少动态效果 晕 animation motion",},- glass: {- name: "毛玻璃效果",- sub: "关闭后侧栏、菜单和对话框换成实色,文字更清楚、也更省电;跟随系统时遵循「降低透明度」",- keys: "毛玻璃 透明 模糊 降低透明度 省电 卡顿 blur transparency",- },resetAppearance: {name: "恢复默认外观",subDesktop: "主题、字体、缩放和以上所有外观设置回到默认",@@ -285,6 +367,8 @@ export default {},cuStatus: {name: "电脑操作后端",+ ready: "可用",+ notReady: "不可用",keys: "computer use cua 辅助功能 屏幕录制",},cuNotice: {diff --git a/ui/locales/zh-CN/sidebar.js b/ui/locales/zh-CN/sidebar.jsindex ce8a706..b2e8021 100644--- a/ui/locales/zh-CN/sidebar.js+++ b/ui/locales/zh-CN/sidebar.js@@ -8,11 +8,16 @@ export default {accountDetails: "账户和用量",balance: "余额",topUp: "充值 ↗",- lowBalance: "余额只剩 {amount},去充值 ↗",+ lowBalance: "余额不多了",+ belowLine: "低于提醒线 {amount}",update: "发现新版本 {version},去下载 ↗",updateDismiss: "不再提示这个版本",renamed: "已重命名",delete: {+ done: "已删除「{name}」",+ handover: "{channels}之后由「{bot}」回复。",+ handoverNone: "这是最后一个机器人,新建机器人之前,{channels}的消息不会有回复。",+ listSep: "、",title: "删除「{name}」?",body: "会永久删除这个机器人及其全部会话,无法恢复。",confirm: "永久删除",diff --git a/ui/main.js b/ui/main.jsindex 21ead4d..cbfbecb 100644--- a/ui/main.js+++ b/ui/main.js@@ -13,7 +13,7 @@ import { NeedsYouScreen } from "./screens/needs-you.js";import { BotAppScreen } from "./screens/bot-app.js";import { DiscoverScreen } from "./screens/discover.js";import { GroupScreen, GroupSheet } from "./screens/group.js";-import { BotAvatar, MAIN_CHAR, charOf } from "./components/avatar.js";+import { BotAvatar, MAIN_CHAR } from "./components/avatar.js";import { Onboarding } from "./screens/onboarding.js";import { CoachMark } from "./components/guide.js";import { api } from "./lib/api.js";@@ -130,8 +130,6 @@ function Palette({ commands, onClose }) {</div>`;}-/** 环境光色相(OKLCH 色相角):和头像角色的主色一致 */-const AURA_HUE = { blue: 245, yellow: 95, green: 155, red: 25, purple: 305, orange: 55 };function App() {// 订阅界面语言:切换语言时整棵树跟着重渲染(子组件里的 t() 都在渲染时取)@@ -148,7 +146,7 @@ function App() {if (settings) adoptServerLang(settings.lang);}, [settings && settings.lang]);const connected = !!(mf && (mf.mode === "external" || mf.connected));- const [botsData, botsErr, reloadBots] = useLoader(() => (connected ? api("/bots") : Promise.resolve(null)), [connected]);+ const [botsData, botsErr, reloadBots, setBotsData] = useLoader(() => (connected ? api("/bots") : Promise.resolve(null)), [connected]);const [groupsData, , reloadGroups] = useLoader(() => (connected ? api("/groups") : Promise.resolve(null)), [connected]);const [groupSheet, setGroupSheet] = useState(null); // 建群 / 改群的弹窗:{ group? }const [modelsData, , loadModels] = useLoader(() => (connected ? api("/models") : Promise.resolve(null)), [connected]);@@ -324,19 +322,37 @@ function App() {reloadGroups();if (route.view === "group" && route.groupId === id) go("/chat/");};- // 「需要你」里的重新扫码:去这个机器人的对话,打开信息面板(渠道在最上面)- const relogin = () => openSettings("connections");+ // 「需要你」里的重新扫码(事项 id 是 login:<账号>:<渠道>):直接打开这个账号的管理弹窗+ const relogin = (id) => {+ const [, key, channel] = id.split(":");+ openSettings("connections", `channel-${channel}-${key}`);+ };useEffect(() => {if (route.view !== "settings") setSettingsQ("");}, [route.view]);const openBotSettings = (id, section = "") => go(`/bot/${encodeURIComponent(id)}/settings${section ? "/" + section : ""}`);const onBotUpdated = () => reloadBots();+ // 建好后等列表里有了它再切过去:先切的话,新机器人还不在列表里,会闪一下第一个机器人+ const onCreated = async (b) => {+ await reloadBots();+ setLastBot(b.id);+ location.hash = `/chat/${encodeURIComponent(b.id)}`;+ setRoute(parseHash()); // 不等 hashchange:占位行和新行不同时出现+ };+ // 先从列表里拿掉:不留给对话页去请求已经删掉的机器人。正在看它时,换到列表里挨着它的那个,而不是跳回第一个const onDeleted = (id) => {+ const list = bots || [];+ const rest = list.filter((b) => b.id !== id);+ const next = rest[Math.min(list.findIndex((b) => b.id === id), rest.length - 1)];+ setBotsData((d) => d && { ...d, bots: rest });reloadBots();- if (bot && id === bot.id) {- setLastBot("");- go("/chat/");- }+ reloadCatalog(); // 目录 Bot 移除后,发现页要变回没打开过+ reloadGroups();+ if (!bot || bot.id !== id) return;+ setLastBot(next ? next.id : "");+ if (route.view !== "chat" && route.view !== "app" && route.view !== "bot-settings") return;+ if (next) openChat(next.id);+ else go("/chat/");};// —— 全局快捷键 ——@@ -415,17 +431,14 @@ function App() {const panelBot = view === "chat" && infoOpen && bot;const shownPanel = panelFx.mounted ? panelBot || lastPanel.current : null;const routedBot = view === "bot-settings" && bots ? bots.find((b) => b.id === route.botId) : null;- // 环境光的色相跟着当前机器人角色的主色(设置页和新建页用缺省的冷色)- const auraBot = view === "chat" || view === "app" ? bot : view === "bot-settings" ? routedBot : null;- const auraHue = (auraBot && AURA_HUE[charOf(auraBot)]) || 250;- return html`<div class=${`app${panelBot ? " with-panel" : ""}`} ref=${appRef} style=${{ "--aura-hue": String(auraHue) }}>+ return html`<div class=${`app${panelBot ? " with-panel" : ""}`} ref=${appRef}>${view === "settings"? html`<${SettingsSide} tab=${route.tab} query=${settingsQ} onQuery=${setSettingsQ} onTab=${(t) => openSettings(t)} onBack=${() => openChat()}username=${status && status.username} account=${managed ? account : null} />`: html`<${Sidebar} bots=${bots} botsError=${botsErr} reloadBots=${reloadBots} selectedId=${bot && bot.id} view=${view === "chat" && bots && !bots.length ? "new" : view}previews=${previews} pending=${pending} working=${working} needs=${needs} username=${status && status.username} account=${managed ? account : null} update=${update}onNew=${newBot} onSelect=${openChat} onNeeds=${openNeeds} onDeleted=${onDeleted} onOpenSettings=${(tab) => openSettings(tab)} onBotSettings=${openBotSettings} onGuide=${startGuide}- groups=${groups} groupId=${route.groupId} onNewGroup=${() => setGroupSheet({})} onSelectGroup=${openGroup} onEditGroup=${(group) => setGroupSheet({ group })} onDeletedGroup=${onDeletedGroup}+ groups=${groups} groupsLoaded=${!!groupsData} groupId=${route.groupId} onNewGroup=${() => setGroupSheet({})} onSelectGroup=${openGroup} onEditGroup=${(group) => setGroupSheet({ group })} onDeletedGroup=${onDeletedGroup}catalog=${catalog} catalogId=${route.catalogId} onDiscover=${openDiscover} onOpenCatalog=${openCatalog} />`}<${Splitter} class="split-side" size="--side-w" label=${t("app.resizeSide")} value=${sideW} room=${room("--panel-track")} onCommit=${(v) => setPrefs({ sideW: v })} /><main class="main">@@ -440,7 +453,7 @@ function App() {${view === "group" && routedGroup && bots && html`<${GroupScreen} key=${routedGroup.id} group=${routedGroup} bots=${bots} onEdit=${() => setGroupSheet({ group: routedGroup })} onOpenSettings=${openSettings} onChanged=${reloadGroups} />`}${view === "group" && groupsData && !routedGroup && html`<div class="empty-state"><b>${t("app.groupMissing")}</b><button type="button" class="text" onClick=${() => openChat()}>${t("app.backToChat")}</button></div>`}${(view === "new" || (view === "chat" && bots && !bots.length)) && html`<${NewBotScreen} first=${!!bots && !bots.length}- onCreated=${(b) => { reloadBots(); openChat(b.id); }} onCancel=${bots && bots.length ? () => openChat() : null} />`}+ onCreated=${onCreated} onCancel=${bots && bots.length ? () => openChat() : null} />`}${view === "settings" && html`<${SettingsScreen} tab=${route.tab} query=${settingsQ} onQuery=${setSettingsQ} onTab=${(t) => openSettings(t)} focusRow=${route.row}mf=${mf} onMfChanged=${reloadMf} onSettings=${setSettings} models=${models} modelsError=${modelsError} reloadModels=${reloadModels}status=${status} update=${update} bots=${bots} onOpenBotSettings=${openBotSettings} account=${managed ? account : null} onAccount=${setAccount} />`}@@ -455,7 +468,7 @@ function App() {onCommit=${(v) => setPrefs({ panelW: v })} />`}${shownPanel && html`<div class=${`panel-scrim${panelFx.leaving ? " leaving" : ""}`} onClick=${() => setInfoOpen(false)}></div>`}${shownPanel && html`<${InfoPanel} key=${shownPanel.id} bot=${shownPanel} leaving=${panelFx.leaving} onClose=${() => setInfoOpen(false)}- onOpenBotSettings=${() => openBotSettings(shownPanel.id)} onOpenChat=${() => setInfoOpen(false)} onOpenConnections=${() => openSettings("connections")} />`}+ onOpenBotSettings=${() => openBotSettings(shownPanel.id)} onOpenChat=${() => setInfoOpen(false)} onOpenConnections=${(row) => openSettings("connections", row || "")} />`}<${CoachMark} bot=${view === "chat" ? bot : null} view=${view} infoOpen=${!!panelBot} />${palette && html`<${Palette} commands=${commands} onClose=${() => setPalette(false)} />`}${groupSheet && bots && html`<${GroupSheet} group=${groupSheet.group} bots=${bots} onClose=${() => setGroupSheet(null)}diff --git a/ui/screens/account.js b/ui/screens/account.jsindex 3e21f66..c80dba7 100644--- a/ui/screens/account.js+++ b/ui/screens/account.js@@ -39,7 +39,6 @@ export function UsageSheet({ onClose }) {${d.models.slice(0, 12).map((m) => html`<div><span class="v">${m.model}</span><span class="n">${usd(m.usd)} · ${t("account.usage.requests", { count: m.requests })}</span></div>`)}${!d.models.length && html`<p class="hint">${t("account.usage.empty")}</p>`}</div>`}- <div class="actions"><button type="button" class="btn" data-autofocus onClick=${onClose}>${t("common.close")}</button></div><//>`;}@@ -59,6 +58,5 @@ export function NotificationsSheet({ onClose }) {<time>${fmtTime(n.created_at * 1000)}</time>${notifLink(n.link) && html`<a class="text" href=${notifLink(n.link)} target="_blank" rel="noopener noreferrer">${t("account.notifications.details")}</a>`}</div>`)}- <div class="actions"><button type="button" class="btn" data-autofocus onClick=${onClose}>${t("common.close")}</button></div><//>`;}diff --git a/ui/screens/bot-settings.js b/ui/screens/bot-settings.jsindex a057497..5fa17e1 100644--- a/ui/screens/bot-settings.js+++ b/ui/screens/bot-settings.js@@ -4,7 +4,8 @@ import { html, Icon, Seg, Switch, MenuButton, Notice, Skeleton, autoGrow } fromimport { BotAvatar, AvatarPicker, charOf } from "../components/avatar.js";import { ModelPicker, shortModel } from "../components/model-picker.js";import { api } from "../lib/api.js";-import { confirmSheet, failed, saved } from "../lib/store.js";+import { deleteBot } from "../lib/bots.js";+import { failed, saved } from "../lib/store.js";import { usd } from "../lib/links.js";import { perms, fullWarning, confirmPermission } from "../lib/perms.js";import { t } from "../lib/i18n.js";@@ -138,13 +139,7 @@ export function BotSettingsScreen({ bot, section, models, modelsError, reloadModonBotUpdated();};const del = async () => {- if (!(await confirmSheet({ title: t("botSettings.delete.title", { name: bot.name }), body: t("botSettings.delete.body"), confirmLabel: t("botSettings.delete.confirm"), danger: true }))) return;- try {- await api(`/bots/${bot.id}`, { method: "DELETE" });- onDeleted();- } catch (e) {- failed(e);- }+ if (await deleteBot(bot)) onDeleted();};const commitName = () => {const n = name.trim();diff --git a/ui/screens/connections.js b/ui/screens/connections.jsindex 1f730e1..a3b8526 100644--- a/ui/screens/connections.js+++ b/ui/screens/connections.js@@ -4,13 +4,17 @@// - 数据账号(Notion、飞书消息):机器人能读写的账号。可以对任何机器人说「看我第一个飞书和第二个飞书的消息」,// 序号就是这里显示的序号(src/agent/accounts.ts)。// 令牌不会回到界面:接口只给名字、序号、状态和掩码。+//+// 添加和管理是两个弹窗。添加只做一件事:照步骤连上,然后告诉你下一步做什么;管理才有别名、默认机器人、谁能用、更换连接方式。+// 关掉添加弹窗就取消进行中的扫码,不会过一会儿冒出一个账号。import { useEffect, useRef, useState } from "preact/hooks";-import { html, Badge, Button, MenuButton, Sheet, Skeleton, Spinner } from "../components/ui.js";+import { html, Badge, Button, Icon, MenuButton, Sheet, Skeleton, Spinner } from "../components/ui.js";import { api } from "../lib/api.js";-import { channelName, sourceLabel } from "../lib/access.js";+import { accountName, channelName, sourceLabel } from "../lib/access.js";import { fmtAgo, fmtTime } from "../lib/format.js";+import { markDone } from "../lib/guide.js";import { confirmSheet, failed, saved, toast } from "../lib/store.js";-import { t } from "../lib/i18n.js";+import { has, t } from "../lib/i18n.js";const NOTION_PORTAL = "https://www.notion.so/developers";const POLL_MS = 2000;@@ -27,29 +31,78 @@ const MESSENGER_FIELDS = {slack: [{ key: "botToken", placeholder: "xoxb-…" }, { key: "appToken", placeholder: "xapp-…" }],discord: [{ key: "token", placeholder: "" }],};-/** 接入说明里 <code> 包着的权限名、事件名 */+/** 这几个状态要用户处理:账号行上写明原因,管理弹窗把修复入口放到最上面 */+const PROBLEM = ["login_required", "expired", "error"];+/** 微信登录结束但没成功:给重试 */+const LOGIN_ENDED = ["failed", "already_bound", "cancelled"];+/** 步骤里 <code> 包着的权限名、事件名,和外部链接 */const code = (s) => html`<code>${s}</code>`;-const MESSENGER_HINT = {+const outLink = (href, text) => html`<a class="text" href=${href} target="_blank" rel="noopener noreferrer">${text}</a>`;+const STEP_PARAMS = {telegram: () => ({ bot: code("@BotFather"), cmd: code("/newbot") }),- slack: () => ({ conn: code("connections:write"), s1: code("chat:write"), s2: code("im:history"), s3: code("files:read"), s4: code("files:write"), event: code("message.im") }),- discord: () => ({}),+ slack: () => ({ link: outLink("https://api.slack.com/apps", "api.slack.com/apps ↗"), conn: code("connections:write"), s1: code("chat:write"), s2: code("im:history"), s3: code("files:read"), s4: code("files:write"), event: code("message.im") }),+ discord: () => ({ link: outLink("https://discord.com/developers/applications", "Discord Developer Portal ↗") }),+ feishuApp: () => ({ link: outLink("https://open.feishu.cn/app", t("settings.connections.feishuPortal")), event: code("im.message.receive_v1"), p1: code("im:message.p2p_msg:readonly"), p2: code("im:message:send_as_bot"), p3: code("cardkit:card:write"), p4: code("im:message.history:readonly") }),};-const FEISHU_HINT = () => ({ event: code("im.message.receive_v1"), p1: code("im:message.p2p_msg:readonly"), p2: code("im:message:send_as_bot"), p3: code("cardkit:card:write"), p4: code("im:message.history:readonly") });-const ACTIVE_LOGIN = ["fetching", "wait", "scaned", "need_verifycode"];+const stepsOf = (name, params) => {+ const out = [];+ for (let i = 0; has(`settings.connections.steps.${name}.${i}`); i++) out.push(t(`settings.connections.steps.${name}.${i}`, params));+ return out;+};+const accountUrl = (key, rest = "") => `/channel-accounts/${encodeURIComponent(key)}${rest}`;+/** 连上之后去聊天的链接:Telegram 和飞书能直接打开那个机器人,其他 App 没有这样的链接 */+function chatLink(channel, st) {+ const name = st?.account?.name;+ if (channel === "telegram" && name?.startsWith("@")) return `https://t.me/${name.slice(1)}`;+ if (channel === "feishu" && st?.account?.appId) return `https://${st.account.brand === "lark" ? "applink.larksuite.com" : "applink.feishu.cn"}/client/bot/open?appId=${encodeURIComponent(st.account.appId)}`;+ return "";+}-/** 账号列表和正在打开的弹窗。渠道账号的状态会变(连上、过期、有人申请使用),所以一直刷新 */-export function useConnections() {- const [accounts, setAccounts] = useState([]);+/**+ * 账号列表和正在打开的弹窗。渠道账号的状态会变(连上、过期、有人申请使用),所以一直刷新。+ * focusRow 指向一个渠道账号时(信息面板、「需要你」跳过来)直接打开它的管理弹窗;账号有问题就同时打开修复。+ */+export function useConnections(focusRow = "") {+ const [accounts, setAccountList] = useState([]);const [channelAccounts, setChannelAccounts] = useState([]);+ const [channelsLoaded, setChannelsLoaded] = useState(false);const [sheet, setSheet] = useState(null);- const reloadChannels = () => api("/channel-accounts").then((r) => setChannelAccounts(r.accounts)).catch(() => {});+ const [fresh, setFresh] = useState("");+ const freshTimer = useRef(0);+ const reloadChannels = () => api("/channel-accounts").then((r) => (setChannelAccounts(r.accounts), setChannelsLoaded(true))).catch(() => {});+ /** 新账号回到列表时闪一下,告诉你它在哪 */+ const flashRow = (id) => {+ clearTimeout(freshTimer.current);+ setFresh(id);+ requestAnimationFrame(() => document.getElementById(`set-${id}`)?.scrollIntoView({ block: "nearest" }));+ freshTimer.current = setTimeout(() => setFresh(""), 1300);+ };+ const setAccounts = (next) => {+ const added = next.find((a) => !accounts.some((p) => p.id === a.id));+ setAccountList(next);+ if (added) flashRow(`account-${added.id}`);+ };+ const updateChannel = async (key, channel, body) => {+ try {+ setChannelAccounts((await api(accountUrl(key, `/${channel}/settings`), { method: "PUT", body })).accounts);+ saved();+ return true;+ } catch (e) {+ failed(e);+ return false;+ }+ };useEffect(() => {- api("/connections").then((r) => setAccounts(r.accounts)).catch(failed);+ api("/connections").then((r) => setAccountList(r.accounts)).catch(failed);reloadChannels();const timer = setInterval(reloadChannels, 5000);- return () => clearInterval(timer);+ return () => (clearInterval(timer), clearTimeout(freshTimer.current));}, []);- return { accounts, setAccounts, channelAccounts, setChannelAccounts, reloadChannels, sheet, setSheet };+ useEffect(() => {+ const m = /^channel-([a-z]+)-(.+)$/.exec(focusRow);+ if (m) setSheet({ kind: "channel", channel: m[1], accountKey: m[2], fix: true });+ }, [focusRow]);+ return { accounts, setAccounts, channelAccounts, channelsLoaded, reloadChannels, updateChannel, sheet, setSheet, fresh, flashRow };}/** 设置页的行:先是聊天渠道,再是数据账号 */@@ -57,41 +110,62 @@ export function connectionRows(conn, bots) {return [...channelRows(conn, bots), ...dataRows(conn)];}+/** 已连接的账号在前,没连的渠道在后,最后一行是给已连接的渠道再加一个账号 */function channelRows({ channelAccounts, setSheet }, bots) {const botName = (id) => (bots || []).find((b) => b.id === id)?.name ?? id;+ const base = { tab: "connections", group: "channels", groupNote: t("settings.connections.channelSub") };+ const keysOf = (channel) => t("settings.connections.channelKeys", { channel: channelName(channel) });+ const add = (channel) => setSheet({ kind: "channel", channel });const rows = [];for (const channel of CHANNELS) {- rows.push({- tab: "connections",- id: `add-channel-${channel}`,- name: channelName(channel),- sub: t("settings.connections.channelSub"),- keys: t("settings.connections.channelKeys", { channel: channelName(channel) }),- ctl: html`<button type="button" class="btn" onClick=${() => setSheet({ kind: "channel", channel })}>${t("settings.connections.addAccount")}</button>`,- });for (const a of channelAccounts.filter((x) => x.channel === channel)) {- const parts = [a.status?.detail, t("settings.connections.defaultIs", { bot: botName(a.defaultBot) }), a.requests ? t("settings.connections.requests", { count: a.requests }) : ""];+ const state = a.status?.state;+ const problem = PROBLEM.includes(state);+ const parts = [state !== "connected" ? a.status?.detail : "", t("settings.connections.defaultIs", { bot: botName(a.defaultBot) }), !problem && !a.hasOwner ? t("settings.connections.waitingOwner") : "", a.requests ? t("settings.connections.requests", { count: a.requests }) : ""];rows.push({- tab: "connections",+ ...base,id: `channel-${channel}-${a.key}`,- name: `${channelName(channel)} ${a.number} · ${a.label}`,+ name: accountName(a),sub: parts.filter(Boolean).join(" · "),keys: `${channelName(channel)} ${a.label}`,- ctl: html`${a.status && html`<${Badge} s=${a.status.state} />`}+ ctl: html`${a.status && html`<${Badge} s=${state} />`}+ ${problem && channel === "weixin" && html`<button type="button" class="btn" onClick=${() => setSheet({ kind: "channel", channel, accountKey: a.key, fix: true })}>${t("info.weixin.relogin")}</button>`}<button type="button" class="text" onClick=${() => setSheet({ kind: "channel", channel, accountKey: a.key })}>${t("settings.connections.manage")}</button>`,});}}+ const linked = CHANNELS.filter((channel) => channelAccounts.some((a) => a.channel === channel));+ for (const channel of CHANNELS.filter((c) => !linked.includes(c))) {+ rows.push({+ ...base,+ id: `add-channel-${channel}`,+ name: channelName(channel),+ sub: t(`settings.connections.how.${channel}`),+ keys: keysOf(channel),+ ctl: html`<button type="button" class="btn" onClick=${() => add(channel)}>${t("settings.connections.connect")}</button>`,+ });+ }+ if (linked.length) {+ rows.push({+ ...base,+ id: "add-channel-more",+ name: t("settings.connections.addAnother"),+ sub: t("settings.connections.addAnotherSub"),+ keys: linked.map(keysOf).join(" "),+ ctl: linked.map((channel) => html`<button type="button" class="text" key=${channel} onClick=${() => add(channel)}>${channelName(channel)}</button>`),+ });+ }return rows;}-/** 数据账号:每个服务一行添加入口,下面是这个服务已加的账号 */+/** 数据账号:每个服务已加的账号,下面一行添加入口。别的连接方式在授权弹窗里 */function dataRows({ accounts, setAccounts, setSheet }) {+ const base = { tab: "connections", group: "data", groupNote: t("settings.connections.dataSub") };const remove = async (a) => {if (!(await confirmSheet({ title: t("settings.connections.removeTitle", { name: a.label }), body: t("settings.connections.removeBody"), confirmLabel: t("settings.connections.remove"), danger: true }))) return;try {setAccounts((await api(`/connections/${a.id}`, { method: "DELETE" })).accounts);- saved();+ toast(t("settings.connections.removed", { name: a.label }));} catch (e) {failed(e);}@@ -99,18 +173,10 @@ function dataRows({ accounts, setAccounts, setSheet }) {const reauthorize = (a) => setSheet(a.service === "feishu" ? { kind: "feishu", mode: "oneclick" } : a.method === "token" ? { kind: "notion-token" } : { kind: "notion-oauth" });const rows = [];for (const service of ["notion", "feishu"]) {- rows.push({- tab: "connections",- id: `add-${service}`,- name: serviceName(service),- sub: t(`settings.connections.${service}Sub`),- keys: t(`settings.connections.${service}Keys`),- ctl: html`<button type="button" class="btn primary" onClick=${() => setSheet(service === "feishu" ? { kind: "feishu", mode: "oneclick" } : { kind: "notion-oauth" })}>${t("settings.connections.oneClick")}</button>- <button type="button" class="text" onClick=${() => setSheet(service === "feishu" ? { kind: "feishu", mode: "app" } : { kind: "notion-token" })}>${t(`settings.connections.${service}Other`)}</button>`,- });- for (const a of accounts.filter((x) => x.service === service)) {+ const list = accounts.filter((x) => x.service === service);+ for (const a of list) {rows.push({- tab: "connections",+ ...base,id: `account-${a.id}`,name: `${serviceName(service)} ${a.number} · ${a.label}`,sub: a.needsReauth ? t("settings.connections.needsReauth") : t(a.method === "token" ? "settings.connections.viaToken" : "settings.connections.viaOAuth"),@@ -120,24 +186,49 @@ function dataRows({ accounts, setAccounts, setSheet }) {<button type="button" class="text danger" onClick=${() => remove(a)}>${t("settings.connections.remove")}</button>`,});}+ rows.push({+ ...base,+ id: `add-${service}`,+ name: serviceName(service),+ sub: t(`settings.connections.${service}Sub`),+ keys: t(`settings.connections.${service}Keys`),+ ctl: html`<button type="button" class="btn" onClick=${() => setSheet(service === "feishu" ? { kind: "feishu", mode: "oneclick" } : { kind: "notion-oauth" })}>${t(list.length ? "settings.connections.addOne" : "settings.connections.connect")}</button>`,+ });}return rows;}function ErrorLine({ text }) {- return text ? html`<p class="hint" role="alert">${text}</p>` : null;+ return text ? html`<p class="hint tone-danger" role="alert">${text}</p>` : null;}+/** 编号步骤。给了 current:做完的打勾,正在做的这步加重,没轮到的变灰;没给就是一份普通的说明 */+function Steps({ items, current }) {+ const tracked = current !== undefined;+ return html`<ol class="conn-steps">+ ${items.map((text, i) => html`<li key=${i} class=${!tracked ? "" : i < current ? "done" : i === current ? "now" : "todo"}>+ <span class="n num">${tracked && i < current ? html`<${Icon} name="check" size="xs" strong />` : i + 1}</span>+ <span class="txt">${text}</span>+ </li>`)}+ </ol>`;+}++const QrPlaceholder = () => html`<div class="qr-img empty"><${Spinner} /></div>`;+/** Notion 一键授权:打开系统浏览器,同意后跳回本机;这里等账号列表变化 */function NotionOAuthSheet({ conn, onClose }) {const [url, setUrl] = useState("");const [error, setError] = useState("");const [waiting, setWaiting] = useState(true);+ const [attempt, setAttempt] = useState(0);useEffect(() => {let stop = false;let timer;const before = JSON.stringify(conn.accounts);const until = Date.now() + OAUTH_WAIT_MS;+ setUrl("");+ setError("");+ setWaiting(true);const poll = async () => {if (stop) return;try {@@ -151,7 +242,11 @@ function NotionOAuthSheet({ conn, onClose }) {} catch {/* 下一轮再试 */}- if (Date.now() > until) return setWaiting(false);+ if (Date.now() > until) {+ setWaiting(false);+ setError(t("settings.connections.oauthTimedOut"));+ return;+ }timer = setTimeout(poll, POLL_MS);};api("/connections/notion/oauth", { method: "POST", body: {} })@@ -169,12 +264,16 @@ function NotionOAuthSheet({ conn, onClose }) {stop = true;clearTimeout(timer);};- }, []);- return html`<${Sheet} title=${t("settings.connections.notionOAuthTitle")} onClose=${onClose}>- <p>${error ? "" : t("settings.connections.notionOAuthBody")}</p>- <${ErrorLine} text=${error} />- ${url && html`<p><a class="text" href=${url} target="_blank" rel="noopener noreferrer">${t("settings.connections.openAgain")}</a></p>`}- ${waiting && html`<p class="hint"><${Spinner} /> ${t("settings.connections.waiting")}</p>`}+ }, [attempt]);+ return html`<${Sheet} title=${t("settings.connections.notionOAuthTitle")} sticky onClose=${onClose}>+ <div class="qr-flow">+ <${Steps} items=${stepsOf("notion")} />+ <${ErrorLine} text=${error} />+ ${waiting && html`<p class="qr-wait"><${Spinner} /> ${t("settings.connections.waiting")}</p>`}+ ${waiting && url && outLink(url, t("settings.connections.openAgain"))}+ ${!waiting && html`<button type="button" class="btn primary" onClick=${() => setAttempt((n) => n + 1)}>${t("settings.connections.retry")}</button>`}+ </div>+ <div class="actions"><button type="button" class="text" onClick=${() => conn.setSheet({ kind: "notion-token" })}>${t("settings.connections.useToken")}</button></div><//>`;}@@ -195,14 +294,14 @@ function NotionTokenSheet({ conn, onClose }) {setBusy(false);}};- return html`<${Sheet} title=${t("settings.connections.notionTokenTitle")} onClose=${onClose}>+ return html`<${Sheet} title=${t("settings.connections.notionTokenTitle")} sticky onClose=${onClose}><form onSubmit=${submit}><p class="hint">${t("settings.connections.notionTokenHint")} <a class="text" href=${NOTION_PORTAL} target="_blank" rel="noopener noreferrer">${t("settings.connections.createToken")}</a></p><label class="set-field"><span class="k">${t("settings.connections.tokenLabel")}</span><input class="field mono" type="password" autocomplete="off" spellcheck="false" value=${token} onInput=${(e) => setToken(e.target.value)} /></label><${ErrorLine} text=${error} />- <div class="actions"><button type="submit" class="btn primary" disabled=${!token.trim() || busy}>${busy ? html`<${Spinner} />` : t("settings.connections.add")}</button></div>+ <div class="actions"><button type="button" class="text" onClick=${() => conn.setSheet({ kind: "notion-oauth" })}>${t("settings.connections.useOneClick")}</button><span class="grow"></span><button type="submit" class="btn primary" disabled=${!token.trim() || busy}>${busy ? html`<${Spinner} />` : t("settings.connections.add")}</button></div></form><//>`;}@@ -254,12 +353,14 @@ function useFeishuFlow(onDone) {return { flow, error: flow && flow.state === "failed" ? flow.error : error, start };}-/** 流程进行中:二维码、链接、等待 */-function FlowSteps({ flow, text }) {- return html`<p>${text}</p>- ${flow.qr && html`<img class="panel-qr" src=${flow.qr} alt=${t("settings.connections.qrAlt")} />`}- ${flow.url && html`<p><a class="text" href=${flow.url} target="_blank" rel="noopener noreferrer">${t("settings.connections.openInBrowser")}</a></p>`}- <p class="hint"><${Spinner} /> ${t("settings.connections.waiting")}</p>`;+/** 流程进行中:步骤、二维码、等待、备用链接 */+function FlowSteps({ flow, items, current }) {+ return html`<div class="qr-flow">+ <${Steps} items=${items} current=${current} />+ ${flow?.qr ? html`<img class="qr-img" src=${flow.qr} alt=${t("settings.connections.qrAlt")} />` : html`<${QrPlaceholder} />`}+ ${flow?.url && html`<p class="qr-wait"><${Spinner} /> ${t("settings.connections.waitingScan")}</p>`}+ ${flow?.url && outLink(flow.url, t("settings.connections.openInBrowser"))}+ </div>`;}/** 飞书消息:一键授权要扫两次(创建应用、授权读消息);用已有应用只扫第二次 */@@ -271,43 +372,42 @@ function FeishuSheet({ conn, mode, onClose }) {saved();onClose();});+ const appBody = () => ({ appId: appId.trim(), appSecret: appSecret.trim() });const begin = (body) => start("/connections/feishu", body);useEffect(() => {if (mode === "oneclick") begin({});}, []);- const steps = flow && (flow.state === "create-app" || flow.state === "authorize");- return html`<${Sheet} title=${t("settings.connections.feishuTitle")} onClose=${onClose}>- ${mode === "app" && !flow && html`<form onSubmit=${(e) => { e.preventDefault(); begin({ appId: appId.trim(), appSecret: appSecret.trim() }); }}>+ const showForm = mode === "app" && (!flow || flow.state === "failed");+ const scanning = !error && !showForm;+ const items = stepsOf(mode === "app" ? "feishuDataApp" : "feishuData");+ return html`<${Sheet} title=${t("settings.connections.feishuTitle")} sticky onClose=${onClose}>+ ${showForm && html`<form onSubmit=${(e) => { e.preventDefault(); begin(appBody()); }}><p class="hint">${t("settings.connections.feishuAppHint")}</p><label class="set-field"><span class="k">App ID</span><input class="field mono" value=${appId} placeholder="cli_xxxxxxxx" onInput=${(e) => setAppId(e.target.value)} /></label><label class="set-field"><span class="k">App Secret</span><input class="field mono" type="password" autocomplete="off" value=${appSecret} onInput=${(e) => setAppSecret(e.target.value)} /></label><div class="actions"><button type="submit" class="btn primary" disabled=${!appId.trim() || !appSecret.trim()}>${t("settings.connections.next")}</button></div></form>`}- ${steps && html`<${FlowSteps} flow=${flow} text=${t(flow.state === "create-app" ? "settings.connections.feishuStepCreate" : "settings.connections.feishuStepAuthorize")} />`}- ${!flow && mode === "oneclick" && !error && html`<p class="hint"><${Spinner} /></p>`}+ ${scanning && html`<${FlowSteps} flow=${flow} items=${items} current=${mode === "app" ? 0 : flow?.state === "authorize" ? 1 : 0} />`}<${ErrorLine} text=${error} />- ${error && mode === "oneclick" && html`<div class="actions"><button type="button" class="btn" onClick=${() => begin({})}>${t("settings.connections.retry")}</button></div>`}+ <div class="actions">+ <button type="button" class="text" onClick=${() => conn.setSheet({ kind: "feishu", mode: mode === "app" ? "oneclick" : "app" })}>${t(mode === "app" ? "settings.connections.useScan" : "settings.connections.useApp")}</button>+ ${error && mode === "oneclick" && html`<button type="button" class="btn primary" onClick=${() => begin({})}>${t("settings.connections.retry")}</button>`}+ </div><//>`;}-/** 飞书聊天账号:默认扫码创建应用,也可以填已有的应用 */-function FeishuChatConnect({ accountKey, st, reload }) {- const [manual, setManual] = useState(false);- const path = `/channel-accounts/${encodeURIComponent(accountKey)}/feishu/one-click`;- const { flow, error, start } = useFeishuFlow(() => {- saved();- reload();- });+/** 添加飞书聊天账号的第一步:扫码创建应用 */+function FeishuScan({ accountKey, onConfirmed, onManual }) {+ const path = accountUrl(accountKey, "/feishu/one-click");+ const { flow, error, start } = useFeishuFlow(onConfirmed);useEffect(() => {- if (!manual) start(path, {});- }, [manual]);- if (manual) return html`<${CredentialConnect} accountKey=${accountKey} channel="feishu" st=${st} reload=${reload} />`;- return html`${flow && flow.state === "create-app" && flow.url && html`<${FlowSteps} flow=${flow} text=${t("settings.connections.feishuChatStep")} />`}- ${(!flow || !flow.url) && !error && html`<p class="hint"><${Spinner} /></p>`}+ start(path, {});+ }, []);+ return html`${!error && html`<${FlowSteps} flow=${flow?.state === "create-app" ? flow : null} items=${stepsOf("feishu")} />`}<${ErrorLine} text=${error} /><div class="actions">- ${error && html`<button type="button" class="btn" onClick=${() => start(path, {})}>${t("settings.connections.retry")}</button>`}- <button type="button" class="text" onClick=${() => setManual(true)}>${t("settings.connections.feishuOther")}</button>+ <button type="button" class="text" onClick=${onManual}>${t("settings.connections.useApp")}</button>+ ${error && html`<button type="button" class="btn primary" onClick=${() => start(path, {})}>${t("settings.connections.retry")}</button>`}</div>`;}@@ -400,35 +500,58 @@ function AccessPanel({ accountKey, channel, onChanged }) {</div>`;}-/** 微信:扫码登录。账号在扫码成功后才出现 */-function WeixinConnect({ accountKey, st, reload }) {- const [code2, setCode] = useState("");- const login = st?.login;- const active = login && ACTIVE_LOGIN.includes(login.state);- const base = `/channel-accounts/${encodeURIComponent(accountKey)}/weixin`;+/**+ * 微信扫码:一打开就取二维码,不用再点一次。扫完在手机上确认时,第一步打勾、第二步加重。+ * 卸载时取消:用户关了弹窗,这次登录就作废。+ */+function WeixinScan({ accountKey, onConfirmed }) {+ const [login, setLogin] = useState({ state: "fetching" });+ const [verifyCode, setVerifyCode] = useState("");+ const base = accountUrl(accountKey, "/weixin");+ const start = () => {+ setLogin({ state: "fetching" });+ api(`${base}/login`, { method: "POST", body: {} }).then(setLogin).catch((e) => setLogin({ state: "failed", message: e.message }));+ };+ useEffect(() => {+ start();+ return () => void api(`${base}/cancel`, { method: "POST", body: {} }).catch(() => {});+ }, []);+ const ended = LOGIN_ENDED.includes(login.state) || login.state === "confirmed";useEffect(() => {- if (!active) return;- const timer = setInterval(reload, 1500);+ if (ended) return;+ // 取二维码的请求还没回来时,这里可能读到 idle:不算数+ const timer = setInterval(() => api(`${base}/login`).then((s) => s.state !== "idle" && setLogin(s)).catch(() => {}), 1500);return () => clearInterval(timer);- }, [active]);- const call = (path, body = {}) => api(base + path, { method: "POST", body }).then(reload).catch(failed);- return html`${login && login.state !== "idle" && html`<div class="actions"><${Badge} s=${login.state} /><span class="hint">${login.message}</span></div>`}- ${active && login.qrDataUrl && html`<img class="panel-qr" src=${login.qrDataUrl} alt=${t("info.weixin.qrAlt")} /><p class="hint">${t("info.weixin.scanHint")}</p>`}- ${login && login.state === "need_verifycode" && html`<div class="actions"><input class="field" style="width:140px" placeholder=${t("info.weixin.verifyCode")} value=${code2} onInput=${(e) => setCode(e.target.value)} />- <button type="button" class="btn" onClick=${() => call("/verify", { code: code2 }).then(() => setCode(""))}>${t("info.weixin.submit")}</button></div>`}- ${st?.account && st.account.pausedUntil > Date.now() && html`<p class="hint">${t("info.weixin.pausedUntil", { time: fmtTime(st.account.pausedUntil) })}</p>`}- <div class="actions">- ${active- ? html`<button type="button" class="btn" onClick=${() => call("/cancel")}>${t("common.cancel")}</button>`- : html`<button type="button" class="btn primary" onClick=${() => call("/login")}>${st?.account ? t("info.weixin.relogin") : t("info.weixin.login")}</button>`}- </div>- ${st?.quota && st.quota.length > 0 && html`<p class="hint">${t("info.weixin.quota", { list: st.quota.map((q) => t("info.weixin.quotaItem", { user: q.userId.slice(0, 8), count: q.remaining })).join(t("info.weixin.quotaSep")) })}</p>`}`;+ }, [ended]);+ useEffect(() => {+ if (login.state === "confirmed") onConfirmed();+ }, [login.state]);+ const verify = (e) => {+ e.preventDefault();+ api(`${base}/verify`, { method: "POST", body: { code: verifyCode } }).then(() => setVerifyCode("")).catch(failed);+ };+ const scanned = login.state === "scaned" || login.state === "need_verifycode";+ if (LOGIN_ENDED.includes(login.state)) {+ return html`<div class="qr-flow"><${ErrorLine} text=${login.message} /><button type="button" class="btn primary" onClick=${start}>${t("settings.connections.retry")}</button></div>`;+ }+ return html`<div class="qr-flow">+ <${Steps} items=${stepsOf("weixin")} current=${scanned ? 1 : 0} />+ ${login.qrDataUrl+ ? html`<span class=${`qr-box${scanned ? " scanned" : ""}`}><img class="qr-img" src=${login.qrDataUrl} alt=${t("info.weixin.qrAlt")} />${scanned && html`<span class="qr-check"><${Icon} name="check" size="md" strong /></span>`}</span>`+ : html`<${QrPlaceholder} />`}+ <p class="qr-wait"><${Spinner} /> ${login.message || t("settings.connections.waitingScan")}</p>+ ${login.state === "need_verifycode" && html`<form class="qr-code" onSubmit=${verify}>+ <input class="field" placeholder=${t("info.weixin.verifyCode")} value=${verifyCode} onInput=${(e) => setVerifyCode(e.target.value)} />+ <button type="submit" class="btn" disabled=${!verifyCode.trim()}>${t("info.weixin.submit")}</button>+ </form>`}+ </div>`;}-/** 飞书、Telegram、Slack、Discord:填凭据连上。已保存的留空表示不改 */-function CredentialConnect({ accountKey, channel, st, reload }) {+/** 飞书、Telegram、Slack、Discord:先照步骤拿到凭据,再填进来连上。已保存的留空表示不改;凭据不对的错误直接写在表单里 */+function CredentialForm({ accountKey, channel, st, onSaved }) {const [values, setValues] = useState({});const [busy, setBusy] = useState(false);+ const [error, setError] = useState("");const feishu = channel === "feishu";const fields = feishu ? [{ key: "appId", label: "App ID", placeholder: "cli_xxxxxxxx", plain: true }, { key: "appSecret", label: "App Secret", placeholder: "" }] : MESSENGER_FIELDS[channel].map((f) => ({ ...f, label: t(`info.messenger.${channel}.${f.key}`) }));const account = st?.account;@@ -436,81 +559,216 @@ function CredentialConnect({ accountKey, channel, st, reload }) {const value = (f) => values[f.key] ?? (f.plain ? account?.appId ?? "" : "");const filled = (f) => !!value(f).trim();const ready = account ? fields.some((f) => (values[f.key] || "").trim()) : fields.every(filled);- const save = async (e) => {+ const submit = async (e) => {e.preventDefault();setBusy(true);+ setError("");try {- await api(`/channel-accounts/${encodeURIComponent(accountKey)}/${channel}`, { method: "PUT", body: feishu ? { appId: value(fields[0]).trim(), appSecret: (values.appSecret || "").trim() } : values });+ await api(accountUrl(accountKey, `/${channel}`), { method: "PUT", body: feishu ? { appId: value(fields[0]).trim(), appSecret: (values.appSecret || "").trim() } : values });setValues({});- saved();- reload();+ onSaved();} catch (err) {- failed(err);+ setError(err.message || String(err));}setBusy(false);};- return html`<form onSubmit=${save}>+ const stepKey = feishu ? "feishuApp" : channel;+ return html`<form class="conn-form" onSubmit=${submit}>+ <${Steps} items=${stepsOf(stepKey, STEP_PARAMS[stepKey]())} />${fields.map((f) => html`<label class="set-field" key=${f.key}><span class="k">${f.label}${saved0(f.key) && html`<span class="hint">${t("info.messenger.secretSaved", { masked: saved0(f.key) })}</span>`}</span><input class="field mono" type=${f.plain ? "text" : "password"} autocomplete="off" spellcheck="false" placeholder=${f.placeholder} value=${value(f)} onInput=${(ev) => setValues((v) => ({ ...v, [f.key]: ev.target.value }))} /></label>`)}- <div class="actions"><button type="submit" class="btn primary" disabled=${!ready || busy}>${busy ? html`<${Spinner} />` : t("info.messenger.saveConnect")}</button></div>- <p class="hint">${feishu ? t("info.feishu.setupHint", FEISHU_HINT()) : t(`info.messenger.${channel}.setupHint`, MESSENGER_HINT[channel]())}</p>+ <${ErrorLine} text=${error} />+ <div class="actions"><button type="submit" class="btn primary" disabled=${!ready || busy}>${busy ? html`<${Spinner} />` : t(account ? "info.messenger.saveConnect" : "settings.connections.connect")}</button></div></form>`;}-/** 管理一个渠道账号(别名、默认机器人、凭据、谁能用),或添加新账号(key 先要一个,连上才真的存) */-function ChannelSheet({ conn, bots, channel, accountKey, onClose }) {- const [key, setKey] = useState(accountKey || "");+/**+ * 连上之后的最后一步:告诉用户接下来做什么。+ * 除了微信(扫码的人就是主人),都是第一个发消息的人成为主人,所以一直盯着,发了就告诉用户绑好了。+ */+function ConnectedStep({ conn, bots, account, channel, onDone, onFix }) {const [st, setSt] = useState(null);+ const [owner, setOwner] = useState(undefined);+ const key = account.key;+ useEffect(() => {+ const load = () => {+ conn.reloadChannels();+ api(accountUrl(key, "/channels")).then((r) => setSt(r[channel])).catch(() => {});+ api(accountUrl(key, "/access")).then((d) => setOwner(d.owners[channel] || null)).catch(() => {});+ };+ load();+ const timer = setInterval(load, POLL_MS);+ return () => clearInterval(timer);+ }, [key]);+ const name = channelName(channel);+ const state = account.status?.state;+ if (PROBLEM.includes(state)) {+ return html`<${ErrorLine} text=${account.status.detail} />+ <div class="actions">+ <button type="button" class="text" onClick=${onDone}>${t("common.close")}</button>+ <button type="button" class="btn primary" data-autofocus onClick=${onFix}>${t("settings.connections.fix")}</button>+ </div>`;+ }+ const list = bots || [];+ const link = chatLink(channel, st);+ const limit = `settings.connections.limit.${channel}`;+ return html`<div class="conn-done">+ <${Steps} items=${[t("settings.connections.tryIt", { channel: name }), ...(list.length > 1 ? [t("settings.connections.switchBot")] : [])]} />+ ${owner !== undefined && html`<p class="conn-note">+ ${owner ? html`<${Icon} name="check" size="sm" strong />` : html`<${Spinner} />`}+ <span>${!owner ? t("settings.connections.ownerWaiting") : owner.via === "login" ? t("settings.connections.ownerLogin", { channel: name }) : t("settings.connections.ownerBound", { who: owner.name })}</span>+ </p>`}+ ${has(limit) && html`<p class="hint">${t(limit)}</p>`}+ ${list.length > 1+ ? html`<div class="set-field"><span class="k">${t("settings.connections.defaultBot")}</span>+ <${MenuButton} label=${t("settings.connections.defaultBot")} value=${account.defaultBot} width=${260} align="left" options=${list.map((b) => [b.id, b.name])} onChange=${(v) => conn.updateChannel(key, channel, { defaultBot: v })} />+ </div>`+ : list.length === 1 && html`<p class="hint">${t("settings.connections.defaultIs", { bot: list[0].name })}</p>`}+ <div class="actions">+ ${link && html`<a class="btn" href=${link} target="_blank" rel="noopener noreferrer">${t("settings.connections.openChat", { channel: name })}</a>`}+ <button type="button" class="btn primary" data-autofocus onClick=${onDone}>${t("settings.connections.done")}</button>+ </div>+ </div>`;+}++/** 添加聊天账号:照步骤连上 → 下一步。账号的 key 先要一个,连上才真的存 */+function AddChannelSheet({ conn, bots, channel, onClose }) {+ const [key, setKey] = useState("");+ const [linked, setLinked] = useState(false);+ const [manual, setManual] = useState(false);+ const account = key ? conn.channelAccounts.find((a) => a.key === key && a.channel === channel) : null;+ useEffect(() => {+ api("/channel-accounts/new-key", { method: "POST", body: {} })+ .then((r) => setKey(r.key))+ .catch((e) => (failed(e), onClose()));+ }, []);+ const onLinked = () => {+ setLinked(true);+ conn.reloadChannels();+ };+ // 确认之后账号要过一会儿才进列表(微信还要存登录态、启动渠道)+ useEffect(() => {+ if (!linked || account) return;+ const timer = setInterval(conn.reloadChannels, 1000);+ return () => clearInterval(timer);+ }, [linked, !!account]);+ useEffect(() => {+ if (linked && account) markDone("weixin");+ }, [linked, !!account]);+ const close = () => {+ if (account) conn.flashRow(`channel-${channel}-${key}`);+ onClose();+ };+ const name = channelName(channel);+ const state = account?.status?.state;+ const title = !linked+ ? t("settings.connections.connectTitle", { channel: name })+ : PROBLEM.includes(state)+ ? t("settings.connections.failedTitle", { channel: name })+ : state === "connected"+ ? t("settings.connections.connectedTitle", { channel: name })+ : t("settings.connections.connectingTitle", { channel: name });+ const connect = !key+ ? html`<div class="qr-flow"><${QrPlaceholder} /></div>`+ : channel === "weixin"+ ? html`<${WeixinScan} accountKey=${key} onConfirmed=${onLinked} />`+ : channel === "feishu" && !manual+ ? html`<${FeishuScan} accountKey=${key} onConfirmed=${onLinked} onManual=${() => setManual(true)} />`+ : html`<${CredentialForm} accountKey=${key} channel=${channel} onSaved=${onLinked} />+ ${channel === "feishu" && html`<div class="actions"><button type="button" class="text" onClick=${() => setManual(false)}>${t("settings.connections.useScan")}</button></div>`}`;+ return html`<${Sheet} title=${title} sticky=${!linked} onClose=${close}>+ ${!linked+ ? connect+ : account+ ? html`<${ConnectedStep} conn=${conn} bots=${bots} account=${account} channel=${channel} onDone=${close} onFix=${() => conn.setSheet({ kind: "channel", channel, accountKey: key, fix: true })} />`+ : html`<p class="qr-wait"><${Spinner} /></p>`}+ <//>`;+}++/** 管理一个渠道账号:状态、别名、默认机器人、谁能用、连接方式。账号有问题时,修复入口排到最上面 */+function ManageChannelSheet({ conn, bots, channel, accountKey: key, fix, onClose }) {const account = conn.channelAccounts.find((a) => a.key === key && a.channel === channel);+ const [st, setSt] = useState(null);const [label, setLabel] = useState(account?.label ?? "");+ const [changing, setChanging] = useState(false);const reload = () => {conn.reloadChannels();- if (key) api(`/channel-accounts/${encodeURIComponent(key)}/channels`).then((r) => setSt(r[channel])).catch(() => {});+ api(accountUrl(key, "/channels")).then((r) => setSt(r[channel])).catch(() => {});};useEffect(() => {- if (!key) api("/channel-accounts/new-key", { method: "POST", body: {} }).then((r) => setKey(r.key)).catch(failed);- else reload();+ reload();+ const timer = setInterval(reload, 5000);+ return () => clearInterval(timer);}, [key]);useEffect(() => {if (account) setLabel(account.label);}, [account?.label]);- const put = async (body) => {- try {- conn.setChannelAccounts((await api(`/channel-accounts/${encodeURIComponent(key)}/${channel}/settings`, { method: "PUT", body })).accounts);- saved();- } catch (e) {- failed(e);- if (account) setLabel(account.label);- }+ // 跳转过来的链接可能指向已经移除的账号+ useEffect(() => {+ if (conn.channelsLoaded && !account) onClose();+ }, [conn.channelsLoaded, !!account]);+ const state = account?.status?.state;+ const problem = PROBLEM.includes(state);+ useEffect(() => {+ if (fix && problem) setChanging(true);+ }, [fix, problem]);+ if (!account) return null;+ const commitLabel = async () => {+ const next = label.trim();+ if (next === account.label) return;+ if (!(await conn.updateChannel(key, channel, { label: next }))) setLabel(account.label);+ };+ const changed = () => {+ setChanging(false);+ saved();+ reload();};const remove = async () => {if (!(await confirmSheet({ title: t("settings.connections.removeTitle", { name: account.label }), body: t("settings.connections.removeChannelBody"), confirmLabel: t("settings.connections.remove"), danger: true }))) return;try {- await api(`/channel-accounts/${encodeURIComponent(key)}/${channel}`, { method: "DELETE" });+ await api(accountUrl(key, `/${channel}`), { method: "DELETE" });conn.reloadChannels();- saved();+ toast(t("settings.connections.removed", { name: account.label }));onClose();} catch (e) {failed(e);}};- const title = account ? `${channelName(channel)} ${account.number} · ${account.label}` : t("settings.connections.addChannelTitle", { channel: channelName(channel) });- return html`<${Sheet} title=${title} wide onClose=${onClose}>- ${account && html`<label class="set-field"><span class="k">${t("settings.connections.nameLabel")}</span>- <input class="field" maxlength="80" value=${label} onInput=${(e) => setLabel(e.target.value)} onBlur=${() => label.trim() !== account.label && put({ label: label.trim() })} />- </label>- <div class="set-field"><span class="k">${t("settings.connections.defaultBot")}</span>- <${MenuButton} label=${t("settings.connections.defaultBot")} value=${account.defaultBot} width=${260} options=${(bots || []).map((b) => [b.id, b.name])} onChange=${(v) => put({ defaultBot: v })} />- <p class="hint">${t("settings.connections.defaultBotHint")}</p>- </div>`}- ${key && st && (channel === "weixin"- ? html`<${WeixinConnect} accountKey=${key} st=${st} reload=${reload} />`- : channel === "feishu" && !st.account- ? html`<${FeishuChatConnect} accountKey=${key} st=${st} reload=${reload} />`- : html`<${CredentialConnect} key=${key} accountKey=${key} channel=${channel} st=${st} reload=${reload} />`)}- ${account && html`<${AccessPanel} accountKey=${key} channel=${channel} onChanged=${conn.reloadChannels} />- <div class="actions"><button type="button" class="text danger" onClick=${remove}>${t("settings.connections.removeAccount")}</button></div>`}+ const via = channel === "weixin"+ ? { name: t("settings.connections.viaScan"), sub: "", action: t("info.weixin.relogin") }+ : channel === "feishu"+ ? { name: "App ID", sub: st?.account?.appId, action: t("settings.connections.changeApp") }+ : { name: t("settings.connections.tokenLabel"), sub: Object.values(st?.account?.saved || {}).join(" · "), action: t("settings.connections.changeToken") };+ const method = html`<div class="conn-method">+ <div class="list-head">${t("settings.connections.connection")}</div>+ <div class="list"><div class="row">+ <div class="who"><div class="name">${via.name}</div>${via.sub && html`<div class="sub">${via.sub}</div>`}</div>+ <div class="ctl"><button type="button" class=${`btn${problem && !changing ? " primary" : ""}`} onClick=${() => setChanging((v) => !v)}>${changing ? t("common.cancel") : via.action}</button></div>+ </div></div>+ ${changing && (channel === "weixin"+ ? html`<${WeixinScan} accountKey=${key} onConfirmed=${changed} />`+ : html`<${CredentialForm} accountKey=${key} channel=${channel} st=${st} onSaved=${changed} />`)}+ ${st?.account?.pausedUntil > Date.now() && html`<p class="hint">${t("info.weixin.pausedUntil", { time: fmtTime(st.account.pausedUntil) })}</p>`}+ ${st?.quota?.length > 0 && html`<p class="hint">${t("info.weixin.quota", { list: st.quota.map((q) => t("info.weixin.quotaItem", { user: q.userId.slice(0, 8), count: q.remaining })).join(t("info.weixin.quotaSep")) })}</p>`}+ </div>`;+ return html`<${Sheet} title=${accountName(account)} wide sticky=${changing} onClose=${onClose}>+ <div class="conn-state"><${Badge} s=${state} />${state !== "connected" && account.status?.detail && html`<span>${account.status.detail}</span>`}</div>+ ${problem && method}+ <label class="set-field"><span class="k">${t("settings.connections.nameLabel")}</span>+ <input class="field" maxlength="80" value=${label} onInput=${(e) => setLabel(e.target.value)} onBlur=${commitLabel} />+ </label>+ <div class="set-field"><span class="k">${t("settings.connections.defaultBot")}</span>+ <${MenuButton} label=${t("settings.connections.defaultBot")} value=${account.defaultBot} width=${260} align="left" options=${(bots || []).map((b) => [b.id, b.name])} onChange=${(v) => conn.updateChannel(key, channel, { defaultBot: v })} />+ <p class="hint">${t("settings.connections.defaultBotHint")}</p>+ </div>+ <${AccessPanel} accountKey=${key} channel=${channel} onChanged=${conn.reloadChannels} />+ ${!problem && method}+ <div class="actions">+ <button type="button" class="text danger" onClick=${remove}>${t("settings.connections.removeAccount")}</button>+ <span class="grow"></span>+ <button type="button" class="btn primary" data-autofocus onClick=${onClose}>${t("settings.connections.done")}</button>+ </div><//>`;}@@ -518,10 +776,11 @@ export function ConnectionSheets({ conn, bots }) {const { sheet, setSheet } = conn;const close = () => setSheet(null);if (!sheet) return null;- if (sheet.kind === "channel") return html`<${ChannelSheet} key=${`${sheet.channel}-${sheet.accountKey ?? "new"}`} conn=${conn} bots=${bots} channel=${sheet.channel} accountKey=${sheet.accountKey} onClose=${close} />`;+ if (sheet.kind === "channel" && sheet.accountKey) return html`<${ManageChannelSheet} key=${`${sheet.channel}-${sheet.accountKey}`} conn=${conn} bots=${bots} channel=${sheet.channel} accountKey=${sheet.accountKey} fix=${sheet.fix} onClose=${close} />`;+ if (sheet.kind === "channel") return html`<${AddChannelSheet} key=${sheet.channel} conn=${conn} bots=${bots} channel=${sheet.channel} onClose=${close} />`;if (sheet.kind === "notion-oauth") return html`<${NotionOAuthSheet} conn=${conn} onClose=${close} />`;if (sheet.kind === "notion-token") return html`<${NotionTokenSheet} conn=${conn} onClose=${close} />`;- if (sheet.kind === "feishu") return html`<${FeishuSheet} conn=${conn} mode=${sheet.mode} onClose=${close} />`;+ if (sheet.kind === "feishu") return html`<${FeishuSheet} key=${sheet.mode} conn=${conn} mode=${sheet.mode} onClose=${close} />`;if (sheet.kind === "rename") return html`<${RenameSheet} conn=${conn} account=${sheet.account} onClose=${close} />`;return null;}diff --git a/ui/screens/discover.js b/ui/screens/discover.jsindex 455d21f..1ad52c5 100644--- a/ui/screens/discover.js+++ b/ui/screens/discover.js@@ -33,13 +33,13 @@ export function DiscoverScreen({ catalog, onOpen }) {const rest = needle ? hits : hits.filter((e) => !e.featured);return html`<section class="discover" data-screen="discover"><header class="discover-head">- <h1 class="t-title">${t("botapp.discover.title")}</h1>- <p class="t-meta">${t("botapp.discover.lead")}</p>+ <h1 class="t-page">${t("botapp.discover.title")}</h1>+ <p>${t("botapp.discover.lead")}</p>${list.length >= SEARCH_MIN && html`<label class="side-search discover-search"><${Icon} name="search" size="sm" /><input type="search" placeholder=${t("common.search")} aria-label=${t("common.search")} value=${q} onInput=${(e) => setQ(e.target.value)} /></label>`}</header>- ${featured.length > 0 && html`<h2 class="t-label">${t("botapp.discover.featured")}</h2><div class="discover-grid">${featured.map((e) => html`<${Card} key=${e.id} entry=${e} lang=${lang} onOpen=${onOpen} />`)}</div>`}- ${rest.length > 0 && html`<h2 class="t-label">${t("botapp.discover.latest")}</h2><div class="discover-grid">${rest.map((e) => html`<${Card} key=${e.id} entry=${e} lang=${lang} onOpen=${onOpen} />`)}</div>`}+ ${featured.length > 0 && html`<h2 class="discover-part">${t("botapp.discover.featured")}</h2><div class="discover-grid">${featured.map((e) => html`<${Card} key=${e.id} entry=${e} lang=${lang} onOpen=${onOpen} />`)}</div>`}+ ${rest.length > 0 && html`<h2 class="discover-part">${t("botapp.discover.latest")}</h2><div class="discover-grid">${rest.map((e) => html`<${Card} key=${e.id} entry=${e} lang=${lang} onOpen=${onOpen} />`)}</div>`}${!hits.length && html`<p class="hint">${t("botapp.discover.empty")}</p>`}</section>`;}diff --git a/ui/screens/info-panel.js b/ui/screens/info-panel.jsindex 6eee135..85d82ca 100644--- a/ui/screens/info-panel.js+++ b/ui/screens/info-panel.js@@ -4,6 +4,7 @@ import { html, Icon, Badge, Button, Sheet, Skeleton } from "../components/ui.js"import { ActivityLine, currentStep, useNow } from "../components/activity.js";import { PromptCard } from "./chat.js";import { api } from "../lib/api.js";+import { accountName } from "../lib/access.js";import { confirmSheet, failed, toast } from "../lib/store.js";import { markDone } from "../lib/guide.js";import { fmtAgo, fmtClock, fmtDur, fmtTime } from "../lib/format.js";@@ -104,7 +105,6 @@ function ConversationSheet({ conv, onClose }) {</div>`)}${turn && html`<${LiveTurn} key=${turn.since} turn=${turn} convId=${conv.id} />`}</div>- <div class="actions"><button type="button" class="btn" data-autofocus onClick=${onClose}>${t("common.close")}</button></div><//>`;}@@ -133,11 +133,11 @@ export function InfoPanel({ bot, leaving, onClose, onOpenBotSettings, onOpenChat${detail?.bot?.settings?.paused && html`<${PausedLine} onResume=${async () => (await api(`/bots/${bot.id}/settings`, { method: "PUT", body: { paused: false } }), reloadDetail())} />`}<div class="list-head">${t("info.channels")}</div><div class="list">- ${mine.map((a) => html`<div key=${`${a.channel}-${a.key}`} class="row clickable" role="button" tabindex="0" onClick=${onOpenConnections} onKeyDown=${(e) => e.key === "Enter" && onOpenConnections()}>- <div class="who"><div class="name">${channelName(a.channel)} · ${a.label}</div><div class="sub">${a.status?.detail || t("info.channelsDefault")}</div></div>+ ${mine.map((a) => html`<div key=${`${a.channel}-${a.key}`} class="row clickable" role="button" tabindex="0" onClick=${() => onOpenConnections(`channel-${a.channel}-${a.key}`)} onKeyDown=${(e) => e.key === "Enter" && onOpenConnections(`channel-${a.channel}-${a.key}`)}>+ <div class="who"><div class="name">${accountName(a)}</div><div class="sub">${a.status?.detail || t("info.channelsDefault")}</div></div><${Badge} s=${a.status?.state} /></div>`)}- <div class="row clickable" data-guide="weixin" role="button" tabindex="0" onClick=${onOpenConnections} onKeyDown=${(e) => e.key === "Enter" && onOpenConnections()}>+ <div class="row clickable" data-guide="weixin" role="button" tabindex="0" onClick=${() => onOpenConnections()} onKeyDown=${(e) => e.key === "Enter" && onOpenConnections()}><div class="who"><div class="name">${t("info.channelsManage")}</div><div class="sub">${t("info.channelsSub")}</div></div></div></div>diff --git a/ui/screens/needs-you.js b/ui/screens/needs-you.jsindex 2d1f118..2f6e483 100644--- a/ui/screens/needs-you.js+++ b/ui/screens/needs-you.js@@ -87,7 +87,7 @@ export function NeedItem({ item, multiBot, onAct, onOpenChat, onRelogin, onOpenB${item.kind === "budget" && html`<${Button} onClick=${() => onOpenBotSettings?.(item.botId, "budget")}>${t("needs.raiseBudget")}<//>`}${item.kind === "delivery" && item.actions.includes("retry") && html`<${Button} loading=${busy === "retry"} disabled=${!!busy} onClick=${() => act("retry")}>${t("common.retry")}<//>`}${item.kind === "delivery" && item.actions.includes("dismiss") && html`<button type="button" class="text" disabled=${!!busy} onClick=${() => act("dismiss")}>${t("needs.dismiss")}</button>`}- ${item.kind === "login" && html`<${Button} onClick=${() => onRelogin?.(item.botId)}>${t("needs.relogin")}<//>`}+ ${item.kind === "login" && html`<${Button} onClick=${() => onRelogin?.(item.id)}>${t("needs.relogin")}<//>`}${item.kind === "suggest" && html`<${Button} loading=${busy === "act"} disabled=${!!busy} onClick=${async () => (await act("act")) && toast(t("rules.nowActs", { title: item.ruleTitle }))}>${t("needs.toAct")}<//><button type="button" class="text" disabled=${!!busy} onClick=${() => act("dismiss")}>${t("needs.keepObserving")}</button>`}</div>diff --git a/ui/screens/new-bot.js b/ui/screens/new-bot.jsindex 7c434a8..8cccb75 100644--- a/ui/screens/new-bot.js+++ b/ui/screens/new-bot.js@@ -4,7 +4,7 @@ import { useEffect, useRef, useState } from "preact/hooks";import { html, Icon, IconButton, Button, autoGrow } from "../components/ui.js";import { BotAvatar, AvatarPicker, MAIN_CHAR } from "../components/avatar.js";import { api } from "../lib/api.js";-import { failed } from "../lib/store.js";+import { createStore, failed } from "../lib/store.js";import { t } from "../lib/i18n.js";/** 模板。名称、简介和人设在词典 newBot.tpl.<key> 里,读的时候按当前语言翻译(选模板时按当时的语言填进表单) */@@ -30,6 +30,9 @@ export const TEMPLATES = [template("coder", "code"),];+/** 正在填的新机器人:侧栏那一行占位跟着显示头像和名字,建好后原地换成真的那一行 */+export const newBotDraft = createStore(null);+export function NewBotScreen({ first, onCreated, onCancel }) {const [name, setName] = useState("");const [prompt, setPrompt] = useState("");@@ -43,6 +46,12 @@ export function NewBotScreen({ first, onCreated, onCancel }) {requestAnimationFrame(() => nameRef.current?.focus());}, []);useEffect(() => autoGrow(promptRef.current, 240), [prompt]);+ useEffect(() => {+ newBotDraft.set({ name: name.trim(), avatar });+ }, [name, avatar]);+ useEffect(() => () => {+ newBotDraft.set(null);+ }, []);const pick = (tp) => {setTpl(tp.key);@@ -61,7 +70,7 @@ export function NewBotScreen({ first, onCreated, onCancel }) {setBusy(true);try {const r = await api("/bots", { method: "POST", body: { name: n, systemPrompt: prompt.trim(), avatar } });- onCreated(r.bot);+ await onCreated(r.bot);} catch (err) {failed(err);setBusy(false);diff --git a/ui/screens/settings.js b/ui/screens/settings.jsindex 280ef20..d2f61df 100644--- a/ui/screens/settings.js+++ b/ui/screens/settings.js@@ -1,10 +1,11 @@-// 设置页(参考 Codex):侧栏换成设置导航(返回应用 + 查找 + 分页),主区是大标题 + 白色圆角 list,一行一项;改动即保存。+// 设置页(参考 Codex):侧栏换成设置导航(返回应用 + 查找 + 分页),主区是大标题 + 按用途分段的 list,一行一项;改动即保存。+// 外观的主题是三张缩略图,Modelflare 顶部是账户和余额;搜索时它们退回普通的行(searchOnly)。// 入口只有左下角账户按钮、⌘/Ctrl+, 和命令面板。-// 外观(主题、字体、动画、毛玻璃…)和对话习惯(发送键、通知)是本机界面偏好,存在浏览器里(lib/theme.js、lib/prefs.js);+// 外观(主题、字体、动画…)和对话习惯(发送键、通知)是本机界面偏好,存在浏览器里(lib/theme.js、lib/prefs.js);// 其余设置走服务端 /settings。import { useEffect, useMemo, useRef, useState } from "preact/hooks";-import { html, Icon, Seg, Switch, Sheet, CopyButton, Skeleton, MenuButton } from "../components/ui.js";-import { AccountButton } from "./sidebar.js";+import { html, Icon, IconButton, Seg, Switch, Sheet, CopyButton, Skeleton, MenuButton } from "../components/ui.js";+import { AccountButton, Balance } from "./sidebar.js";import { PickModel, effortOptions, setEffort, shortModel, showsStrategy, strategyOptions, useEffort } from "../components/model-picker.js";import { DomainConnection } from "../components/domain-connection.js";import { NotificationsSheet, UsageSheet } from "./account.js";@@ -126,15 +127,42 @@ function SaveInput({ id, value = "", secret, label, placeholder, onSave }) {onKeyDown=${(e) => e.key === "Enter" && !e.isComposing && e.keyCode !== 229 && (e.preventDefault(), e.currentTarget.blur())} />`;}-/** 外观分页顶部的预览:一问一答 + 一行代码,跟着字体大小、字体、代码字体和代码换行实时变 */-function AppearancePreview() {- return html`<div class="ap-preview" aria-hidden="true">- <div class="ap-bubble">${t("settings.preview.ask")}</div>- <div class="ap-reply">${t("settings.preview.reply", { b: html`<b>${t("settings.rows.codeWrap.name")}</b>` })}</div>- <pre class="ap-code">const res = await fetch(\`\${base}/v1/chat/completions\`, { method: "POST", headers, body: JSON.stringify({ model, messages }) });</pre>+/** 主题的缩略图:一扇小窗口,局部 data-theme 让它用那个主题的真实颜色 */+const ThemeSketch = ({ theme }) => html`<span class="tsk" data-theme=${theme}><i class="tsk-side"></i><span class="tsk-main"><i class="tsk-bubble"></i><i class="tsk-line"></i><i class="tsk-line short"></i><i class="tsk-box"></i></span></span>`;++/** 外观分页顶部:三张主题缩略图。跟随系统那张左半浅、右半深 */+function ThemeCards({ value, flash, onChange }) {+ return html`<div class=${`theme-cards${flash ? " flash" : ""}`} id="set-theme" role="group" aria-label=${t("settings.rows.theme.name")}>+ ${THEMES().map(([v, label]) => html`<button type="button" key=${v} class=${`theme-card${value === v ? " on" : ""}`} aria-pressed=${value === v} onClick=${() => onChange(v)}>+ <span class=${`theme-thumb${v === "system" ? " split" : ""}`} aria-hidden="true">+ ${v === "system" ? html`<${ThemeSketch} theme="light" /><${ThemeSketch} theme="dark" />` : html`<${ThemeSketch} theme=${v} />`}+ </span>+ <span class="theme-name">${label}</span>+ </button>`)}+ </div>`;+}++/** 文字预览:排在「文字」这组的最后,跟着字体大小、字体、代码字体和代码换行实时变 */+function TextPreview() {+ return html`<div class="text-sample" aria-hidden="true">+ <span class="t-label">${t("settings.preview.label")}</span>+ <p>${t("settings.preview.reply", { b: html`<b>${t("settings.rows.codeWrap.name")}</b>` })}</p>+ <pre>const res = await fetch(\`\${base}/v1/chat/completions\`, { method: "POST", headers, body: JSON.stringify({ model, messages }) });</pre></div>`;}+/** 按 group 分段:相邻同组的行排在一块 .list 里,第一段可以没有标题 */+function groupRows(list) {+ const out = [];+ for (const r of list) {+ const key = r.group || "";+ const last = out[out.length - 1];+ if (last && last.key === key) last.rows.push(r);+ else out.push({ key, label: key ? t(`settings.groups.${key}`) : "", note: r.groupNote, rows: [r] });+ }+ return out;+}+function NoticesSheet({ onClose }) {const [d, setD] = useState(null);const lang = useLang();@@ -146,7 +174,6 @@ function NoticesSheet({ onClose }) {}, [lang]);return html`<${Sheet} title=${t("settings.rows.licenses.name")} wide onClose=${onClose}><pre class="doc">${d ? `${d.license}\n\n${d.notices}` : t("common.loading")}</pre>- <div class="actions"><button type="button" class="btn" data-autofocus onClick=${onClose}>${t("common.close")}</button></div><//>`;}@@ -271,7 +298,7 @@ export function SettingsScreen({ tab, query: q, onQuery: setQ, onTab, focusRow,}).catch(failed);const putSearch = (patch) => put({ webSearch: patch }, { webSearch: { ...s.webSearch, ...(patch.provider ? { provider: patch.provider } : {}) } });- const conn = useConnections();+ const conn = useConnections(tab === "connections" ? focusRow : "");const desktop = !!(s && s.desktop);const pickFont = (v) => {setPrefs({ font: v });@@ -313,87 +340,86 @@ export function SettingsScreen({ tab, query: q, onQuery: setQ, onTab, focusRow,ctl: html`<${Seg} label=${t("settings.rows.sendKey.name")} value=${p.sendKey} onChange=${(v) => { setPrefs({ sendKey: v }); saved(); }} options=${[["enter", "Enter"], ["mod", MOD_ENTER]]} />` },canNotify && { tab: "general", id: "notify", name: t("settings.rows.notify.name"), sub: t("settings.rows.notify.sub"), keys: t("settings.rows.notify.keys"),ctl: html`<${Switch} label=${t("settings.rows.notify.name")} value=${p.notify} onChange=${toggleNotify} />` },- desktop && { tab: "general", id: "close", name: t("settings.rows.close.name"), sub: t("settings.rows.close.sub"), keys: t("settings.rows.close.keys"),- ctl: html`<${Seg} label=${t("settings.rows.close.name")} value=${s.closeToTray} onChange=${(v) => put({ closeToTray: v }, { closeToTray: v })} options=${[[true, t("settings.rows.close.tray")], [false, t("settings.rows.close.quit")]]} />` },- desktop && s.autostart.supported && { tab: "general", id: "autostart", name: t("settings.rows.autostart.name"), sub: t("settings.rows.autostart.sub"), keys: t("settings.rows.autostart.keys"),- ctl: html`<${Switch} label=${t("settings.rows.autostart.name")} value=${s.autostart.on} onChange=${(v) => put({ autostart: v }, { autostart: { ...s.autostart, on: v } })} />` },- desktop && { tab: "general", id: "browser", name: t("settings.rows.browser.name"), sub: t("settings.rows.browser.sub"), keys: t("settings.rows.browser.keys"),- ctl: html`<button type="button" class="text" onClick=${() => api("/desktop/open-in-browser", { method: "POST", body: {} }).catch(failed)}>${t("common.open")}</button>` },g.loaded && { tab: "general", id: "guide", name: t("settings.rows.guide.name"),sub: g.hidden ? t("settings.rows.guide.hidden") : t("settings.rows.guide.progress", { done: guideSteps.filter((x) => g.done.includes(x.id)).length, total: guideSteps.length }),keys: t("settings.rows.guide.keys"),ctl: html`<button type="button" class="text" onClick=${() => resetGuide().then(() => toast(t("settings.rows.guide.restarted"))).catch(failed)}>${t("settings.rows.guide.restart")}</button>` },+ desktop && { tab: "general", group: "desktop", id: "close", name: t("settings.rows.close.name"), sub: t("settings.rows.close.sub"), keys: t("settings.rows.close.keys"),+ ctl: html`<${Seg} label=${t("settings.rows.close.name")} value=${s.closeToTray} onChange=${(v) => put({ closeToTray: v }, { closeToTray: v })} options=${[[true, t("settings.rows.close.tray")], [false, t("settings.rows.close.quit")]]} />` },+ desktop && s.autostart.supported && { tab: "general", group: "desktop", id: "autostart", name: t("settings.rows.autostart.name"), sub: t("settings.rows.autostart.sub"), keys: t("settings.rows.autostart.keys"),+ ctl: html`<${Switch} label=${t("settings.rows.autostart.name")} value=${s.autostart.on} onChange=${(v) => put({ autostart: v }, { autostart: { ...s.autostart, on: v } })} />` },+ desktop && { tab: "general", group: "desktop", id: "browser", name: t("settings.rows.browser.name"), sub: t("settings.rows.browser.sub"), keys: t("settings.rows.browser.keys"),+ ctl: html`<button type="button" class="text" onClick=${() => api("/desktop/open-in-browser", { method: "POST", body: {} }).catch(failed)}>${t("common.open")}</button>` },- { tab: "appearance", id: "theme", name: t("settings.rows.theme.name"), sub: t("settings.rows.theme.sub"), keys: t("settings.rows.theme.keys"),+ { tab: "appearance", searchOnly: true, id: "theme", name: t("settings.rows.theme.name"), sub: t("settings.rows.theme.sub"), keys: t("settings.rows.theme.keys"),ctl: html`<${Seg} label=${t("settings.rows.theme.name")} value=${mode} onChange=${(m) => { setThemeMode(m); saved(); }} options=${THEMES()} />` },- { tab: "appearance", id: "text-size", name: t("settings.rows.textSize.name"), sub: desktop ? t("settings.rows.textSize.subDesktop") : t("settings.rows.textSize.sub"), keys: t("settings.rows.textSize.keys"),+ { tab: "appearance", group: "text", id: "text-size", name: t("settings.rows.textSize.name"), sub: desktop ? t("settings.rows.textSize.subDesktop") : t("settings.rows.textSize.sub"), keys: t("settings.rows.textSize.keys"),ctl: html`<${Seg} label=${t("settings.rows.textSize.name")} value=${p.text} onChange=${(v) => { setPrefs({ text: v }); saved(); }} options=${TEXT_SIZES()} />` },- { tab: "appearance", id: "font", name: t("settings.rows.font.name"), sub: t("settings.rows.font.sub"), keys: t("settings.rows.font.keys"),+ { tab: "appearance", group: "text", id: "font", name: t("settings.rows.font.name"), sub: t("settings.rows.font.sub"), keys: t("settings.rows.font.keys"),ctl: html`<${Seg} label=${t("settings.rows.font.name")} value=${p.font} onChange=${pickFont} options=${FONTS()} />` },- p.font === "custom" && { tab: "appearance", id: "font-name", name: t("settings.rows.fontName.name"), sub: p.fontName ? t("settings.rows.fontName.subSet") : t("settings.rows.fontName.subEmpty"), keys: t("settings.rows.fontName.keys"),+ p.font === "custom" && { tab: "appearance", group: "text", id: "font-name", name: t("settings.rows.fontName.name"), sub: p.fontName ? t("settings.rows.fontName.subSet") : t("settings.rows.fontName.subEmpty"), keys: t("settings.rows.fontName.keys"),ctl: html`<${FontInput} id="font-ui" label=${t("settings.rows.fontName.name")} value=${p.fontName} placeholder=${t("settings.rows.fontName.placeholder")} suggest=${SUGGEST_UI} fallback="var(--font-system)"onChange=${(v) => setPrefs({ fontName: v })} />` },- { tab: "appearance", id: "code-font", name: t("settings.rows.codeFont.name"), sub: t("settings.rows.codeFont.sub"), keys: t("settings.rows.codeFont.keys"),+ { tab: "appearance", group: "text", id: "code-font", name: t("settings.rows.codeFont.name"), sub: t("settings.rows.codeFont.sub"), keys: t("settings.rows.codeFont.keys"),ctl: html`<${FontInput} id="font-code" label=${t("settings.rows.codeFont.name")} value=${p.codeFont} placeholder=${t("settings.rows.codeFont.placeholder")} suggest=${SUGGEST_CODE} fallback="var(--code-system)"onChange=${(v) => setPrefs({ codeFont: v })} />` },- desktop && { tab: "appearance", id: "zoom", name: t("settings.rows.zoom.name"), sub: t("settings.rows.zoom.sub"), keys: t("settings.rows.zoom.keys"),+ { tab: "appearance", group: "text", id: "code-wrap", name: t("settings.rows.codeWrap.name"), sub: t("settings.rows.codeWrap.sub"), keys: t("settings.rows.codeWrap.keys"),+ ctl: html`<${Switch} label=${t("settings.rows.codeWrap.name")} value=${p.codeWrap} onChange=${(v) => { setPrefs({ codeWrap: v }); saved(); }} />` },+ { tab: "appearance", group: "text", id: "text-preview", custom: html`<${TextPreview} key="text-preview" />` },+ desktop && { tab: "appearance", group: "layout", id: "zoom", name: t("settings.rows.zoom.name"), sub: t("settings.rows.zoom.sub"), keys: t("settings.rows.zoom.keys"),ctl: html`<${Seg} label=${t("settings.rows.zoom.name")} value=${s.zoom} onChange=${(z) => put({ zoom: z }, { zoom: z })} options=${ZOOMS} />` },- { tab: "appearance", id: "chat-width", name: t("settings.rows.chatWidth.name"), sub: t("settings.rows.chatWidth.sub"), keys: t("settings.rows.chatWidth.keys"),+ { tab: "appearance", group: "layout", id: "chat-width", name: t("settings.rows.chatWidth.name"), sub: t("settings.rows.chatWidth.sub"), keys: t("settings.rows.chatWidth.keys"),ctl: html`<${Seg} label=${t("settings.rows.chatWidth.name")} value=${p.width} onChange=${(v) => { setPrefs({ width: v }); saved(); }} options=${WIDTHS()} />` },- { tab: "appearance", id: "code-wrap", name: t("settings.rows.codeWrap.name"), sub: t("settings.rows.codeWrap.sub"), keys: t("settings.rows.codeWrap.keys"),- ctl: html`<${Switch} label=${t("settings.rows.codeWrap.name")} value=${p.codeWrap} onChange=${(v) => { setPrefs({ codeWrap: v }); saved(); }} />` },- { tab: "appearance", id: "motion", name: t("settings.rows.motion.name"), sub: t("settings.rows.motion.sub"), keys: t("settings.rows.motion.keys"),+ { tab: "appearance", group: "effects", id: "motion", name: t("settings.rows.motion.name"), sub: t("settings.rows.motion.sub"), keys: t("settings.rows.motion.keys"),ctl: html`<${Seg} label=${t("settings.rows.motion.name")} value=${p.motion} onChange=${(v) => { setPrefs({ motion: v }); saved(); }} options=${AUTO_ON_OFF()} />` },- { tab: "appearance", id: "glass", name: t("settings.rows.glass.name"), sub: t("settings.rows.glass.sub"), keys: t("settings.rows.glass.keys"),- ctl: html`<${Seg} label=${t("settings.rows.glass.name")} value=${p.glass} onChange=${(v) => { setPrefs({ glass: v }); saved(); }} options=${AUTO_ON_OFF()} />` },{ tab: "appearance", id: "reset-appearance", name: t("settings.rows.resetAppearance.name"), sub: desktop ? t("settings.rows.resetAppearance.subDesktop") : t("settings.rows.resetAppearance.sub"), keys: t("settings.rows.resetAppearance.keys"),ctl: html`<button type="button" class="text" disabled=${!customized} onClick=${resetLook}>${t("settings.rows.resetAppearance.button")}</button>` },- managed && acct && { tab: "modelflare", id: "account", name: t("settings.rows.account.name"),+ managed && acct && { tab: "modelflare", searchOnly: true, id: "account", name: t("settings.rows.account.name"),sub: signedIn ? (acct.billedToEnterprise ? t("settings.rows.account.enterprise", { name: acctName }) : acctName) : acct.state === "unavailable" ? acct.error : t("settings.rows.account.signedOut"), keys: t("settings.rows.account.keys"),ctl: signedIn ? html`<button type="button" class="text danger" onClick=${logout}>${t("settings.rows.account.logout")}</button>` : null },!managed && { tab: "modelflare", id: "connection", name: t("settings.rows.connection.name"), sub: t("settings.rows.connection.subExternal"), keys: "",ctl: html`<span class="val" title=${mf && mf.baseUrl}>${mf && mf.baseUrl}</span>` },- managed && acct && mf.connected && { tab: "modelflare", id: "balance", name: t("settings.rows.balance.name"),+ managed && acct && mf.connected && { tab: "modelflare", searchOnly: true, id: "balance", name: t("settings.rows.balance.name"),sub: acct.error ? t("settings.rows.balance.error", { error: acct.error }) : acct.updatedAt ? t("settings.rows.balance.updated", { time: fmtTimeOfDay(acct.updatedAt) }) : t("common.reading"), keys: t("settings.rows.balance.keys"),- ctl: html`<span class=${`balance${acct.lowBalance ? " low" : ""}`}>${usd(acct.balanceUsd)}</span>+ ctl: html`${acct.lowBalance && html`<span class="dot warn"></span>`}<span class="balance">${usd(acct.balanceUsd)}</span><button type="button" class="icon-btn" title=${t("common.refresh")} aria-label=${t("settings.rows.balance.refresh")} onClick=${refreshBalance}><${Icon} name="refresh" size="sm" /></button><a class="btn" href=${MF_TOPUP} target="_blank" rel="noopener noreferrer">${t("settings.rows.balance.topUp")}</a>` },- managed && acct && mf.connected && { tab: "modelflare", id: "low-balance", name: t("settings.rows.lowBalance.name"), sub: t("settings.rows.lowBalance.sub"), keys: t("settings.rows.lowBalance.keys"),+ managed && acct && mf.connected && { tab: "modelflare", group: "account", id: "low-balance", name: t("settings.rows.lowBalance.name"), sub: t("settings.rows.lowBalance.sub"), keys: t("settings.rows.lowBalance.keys"),ctl: html`<${Seg} label=${t("settings.rows.lowBalance.name")} value=${acct.alerts.lowBalanceUsd} onChange=${(v) => putAlerts({ lowBalanceUsd: v })}options=${alertLines.some(([v]) => v === acct.alerts.lowBalanceUsd) ? alertLines : [...alertLines, [acct.alerts.lowBalanceUsd, usd(acct.alerts.lowBalanceUsd)]]} />` },- managed && acct && mf.connected && acct.alerts.lowBalanceUsd > 0 && { tab: "modelflare", id: "low-balance-push", name: t("settings.rows.lowBalancePush.name"), sub: t("settings.rows.lowBalancePush.sub"), keys: t("settings.rows.lowBalancePush.keys"),+ managed && acct && mf.connected && acct.alerts.lowBalanceUsd > 0 && { tab: "modelflare", group: "account", id: "low-balance-push", name: t("settings.rows.lowBalancePush.name"), sub: t("settings.rows.lowBalancePush.sub"), keys: t("settings.rows.lowBalancePush.keys"),ctl: html`<${Switch} label=${t("settings.rows.lowBalancePush.name")} value=${acct.alerts.push} onChange=${(v) => putAlerts({ lowBalancePush: v })} />` },- signedIn && { tab: "modelflare", id: "usage", name: t("settings.rows.usage.name"), sub: t("settings.rows.usage.sub"), keys: t("settings.rows.usage.keys"),+ signedIn && { tab: "modelflare", group: "account", id: "usage", name: t("settings.rows.usage.name"), sub: t("settings.rows.usage.sub"), keys: t("settings.rows.usage.keys"),ctl: html`<button type="button" class="text" onClick=${() => setSheet("usage")}>${t("common.view")}</button>` },- signedIn && { tab: "modelflare", id: "notifications", name: t("settings.rows.notifications.name"), sub: unread ? t("settings.rows.notifications.unread", { count: unread }) : t("settings.rows.notifications.sub"), keys: t("settings.rows.notifications.keys"),+ signedIn && { tab: "modelflare", group: "account", id: "notifications", name: t("settings.rows.notifications.name"), sub: unread ? t("settings.rows.notifications.unread", { count: unread }) : t("settings.rows.notifications.sub"), keys: t("settings.rows.notifications.keys"),ctl: html`<button type="button" class="text" onClick=${() => setSheet("notifications")}>${t("common.view")}</button>` },- signedIn && invite && { tab: "modelflare", id: "invite", name: t("settings.rows.invite.name"), sub: t("settings.rows.invite.sub"), keys: t("settings.rows.invite.keys"),+ signedIn && invite && { tab: "modelflare", group: "account", id: "invite", name: t("settings.rows.invite.name"), sub: t("settings.rows.invite.sub"), keys: t("settings.rows.invite.keys"),ctl: html`<span class="val">${invite.code}</span><${CopyButton} text=${invite.url} label=${t("settings.rows.invite.copy")} />` },- showsStrategy(acct) && { tab: "modelflare", id: "key-quality", name: t("settings.rows.keyQuality.name"), sub: t("settings.rows.keyQuality.sub"), keys: t("settings.rows.keyQuality.keys"),- ctl: html`<${Seg} label=${t("settings.rows.keyQuality.name")} value=${acct.keyQuality.strategy} onChange=${putKeyQuality} options=${strategyOptions()} />` },- managed && mf.connected && { tab: "modelflare", id: "reasoning-effort", name: t("models.effort.name"), sub: t("settings.rows.effort.sub"), keys: t("settings.rows.effort.keys"),- ctl: html`<${Seg} label=${t("models.effort.name")} value=${effort} onChange=${(v) => setEffort(v).then((ok) => ok && saved())} options=${effortOptions()} />` },- managed && { tab: "modelflare", id: "line", name: t("settings.rows.line.name"), sub: t("settings.rows.line.sub"), keys: t("settings.rows.line.keys"),- ctl: html`<${DomainConnection} value=${mf.line} onChange=${setLine} />` },- { tab: "modelflare", id: "default-model", name: t("settings.rows.defaultModel.name"), sub: t("settings.rows.defaultModel.sub"), keys: t("settings.rows.defaultModel.keys"),+ { tab: "modelflare", group: "account", id: "console", name: t("settings.rows.console.name"), sub: t("settings.rows.console.sub"), keys: t("settings.rows.console.keys"),+ ctl: html`<a class="text" href=${MF_CONSOLE} target="_blank" rel="noopener noreferrer">${t("common.openExternal")}</a>` },+ { tab: "modelflare", group: "models", id: "default-model", name: t("settings.rows.defaultModel.name"), sub: t("settings.rows.defaultModel.sub"), keys: t("settings.rows.defaultModel.keys"),ctl: html`<${PickModel} value=${s.defaultModel} models=${models} modelsError=${modelsError} reloadModels=${reloadModels} resetLabel=${t("settings.rows.defaultModel.auto")}onChange=${(m) => put({ defaultModel: m }, { defaultModel: m })} />` },- managed && mf.connected && { tab: "modelflare", id: "image-model", name: t("settings.rows.imageModel.name"), sub: t("settings.rows.imageModel.sub"), keys: t("settings.rows.imageModel.keys"),+ managed && mf.connected && { tab: "modelflare", group: "models", id: "image-model", name: t("settings.rows.imageModel.name"), sub: t("settings.rows.imageModel.sub"), keys: t("settings.rows.imageModel.keys"),ctl: html`<${PickModel} value=${s.imageModel} models=${media ? media.image : null} modelsError=${media && media.error} reloadModels=${loadMedia}resetLabel=${media && media.recommended.image ? t("settings.rows.autoModel", { model: shortModel(media.recommended.image) }) : t("common.auto")} label=${t("settings.rows.imageModel.name")}onChange=${(m) => put({ imageModel: m }, { imageModel: m })} />` },- managed && mf.connected && { tab: "modelflare", id: "video-model", name: t("settings.rows.videoModel.name"), sub: t("settings.rows.videoModel.sub"), keys: t("settings.rows.videoModel.keys"),+ managed && mf.connected && { tab: "modelflare", group: "models", id: "video-model", name: t("settings.rows.videoModel.name"), sub: t("settings.rows.videoModel.sub"), keys: t("settings.rows.videoModel.keys"),ctl: html`<${PickModel} value=${s.videoModel} models=${media ? media.video : null} modelsError=${media && media.error} reloadModels=${loadMedia}resetLabel=${media && media.recommended.video ? t("settings.rows.autoModel", { model: shortModel(media.recommended.video) }) : t("common.auto")} label=${t("settings.rows.videoModel.name")}onChange=${(m) => put({ videoModel: m }, { videoModel: m })} />` },- { tab: "modelflare", id: "models", name: t("settings.rows.models.name"), sub: modelsError ? t("settings.rows.models.error", { error: modelsError }) : t("settings.rows.models.sub"), keys: t("settings.rows.models.keys"),+ { tab: "modelflare", group: "models", id: "models", name: t("settings.rows.models.name"), sub: modelsError ? t("settings.rows.models.error", { error: modelsError }) : t("settings.rows.models.sub"), keys: t("settings.rows.models.keys"),ctl: html`<span class="val num">${models ? t("settings.rows.models.count", { count: models.length }) : "…"}</span><button type="button" class="text" onClick=${() => reloadModels().then(() => saved())}>${t("common.refresh")}</button>` },- { tab: "modelflare", id: "console", name: t("settings.rows.console.name"), sub: t("settings.rows.console.sub"), keys: t("settings.rows.console.keys"),- ctl: html`<a class="text" href=${MF_CONSOLE} target="_blank" rel="noopener noreferrer">${t("common.openExternal")}</a>` },+ managed && mf.connected && { tab: "modelflare", group: "models", id: "reasoning-effort", name: t("models.effort.name"), sub: t("settings.rows.effort.sub"), keys: t("settings.rows.effort.keys"),+ ctl: html`<${Seg} label=${t("models.effort.name")} value=${effort} onChange=${(v) => setEffort(v).then((ok) => ok && saved())} options=${effortOptions()} />` },+ showsStrategy(acct) && { tab: "modelflare", group: "models", id: "key-quality", name: t("settings.rows.keyQuality.name"), sub: t("settings.rows.keyQuality.sub"), keys: t("settings.rows.keyQuality.keys"),+ ctl: html`<${Seg} label=${t("settings.rows.keyQuality.name")} value=${acct.keyQuality.strategy} onChange=${putKeyQuality} options=${strategyOptions()} />` },+ managed && { tab: "modelflare", group: "line", id: "line", name: t("settings.rows.line.name"), sub: t("settings.rows.line.sub"), keys: t("settings.rows.line.keys"),+ ctl: html`<${DomainConnection} value=${mf.line} onChange=${setLine} />` },{ tab: "computer", id: "cu-status", name: t("settings.rows.cuStatus.name"), sub: cu ? cu.reason : t("common.reading"), keys: t("settings.rows.cuStatus.keys"),- ctl: html`<span class=${`dot ${cu ? (cu.available ? "ok" : "err") : ""}`}></span>` },+ ctl: cu && html`<span class=${`badge ${cu.available ? "ok" : "err"}`}>${t(cu.available ? "settings.rows.cuStatus.ready" : "settings.rows.cuStatus.notReady")}</span>` },cu && cu.notice && { tab: "computer", id: "cu-notice", name: t("settings.rows.cuNotice.name"), sub: cu.notice, title: cu.notice, keys: t("settings.rows.cuNotice.keys"), ctl: null },{ tab: "computer", id: "cu-per-bot", name: t("settings.rows.cuPerBot.name"), sub: t("settings.rows.cuPerBot.sub"), keys: t("settings.rows.cuPerBot.keys"),ctl: bots && bots[0] && html`<button type="button" class="text" onClick=${() => onOpenBotSettings(bots[0].id, "computer")}>${t("settings.rows.cuPerBot.open")}</button>` },@@ -401,7 +427,7 @@ export function SettingsScreen({ tab, query: q, onQuery: setQ, onTab, focusRow,{ tab: "privacy", id: "key-storage", name: t("settings.rows.keyStorage.name"), sub: t("settings.rows.keyStorage.sub"), ctl: null, keys: t("settings.rows.keyStorage.keys") },{ tab: "privacy", id: "account-storage", name: t("settings.rows.accountStorage.name"), sub: t("settings.rows.accountStorage.sub"), ctl: null, keys: t("settings.rows.accountStorage.keys") },{ tab: "privacy", id: "token", name: t("settings.rows.token.name"), sub: s.listen.tokenRequired ? t("settings.rows.token.required") : t("settings.rows.token.local"), keys: t("settings.rows.token.keys"),- ctl: html`<span class=${`dot ${s.listen.tokenRequired ? "ok" : ""}`}></span>` },+ ctl: html`<span class=${`badge ${s.listen.tokenRequired ? "ok" : "off"}`}>${t(s.listen.tokenRequired ? "common.on" : "common.off")}</span>` },{ tab: "privacy", id: "sandbox", name: t("settings.rows.sandbox.name"), sub: t("settings.rows.sandbox.sub"), ctl: null, keys: t("settings.rows.sandbox.keys") },{ tab: "privacy", id: "screens", name: t("settings.rows.screens.name"), sub: t("settings.rows.screens.sub"), ctl: null, keys: t("settings.rows.screens.keys") },@@ -444,8 +470,11 @@ export function SettingsScreen({ tab, query: q, onQuery: setQ, onTab, focusRow,}, [s, mf, mode, p, models, modelsError, cu, status, update, bots, acct, invite, unread, g, media, lang, langPref, conn.accounts, conn.channelAccounts, effort]);const needle = q.trim().toLowerCase();- const shown = needle ? rows.filter((r) => `${r.name} ${r.sub || ""} ${r.keys || ""}`.toLowerCase().includes(needle)) : rows.filter((r) => r.tab === tab);- const parts = needle ? TABS.map(([id, label]) => [tabLabel(label), shown.filter((r) => r.tab === id)]).filter(([, l]) => l.length) : [["", shown]];+ const shown = needle ? rows.filter((r) => !r.custom && `${r.name} ${r.sub || ""} ${r.keys || ""}`.toLowerCase().includes(needle)) : rows.filter((r) => r.tab === tab && !r.searchOnly);+ // 搜索时按分页分段,平时按 group 分段+ const parts = needle ? TABS.map(([id, label]) => ({ label: tabLabel(label), rows: shown.filter((r) => r.tab === id) })).filter((x) => x.rows.length) : groupRows(shown);+ const acctRow = rows.find((r) => r.id === "account");+ const balRow = rows.find((r) => r.id === "balance");const title = needle ? t("settings.searchResults") : tabLabel((TABS.find(([id]) => id === tab) || TABS[0])[1]);return html`<section class="settings view" data-screen="settings" key=${needle ? "search" : tab}>@@ -454,9 +483,17 @@ export function SettingsScreen({ tab, query: q, onQuery: setQ, onTab, focusRow,${!s && html`<div class="list"><div class="row"><${Skeleton} w="40%" /></div><div class="row"><${Skeleton} w="55%" /></div></div>`}${s && !shown.length && html`<p class="set-none">${t("settings.noMatch")}</p>`}${s && !needle && tab === "general" && html`<${PwshHint} />`}- ${s && !needle && tab === "appearance" && html`<${AppearancePreview} />`}- ${s && !needle && tab === "troubleshoot" ? html`<${TroubleshootPane} bots=${bots} desktop=${desktop} />` : parts.map(([label, list]) => html`${label && html`<div class="set-part">${label}</div>`}- <div class="list">${list.map((r) => html`<${Row} key=${r.id} id=${r.id} name=${r.name} sub=${r.sub} title=${r.title || r.sub} flash=${flash === r.id}>${r.ctl}<//>`)}</div>`)}+ ${s && !needle && tab === "appearance" && html`<div class="set-part">${t("settings.groups.theme")}</div>+ <${ThemeCards} value=${mode} flash=${flash === "theme"} onChange=${(m) => { setThemeMode(m); saved(); }} />`}+ ${s && !needle && tab === "modelflare" && acctRow && html`<div class="list acct-card">+ <${Row} id=${acctRow.id} name=${acctRow.name} sub=${acctRow.sub} title=${acctRow.sub} flash=${flash === acctRow.id}>${acctRow.ctl}<//>+ ${balRow && html`<div class=${`acct-bal${flash === balRow.id ? " flash" : ""}`} id="set-balance">+ <${Balance} account=${acct} note=${html`<span>${balRow.sub}</span><${IconButton} icon="refresh" size="xs" iconSize="xs" label=${t("settings.rows.balance.refresh")} onClick=${refreshBalance} />`} />+ <a class=${`btn${acct.lowBalance ? " primary" : ""}`} href=${MF_TOPUP} target="_blank" rel="noopener noreferrer">${t("settings.rows.balance.topUp")}</a>+ </div>`}+ </div>`}+ ${s && !needle && tab === "troubleshoot" ? html`<${TroubleshootPane} bots=${bots} desktop=${desktop} />` : parts.map(({ label, note, rows: list }) => html`${label && html`<div class="set-part">${label}</div>`}${note && html`<p class="set-note">${note}</p>`}+ <div class="list">${list.map((r) => r.custom || html`<${Row} key=${r.id} id=${r.id} name=${r.name} sub=${r.sub} title=${r.title || r.sub} flash=${flash === r.id || conn.fresh === r.id}>${r.ctl}<//>`)}</div>`)}</div>${notices && html`<${NoticesSheet} onClose=${() => setNotices(false)} />`}<${ConnectionSheets} conn=${conn} bots=${bots} />diff --git a/ui/screens/sidebar.js b/ui/screens/sidebar.jsindex 89fc6cd..dd71940 100644--- a/ui/screens/sidebar.js+++ b/ui/screens/sidebar.js@@ -1,6 +1,7 @@// 侧栏 280(参考 Grok Bot,宽度可以拖右边的分隔条调整):顶部只有新建按钮,常驻搜索框,// 机器人行(头像 + 名称 + 时间 + 一行预览;悬停出现"更多",和右键是同一份菜单),左下角账户(点头像看余额,点齿轮打开设置)。-// 新建在主区的新建页(screens/new-bot.js);新建页打开时列表顶部有一行占位的"新机器人"。+// 新建在主区的新建页(screens/new-bot.js);新建页打开时,机器人列表末尾(建好后它就在这)有一行占位,跟着显示头像和名字。+// 机器人和群聊的增删:新行淡入并定位到它(新机器人的头像打个招呼),删掉的行淡出(design/motion.js 的 useListPresence)。// 群聊排在机器人后面(screens/group.js);有两个以上机器人时,新建按钮是一个菜单(机器人 / 群聊)。// 有事在等你时,机器人列表上方多一行「需要你 N」(没事时没有这一行);机器人行的第二行换成最早那件事。import { useEffect, useRef, useState } from "preact/hooks";@@ -9,6 +10,9 @@ import { BotAvatar } from "../components/avatar.js";import { GuidePill } from "../components/guide.js";import { api } from "../lib/api.js";import { confirmSheet, failed, toast, useStore } from "../lib/store.js";+import { deleteBot } from "../lib/bots.js";+import { useListPresence } from "../design/motion.js";+import { newBotDraft } from "./new-bot.js";import { prefs, setPrefs } from "../lib/prefs.js";import { fmtAgo } from "../lib/format.js";import { MF_TOPUP, usd } from "../lib/links.js";@@ -17,6 +21,16 @@ import { NeedsRow } from "./needs-you.js";import { catalogFold, catalogSeen, latestOf, setCatalogFold, tr } from "../lib/catalog.js";import { GroupAvatars } from "./group.js";+/** 余额:一个数字 + 说明。低于提醒线时数字不变色(红字像欠费),只多一行小字 */+export function Balance({ account, note }) {+ return html`<div class="bal">+ <div class="bal-label">${t("sidebar.balance")}</div>+ <div class="bal-amount">${usd(account.balanceUsd)}</div>+ ${account.lowBalance && html`<div class="bal-note"><span class="dot warn"></span>${t("sidebar.belowLine", { amount: usd(account.alerts?.lowBalanceUsd) })}</div>`}+ ${note && html`<div class="bal-note">${note}</div>`}+ </div>`;+}+/*** 左下角账户:头像字母 + 名称(登录后是 Modelflare 账户名),旁边是设置齿轮。* 余额不常驻:用户反馈一直看到它,会觉得一直在花钱。点头像才弹出来;余额低于提醒线时另有 LowBalance 提示。@@ -34,23 +48,23 @@ export function AccountButton({ username, account, settingsOn, onSettings, onMod<span class="who">${me}</span></button><${IconButton} icon="gear" iconSize="md" label=${t("sidebar.settingsTitle")} on=${settingsOn} onClick=${onSettings} />- ${open && bal && html`<${Popover} anchor=${ref.current} prefer="up" width=${240} label=${t("sidebar.account")} onClose=${() => setOpen(false)}>+ ${open && bal && html`<${Popover} anchor=${ref.current} prefer="up" width=${260} label=${t("sidebar.account")} onClose=${() => setOpen(false)}><div class="account-pop"><div class="account-pop-name">${me}</div><div class="account-pop-bal">- <div><div class="account-pop-label">${t("sidebar.balance")}</div><div class=${`balance${account.lowBalance ? " low" : ""}`}>${bal}</div></div>- <a class="btn sm" href=${MF_TOPUP} target="_blank" rel="noopener noreferrer">${t("sidebar.topUp")}</a>+ <${Balance} account=${account} />+ <a class=${`btn sm${account.lowBalance ? " primary" : ""}`} href=${MF_TOPUP} target="_blank" rel="noopener noreferrer">${t("sidebar.topUp")}</a></div></div><div class="foot"><button type="button" onClick=${() => { setOpen(false); onModelflare(); }}>${t("sidebar.accountDetails")}</button></div><//>`}`;}-/** 余额低于提醒线时,侧栏底部常驻一条提示 */+/** 余额低于提醒线时,侧栏底部一行安静的提示:不写金额,金额在账户浮层里 */function LowBalance({ account }) {if (!account || !account.lowBalance) return null;- return html`<a class="low-balance" href=${MF_TOPUP} target="_blank" rel="noopener noreferrer" role="status">- ${t("sidebar.lowBalance", { amount: usd(account.balanceUsd) })}+ return html`<a class="side-note" href=${MF_TOPUP} target="_blank" rel="noopener noreferrer" role="status">+ <span class="side-note-main"><span class="dot warn"></span><span class="v">${t("sidebar.lowBalance")}</span><span class="go">${t("sidebar.topUp")}</span></span></a>`;}@@ -58,13 +72,14 @@ function LowBalance({ account }) {function UpdateNotice({ update }) {const { updateDismissed } = useStore(prefs);if (!update || !update.available || updateDismissed === update.latest) return null;- return html`<div class="side-update" role="status">- <a href=${update.downloadUrl} target="_blank" rel="noopener noreferrer">${t("sidebar.update", { version: update.latest })}</a>+ const text = t("sidebar.update", { version: update.latest });+ return html`<div class="side-note" role="status">+ <a class="side-note-main" href=${update.downloadUrl} target="_blank" rel="noopener noreferrer" title=${text}><span class="dot new"></span><span class="v">${text}</span></a><${IconButton} icon="close" size="xs" iconSize="xs" label=${t("sidebar.updateDismiss")} onClick=${() => setPrefs({ updateDismissed: update.latest })} /></div>`;}-export function Sidebar({ bots, botsError, reloadBots, selectedId, view, previews, pending, working, needs = { n: 0, bots: {} }, username, account, update, onNew, onSelect, onNeeds, onDeleted, onOpenSettings, onBotSettings, onGuide, groups = [], groupId, onNewGroup, onSelectGroup, onEditGroup, onDeletedGroup, catalog = [], catalogId, onDiscover, onOpenCatalog }) {+export function Sidebar({ bots, botsError, reloadBots, selectedId, view, previews, pending, working, needs = { n: 0, bots: {} }, username, account, update, onNew, onSelect, onNeeds, onDeleted, onOpenSettings, onBotSettings, onGuide, groups = [], groupsLoaded = true, groupId, onNewGroup, onSelectGroup, onEditGroup, onDeletedGroup, catalog = [], catalogId, onDiscover, onOpenCatalog }) {const lang = useLang();const seen = useStore(catalogSeen);const fold = useStore(catalogFold);@@ -96,16 +111,7 @@ export function Sidebar({ bots, botsError, reloadBots, selectedId, view, preview}};const del = async (bot) => {- // 目录 Bot 移除时问一句是否保留数据:保留的话再次使用能接上- const fromCatalog = bot.origin === "catalog";- if (!(await confirmSheet(fromCatalog ? { title: t("botapp.remove.title", { name: bot.name }), body: t("botapp.remove.body"), confirmLabel: t("botapp.remove.confirm"), danger: true } : { title: t("sidebar.delete.title", { name: bot.name }), body: t("sidebar.delete.body"), confirmLabel: t("sidebar.delete.confirm"), danger: true }))) return;- const keep = fromCatalog && (await confirmSheet({ title: t("botapp.remove.keepTitle"), body: t("botapp.remove.keepBody"), confirmLabel: t("botapp.remove.keep"), cancelLabel: t("botapp.remove.discard") }));- try {- await api(`/bots/${bot.id}${keep ? "?keepData=1" : ""}`, { method: "DELETE" });- onDeleted(bot.id);- } catch (e) {- failed(e);- }+ if (await deleteBot(bot)) onDeleted(bot.id);};const delGroup = async (g) => {@@ -119,9 +125,17 @@ export function Sidebar({ bots, botsError, reloadBots, selectedId, view, preview};const groupBots = (g) => g.members.map((id) => (bots || []).find((b) => b.id === id)).filter(Boolean);+ const draft = useStore(newBotDraft);+ const botRows = useListPresence(bots);+ const groupRows = useListPresence(groupsLoaded ? groups : null);const needle = q.trim().toLowerCase();- const list = (bots || []).filter((b) => !needle || b.name.toLowerCase().includes(needle) || (previews[b.id]?.text || "").toLowerCase().includes(needle));- const shownGroups = groups.filter((g) => !needle || g.name.toLowerCase().includes(needle));+ const list = botRows.filter(({ item: b }) => !needle || b.name.toLowerCase().includes(needle) || (previews[b.id]?.text || "").toLowerCase().includes(needle));+ const shownGroups = groupRows.filter(({ item: g }) => !needle || g.name.toLowerCase().includes(needle));+ // 新行可能在列表下面看不见的地方:滚过去+ const entered = [...botRows, ...groupRows].filter((r) => r.state === "enter").map((r) => r.item.id).join();+ useEffect(() => {+ if (entered || view === "new") root.current?.querySelector(".thread-item.anim-fade-in, .thread.draft")?.scrollIntoView({ block: "nearest" });+ }, [entered, view === "new"]);const canGroup = !!bots && bots.length >= 2;return html`<aside class="side" ref=${root} aria-label=${t("sidebar.bots")}>@@ -142,13 +156,11 @@ export function Sidebar({ bots, botsError, reloadBots, selectedId, view, preview<span class="body"><span class="line"><span class="title">${t("botapp.sidebar.discover")}</span>${hasNew && html`<span class="thread-new-dot" title=${t("botapp.sidebar.new")}></span>`}</span></span></button><div class="side-group"><span class="text t-label">${t("botapp.sidebar.mine")}</span></div>`}- ${view === "new" && html`<div class="thread sel" aria-current="page"><${BotAvatar} neutral size=${38} />- <span class="body"><span class="line"><span class="title">${t("sidebar.newBot")}</span></span><span class="line"><span class="snip">${t("sidebar.creating")}</span></span></span></div>`}${botsError && html`<div class="side-empty"><span>${t("sidebar.loadFailed")}</span><button type="button" class="btn" onClick=${reloadBots}>${t("common.retry")}</button></div>`}${!bots && !botsError && [0, 1, 2].map((k) => html`<div class="thread" key=${k}><${Skeleton} w="38px" circle /><span class="thread-skel"><${Skeleton} w="50%" /><${Skeleton} w="75%" /></span></div>`)}${bots && !bots.length && view !== "new" && html`<div class="side-empty"><span>${t("sidebar.empty")}</span><button type="button" class="btn primary" onClick=${onNew}>${t("sidebar.create")}</button></div>`}${bots && needle && !list.length && !shownGroups.length && html`<p class="hint">${t("sidebar.noMatch")}</p>`}- ${list.map((b) => {+ ${list.map(({ item: b, state: rowState }) => {const sel = (view === "chat" || view === "bot-settings" || view === "app") && b.id === selectedId;// 等你的:「需要你」里这个机器人的件数和最早那件(没有时退回待审批数)const nd = needs.bots[b.id];@@ -160,10 +172,11 @@ export function Sidebar({ bots, botsError, reloadBots, selectedId, view, previewonKeyDown=${(e) => { if (e.isComposing || e.keyCode === 229) return; if (e.key === "Enter" && !e.isComposing && e.keyCode !== 229) e.target.blur(); if (e.key === "Escape") { e.stopPropagation(); setRenaming(""); } }} /></div>`;const pv = previews[b.id];const menuOpen = !!(ctx && ctx.el && ctx.bot.id === b.id);- return html`<div class="thread-item" key=${b.id}>- <button type="button" class=${`thread bot-hover${sel ? " sel" : ""}`} aria-current=${sel ? "page" : undefined}+ const rowFx = rowState === "enter" ? " anim-fade-in" : rowState === "leave" ? " anim-fade-out" : "";+ return html`<div class=${`thread-item${rowFx}`} key=${b.id} inert=${rowState === "leave" || undefined}>+ <button type="button" class=${`thread bot-hover${sel && rowState !== "leave" ? " sel" : ""}`} aria-current=${sel ? "page" : undefined}onClick=${() => onSelect(b.id)} onContextMenu=${(e) => { e.preventDefault(); setCtx({ bot: b, x: e.clientX, y: e.clientY }); }}>- <span class="avatar-wrap"><${BotAvatar} bot=${b} size=${38} state=${n > 0 ? "waiting" : working[b.id] ? "working" : "idle"} />${working[b.id] && html`<span class="working-dot" title=${t("sidebar.working")}></span>`}</span>+ <span class="avatar-wrap"><${BotAvatar} bot=${b} size=${38} greet=${rowState === "enter"} state=${n > 0 ? "waiting" : working[b.id] ? "working" : "idle"} />${working[b.id] && html`<span class="working-dot" title=${t("sidebar.working")}></span>`}</span><span class="body"><span class="line"><span class="title">${b.name}</span>${pv?.at && html`<span class="when num">${fmtAgo(pv.at)}</span>`}</span><span class="line"><span class="snip">${nd?.line || (working[b.id] ? t("sidebar.workingNow") : pv?.text || t("sidebar.noChats"))}</span>${n > 0 && html`<span class="badge count" title=${t("sidebar.needs", { count: n })}>${n}</span>`}</span>@@ -173,12 +186,15 @@ export function Sidebar({ bots, botsError, reloadBots, selectedId, view, previewonClick=${(e) => { const el = e.currentTarget; setCtx((c) => (c && c.el && c.bot.id === b.id ? null : { bot: b, el })); }} /></div>`;})}- ${bots && shownGroups.map((g) => {- const sel = view === "group" && g.id === groupId;+ ${view === "new" && html`<div class="thread sel draft anim-fade-in" aria-current="page"><${BotAvatar} char=${draft?.avatar} neutral size=${38} />+ <span class="body"><span class="line"><span class="title">${draft?.name || t("sidebar.newBot")}</span></span><span class="line"><span class="snip">${t("sidebar.creating")}</span></span></span></div>`}+ ${bots && shownGroups.map(({ item: g, state: rowState }) => {+ const sel = view === "group" && g.id === groupId && rowState !== "leave";const who = g.last?.botId ? (bots.find((b) => b.id === g.last.botId)?.name ?? "") : "";const line = g.running && g.current ? t("group.working", { name: bots.find((b) => b.id === g.current)?.name ?? "" }) : g.last ? `${who ? `${who}: ` : ""}${g.last.text.replace(/^⚠️\s*/, "").replace(/\s+/g, " ")}` : t("group.noMessages");const menuOpen = !!(groupCtx && groupCtx.el && groupCtx.group.id === g.id);- return html`<div class="thread-item" key=${"g" + g.id}>+ const rowFx = rowState === "enter" ? " anim-fade-in" : rowState === "leave" ? " anim-fade-out" : "";+ return html`<div class=${`thread-item${rowFx}`} key=${"g" + g.id} inert=${rowState === "leave" || undefined}><button type="button" class=${`thread${sel ? " sel" : ""}`} aria-current=${sel ? "page" : undefined}onClick=${() => onSelectGroup(g.id)} onContextMenu=${(e) => { e.preventDefault(); setGroupCtx({ group: g, x: e.clientX, y: e.clientY }); }}><span class="avatar-wrap"><${GroupAvatars} bots=${groupBots(g)} size=${38} pile />${g.running && html`<span class="working-dot" title=${t("sidebar.working")}></span>`}</span>