diff --git a/AIChatPanel.xaml.cs b/AIChatPanel.xaml.cs index 60ffe51..100f245 100644 --- a/AIChatPanel.xaml.cs +++ b/AIChatPanel.xaml.cs @@ -97,6 +97,7 @@ namespace AnotherReplayReader // 外部注入:每次请求前调用获取最新配置 // 委托类型变更 public Func? GetRequestContext { get; set; } + public Func? GetPromptSettings { get; set; } // ---------- methods ---------- @@ -248,7 +249,7 @@ namespace AnotherReplayReader FinishCurrentContent(); var requestContext = GetRequestContext(); - var systemPrompt = AIAnalyze.GetSystemPrompt(replay, players); + var systemPrompt = AIAnalyze.GetSystemPrompt(replay, players, GetPromptSettings?.Invoke()); var userPrompt = AIAnalyze.BuildUserPrompt(replay.Mod, players, replayData, out var userPromptPrefix); AppendLog($"让 AI 了解录像...", userPromptPrefix @@ -358,6 +359,14 @@ namespace AnotherReplayReader requestContext, OnChunk, _linkedCts.Token); + var validationResult = AIAnalysisValidation.ValidateMachineReadableClaims(segmentResult.Response); + if (validationResult.HasIssues) + { + AppendLog( + $"第{segmentIndex}段机器可读声明检查", + AIAnalysisValidation.FormatIssues(validationResult.Issues), + false); + } _lastSuccessfulSegment = lastState.CurrentSegment; lastState = segmentResult.State; UpdateTokenDisplay(segmentResult); @@ -831,4 +840,4 @@ namespace AnotherReplayReader return $"{n / m:0.#}{(binary ? "Mi" : "M")}{unit}"; } } -} \ No newline at end of file +} diff --git a/AIProviderSettingsControl.xaml b/AIProviderSettingsControl.xaml index 765814f..9b90ed5 100644 --- a/AIProviderSettingsControl.xaml +++ b/AIProviderSettingsControl.xaml @@ -32,6 +32,7 @@ + @@ -69,8 +70,58 @@ + + + + + + + + + + + + + + + +