From f5f3adad10503f3a5d5f04fde1fd2ed199e4c3c4 Mon Sep 17 00:00:00 2001
From: tfarcraw <123211521@163.com>
Date: Thu, 19 Nov 2026 02:39:01 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BE=9B=E5=8F=AF=E5=A4=8D=E7=8E=B0?=
=?UTF-8?q?=E5=AE=9E=E6=B5=8B=E5=8F=82=E6=95=B0=E7=9A=84=E6=97=B6=E5=BA=8F?=
=?UTF-8?q?=E6=A8=A1=E5=9E=8B=E6=80=9D=E8=80=83=E5=BC=80=E5=85=B3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Training/DesktopSequenceVisionClient.cs | 4 +++-
src/SopHelper.Avalonia/VVMs/RecipeEditor/RecipeEditor.axaml | 3 ++-
.../VVMs/RecipeEditor/SopVideoAgentViewModel.cs | 6 +++++-
tests/VideoFlowTest.Smoke/AgentDraftVerificationChecks.cs | 3 +++
tests/VisionDecision.Smoke/SequenceProtocolTests.cs | 5 ++++-
5 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/src/SopHelper.Avalonia/Training/DesktopSequenceVisionClient.cs b/src/SopHelper.Avalonia/Training/DesktopSequenceVisionClient.cs
index 520e939..96baa10 100644
--- a/src/SopHelper.Avalonia/Training/DesktopSequenceVisionClient.cs
+++ b/src/SopHelper.Avalonia/Training/DesktopSequenceVisionClient.cs
@@ -29,7 +29,9 @@ public sealed class DesktopSequenceVisionClient(HttpClient http) : IVisionDecisi
if (root.TryGetProperty("useForSequence", out var enabled) && enabled.GetBoolean())
_client = new(http, new(root.GetProperty("endpoint").GetString() ?? "",
root.GetProperty("model").GetString() ?? "",
- root.TryGetProperty("apiKey", out var key) ? key.GetString() ?? "" : ""));
+ root.TryGetProperty("apiKey", out var key) ? key.GetString() ?? "" : "",
+ root.TryGetProperty("sequenceEnableThinking", out var thinking) && thinking.ValueKind != JsonValueKind.Null
+ ? thinking.GetBoolean() : null));
}
catch (Exception error) when (error is IOException or UnauthorizedAccessException or JsonException or InvalidOperationException or KeyNotFoundException)
{ _client = new(http, new("", "")); }
diff --git a/src/SopHelper.Avalonia/VVMs/RecipeEditor/RecipeEditor.axaml b/src/SopHelper.Avalonia/VVMs/RecipeEditor/RecipeEditor.axaml
index c30498b..19c72b4 100644
--- a/src/SopHelper.Avalonia/VVMs/RecipeEditor/RecipeEditor.axaml
+++ b/src/SopHelper.Avalonia/VVMs/RecipeEditor/RecipeEditor.axaml
@@ -195,7 +195,7 @@
-
+
@@ -514,6 +514,7 @@
+
diff --git a/src/SopHelper.Avalonia/VVMs/RecipeEditor/SopVideoAgentViewModel.cs b/src/SopHelper.Avalonia/VVMs/RecipeEditor/SopVideoAgentViewModel.cs
index d8d2cec..86013b6 100644
--- a/src/SopHelper.Avalonia/VVMs/RecipeEditor/SopVideoAgentViewModel.cs
+++ b/src/SopHelper.Avalonia/VVMs/RecipeEditor/SopVideoAgentViewModel.cs
@@ -24,6 +24,8 @@ public partial class RecipeEditorViewModel
private bool _isAgentBusy, _draftApplied;
private bool _agentSettingsLoaded, _agentUseForSequence;
public bool AgentUseForSequence { get => _agentUseForSequence; set { if (SetProperty(ref _agentUseForSequence, value)) SaveAgentSettings(); } }
+ private bool? _agentSequenceEnableThinking;
+ public bool? AgentSequenceEnableThinking { get => _agentSequenceEnableThinking; set { if (SetProperty(ref _agentSequenceEnableThinking, value)) SaveAgentSettings(); } }
private string _agentEndpoint = "", _agentModel = "", _agentApiKey = "", _agentVideoPath = "", _agentInstructions = "";
private string _agentStatus = "", _agentSummary = "";
private int _agentMaxFrames = 3;
@@ -118,6 +120,7 @@ public partial class RecipeEditorViewModel
AgentApiKey = document.RootElement.TryGetProperty("apiKey", out var key) ? key.GetString() ?? "" : "";
var root = document.RootElement;
if (root.TryGetProperty("useForSequence", out var sequence)) AgentUseForSequence = sequence.GetBoolean();
+ if (root.TryGetProperty("sequenceEnableThinking", out var thinking)) AgentSequenceEnableThinking = thinking.ValueKind == JsonValueKind.Null ? null : thinking.GetBoolean();
if (root.TryGetProperty("maxFrames", out var frames)) AgentMaxFrames = frames.GetInt32();
if (root.TryGetProperty("contextLength", out var context)) AgentContextLength = context.GetInt32();
if (root.TryGetProperty("maxTokens", out var output)) AgentMaxTokens = output.GetInt32();
@@ -146,7 +149,8 @@ public partial class RecipeEditorViewModel
if (!OperatingSystem.IsWindows()) options.UnixCreateMode = UnixFileMode.UserRead | UnixFileMode.UserWrite;
using (var stream = new FileStream(temporary, options))
JsonSerializer.Serialize(stream, new { endpoint = AgentEndpoint, model = AgentModel, apiKey = AgentApiKey,
- useForSequence = AgentUseForSequence, maxFrames = AgentMaxFrames, contextLength = AgentContextLength, maxTokens = AgentMaxTokens,
+ useForSequence = AgentUseForSequence, sequenceEnableThinking = AgentSequenceEnableThinking,
+ maxFrames = AgentMaxFrames, contextLength = AgentContextLength, maxTokens = AgentMaxTokens,
temperature = AgentTemperature, topP = AgentTopP, timeoutSeconds = AgentTimeoutSeconds });
File.Move(temporary, AgentSettingsPath, overwrite: true);
}
diff --git a/tests/VideoFlowTest.Smoke/AgentDraftVerificationChecks.cs b/tests/VideoFlowTest.Smoke/AgentDraftVerificationChecks.cs
index 598f78d..ffd4172 100644
--- a/tests/VideoFlowTest.Smoke/AgentDraftVerificationChecks.cs
+++ b/tests/VideoFlowTest.Smoke/AgentDraftVerificationChecks.cs
@@ -34,6 +34,9 @@ internal static class AgentDraftVerificationChecks
model.SaveCommand.Execute();
var path = store.ConfigPath(config.Sop.Name); var before = File.ReadAllBytes(path);
model.AgentVideoPath = video; model.AgentEndpoint = "http://127.0.0.1:1/v1"; model.AgentModel = "unit-test";
+ model.AgentSequenceEnableThinking = false;
+ using (var saved = System.Text.Json.JsonDocument.Parse(File.ReadAllText(Path.Combine(root, "workspace", "sop-agent.json"))))
+ Check(!saved.RootElement.GetProperty("sequenceEnableThinking").GetBoolean(), "时序思考设置须可持久化,便于复现实测参数");
var view = new RecipeEditor { DataContext = model };
var window = new Window { Width = 1040, Height = 900, Content = view }; window.Show(); window.UpdateLayout();
var tabs = view.GetVisualDescendants().OfType().Single();
diff --git a/tests/VisionDecision.Smoke/SequenceProtocolTests.cs b/tests/VisionDecision.Smoke/SequenceProtocolTests.cs
index d23a8db..987e8ce 100644
--- a/tests/VisionDecision.Smoke/SequenceProtocolTests.cs
+++ b/tests/VisionDecision.Smoke/SequenceProtocolTests.cs
@@ -12,6 +12,9 @@ internal static class SequenceProtocolTests
{
using var body = JsonDocument.Parse(await request.Content!.ReadAsStringAsync(token));
Check(body.RootElement.GetProperty("max_tokens").GetInt32() == 768, "时序接口应限制解释输出预算");
+ Check(mode == "backdated"
+ ? !body.RootElement.GetProperty("chat_template_kwargs").GetProperty("enable_thinking").GetBoolean()
+ : !body.RootElement.TryGetProperty("chat_template_kwargs", out _), "思考开关必须按显式选择发送,默认沿用服务设置");
var parts = body.RootElement.GetProperty("messages")[1].GetProperty("content");
Check(parts.EnumerateArray().Count(p => p.GetProperty("type").GetString() == "image_url") == 3,
"必须发送三张真实证据,不能把时序请求退化为尾图");
@@ -30,7 +33,7 @@ internal static class SequenceProtocolTests
foreach (var mode in new[] { "valid", "backdated", "fabricated", "truncated" })
{
using var http = new HttpClient(new Handler(mode));
- var client = new SequenceVisionDecisionClient(http, new("https://probe.invalid/v1", "test-model"));
+ var client = new SequenceVisionDecisionClient(http, new("https://probe.invalid/v1", "test-model", EnableThinking: mode == "backdated" ? false : null));
var result = await client.DecideAsync(request, default);
Check(result.Completed == (mode is "valid" or "backdated") && (mode is "valid" or "backdated" || result.EffectiveStatus == VisionDecisionStatus.Insufficient),
"缩短输出预算后仍须拒绝虚构帧和被截断的判定");