AiConfig: Temperatur, Top_P, Max_Gen_len, selected Model
This commit is contained in:
@@ -95,10 +95,18 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Converter\NewlineConverter.cs" />
|
||||
<Compile Include="ViewModel\AiConfigVM.cs" />
|
||||
<Compile Include="View\Detail\AI\AiConfigView.xaml.cs">
|
||||
<DependentUpon>AiConfigView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\TemplateSelectors\AiConversationMessageTemplateSelector.cs" />
|
||||
<Compile Include="View\Windows\AnimatedBeWoWindow.xaml.cs">
|
||||
<DependentUpon>AnimatedBeWoWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="View\Detail\AI\AiConfigView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="View\Windows\AnimatedBeWoWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -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<BS.Shared.DataContracts.Feature.AI.AiModelDC> 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<BS.Shared.DataContracts.Feature.AI.AiModelDC> GetAiModels()
|
||||
{
|
||||
return base.Channel.GetAiModels();
|
||||
|
||||
86
BeWo/View/Detail/AI/AiConfigView.xaml
Normal file
86
BeWo/View/Detail/AI/AiConfigView.xaml
Normal file
@@ -0,0 +1,86 @@
|
||||
<UserControl
|
||||
x:Class="BeWo.View.Detail.AI.AiConfigView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
|
||||
xmlns:listviewmodel="clr-namespace:BeWo.ViewModel.ListViewModel"
|
||||
xmlns:local="clr-namespace:BeWo.View.Detail.AI"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:viewmodel="clr-namespace:BeWo.ViewModel"
|
||||
d:DataContext="{d:DesignInstance Type=listviewmodel:AiConversationListVM}"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="..\..\..\Styles\ModernOrangeBlack.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<Style TargetType="{x:Type Slider}">
|
||||
<Setter Property="Margin" Value="3" />
|
||||
<Setter Property="Height" Value="24" />
|
||||
<Setter Property="Minimum" Value="0" />
|
||||
<Setter Property="Maximum" Value="1" />
|
||||
<Setter Property="SmallChange" Value="0.01" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<GroupBox Style="{StaticResource ObjectEditGroupBox}">
|
||||
<GroupBox.Header>
|
||||
KI Module Einstellungen
|
||||
</GroupBox.Header>
|
||||
|
||||
<Grid HorizontalAlignment="Stretch" Margin="16">
|
||||
<!--<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" SharedSizeGroup="ai1" />
|
||||
<ColumnDefinition Width="100*" MaxWidth="600" />
|
||||
<ColumnDefinition Width="*" SharedSizeGroup="ai1" />
|
||||
</Grid.ColumnDefinitions>-->
|
||||
|
||||
<Grid Grid.Column="1" HorizontalAlignment="Stretch">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" MinWidth="100" />
|
||||
<ColumnDefinition Width="200" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label>
|
||||
Ausgewähltes Modell
|
||||
</Label>
|
||||
<ComboBox
|
||||
Grid.Column="1"
|
||||
ItemsSource="{Binding Models}"
|
||||
SelectedItem="{Binding Config.SelectedModel}" />
|
||||
|
||||
<Label Grid.Row="1" VerticalAlignment="Center">
|
||||
Temperatur
|
||||
</Label>
|
||||
<Slider
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Value="{Binding Config.Temperature}" />
|
||||
|
||||
<Label Grid.Row="2" VerticalAlignment="Center">
|
||||
top__p
|
||||
</Label>
|
||||
<Slider
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Value="{Binding Config.Top_P}" />
|
||||
|
||||
<Label Grid.Row="3">
|
||||
max__gen__len
|
||||
</Label>
|
||||
<dxe:TextEdit
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
EditValue="{Binding Config.Max_Gen_Len}"
|
||||
Style="{StaticResource TextEditNumber}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
</UserControl>
|
||||
28
BeWo/View/Detail/AI/AiConfigView.xaml.cs
Normal file
28
BeWo/View/Detail/AI/AiConfigView.xaml.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für AiConfigView.xaml
|
||||
/// </summary>
|
||||
public partial class AiConfigView : UserControl
|
||||
{
|
||||
public AiConfigView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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">
|
||||
<Grid Margin="5" Background="Orange">
|
||||
<ai:AiConfigView DataContext="{Binding}"/>
|
||||
|
||||
<!--<Grid Margin="5" Background="Orange">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="auto" />
|
||||
@@ -301,8 +303,8 @@
|
||||
<ComboBox
|
||||
Grid.Column="1"
|
||||
ItemsSource="{Binding Models}"
|
||||
SelectedItem="{Binding SelectedModel, Mode=TwoWay}" />
|
||||
</Grid>
|
||||
SelectedItem="{Binding Config.SelectedModel, Mode=TwoWay}" />
|
||||
</Grid>-->
|
||||
</Popup>
|
||||
</Grid>
|
||||
</localView:BeWoView>
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -1,98 +1,227 @@
|
||||
<localView:BeWoView x:Class="BeWo.View.Report.Auslastung.AuslastungReportView2"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:localView="clr-namespace:BeWo.View"
|
||||
xmlns:localSearchView="clr-namespace:BeWo.View.Search"
|
||||
xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls"
|
||||
Height="Auto" Width="Auto" HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch" Focusable="True" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:dxp="http://schemas.devexpress.com/winfx/2008/xaml/printing"
|
||||
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
|
||||
xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup"
|
||||
xmlns:dxpbars="http://schemas.devexpress.com/winfx/2008/xaml/printing/bars"
|
||||
mc:Ignorable="d">
|
||||
<localView:BeWoView
|
||||
x:Class="BeWo.View.Report.Auslastung.AuslastungReportView2"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
|
||||
xmlns:dxp="http://schemas.devexpress.com/winfx/2008/xaml/printing"
|
||||
xmlns:dxpbars="http://schemas.devexpress.com/winfx/2008/xaml/printing/bars"
|
||||
xmlns:localSearchView="clr-namespace:BeWo.View.Search"
|
||||
xmlns:localView="clr-namespace:BeWo.View"
|
||||
xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls"
|
||||
Width="Auto"
|
||||
Height="Auto"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Focusable="True"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<GroupBox Style="{StaticResource ObjectEditGroupBox}" Header="{markup:Translate Mitarbeiterauslastung}" >
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="120" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<GroupBox Header="{markup:Translate Mitarbeiterauslastung}" Style="{StaticResource ObjectEditGroupBox}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="120" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<RadioButton x:Name="radioEmployeeReport" Grid.Column="0" Grid.ColumnSpan="2" Content="{markup:Translate Nach Mitarbeiter auswerten}" GroupName="radioReportType" IsChecked="True" Margin="4,3,0,3" Checked="RadioButton_Checked" Height="22" />
|
||||
<RadioButton x:Name="radioTeamReport" Grid.Column="2" Grid.Row="0" Grid.ColumnSpan="3" GroupName="radioReportType" Content="Nach Team auswerten" Margin="-10,3,0,3" Checked="RadioButton_Checked" />
|
||||
<RadioButton
|
||||
x:Name="radioEmployeeReport"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Height="22"
|
||||
Margin="4,3,0,3"
|
||||
Checked="RadioButton_Checked"
|
||||
Content="{markup:Translate Nach Mitarbeiter auswerten}"
|
||||
GroupName="radioReportType"
|
||||
IsChecked="True" />
|
||||
<RadioButton
|
||||
x:Name="radioTeamReport"
|
||||
Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
Grid.ColumnSpan="3"
|
||||
Margin="-10,3,0,3"
|
||||
Checked="RadioButton_Checked"
|
||||
Content="Nach Team auswerten"
|
||||
GroupName="radioReportType" />
|
||||
|
||||
<CheckBox Margin="3" Name="checkbox_all" Grid.Row="1" Grid.Column="0" IsChecked="False" Content="{markup:Translate Alle Mitarbeiter}" Checked="CheckBox_Checked" Unchecked="CheckBox_Checked" VerticalAlignment="Center"/>
|
||||
<CheckBox
|
||||
Name="checkbox_all"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="3"
|
||||
VerticalAlignment="Center"
|
||||
Checked="CheckBox_Checked"
|
||||
Content="{markup:Translate Alle Mitarbeiter}"
|
||||
IsChecked="False"
|
||||
Unchecked="CheckBox_Checked" />
|
||||
|
||||
<uc:PopUpEdit Grid.Row="1" IsReadOnly="True" Grid.Column="1" Grid.ColumnSpan="3"
|
||||
x:Name="popupedit_employee" DeleteButtonVisibility="Collapsed"
|
||||
Margin="3" Height="22" VerticalAlignment="Top" PopUpClick="popupedit_employee_PopUpClick" Cursor="Arrow" />
|
||||
<uc:PopUpEdit
|
||||
x:Name="popupedit_employee"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="3"
|
||||
Height="22"
|
||||
Margin="3"
|
||||
VerticalAlignment="Top"
|
||||
Cursor="Arrow"
|
||||
DeleteButtonVisibility="Collapsed"
|
||||
IsReadOnly="True"
|
||||
PopUpClick="popupedit_employee_PopUpClick" />
|
||||
|
||||
<CheckBox Grid.Column="0" Grid.Row="1" Margin="3" x:Name="checkbox_all_teams" IsChecked="True" Content="Alle Teams" Checked="CheckBoxAllTeams_Checked" Unchecked="CheckBoxAllTeams_Checked" VerticalAlignment="Center" Visibility="Collapsed" />
|
||||
<uc:PopUpEdit Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="3" IsReadOnly="True" Visibility="Collapsed"
|
||||
x:Name="popupedit_team" DeleteButtonVisibility="Collapsed" PopUpClick="popupedit_team_PopUpClick" HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Left" Height="22" Margin="3" Cursor="Arrow" />
|
||||
<CheckBox
|
||||
x:Name="checkbox_all_teams"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="3"
|
||||
VerticalAlignment="Center"
|
||||
Checked="CheckBoxAllTeams_Checked"
|
||||
Content="Alle Teams"
|
||||
IsChecked="True"
|
||||
Unchecked="CheckBoxAllTeams_Checked"
|
||||
Visibility="Collapsed" />
|
||||
<uc:PopUpEdit
|
||||
x:Name="popupedit_team"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="3"
|
||||
Height="22"
|
||||
Margin="3"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Left"
|
||||
Cursor="Arrow"
|
||||
DeleteButtonVisibility="Collapsed"
|
||||
IsReadOnly="True"
|
||||
PopUpClick="popupedit_team_PopUpClick"
|
||||
Visibility="Collapsed" />
|
||||
|
||||
<!--<uc:PopUpEdit Grid.Row="1" IsReadOnly="True" MinWidth="50" Grid.Column="1" Grid.ColumnSpan="3"
|
||||
<!--<uc:PopUpEdit Grid.Row="1" IsReadOnly="True" MinWidth="50" Grid.Column="1" Grid.ColumnSpan="3"
|
||||
x:Name="popupedit_team" DeleteButtonVisibility="Collapsed"
|
||||
Visibility="{Binding Path=IsChecked, Converter={StaticResource BoolVisibilityHiddenConverter}, ConverterParameter=false, ElementName=checkbox_allTeams}"
|
||||
Margin="3" VerticalAlignment="Top" PopUpClick="popupedit_team_PopUpClick" Cursor="Arrow" />-->
|
||||
|
||||
|
||||
<Label Margin="0 2" Content="Monat" Grid.Row="2" Grid.Column="0" />
|
||||
<ComboBox Height="23" x:Name="combobox_month" Grid.Row="2" Grid.Column="1" Margin="3" VerticalAlignment="Top" Width="90" />
|
||||
<Label
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Margin="0,2"
|
||||
Content="Monat" />
|
||||
<ComboBox
|
||||
x:Name="combobox_month"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Width="90"
|
||||
Height="23"
|
||||
Margin="3"
|
||||
VerticalAlignment="Top" />
|
||||
|
||||
<TextBlock Margin="0 7,3,0" Text=" Jahr" Grid.Row="2" Grid.Column="2" Foreground="Black"/>
|
||||
<ComboBox Height="23" x:Name="combobox_year" Grid.Row="2" Grid.Column="3" VerticalAlignment="Top" Margin="3" Width="60" />
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
Grid.Column="2"
|
||||
Margin="0,7,3,0"
|
||||
Foreground="Black"
|
||||
Text=" Jahr" />
|
||||
<ComboBox
|
||||
x:Name="combobox_year"
|
||||
Grid.Row="2"
|
||||
Grid.Column="3"
|
||||
Width="60"
|
||||
Height="23"
|
||||
Margin="3"
|
||||
VerticalAlignment="Top" />
|
||||
|
||||
<Button Name="button_generate" Grid.Row="3" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Top" FontWeight="Bold" Content="Erstellen" Click="button_generate_Click" Height="23" Margin="3" />
|
||||
<CheckBox Margin="3" Name="checkbox_openInNewWindow" Grid.Row="3" Grid.ColumnSpan="5" Grid.Column="1"
|
||||
IsChecked="False" Content="{markup:Translate In einem neuen Fenster öffnen}" VerticalAlignment="Center" Checked="checkbox_openInNewWindow_Checked" Unchecked="checkbox_openInNewWindow_Checked"/>
|
||||
|
||||
<dxp:DocumentPreviewControl x:Name="docPrevControl" Grid.Row="6" Grid.ColumnSpan="5" Grid.Column="0" Visibility="Collapsed" CommandBarStyle="Bars">
|
||||
<dxp:DocumentPreviewControl.CommandProvider>
|
||||
<dxp:DocumentCommandProvider>
|
||||
<dxp:DocumentCommandProvider.Actions>
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.ExportCsv}"/>
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.ExportMht}"/>
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.ExportTxt}"/>
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.Open}"/>
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.DocumentMap}"/>
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.Watermark}"/>
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.Scale}"/>
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.PrintDirect}"/>
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.PageSetup}"/>
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.Save}"/>
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.Send}"/>
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.Parameters}"/>
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.Thumbnails}"/>
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.EditingFields}"/>
|
||||
</dxp:DocumentCommandProvider.Actions>
|
||||
</dxp:DocumentCommandProvider>
|
||||
</dxp:DocumentPreviewControl.CommandProvider>
|
||||
</dxp:DocumentPreviewControl>
|
||||
|
||||
<Popup Margin="10" Name="popup_employee" StaysOpen="False" Placement="MousePoint" Width="400" Grid.Row="5"
|
||||
Grid.Column="0" Height="400" Closed="popup_Closed" Opened="popup_Opened">
|
||||
<localSearchView:EmployeeSearchView ItemSelected="EmployeeSearchView_EmployeeSelected" x:Name="employeesearchview" />
|
||||
</Popup>
|
||||
<Popup Margin="10" Name="popup_team" StaysOpen="False" Placement="MousePoint" Width="400" Grid.Row="7" Grid.ColumnSpan="5"
|
||||
Grid.Column="0" Height="400" Closed="popup_Closed" Opened="popup_Opened">
|
||||
<localSearchView:TeamSearchView ItemSelected="TeamSearchView_TeamSelected" x:Name="teamsearchview" />
|
||||
</Popup>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
<Button
|
||||
Name="button_generate"
|
||||
Grid.Row="3"
|
||||
Grid.Column="0"
|
||||
Height="23"
|
||||
Margin="3"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Top"
|
||||
Click="button_generate_Click"
|
||||
Content="Erstellen"
|
||||
FontWeight="Bold" />
|
||||
<CheckBox
|
||||
Name="checkbox_openInNewWindow"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="5"
|
||||
Margin="3"
|
||||
VerticalAlignment="Center"
|
||||
Checked="checkbox_openInNewWindow_Checked"
|
||||
Content="{markup:Translate In einem neuen Fenster öffnen}"
|
||||
IsChecked="False"
|
||||
Unchecked="checkbox_openInNewWindow_Checked" />
|
||||
|
||||
<dxp:DocumentPreviewControl
|
||||
x:Name="docPrevControl"
|
||||
Grid.Row="6"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="5"
|
||||
CommandBarStyle="Bars"
|
||||
Visibility="Collapsed">
|
||||
<dxp:DocumentPreviewControl.CommandProvider>
|
||||
<dxp:DocumentCommandProvider>
|
||||
<dxp:DocumentCommandProvider.Actions>
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.ExportCsv}" />
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.ExportMht}" />
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.ExportTxt}" />
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.Open}" />
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.DocumentMap}" />
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.Watermark}" />
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.Scale}" />
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.PrintDirect}" />
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.PageSetup}" />
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.Save}" />
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.Send}" />
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.Parameters}" />
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.Thumbnails}" />
|
||||
<dxb:RemoveAction ElementName="{x:Static dxpbars:DefaultPreviewBarItemNames.EditingFields}" />
|
||||
</dxp:DocumentCommandProvider.Actions>
|
||||
</dxp:DocumentCommandProvider>
|
||||
</dxp:DocumentPreviewControl.CommandProvider>
|
||||
</dxp:DocumentPreviewControl>
|
||||
|
||||
<Popup
|
||||
Name="popup_employee"
|
||||
Grid.Row="5"
|
||||
Grid.Column="0"
|
||||
Width="400"
|
||||
Height="400"
|
||||
Margin="10"
|
||||
Closed="popup_Closed"
|
||||
Opened="popup_Opened"
|
||||
Placement="MousePoint"
|
||||
StaysOpen="False">
|
||||
<localSearchView:EmployeeSearchView x:Name="employeesearchview" ItemSelected="EmployeeSearchView_EmployeeSelected" />
|
||||
</Popup>
|
||||
<Popup
|
||||
Name="popup_team"
|
||||
Grid.Row="7"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="5"
|
||||
Width="400"
|
||||
Height="400"
|
||||
Margin="10"
|
||||
Closed="popup_Closed"
|
||||
Opened="popup_Opened"
|
||||
Placement="MousePoint"
|
||||
StaysOpen="False">
|
||||
<localSearchView:TeamSearchView x:Name="teamsearchview" ItemSelected="TeamSearchView_TeamSelected" />
|
||||
</Popup>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
</localView:BeWoView>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using BS.Shared.DataContracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace BeWo.ViewModel
|
||||
@@ -18,6 +19,8 @@ namespace BeWo.ViewModel
|
||||
InitByDataContract(DataContract);
|
||||
}
|
||||
|
||||
public AbstractDCMapperVM(DCType pDataContract, long? oid) : this(pDataContract, oid is null) { }
|
||||
|
||||
public override bool IsDirty
|
||||
{
|
||||
get { return _DirtyProps.Count > 0; }
|
||||
@@ -35,10 +38,10 @@ namespace BeWo.ViewModel
|
||||
return _IsNew.Value;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_IsNew = value;
|
||||
}
|
||||
set
|
||||
{
|
||||
_IsNew = value;
|
||||
}
|
||||
}
|
||||
|
||||
internal DCType DataContract { get; set; }
|
||||
|
||||
106
BeWo/ViewModel/AiConfigVM.cs
Normal file
106
BeWo/ViewModel/AiConfigVM.cs
Normal file
@@ -0,0 +1,106 @@
|
||||
using System;
|
||||
|
||||
using BS.Shared;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.DataContracts.Feature.AI;
|
||||
|
||||
namespace BeWo.ViewModel
|
||||
{
|
||||
public class AiConfigVM : AbstractDCMapperVM<AiConfigDC>
|
||||
{
|
||||
private AiModelDC _SelectedModel;
|
||||
private float _Temperature;
|
||||
private float _Top_P;
|
||||
private int _Max_Gen_Len;
|
||||
|
||||
public AiConfigVM() : this(null) { }
|
||||
public AiConfigVM(AiConfigDC dc) : base(dc, dc.Oid)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public AiModelDC SelectedModel
|
||||
{
|
||||
get { return _SelectedModel; }
|
||||
set
|
||||
{
|
||||
if (!AreDifferent(_SelectedModel?.Oid, value?.Oid))
|
||||
return;
|
||||
|
||||
_SelectedModel = value;
|
||||
StoreDirtyInformation(AreDifferent(DataContract.SelectedModel, value), nameof(SelectedModel));
|
||||
FirePropertyChanged(nameof(SelectedModel));
|
||||
}
|
||||
}
|
||||
|
||||
public float Temperature
|
||||
{
|
||||
get { return _Temperature; }
|
||||
set
|
||||
{
|
||||
if (!AreDifferent(_Temperature, value))
|
||||
return;
|
||||
|
||||
_Temperature = value;
|
||||
StoreDirtyInformation(AreDifferent(DataContract.Temperature, value), nameof(Temperature));
|
||||
FirePropertyChanged(nameof(Temperature));
|
||||
}
|
||||
}
|
||||
|
||||
public float Top_P
|
||||
{
|
||||
get { return _Top_P; }
|
||||
set
|
||||
{
|
||||
if (!AreDifferent(_Top_P, value))
|
||||
return;
|
||||
|
||||
_Top_P = value;
|
||||
StoreDirtyInformation(AreDifferent(DataContract.Top_P, value), nameof(Top_P));
|
||||
FirePropertyChanged(nameof(Top_P));
|
||||
}
|
||||
}
|
||||
|
||||
public int Max_Gen_Len
|
||||
{
|
||||
get { return _Max_Gen_Len; }
|
||||
set
|
||||
{
|
||||
if (!AreDifferent(_Max_Gen_Len, value))
|
||||
return;
|
||||
|
||||
_Max_Gen_Len = value;
|
||||
StoreDirtyInformation(AreDifferent(DataContract.Max_Gen_Len, value), nameof(Max_Gen_Len));
|
||||
FirePropertyChanged(nameof(Max_Gen_Len));
|
||||
}
|
||||
}
|
||||
|
||||
protected override void InitByDataContract(AiConfigDC pDataContract)
|
||||
{
|
||||
_SelectedModel = pDataContract.SelectedModel;
|
||||
_Temperature = pDataContract.Temperature;
|
||||
_Top_P = pDataContract.Top_P;
|
||||
_Max_Gen_Len = pDataContract.Max_Gen_Len;
|
||||
}
|
||||
|
||||
protected override AiConfigDC MapToDataContract(AiConfigDC pDataContract, bool doCommit)
|
||||
{
|
||||
pDataContract.SelectedModel = _SelectedModel;
|
||||
pDataContract.Temperature = _Temperature;
|
||||
pDataContract.Top_P = _Top_P;
|
||||
pDataContract.Max_Gen_Len = _Max_Gen_Len;
|
||||
|
||||
return pDataContract;
|
||||
}
|
||||
|
||||
internal void Update(AiConfigDC pDataContract)
|
||||
{
|
||||
DataContract = pDataContract;
|
||||
|
||||
SelectedModel = pDataContract.SelectedModel;
|
||||
Temperature = pDataContract.Temperature;
|
||||
Top_P = pDataContract.Top_P;
|
||||
Max_Gen_Len = pDataContract.Max_Gen_Len;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@ namespace BeWo.ViewModel.ListViewModel
|
||||
private string _ContextInput;
|
||||
|
||||
private AiModelDC _SelectedModel;
|
||||
private AiConfigVM _Config;
|
||||
|
||||
public AiConversationListVM() : this(null)
|
||||
{
|
||||
@@ -40,15 +41,23 @@ namespace BeWo.ViewModel.ListViewModel
|
||||
SendNewMessageCommand = new DelegateCommand(SendNewMessage, CanSendNewMessage);
|
||||
RequestNewConversationCommand = new DelegateCommand(RequestNewConversation);
|
||||
TestCommand = new DelegateCommand(Test);
|
||||
|
||||
ReloadConfigCommand = new DelegateCommand(ReloadConfig);
|
||||
ReloadConversationsCommand = new DelegateCommand(ReloadConversations);
|
||||
ReloadModelsCommand = new DelegateCommand(ReloadModels);
|
||||
}
|
||||
|
||||
public DelegateCommand SendNewMessageCommand { get; set; }
|
||||
public DelegateCommand RequestNewConversationCommand { get; set; }
|
||||
public DelegateCommand TestCommand { get; set; }
|
||||
public DelegateCommand ReloadConfigCommand { get; set; }
|
||||
public DelegateCommand ReloadConversationsCommand { get; set; }
|
||||
public DelegateCommand ReloadModelsCommand { get; set; }
|
||||
|
||||
public ObservableCollection<AiModelDC> Models { get; set; }
|
||||
public AiModelDC SelectedModel {
|
||||
get { return _SelectedModel; }
|
||||
public AiModelDC SelectedModel
|
||||
{
|
||||
get { return _SelectedModel; }
|
||||
set
|
||||
{
|
||||
if (_SelectedModel == value)
|
||||
@@ -58,6 +67,18 @@ namespace BeWo.ViewModel.ListViewModel
|
||||
FirePropertyChanged(nameof(SelectedModel));
|
||||
}
|
||||
}
|
||||
public AiConfigVM Config
|
||||
{
|
||||
get { return _Config; }
|
||||
set
|
||||
{
|
||||
if (Config == value)
|
||||
return;
|
||||
|
||||
_Config = value;
|
||||
FirePropertyChanged(nameof(Config));
|
||||
}
|
||||
}
|
||||
|
||||
public string MessageInput
|
||||
{
|
||||
@@ -90,13 +111,12 @@ namespace BeWo.ViewModel.ListViewModel
|
||||
|
||||
public void RequestNewConversation()
|
||||
{
|
||||
ServiceFacade.DoOperationsEnhancedServiceAsnyc(x => x.CreateAiConversation(UIContext, SelectedModel.Oid.Value, ContextBeWoObjects), dc => {
|
||||
ServiceFacade.DoOperationsEnhancedServiceAsnyc(x => x.CreateAiConversation(UIContext, Config.SelectedModel.Oid.Value, ContextBeWoObjects), dc => {
|
||||
var vm = new AiConversationVM(dc);
|
||||
VMList.Insert(0, vm);
|
||||
SelectedVM = vm;
|
||||
}, true, null);
|
||||
}
|
||||
|
||||
public void SendNewMessage()
|
||||
{
|
||||
var conv = SelectedVM;
|
||||
@@ -121,7 +141,6 @@ namespace BeWo.ViewModel.ListViewModel
|
||||
conv.Messages.VMList.Add(new AiConversationMessageVM(messages[1]));
|
||||
});
|
||||
}
|
||||
|
||||
public void Test()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -161,11 +180,55 @@ namespace BeWo.ViewModel.ListViewModel
|
||||
//}
|
||||
}
|
||||
|
||||
private void ReloadConfig()
|
||||
{
|
||||
ServiceFacade.DoOperationsEnhancedServiceAsnyc(x => x.GetAiConfig(), (x) =>
|
||||
{
|
||||
if (Config is null)
|
||||
Config = new AiConfigVM(x);
|
||||
else
|
||||
Config.Update(x);
|
||||
});
|
||||
}
|
||||
public void UpdateConfig()
|
||||
{
|
||||
if (!Config.IsDirty)
|
||||
return;
|
||||
|
||||
ServiceFacade.DoOperationsEnhancedServiceAsnyc(x => x.UpdateAiConfig(Config.CommitToDataContract()), (x) =>
|
||||
{
|
||||
Config.Update(x);
|
||||
});
|
||||
}
|
||||
|
||||
private void ReloadModels()
|
||||
{
|
||||
ServiceFacade.DoOperationsEnhancedServiceAsnyc(x => x.GetAiModels(), (x) =>
|
||||
{
|
||||
Models.MakeEqualTo(x);
|
||||
|
||||
if (Config.SelectedModel is null && Models.Any())
|
||||
Config.SelectedModel = Models.First();
|
||||
});
|
||||
}
|
||||
private void ReloadConversations()
|
||||
{
|
||||
var ui_context = UIContext;
|
||||
|
||||
ServiceFacade.DoOperationsEnhancedServiceAsnyc(x => x.GetAiConversations(ui_context), (x) =>
|
||||
{
|
||||
x.Reverse();
|
||||
var vms = new AiConversationListVM(x);
|
||||
VMList.MakeEqualTo(vms.VMList);
|
||||
});
|
||||
}
|
||||
|
||||
private bool CanSendNewMessage()
|
||||
{
|
||||
return SelectedVM is object;
|
||||
}
|
||||
|
||||
#region Designer
|
||||
private void InitDesigner()
|
||||
{
|
||||
var model = new AiModelDC()
|
||||
@@ -227,7 +290,6 @@ namespace BeWo.ViewModel.ListViewModel
|
||||
|
||||
SelectedVM = conversation_vm;
|
||||
}
|
||||
|
||||
private void InitDummyConversations(int count)
|
||||
{
|
||||
var model = new AiModelDC()
|
||||
@@ -251,5 +313,6 @@ namespace BeWo.ViewModel.ListViewModel
|
||||
VMList.Add(conversation_vm2);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,6 +219,7 @@
|
||||
<Compile Include="DefaultHibernateSessionManager.cs" />
|
||||
<Compile Include="Entities\AiConversation.cs" />
|
||||
<Compile Include="Entities\AiConversationMessage.cs" />
|
||||
<Compile Include="Entities\AiConfig.cs" />
|
||||
<Compile Include="Entities\AiModel.cs" />
|
||||
<Compile Include="Entities\AiSetting.cs" />
|
||||
<Compile Include="Entities\AiSettings.cs" />
|
||||
@@ -802,6 +803,7 @@
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Mappings\AiConversationMessage.hbm.xml" />
|
||||
<EmbeddedResource Include="Mappings\AiModel.hbm.xml" />
|
||||
<EmbeddedResource Include="Mappings\AiConfig.hbm.xml" />
|
||||
<Content Include="Mappings\Timesheet2Mail.hbm.xml" />
|
||||
<EmbeddedResource Include="Mappings\ContactHistory.hbm.xml">
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
24
Data/Entities/AiConfig.cs
Normal file
24
Data/Entities/AiConfig.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using BS.Shared;
|
||||
using BS.Shared.Core;
|
||||
|
||||
namespace BeWo.Data.Entities
|
||||
{
|
||||
public class AiConfig : BeWoEntityBase
|
||||
{
|
||||
public AiConfig()
|
||||
{
|
||||
_Tid = TableID.AiConfig;
|
||||
}
|
||||
|
||||
public virtual AiModel SelectedModel { get; set; }
|
||||
|
||||
public virtual float Temperature { get; set; }
|
||||
|
||||
public virtual float Top_P { get; set; }
|
||||
|
||||
public virtual int Max_Gen_Len { get; set; }
|
||||
}
|
||||
}
|
||||
23
Data/Mappings/AiConfig.hbm.xml
Normal file
23
Data/Mappings/AiConfig.hbm.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
|
||||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
|
||||
<class name="BeWo.Data.Entities.AiConfig,BeWo.Data" table="AiConfig">
|
||||
<id name="Oid" column ="Oid" unsaved-value="null">
|
||||
<generator class="identity" />
|
||||
</id>
|
||||
<version type="Int64" column="Version" name="Version" />
|
||||
<property name="InsTs"/>
|
||||
<property name="InsUser"/>
|
||||
<property column="Tid" type="BS.Shared.TableID, BS.Shared" name="_Tid" access="field" />
|
||||
<property name="UdpUser"/>
|
||||
<property name="IsActive" type="BS.Shared.ActivationTypeId, BS.Shared" />
|
||||
<property name="SystemEntryID" type="BS.Shared.SystemEntryID, BS.Shared" />
|
||||
<property name="Notice"/>
|
||||
<property name="Temperature"/>
|
||||
<property name="Top_P"/>
|
||||
<property name="Max_Gen_Len"/>
|
||||
<many-to-one name="SelectedModel"
|
||||
column="SelectedModelOid"
|
||||
class="BeWo.Data.Entities.AiModel,BeWo.Data"/>
|
||||
</class>
|
||||
</hibernate-mapping>
|
||||
@@ -60,4 +60,23 @@ CREATE Table `AiConversation2BeWoObject` (
|
||||
`BeWoObjectTid` bigint,
|
||||
PRIMARY KEY (`AiConversationOid`, `BeWoObjectOid`, `BeWoObjectTid`),
|
||||
CONSTRAINT `FK_AICONVERSATION2_OID` FOREIGN KEY (`AiConversationOid`) REFERENCES `aiconversation` (`Oid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE `AiConfig` (
|
||||
`Oid` bigint NOT NULL AUTO_INCREMENT,
|
||||
`InsTs` datetime DEFAULT NULL,
|
||||
`InsUser` varchar(256) DEFAULT NULL,
|
||||
`Notice` varchar(1024) DEFAULT NULL,
|
||||
`Tid` int DEFAULT NULL,
|
||||
`UdpUser` varchar(256) DEFAULT NULL,
|
||||
`Version` bigint DEFAULT NULL,
|
||||
`IsActive` tinyint DEFAULT NULL,
|
||||
`SystemEntryID` int DEFAULT NULL,
|
||||
`SelectedModelOid` bigint DEFAULT NULL,
|
||||
`Temperature` float DEFAULT NULL,
|
||||
`Top_P` float DEFAULT NULL,
|
||||
`Max_Gen_Len` int DEFAULT NULL,
|
||||
PRIMARY KEY (`Oid`),
|
||||
KEY `FK_AICONFIG_AIMODELL_OID` (`SelectedModelOid`),
|
||||
CONSTRAINT `FK_AICONFIG_AIMODELL_OID` FOREIGN KEY (`SelectedModelOid`) REFERENCES `aimodel` (`Oid`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
|
||||
54
Service/DCEntityMapper/AiConfigDC_AiConfig.cs
Normal file
54
Service/DCEntityMapper/AiConfigDC_AiConfig.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
|
||||
using BS.Shared;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.DataContracts.Feature.AI;
|
||||
|
||||
namespace BeWo.Service.DCEntityMapper
|
||||
{
|
||||
public class AiConfigDC_AiConfig : AbstractIDCEntityMapper<AiConfig, AiConfigDC>
|
||||
{
|
||||
public override AiConfigDC MergeWithDC(AiConfig pEntity, AiConfigDC pDataContract)
|
||||
{
|
||||
pDataContract.Oid = pEntity.Oid;
|
||||
pDataContract.Version = pEntity.Version;
|
||||
pDataContract.Notice = pEntity.Notice;
|
||||
pDataContract.Temperature = pEntity.Temperature;
|
||||
pDataContract.Top_P = pEntity.Top_P;
|
||||
pDataContract.Max_Gen_Len = pEntity.Max_Gen_Len;
|
||||
|
||||
pDataContract.SelectedModel = MapperFactory.AiModel.MapToNewDC(pEntity.SelectedModel);
|
||||
|
||||
return pDataContract;
|
||||
}
|
||||
|
||||
public override AiConfig MergeWithEntity(AiConfigDC pDataContract, AiConfig pEntity)
|
||||
{
|
||||
ConcurrencyCheck(pDataContract.Version, pEntity);
|
||||
|
||||
pEntity.Oid = pDataContract.Oid;
|
||||
pEntity.Version = pDataContract.Version;
|
||||
pEntity.Notice = pDataContract.Notice;
|
||||
pEntity.Temperature = pDataContract.Temperature;
|
||||
pEntity.Top_P = pDataContract.Top_P;
|
||||
pEntity.Max_Gen_Len = pDataContract.Max_Gen_Len;
|
||||
|
||||
if (pDataContract.SelectedModel?.Oid is long oid)
|
||||
pEntity.SelectedModel = DAOFactory.GenericDAO.LoadByID<AiModel>(oid);
|
||||
else
|
||||
pEntity.SelectedModel = null;
|
||||
|
||||
return pEntity;
|
||||
}
|
||||
|
||||
protected override bool AreDCAndEntityEqual(AiConfigDC pDC, AiConfig pEntity)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -793,5 +793,6 @@ namespace BeWo.Service.DCEntityMapper
|
||||
public static AiConversationDC_AiConversation AiConversation { get; } = new AiConversationDC_AiConversation();
|
||||
public static AiConversationMessageDC_AiConversationMessage AiConversationMessage { get; } = new AiConversationMessageDC_AiConversationMessage();
|
||||
public static AiModelDC_AiModel AiModel { get; } = new AiModelDC_AiModel();
|
||||
public static AiConfigDC_AiConfig AiConfig { get; } = new AiConfigDC_AiConfig();
|
||||
}
|
||||
}
|
||||
@@ -237,6 +237,7 @@
|
||||
<Compile Include="DCEntityMapper\AddressRouteDC_AddressRoute.cs" />
|
||||
<Compile Include="DCEntityMapper\AiConversationMessageDC_AiConversationMessage.cs" />
|
||||
<Compile Include="DCEntityMapper\AiConversationDC_AiConversation.cs" />
|
||||
<Compile Include="DCEntityMapper\AiConfigDC_AiConfig.cs" />
|
||||
<Compile Include="DCEntityMapper\AiModelDC_AiModel.cs" />
|
||||
<Compile Include="DCEntityMapper\BankAccountDC_BankAccount.cs" />
|
||||
<Compile Include="DCEntityMapper\BargeldtransaktionshistoryDC_Bargeldtransaktionshistory.cs" />
|
||||
|
||||
@@ -14,6 +14,16 @@ namespace BeWo.Service.ServiceContracts
|
||||
[ServiceContract]
|
||||
public interface IOperationsEnhancedService : IService
|
||||
{
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
[RequirePermission(BS.Shared.UserRightType.AiModuleView)]
|
||||
AiConfigDC GetAiConfig();
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
[RequirePermission(BS.Shared.UserRightType.AiModuleView)]
|
||||
AiConfigDC UpdateAiConfig(AiConfigDC toUpdate);
|
||||
|
||||
[FaultContract(typeof(BeWoFault))]
|
||||
[OperationContract]
|
||||
[RequirePermission(BS.Shared.UserRightType.AiModuleView)]
|
||||
|
||||
@@ -22,41 +22,44 @@ namespace BeWo.Service.ServiceImplementations
|
||||
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Single)]
|
||||
public class OperationsEnhancedServiceImp : IOperationsEnhancedService
|
||||
{
|
||||
#region Ai
|
||||
public AiConfigDC GetAiConfig()
|
||||
{
|
||||
var configs = DAOFactory.GenericDAO.GetAllActive<AiConfig>();
|
||||
|
||||
var config = configs.FirstOrDefault();
|
||||
|
||||
if(config == null)
|
||||
{
|
||||
config = getDefaultAiConfig();
|
||||
|
||||
DAOFactory.GenericDAO.Insert(config);
|
||||
}
|
||||
|
||||
var config_dc = MapperFactory.AiConfig.MapToNewDC(config);
|
||||
|
||||
return config_dc;
|
||||
}
|
||||
|
||||
public AiConfigDC UpdateAiConfig(AiConfigDC toUpdate)
|
||||
{
|
||||
if (toUpdate?.Oid is null)
|
||||
throw new InvalidOperationException();
|
||||
|
||||
var oid = toUpdate.Oid.Value;
|
||||
var entity = DAOFactory.GenericDAO.LoadByID<AiConfig>(oid);
|
||||
var update = MapperFactory.AiConfig.MergeWithEntity(toUpdate, entity);
|
||||
|
||||
DAOFactory.GenericDAO.Update(update);
|
||||
|
||||
var dc = MapperFactory.AiConfig.MapToNewDC(update);
|
||||
|
||||
return dc;
|
||||
}
|
||||
|
||||
public IEnumerable<AiModelDC> GetAiModels()
|
||||
{
|
||||
var old_models = DAOFactory.GenericDAO.GetAll<AiModel>();
|
||||
var new_models = ServiceFacade.OpenWebUI.GetAiModelle();
|
||||
var unknown_models = new_models.ToList();
|
||||
|
||||
foreach (var old_model in old_models)
|
||||
{
|
||||
bool found = false;
|
||||
foreach (var new_model in new_models)
|
||||
{
|
||||
if(old_model.ModelName == new_model.ModelName)
|
||||
{
|
||||
if (old_model.IsActive != BS.Shared.ActivationTypeId.Active)
|
||||
DAOFactory.GenericDAO.SetActivationType(old_model, BS.Shared.ActivationTypeId.Active);
|
||||
|
||||
found = true;
|
||||
unknown_models.Remove(new_model);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
DAOFactory.GenericDAO.Deactivate(old_model);
|
||||
}
|
||||
|
||||
if (unknown_models.Count != 0)
|
||||
{
|
||||
foreach (var unknown_model in unknown_models)
|
||||
{
|
||||
DAOFactory.GenericDAO.Insert(unknown_model);
|
||||
}
|
||||
}
|
||||
|
||||
var models = DAOFactory.GenericDAO.GetAllActive<AiModel>();
|
||||
var models = getAiModels();
|
||||
|
||||
return MapperFactory.AiModel.MapToNewDCs(models);
|
||||
}
|
||||
@@ -133,5 +136,67 @@ namespace BeWo.Service.ServiceImplementations
|
||||
|
||||
return new AiConversationMessageDC[] { user_msg_dc, assi_msg_dc };
|
||||
}
|
||||
|
||||
private AiConfig getDefaultAiConfig()
|
||||
{
|
||||
var config = new AiConfig();
|
||||
|
||||
config.Temperature = 1;
|
||||
config.Top_P = 1;
|
||||
config.Max_Gen_Len = 1000;
|
||||
config.SelectedModel = getDefaultAiModel();
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
private AiModel getDefaultAiModel()
|
||||
{
|
||||
var models = getAiModels();
|
||||
|
||||
if (models == null || !models.Any())
|
||||
return null;
|
||||
|
||||
return models.First();
|
||||
}
|
||||
|
||||
private IEnumerable<AiModel> getAiModels()
|
||||
{
|
||||
var old_models = DAOFactory.GenericDAO.GetAll<AiModel>();
|
||||
var new_models = ServiceFacade.OpenWebUI.GetAiModelle();
|
||||
var unknown_models = new_models.ToList();
|
||||
|
||||
foreach (var old_model in old_models)
|
||||
{
|
||||
bool found = false;
|
||||
foreach (var new_model in new_models)
|
||||
{
|
||||
if (old_model.ModelName == new_model.ModelName)
|
||||
{
|
||||
if (old_model.IsActive != BS.Shared.ActivationTypeId.Active)
|
||||
DAOFactory.GenericDAO.SetActivationType(old_model, BS.Shared.ActivationTypeId.Active);
|
||||
|
||||
found = true;
|
||||
unknown_models.Remove(new_model);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
DAOFactory.GenericDAO.Deactivate(old_model);
|
||||
}
|
||||
|
||||
if (unknown_models.Count != 0)
|
||||
{
|
||||
foreach (var unknown_model in unknown_models)
|
||||
{
|
||||
DAOFactory.GenericDAO.Insert(unknown_model);
|
||||
}
|
||||
}
|
||||
|
||||
var models = DAOFactory.GenericDAO.GetAllActive<AiModel>();
|
||||
|
||||
return models;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +183,8 @@ namespace BS.Shared
|
||||
AiConversation = 176,
|
||||
AiModel = 177,
|
||||
AiConversationMessage = 178,
|
||||
AiContext2BeWoObject = 179
|
||||
AiContext2BeWoObject = 179,
|
||||
AiConfig = 180
|
||||
}
|
||||
|
||||
public enum SystemEntryID
|
||||
|
||||
17
Shared/DataContracts/Feature/AI/AiConfigDC.cs
Normal file
17
Shared/DataContracts/Feature/AI/AiConfigDC.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BS.Shared.DataContracts.Feature.AI
|
||||
{
|
||||
public class AiConfigDC : BeWoDataContract
|
||||
{
|
||||
[DataMember] public AiModelDC SelectedModel { get; set; }
|
||||
[DataMember] public float Temperature { get; set; }
|
||||
[DataMember] public float Top_P { get; set; }
|
||||
[DataMember] public int Max_Gen_Len { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ namespace BS.Shared.DataContracts.Feature.AI
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{ModelName}:{Value}";
|
||||
return $"{ModelName}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,6 +174,7 @@
|
||||
<Compile Include="DataContracts\AbsenceOverviewFilterDC.cs" />
|
||||
<Compile Include="DataContracts\AdminService\IAdminServiceDC.cs" />
|
||||
<Compile Include="DataContracts\AdminService\AdminServiceSumReqDC.cs" />
|
||||
<Compile Include="DataContracts\Feature\AI\AiConfigDC.cs" />
|
||||
<Compile Include="DataContracts\Feature\AI\AiConversationDC.cs" />
|
||||
<Compile Include="DataContracts\Feature\AI\AiConversationMessageDC.cs" />
|
||||
<Compile Include="DataContracts\Feature\AI\AiModelDC.cs" />
|
||||
|
||||
Reference in New Issue
Block a user