From 72a2a07a8826ad8804f1051b91e21c1c73abd770 Mon Sep 17 00:00:00 2001 From: Anran Zhang Date: Mon, 24 Jun 2024 13:55:35 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E5=8A=A9=E7=90=86=E5=89=AF=E6=9C=AC?= 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 | 3 +++ .../Resources/zh-Hans-CN/Resources.resw | 3 +++ .../ChatServicePageViewModel.Agents.cs | 24 +++++++++++++++++++ 5 files changed, 44 insertions(+) diff --git a/src/Desktop/RodelAgent.UI/Controls/Chat/AgentsSection.xaml b/src/Desktop/RodelAgent.UI/Controls/Chat/AgentsSection.xaml index 7c82f408..f4f091b2 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 86ad2155..1fcedcf3 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 96c5bb65..bc4e76f9 100644 --- a/src/Desktop/RodelAgent.UI/Resources/en-US/Resources.resw +++ b/src/Desktop/RodelAgent.UI/Resources/en-US/Resources.resw @@ -363,6 +363,9 @@ Create + + Create copy + Create custom model 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 07126c2b..422b5719 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 7c2e0271..6d53d53d 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) { From b831513cf7b61522a62d65c629efa745aa13f123 Mon Sep 17 00:00:00 2001 From: Anran Zhang Date: Mon, 24 Jun 2024 13:59:51 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=8B=B1=E6=96=87?= =?UTF-8?q?=E7=BF=BB=E8=AF=91=E6=96=87=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Desktop/RodelAgent.UI/Resources/en-US/Resources.resw | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Desktop/RodelAgent.UI/Resources/en-US/Resources.resw b/src/Desktop/RodelAgent.UI/Resources/en-US/Resources.resw index bc4e76f9..6fa579fb 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! @@ -614,7 +614,7 @@ You can manually adjust the limit, and the application will capture the specifie Modify - Modify assistant + Modify agent Modify custom model @@ -665,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~