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:
Leonid Pershin
2026-08-21 23:21:03 +03:00
co-authored by Cursor
parent 714da5c38b
commit 723ab82991
6 changed files with 73 additions and 55 deletions
+40
View File
@@ -315,6 +315,46 @@ public sealed class AssistentConfig
return def;
}
/// <summary>Exact KV for the system prompt: params tables only (facts stay short / in RAG).</summary>
public JObject LoadExactForPrompt(string personaId)
{
JObject full = LoadExact(personaId);
if (full is null || full.Count == 0)
{
return full ?? new JObject();
}
JObject slim = new();
foreach (string key in new[] { "generation", "profiles", "aspect_table" })
{
if (full[key] is not null)
{
slim[key] = full[key].DeepClone();
}
}
if (full["facts"] is JObject facts)
{
// Keep short pointers only — long prose bloats 7B context and kills JSON discipline.
JObject shortFacts = new();
foreach (JProperty prop in facts.Properties())
{
string text = prop.Value?.ToString() ?? "";
if (text.Length <= 160)
{
shortFacts[prop.Name] = text;
}
else
{
shortFacts[prop.Name] = text.Substring(0, 157) + "…";
}
}
if (shortFacts.Count > 0)
{
slim["facts"] = shortFacts;
}
}
return slim;
}
public JObject LoadAssistant(string personaId) => MergeJsonLayers("assistant.json", LayerRoots(personaId));
public JObject LoadUi(string personaId) => MergeJsonLayers("ui.json", LayerRoots(personaId));