From 99af30ea77aa766e67307f8f6e78155093746298 Mon Sep 17 00:00:00 2001 From: Richasy Date: Mon, 24 Jun 2024 14:31:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=9F=BA=E4=BA=8E=E7=8E=B0?= =?UTF-8?q?=E6=9C=89=E5=8A=A9=E7=90=86=E5=88=9B=E5=BB=BA=E5=89=AF=E6=9C=AC?= =?UTF-8?q?=20(#20)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 支持创建助理副本 * 修正英文翻译文本 --- .../Controls/Chat/AgentsSection.xaml | 5 ++++ .../Controls/Chat/AgentsSection.xaml.cs | 9 +++++++ .../Resources/en-US/Resources.resw | 11 +++++---- .../Resources/zh-Hans-CN/Resources.resw | 3 +++ .../ChatServicePageViewModel.Agents.cs | 24 +++++++++++++++++++ 5 files changed, 48 insertions(+), 4 deletions(-) diff --git a/src/Desktop/RodelAgent.UI/Controls/Chat/AgentsSection.xaml b/src/Desktop/RodelAgent.UI/Controls/Chat/AgentsSection.xaml index 7c82f40..f4f091b 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Chat/AgentsSection.xaml +++ b/src/Desktop/RodelAgent.UI/Controls/Chat/AgentsSection.xaml @@ -39,6 +39,11 @@ + + + + + diff --git a/src/Desktop/RodelAgent.UI/Controls/Chat/AgentsSection.xaml.cs b/src/Desktop/RodelAgent.UI/Controls/Chat/AgentsSection.xaml.cs index 86ad215..1fcedcf 100644 --- a/src/Desktop/RodelAgent.UI/Controls/Chat/AgentsSection.xaml.cs +++ b/src/Desktop/RodelAgent.UI/Controls/Chat/AgentsSection.xaml.cs @@ -32,4 +32,13 @@ private void OnEditItemClick(object sender, RoutedEventArgs e) ViewModel.EditAgentCommand.Execute(vm); } } + + private void OnCreateCopyItemClick(object sender, RoutedEventArgs e) + { + var vm = (sender as FrameworkElement)?.DataContext as ViewModels.Items.ChatPresetItemViewModel; + if (vm != null) + { + ViewModel.CreateAgentCopyCommand.Execute(vm); + } + } } diff --git a/src/Desktop/RodelAgent.UI/Resources/en-US/Resources.resw b/src/Desktop/RodelAgent.UI/Resources/en-US/Resources.resw index 96c5bb6..6fa579f 100644 --- a/src/Desktop/RodelAgent.UI/Resources/en-US/Resources.resw +++ b/src/Desktop/RodelAgent.UI/Resources/en-US/Resources.resw @@ -256,7 +256,7 @@ Keep plugin - Unable to load the assistant. The corresponding service may have been deregistered. Please check and try again. + Unable to load the agent. The corresponding service may have been deregistered. Please check and try again. Unable to load the local model. The model may have been deleted or the default preset is missing. Please try deleting and re-importing the model. @@ -286,7 +286,7 @@ Conversation turn - Choose a service or assistant + Choose a service or agent Start a constructive conversation! @@ -363,6 +363,9 @@ Create + + Create copy + Create custom model @@ -611,7 +614,7 @@ You can manually adjust the limit, and the application will capture the specifie Modify - Modify assistant + Modify agent Modify custom model @@ -662,7 +665,7 @@ You can manually adjust the limit, and the application will capture the specifie Next step - No available assistants + No available agents No audio records yet, go generate one~ diff --git a/src/Desktop/RodelAgent.UI/Resources/zh-Hans-CN/Resources.resw b/src/Desktop/RodelAgent.UI/Resources/zh-Hans-CN/Resources.resw index 07126c2..422b571 100644 --- a/src/Desktop/RodelAgent.UI/Resources/zh-Hans-CN/Resources.resw +++ b/src/Desktop/RodelAgent.UI/Resources/zh-Hans-CN/Resources.resw @@ -363,6 +363,9 @@ 创建 + + 创建副本 + 创建自定义模型 diff --git a/src/Desktop/RodelAgent.UI/ViewModels/Pages/ChatServicePageViewModel/ChatServicePageViewModel.Agents.cs b/src/Desktop/RodelAgent.UI/ViewModels/Pages/ChatServicePageViewModel/ChatServicePageViewModel.Agents.cs index 7c2e027..6d53d53 100644 --- a/src/Desktop/RodelAgent.UI/ViewModels/Pages/ChatServicePageViewModel/ChatServicePageViewModel.Agents.cs +++ b/src/Desktop/RodelAgent.UI/ViewModels/Pages/ChatServicePageViewModel/ChatServicePageViewModel.Agents.cs @@ -66,6 +66,30 @@ private async Task AddAgentAsync() IsAgentsEmpty = AgentPresets.Count == 0; } + [RelayCommand] + private async Task CreateAgentCopyAsync(ChatPresetItemViewModel presetVM) + { + var tempAgent = presetVM.Data.Clone(); + tempAgent.Id = Guid.NewGuid().ToString("N"); + + var vm = new ChatPresetItemViewModel(tempAgent); + _presetModuleVM.SetData(vm, ChatSessionPresetType.Agent); + var dialog = new ChatPresetSettingsDialog(); + await dialog.ShowAsync(); + + var preset = dialog.ViewModel.Data; + if (preset is not null && !_presetModuleVM.IsManualClose) + { + if (!AgentPresets.Any(p => p.Data.Id == preset.Data.Id)) + { + AgentPresets.Add(new ChatPresetItemViewModel(preset.Data)); + await _storageService.AddOrUpdateChatAgentAsync(preset.Data); + } + } + + IsAgentsEmpty = AgentPresets.Count == 0; + } + [RelayCommand] private async Task SetSelectedAgentAsync(ChatPresetItemViewModel presetVM) {