Ship Assistent 0.10.13: ordinary pack, senior chat default, aspect/critique fixes, prose UI.
Default pack is Обычный; prefer default_chat/senior Ollama tag; client-apply same-but-aspect; leave critique pack after hops; render Critique as Критика instead of raw ### markdown. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+46
-4
@@ -96,12 +96,18 @@ public partial class SwarmAssistentExtension
|
||||
|| n.StartsWith(fallback.Split(':')[0], StringComparison.OrdinalIgnoreCase)));
|
||||
}
|
||||
}
|
||||
string preferred = roles["default_chat"]?.ToString()?.Trim() ?? "";
|
||||
if (string.IsNullOrWhiteSpace(preferred) || !models.Any(t => string.Equals(t.ToString(), preferred, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
preferred = PickSeniorChatModel(models.Select(t => t.ToString()).ToList());
|
||||
}
|
||||
return new JObject
|
||||
{
|
||||
["success"] = true,
|
||||
["base_url"] = root,
|
||||
["models"] = models,
|
||||
["memory_models"] = memoryModels,
|
||||
["preferred"] = preferred ?? "",
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -116,6 +122,40 @@ public partial class SwarmAssistentExtension
|
||||
return n.Contains("embed") || n.Contains("nomic") || n.Contains("bge-") || n.Contains("minilm") || n.Contains("e5-");
|
||||
}
|
||||
|
||||
/// <summary>Prefer larger param tags (32b > 8b > 7b), then instruct / qwen3.</summary>
|
||||
static string PickSeniorChatModel(IList<string> names)
|
||||
{
|
||||
if (names is null || names.Count == 0)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return names.OrderByDescending(ChatModelSeniority).ThenBy(n => n, StringComparer.OrdinalIgnoreCase).First();
|
||||
}
|
||||
|
||||
static long ChatModelSeniority(string name)
|
||||
{
|
||||
string n = (name ?? "").ToLowerInvariant();
|
||||
long score = 0;
|
||||
System.Text.RegularExpressions.Match m = System.Text.RegularExpressions.Regex.Match(n, @"(?:^|[:\-/])(\d+)\s*b\b");
|
||||
if (m.Success && long.TryParse(m.Groups[1].Value, out long bil))
|
||||
{
|
||||
score += bil * 1_000_000;
|
||||
}
|
||||
if (n.Contains("instruct"))
|
||||
{
|
||||
score += 50_000;
|
||||
}
|
||||
if (n.Contains("qwen3"))
|
||||
{
|
||||
score += 20_000;
|
||||
}
|
||||
if (n.Contains("thinking") || n.EndsWith(":latest"))
|
||||
{
|
||||
score -= 10_000;
|
||||
}
|
||||
return score;
|
||||
}
|
||||
|
||||
async Task<(string reply, JObject raw)> CallOllamaChat(
|
||||
string root,
|
||||
string modelName,
|
||||
@@ -239,11 +279,11 @@ public partial class SwarmAssistentExtension
|
||||
{
|
||||
return new JObject { ["error"] = invalid };
|
||||
}
|
||||
string packName = (pack ?? "write_prompt").Trim();
|
||||
string packName = (pack ?? "ordinary").Trim();
|
||||
string embedModel = raw?["embed_model"]?.ToString() ?? Config.LoadSettings()["embed_model"]?.ToString();
|
||||
try
|
||||
{
|
||||
(string reply, JObject parsed, JArray civitai, int systemChars) = await RunChatWithHops(
|
||||
(string reply, JObject parsed, JArray civitai, int systemChars, JObject systemLayers) = await RunChatWithHops(
|
||||
session, root, modelName, packName, includeBase, contextJson, userMessages, personaId: persona, skillIds: skills, embedModel: embedModel);
|
||||
return new JObject
|
||||
{
|
||||
@@ -255,6 +295,7 @@ public partial class SwarmAssistentExtension
|
||||
["raw"] = parsed,
|
||||
["civitai_results"] = civitai,
|
||||
["system_chars"] = systemChars,
|
||||
["system_layers"] = systemLayers,
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -275,7 +316,7 @@ public partial class SwarmAssistentExtension
|
||||
await ws.SendJson(new JObject { ["error"] = invalid }, API.WebsocketTimeout);
|
||||
return null;
|
||||
}
|
||||
string packName = (pack ?? "write_prompt").Trim();
|
||||
string packName = (pack ?? "ordinary").Trim();
|
||||
string embedModel = raw?["embed_model"]?.ToString() ?? Config.LoadSettings()["embed_model"]?.ToString();
|
||||
try
|
||||
{
|
||||
@@ -306,7 +347,7 @@ public partial class SwarmAssistentExtension
|
||||
}, API.WebsocketTimeout);
|
||||
}
|
||||
}
|
||||
(string reply, JObject parsed, JArray civitai, int systemChars) = await RunChatWithHops(
|
||||
(string reply, JObject parsed, JArray civitai, int systemChars, JObject systemLayers) = await RunChatWithHops(
|
||||
session, root, modelName, packName, includeBase, contextJson, userMessages, OnDelta, OnHopStart, persona, skills, embedModel);
|
||||
await ws.SendJson(new JObject
|
||||
{
|
||||
@@ -319,6 +360,7 @@ public partial class SwarmAssistentExtension
|
||||
["raw"] = parsed,
|
||||
["civitai_results"] = civitai,
|
||||
["system_chars"] = systemChars,
|
||||
["system_layers"] = systemLayers,
|
||||
}, API.WebsocketTimeout);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user