From 9c5d19abbdfa30ccd2b84fdbbf0aafdf0bdcf5c3 Mon Sep 17 00:00:00 2001 From: status102 <102887808+status102@users.noreply.github.com> Date: Mon, 24 Feb 2025 19:50:59 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E8=87=AA=E5=8A=A8=E6=88=98=E6=96=97?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=B1=BB=E5=9E=8B=E6=A0=A1=E9=AA=8C=E8=A1=A5?= =?UTF-8?q?=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [skip changelog] --- src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs b/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs index 80e292c315..834894d2c4 100644 --- a/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs +++ b/src/MaaWpfGui/ViewModels/UI/CopilotViewModel.cs @@ -223,7 +223,7 @@ namespace MaaWpfGui.ViewModels.UI } } - private string _userAdditional = ConfigurationHelper.GetValue(ConfigurationKeys.CopilotUserAdditional, string.Empty); + private string _userAdditional = ConfigurationHelper.GetValue(ConfigurationKeys.CopilotUserAdditional, string.Empty).Replace(",", ",").Replace(";", ";").Trim(); /// /// Gets or sets a value indicating whether to use auto-formation. @@ -233,6 +233,7 @@ namespace MaaWpfGui.ViewModels.UI get => _userAdditional; set { + value = value.Replace(",", ",").Replace(";", ";").Trim(); SetAndNotify(ref _userAdditional, value); ConfigurationHelper.SetValue(ConfigurationKeys.CopilotUserAdditional, value); } @@ -1121,7 +1122,7 @@ namespace MaaWpfGui.ViewModels.UI return; } - if (UseCopilotList && !await VerifyCopilotListTask()) + if (_taskType == AsstTaskType.Copilot && UseCopilotList && !await VerifyCopilotListTask()) { // 校验作业合法性 _runningState.SetIdle(true); @@ -1148,7 +1149,6 @@ namespace MaaWpfGui.ViewModels.UI return; } - UserAdditional = UserAdditional.Replace(",", ",").Replace(";", ";").Trim(); Regex regex = new Regex(@"(?<=;)(?[^,;]+)(?:, *(?\d))?(?=;)", RegexOptions.Compiled); JArray userAdditional = new(regex.Matches(";" + UserAdditional + ";").ToList().Select(match => new JObject { @@ -1274,12 +1274,10 @@ namespace MaaWpfGui.ViewModels.UI private async Task VerifyCopilotListTask() { var list = CopilotItemViewModels.Where(i => i.IsChecked); - /* if (list.Any(i => string.IsNullOrEmpty(i.Name.Trim()))) { - _runningState.SetIdle(false); - return; - }*/ + return false; + } var stageNames = list.Select(i => i.FilePath).ToHashSet().Select(async path => {