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)
Changes
@@@ -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}`);@@@ -205,6 +205,8 @@ t('Vibe thinks with your own key or computer when you choose it: every chat of yawait 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');
@@ -398,9 +398,21 @@ async function afterPost(room, message, user, deps = {}) {
@@ -398,9 +398,21 @@ async function afterPost(room, message, user, deps = {}) {
}, opts);
}, opts);
text = out && typeof out.text === 'string' ? clean(out.text, 2000) : '';
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 (!own) await countReply(room);
if (vibe && !own) await require('./vibe').countReply(user);
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);
return await say(text, steps && steps.steps.length ? steps : null);
} catch (err) {
} catch (err) {
console.warn(`[Chat AI members] room ${room.id}: ${(err && err.message) || err}`);
console.warn(`[Chat AI members] room ${room.id}: ${(err && err.message) || err}`);
@@ -205,6 +205,8 @@ t('Vibe thinks with your own key or computer when you choose it: every chat of y
@@ -205,6 +205,8 @@ t('Vibe thinks with your own key or computer when you choose it: every chat of y
await settle(400);
await settle(400);
const mine = runs.slice(before).filter((r) => r.credential && r.credential.subject === h.live.users.get(di.id).subject_id);
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)`);
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.
// The settings form says so and keeps it; unchecked, Vibe goes back to OpenVibe's model.
const page = await web('GET', '/settings', di);
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');
assert.ok(page.text.includes('name="vibe" value="1" checked') && page.text.includes('· Vibe thinks with it'), 'the box, checked');