Site assistant (Marty 2026-11-15): chat widget in the Downline Banners ultraviolet + lime look on every page, CANNED + FACTS from this repo's code and the BannerLine contract ($5 spot, 300 views in 30 days, 30% sponsor + 55% as $0.275 x 10 + 10% company + 5% momentum fund, fund buys after 4 h quiet, max 12 a day, 7-day gift cooldown, look-around tour, buy for someone, refuel spots, 468x60 up to 150 KB), retrieval over the shared network knowledge base on the hub (netkb.js, home entries boosted, another site named = its answer), reasoning off, account problems hand off to network support. Chat admin routes use a constant-time ADMIN_TOKEN check. chatbot.test 165, smoke 131/131
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+8
-1
@@ -115,7 +115,7 @@ async function main() {
|
||||
fs.writeFileSync(path.join(DATA, 'house.json'), JSON.stringify([{ key: 'one', title: 'Test house 1', img: '/art/house-iap.svg', link: 'https://example.com/' }, { key: 'two', title: 'Test house 2', img: '/art/house-linkspin.svg', link: 'https://example.net/' }]));
|
||||
const env = Object.assign({}, process.env, { PORT: String(APP_PORT), DATA_DIR: DATA, CHAIN_ID: '31337', RPC_URLS: 'http://127.0.0.1:' + RPC_PORT, CONTRACT_ADDRESS: CA,
|
||||
DEPLOY_BLOCK: String(deployBlock), POLL_MS: '1000', ADMIN_TOKEN: ADMIN, KEEPER_ENABLED: '1', KEEPER_KEY: W[7].signer.privateKey, KEEPER_STALL_HOURS: '0.01', KEEPER_EVERY_MIN: '0.25', NODE_ENV: 'development',
|
||||
HUB_URL: 'http://127.0.0.1:' + HUB_PORT, HUB_SECRET, HUB_SITE: 'bannerline', HUB_ENABLED: '0', HUB_DOWN_MS: '400', NETWORK_LOOKUP_URL: 'http://127.0.0.1:' + IAP_PORT + '/api/network/member',
|
||||
HUB_URL: 'http://127.0.0.1:' + HUB_PORT, HUB_SECRET, HUB_SITE: 'bannerline', HUB_ENABLED: '0', NETKB: '0', HUB_DOWN_MS: '400', NETWORK_LOOKUP_URL: 'http://127.0.0.1:' + IAP_PORT + '/api/network/member',
|
||||
TG_TOKEN: 'standin-token', TG_CHAT: '-100123', TG_PAY_TOPIC: '632242', TG_API: 'http://127.0.0.1:' + TG_PORT });
|
||||
startStandIns();
|
||||
const hid = n => 'h_' + String(n).padStart(16, '0');
|
||||
@@ -132,6 +132,13 @@ async function main() {
|
||||
ok(st.totals && st.totals.members === 6, 'index parsed 6 MemberJoined (payer of a buyFor is not a member)', st.totals);
|
||||
ok(BigInt(st.totals.paidInWei) === 7n * q, 'paid in = 7 x quote (refunds excluded)', st.totals.paidInWei);
|
||||
const cfg = await u.json('/api/config'); ok(cfg.ready && cfg.sel.buy === '0xf088d547', '/api/config has contract + selectors');
|
||||
// the site assistant (2026-11-15): widget on every page, canned answers without AI, account problems hand off, admin KB behind the token
|
||||
{ const home = await (await u.req('/')).text();
|
||||
ok(/<script src="\/assets\/chat\.js\?v=\d+" defer><\/script>/.test(home) && (await u.req('/assets/chat.js')).status === 200 && (await u.req('/assets/chat.css')).status === 200, 'chat widget on the page, its script and styles served');
|
||||
const ch = async m => (await u.req('/api/chat', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ message: m }) })).json();
|
||||
const a1 = await ch('Where does the $5 go?'); ok(a1.canned && /\$0\.275/.test(a1.reply) && /\$1\.50/.test(a1.reply), 'chat: canned split answer', a1);
|
||||
const a2 = await ch('my spot did not show up'); ok(a2.handoff === true && /^https:\/\/instantadpay\.com\/support\?from=bannerline/.test(a2.support || ''), 'chat: account problem hands off to network support', a2);
|
||||
ok((await u.req('/api/admin/kb')).status === 401, 'admin KB needs the token'); }
|
||||
const qq = await u.json('/api/quote'); ok(qq.wei === q.toString() && qq.source === 'contract.quoteWei', '/api/quote reads quoteWei()', qq);
|
||||
for (const p of ['/', '/board', '/join', '/my', '/how', '/assets/site.css', '/art/house-line.svg']) { const r = await u.req(p); ok(r.status === 200, 'GET ' + p + ' 200'); }
|
||||
const r404 = await u.req('/nope'); ok(r404.status === 404, 'unknown path 404');
|
||||
|
||||
Reference in New Issue
Block a user