From 81b42a2d1bfa663dc349d5922403c9623ddbf32d Mon Sep 17 00:00:00 2001 From: tfarcraw <123211521@163.com> Date: Mon, 9 Nov 2026 20:32:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=EF=BC=9A=E5=9C=A8=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E7=95=8C=E9=9D=A2=E6=98=BE=E7=A4=BA=E5=AE=9E=E9=99=85?= =?UTF-8?q?=E6=8E=A8=E7=90=86=E8=AE=BE=E5=A4=87=E4=BB=A5=E8=AF=86=E5=88=AB?= =?UTF-8?q?=20CPU=20=E5=9B=9E=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SopHelper.Avalonia/VVMs/SopPage/SopPage.axaml | 3 ++- src/SopHelper.Avalonia/VVMs/SopPage/SopPageViewModel.cs | 6 +++++- tests/Avalonia.Smoke/Program.cs | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/SopHelper.Avalonia/VVMs/SopPage/SopPage.axaml b/src/SopHelper.Avalonia/VVMs/SopPage/SopPage.axaml index b7685ff..16e8326 100644 --- a/src/SopHelper.Avalonia/VVMs/SopPage/SopPage.axaml +++ b/src/SopHelper.Avalonia/VVMs/SopPage/SopPage.axaml @@ -68,6 +68,7 @@ + @@ -151,4 +152,4 @@ - \ No newline at end of file + diff --git a/src/SopHelper.Avalonia/VVMs/SopPage/SopPageViewModel.cs b/src/SopHelper.Avalonia/VVMs/SopPage/SopPageViewModel.cs index 7b72d6a..7954517 100644 --- a/src/SopHelper.Avalonia/VVMs/SopPage/SopPageViewModel.cs +++ b/src/SopHelper.Avalonia/VVMs/SopPage/SopPageViewModel.cs @@ -211,6 +211,9 @@ public class SopPageViewModel : ViewModelBase set { SetProperty(ref _inferenceText, value); } } + /// 实际推理设备,CPU 回退时直接显示在运行界面。 + public string InferenceBackendText => $"手部:{_pipeline.HandBackend};目标:{_pipeline.YoloBackend}"; + /// 是否运行中 public bool IsRunning { @@ -637,7 +640,8 @@ public class SopPageViewModel : ViewModelBase RequireGpu = OperatingSystem.IsLinux(), }; - _pipeline.LoadModels(options); + try { _pipeline.LoadModels(options); } + finally { RaisePropertyChanged(nameof(InferenceBackendText)); } ActiveRecipe = SelectedRecipe; Log("info", $"推理设备:手部={_pipeline.HandBackend},YOLO={_pipeline.YoloBackend}"); diff --git a/tests/Avalonia.Smoke/Program.cs b/tests/Avalonia.Smoke/Program.cs index e989ee8..a295440 100644 --- a/tests/Avalonia.Smoke/Program.cs +++ b/tests/Avalonia.Smoke/Program.cs @@ -83,6 +83,9 @@ internal static class Smoke sop.SelectedRecipe="pending.yaml"; Check(sop.ActiveRecipe==applied,"Unapplied recipe selection does not change current recipe"); navigation.SelectedIndex=0;await Task.Delay(80); + Check(window.GetVisualDescendants().OfType().Any(t=>t.Name=="InferenceBackend"&&t.Text==sop.InferenceBackendText) + &&sop.InferenceBackendText.Contains("手部:")&&sop.InferenceBackendText.Contains("目标:"), + "Operator page displays the actual inference backends, including CPU fallback"); Check(window.GetVisualDescendants().OfType().Single().GetVisualDescendants().OfType().Any(t=>t.Text=="pending.yaml"),"Operator page updates to the selected recipe without applying or starting"); sop.SelectedRecipe=selected;await Task.Delay(80); Check(window.GetVisualDescendants().OfType().Single().GetVisualDescendants().OfType().Any(t=>t.Text==selected),"Recipe selection changes notify the operator page immediately");