Ship Assistent 0.10.18: settings as a peer tab, stream/VRAM chat fixes.
Move settings beside Chat/Cards; stop fence ramble, sticky scroll, horny echo filter, and force-warm after Generate. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -106,6 +106,51 @@ public partial class SwarmAssistentExtension
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If the reply already contains a closed fenced patch/card, cut everything after it.
|
||||
/// Models often keep writing («Готово!», second aspect, …) and the stream never feels done.
|
||||
/// </summary>
|
||||
static bool TryTruncateAtCompleteFence(string reply, out string truncated)
|
||||
{
|
||||
truncated = reply ?? "";
|
||||
if (string.IsNullOrWhiteSpace(reply))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
MatchCollection matches = JsonFenceRe.Matches(reply);
|
||||
if (matches.Count == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < matches.Count; i++)
|
||||
{
|
||||
Match match = matches[i];
|
||||
string raw = match.Groups[1].Value.Trim();
|
||||
try
|
||||
{
|
||||
JObject obj = JObject.Parse(raw);
|
||||
if (obj is null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
bool usable = LooksLikeCardObject(obj)
|
||||
|| Array.Exists(PatchKeys, k => obj[k] is not null);
|
||||
if (!usable)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
truncated = reply.Substring(0, match.Index + match.Length).TrimEnd();
|
||||
// Only treat as complete if the fence actually closed (regex requires ```).
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// incomplete / invalid json inside fence
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static string ExtractSearchQuery(JObject patch)
|
||||
{
|
||||
if (patch is null)
|
||||
|
||||
Reference in New Issue
Block a user