From 9ea046fc7043881b5ad9663ba4dc48845b27ad43 Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Tue, 8 Apr 2025 16:57:55 +0200 Subject: [PATCH] AiConfig: Temperatur, Top_P, Max_Gen_len, selected Model --- BeWo/BeWo.csproj | 8 + .../GeneratedOperationsEnhancedService.cs | 20 +- BeWo/View/Detail/AI/AiConfigView.xaml | 86 +++++ BeWo/View/Detail/AI/AiConfigView.xaml.cs | 28 ++ BeWo/View/Detail/AiConversationChatView.xaml | 10 +- .../Detail/AiConversationChatView.xaml.cs | 38 +-- .../Auslastung/AuslastungReportView2.xaml | 295 +++++++++++++----- BeWo/ViewModel/AbstractDCMapperVM.cs | 13 +- BeWo/ViewModel/AiConfigVM.cs | 106 +++++++ .../ListViewModel/AiConversationListVM.cs | 75 ++++- Data/Data.csproj | 2 + Data/Entities/AiConfig.cs | 24 ++ Data/Mappings/AiConfig.hbm.xml | 23 ++ Model/Changes_2025_04_01 AI Feature.txt | 19 ++ Service/DCEntityMapper/AiConfigDC_AiConfig.cs | 54 ++++ Service/DCEntityMapper/MapperFactory.cs | 1 + Service/Service.csproj | 1 + .../IOperationsEnhancedService.cs | 10 + .../OperationsEnhancedServiceImp.cs | 131 ++++++-- Shared/BeWoEntityEnums.cs | 3 +- Shared/DataContracts/Feature/AI/AiConfigDC.cs | 17 + Shared/DataContracts/Feature/AI/AiModelDC.cs | 2 +- Shared/Shared.csproj | 1 + 23 files changed, 800 insertions(+), 167 deletions(-) create mode 100644 BeWo/View/Detail/AI/AiConfigView.xaml create mode 100644 BeWo/View/Detail/AI/AiConfigView.xaml.cs create mode 100644 BeWo/ViewModel/AiConfigVM.cs create mode 100644 Data/Entities/AiConfig.cs create mode 100644 Data/Mappings/AiConfig.hbm.xml create mode 100644 Service/DCEntityMapper/AiConfigDC_AiConfig.cs create mode 100644 Shared/DataContracts/Feature/AI/AiConfigDC.cs diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj index 6ff40da44..3168b7ccb 100644 --- a/BeWo/BeWo.csproj +++ b/BeWo/BeWo.csproj @@ -95,10 +95,18 @@ + + + AiConfigView.xaml + AnimatedBeWoWindow.xaml + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/BeWo/ServiceProxy/GeneratedOperationsEnhancedService.cs b/BeWo/ServiceProxy/GeneratedOperationsEnhancedService.cs index 9faf67b50..dd57c326e 100644 --- a/BeWo/ServiceProxy/GeneratedOperationsEnhancedService.cs +++ b/BeWo/ServiceProxy/GeneratedOperationsEnhancedService.cs @@ -10,13 +10,19 @@ namespace BeWo.ServiceProxy { - using System.Runtime.Serialization; - [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.ServiceModel.ServiceContractAttribute(ConfigurationName="BeWo.ServiceProxy.IOperationsEnhancedService")] public interface IOperationsEnhancedService { + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsEnhancedService/GetAiConfig", ReplyAction="http://tempuri.org/IOperationsEnhancedService/GetAiConfigResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsEnhancedService/GetAiConfigBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + BS.Shared.DataContracts.Feature.AI.AiConfigDC GetAiConfig(); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsEnhancedService/UpdateAiConfig", ReplyAction="http://tempuri.org/IOperationsEnhancedService/UpdateAiConfigResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsEnhancedService/UpdateAiConfigBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + BS.Shared.DataContracts.Feature.AI.AiConfigDC UpdateAiConfig(BS.Shared.DataContracts.Feature.AI.AiConfigDC toUpdate); + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsEnhancedService/GetAiModels", ReplyAction="http://tempuri.org/IOperationsEnhancedService/GetAiModelsResponse")] [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsEnhancedService/GetAiModelsBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] System.Collections.Generic.List GetAiModels(); @@ -68,6 +74,16 @@ namespace BeWo.ServiceProxy { } + public BS.Shared.DataContracts.Feature.AI.AiConfigDC GetAiConfig() + { + return base.Channel.GetAiConfig(); + } + + public BS.Shared.DataContracts.Feature.AI.AiConfigDC UpdateAiConfig(BS.Shared.DataContracts.Feature.AI.AiConfigDC toUpdate) + { + return base.Channel.UpdateAiConfig(toUpdate); + } + public System.Collections.Generic.List GetAiModels() { return base.Channel.GetAiModels(); diff --git a/BeWo/View/Detail/AI/AiConfigView.xaml b/BeWo/View/Detail/AI/AiConfigView.xaml new file mode 100644 index 000000000..4b149f9a6 --- /dev/null +++ b/BeWo/View/Detail/AI/AiConfigView.xaml @@ -0,0 +1,86 @@ + + + + + + + + + + + + KI Module Einstellungen + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BeWo/View/Detail/AI/AiConfigView.xaml.cs b/BeWo/View/Detail/AI/AiConfigView.xaml.cs new file mode 100644 index 000000000..3b0845552 --- /dev/null +++ b/BeWo/View/Detail/AI/AiConfigView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BeWo.View.Detail.AI +{ + /// + /// Interaktionslogik für AiConfigView.xaml + /// + public partial class AiConfigView : UserControl + { + public AiConfigView() + { + InitializeComponent(); + } + } +} diff --git a/BeWo/View/Detail/AiConversationChatView.xaml b/BeWo/View/Detail/AiConversationChatView.xaml index 24d1ae4cc..8a3409e10 100644 --- a/BeWo/View/Detail/AiConversationChatView.xaml +++ b/BeWo/View/Detail/AiConversationChatView.xaml @@ -13,7 +13,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:t="clr-namespace:BeWo.MultiLanguage.Markup" xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls" - xmlns:viewmodel="clr-namespace:BeWo.ViewModel" + xmlns:viewmodel="clr-namespace:BeWo.ViewModel" xmlns:ai="clr-namespace:BeWo.View.Detail.AI" Width="Auto" Height="Auto" HorizontalAlignment="Stretch" @@ -288,7 +288,9 @@ Height="auto" Placement="Center" StaysOpen="False"> - + + + diff --git a/BeWo/View/Detail/AiConversationChatView.xaml.cs b/BeWo/View/Detail/AiConversationChatView.xaml.cs index d1f099f97..ff395b66d 100644 --- a/BeWo/View/Detail/AiConversationChatView.xaml.cs +++ b/BeWo/View/Detail/AiConversationChatView.xaml.cs @@ -31,10 +31,10 @@ namespace BeWo.View.Detail InitializeComponent(); OpenAiSettingCommand = new DelegateCommand(OpenAiSetting); - ReloadConversationsCommand = new DelegateCommand(ReloadConversations); - ReloadModelsCommand = new DelegateCommand(ReloadModels); ((INotifyCollectionChanged)listbox_messages.Items).CollectionChanged += listbox_conversations_SelectionChanged; + + popup_settings.Closed += (s, e) => ViewModel.UpdateConfig(); } public AiConversationChatView(object o) : this() @@ -49,18 +49,11 @@ namespace BeWo.View.Detail } public DelegateCommand OpenAiSettingCommand { get; set; } - public DelegateCommand ReloadConversationsCommand { get; set; } - public DelegateCommand ReloadModelsCommand { get; set; } private void BeWoView_Loaded(object sender, RoutedEventArgs e) { - ReloadModels(); - ReloadConversations(); - } - - private void ReloadButton_OnClick(object sender, RoutedEventArgs e) - { - ReloadConversations(); + ViewModel.ReloadConfigCommand.Execute(null); + ViewModel.ReloadConversationsCommand.Execute(null); } private void OpenAiSetting() @@ -71,29 +64,10 @@ namespace BeWo.View.Detail popup_settings.IsOpen = true; }, true, this); } - - private void ReloadModels() + + private void Test() { - ServiceFacade.DoOperationsEnhancedServiceAsnyc(x => x.GetAiModels(), (x) => - { - ViewModel.Models.MakeEqualTo(x); - if (ViewModel.SelectedModel is null && ViewModel.Models.Any()) - ViewModel.SelectedModel = ViewModel.Models.First(); - - }, true, this); - } - - private void ReloadConversations() - { - var ui_context = ViewModel.UIContext; - - ServiceFacade.DoOperationsEnhancedServiceAsnyc(x => x.GetAiConversations(ui_context), (x) => - { - x.Reverse(); - var vms = new AiConversationListVM(x); - ViewModel.VMList.MakeEqualTo(vms.VMList); - }, true); } private void listbox_conversations_SelectionChanged(object sender, NotifyCollectionChangedEventArgs e) diff --git a/BeWo/View/Report/Auslastung/AuslastungReportView2.xaml b/BeWo/View/Report/Auslastung/AuslastungReportView2.xaml index 6cc1989dc..b99cf3eee 100644 --- a/BeWo/View/Report/Auslastung/AuslastungReportView2.xaml +++ b/BeWo/View/Report/Auslastung/AuslastungReportView2.xaml @@ -1,98 +1,227 @@ - + - - - - - - - - - - - - - + + + + + + + + + + - - - - - + + + + + + + + - - + + - + - + - - + + - -