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:
+340
-19
@@ -640,6 +640,48 @@
|
||||
const ask = patchAskList(delta);
|
||||
return { generate, look, vetoed, ask };
|
||||
}
|
||||
var EXACT_GENERATE_PARAM_KEYS = ["steps", "cfg", "sigma_shift"];
|
||||
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
|
||||
};
|
||||
}
|
||||
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 };
|
||||
}
|
||||
function attachSession(SA2) {
|
||||
SA2.session = {
|
||||
emptySession,
|
||||
@@ -653,6 +695,9 @@
|
||||
compactContext,
|
||||
fullSettingsDump,
|
||||
resolveTurnIntent,
|
||||
resolveExactProfileDefaults,
|
||||
mergeExactParamsForGenerate,
|
||||
EXACT_GENERATE_PARAM_KEYS,
|
||||
GEN_KEYS
|
||||
};
|
||||
}
|
||||
@@ -1038,6 +1083,86 @@
|
||||
SA2.createActivityController = createActivityController;
|
||||
}
|
||||
|
||||
// src/kreaProfile.js
|
||||
function numClose(a, b, eps = 0.051) {
|
||||
const x = Number(a);
|
||||
const y = Number(b);
|
||||
if (!Number.isFinite(x) || !Number.isFinite(y)) {
|
||||
return false;
|
||||
}
|
||||
return Math.abs(x - y) <= eps;
|
||||
}
|
||||
function detectKreaProfileName(modelBlob, exactProfile) {
|
||||
const blob = String(modelBlob || "").toLowerCase();
|
||||
const hasTurbo = /turbo/.test(blob);
|
||||
const hasRaw = /\braw\b|_raw\b|-raw\b|\/raw\b/.test(blob);
|
||||
if (hasTurbo) {
|
||||
return "turbo";
|
||||
}
|
||||
if (hasRaw) {
|
||||
return "raw";
|
||||
}
|
||||
void exactProfile;
|
||||
return "raw";
|
||||
}
|
||||
function profileParamDefaults(profiles, profileName, generation = {}) {
|
||||
const profile = String(profileName || "raw");
|
||||
const fromProfile = profiles && typeof profiles[profile] === "object" ? profiles[profile] : {};
|
||||
const gen = generation && typeof generation === "object" ? generation : {};
|
||||
return {
|
||||
profile,
|
||||
steps: fromProfile.steps ?? gen.steps ?? null,
|
||||
cfg: fromProfile.cfg ?? gen.cfg ?? null,
|
||||
sigma_shift: fromProfile.sigma_shift ?? gen.sigma_shift ?? null
|
||||
};
|
||||
}
|
||||
function liveMatchesExactProfile(live, defaults) {
|
||||
if (!defaults || defaults.steps == null || defaults.cfg == null) {
|
||||
return true;
|
||||
}
|
||||
const stepsOk = live?.steps == null || numClose(live.steps, defaults.steps, 0.5);
|
||||
const cfgOk = live?.cfg == null || numClose(live.cfg, defaults.cfg);
|
||||
const sigmaOk = defaults.sigma_shift == null || live?.sigma_shift == null || numClose(live.sigma_shift, defaults.sigma_shift);
|
||||
return stepsOk && cfgOk && sigmaOk;
|
||||
}
|
||||
function exactKeysToForce(live, defaults, {
|
||||
patch = null,
|
||||
sessionExact = null,
|
||||
userParamIntent = false
|
||||
} = {}) {
|
||||
if (!defaults) {
|
||||
return [];
|
||||
}
|
||||
const out = [];
|
||||
for (const key of ["steps", "cfg", "sigma_shift"]) {
|
||||
const want = defaults[key];
|
||||
if (want == null) {
|
||||
continue;
|
||||
}
|
||||
const eps = key === "steps" ? 0.5 : 0.051;
|
||||
if (patch && patch[key] != null && !numClose(patch[key], want, eps)) {
|
||||
continue;
|
||||
}
|
||||
if (userParamIntent && sessionExact && sessionExact[key] != null) {
|
||||
continue;
|
||||
}
|
||||
const have = live?.[key];
|
||||
if (have == null || !numClose(have, want, eps)) {
|
||||
out.push(key);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
function attachKreaProfile(SA2) {
|
||||
SA2.kreaProfile = {
|
||||
numClose,
|
||||
detectKreaProfileName,
|
||||
profileParamDefaults,
|
||||
liveMatchesExactProfile,
|
||||
exactKeysToForce
|
||||
};
|
||||
}
|
||||
|
||||
// src/app.js
|
||||
(function() {
|
||||
const LS_BASE = "swarm_assistent_base_url";
|
||||
@@ -1559,6 +1684,7 @@
|
||||
return false;
|
||||
}
|
||||
}
|
||||
let lastExactForceCkpt = null;
|
||||
function updateGate() {
|
||||
const ok = isKreaSelected();
|
||||
const gate = $2("sa_gate");
|
||||
@@ -1579,6 +1705,19 @@
|
||||
if (layout) {
|
||||
layout.classList.toggle("sa-disabled", !ok);
|
||||
}
|
||||
try {
|
||||
const ckptName = resolveCurrentCheckpoint()?.name || null;
|
||||
if (ok && ckptName && ckptName !== lastExactForceCkpt) {
|
||||
const defs = typeof exactProfileDefaults === "function" ? exactProfileDefaults(detectKreaProfileName2()) : null;
|
||||
if (defs && defs.steps != null && defs.cfg != null) {
|
||||
lastExactForceCkpt = ckptName;
|
||||
forceExactParamsForGenerate({});
|
||||
}
|
||||
} else if (!ok) {
|
||||
lastExactForceCkpt = null;
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
function escapeHtml2(s) {
|
||||
@@ -1863,7 +2002,9 @@
|
||||
if (/\b(steps?|cfg|seed|sigma|aspect|resolution|batch|turbo|raw)\b/i.test(t)) {
|
||||
return true;
|
||||
}
|
||||
return cyrTokenRe("\u0440\u0430\u0437\u043C\u0435\u0440|\u0448\u0438\u0440\u0438\u043D[\u0430-\u044F\u0451]*|\u0432\u044B\u0441\u043E\u0442[\u0430-\u044F\u0451]*|\u0441\u043E\u043E\u0442\u043D\u043E\u0448\u0435\u043D[\u0430-\u044F\u0451]*|\u0442\u0443\u0440\u0431\u043E|\u043F\u043E\u0440\u0442\u0440\u0435\u0442|\u0432\u0435\u0440\u0442\u0438\u043A\u0430\u043B[\u0430-\u044F\u0451]*").test(t);
|
||||
return cyrTokenRe(
|
||||
"\u0440\u0430\u0437\u043C\u0435\u0440|\u0448\u0438\u0440\u0438\u043D[\u0430-\u044F\u0451]*|\u0432\u044B\u0441\u043E\u0442[\u0430-\u044F\u0451]*|\u0441\u043E\u043E\u0442\u043D\u043E\u0448\u0435\u043D[\u0430-\u044F\u0451]*|\u0442\u0443\u0440\u0431\u043E|\u043F\u043E\u0440\u0442\u0440\u0435\u0442|\u0432\u0435\u0440\u0442\u0438\u043A\u0430\u043B[\u0430-\u044F\u0451]*|\u0448\u0430\u0433|\u0448\u0430\u0433\u043E\u043C|\u0448\u0430\u0433\u0430\u043C\u0438|\u0448\u0430\u0433\u043E\u0432|\u0448\u0430\u0433\u0430"
|
||||
).test(t);
|
||||
}
|
||||
function replyMissingJsonPatch(reply) {
|
||||
const t = String(reply || "");
|
||||
@@ -2127,7 +2268,7 @@ ${patch.prompt}`;
|
||||
const steps = val("input_steps") || "\u2014";
|
||||
const cfg = val("input_cfgscale") || val("input_cfg") || "\u2014";
|
||||
const seed = val("input_seed") || "\u2014";
|
||||
const profile = detectKreaProfileName();
|
||||
const profile = detectKreaProfileName2();
|
||||
el.textContent = `${aspect} \xB7 ${w || "?"}\xD7${h || "?"} \xB7 steps ${steps} \xB7 cfg ${cfg} \xB7 ${profile} \xB7 seed ${seed}`;
|
||||
}
|
||||
function applyAspectTableFrom(obj) {
|
||||
@@ -2151,28 +2292,116 @@ ${patch.prompt}`;
|
||||
const profiles = exact.profiles || state.kreaProfiles || {};
|
||||
return { exact, profiles };
|
||||
}
|
||||
function detectKreaProfileName() {
|
||||
function detectKreaProfileName2() {
|
||||
const KP = window.SA?.kreaProfile;
|
||||
try {
|
||||
const model = resolveCurrentCheckpoint();
|
||||
const blob = `${model?.name || ""} ${model?.title || ""}`.toLowerCase();
|
||||
const hasRaw = /\braw\b/.test(blob);
|
||||
const hasTurbo = /\bturbo\b/.test(blob);
|
||||
return hasRaw && !hasTurbo ? "raw" : "turbo";
|
||||
const blob = `${model?.name || ""} ${model?.title || ""}`;
|
||||
const exactProfile = state.exact?.generation?.profile;
|
||||
if (KP?.detectKreaProfileName) {
|
||||
return KP.detectKreaProfileName(blob, exactProfile);
|
||||
}
|
||||
const lower = blob.toLowerCase();
|
||||
if (/turbo/.test(lower)) {
|
||||
return "turbo";
|
||||
}
|
||||
if (/\braw\b|_raw\b|-raw\b/.test(lower)) {
|
||||
return "raw";
|
||||
}
|
||||
return "raw";
|
||||
} catch (e) {
|
||||
return state.exact?.generation?.profile || "turbo";
|
||||
return state.exact?.generation?.profile || "raw";
|
||||
}
|
||||
}
|
||||
function exactProfileDefaults(profileName) {
|
||||
const { exact, profiles } = resolveExactBundle();
|
||||
const profile = profileName || detectKreaProfileName2();
|
||||
const KP = window.SA?.kreaProfile;
|
||||
if (KP?.profileParamDefaults) {
|
||||
return KP.profileParamDefaults(profiles, profile, exact.generation);
|
||||
}
|
||||
const gen = exact.generation && typeof exact.generation === "object" ? exact.generation : {};
|
||||
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
|
||||
};
|
||||
}
|
||||
function readLiveStepsCfgSigma() {
|
||||
return {
|
||||
steps: parseInt(val("input_steps") || "", 10) || null,
|
||||
cfg: parseFloat(val("input_cfgscale") || val("input_cfg") || "") || null,
|
||||
sigma_shift: parseFloat(val("input_sigmashift") || "") || null
|
||||
};
|
||||
}
|
||||
function setCfgVal(n) {
|
||||
if (document.getElementById("input_cfgscale")) {
|
||||
setVal("input_cfgscale", String(n));
|
||||
} else if (document.getElementById("input_cfg")) {
|
||||
setVal("input_cfg", String(n));
|
||||
}
|
||||
}
|
||||
function forceExactParamsForGenerate({ patch = null, profileName = null } = {}) {
|
||||
if (typeof isKreaSelected === "function" && !isKreaSelected()) {
|
||||
return false;
|
||||
}
|
||||
const profile = profileName || detectKreaProfileName2();
|
||||
const defaults = exactProfileDefaults(profile);
|
||||
const live = readLiveStepsCfgSigma();
|
||||
const KP = window.SA?.kreaProfile;
|
||||
const userIntent = !!state.lastUserParamIntent;
|
||||
const keys = KP?.exactKeysToForce ? KP.exactKeysToForce(live, defaults, {
|
||||
patch,
|
||||
sessionExact: state.sessionExact,
|
||||
userParamIntent: userIntent
|
||||
}) : ["steps", "cfg", "sigma_shift"].filter((k) => {
|
||||
const want = defaults[k];
|
||||
if (want == null) {
|
||||
return false;
|
||||
}
|
||||
if (patch?.[k] != null && String(patch[k]) !== String(want)) {
|
||||
return false;
|
||||
}
|
||||
if (userIntent && state.sessionExact?.[k] != null) {
|
||||
return false;
|
||||
}
|
||||
return live[k] == null || String(live[k]) !== String(want);
|
||||
});
|
||||
if (!keys.length) {
|
||||
return false;
|
||||
}
|
||||
for (const key of keys) {
|
||||
const want = defaults[key];
|
||||
if (key === "steps") {
|
||||
setVal("input_steps", String(want));
|
||||
} else if (key === "cfg") {
|
||||
setCfgVal(want);
|
||||
} else if (key === "sigma_shift") {
|
||||
setVal("input_sigmashift", String(want));
|
||||
}
|
||||
if (state.sessionExact && state.sessionExact[key] != null && String(state.sessionExact[key]) !== String(want)) {
|
||||
delete state.sessionExact[key];
|
||||
}
|
||||
if (state.chatSession?.gen) {
|
||||
state.chatSession.gen[key] = want;
|
||||
}
|
||||
}
|
||||
syncLiveParamsBar();
|
||||
return true;
|
||||
}
|
||||
function mergedGenerationDefaults(profileName) {
|
||||
const { exact, profiles } = resolveExactBundle();
|
||||
const gen = exact.generation && typeof exact.generation === "object" ? { ...exact.generation } : {};
|
||||
const profile = profileName || gen.profile || detectKreaProfileName();
|
||||
const profile = profileName || detectKreaProfileName2();
|
||||
const fromProfile = profiles[profile] && typeof profiles[profile] === "object" ? { ...profiles[profile] } : {};
|
||||
const session = state.sessionExact && typeof state.sessionExact === "object" ? { ...state.sessionExact } : {};
|
||||
return { ...gen, ...fromProfile, profile, ...session };
|
||||
}
|
||||
function exactDefaultFor(key, profileName) {
|
||||
const { exact, profiles } = resolveExactBundle();
|
||||
const profile = profileName || exact.generation?.profile || detectKreaProfileName();
|
||||
const profile = profileName || exact.generation?.profile || detectKreaProfileName2();
|
||||
const fromProfile = profiles[profile]?.[key];
|
||||
if (fromProfile != null) {
|
||||
return fromProfile;
|
||||
@@ -2206,6 +2435,36 @@ ${patch.prompt}`;
|
||||
}
|
||||
return String(value) !== String(exactVal);
|
||||
}
|
||||
function ensureExactParamsForGenerate(patch) {
|
||||
const S = window.SA && window.SA.session;
|
||||
if (!patch || !S || typeof S.mergeExactParamsForGenerate !== "function") {
|
||||
return patch;
|
||||
}
|
||||
if (!S.patchWantsGenerate(patch)) {
|
||||
return patch;
|
||||
}
|
||||
const { exact, profiles } = resolveExactBundle();
|
||||
const { patch: next, clearSessionKeys } = S.mergeExactParamsForGenerate(patch, {
|
||||
exact,
|
||||
profiles,
|
||||
profileName: detectKreaProfileName2(),
|
||||
sessionExact: state.sessionExact,
|
||||
userParamIntent: !!state.lastUserParamIntent
|
||||
});
|
||||
for (const key of clearSessionKeys || []) {
|
||||
if (state.sessionExact && state.sessionExact[key] != null) {
|
||||
delete state.sessionExact[key];
|
||||
}
|
||||
}
|
||||
if (state.chatSession && state.chatSession.gen) {
|
||||
for (const key of S.EXACT_GENERATE_PARAM_KEYS || ["steps", "cfg", "sigma_shift"]) {
|
||||
if (next[key] != null) {
|
||||
state.chatSession.gen[key] = next[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return next;
|
||||
}
|
||||
function fillEmptyParamsFromExact() {
|
||||
const defaults = mergedGenerationDefaults();
|
||||
if (isEmptyParamField(val("input_steps"), { treatZeroEmpty: true }) && defaults.steps != null) {
|
||||
@@ -4554,6 +4813,8 @@ ${patch.prompt}`;
|
||||
if (typeof readInitContext === "function") initCtx = readInitContext();
|
||||
} catch (e) {
|
||||
}
|
||||
const kreaProfile = detectKreaProfileName2();
|
||||
const exactDefs = exactProfileDefaults(kreaProfile);
|
||||
const extra = {
|
||||
prompt_image_count: typeof countPromptImages === "function" ? countPromptImages() : 0,
|
||||
has_vision_image: typeof visionReadySlots === "function" ? visionReadySlots().length > 0 : false,
|
||||
@@ -4561,6 +4822,12 @@ ${patch.prompt}`;
|
||||
attached_slot_ids: typeof attachableSlots === "function" ? attachableSlots().map((s) => s.id) : [],
|
||||
auto_apply: !!$2("sa_auto_apply")?.checked,
|
||||
auto_generate: true,
|
||||
krea_profile: kreaProfile,
|
||||
recommended_params: {
|
||||
steps: exactDefs.steps,
|
||||
cfg: exactDefs.cfg,
|
||||
sigma_shift: exactDefs.sigma_shift
|
||||
},
|
||||
...initCtx
|
||||
};
|
||||
if (S && typeof S.compactContext === "function") {
|
||||
@@ -4576,7 +4843,7 @@ ${patch.prompt}`;
|
||||
return ctx;
|
||||
}
|
||||
const g = state.chatSession && state.chatSession.gen || {};
|
||||
return { session: true, prompt: g.prompt || "", negative: g.negative || "", ...extra };
|
||||
return { session: true, prompt: g.prompt || "", negative: g.negative || "", krea_profile: kreaProfile, ...extra };
|
||||
}
|
||||
function slimInventoryLoras(list, limit) {
|
||||
const selected = /* @__PURE__ */ new Set();
|
||||
@@ -4858,6 +5125,11 @@ ${patch.prompt}`;
|
||||
if (!patch) {
|
||||
return;
|
||||
}
|
||||
const S = window.SA && window.SA.session;
|
||||
const wantsGen = S && typeof S.patchWantsGenerate === "function" && S.patchWantsGenerate(patch);
|
||||
if (wantsGen) {
|
||||
patch = ensureExactParamsForGenerate(patch);
|
||||
}
|
||||
const doPrompt = !which || which === "all" || which === "prompt";
|
||||
const doLoras = !which || which === "all" || which === "loras";
|
||||
const doParams = !which || which === "all" || which === "size" || which === "params";
|
||||
@@ -5038,6 +5310,10 @@ ${patch.prompt}`;
|
||||
setVal(batchId, String(defBatch));
|
||||
}
|
||||
}
|
||||
const Sgen = window.SA && window.SA.session;
|
||||
if (Sgen?.patchWantsGenerate?.(patch) || patch.generate === true || Array.isArray(patch.actions) && patch.actions.map(String).includes("generate")) {
|
||||
forceExactParamsForGenerate({ patch });
|
||||
}
|
||||
}
|
||||
if (doInit) {
|
||||
const creativity = patch.init_creativity != null ? patch.init_creativity : patch.denoise;
|
||||
@@ -5442,16 +5718,41 @@ ${patch.prompt}`;
|
||||
return true;
|
||||
}
|
||||
async function runGenerateFromPatch(patch, opts = {}) {
|
||||
const deltaBeforeLive = patch && typeof patch === "object" ? { ...patch } : {};
|
||||
const S = window.SA && window.SA.session;
|
||||
const exactKeys = S && S.EXACT_GENERATE_PARAM_KEYS || ["steps", "cfg", "sigma_shift"];
|
||||
if (typeof pullLiveIntoSession === "function") pullLiveIntoSession();
|
||||
if (state.chatSession && state.chatSession.gen && (opts.fromSession || opts.force)) {
|
||||
const fromSess = { ...state.chatSession.gen, generate: true, actions: ["generate"] };
|
||||
if (patch && typeof patch === "object") {
|
||||
for (const k of Object.keys(patch)) {
|
||||
if (patch[k] != null) fromSess[k] = patch[k];
|
||||
if (state.chatSession && state.chatSession.gen) {
|
||||
for (const key of exactKeys) {
|
||||
const fromDelta = deltaBeforeLive[key] != null;
|
||||
const fromUser = !!state.lastUserParamIntent && state.sessionExact?.[key] != null;
|
||||
if (!fromDelta && !fromUser) {
|
||||
state.chatSession.gen[key] = null;
|
||||
}
|
||||
}
|
||||
patch = fromSess;
|
||||
}
|
||||
let working = {
|
||||
...deltaBeforeLive,
|
||||
generate: true,
|
||||
actions: Array.isArray(deltaBeforeLive.actions) && deltaBeforeLive.actions.map(String).includes("generate") ? deltaBeforeLive.actions : [...Array.isArray(deltaBeforeLive.actions) ? deltaBeforeLive.actions : [], "generate"]
|
||||
};
|
||||
working = ensureExactParamsForGenerate(working);
|
||||
if (state.chatSession && state.chatSession.gen && (opts.fromSession || opts.force)) {
|
||||
const fromSess = { ...state.chatSession.gen, generate: true, actions: ["generate"] };
|
||||
for (const k of Object.keys(working)) {
|
||||
if (working[k] != null) fromSess[k] = working[k];
|
||||
}
|
||||
for (const key of exactKeys) {
|
||||
const fromDelta = deltaBeforeLive[key] != null;
|
||||
const fromUser = !!state.lastUserParamIntent && state.sessionExact?.[key] != null;
|
||||
if (!fromDelta && !fromUser && working[key] != null) {
|
||||
fromSess[key] = working[key];
|
||||
}
|
||||
}
|
||||
patch = ensureExactParamsForGenerate(fromSess);
|
||||
if (typeof pushSessionToSwarm === "function") await pushSessionToSwarm(state.chatSession);
|
||||
} else {
|
||||
patch = working;
|
||||
}
|
||||
const force = !!opts.force;
|
||||
if (!force && false || !patchHasGenTrigger(patch)) {
|
||||
@@ -5506,6 +5807,10 @@ ${patch.prompt}`;
|
||||
syncLiveParamsBar();
|
||||
}
|
||||
ensureNegativeForGenerate(job.patch);
|
||||
forceExactParamsForGenerate({ patch: job.patch });
|
||||
if (typeof pullLiveIntoSession === "function") {
|
||||
pullLiveIntoSession();
|
||||
}
|
||||
if (epoch !== state.chatEpoch) {
|
||||
break;
|
||||
}
|
||||
@@ -6406,7 +6711,12 @@ ${data.ui.help_extra}`.trim();
|
||||
fillKnobsFromConfig(data);
|
||||
updateCtxChip();
|
||||
if (applyDefaults || data.exact) {
|
||||
lastExactForceCkpt = null;
|
||||
fillEmptyParamsFromExact();
|
||||
if (typeof isKreaSelected === "function" && isKreaSelected()) {
|
||||
forceExactParamsForGenerate({});
|
||||
lastExactForceCkpt = resolveCurrentCheckpoint()?.name || null;
|
||||
}
|
||||
}
|
||||
const nextPersona = data.persona || $2("sa_persona")?.value || "";
|
||||
let controlValues = data.control_values || data.exact?.controls || {};
|
||||
@@ -8035,6 +8345,13 @@ ${summary || "(\u043F\u0443\u0441\u0442\u043E)"}`;
|
||||
status: intent.vetoed ? "skip" : "running"
|
||||
});
|
||||
if (typeof startBusyUi === "function") startBusyUi("silent_gen");
|
||||
if (effective) {
|
||||
effective = ensureExactParamsForGenerate({
|
||||
...effective,
|
||||
generate: true,
|
||||
actions: Array.isArray(effective.actions) && effective.actions.map(String).includes("generate") ? effective.actions : [...Array.isArray(effective.actions) ? effective.actions : [], "generate"]
|
||||
});
|
||||
}
|
||||
if (S && effective) state.chatSession = S.mergeDelta(state.chatSession || S.emptySession(), effective);
|
||||
await pushSessionToSwarm(state.chatSession);
|
||||
if (typeof syncLiveParamsBar === "function") syncLiveParamsBar();
|
||||
@@ -8058,13 +8375,16 @@ ${summary || "(\u043F\u0443\u0441\u0442\u043E)"}`;
|
||||
state.pendingSilentGen = false;
|
||||
}
|
||||
async function applyQuickPatch(patch, note) {
|
||||
const withActions = { ...patch };
|
||||
let withActions = { ...patch };
|
||||
if (!Array.isArray(withActions.actions) && patchHasGenTrigger(withActions)) {
|
||||
withActions.actions = ["generate"];
|
||||
}
|
||||
const prevIntent = state.lastUserParamIntent;
|
||||
state.lastUserParamIntent = true;
|
||||
const S = window.SA && window.SA.session;
|
||||
if (S && S.patchWantsGenerate && S.patchWantsGenerate(withActions)) {
|
||||
withActions = ensureExactParamsForGenerate(withActions);
|
||||
}
|
||||
if (S) {
|
||||
state.chatSession = S.mergeDelta(state.chatSession || S.emptySession(), withActions);
|
||||
}
|
||||
@@ -8126,7 +8446,7 @@ ${summary || "(\u043F\u0443\u0441\u0442\u043E)"}`;
|
||||
const pack = $2("sa_pack")?.value || defaultPackId();
|
||||
const chatModel = $2("sa_model")?.value || "\u2014";
|
||||
const embed = $2("sa_embed_model")?.value || state.preferredEmbed || "\u2014";
|
||||
const profile = detectKreaProfileName();
|
||||
const profile = detectKreaProfileName2();
|
||||
const defaults = mergedGenerationDefaults(profile);
|
||||
const session = state.sessionExact || {};
|
||||
const exactGen = state.exact?.generation || state.config?.exact?.generation || {};
|
||||
@@ -10095,6 +10415,7 @@ ${HELP_TEXT}`);
|
||||
attachSession(window.SA);
|
||||
attachContext(window.SA);
|
||||
attachActivity(window.SA);
|
||||
attachKreaProfile(window.SA);
|
||||
window.SA.applyConfigPatchKeys = function(config) {
|
||||
const keys = config?.patch_keys;
|
||||
if (Array.isArray(keys) && keys.length) {
|
||||
|
||||
Reference in New Issue
Block a user