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:
@@ -173,6 +173,75 @@ public partial class SwarmAssistentExtension
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<JObject> AssistentSearchMemory(Session session, string query, string kind = null, int limit = 10, string persona = null, string baseUrl = null, string embed_model = null)
|
||||
{
|
||||
if (Memory is null)
|
||||
{
|
||||
return new JObject { ["error"] = "memory not ready" };
|
||||
}
|
||||
query = (query ?? "").Trim();
|
||||
if (query.Length < 2)
|
||||
{
|
||||
return new JObject { ["error"] = "query required" };
|
||||
}
|
||||
string pid = AssistentConfig.SafeId(persona) ?? Config.DefaultPersonaId();
|
||||
try
|
||||
{
|
||||
JArray rows = await Memory.SearchAsync(MemoryBaseUrl(baseUrl), query, kind, limit, MemoryEmbedModel(embed_model), Config.PersonaExtendsChain(pid));
|
||||
return new JObject { ["success"] = true, ["query"] = query, ["kind"] = kind ?? "", ["memories"] = rows };
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new JObject { ["error"] = $"memory search: {ex.Message}" };
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<JObject> AssistentGetMemory(Session session, string kind, string key, string persona = null)
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
if (Memory is null)
|
||||
{
|
||||
return new JObject { ["error"] = "memory not ready" };
|
||||
}
|
||||
string pid = AssistentConfig.SafeId(persona) ?? Config.DefaultPersonaId();
|
||||
JObject row = Memory.Get(kind, key, Config.PersonaExtendsChain(pid));
|
||||
if (row is null)
|
||||
{
|
||||
return new JObject { ["success"] = true, ["missing"] = true, ["kind"] = kind, ["key"] = key };
|
||||
}
|
||||
return new JObject { ["success"] = true, ["memory"] = row };
|
||||
}
|
||||
|
||||
public async Task<JObject> AssistentLookupTags(Session session, string query, int limit = 20)
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
if (Memory is null)
|
||||
{
|
||||
return new JObject { ["error"] = "memory not ready" };
|
||||
}
|
||||
query = (query ?? "").Trim();
|
||||
if (query.Length < 1)
|
||||
{
|
||||
return new JObject { ["error"] = "query required" };
|
||||
}
|
||||
try
|
||||
{
|
||||
JArray tags = Memory.LookupTags(query, limit);
|
||||
return new JObject
|
||||
{
|
||||
["success"] = true,
|
||||
["query"] = query,
|
||||
["tags"] = tags,
|
||||
["indexed"] = Memory.TagCount(),
|
||||
["csv"] = Memory.FindAutocompleteCsv() ?? "",
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new JObject { ["error"] = $"tag lookup: {ex.Message}" };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The gpu-rent wanted queue (models pending the next <c>up</c>) — count + entries.</summary>
|
||||
public async Task<JObject> AssistentListWanted(Session session)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user