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:
@@ -49,7 +49,7 @@ public class SwarmAssistentExtension : Extension
|
||||
ExtensionAuthor = "mrleo1nid";
|
||||
Description = "Collaborative Krea 2 assistant: Ollama chat, persona presets, vector memory, model cards, Generate loop.";
|
||||
License = "MIT";
|
||||
Version = "0.7.1";
|
||||
Version = "0.7.2";
|
||||
Tags = ["tabs", "ui", "llm", "ollama", "krea", "inpaint", "memory"];
|
||||
}
|
||||
|
||||
@@ -1347,11 +1347,11 @@ public class SwarmAssistentExtension : Extension
|
||||
}
|
||||
}
|
||||
|
||||
JObject exact = Config.LoadExact(pid);
|
||||
JObject exact = Config.LoadExactForPrompt(pid);
|
||||
if (exact is not null && exact.Count > 0)
|
||||
{
|
||||
system.AppendLine();
|
||||
system.AppendLine("## Exact memory (canonical KV — always trust over RAG guesses)");
|
||||
system.AppendLine("## Exact memory (canonical KV defaults — prefer over RAG for numbers)");
|
||||
system.AppendLine("```json");
|
||||
system.AppendLine(exact.ToString(Newtonsoft.Json.Formatting.None));
|
||||
system.AppendLine("```");
|
||||
@@ -1574,7 +1574,7 @@ public class SwarmAssistentExtension : Extension
|
||||
Logs.Debug($"Assistent memory retrieve: {ex.Message}");
|
||||
}
|
||||
|
||||
string enrichedContext = InjectMemoryHits(contextJson, hits, Config.LoadExact(pid));
|
||||
string enrichedContext = InjectMemoryHits(contextJson, hits);
|
||||
List<JObject> messages = BuildOllamaMessages(packName, includeBase, enrichedContext, userMessages, personaId: pid, skillIds: skills);
|
||||
JArray civitaiResults = [];
|
||||
string reply = "";
|
||||
@@ -1681,29 +1681,12 @@ public class SwarmAssistentExtension : Extension
|
||||
ctx = new JObject { ["_raw_context"] = contextJson };
|
||||
}
|
||||
ctx["memory_hits"] = hits ?? new JArray();
|
||||
if (exact is not null && exact.Count > 0 && ctx["exact"] is null)
|
||||
{
|
||||
ctx["exact"] = exact;
|
||||
}
|
||||
// Never re-inject full Exact into live context (already in system prompt).
|
||||
ctx.Remove("exact");
|
||||
if (ctx["session_exact"] is null)
|
||||
{
|
||||
ctx["session_exact"] = new JObject();
|
||||
}
|
||||
if (ctx["recommended_params"] is null && exact?["generation"] is JObject gen)
|
||||
{
|
||||
JObject rec = new();
|
||||
foreach (string key in new[] { "steps", "cfg", "sigma_shift", "aspect", "images" })
|
||||
{
|
||||
if (gen[key] is not null)
|
||||
{
|
||||
rec[key] = gen[key].DeepClone();
|
||||
}
|
||||
}
|
||||
if (rec.Count > 0)
|
||||
{
|
||||
ctx["recommended_params"] = rec;
|
||||
}
|
||||
}
|
||||
// Slim inventory for LLM: keep enabled + current, drop full dump if present
|
||||
if (ctx["available_loras"] is JArray allLoras && allLoras.Count > 24)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user