openvibers/openvibe.chat Commits

Vibe on your own model says so under its answer ("Answered with llama3.1:8b on Di's computer"), and when your computer does not answer it says what to check and how to switch back (#209)

OP OpenVibers committed 18 days ago · dbddde8469 · 2 files, +15 −1

Changes

ddiff --git a/server/rooms/ai-members.js b/server/rooms/ai-members.js
iindex cd307a6..a9631ff 100644
---- a/server/rooms/ai-members.js
++++ b/server/rooms/ai-members.js
@@@ -398,9 +398,21 @@ async function afterPost(room, message, user, deps = {}) {
}, opts);
text = out && typeof out.text === 'string' ? clean(out.text, 2000) : '';
}
-- if (!text) return await say(own ? 'I could not reach my model just now (its key may be out of today\'s budget, or the provider did not answer). Try again later, or the room\'s owner can switch me to OpenVibe\'s model.' : 'I could not answer just now. Try again in a minute.');
++ // A model on someone's own computer (credential provider node): its label reads "<model> on Fran's computer".
++ const onComputer = own && /'s computer$/.test(String(member.engine_label || ''));
++ if (!text) {
++ if (!own) return await say('I could not answer just now. Try again in a minute.');
++ if (onComputer) return await say(vibe
++ ? 'I could not reach the model on your computer just now. Is it on, with its model server running (Ollama, LM Studio or llama.cpp), and "Let my AI use this computer\'s models" on at openvibe.bot/machines? You can switch me back to OpenVibe\'s model in Settings, under "Your AI key".'
++ : 'I could not reach the model on my manager\'s computer just now. Try again later, or the room\'s owner can switch me to OpenVibe\'s model.');
++ return await say(vibe
++ ? 'I could not reach your model just now (your key may be out of today\'s budget, or the provider did not answer). Try again later, or switch me back to OpenVibe\'s model in Settings, under "Your AI key".'
++ : 'I could not reach my model just now (its key may be out of today\'s budget, or the provider did not answer). Try again later, or the room\'s owner can switch me to OpenVibe\'s model.');
++ }
if (!own) await countReply(room);
if (vibe && !own) await require('./vibe').countReply(user);
++ // "How Vibe did this" says which model answered when it was the person's own (their key or their computer).
++ if (vibe && own && steps && member.engine_label) steps.steps.unshift(`Answered with ${String(member.engine_label).slice(0, 160)}`);
return await say(text, steps && steps.steps.length ? steps : null);
} catch (err) {
console.warn(`[Chat AI members] room ${room.id}: ${(err && err.message) || err}`);
ddiff --git a/test/room-ai-models.test.js b/test/room-ai-models.test.js
iindex f78fa5c..cf9b47a 100644
---- a/test/room-ai-models.test.js
++++ b/test/room-ai-models.test.js
@@@ -205,6 +205,8 @@ t('Vibe thinks with your own key or computer when you choose it: every chat of y
await settle(400);
const mine = runs.slice(before).filter((r) => r.credential && r.credential.subject === h.live.users.get(di.id).subject_id);
assert.ok(mine.length >= 1, `Vibe answered with their computer (${runs.length - before} runs)`);
++ const answer = await h.db.get('SELECT m.how FROM room_messages m JOIN rooms r ON r.id = m.room_id WHERE r.slug = ? AND m.user_id = 0 ORDER BY m.id DESC LIMIT 1', [next.body.room.slug]);
++ assert.ok(answer && String(answer.how).includes('Answered with llama3.1:8b on Di\'s computer'), `"How Vibe did this" names it (${answer && answer.how})`);
// The settings form says so and keeps it; unchecked, Vibe goes back to OpenVibe's model.
const page = await web('GET', '/settings', di);
assert.ok(page.text.includes('name="vibe" value="1" checked') && page.text.includes('· Vibe thinks with it'), 'the box, checked');