Coach: a failed run on the phone says why, a message with no plan asks for one, the chat has context
- Phone with own key: the provider's or validator's reason reaches the chat line and toast (BYOK_ERRORS + jobErrorText); no more "instance owner" wording where there is none (#58) - CoachChat: a message with no routines refines/creates instead of reviewing an empty window; menu entry "Start a new plan" (Discord "Coach reset" thread) - payload: refine without a previous plan becomes a create with userNote; the last six chat lines travel as `conversation` (documented in common.md, prompts.js regenerated) - OpenAI model list cut to Chat-Completions models (isChatModel); Gemini placeholder names AQ. keys - 3 new strings in 14 packs, pt-BR guard 626/616/3db560d7; tests for all of it
This commit is contained in:
1 parent
5c2005e81f
commit
d0aaa7205d
26 files changed
+208
-13
No files matched your search
@@ -262,3 +262,17 @@ test('validateBaseUrl: http(s) only, no credentials, no query, trailing slash dr
|
||||
assert.equal(validateBaseUrl('http://x/?key=1').ok, false);
|
||||
assert.equal(validateBaseUrl('not a url').ok, false);
|
||||
});
|
||||
|
||||
test('models(): OpenAI’s list is cut to what Chat Completions can use; a compatible endpoint is not filtered', async () => {
|
||||
const { isChatModel } = await import('../coach/core/adapters/openai.js');
|
||||
const all = ['gpt-5.6', 'gpt-5.6-mini', 'gpt-4o', 'o3', 'o4-mini', 'chatgpt-4o-latest',
|
||||
'gpt-4o-realtime-preview', 'gpt-4o-audio-preview', 'gpt-4o-mini-tts', 'gpt-4o-transcribe', 'whisper-1',
|
||||
'text-embedding-3-small', 'gpt-image-1', 'dall-e-3', 'omni-moderation-latest', 'gpt-4o-search-preview',
|
||||
'gpt-3.5-turbo-instruct', 'codex-mini-latest', 'computer-use-preview', 'o3-deep-research', 'o1-pro', 'gpt-5.6-pro', 'davinci-002'];
|
||||
assert.deepEqual(all.filter(isChatModel), ['gpt-5.6', 'gpt-5.6-mini', 'gpt-4o', 'o3', 'o4-mini', 'chatgpt-4o-latest']);
|
||||
const oa = fakeFetch([ok({ data: all.map(id => ({ id })) })]);
|
||||
assert.deepEqual((await openai.models({}, env, { fetch: oa })).models, ['chatgpt-4o-latest', 'gpt-4o', 'gpt-5.6', 'gpt-5.6-mini', 'o3', 'o4-mini']);
|
||||
const { default: compatible } = await import('../coach/core/adapters/compatible.js');
|
||||
const co = fakeFetch([ok({ data: [{ id: 'qwen2.5:3b' }, { id: 'llama3.2' }] })]);
|
||||
assert.deepEqual((await compatible.models({ providerOptions: { compatible: { baseUrl: 'http://ollama:11434' } } }, {}, { fetch: co })).models, ['llama3.2', 'qwen2.5:3b']);
|
||||
});
|
||||
@@ -209,3 +209,38 @@ test('the cohort rides along on a review and a debrief only when handed in', ()
|
||||
assert.equal('cohort' in payload.build(sampleState(), { handle: handleFor('u'), kind: 'review' }), false);
|
||||
assert.equal('cohort' in payload.build(sampleState(), { handle: handleFor('u'), kind: 'create', cohort }), false);
|
||||
});
|
||||
|
||||
test('a refine with no plan to refine is a fresh plan with a note, never refine.previous = null', () => {
|
||||
const S = sampleState();
|
||||
const p = payload.build(S, { handle: handleFor('u1'), kind: 'create', refine: 'three days, no barbell', previous: null });
|
||||
assert.equal(p.task, 'create');
|
||||
assert.equal(p.refine, undefined);
|
||||
assert.equal(p.userNote, 'three days, no barbell');
|
||||
const q = payload.build(S, { handle: handleFor('u1'), kind: 'create', refine: 'shorter', previous: { routines: [] } });
|
||||
assert.deepEqual(q.refine, { text: 'shorter', previous: { routines: [] } });
|
||||
assert.equal(q.userNote, undefined);
|
||||
});
|
||||
|
||||
test('the last few chat lines travel as conversation — user text and Coach verdicts only, never the message being sent', () => {
|
||||
const S = sampleState();
|
||||
S.coach = { ...(S.coach || {}), chat: [
|
||||
{ role: 'coach', kind: 'text', text: 'Hi — I’m your Coach.' },
|
||||
{ role: 'user', kind: 'intake' },
|
||||
{ role: 'user', kind: 'text', text: 'my knee hurts on lunges' },
|
||||
{ role: 'coach', kind: 'error', text: 'The Coach couldn’t run.' },
|
||||
{ role: 'coach', kind: 'nochange', text: 'Nothing to change yet; watch the knee.' },
|
||||
{ role: 'coach', kind: 'applied', text: 'Applied 2 changes' },
|
||||
{ role: 'user', kind: 'text', text: 'x'.repeat(500) },
|
||||
{ role: 'user', kind: 'text', text: 'and what about that?' }
|
||||
] };
|
||||
const p = payload.build(S, { handle: handleFor('u1'), kind: 'review', note: 'and what about that?' });
|
||||
assert.deepEqual(p.conversation.map(l => l.who), ['coach', 'user', 'coach', 'user']);
|
||||
assert.equal(p.conversation[1].text, 'my knee hurts on lunges');
|
||||
assert.equal(p.conversation[3].text.length, payload.CONVERSATION_CHARS, 'long lines are cut');
|
||||
assert.ok(!JSON.stringify(p.conversation).includes('couldn’t run'), 'error lines are noise');
|
||||
assert.ok(!p.conversation.some(l => l.text === 'and what about that?'), 'the current message rides in userNote');
|
||||
const d = payload.build(S, { handle: handleFor('u1'), kind: 'debrief' });
|
||||
assert.equal(d.conversation, undefined, 'a debrief reads one session and nothing else');
|
||||
const none = payload.build(sampleState(), { handle: handleFor('u1'), kind: 'review' });
|
||||
assert.equal(none.conversation, undefined);
|
||||
});
|
||||
Reference in new issue
Block a user