28 lines
1.3 KiB
JavaScript
28 lines
1.3 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import { readFile } from 'node:fs/promises';
|
|
import test from 'node:test';
|
|
|
|
const read = (path) => readFile(new URL(path, import.meta.url), 'utf8');
|
|
|
|
test('问师傅为文字、媒体和数据工具请求携带同一短期会话版本', async () => {
|
|
const service = await read('../src/services/knowledge.ts');
|
|
|
|
assert.match(service, /conversationId:\s*conversation\?\.conversationId/);
|
|
assert.match(service, /contextVersion:\s*conversation\?\.contextVersion/);
|
|
assert.match(service, /conversationId:\s*conversation\.conversationId/);
|
|
assert.match(service, /resources:\s*response\.resources \|\| \[\]/);
|
|
});
|
|
|
|
test('问师傅支持显式新对话、版本回写和受控原文件或视频卡', async () => {
|
|
const page = await read('../src/pages/user/sop/index.vue');
|
|
|
|
assert.match(page, /@click="startNewConversation">新对话/);
|
|
assert.match(page, /const contextVersion = ref\(0\)/);
|
|
assert.match(page, /applyConversationState\(nextResult\)/);
|
|
assert.match(page, /authenticatedFileUrl\(resource\.contentUrl\)/);
|
|
assert.match(page, /releaseAuthenticatedFileUrl\(resource\.localUrl\)/);
|
|
assert.match(page, /resource\.type === 'VIDEO' && resource\.localUrl/);
|
|
assert.match(page, /msg\.result\.rewrittenQuery !== msg\.result\.queryText/);
|
|
assert.match(page, /已结合本次对话理解/);
|
|
});
|