Эх сурвалжийг харах

能力接口声明 bot-only-v1,供移动端切换为只用 Bot 模式

/api/app/capabilities 的 features 新增 bot-only-v1。yaoyao-mobile
据此隐藏聊天模式、不再请求已删除的普通聊天与实时接口;旧服务端不带该标记,行为不变。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HvtCVdUBNe9gYx2xaCShcc
Claude 4 цаг өмнө
parent
commit
af413b65c3

+ 1 - 0
docs/embedded-hermes-migration.md

@@ -241,6 +241,7 @@ yaovi-agent 在内置 Hermes 的同时还做了很多产品层改动,本方案
 - 管理员与子账号使用同一套界面:「聊天」里的 Bot 单聊和群聊,以及工具菜单(电脑接管、自动化等)。设置中心默认打开「我的资料」,不再有模式切换。
 - 旧链接 `/`、`/chat/*`、`/history/*`、`/files`、`/artifacts` 及未知路径都跳转到 `/conversations`。
 - 未读只统计 Bot 会话;为兼容旧客户端,接口仍返回 `chat` 字段,固定为 0。
+- `/api/app/capabilities` 的 `features` 新增 `bot-only-v1`。yaoyao-mobile 看到该标记后强制进入 Bot 模式、隐藏「聊天模式」切换、不再加载普通聊天运行时,并拒绝打开普通聊天与旧群组通知;未带该标记的旧服务端保持原有行为。
 - 账号扫码登录保留;设备配对(`/api/app/pairings*`、`/api/app/paired-devices*`、`/api/pair/v1/*`)删除。远程 Bot 已在此前停用,因此已有节点记录只能查看和删除,新的子节点配对会因对端没有配对接口而失败。
 - 不再写入 `chat-cache.sqlite3` 和 `realtime-receipts.sqlite3`;已有文件保留在数据目录中,可手动删除。`HERMES_YAOYAO_CHAT_CACHE_MODE` 已停用。
 

+ 2 - 0
src/server/workspaceRoutes.ts

@@ -91,6 +91,8 @@ export function workspaceRouter(
         ...(auth.require(ctx).role === 'admin' ? ['voice', 'context'] : []),
         ...(auth.require(ctx).role === 'admin' ? ['nodes', 'pairedNodes', 'editableNodeAddress'] : []),
         'events', 'workspace-stream-v1',
+        // Ordinary chat, history and the realtime relay were removed; mobile hides its chat mode.
+        'bot-only-v1',
         ...(store.messagePatchesEnabled ? [WORKSPACE_PATCH_CAPABILITY] : []),
       ],
     }

+ 1 - 0
tests/server/workspaceRoutes.test.ts

@@ -195,6 +195,7 @@ describe('application workspace HTTP contract', () => {
     store.saveMessage('first', { id: randomUUID(), conversationId: conversation.id, seq: 0, role: 'assistant', content: '保留历史回复', reasoning: '', status: 'complete', tools: [], attachments: [], createdAt: Date.now() })
     const capabilities = (await req('get', '/api/app/capabilities').expect(200)).body.features
     expect(capabilities).not.toContain('remoteAgentReferences')
+    expect(capabilities).toContain('bot-only-v1')
     expect((await req('get', `/api/app/nodes/${randomUUID()}/agents`).expect(410)).body.code).toBe('remote_agent_removed')
     expect((await req('post', '/api/app/agents/remote').send({ nodeId: randomUUID(), agentId: randomUUID() }).expect(410)).body.code).toBe('remote_agent_removed')
     expect((await req('get', `/api/app/conversations/${conversation.id}`).expect(200)).body.messages.some((message: { content: string }) => message.content === '保留历史回复')).toBe(true)