okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221merge f-split-fr (owner app UI fixes, rounds 1-5) into f-split-int8820fa433

main
1.2 KiB21 linesraw
1import test from 'node:test';
2import assert from 'node:assert/strict';
3import { readFileSync } from 'node:fs';
4
5/* The direct chat path (no agent): the composer's Reasoning effort menu reaches the server as reasoning_effort ("Off" -> "none", which the
6   server turns into enable_thinking=false), and the Thinking budget as reasoning_budget_tokens, never when thinking is off. */
7const host = readFileSync(new URL('../server/index.mjs', import.meta.url), 'utf8');
8const composer = readFileSync(new URL('../src/components/ComposerControls.tsx', import.meta.url), 'utf8');
9const store = readFileSync(new URL('../src/lib/store.ts', import.meta.url), 'utf8');
10
11test('Off is sent as none and Max as high; the budget only with thinking on', () => {
12  assert.match(host, /reasoning_effort:\(\{off:'none',max:'high'\}/);
13  assert.match(host, /thinkingBudget>0&&String\(thinking\)\.toLowerCase\(\)!=='off'\?\{reasoning_budget_tokens:thinkingBudget\}/);
14});
15
16test('the budget travels from the menu to the request', () => {
17  assert.match(composer, /THINKING_BUDGETS/);
18  assert.match(composer, /thinkingBudget: value/);
19  assert.match(store, /thinkingBudget:state\.sessions\.find/);
20  assert.match(host, /thinkingBudget:Number\.isInteger\(body\.thinkingBudget\)/);
21});