diff --git a/docs/dsh-providers-verification-2026-10-28.md b/docs/dsh-providers-verification-2026-10-28.md new file mode 100644 index 0000000..1bd18c6 --- /dev/null +++ b/docs/dsh-providers-verification-2026-10-28.md @@ -0,0 +1,41 @@ +# DSH 供应商与会话管理验证 + +日期:2026-10-28(Asia/Shanghai)。设计与新增助手设置/返回按钮要求已获用户批准。功能代码提交 `301cdf6`,原生适配及供应商提交为 `e4faee3`、`5a5e166`、`506e6fb`;本机部署构建为 `528120a`,其后仅调整测试夹具和文档。 + +## 已交付 + +- 助手设置统一提供供应商列表/编辑卡、默认模型、运行与权限。DeepSeek、OpenAI、Anthropic 和自定义兼容 API 可分别配置密钥、端点、协议与模型;支持编辑、停用、删除和显式获取目录。 +- 复用固定 DSH `0.2.1-rc.2` 的 `dsh-llm-pi-ai`,支持 Chat Completions、Responses、Messages;既有 DeepSeek Messages 保留官方直连适配行为。 +- 输入区和 `/model` 共用分组目录;会话选择、每轮配置快照、原生协议路由、切换下一轮生效。历史回答显示实际供应商/模型,失效选择要求重选。 +- 会话行 `⋯` 菜单、归档/恢复、回收站、永久删除确认。删除不退调用额度,不删除独立审计,不破坏已延续会话。删除中的会话停止订阅,跨标签页模型选择也能更新。 +- 110×44px 的“← 返回工具”按钮在桌面和窄屏均可见;工具子页返回入口使用一致的强调样式。 +- 旧模型配置迁到独立加密供应商记录,原全局配置不再重复保存密钥;维护版本防止删除重建后的过期写入,供应商数量限制同样覆盖旧接口同步。 +- 凭据只写、不回显;诊断输入/历史/快照按全部已知供应商密钥脱敏,包含凭据的选定修复源码在受理前拒绝。目录获取拒绝重定向并及时关闭响应体。 +- 备份恢复支持供应商、默认选择、会话事件和请求记录的实际加密 AAD,保留模型选择与独立调用记账。 + +## 检查结果 + +| 检查 | 结果 | 本机收据 | +|---|---|---| +| `npm ci` | 正常退出,安全审计 0 项漏洞 | `npm-ci.log` | +| 官方运行包/供应商/协议专项 | 28/28,通过,无跳过 | Task1 报告与 providers-runtime 测试 | +| 最终新增功能集中专项 | 24/24,通过,无跳过 | `focused-final.log` | +| 原备份回归 | 16/16,通过,无跳过 | `backup-regression.log` | +| 助手设置刷新版本及旧流程选择框单独复验 | 2/2,通过 | `settings-scope-recheck.log` | +| 业务回归 | 377 项:376 通过,1 项旧选择框界面测试偶发失败;该项单独复跑通过 | `business-confirmed.log` | + +收据均位于 Git 忽略的 `output/verification/dsh-providers/`。新增集中专项涵盖供应商设置/默认模型/会话选模型、草稿确认、保存锁定、首次订阅、回收站/删除/额度/延续链、跨用户/API版本/凭据隔离及备份恢复。 + +完整助手检查曾因供应商编辑和会话切换的时序问题失败,均补充或加强等待/字段锁定/版本守卫后复验通过。最终供应商保存锁定单项的测试夹具补上等待登录页就绪,避免首屏尚未渲染时跳过登录;此项单独复验通过。完整助手检查中的旧官方 ZCode 实机测试因其旧运行包未安装而跳过,当前官方 DSH 三种协议均实际通过本地假接口测试。 + +业务回归唯一波动项为 `scope-search-ui.test.cjs` 的 `unselected search text never becomes a rule value and removed rows dispose their comboboxes`:旧 Tom Select 弹层短暂拦截“添加流程节点”点击。未修改该业务模块或强制点击;在独立环境重新执行原测试通过。不能把此次业务结果描述为一次全绿运行;上轮全量的基线/环境限制仍见[工作区验证](dsh-workspace-verification-2026-10-27.md)。本轮未重跑旧全量。 + +## 审查与实际页面 + +供应商内核及整支功能分别经独立审查。已修复凭据版本 ABA、旧同步绕过数量上限、目录响应体未关闭、32K 修复预算退化、未保存供应商草稿丢失、首次选模型不订阅、保存中字段编辑丢失、重复取消确认及会话异步切换问题,最终无未解决 P1/P2。 + +已备份并更新原本机测试副本,逐文件校验 681 个跟踪文件,保留原 `config.json`、账号、业务状态及助手开关。旧配置已在实际页面显示为 DeepSeek 供应商,原模型及“密钥已保存”状态保留;没有输入、回显或测试真实密钥。供应商添加表单、模型控件、会话管理和返回按钮在实际页面可见,返回按钮实际测量 110×44px。 + +实际页面证据保存在本机忽略目录的 `live-settings.png` 和 `live-assistant.png`,含真实工作台信息,不提交 Git。用户指南截图使用虚构测试供应商/模型。测试临时凭据目录独立于运行服务,通过 junction 引用既有 DSH 运行包。 + +模型调用验证使用本地假模型接口,不代表真实供应商/公司业务端到端验收;本轮没有自动启用对话、改变业务发送规则、执行真实恢复操作或更新正式服务机。 diff --git a/docs/images/user-guide/assistant-mobile.png b/docs/images/user-guide/assistant-mobile.png index 38846de..fdad431 100644 Binary files a/docs/images/user-guide/assistant-mobile.png and b/docs/images/user-guide/assistant-mobile.png differ diff --git a/docs/images/user-guide/assistant-settings.png b/docs/images/user-guide/assistant-settings.png index eb9f7ed..50eda5d 100644 Binary files a/docs/images/user-guide/assistant-settings.png and b/docs/images/user-guide/assistant-settings.png differ diff --git a/docs/images/user-guide/assistant.png b/docs/images/user-guide/assistant.png index 1920838..5f8e7cd 100644 Binary files a/docs/images/user-guide/assistant.png and b/docs/images/user-guide/assistant.png differ diff --git a/docs/superpowers/plans/2026-10-28-dsh-providers-conversations.md b/docs/superpowers/plans/2026-10-28-dsh-providers-conversations.md index ec51764..573e4e3 100644 --- a/docs/superpowers/plans/2026-10-28-dsh-providers-conversations.md +++ b/docs/superpowers/plans/2026-10-28-dsh-providers-conversations.md @@ -26,7 +26,7 @@ **Interfaces:** `new ProviderRegistry(store)`, methods `list()`, `save(input)`, `chooseDefault(input)`, `remove(id,input)`, `resolve(selection?)`, `syncLegacy(settings)`, `discover(id,{version,signal}={})`. `list()` returns `{version,providers,defaultSelection,catalog}`; providers expose `{id,version,name,preset,protocol,apiBase,enabled,hasApiKey,models:[{id,name,contextWindow?,maxTokens?}]}`. `resolve` returns private config `{providerId,providerName,providerVersion,preset,protocol,apiBase,apiKey,model,modelName,contextWindow,maxTokens}`. Fixed legacy provider ID is `deepseek`. -- [ ] Write tests proving migration from old DeepSeek configuration retains secret/default; multiple providers stay isolated/encrypted; address/protocol changes require a new key; version conflicts/disabled/missing models fail. Run red before implementation. +- [x] Write tests proving migration from old DeepSeek configuration retains secret/default; multiple providers stay isolated/encrypted; address/protocol changes require a new key; version conflicts/disabled/missing models fail. Run red before implementation. ```js const registry=new ProviderRegistry(store); @@ -35,9 +35,9 @@ assert.equal(registry.resolve().model,'legacy'); assert.equal(registry.list().providers[0].apiKey,undefined); ``` -- [ ] Implement encrypted provider records and independently versioned defaults. Limit30 providers/100 models, validate names/IDs/endpoints/model bounds; save id absent creates stable ID, new version0 and stale existing version reject. Blank key preserves existing, no source/environment key discovery. -- [ ] Reuse installed native catalogue metadata where possible; expose DeepSeek/OpenAI/Anthropic/custom presets. Explicit `discover` lists models with a bounded GET using only that provider's key; unsupported response fails without saving. -- [ ] Adapt `profilePatch`/environment to selected route: legacy DeepSeek remains byte-compatible in behavior, other protocols mount only native `dsh-llm-pi-ai` with the chosen explicit route/model and fixed private credential reference. No tools or additional ambient credentials. Honor timeout/output limits. +- [x] Implement encrypted provider records and independently versioned defaults. Limit30 providers/100 models, validate names/IDs/endpoints/model bounds; save id absent creates stable ID, new version0 and stale existing version reject. Blank key preserves existing, no source/environment key discovery. +- [x] Reuse installed native catalogue metadata where possible; expose DeepSeek/OpenAI/Anthropic/custom presets. Explicit `discover` lists models with a bounded GET using only that provider's key; unsupported response fails without saving. +- [x] Adapt `profilePatch`/environment to selected route: legacy DeepSeek remains byte-compatible in behavior, other protocols mount only native `dsh-llm-pi-ai` with the chosen explicit route/model and fixed private credential reference. No tools or additional ambient credentials. Honor timeout/output limits. ```js const profile=profilePatch({...config,protocol:'openai-responses',providerId:'fixture'}); @@ -45,7 +45,7 @@ assert.match(profile,/dsh-llm-pi-ai/); assert.doesNotMatch(profile,/TEST_KEY/); ``` -- [ ] Test actual fixed official DSH against local fake Messages, Chat Completions and Responses endpoints, ensure zero native tools, correct route, credentials and cancellation cleanup. Run previous dsh-runtime/dsh-events tests and commit owned paths only. +- [x] Test actual fixed official DSH against local fake Messages, Chat Completions and Responses endpoints, ensure zero native tools, correct route, credentials and cancellation cleanup. Run previous dsh-runtime/dsh-events tests and commit owned paths only. ## Task 2: Conversation lifecycle, settings and routing integration @@ -53,7 +53,7 @@ assert.doesNotMatch(profile,/TEST_KEY/); **Interfaces:** store.providers is ProviderRegistry; service.resolve per-conversation or default selection before each new run; existing settings API fields remain compatible. Conversation model choice endpoint updates encrypted metadata with version. Store methods `trash`, `restoreDeleted`, `purge` implement deleted scope; `usage()` reads durable ledger. -- [ ] Write failing tests for deleted filtering/restoration, owner/version/busy guards, quota retained after purge, continued child usable after parent deletion, and model selection pinned to a running turn. +- [x] Write failing tests for deleted filtering/restoration, owner/version/busy guards, quota retained after purge, continued child usable after parent deletion, and model selection pinned to a running turn. ```js const c=store.create('owner'),turn=store.beginTurn(c.id,'owner','fixture'); @@ -64,20 +64,24 @@ store.purge(c.id,'owner',{version:deleted.version,confirm:'delete'}); assert.equal(store.usage().calls,used); ``` -- [ ] Add deleted_at and call ledger migration. Exclude deleted rows from active/search/send/actions; explicit deleted scope permits read-only history. Inherit three successful turns into child metadata before parent removal. Delete events/requests/turns atomically on purge, independent audit/ledger survive. -- [ ] Integrate registry in store; legacy saveFields sync only explicit legacy writes. New runtime settings omit old endpoint/key fields. Enabling checks selected usable config, preserving old tests and stored settings. -- [ ] Integrate provider/default/model endpoints with same-origin, admin/owner, secure credential transport, version and running provider-delete guards. Pin private provider config to each run and persist only public per-turn selection metadata. -- [ ] Update SSE/polling with conversation_removed terminal control, no authentication logout on deleted conversation. Update backup payload AAD mapping for config/providers/defaults/events/requests and verify backup/restore roundtrip. -- [ ] Run focused HTTP, lifecycle, old assistant and backup tests. Commit only task paths after Task1 implementation agent has committed. +- [x] Add deleted_at and call ledger migration. Exclude deleted rows from active/search/send/actions; explicit deleted scope permits read-only history. Inherit three successful turns into child metadata before parent removal. Delete events/requests/turns atomically on purge, independent audit/ledger survive. +- [x] Integrate registry in store; legacy saveFields sync only explicit legacy writes. New runtime settings omit old endpoint/key fields. Enabling checks selected usable config, preserving old tests and stored settings. +- [x] Integrate provider/default/model endpoints with same-origin, admin/owner, secure credential transport, version and running provider-delete guards. Pin private provider config to each run and persist only public per-turn selection metadata. +- [x] Update SSE/polling with conversation_removed terminal control, no authentication logout on deleted conversation. Update backup payload AAD mapping for config/providers/defaults/events/requests and verify backup/restore roundtrip. +- [x] Run focused HTTP, lifecycle, old assistant and backup tests. Commit only task paths after Task1 implementation agent has committed. ## Task 3: Settings/model menu, row actions and return controls **Files:** Create `web/modules/assistant/providers.js`, `model-picker.js`; modify assistant `view.js`, `layout.js`, `workspace.css`, `commands.js`, `events-client.js`, `web/app.js`, assets/index, user guide; add browser tests `providers-ui.test.cjs`, `conversation-trash-ui.test.cjs`. -- [ ] Add failing UI tests: add/edit supplier via actual assistant-settings route; models fetched into draft then saved; default and composer selection consistent; trash/archive visible from row menus; recover/purge confirmation; return controls44px high and target tools on desktop/mobile. -- [ ] Build supplier rows/one expanded editor, protocol presets, write-only key input, editable model rows, explicit model discovery, default model chooser. Keep runtime/permissions in a separate existing settings form and honor dirty draft guards. -- [ ] Add grouped searchable picker and `/model`, showing unavailable selection honestly. Selecting updates conversation version; the next request uses it while a running turn retains the previous choice. No key reaches browser pickers. -- [ ] Add `⋯` row actions and deleted scope; owner-confirmation dialog for permanent deletion; stop and discard event subscriptions when current conversation is deleted elsewhere. Preserve existing draft/search/scroll and archive/continue behavior. -- [ ] Emphasize return button with text/arrow,44px height and110px minimum width, `#tools`; adapt tools subpage breadcrumb consistently and verify narrow screens. -- [ ] Run new+old UI, assistant suite and isolated fresh `npm test`; perform independent final review and fix important findings. Preserve known full-suite baseline limitations from prior verification, avoid unrelated fixes. -- [ ] Update guide/design/verification, commit and push dsh. Stop local test copy, verified backup, deploy tracked files, retain config/dependencies, restart healthy and open both settings/assistant for visual review; no actual credential setup or real model calls. +- [x] Add failing UI tests: add/edit supplier via actual assistant-settings route; models fetched into draft then saved; default and composer selection consistent; trash/archive visible from row menus; recover/purge confirmation; return controls44px high and target tools on desktop/mobile. +- [x] Build supplier rows/one expanded editor, protocol presets, write-only key input, editable model rows, explicit model discovery, default model chooser. Keep runtime/permissions in a separate existing settings form and honor dirty draft guards. +- [x] Add grouped searchable picker and `/model`, showing unavailable selection honestly. Selecting updates conversation version; the next request uses it while a running turn retains the previous choice. No key reaches browser pickers. +- [x] Add `⋯` row actions and deleted scope; owner-confirmation dialog for permanent deletion; stop and discard event subscriptions when current conversation is deleted elsewhere. Preserve existing draft/search/scroll and archive/continue behavior. +- [x] Emphasize return button with text/arrow,44px height and110px minimum width, `#tools`; adapt tools subpage breadcrumb consistently and verify narrow screens. +- [x] Run new+old UI, assistant suite and isolated fresh `npm test`; perform independent final review and fix important findings. Preserve known full-suite baseline limitations from prior verification, avoid unrelated fixes. +- [x] Update guide/design/verification, commit and push dsh. Stop local test copy, verified backup, deploy tracked files, retain config/dependencies, restart healthy and open both settings/assistant for visual review; no actual credential setup or real model calls. + +## Execution outcome + +功能已实施并更新本机测试副本;官方协议专项28/28、新增集中专项24/24、备份回归16/16通过,业务回归376/377且波动项单独复验通过。详细范围和限制见[验证记录](../../dsh-providers-verification-2026-10-28.md)。没有启用真实模型或修改业务发送规则。 diff --git a/docs/user-guide.md b/docs/user-guide.md index 24e6c78..02e9ff9 100644 --- a/docs/user-guide.md +++ b/docs/user-guide.md @@ -61,9 +61,11 @@ ![DSH 助手](images/user-guide/assistant.png) -助手采用 DSH 原生交互适配的三栏工作区:左侧搜索/切换个人会话,中间阅读回答和本轮过程,右侧查看概况、证据、操作及记录。输入区固定在中栏底部;手机通过“会话列表”和“上下文”按钮打开侧栏。归档保留历史,继续新对话带入最近三轮上下文。归档标题搜索覆盖最近 2000 个,超出时页面明确标注范围。 +助手采用 DSH 原生交互适配的三栏工作区:左侧搜索/切换个人会话,中间阅读回答和本轮过程,右侧查看概况、证据、操作及记录。输入区固定在中栏底部;手机通过“会话列表”和“上下文”按钮打开侧栏。顶部“← 返回工具”为醒目的 110×44px 按钮,在手机上也保留。 -可直接描述连接、扫描或归档异常,也可输入 `/` 打开固定命令菜单。`/help` 展示帮助,`/status` 只刷新本机授权概况;`/bpm`、`/storage`、`/archive` 选择可见目标后填入诊断草稿,发送才调用模型。概况刷新不会自动检查外部连接,未知命令不会作为提示词发送。未配置模型时仍可查看授权概况。 +每条会话右侧的 `⋯` 可归档、恢复或移至回收站;会话范围可切换活跃、已归档、回收站。回收站历史只读,支持恢复或经确认永久删除,没有自动清空。删除不会退回当日调用额度,独立操作审计及已延续到其他会话的上下文保留。回复/操作进行中需先停止回复或等待操作结束。继续新对话带入最近三轮上下文;父会话删除后子会话仍可继续。归档/回收站标题搜索覆盖最近 2000 个,超出时明确标注范围。 + +可直接描述连接、扫描或归档异常,也可输入 `/` 打开固定命令菜单。`/help` 展示帮助,`/status` 只刷新本机授权概况;`/bpm`、`/storage`、`/archive` 选择可见目标后填入诊断草稿,发送才调用模型。输入区模型控件与 `/model` 可按供应商选择管理员已启用的模型,下一轮生效;每轮回答旁显示实际使用的供应商/模型。移除或停用所选模型后须重新选择。概况刷新不会自动检查外部连接,未知命令不会作为提示词发送。未配置模型时仍可查看授权概况。 过程按真实阶段推送,断线后补读,必要时回退轮询;首版回答在完整校验后显示,不逐字输出,也不展示模型内部思考。概况是最近观测,证据页是该轮实际使用的快照,两者时间和范围可能不同。停止只针对模型回复,确认进程退出前显示“正在停止”;操作中断或结果不明显示“待核验”。 @@ -139,7 +141,11 @@ ![助手设置](images/user-guide/assistant-settings.png) -管理员管理 DSH 运行包、模型连接和允许的受控操作,可检查运行状态、启停助手并查看用量/操作记录。连接或密钥配置须在部署机本地或可信 HTTPS 环境维护;密钥由本地安全存储管理。助手默认不因设置页打开而运行,开启后也只具有明确允许的操作权限。没有真实模型服务配置时,助手页面不会提供可用对话。 +助手设置包含“模型供应商”“默认模型”“运行与权限”。管理员可添加 DeepSeek、OpenAI、Anthropic 或自定义兼容 API,独立维护地址、协议、密钥和模型列表,设置默认模型,编辑/停用/删除供应商。支持 OpenAI Chat Completions、OpenAI Responses、Anthropic Messages。模型列表每行可填 `模型 ID | 显示名 | 上下文窗口 | 最大输出`,后面三项可省略;获取目录只填入草稿,检查并保存后生效。旧单模型配置会迁成 DeepSeek 供应商,保留原地址、模型、密钥与助手开关。 + +已保存的密钥不读回输入框,留空保留;更换协议或地址需重填。供应商编辑有未保存确认,保存/获取目录期间锁定字段,避免迟到结果覆盖新输入。运行包、超时、调用上限和受控操作权限单独保存;其他成员可在自己的会话选择可用模型,不能维护供应商。 + +连接或密钥配置须在部署机本地或可信 HTTPS 环境维护;密钥由本地安全存储管理。添加供应商或打开设置页不会自动启用助手。调用使用当轮启动时的配置,不因后续切换改变正在回复的模型;目录获取也不等同真实模型调用验证。 ### 系统健康 diff --git a/tests/assistant/management-fixture.cjs b/tests/assistant/management-fixture.cjs index 0cf9b11..32e0845 100644 --- a/tests/assistant/management-fixture.cjs +++ b/tests/assistant/management-fixture.cjs @@ -7,7 +7,7 @@ async function managementFixture(t,{browser=false}={}){ const call=(route,body,cookie)=>fetch(base+'/api'+route,{method:body===undefined?'GET':'POST',headers:{...(body===undefined?{}:{Origin:base,'Content-Type':'application/json'}),...(cookie?{Cookie:cookie}:{})},body:body===undefined?undefined:JSON.stringify(body)}),login=async(username='admin')=>(await call('/login',{username,password:'Test-password-123'})).headers.get('set-cookie').split(';')[0]; let engine,page;if(browser){const {loadPlaywright,browserOptions}=require('../../src/platform/browser.cjs');engine=await loadPlaywright().chromium.launch(browserOptions());page=await engine.newPage({viewport:{width:1440,height:1000}});page.setDefaultTimeout(10000);} t.after(async()=>{await engine?.close();server.closeAssistantStreams?.();await assistant.stop();server.closeAllConnections();await new Promise(r=>server.close(r));store.close();await fs.rm(dir,{recursive:true,force:true});}); - async function open(route='#assistant',username='admin'){await page.goto(base+'/'+route);if(await page.getByLabel('账号',{exact:true}).count()){await page.getByLabel('账号',{exact:true}).fill(username);await page.getByLabel('密码',{exact:true}).fill('Test-password-123');await page.getByRole('button',{name:'登录',exact:true}).click();}} + async function open(route='#assistant',username='admin'){await page.goto(base+'/'+route);await page.waitForFunction(()=>!!document.querySelector('#username')||!!document.querySelector('#logout'));if(await page.getByLabel('账号',{exact:true}).count()){await page.getByLabel('账号',{exact:true}).fill(username);await page.getByLabel('密码',{exact:true}).fill('Test-password-123');await page.getByRole('button',{name:'登录',exact:true}).click();}} return {base,page,open,store,users,assistant,call,login,calls:()=>calls,lastConfig:()=>lastConfig}; } module.exports={managementFixture}; diff --git a/tests/assistant/providers-ui.test.cjs b/tests/assistant/providers-ui.test.cjs index 1d86844..9ff0718 100644 --- a/tests/assistant/providers-ui.test.cjs +++ b/tests/assistant/providers-ui.test.cjs @@ -2,7 +2,7 @@ const {test}=require('node:test'),assert=require('node:assert/strict');const {managementFixture}=require('./management-fixture.cjs'); test('assistant settings manage providers and default models without exposing a saved key',{timeout:120000},async t=>{ const {page,open,calls}=await managementFixture(t,{browser:true});await open('#assistant-settings');await page.getByRole('button',{name:'添加供应商',exact:true}).click();await page.getByLabel('供应商类型',{exact:true}).selectOption('openai');await page.getByLabel('供应商名称',{exact:true}).fill('测试供应商');await page.getByLabel('API 根地址',{exact:true}).fill('https://models.example/v1');await page.getByLabel('API 密钥',{exact:true}).fill('TEST_PROVIDER_UI_KEY');await page.getByLabel('模型列表',{exact:true}).fill('test-a|测试模型 A\ntest-b|测试模型 B');await page.getByRole('button',{name:'保存供应商',exact:true}).click();await page.getByText('测试供应商',{exact:true}).waitFor();assert.equal(calls(),0);assert.doesNotMatch(await page.locator('body').innerText(),/TEST_PROVIDER_UI_KEY/); - await page.getByLabel('默认模型',{exact:true}).selectOption({label:'测试供应商 / 测试模型 A'});await page.getByRole('button',{name:'保存默认模型',exact:true}).click();await page.getByText('默认模型已保存。',{exact:true}).waitFor();await page.getByLabel('启用 DSH 对话诊断',{exact:true}).check();await page.getByRole('button',{name:'保存助手设置',exact:true}).click();await require('node:fs/promises').mkdir('output/verification/dsh-providers',{recursive:true});await page.screenshot({path:'output/verification/dsh-providers/settings-desktop.png',fullPage:true});await page.goto(new URL('/#assistant',page.url()).href);await page.getByRole('button',{name:/选择模型/}).click();await page.getByRole('option',{name:'测试模型 B',exact:true}).click();await page.getByLabel('发送给 DSH',{exact:true}).fill('分析当前状态');await page.getByRole('button',{name:'发送',exact:true}).click();await page.getByText('使用模型 test-b',{exact:true}).waitFor();assert.equal(calls(),1);await page.screenshot({path:'output/verification/dsh-providers/assistant-model-selected.png',fullPage:true});await page.setViewportSize({width:390,height:844});await page.screenshot({path:'output/verification/dsh-providers/assistant-mobile.png',fullPage:true}); + await page.getByLabel('默认模型',{exact:true}).selectOption({label:'测试供应商 / 测试模型 A'});await page.getByRole('button',{name:'保存默认模型',exact:true}).click();await page.getByText('默认模型已保存。',{exact:true}).waitFor();await page.getByLabel('启用 DSH 对话诊断',{exact:true}).check();await page.getByRole('button',{name:'保存助手设置',exact:true}).click();await require('node:fs/promises').mkdir('output/verification/dsh-providers',{recursive:true});await page.evaluate(()=>scrollTo(0,0));await page.screenshot({path:'output/verification/dsh-providers/settings-desktop.png',fullPage:true});await page.goto(new URL('/#assistant',page.url()).href);await page.getByRole('button',{name:/选择模型/}).click();await page.getByRole('option',{name:'测试模型 B',exact:true}).click();await page.getByLabel('发送给 DSH',{exact:true}).fill('分析当前状态');await page.getByRole('button',{name:'发送',exact:true}).click();await page.getByText('使用模型 test-b',{exact:true}).waitFor();assert.equal(calls(),1);await page.screenshot({path:'output/verification/dsh-providers/assistant-model-selected.png',fullPage:true});await page.setViewportSize({width:390,height:844});await page.screenshot({path:'output/verification/dsh-providers/assistant-mobile.png',fullPage:true}); }); test('the tool return button is prominent on desktop and mobile and returns to the tools section',{timeout:90000},async t=>{ const {page,open}=await managementFixture(t,{browser:true});await open();for(const width of [1440,390]){await page.setViewportSize({width,height:900});const back=page.getByRole('link',{name:'返回工具',exact:true});await back.waitFor();const box=await back.boundingBox();assert.ok(box.height>=44);assert.ok(box.width>=100);assert.equal(await back.getAttribute('href'),'#tools');}await page.getByRole('link',{name:'返回工具',exact:true}).click();await page.getByRole('navigation',{name:'工具导航'}).waitFor();assert.equal(await page.locator('.assistant-workspace').count(),0);