fix(personal): align assistant citations and UI state

This commit is contained in:
2026-07-12 12:07:28 +08:00
parent c8ef15ee9e
commit 36b7bf28bf
14 changed files with 181 additions and 61 deletions
+17 -1
View File
@@ -5,12 +5,18 @@ import test from 'node:test';
const source = (path) => readFile(new URL(path, import.meta.url), 'utf8');
test('个人助理 API 固定使用登录态且不接收 owner 参数', async () => {
const client = await source('../src/services/personal-assistant.ts');
const [client, api] = await Promise.all([
source('../src/services/personal-assistant.ts'),
source('../src/services/api.ts')
]);
assert.match(client, /apiRequest/);
assert.match(client, /\/api\/aihr\/personal-assistant\/ask/);
assert.match(client, /\/api\/aihr\/personal-assistant\/items\/file/);
assert.match(client, /uni\.uploadFile/);
assert.doesNotMatch(client, /ownerUserId|tenantId/);
assert.doesNotMatch(client, /clearAuthOnUnauthorized:\s*false/);
assert.doesNotMatch(api, /statusCode === 401 \|\| statusCode === 403/);
assert.match(api, /statusCode === 401 \|\| code === 401/);
});
test('问答首页默认只查询个人资料并展示真实引用域', async () => {
@@ -21,6 +27,11 @@ test('问答首页默认只查询个人资料并展示真实引用域', async ()
assert.match(page, /企业 SOP/);
assert.match(page, /外部网页/);
assert.match(page, /citation\.domain/);
assert.match(page, /citation\.itemId/);
assert.match(page, /citation\.sourceType/);
assert.doesNotMatch(page, /loadPersonalItem/);
assert.match(page, /answer\.value = undefined/);
assert.match(page, /requestGeneration/);
assert.match(page, /收藏资料/);
assert.doesNotMatch(page, /ownerUserId|tenantId/);
});
@@ -34,6 +45,10 @@ test('资料库和收藏页覆盖分页筛选以及三种真实收藏方式', as
assert.match(library, /sourceType/);
assert.match(library, /status/);
assert.match(library, /loadPersonalItems/);
assert.match(library, /requestGeneration/);
assert.match(library, /pageSnapshot/);
assert.match(library, /mergePersonalRows/);
assert.match(library, /pageNum\.value = Math\.max/);
assert.match(capture, /TEXT/);
assert.match(capture, /FILE/);
assert.match(capture, /URL/);
@@ -62,6 +77,7 @@ test('会话页覆盖列表、详情和删除且不伪造会话', async () => {
assert.match(page, /loadPersonalSession/);
assert.match(page, /deletePersonalSession/);
assert.match(page, /暂无历史会话/);
assert.match(page, /chat\.role\.toLowerCase\(\) === 'user'/);
});
test('个人助理路由已注册且企业 SOP 问答保留独立入口', async () => {