From 73682cea579b9f154f65362261dacb76c99939bf Mon Sep 17 00:00:00 2001 From: tfarcraw <123211521@163.com> Date: Fri, 13 Nov 2026 16:57:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BD=BF=E7=94=A8=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E9=85=8D=E7=BD=AE=E7=9A=84=E7=BC=96=E8=BE=91=E5=99=A8?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E5=88=97=E8=A1=A8=E5=AE=9E=E8=BF=9E=E8=AF=8A?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HAND_AI.md | 2 ++ tests/Avalonia.Smoke/Program.cs | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/HAND_AI.md b/HAND_AI.md index eb5fa3f..824a635 100644 --- a/HAND_AI.md +++ b/HAND_AI.md @@ -28,6 +28,8 @@ ## 配置接口 +模型列表实连诊断可运行 `dotnet run --project tests/Avalonia.Smoke -- --agent-settings-file 设置文件路径`,传入当前工作区的 `workspace/sop-agent.json`。它复制设置到临时工作区,通过真实编辑器和 HTTP 客户端获取模型列表,输出状态和模型名,不输出密钥、不改原设置,结束后删除临时数据。 + ### 当前版本:本机 D3-lite 本分支默认 `d3-lite` 后端、`http://127.0.0.1:8766/v1/systemone`。不设置模型名或密钥也可连接本机服务;显式的 Laya / Chat Completions provider 仍受支持。 diff --git a/tests/Avalonia.Smoke/Program.cs b/tests/Avalonia.Smoke/Program.cs index 0890a59..005c0ef 100644 --- a/tests/Avalonia.Smoke/Program.cs +++ b/tests/Avalonia.Smoke/Program.cs @@ -28,6 +28,7 @@ internal static class Smoke private static bool _visionOnly; private static bool _processImagesOnly; private static bool _recipeSelectionOnly; + private static string? _agentSettingsFile; private static readonly FakeCamera Camera=new(); [STAThread] public static int Main(string[] args) @@ -35,9 +36,20 @@ internal static class Smoke _visionOnly=args.Contains("--vision-only"); _processImagesOnly=args.Contains("--process-images-only"); _recipeSelectionOnly=args.Contains("--recipe-selection-only"); + var agentSettingsIndex=Array.IndexOf(args,"--agent-settings-file"); + if(agentSettingsIndex>=0) + { + if(agentSettingsIndex+1>=args.Length)throw new ArgumentException("--agent-settings-file 后需提供设置文件路径"); + _agentSettingsFile=Path.GetFullPath(args[agentSettingsIndex+1]); + } var previousRoot=Environment.GetEnvironmentVariable("SOPHELPER_WORKSPACE_ROOT"); var dataRoot=Path.Combine(Path.GetTempPath(),"sophelper-layout-smoke-"+Guid.NewGuid().ToString("N")); Directory.CreateDirectory(dataRoot); + if(_agentSettingsFile is not null) + { + Directory.CreateDirectory(Path.Combine(dataRoot,"workspace")); + File.Copy(_agentSettingsFile,Path.Combine(dataRoot,"workspace","sop-agent.json")); + } Environment.SetEnvironmentVariable("SOPHELPER_WORKSPACE_ROOT",dataRoot); var settingsPath=Path.Combine(dataRoot,"workspace","settings.json"); var settingsBefore=File.Exists(settingsPath)?File.ReadAllBytes(settingsPath):null; @@ -72,6 +84,20 @@ internal static class Smoke var userCameraBefore=File.Exists(userCameraPath)?File.ReadAllBytes(userCameraPath):null; await Task.Delay(150); var app=(App)Application.Current!;var window=lifetime.MainWindow!; + if(_agentSettingsFile is not null) + { + var model=new RecipeEditorViewModel(); + var view=new RecipeEditor{DataContext=model}; + var dialog=new Window{Width=1040,Height=900,Content=view};dialog.Show(); + model.OnDialogOpened(new DialogParameters{{"new",true}}); + view.GetVisualDescendants().OfType().First().SelectedIndex=4; + view.FindControl("AgentSettingsExpander")!.IsExpanded=true; + model.FetchAgentModelsCommand.Execute(); + for(var i=0;i<180&&model.AgentModels.Count==0;i++)await Task.Delay(100); + Check(model.AgentModels.Count>0,"Live editor model discovery: "+model.AgentStatus); + Console.WriteLine("Models: "+string.Join(", ",model.AgentModels)); + await model.ShutdownAsync();dialog.Close();_exit=0;return; + } CheckCameraPreferences(app); CheckRecipePreferences(app); var navigation=app.Container.Resolve();