feat(mindspace): enforce PostgreSQL user data delivery

This commit is contained in:
john
2026-07-13 15:29:29 +08:00
parent b33c943b69
commit a6620fb719
57 changed files with 2779 additions and 164 deletions
+30 -2
View File
@@ -67,6 +67,34 @@ test('classifyWithRules routes page data collection to page-data-collect', () =>
assert.equal(result.suggestedSkill, 'page-data-collect');
});
test('classifyWithRules routes ordinary household ledger language to page-data-collect', () => {
const text = '帮我做一个家庭记账页面,我每天可以记录日期、收入、支出、分类和备注,日期默认当天。再做一个管理页面,可以查看所有记录和收支汇总。';
const result = classifyWithRules({
text,
userMessage: {
role: 'user',
content: [{ type: 'text', text }],
metadata: { displayText: text },
},
});
assert.equal(result.route, CHAT_INTENT_ROUTE.AGENT);
assert.equal(result.suggestedSkill, 'page-data-collect');
});
test('classifyWithRules routes implicit sticky-note timeline apps to page-data-collect', () => {
const text = '帮我设计一个便签提醒,可以写便签提交,时间轴来显示';
const result = classifyWithRules({
text,
userMessage: {
role: 'user',
content: [{ type: 'text', text }],
metadata: { displayText: text },
},
});
assert.equal(result.route, CHAT_INTENT_ROUTE.AGENT);
assert.equal(result.suggestedSkill, 'page-data-collect');
});
test('coercePageDataSkill overrides static-page-publish when data intent is present', () => {
const text = '帮我在这个页面增加调查问卷,密码 888 查看提交记录';
const coerced = coercePageDataSkill(
@@ -579,9 +607,9 @@ test('createManagedChatIntentRouter hot-loads admin config and stays skill-only'
},
});
assert.equal(await router.isEnabled(), false);
assert.equal(await router.isEnabled(), true);
states.shift();
assert.equal(await router.isEnabled(), false);
assert.equal(await router.isEnabled(), true);
const result = await router.classify({
userMessage: {
role: 'user',