Fix broken chat: slim Exact prompt and restore JSON discipline.
Stop duplicating Exact into live context, tighten preview URL matching, force write_prompt on "поправь", and gate critique behind vision + a real JSON fence. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+10
-10
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Swarm Assistent — Krea 2 collaborative chat (Ollama via Swarm API).
|
||||
* v0.7.1: Exact KV memory; block SwarmUI ViewSpecial/model-card previews from Generate+vision.
|
||||
* v0.7.2: Slim Exact in prompt; no Exact blob in live ctx; tighter preview filter; critique requires vision+JSON.
|
||||
*/
|
||||
(function () {
|
||||
const LS_BASE = 'swarm_assistent_base_url';
|
||||
@@ -1681,10 +1681,10 @@
|
||||
};
|
||||
}
|
||||
|
||||
ctx.exact = state.exact || state.config?.exact || null;
|
||||
ctx.session_exact = state.sessionExact && Object.keys(state.sessionExact).length
|
||||
? { ...state.sessionExact }
|
||||
: {};
|
||||
// Exact KV is already in the system prompt — do not duplicate the full blob into live context.
|
||||
|
||||
return ctx;
|
||||
}
|
||||
@@ -2088,6 +2088,9 @@
|
||||
if (!t.trim()) {
|
||||
return null;
|
||||
}
|
||||
if (/\b(поправь|исправь|перепиши|улучши|fix\s+it|make\s+it\s+better|rewrite)\b/i.test(t)) {
|
||||
return 'write_prompt';
|
||||
}
|
||||
if (/\b(опиши\s+реф|опиши\s+изображ|prompt\s+from\s+image|describe\s+(this|the|ref|image)|reverse\s*prompt)\b/i.test(t)
|
||||
|| /опиши\s+(этот|эту|картинк|референс)/i.test(t)) {
|
||||
return 'describe_ref';
|
||||
@@ -2846,17 +2849,14 @@
|
||||
if (!s) {
|
||||
return false;
|
||||
}
|
||||
// SwarmUI checkpoint/LoRA cards: ViewSpecial/*, View/Models/*, *.preview.*, PLACEHOLDER.
|
||||
if (s.includes('.preview.')
|
||||
// Only SwarmUI checkpoint/LoRA card routes — not bare "/models/" (matches Civitai page URLs).
|
||||
return s.includes('.preview.')
|
||||
|| s.includes('placeholder')
|
||||
|| s.includes('/viewspecial/')
|
||||
|| s.includes('viewspecial/')
|
||||
|| s.includes('/models/')
|
||||
|| s.includes('view/models/')
|
||||
|| /[?&](?:path|file)=[^&]*\.preview\./i.test(s)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|| s.includes('/view/models/')
|
||||
|| /\/view\/models\//.test(s)
|
||||
|| /[?&](?:path|file)=[^&]*\.preview\./i.test(s);
|
||||
}
|
||||
|
||||
function findCurrentGenerateSrc({ allowPreview = false } = {}) {
|
||||
|
||||
Reference in New Issue
Block a user