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:
@@ -466,6 +466,81 @@ public sealed class AssistentConfig
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Drop control keys that merely restate schema defaults while the user already has a
|
||||
/// different saved value — models often echo Exact defaults inside Generate patches and
|
||||
/// that was resetting Хорни / Вкус after every reply.
|
||||
/// Keep intentional changes: non-default values, or default when it matches current, or
|
||||
/// when the patch is controls-only (e.g. /horny-game).
|
||||
/// </summary>
|
||||
public static JObject FilterEchoedControlDefaults(JObject schema, JObject current, JObject incoming, bool patchLooksLikeGen)
|
||||
{
|
||||
JObject result = new();
|
||||
if (schema is null || incoming is null)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
current ??= new JObject();
|
||||
foreach (JProperty prop in incoming.Properties())
|
||||
{
|
||||
if (schema[prop.Name] is not JObject def)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!double.TryParse(prop.Value?.ToString(), System.Globalization.NumberStyles.Float,
|
||||
System.Globalization.CultureInfo.InvariantCulture, out double incomingVal))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
double defVal = def["default"]?.Value<double?>() ?? double.NaN;
|
||||
double curVal = double.NaN;
|
||||
if (current[prop.Name] != null)
|
||||
{
|
||||
double.TryParse(current[prop.Name]?.ToString(), System.Globalization.NumberStyles.Float,
|
||||
System.Globalization.CultureInfo.InvariantCulture, out curVal);
|
||||
}
|
||||
if (!double.IsNaN(curVal) && Math.Abs(incomingVal - curVal) < 0.0005)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (patchLooksLikeGen
|
||||
&& !double.IsNaN(defVal)
|
||||
&& Math.Abs(incomingVal - defVal) < 0.0005
|
||||
&& !double.IsNaN(curVal)
|
||||
&& Math.Abs(curVal - defVal) > 0.0005)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
result[prop.Name] = Math.Round(incomingVal, 4);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static bool PatchLooksLikeGeneration(JObject patch)
|
||||
{
|
||||
if (patch is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (patch["prompt"] != null || patch["loras"] != null || patch["aspect"] != null
|
||||
|| patch["width"] != null || patch["height"] != null || patch["steps"] != null
|
||||
|| patch["cfg"] != null || patch["seed"] != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (patch["actions"] is JArray acts)
|
||||
{
|
||||
foreach (JToken a in acts)
|
||||
{
|
||||
if (string.Equals(a?.ToString(), "generate", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public string RenderControlsBlock(string personaId)
|
||||
{
|
||||
string id = SafeId(personaId) ?? "neutral";
|
||||
|
||||
Reference in New Issue
Block a user