feat(assistant): unify confirmed memory capture

This commit is contained in:
2026-07-20 02:30:06 +08:00
parent 46a6156d8c
commit 0a5fc9a463
32 changed files with 949 additions and 242 deletions
+6 -2
View File
@@ -14,9 +14,13 @@ test('问师傅为文字、媒体和数据工具请求携带同一短期会话
});
test('问师傅支持显式新对话、版本回写和受控原文件或视频卡', async () => {
const page = await read('../src/pages/user/sop/index.vue');
const [page, header] = await Promise.all([
read('../src/pages/user/sop/index.vue'),
read('../src/components/chat/AskSourceHeader.vue')
]);
assert.match(page, /@click="startNewConversation">新对话/);
assert.match(page, /@new-conversation="startNewConversation"/);
assert.match(header, /@click="emit\('newConversation'\)">新对话/);
assert.match(page, /const contextVersion = ref\(0\)/);
assert.match(page, /applyConversationState\(nextResult\)/);
assert.match(page, /authenticatedFileUrl\(resource\.contentUrl\)/);
+22 -1
View File
@@ -88,6 +88,27 @@ test('员工端首页、问师傅和训练页接入当前共享基座', async ()
assert.match(practiceSource, /scenario-card employee-card/);
});
test('工作助手与查全网使用一致的来源切换头部', async () => {
const [sopSource, webAiSource, headerSource] = await Promise.all([
pageSource('../src/pages/user/sop/index.vue'),
pageSource('../src/pages/user/web-ai/index.vue'),
pageSource('../src/components/chat/AskSourceHeader.vue')
]);
for (const page of [sopSource, webAiSource]) {
assert.match(page, /import AskSourceHeader from ['"]@\/components\/chat\/AskSourceHeader\.vue['"]/);
assert.match(page, /<AskSourceHeader\b/);
assert.doesNotMatch(page, /(?:^|\n)\s*\.chat-source-switch(?:\s+\.source-option(?:\.active)?)?\s*\{/);
}
assert.match(headerSource, /<text class="head-title">问 · 数字师傅<\/text>/);
assert.match(headerSource, /\.source-option\s*\{[^}]*height:\s*44px/);
assert.match(headerSource, /\.new-chat-button\s*\{[^}]*min-height:\s*44px/);
assert.match(headerSource, /@click="emit\('newConversation'\)"/);
assert.doesNotMatch(sopSource, /(?:^|\n)\s*\.source-switch\s*\{/);
assert.doesNotMatch(sopSource, /(?:^|\n)\s*\.source-option(?:\.active)?\s*\{/);
});
test('登录后按组织身份切换主管首页', async () => {
const source = await pageSource('../src/services/position.ts');
@@ -198,7 +219,7 @@ test('员工问师傅页显示当前岗位而不是固定生活顾问', async ()
assert.match(source, /getSelectedPosition/);
assert.match(source, /const positionLabel = ref\(getSelectedPosition\(\)\)/);
assert.match(source, /\{\{ positionLabel \}\} · 住宅项目/);
assert.match(source, /:context="`\$\{positionLabel\} · 住宅项目`"/);
assert.doesNotMatch(source, /sop-context">管家(生活顾问) · 住宅项目/);
});
+27 -5
View File
@@ -26,15 +26,17 @@ test('个人助理客户端使用确认式记忆接口且确认请求携带稳
assert.match(service, /\$\{candidateBase\}\/\$\{candidateId\}\/confirm/);
assert.match(service, /\$\{candidateBase\}\/\$\{candidateId\}\/dismiss/);
assert.match(service, /\/api\/aihr\/service-memories/);
assert.match(service, /\/api\/aihr\/personal-assistant\/assistant-captures/);
assert.match(card, /const idempotencyKey = ref\(createMemoryIdempotencyKey\(props\.candidate\.id\)\)/);
assert.match(card, /if \(submitting\.value \|\| completed\.value\) return/);
assert.match(card, /expectedVersion: props\.candidate\.version/);
assert.match(card, /enableReminder: reminderEnabled\.value/);
assert.match(card, /saveScope: saveScope \|\| undefined/);
assert.match(card, /\.\.\.value/);
for (const field of ['projectCode', 'title', 'detail', 'status']) assert.match(card, new RegExp(field));
});
test('候选确认卡区分待补充和草稿,提醒默认关闭并保留三个动作', async () => {
test('统一采集确认卡把缺失字段作为可选提示并让用户选择保存范围', async () => {
const card = await read('../src/components/chat/MemoryCandidateCard.vue');
assert.match(card, /candidate\.status === 'NEEDS_INPUT'/);
@@ -43,6 +45,10 @@ test('候选确认卡区分待补充和草稿,提醒默认关闭并保留三
assert.match(card, />修改</);
assert.match(card, />暂不保存</);
assert.match(card, />确认保存</);
assert.match(card, />仅自己保存</);
assert.match(card, />提交公司处理</);
assert.match(card, /可继续补充:/);
assert.doesNotMatch(card, />还需要补充信息</);
assert.match(card, /v-if="reminderEnabled"/);
for (const field of ['buildingName', 'unitName', 'roomNo']) {
assert.match(card, new RegExp(`value: draft\\.value\\.${field}`));
@@ -65,15 +71,31 @@ test('工作助手页面展示任务过期后不会消费待执行查询或数
assert.match(page, /ensureEmployeePosition\('\/pages\/user\/sop\/index'\)\) \|\| !isCurrentQuestion\(\)/);
});
test('我的资料与记忆展示个人记录和公司流转状态', async () => {
const [page, service] = await Promise.all([
read('../src/pages/user/assistant/memories.vue'),
read('../src/services/personal-assistant.ts')
]);
assert.match(page, /getAssistantCaptures/);
assert.match(page, />我的记录</);
assert.match(page, /仅自己保存的内容不会提交公司/);
assert.match(page, /deliveryLabel\(item\.deliveryStatus\)/);
assert.match(service, /assistant-captures\?limit=50/);
});
test('工作助手保留原问答链并只提供显式查全网入口', async () => {
const [page, knowledge] = await Promise.all([
const [page, header, knowledge] = await Promise.all([
read('../src/pages/user/sop/index.vue'),
read('../src/components/chat/AskSourceHeader.vue'),
read('../src/services/knowledge.ts')
]);
assert.match(page, />工作助手<\/button>/);
assert.match(page, />查全网<\/button>/);
assert.match(header, />\s*工作助手\s*<\/button>/);
assert.match(header, />\s*查全网\s*<\/button>/);
assert.match(page, /@select-web="openWebAi"/);
assert.match(page, /<MemoryCandidateCard/);
assert.match(page, /msg\.result\.answer \|\| msg\.result\.snippets\?\.length \|\| !msg\.result\.memoryCandidate/);
assert.match(page, /msg\.result\.noEvidence/);
assert.match(page, /@click="openWebAi">去查全网/);
assert.match(knowledge, /url: '\/api\/knowledge\/query'/);
@@ -137,7 +159,7 @@ test('我的页面和路由提供首版资料与记忆入口', async () => {
assert.match(profile, /openMemories/);
assert.match(memories, /待确认/);
assert.match(memories, /项目跟进/);
assert.match(memories, /首版仅展示/);
assert.match(memories, /仅展示当前账号有权限查看的项目服务记录/);
assert.match(memories, /项目:\{\{ item\.projectCode \}\}/);
assert.match(pages, /pages\/user\/assistant\/memories/);
});