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:
@@ -0,0 +1,84 @@
|
||||
import { describe, it } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {
|
||||
detectKreaProfileName,
|
||||
profileParamDefaults,
|
||||
liveMatchesExactProfile,
|
||||
exactKeysToForce,
|
||||
numClose,
|
||||
} from '../src/kreaProfile.js';
|
||||
|
||||
const PROFILES = {
|
||||
turbo: { steps: 8, cfg: 1, sigma_shift: 1.15 },
|
||||
raw: { steps: 28, cfg: 4.5, sigma_shift: 1.15 },
|
||||
};
|
||||
|
||||
describe('kreaProfile', () => {
|
||||
it('detectKreaProfileName: turbo token wins', () => {
|
||||
assert.equal(detectKreaProfileName('realismByStableYogi_v25INT8Turbo', 'raw'), 'turbo');
|
||||
assert.equal(detectKreaProfileName('Krea2 Turbo fp8', 'raw'), 'turbo');
|
||||
});
|
||||
|
||||
it('detectKreaProfileName: raw token without turbo', () => {
|
||||
assert.equal(detectKreaProfileName('Krea2 RAW Base', 'turbo'), 'raw');
|
||||
});
|
||||
|
||||
it('detectKreaProfileName: unlabeled Yogi is not fake turbo', () => {
|
||||
assert.equal(detectKreaProfileName('realismByStableYogi_v25', 'turbo'), 'raw');
|
||||
assert.equal(detectKreaProfileName('realismByStableYogi', null), 'raw');
|
||||
});
|
||||
|
||||
it('liveMatchesExactProfile rejects SD leftovers under turbo', () => {
|
||||
const turbo = profileParamDefaults(PROFILES, 'turbo');
|
||||
assert.equal(liveMatchesExactProfile({ steps: 20, cfg: 7, sigma_shift: 1.15 }, turbo), false);
|
||||
assert.equal(liveMatchesExactProfile({ steps: 8, cfg: 1, sigma_shift: 1.15 }, turbo), true);
|
||||
});
|
||||
|
||||
it('exactKeysToForce overwrites 20/7 unless intentional non-Exact patch or user session', () => {
|
||||
const turbo = profileParamDefaults(PROFILES, 'turbo');
|
||||
assert.deepEqual(
|
||||
exactKeysToForce({ steps: 20, cfg: 7, sigma_shift: 1 }, turbo, {}),
|
||||
['steps', 'cfg', 'sigma_shift'],
|
||||
);
|
||||
// Injected Exact values in the patch still force live leftovers.
|
||||
assert.deepEqual(
|
||||
exactKeysToForce(
|
||||
{ steps: 20, cfg: 7, sigma_shift: 1 },
|
||||
turbo,
|
||||
{ patch: { steps: 8, cfg: 1, sigma_shift: 1.15 } },
|
||||
),
|
||||
['steps', 'cfg', 'sigma_shift'],
|
||||
);
|
||||
// Stale sessionExact without user intent must not block Exact.
|
||||
assert.deepEqual(
|
||||
exactKeysToForce(
|
||||
{ steps: 20, cfg: 7, sigma_shift: 1.15 },
|
||||
turbo,
|
||||
{ sessionExact: { steps: 20 }, userParamIntent: false },
|
||||
),
|
||||
['steps', 'cfg'],
|
||||
);
|
||||
assert.deepEqual(
|
||||
exactKeysToForce(
|
||||
{ steps: 20, cfg: 7, sigma_shift: 1.15 },
|
||||
turbo,
|
||||
{ sessionExact: { steps: 20 }, userParamIntent: true },
|
||||
),
|
||||
['cfg'],
|
||||
);
|
||||
// Intentional non-Exact patch value is kept.
|
||||
assert.deepEqual(
|
||||
exactKeysToForce({ steps: 20, cfg: 7, sigma_shift: 1.15 }, turbo, { patch: { cfg: 7 } }),
|
||||
['steps'],
|
||||
);
|
||||
assert.deepEqual(
|
||||
exactKeysToForce({ steps: 8, cfg: 1, sigma_shift: 1.15 }, turbo, {}),
|
||||
[],
|
||||
);
|
||||
});
|
||||
|
||||
it('numClose', () => {
|
||||
assert.equal(numClose(1.15, 1.14), true);
|
||||
assert.equal(numClose(1, 7), false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user