openvibers/openvibe.live Commits

Arena: the AI desk gets each story's plain account (what happened) with its facts (#149)

OP OpenVibers committed 28 days ago · cada911405 · 2 files, +4 −3

Changes

ddiff --git a/server/arena/drama.js b/server/arena/drama.js
iindex 6575ff32..f30928f2 100644
---- a/server/arena/drama.js
++++ b/server/arena/drama.js
@@@ -16,7 +16,8 @@
* quote_of_day (the best judged mic line). Beefs report themselves (beef.js → beefStory).
*
* A story is written at once from a template (grounded, already spicy) and rewritten by OpenVibe.AI's
-- * live.arena.drama in the desk's voice (headline, blurb, alert 1-5) when AI is on, at most AI_PER_HOUR an hour.
++ * live.arena.drama in the desk's voice (headline, blurb, alert 1-5) when AI is on, at most AI_PER_HOUR an hour; the
++ * template's plain account (`what`) goes with the facts so the model knows what the event means.
* Each story moves two scores: cow_points (the Lolcow Index: rage quits, crashes, meltdowns, L's) and clout_points
* (the Clout Rankings: spikes, records, marathons, W's). Streamers in arena_opt_outs get no stories.
*
@@@ -102,7 +103,7 @@ async function createStory({ kind, userId, otherUserId = null, streamId = null,
try { require('./notify').arenaNotify(userId, { type: 'drama', title: `You made the Arena: ${headline.slice(0, 100)}`, message: blurb.slice(0, 200), icon: '🚨', url: `/arena/drama/${id}`, key: `drama:${id}` }); } catch { /* */ }
}
// The AI headline first (when it comes), then the chat hears about it.
-- rewrite(id, { kind, streamer: name, other: fx.other || null, facts: fx, quote: cleanQuote }, userId).catch(() => {}).then(() => announce(id)).catch(() => {});
++ rewrite(id, { kind, streamer: name, other: fx.other || null, what: blurb, facts: fx, quote: cleanQuote }, userId).catch(() => {}).then(() => announce(id)).catch(() => {});
return id;
}
ddiff --git a/test/arena-drama.test.js b/test/arena-drama.test.js
iindex acc275bc..d031d2d9 100644
---- a/test/arena-drama.test.js
++++ b/test/arena-drama.test.js
@@@ -123,7 +123,7 @@ const db = require('../server/db/database');
const aiSvc = require('../server/ai/ai-service');
arenaSvc.aiOn = async () => true;
let answer = { headline: '🚨 GHOST STREAMS 90 MINUTES TO NOBODY', blurb: 'Peak 0. Chat 0. Brutal.', alert: 2 };
-- aiSvc.structured = async (workflow, input) => { assert.strictEqual(workflow, 'live.arena.drama'); assert.strictEqual(input.streamer, 'ghost'); return answer; };
++ aiSvc.structured = async (workflow, input) => { assert.strictEqual(workflow, 'live.arena.drama'); assert.strictEqual(input.streamer, 'ghost'); assert.match(input.what, /^Peak: 0 viewers\. Chat messages: 0\.$/); return answer; };
const g1 = await drama.createStory({ kind: 'ghost_town', userId: ghost, dedupeKey: 'ai:1', facts: { minutes: 90, peak: 0, messages: 0 }, happenedAt: NOW });
await new Promise((r) => setTimeout(r, 50));
assert.deepStrictEqual(await db.get('SELECT headline, ai FROM arena_drama WHERE id = ?', [g1]), { headline: '🚨 GHOST STREAMS 90 MINUTES TO NOBODY', ai: 1 });