Site assistant: a question that names another network site skips this site's instant answers (a hand-off still wins), so 'how much is a Boost on ViralAdBlitz' asked on another site gets that site's answer from the shared knowledge base. chatbot.test covers it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-15 12:49:25 -06:00
parent d6e36a65bc
commit ae7077da57
3 changed files with 29 additions and 4 deletions
+4 -1
View File
@@ -59,7 +59,7 @@ ok(/NEVER promise or estimate income/.test(lastPrompt) && /SafePal or any other
reply = 'Fine.';
// 4. the network merge: home boosted, a named site boosted, labelled with the site and its link
const GENERAL = bot.CANNED.find(c => c.id !== 'support' && c.id !== 'refund' && (c.q || []).length).q[0].replace(/\?$/, '');
const GENERAL = bot.CANNED.find(c => !['support', 'refund', 'about'].includes(c.id) && (c.q || []).length).q[0].replace(/\?$/, '');
netkb._set({ version: 'v1', sites: { othersite: { name: 'Other Site', url: 'https://other.example', count: 1 }, [process.env.HUB_SITE || bot.SITE.hubSite]: { name: bot.SITE.name, url: bot.SITE.url } },
entries: [{ site: 'othersite', id: 'about', title: 'What is Other Site?', questions: ['What is Other Site?', GENERAL + ' on Other Site'], answer: 'Other Site is a test site with its own rules.', tags: ['test'] }] });
await kb.load(true);
@@ -67,6 +67,9 @@ await kb.load(true);
{ const hits = await kb.search(GENERAL + ' on Other Site', 8); const top = hits[0] && hits[0].entry; ok(top && top.site === 'othersite', 'a named site boosts its own entry (top ' + (top && top.id) + ')'); }
{ const block = kb.promptBlock(await kb.context('What is Other Site', 6)); ok(/about Other Site, another network site; send people to https:\/\/other\.example/.test(block), 'remote entry labelled with site and link'); }
{ const fp = await kb.fastPath('What is Other Site?'); ok(!fp || !String(fp.id).startsWith('othersite:'), 'other sites never take the fast path'); }
{ const r = await bot.answer(GENERAL + ' on Other Site'); ok(!r.canned, 'a question naming another site skips this site\'s instant answers (' + r.kb + ')'); }
{ const r = await bot.answer('I need a real person, my order on Other Site failed'); ok(r.handoff === true, 'a hand-off still wins when another site is named'); }
{ const r = await bot.answer(bot.CANNED.find(c => c.id === 'about').q[0]); ok(r.canned && r.kb === 'c-about', 'this site\'s own name keeps the instant answer'); }
{ const own = await kb.own(); ok(own.length === seeds.length && own.every(e => !e.site), 'publish set = this site\'s own entries only'); }
// 5. the scripted Q&A (home questions)