Ship Assistent 0.14.1: Exact generate params and cheap park/warm.
Client always merges Exact turbo|raw steps/cfg/sigma before Generate so sparse LLM omissions and leftover SD 20/7 cannot stick; Ollama park/warm skip no-op /api/ps round-trips when the chat model is already unloaded or resident. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -13,6 +13,8 @@ import {
|
||||
sessionFromLegacyParams,
|
||||
toPersistParams,
|
||||
resolveTurnIntent,
|
||||
mergeExactParamsForGenerate,
|
||||
resolveExactProfileDefaults,
|
||||
} from '../src/session.js';
|
||||
|
||||
describe('patch.js', () => {
|
||||
@@ -74,4 +76,67 @@ describe('session.js', () => {
|
||||
assert.equal(intent.generate, false);
|
||||
assert.equal(intent.vetoed, true);
|
||||
});
|
||||
|
||||
it('mergeExactParamsForGenerate fills turbo profile when LLM omits steps/cfg', () => {
|
||||
const exact = {
|
||||
generation: { profile: 'turbo', steps: 8, cfg: 1, sigma_shift: 1.15 },
|
||||
profiles: {
|
||||
turbo: { steps: 8, cfg: 1, sigma_shift: 1.15 },
|
||||
raw: { steps: 28, cfg: 4.5, sigma_shift: 1.15 },
|
||||
},
|
||||
};
|
||||
const { patch, clearSessionKeys, profile } = mergeExactParamsForGenerate(
|
||||
{ prompt: 'a fox', generate: true },
|
||||
{
|
||||
exact,
|
||||
profiles: exact.profiles,
|
||||
profileName: 'turbo',
|
||||
sessionExact: { steps: 20, cfg: 7 },
|
||||
userParamIntent: false,
|
||||
},
|
||||
);
|
||||
assert.equal(profile, 'turbo');
|
||||
assert.equal(patch.steps, 8);
|
||||
assert.equal(patch.cfg, 1);
|
||||
assert.equal(patch.sigma_shift, 1.15);
|
||||
assert.deepEqual(clearSessionKeys.sort(), ['cfg', 'steps']);
|
||||
});
|
||||
|
||||
it('mergeExactParamsForGenerate keeps user-intent sessionExact and explicit patch', () => {
|
||||
const exact = {
|
||||
generation: { steps: 8, cfg: 1 },
|
||||
profiles: { raw: { steps: 28, cfg: 4.5, sigma_shift: 1.15 } },
|
||||
};
|
||||
const kept = mergeExactParamsForGenerate(
|
||||
{ generate: true, actions: ['generate'] },
|
||||
{
|
||||
exact,
|
||||
profiles: exact.profiles,
|
||||
profileName: 'raw',
|
||||
sessionExact: { steps: 20 },
|
||||
userParamIntent: true,
|
||||
},
|
||||
);
|
||||
assert.equal(kept.patch.steps, 20);
|
||||
assert.equal(kept.patch.cfg, 4.5);
|
||||
assert.deepEqual(kept.clearSessionKeys, []);
|
||||
|
||||
const explicit = mergeExactParamsForGenerate(
|
||||
{ generate: true, steps: 12, cfg: 2 },
|
||||
{ exact, profiles: exact.profiles, profileName: 'turbo' },
|
||||
);
|
||||
assert.equal(explicit.patch.steps, 12);
|
||||
assert.equal(explicit.patch.cfg, 2);
|
||||
});
|
||||
|
||||
it('resolveExactProfileDefaults picks raw over generation defaults', () => {
|
||||
const d = resolveExactProfileDefaults({
|
||||
exact: { generation: { steps: 8, cfg: 1, sigma_shift: 1.15 } },
|
||||
profiles: { raw: { steps: 28, cfg: 4.5 } },
|
||||
profileName: 'raw',
|
||||
});
|
||||
assert.equal(d.steps, 28);
|
||||
assert.equal(d.cfg, 4.5);
|
||||
assert.equal(d.sigma_shift, 1.15);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user