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:
@@ -350,6 +350,64 @@ export function resolveTurnIntent(patch, userText, { vetoFn } = {}) {
|
||||
return { generate, look, vetoed, ask };
|
||||
}
|
||||
|
||||
/** Params the client fills from Exact on Generate when the LLM omits them (sparse contract). */
|
||||
export const EXACT_GENERATE_PARAM_KEYS = ['steps', 'cfg', 'sigma_shift'];
|
||||
|
||||
/**
|
||||
* Turbo/RAW profile numbers from Exact — no sessionExact overlay.
|
||||
* profileName should already reflect the live checkpoint (turbo vs raw).
|
||||
*/
|
||||
export function resolveExactProfileDefaults({ exact, profiles, profileName } = {}) {
|
||||
const gen = exact?.generation && typeof exact.generation === 'object' ? exact.generation : {};
|
||||
const profile = profileName || gen.profile || 'turbo';
|
||||
const fromProfile = profiles?.[profile] && typeof profiles[profile] === 'object'
|
||||
? profiles[profile]
|
||||
: {};
|
||||
return {
|
||||
profile,
|
||||
steps: fromProfile.steps ?? gen.steps ?? null,
|
||||
cfg: fromProfile.cfg ?? gen.cfg ?? null,
|
||||
sigma_shift: fromProfile.sigma_shift ?? gen.sigma_shift ?? null,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* On generate, inject Exact profile steps/cfg/sigma when the patch omitted them.
|
||||
* Client is authoritative so sparse LLM deltas are safe. Honors explicit patch values
|
||||
* and sessionExact when the user asked for params this turn.
|
||||
* Returns clearSessionKeys so the UI apply path is not blocked by stale sessionExact.
|
||||
*/
|
||||
export function mergeExactParamsForGenerate(patch, {
|
||||
exact,
|
||||
profiles,
|
||||
profileName,
|
||||
sessionExact,
|
||||
userParamIntent,
|
||||
} = {}) {
|
||||
if (!patchWantsGenerate(patch)) {
|
||||
return { patch, clearSessionKeys: [], profile: null };
|
||||
}
|
||||
const defaults = resolveExactProfileDefaults({ exact, profiles, profileName });
|
||||
const out = { ...patch };
|
||||
const clearSessionKeys = [];
|
||||
for (const key of EXACT_GENERATE_PARAM_KEYS) {
|
||||
if (out[key] != null) {
|
||||
continue;
|
||||
}
|
||||
if (userParamIntent && sessionExact?.[key] != null) {
|
||||
out[key] = sessionExact[key];
|
||||
continue;
|
||||
}
|
||||
if (defaults[key] != null) {
|
||||
out[key] = defaults[key];
|
||||
if (sessionExact?.[key] != null && String(sessionExact[key]) !== String(defaults[key])) {
|
||||
clearSessionKeys.push(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
return { patch: out, clearSessionKeys, profile: defaults.profile };
|
||||
}
|
||||
|
||||
export function attachSession(SA) {
|
||||
SA.session = {
|
||||
emptySession,
|
||||
@@ -363,6 +421,9 @@ export function attachSession(SA) {
|
||||
compactContext,
|
||||
fullSettingsDump,
|
||||
resolveTurnIntent,
|
||||
resolveExactProfileDefaults,
|
||||
mergeExactParamsForGenerate,
|
||||
EXACT_GENERATE_PARAM_KEYS,
|
||||
GEN_KEYS,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user