增加使用当前配置的编辑器模型列表实连诊断
This commit is contained in:
parent
c718b4f0fa
commit
73682cea57
@ -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 仍受支持。
|
||||
|
||||
@ -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<TabControl>().First().SelectedIndex=4;
|
||||
view.FindControl<Expander>("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<NavigationModel>();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user