Ship Assistent disk persist, park LLM, and memory UI cleanup.
Split the extension into partials, persist chats on the data volume, park/warm the chat model around Generate, and drop dual raw/persona dump paths. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+61
-2
@@ -19,6 +19,7 @@ public partial class SwarmAssistentExtension
|
||||
"snapshot_generate", "select_slot", "aspect", "images", "batch", "vary", "lock_seed",
|
||||
"creativity", "intensity", "complexity", "movement",
|
||||
"clear_prompt_images", "slot_to_prompt_image", "pack", "memories", "memory",
|
||||
"memory_query", "memory_kind", "tag_query",
|
||||
];
|
||||
|
||||
static bool HasValue(JObject obj, string key)
|
||||
@@ -91,8 +92,66 @@ public partial class SwarmAssistentExtension
|
||||
return string.IsNullOrWhiteSpace(q) ? null : q;
|
||||
}
|
||||
|
||||
static bool WantsCivitaiSearch(JObject patch)
|
||||
static bool ActionsContain(JObject patch, string action)
|
||||
{
|
||||
return !string.IsNullOrWhiteSpace(ExtractSearchQuery(patch));
|
||||
if (patch?["actions"] is not JArray acts)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
foreach (JToken a in acts)
|
||||
{
|
||||
if (string.Equals(a?.ToString(), action, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static string ExtractMemoryQuery(JObject patch)
|
||||
{
|
||||
string q = patch?["memory_query"]?.ToString()?.Trim();
|
||||
if (!string.IsNullOrWhiteSpace(q))
|
||||
{
|
||||
return q;
|
||||
}
|
||||
return ActionsContain(patch, "memory_search") ? ExtractSearchQuery(patch) : null;
|
||||
}
|
||||
|
||||
static string ExtractTagQuery(JObject patch)
|
||||
{
|
||||
string q = patch?["tag_query"]?.ToString()?.Trim();
|
||||
if (!string.IsNullOrWhiteSpace(q))
|
||||
{
|
||||
return q;
|
||||
}
|
||||
return ActionsContain(patch, "lookup_tags") ? ExtractSearchQuery(patch) : null;
|
||||
}
|
||||
|
||||
static string NextToolHop(JObject patch)
|
||||
{
|
||||
if (patch is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (ActionsContain(patch, "memory_get"))
|
||||
{
|
||||
return "memory_get";
|
||||
}
|
||||
if (ActionsContain(patch, "memory_search") || !string.IsNullOrWhiteSpace(patch["memory_query"]?.ToString()))
|
||||
{
|
||||
return "memory_search";
|
||||
}
|
||||
if (ActionsContain(patch, "lookup_tags") || !string.IsNullOrWhiteSpace(patch["tag_query"]?.ToString()))
|
||||
{
|
||||
return "lookup_tags";
|
||||
}
|
||||
if (ActionsContain(patch, "search_civitai") || !string.IsNullOrWhiteSpace(ExtractSearchQuery(patch)))
|
||||
{
|
||||
return "civitai";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static bool WantsCivitaiSearch(JObject patch) => NextToolHop(patch) == "civitai";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user