Chatbot brought fully current + knowledge guard
Audit against the live site: removed stale text (featured links and visit packs marked "coming", Pipeline "coming soon", the superseded sponsor-hold rule, a non-existent home-page calculator, "earned credits spend on banner and text only", "Coaching pane"); added live featured and visit-pack rules with prices and limits, the video cap and rewards, the sign-in bonus and claim ladders, report-an-ad, the public missed-payout posts, the walk-up gain notice, the four-minute overview video, the promo Videos and Toolkit tabs; new canned answers for featured links, visit packs and "what is this". KNOWLEDGE_DATE constant + qa/chatbot-sync.mjs (run in public/all QA) fails when a release note is newer than the chatbot's knowledge. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
// Chatbot knowledge guard (Marty, 2026-09-16: "ensure the chatbot is completely current, and keep it that way").
|
||||
// Compares chatbot.js KNOWLEDGE_DATE with the newest public release note. If a note is newer, the
|
||||
// chatbot was not brought up to date with that change: fix chatbot.js (canned + prompt), bump the date.
|
||||
// node qa/chatbot-sync.mjs (checks the live site's /api/releases)
|
||||
// LOCAL=http://127.0.0.1:8796 node qa/chatbot-sync.mjs
|
||||
import fs from 'node:fs';
|
||||
const B = process.env.LOCAL || 'https://instantadpay.com';
|
||||
const src = fs.readFileSync(new URL('../chatbot.js', import.meta.url), 'utf8');
|
||||
const m = /KNOWLEDGE_DATE = '(\d{4}-\d{2}-\d{2})'/.exec(src);
|
||||
if (!m) { console.log('[bug] chatbot.js has no KNOWLEDGE_DATE constant'); process.exit(1); }
|
||||
const known = m[1];
|
||||
let notes = [];
|
||||
try { const r = await (await fetch(B + '/api/releases')).json(); notes = r.notes || []; } catch (e) { console.log('[warn] could not read ' + B + '/api/releases: ' + e.message); process.exit(0); }
|
||||
const newer = notes.filter(n => (n.date || '') > known);
|
||||
if (newer.length) {
|
||||
console.log('[bug] chatbot knowledge date ' + known + ' is older than ' + newer.length + ' release note(s):');
|
||||
for (const n of newer) console.log(' ' + n.date + ' ' + n.title);
|
||||
console.log(' -> update chatbot.js (canned answers + systemPrompt) for each, then bump KNOWLEDGE_DATE.');
|
||||
process.exit(1);
|
||||
}
|
||||
console.log('chatbot knowledge date ' + known + ' covers all ' + notes.length + ' release notes (newest ' + (notes[0] ? notes[0].date : 'none') + ')');
|
||||
@@ -27,12 +27,14 @@ stop_local() { # $1 = port
|
||||
|
||||
if [ "$MODE" = "public" ]; then
|
||||
node qa/walk.mjs public || status=1
|
||||
node qa/chatbot-sync.mjs || status=1
|
||||
elif [ "$MODE" = "member" ]; then
|
||||
start_local 8796 && { LOCAL=http://127.0.0.1:8796 node qa/walk.mjs member || status=1; }; stop_local 8796
|
||||
elif [ "$MODE" = "earn" ]; then
|
||||
start_local 8797 && { LOCAL=http://127.0.0.1:8797 node qa/earn.mjs || status=1; }; stop_local 8797
|
||||
else
|
||||
node qa/walk.mjs public || status=1
|
||||
node qa/chatbot-sync.mjs || status=1
|
||||
start_local 8796 && { LOCAL=http://127.0.0.1:8796 node qa/walk.mjs member || status=1; }; stop_local 8796
|
||||
start_local 8797 && { LOCAL=http://127.0.0.1:8797 node qa/earn.mjs || status=1; }; stop_local 8797
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user