feat: add semantic WeChat session actions

This commit is contained in:
john
2026-07-23 17:18:25 +08:00
parent baa383548c
commit 7e20ec14f1
8 changed files with 235 additions and 2 deletions
+19
View File
@@ -425,6 +425,25 @@ test('classifyWithRules bypasses llm router when user selected summarize skill',
assert.equal(llmCalls.length, 0);
});
test('chat intent router classifies ambiguous WeChat session actions semantically', async () => {
const router = createChatIntentRouter({
enabled: true,
timeoutMs: 500,
llmProviderService: {
async createChatCompletion({ messages }) {
assert.match(messages[0].content, /微信聊天会话动作分类器/);
return {
ok: true,
reply: '{"action":"reset","confidence":0.91,"reason":"用户要求换一种对话上下文"}',
};
},
},
});
const result = await router.classifySessionAction({ text: '我们换个思路聊' });
assert.equal(result.action, 'reset');
assert.equal(result.confidence, 0.91);
});
test('classifyWithRules bypasses llm router for explicit web skill prompt', async () => {
const llmCalls = [];
const router = createChatIntentRouter({