UIContextType -> AiActionType

This commit is contained in:
2026-05-26 12:30:29 +02:00
parent 709937eee3
commit 9c10386b87
46 changed files with 396 additions and 625 deletions

View File

@@ -31,7 +31,7 @@ namespace BeWo.ServiceProxy
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/GetAiConversations", ReplyAction="http://tempuri.org/IAiEnhancedService/GetAiConversationsResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/GetAiConversationsBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationDC> GetAiConversations(BS.Shared.AiContextType uicontext, System.Nullable<long> oid);
System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationDC> GetAiConversations(BS.Shared.AiActionType actionType, System.Nullable<long> oid);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/CreateAiConversation", ReplyAction="http://tempuri.org/IAiEnhancedService/CreateAiConversationResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/CreateAiConversationBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
@@ -61,7 +61,7 @@ namespace BeWo.ServiceProxy
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/CheckContextSize", ReplyAction="http://tempuri.org/IAiEnhancedService/CheckContextSizeResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/CheckContextSizeBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
bool CheckContextSize(BS.Shared.AiContextType aiContextType, System.Collections.Generic.Dictionary<BS.Shared.TableID, System.Collections.Generic.List<long>> context, System.Nullable<long> modell_oid);
bool CheckContextSize(BS.Shared.AiActionType actionType, System.Collections.Generic.Dictionary<BS.Shared.TableID, System.Collections.Generic.List<long>> context, System.Nullable<long> modell_oid);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAiEnhancedService/GetAiPromptbausteinFolder", ReplyAction="http://tempuri.org/IAiEnhancedService/GetAiPromptbausteinFolderResponse")]
[System.ServiceModel.FaultContractAttribute(typeof(BS.Shared.Core.BeWoFault), Action="http://tempuri.org/IAiEnhancedService/GetAiPromptbausteinFolderBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BS.Shared.Core")]
@@ -171,9 +171,9 @@ namespace BeWo.ServiceProxy
return base.Channel.GetAiModels();
}
public System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationDC> GetAiConversations(BS.Shared.AiContextType uicontext, System.Nullable<long> oid)
public System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiConversationDC> GetAiConversations(BS.Shared.AiActionType actionType, System.Nullable<long> oid)
{
return base.Channel.GetAiConversations(uicontext, oid);
return base.Channel.GetAiConversations(actionType, oid);
}
public BS.Shared.DataContracts.Feature.AI.AiConversationDC CreateAiConversation(BS.Shared.DataContracts.Feature.AI.AiConversationDC conversation, long modell_oid)
@@ -206,9 +206,9 @@ namespace BeWo.ServiceProxy
return base.Channel.SendNewMessage(conversation, message);
}
public bool CheckContextSize(BS.Shared.AiContextType aiContextType, System.Collections.Generic.Dictionary<BS.Shared.TableID, System.Collections.Generic.List<long>> context, System.Nullable<long> modell_oid)
public bool CheckContextSize(BS.Shared.AiActionType actionType, System.Collections.Generic.Dictionary<BS.Shared.TableID, System.Collections.Generic.List<long>> context, System.Nullable<long> modell_oid)
{
return base.Channel.CheckContextSize(aiContextType, context, modell_oid);
return base.Channel.CheckContextSize(actionType, context, modell_oid);
}
public System.Collections.Generic.List<BS.Shared.DataContracts.Feature.AI.AiPromptbausteinFolderDC> GetAiPromptbausteinFolder(BS.Shared.AiActionType aiActionType)

View File

@@ -19,7 +19,7 @@ namespace BeWo.Services
{
public Control GetAiConversationControl(AiConversationChatViewModel vm)
{
var styleString = getStyleString(vm.AiContext);
var styleString = getStyleString(vm.ActionType);
var control = styleString is object ? new AiConversationChatView(vm, styleString) : new AiConversationChatView(vm);
@@ -52,18 +52,21 @@ namespace BeWo.Services
return control;
}
private string getStyleString(AiContextType uIContext) {
switch (uIContext)
private string getStyleString(AiActionType actionType) {
switch (actionType)
{
case AiContextType.SupportConceptNavigation: return "ModuleAiControlSupportConceptStyle";
case AiContextType.CustomerNavigation: return "ModuleAiControlCustomerStyle";
case AiContextType.PersonNavigation: return "ModuleAiControlPersonStyle";
case AiContextType.EmployeeNavigation: return "ModuleAiControlEmployeeStyle";
case AiContextType.OrganisationNavigation: return "ModuleAiControlOrganisationStyle";
case AiContextType.ServiceRecord: return "ModuleAiControlZeiterfassungStyle";
case AiContextType.CustomerDetail: return "ModuleAiControlCustomerStyle";
case AiContextType.PersonDetail: return "ModuleAiControlPersonStyle";
case AiContextType.EmployeeDetail: return "ModuleAiControlEmployeeStyle";
case AiActionType.ServiceRecordConversation: return "ModuleAiControlZeiterfassungStyle";
case AiActionType.ServiceRecordDocumentation: return "ModuleAiControlZeiterfassungStyle";
//case AiContextType.SupportConceptNavigation: return "ModuleAiControlSupportConceptStyle";
//case AiContextType.CustomerNavigation: return "ModuleAiControlCustomerStyle";
//case AiContextType.PersonNavigation: return "ModuleAiControlPersonStyle";
//case AiContextType.EmployeeNavigation: return "ModuleAiControlEmployeeStyle";
//case AiContextType.OrganisationNavigation: return "ModuleAiControlOrganisationStyle";
//case AiContextType.ServiceRecord: return "ModuleAiControlZeiterfassungStyle";
//case AiContextType.CustomerDetail: return "ModuleAiControlCustomerStyle";
//case AiContextType.PersonDetail: return "ModuleAiControlPersonStyle";
//case AiContextType.EmployeeDetail: return "ModuleAiControlEmployeeStyle";
}
return null;

View File

@@ -17,15 +17,10 @@ namespace BeWo.Services
{
public class BeWoWindowFactory
{
private Dictionary<AiContextType, string> _UIContext2Header = new Dictionary<AiContextType, string>()
private Dictionary<AiActionType, string> _UIContext2Header = new Dictionary<AiActionType, string>()
{
{AiContextType.ServiceRecord, "KI Chat: Zeiterfassung" },
{AiContextType.CustomerNavigation, "KI Chat: Klienten Übersicht" },
{AiContextType.PersonNavigation, "KI Chat: Personen Übersicht" },
{AiContextType.EmployeeNavigation, "KI Chat: Mitarbeiter Übersicht" },
{AiContextType.OrganisationNavigation, "KI Chat: Organisation Übersicht" },
{AiContextType.SupportConceptNavigation, "KI Chat: Hilfeplan Übersicht" },
{AiContextType.CustomerDetail, "KI Chat: Klient" },
{AiActionType.ServiceRecordConversation, "KI Chat: Zeiterfassung" },
{AiActionType.ServiceRecordDocumentation, "KI Doku: Zeiterfassung" }
};
public Control GetModalViewWindow(string title, Control control, double height = 600, double width = 1200)
@@ -69,9 +64,9 @@ namespace BeWo.Services
return "GKV-Abrechnung Nr. " + vm.Oid;
}
public string GetAiTitle(AiContextType aiContextType)
public string GetAiTitle(AiActionType actionType)
{
if (_UIContext2Header.TryGetValue(aiContextType, out string str))
if (_UIContext2Header.TryGetValue(actionType, out string str))
return str;
return "default";

View File

@@ -81,7 +81,7 @@ namespace BeWo.Services
public void ShowAiConversationWindow(AiConversationChatViewModel viewModel)
{
var control = _controlFactory.GetAiConversationControl(viewModel);
var title = _windowFactory.GetAiTitle(viewModel.AiContext);
var title = _windowFactory.GetAiTitle(viewModel.ActionType);
var options = new BeWoWindowOptions()
{
Height = 600,

View File

@@ -2,11 +2,16 @@
x:Class="BeWo.View.Controls.AI.AiChatButton"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ai="clr-namespace:BeWo.ViewModel.Controls.AI"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:draw="clr-namespace:System.Drawing;assembly=System.Drawing"
xmlns:i="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:local="clr-namespace:BeWo.View.Controls.AI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:ai="clr-namespace:BeWo.ViewModel.Controls.AI" xmlns:i="http://schemas.devexpress.com/winfx/2008/xaml/mvvm" d:DataContext="{d:DesignInstance Type=ai:AiChatButtonViewModel}"
mc:Ignorable="d">
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DataContext="{d:DesignInstance Type=ai:AiChatButtonWithHistoryViewModel}"
mc:Ignorable="d"
Loaded="UserControl_Loaded"
Visibility="{Binding IsEnabled, Converter={StaticResource BoolVisibilityConverter}}">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
@@ -26,9 +31,9 @@
Background="Transparent"
Content="{StaticResource AiDesignsIconKIChatWeissOrange}"
ToolTip="KI Chat öffnen"
ToolTipService.ShowOnDisabled="True" >
ToolTipService.ShowOnDisabled="True">
<Button.InputBindings>
<MouseBinding Command="{Binding OpenConversationPopupCommand}" Gesture="LeftClick"/>
<MouseBinding Command="{Binding OpenConversationPopupCommand}" Gesture="LeftClick" />
</Button.InputBindings>
</Button>
<Button
@@ -37,9 +42,9 @@
Margin="10,0,0,0"
Background="Transparent"
Content="{StaticResource AiDesignsIconKIFunktionWeissGruen}"
MouseRightButtonUp="btnOpenAi5_MouseRightButtonUp"
ToolTip="KI Chat mit Prompt-Baustein starten"
ToolTipService.ShowOnDisabled="True"
MouseRightButtonUp="btnOpenAi5_MouseRightButtonUp">
ToolTipService.ShowOnDisabled="True">
<Button.InputBindings>
<MouseBinding Command="{Binding OpenAllPromptsPopupCommand}" Gesture="LeftClick" />
</Button.InputBindings>
@@ -57,6 +62,22 @@
Es können keine neuen Chats zu dieser Ansicht erstellt werden.
</Image.ToolTip>
</Image>
<StackPanel
Orientation="Horizontal"
Visibility="{Binding IsHistoryEnabled, Converter={StaticResource BoolVisibilityConverter}}">
<Button
x:Name="btn_AiPromptbausteinUndo"
Margin="3,0,0,0"
Command="{Binding UndoAiActionCommand}"
Style="{StaticResource ButtonPreviousStyle}"
Visibility="{Binding IsUndoButtonVisible, Converter={StaticResource BoolVisibilityHiddenConverter}}" />
<Button
x:Name="btn_AiPromptbausteinRedo"
Margin="3,0,3,0"
Command="{Binding RedoAiActionCommand}"
Style="{StaticResource ButtonRedoStyle}"
Visibility="{Binding IsRedoButtonVisible, Converter={StaticResource BoolVisibilityHiddenConverter}}" />
</StackPanel>
</StackPanel>
<!--<Popup
x:Name="popup_promptbaustein_all"
@@ -69,10 +90,10 @@
</Popup>-->
<Popup
x:Name="popup_promptbaustein_favoriten"
IsOpen="{Binding IsFavoritenOpen}"
Placement="Top"
PlacementTarget="{Binding ElementName=btnOpenAi5}"
StaysOpen="False"
IsOpen="{Binding IsFavoritenOpen}">
StaysOpen="False">
<Border x:Name="border_promptbaustein_favoriten" BorderThickness="1" />
</Popup>
</Grid>

View File

@@ -27,15 +27,6 @@ namespace BeWo.View.Controls.AI
/// </summary>
public partial class AiChatButton : UserControl
{
public static readonly DependencyProperty ActionTypeProperty =
DependencyProperty.Register("ActionType", typeof(AiActionType), typeof(AiChatButton), new PropertyMetadata(AiActionType.ServiceRecord, OnActionTypeChanged));
public AiActionType ActionType
{
get { return (AiActionType)GetValue(ActionTypeProperty); }
set { SetValue(ActionTypeProperty, value); }
}
public AiChatButtonViewModel ViewModel => DataContext as AiChatButtonViewModel;
public AiChatButton()
@@ -43,25 +34,17 @@ namespace BeWo.View.Controls.AI
InitializeComponent();
}
private static void OnActionTypeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
var control = (AiChatButton)d;
var actionType = (AiActionType)e.NewValue;
if (BeWoApp.AppSettings.ShowAI && BeWoApp.HasLoggedOnUserRight(UserRightType.AiModulePromptbausteineView))
if (ViewModel.IsEnabled)
{
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.GetAiPromptbausteinFolder(actionType), folders => control.InitPromptbausteine(actionType, folders));
}
}
var actionType = ViewModel.ActionType;
public void AiPromptOpenAll()
{
//popup_promptbaustein_all.IsOpen = true;
//OpenAiPromptClick?.Invoke(this, e);
BeWoApp.MainControl.WindowService.Show(ViewModel.AllPromptsViewModel);
}
public void AiPromptOpenFavorite()
{
popup_promptbaustein_favoriten.IsOpen = true;
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.GetAiPromptbausteinFolder(actionType), folders => InitPromptbausteine(actionType, folders),
null,
true,
this);
}
}
private void InitPromptbausteine(AiActionType actionType, List<AiPromptbausteinFolderDC> folders)

View File

@@ -5,8 +5,8 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="root"
d:DesignWidth="28"
d:DesignHeight="28"
d:DesignWidth="28"
mc:Ignorable="d">
<Button
x:Name="btn"
@@ -14,10 +14,10 @@
Height="22"
Padding="0"
Click="btn_Click"
ToolTip="{Binding HelpToolTip, ElementName=root}"
Cursor="Hand"
FontSize="13"
FontWeight="Bold"
FontSize="13">
ToolTip="{Binding HelpToolTip, ElementName=root}">
<Button.Template>
<ControlTemplate TargetType="Button">
<Grid>
@@ -25,9 +25,7 @@
Fill="White"
Stroke="#FF14549E"
StrokeThickness="1" />
<ContentPresenter
HorizontalAlignment="Center"
VerticalAlignment="Center" />
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
@@ -40,11 +38,11 @@
</ControlTemplate>
</Button.Template>
<TextBlock
Text="?"
Foreground="#FF14549E"
FontWeight="Bold"
FontSize="14"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
VerticalAlignment="Center"
FontSize="14"
FontWeight="Bold"
Foreground="#FF14549E"
Text="?" />
</Button>
</UserControl>

View File

@@ -292,8 +292,6 @@ namespace BeWo.View.Detail
#endif
}
public DelegateCommand OpenAiWindowCommand { get; }
public Dictionary<TableID, long[]> GetVisibleInformationReferences()
{
var visible = ViewModel;
@@ -312,13 +310,14 @@ namespace BeWo.View.Detail
private AiConversationChatViewModel getAiConversationChatViewModel()
{
var customer_oid = ViewModel.DataContract.CustomerOid;
var context = GetVisibleInformationReferences();
throw new NotImplementedException();
//var customer_oid = ViewModel.DataContract.CustomerOid;
//var context = GetVisibleInformationReferences();
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.CustomerDetail, context, customer_oid);
// var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.CustomerDetail, context, customer_oid);
return vm;
}
// return vm;
}
private void OpenAiWindow()
{

View File

@@ -2,6 +2,7 @@
x:Class="BeWo.View.Detail.Zeiterfassung.ServiceRecordEditView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ai="clr-namespace:BeWo.View.Controls.AI"
xmlns:core="clr-namespace:BS.Shared.Core;assembly=BS.Shared"
xmlns:detail="clr-namespace:BeWo.View.Detail"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
@@ -16,7 +17,6 @@
xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls"
xmlns:val="clr-namespace:BeWo.Validation"
xmlns:zeit="clr-namespace:BeWo.View.Detail.Zeiterfassung"
xmlns:ai="clr-namespace:BeWo.View.Controls.AI"
x:Name="root"
Width="Auto"
Height="Auto"
@@ -1508,12 +1508,11 @@
<StackPanel
x:Name="stackpanel_ai"
Grid.Row="1"
Grid.ColumnSpan="2"
Grid.ColumnSpan="2"
Margin="3,3,3,6"
HorizontalAlignment="Right"
DataContext=""
Orientation="Horizontal"
Visibility="{Binding IsAiDocuButtonVisible, Converter={StaticResource BoolVisibilityConverter}}">
Orientation="Horizontal">
<StackPanel.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
@@ -1521,25 +1520,8 @@
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</StackPanel.Resources>
<Button
x:Name="btn_AiPromptbausteinUndo"
Margin="3,0,0,0"
Command="{Binding UndoEditAiActionCommand}"
Style="{StaticResource ButtonPreviousStyle}"
Visibility="{Binding IsEditUndoButtonVisible, Converter={StaticResource BoolVisibilityHiddenConverter}}" />
<Button
x:Name="btn_AiPromptbausteinRedo"
Margin="3,0,3,0"
Command="{Binding RedoEditAiActionCommand}"
Style="{StaticResource ButtonRedoStyle}"
Visibility="{Binding IsEditRedoButtonVisible, Converter={StaticResource BoolVisibilityHiddenConverter}}" />
<ai:AiPromptbausteinButton
Margin="3,0,0,0"
x:Name="btn_AiPromptbaustein"
ActionType="ServiceRecordDocumentation"
CanExecute="{Binding EditVM.Notice, Converter={StaticResource StringEmptyBoolConverter}}"
ItemAccepted="btn_AiPromptbaustein_ItemAccepted" />
<ai:AiChatButton
x:Name="btn_ai_docu" />
</StackPanel>

View File

@@ -26,6 +26,7 @@ using DevExpress.Xpf.Editors;
using DevExpress.Xpf.RichEdit;
using SupportConceptService = BeWo.Core.Service.SupportConceptService;
using System.Windows.Media;
using BeWo.ViewModel.Controls.AI;
namespace BeWo.View.Detail.Zeiterfassung
{
@@ -1168,9 +1169,10 @@ namespace BeWo.View.Detail.Zeiterfassung
}
}
}
private void btn_AiPromptbaustein_ItemAccepted(object sender, AbstractBaseVM e)
{
ViewModel.ItemAccepted(sender, e);
}
public void SetAiViewmodel(AiChatButtonWithHistoryViewModel aiChatButtonWithHistoryView)
{
btn_ai_docu.DataContext = aiChatButtonWithHistoryView;
}
}
}

View File

@@ -1730,7 +1730,7 @@
ActionType="ServiceRecordDocumentation"
CanExecute="{Binding PrototypeVM.Notice, Converter={StaticResource StringEmptyBoolConverter}}"
ItemAccepted="btn_AiPromptbaustein2_ItemAccepted" />-->
<ai:AiChatButton x:Name="btn_ai_docu" ActionType="ServiceRecordDocumentation" />
<ai:AiChatButton x:Name="btn_ai_docu" />
<!--</StackPanel>-->
@@ -3335,7 +3335,7 @@
Margin="0"
VerticalAlignment="Center"
Orientation="Horizontal">
<ai:AiChatButton x:Name="btn_ai_conv" ActionType="ServiceRecordConversation" />
<ai:AiChatButton x:Name="btn_ai_conv" />
<!--<ai:AiConversationButton
x:Name="ai_conversation_btn"
Margin="10,0,0,0"

View File

@@ -54,6 +54,7 @@ using BeWo.View.Windows;
using BeWo.Core.Commands;
using BeWo.ViewModel.View.AI;
using System.Text;
using BS.Shared.DataContracts.Feature.AI;
namespace BeWo.View.Detail.Zeiterfassung
{
@@ -348,14 +349,11 @@ namespace BeWo.View.Detail.Zeiterfassung
srGridControl.ItemsSourceChanged += SrGridControl_ItemsSourceChanged;
btn_ai_conv.DataContext = pViewModel.AiChatButtonConversationViewModel;
btn_ai_conv.ViewModel.GetAiConversationChatViewModel = () => getAiConversationChatViewModel();
btn_ai_conv.ViewModel.GetAiVisualContext = () => getAiVisualContext();
btn_ai_docu.DataContext = pViewModel.AiChatButtonDocumentationViewModel;
}
public ICommand OpenAiWindowCommand { get; set; }
public ICommand OpenAiChatPromptWindowCommand { get; set; }
private void SrGridControl_ItemsSourceChanged(object sender, DevExpress.Xpf.Grid.ItemsSourceChangedEventArgs e)
{
ErstelleRecordInformationString();
@@ -1184,16 +1182,20 @@ namespace BeWo.View.Detail.Zeiterfassung
BeWoView serviceRecordEditView;
if (vm.GroupOid != null)
ViewModel.AiChatButtonDocumentationEditViewModel.ClearHistory();
if (vm.GroupOid != null)
{
serviceRecordEditView = new ServiceRecordGroupEditView();
}
else
{
serviceRecordEditView = new ServiceRecordEditView();
}
var view = new ServiceRecordEditView();
ViewModel.AiChatButtonDocumentationEditViewModel.ClearHistory();
view.SetAiViewmodel(ViewModel.AiChatButtonDocumentationEditViewModel);
serviceRecordEditView = view;
}
popup_content.Child = serviceRecordEditView;
@@ -5082,21 +5084,19 @@ namespace BeWo.View.Detail.Zeiterfassung
ComboBoxTreeViewControl.TreeViewSourceList = ViewModel.PrototypeVM.GoalTree;
}
private AiConversationChatViewModel getAiConversationChatViewModel()
{
private AiViewContextDC getAiVisualContext()
{
var records = GetVisibleRecordVMs();
var context = ViewModel.GetVisibleInformationReferences(records);
var oid = supportConceptSelectionControl.SelectedItem.SupportConceptTreeNodeDC.SupportConcept.SupportConceptOid;
var canSendNewMessage = ViewModel.AiConversationButtonState == Controls.AI.AiConversationButtonState.Normal;
var oid = supportConceptSelectionControl.SelectedItem.SupportConceptTreeNodeDC.SupportConcept.SupportConceptOid;
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.ServiceRecord, context, oid, canSendNewMessage);
var dc = new AiViewContextDC()
{
Primary = oid,
References = context
};
return vm;
}
private void OpenAiWindow()
{
MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
return dc;
}
private IEnumerable<ServiceRecordVM> GetVisibleRecordVMs()
@@ -5123,16 +5123,6 @@ namespace BeWo.View.Detail.Zeiterfassung
return list;
}
private void ItemAccepted(object sender, AbstractBaseVM e)
{
ViewModel.ItemAccepted(sender, e);
}
private void btn_AiPromptbaustein2_ItemAccepted(object sender, AbstractBaseVM e)
{
ViewModel.ItemAccepted(sender, e);
}
}
//public class RowBackgroundHelper

View File

@@ -235,11 +235,12 @@ namespace BeWo.View.Navigation
private AiConversationChatViewModel getAiConversationChatViewModel()
{
var context = GetVisibleInformationReferences();
throw new NotImplementedException();
// var context = GetVisibleInformationReferences();
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.CustomerNavigation, context);
// var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.CustomerNavigation, context);
return vm;
// return vm;
}
private void OpenAiWindow()

View File

@@ -110,11 +110,12 @@ namespace BeWo.View.Navigation
private AiConversationChatViewModel getAiConversationChatViewModel()
{
var context = GetVisibleInformationReferences();
throw new NotImplementedException();
//var context = GetVisibleInformationReferences();
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.EmployeeNavigation, context);
//var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.EmployeeNavigation, context);
return vm;
//return vm;
}
private void OpenAiWindow()

View File

@@ -267,24 +267,6 @@
Click="btnDelete_Click"
Content="Löschen"
Style="{StaticResource NavigationToolbarButtonStyle}" />
<StackPanel
Margin="0"
Orientation="Horizontal"
Visibility="Collapsed">
<StackPanel.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\..\Styles\ModernOrangeBlack.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</StackPanel.Resources>
<Button
x:Name="btnOpenAi2"
Margin="10,0,0,0"
Command="{Binding Path=OpenAiWindowCommand, RelativeSource={RelativeSource AncestorType={x:Type localView:BeWoView}}}"
Content="AI Chat Window"
Style="{StaticResource NavigationToolbarButtonStyle}" />
</StackPanel>
<TextBlock
x:Name="textblock_link"
Margin="20,0,0,0"

View File

@@ -86,8 +86,6 @@ namespace BeWo.View.Navigation
OpenSelectedObject();
}
};
OpenAiWindowCommand = new DelegateCommand(null, () => false);
}
public delegate bool ArchiveObjectDelegate(IFilterableDC obj);
@@ -128,8 +126,6 @@ namespace BeWo.View.Navigation
public event CopyObjectDelegate CopyObject;
public DelegateCommand OpenAiWindowCommand { get; set; }
public bool ArchiveButtonVisible
{
get

View File

@@ -1,4 +1,5 @@
using System.Collections;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -76,11 +77,12 @@ namespace BeWo.View.Navigation
private AiConversationChatViewModel getAiConversationChatViewModel()
{
var context = GetVisibleInformationReferences();
throw new NotImplementedException();
//var context = GetVisibleInformationReferences();
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.OrganisationNavigation, context);
//var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.OrganisationNavigation, context);
return vm;
//return vm;
}
private void OpenAiWindow()

View File

@@ -24,6 +24,7 @@ using DevExpress.XtraBars.Docking;
using BeWo.ViewModel.View.AI;
using DevExpress.Xpf.Editors;
using BS.Shared.Translation;
using System;
namespace BeWo.View.Navigation
{
@@ -151,11 +152,12 @@ namespace BeWo.View.Navigation
private AiConversationChatViewModel getAiConversationChatViewModel()
{
var context = GetVisibleInformationReferences();
throw new NotImplementedException();
//var context = GetVisibleInformationReferences();
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.PersonNavigation, context);
//var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.PersonNavigation, context);
return vm;
//return vm;
}
private void OpenAiWindow()

View File

@@ -227,11 +227,13 @@ namespace BeWo.View.Navigation
private AiConversationChatViewModel getAiConversationChatViewModel()
{
var context = GetVisibleInformationReferences();
throw new NotImplementedException();
var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.SupportConceptNavigation, context);
//var context = GetVisibleInformationReferences();
return vm;
//var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.SupportConceptNavigation, context);
//return vm;
}
private void OpenAiWindow()

View File

@@ -73,7 +73,7 @@ namespace BeWo.ViewModel
public string Context => DataContract.Context;
public Dictionary<TableID, long[]> ContextBeWoObjects => DataContract.ContextBeWoObjects;
public AiDataContextType Context_Type => DataContract.ContextType;
public UIContext UIContext => (UIContext)DataContract.UIContext;
public AiActionType AiActionType => DataContract.ActionType;
protected override void InitByDataContract(AiConversationDC pDataContract)
{

View File

@@ -1,29 +1,51 @@
using BeWo.ViewModel.View.AI;
using BeWo.ServiceProxy;
using BeWo.View.Controls.AI;
using BeWo.View.Detail.AI;
using BeWo.ViewModel.View.AI;
using BS.Shared;
using BS.Shared.DataContracts.Feature.AI;
using DevExpress.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace BeWo.ViewModel.Controls.AI
{
public enum AiChatButtonState
{
Hidden,
Normal,
Loading,
Warning,
Disabled
}
public class AiChatButtonViewModel : AbstractBaseVM
{
private bool canExecute;
private AiChatButtonState buttonState;
public AiActionType ActionType { get; protected set; }
public bool IsFavoritenOpen { get; set; }
public List<AiMenuItemTemplate> AssistentCommands { get; protected set; }
public virtual bool IsHistoryEnabled => false;
public bool IsEnabled => BeWoApp.AppSettings.ShowAI && BeWoApp.HasLoggedOnUserRight(GetUserRightType());
public bool CanExecute
{
get => canExecute;
set => SetProperty(ref canExecute, value, nameof(CanExecute));
}
public AiChatButtonState ButtonState
{
get => buttonState;
set => SetProperty(ref buttonState, value, nameof(ButtonState));
}
public Func<AiConversationChatViewModel> GetAiConversationChatViewModel { get; set; }
public Func<AiViewContextDC> GetAiVisualContext { get; set; }
public AiPromptbausteinSelectionComplexViewModel AllPromptsViewModel { get; set; }
@@ -31,8 +53,13 @@ namespace BeWo.ViewModel.Controls.AI
public DelegateCommand OpenAllPromptsPopupCommand { get; protected set; }
public DelegateCommand OpenFavoritePromptsPopupCommand { get; protected set; }
public AiChatButtonViewModel()
public AiChatButtonViewModel(AiActionType aiActionType)
{
ActionType = aiActionType;
if (!IsEnabled)
return;
canExecute = true;
OpenConversationPopupCommand = new DelegateCommand(OpenConversationPopup);
@@ -40,21 +67,67 @@ namespace BeWo.ViewModel.Controls.AI
OpenFavoritePromptsPopupCommand = new DelegateCommand(OpenFavoritePromptsPopup);
}
public void OpenConversationPopup()
public void CheckContextSize()
{
BeWoApp.MainControl.WindowService.ShowAiConversationWindow(GetAiConversationChatViewModel());
if (!IsEnabled)
{
return;
}
ButtonState = AiChatButtonState.Loading;
var context = GetAiVisualContext();
if (context != null)
{
var context2 = context.References.ToDictionary(kv => kv.Key, kv => kv.Value.ToList());
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.CheckContextSize(ActionType, context2, null),
isValid =>
{
if (isValid)
ButtonState = AiChatButtonState.Normal;
else
ButtonState = AiChatButtonState.Warning;
},
(exp) => ButtonState = AiChatButtonState.Disabled);
}
}
public void OpenAllPromptsPopup()
private void OpenConversationPopup()
{
var context = GetAiVisualContext();
var chat_viewmodel = VMFactory.CreateAiConversationChatViewModel(ActionType, context.References, (long)context.Primary, true);
BeWoApp.MainControl.WindowService.Show(chat_viewmodel);
}
private void OpenAllPromptsPopup()
{
BeWoApp.MainControl.WindowService.Show(AllPromptsViewModel);
}
public void OpenFavoritePromptsPopup()
private void OpenFavoritePromptsPopup()
{
IsFavoritenOpen = true;
FirePropertyChanged(nameof(IsFavoritenOpen));
}
private UserRightType GetUserRightType()
{
switch (ActionType)
{
case AiActionType.ServiceRecord:
break;
case AiActionType.ServiceRecordConversation:
return UserRightType.AiModuleServiceRecordChat;
case AiActionType.ServiceRecordDocumentation:
return UserRightType.AiModuleServiceRecordDocu;
default:
break;
}
throw new InvalidOperationException($"UserRightType '{ActionType}' not implemented");
}
}
public class AiMenuItemTemplate

View File

@@ -1,4 +1,7 @@
using System;
using BS.Shared;
using DevExpress.Mvvm;
using DevExpress.XtraPrinting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -19,12 +22,15 @@ namespace BeWo.ViewModel.Controls.AI
set => SetProperty(ref currentValue, value, nameof(CurrentValue));
}
public override bool IsHistoryEnabled => true;
public bool IsUndoButtonVisible => CurrentIndex > 0;
public bool IsRedoButtonVisible => CurrentIndex < History.Count - 1;
public override bool IsHistoryEnabled => true;
public DelegateCommand UndoAiActionCommand { get; protected set; }
public DelegateCommand RedoAiActionCommand { get; protected set; }
public AiChatButtonWithHistoryViewModel() : base()
public AiChatButtonWithHistoryViewModel(AiActionType aiActionType) : base(aiActionType)
{
History = new List<string>();
CurrentIndex = 0;
@@ -32,17 +38,19 @@ namespace BeWo.ViewModel.Controls.AI
{
new AiMenuItemTemplate()
{
Command = new DevExpress.Mvvm.DelegateCommand<AiConversationMessageVM>(x => Accept1(x.Message)),
Command = new DelegateCommand<AiConversationMessageVM>(x => AddValue(x.Message)),
Icon = null,
Name = "Akzeptieren"
Name = "Anfügen"
},
new AiMenuItemTemplate()
{
Command = new DevExpress.Mvvm.DelegateCommand<AiConversationMessageVM>(x => Accept2(x.Message)),
Command = new DelegateCommand<AiConversationMessageVM>(x => ReplaceValue(x.Message)),
Icon = null,
Name = "Ersetzen"
},
};
UndoAiActionCommand= new DelegateCommand(UndoAiAction);
RedoAiActionCommand= new DelegateCommand(RedoAiAction);
}
public void ClearHistory()
@@ -97,14 +105,24 @@ namespace BeWo.ViewModel.Controls.AI
CurrentValue = History[CurrentIndex];
}
public void Accept1(string s)
public void AddValue(string s)
{
var sb = new StringBuilder();
sb.AppendLine("Antwort:");
sb.AppendLine(s);
sb.AppendLine();
sb.AppendLine("Original:");
sb.AppendLine(CurrentValue);
var str = sb.ToString();
Accept(str);
}
public void Accept2(string s)
public void ReplaceValue(string str)
{
Accept(str);
}
}
}

View File

@@ -90,7 +90,7 @@ namespace BeWo.ViewModel.ListViewModel
Displayname = "Displayname Megamegalange Deluxe Op 3000",
Messages = messages_dc,
Modell = model,
UIContext = AiContextType.ServiceRecord,
ActionType = AiActionType.ServiceRecordDocumentation,
Updated = DateTime.Now,
};
@@ -116,7 +116,7 @@ namespace BeWo.ViewModel.ListViewModel
Created = DateTime.Now,
Displayname = "Dummy Num " + i.ToString(),
Modell = model,
UIContext = AiContextType.ServiceRecord,
ActionType = AiActionType.ServiceRecordDocumentation,
Updated = DateTime.Now,
};

View File

@@ -102,19 +102,6 @@ namespace BeWo.ViewModel.ListViewModel
//private static List<DarreichungsformDC> _AllDosageForms;
private List<string> _AiActionHistory;
private int _AiActionHistoryIndex;
private AiConversationButtonState _AiConversationButtonState;
public ICommand UndoAiActionCommand { get; set; }
public ICommand RedoAiActionCommand { get; set; }
private List<string> _EditAiActionHistory;
private int _EditAiActionHistoryIndex;
public ICommand UndoEditAiActionCommand { get; set; }
public ICommand RedoEditAiActionCommand { get; set; }
public AiUserSettingVM AiUserSetting { get; set; }
public AiChatButtonViewModel AiChatButtonConversationViewModel { get; set; }
@@ -193,17 +180,16 @@ namespace BeWo.ViewModel.ListViewModel
private void InitAiStuff()
{
AiChatButtonConversationViewModel = new AiChatButtonViewModel()
AiChatButtonConversationViewModel = new AiChatButtonViewModel(AiActionType.ServiceRecordConversation)
{
};
AiChatButtonDocumentationViewModel = new AiChatButtonWithHistoryViewModel()
};
AiChatButtonDocumentationViewModel = new AiChatButtonWithHistoryViewModel(AiActionType.ServiceRecordDocumentation)
{
};
AiChatButtonDocumentationEditViewModel = new AiChatButtonWithHistoryViewModel()
AiChatButtonDocumentationEditViewModel = new AiChatButtonWithHistoryViewModel(AiActionType.ServiceRecordDocumentation)
{
};
@@ -224,12 +210,6 @@ namespace BeWo.ViewModel.ListViewModel
FirePropertyChanged(nameof(AiUserSetting));
}
public AiConversationButtonState AiConversationButtonState
{
get => _AiConversationButtonState;
set => SetProperty(ref _AiConversationButtonState, value, nameof(AiConversationButtonState));
}
public IEnumerable<ServiceRecordVM> CurrentVisibleVMs { get; set; }
public string AktuellerDokutext
{
@@ -257,252 +237,11 @@ namespace BeWo.ViewModel.ListViewModel
public bool IsAiChatButtonVisible => SelectedCustomerNode is object && IsAiModuleEnabled && BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleServiceRecordChat);
public bool IsAiDocuButtonVisible => SelectedCustomerNode is object && IsAiModuleEnabled && BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleServiceRecordDocu);
public bool IsAiRowVisible => IsAiDocuButtonVisible || VoiceToTextButtonControl.HasRightToUseAIVoice;
public void ItemAccepted(object sender, AbstractBaseVM item)
{
if(item is AiPromptbausteinRoutineVM)
{
MessageBox.Show("");
return;
}
var prompt = item as AiPromptbausteinPromptVM;
if (prompt is null)
throw new NotImplementedException();
// 1. Information aufbereiten
// 1.1 Prompt
var prompt_oid = prompt.DataContract.Oid.Value;
var prompt_version = prompt.DataContract.Version;
// 1.2 Hilfeplan
var support_concept = SelectedCustomerNode.SupportConceptTreeNodeDC.SupportConcept;
var support_concept_oid = support_concept.SupportConceptOid;
var support_concept_version = support_concept.SupportConceptVersion;
// 1.3 Aktuelles Doku Feld
var doku_feld = AktuellerDokutext;
// 1.4 Sichtbaren Zeiterfassungseinträge
var service_records = CurrentVisibleVMs;
var sr_refs = service_records.Select(x => new BeWoRefDC(x.DataContract.ServiceRecordOid.Value, x.DataContract.ServiceRecordVersion));
// 1.5 Costbearer
var costbearer = SelectedCustomerNode.SupportConceptTreeNodeDC.CostBearer;
var cb_oid = costbearer.CostBearerOid.Value;
var cb_ver = costbearer.CostBearerVersion;
// Service Aufruf
var req = new AiFunctionDocRequest()
{
AiPromptbausteinPrompt = new BeWoRefDC(prompt_oid, prompt_version),
SupportConcept = new BeWoRefDC(support_concept_oid, support_concept_version),
ServiceRecords = sr_refs,
CostBearer = new BeWoRefDC(cb_oid, cb_ver),
Dokumentation = doku_feld,
};
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.ExecuteAiFunctionServiceRecordDocumentation(req),
callback =>
{
var viewModel = new AiPromptbausteinActionResultViewModel();
viewModel.Result = callback.Result;
viewModel.Accept_Button_Clicked += (s, e) =>
{
var sb = new StringBuilder();
sb.AppendLine("AI Antwort:");
sb.AppendLine(viewModel.Result);
sb.AppendLine();
sb.AppendLine("Original:");
sb.AppendLine(AktuellerDokutext);
var str = sb.ToString();
var idx = _AiActionHistoryIndex;
var count = _AiActionHistory.Count;
if (count - 1 > idx)
{
_AiActionHistory.RemoveRange(idx + 1, count - idx - 1);
}
if (AktuellerDokutext != _AiActionHistory[_AiActionHistoryIndex])
{
_AiActionHistory.Add(AktuellerDokutext);
_AiActionHistoryIndex++;
}
_AiActionHistory.Add(str);
_AiActionHistoryIndex++;
AktuellerDokutext = str;
};
viewModel.Replace_Button_Clicked += (s, e) =>
{
var str = viewModel.Result;
var idx = _AiActionHistoryIndex;
var count = _AiActionHistory.Count;
if (count - 1 > idx)
{
_AiActionHistory.RemoveRange(idx + 1, count - idx - 1);
}
if (AktuellerDokutext != _AiActionHistory[_AiActionHistoryIndex])
{
_AiActionHistory.Add(AktuellerDokutext);
_AiActionHistoryIndex++;
}
_AiActionHistory.Add(str);
_AiActionHistoryIndex++;
AktuellerDokutext = str;
};
viewModel.Retry_Button_Clicked += (s, e) =>
{
ItemAccepted(sender, prompt);
};
BeWoApp.MainControl.WindowService.Show(viewModel);
}
);
}
public void EditPromptAccepted(object sender, AiPromptbausteinPromptVM prompt)
{
if (prompt is null)
throw new NotImplementedException();
// 1. Information aufbereiten
// 1.1 Prompt
var prompt_oid = prompt.DataContract.Oid.Value;
var prompt_version = prompt.DataContract.Version;
// 1.2 Hilfeplan
var support_concept = SelectedCustomerNode.SupportConceptTreeNodeDC.SupportConcept;
var support_concept_oid = support_concept.SupportConceptOid;
var support_concept_version = support_concept.SupportConceptVersion;
// 1.3 Aktuelles Doku Feld
var doku_feld = AktuellerEditDokutext;
// 1.4 Sichtbaren Zeiterfassungseinträge
var service_records = CurrentVisibleVMs;
var sr_refs = service_records.Select(x => new BeWoRefDC(x.DataContract.ServiceRecordOid.Value, x.DataContract.ServiceRecordVersion));
// 1.5 Costbearer
var costbearer = SelectedCustomerNode.SupportConceptTreeNodeDC.CostBearer;
var cb_oid = costbearer.CostBearerOid.Value;
var cb_ver = costbearer.CostBearerVersion;
// Service Aufruf
var req = new AiFunctionDocRequest()
{
AiPromptbausteinPrompt = new BeWoRefDC(prompt_oid, prompt_version),
SupportConcept = new BeWoRefDC(support_concept_oid, support_concept_version),
ServiceRecords = sr_refs,
CostBearer = new BeWoRefDC(cb_oid, cb_ver),
Dokumentation = doku_feld,
};
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.ExecuteAiFunctionServiceRecordDocumentation(req),
callback =>
{
var viewModel = new AiPromptbausteinActionResultViewModel();
viewModel.Result = callback.Result;
viewModel.Accept_Button_Clicked += (s, e) =>
{
var sb = new StringBuilder();
sb.AppendLine("AI Antwort:");
sb.AppendLine(viewModel.Result);
sb.AppendLine();
sb.AppendLine("Original:");
sb.AppendLine(AktuellerEditDokutext);
var str = sb.ToString();
var idx = _EditAiActionHistoryIndex;
var count = _EditAiActionHistory.Count;
if (count - 1 > idx)
{
_EditAiActionHistory.RemoveRange(idx + 1, count - idx - 1);
}
if (AktuellerEditDokutext != _EditAiActionHistory[_EditAiActionHistoryIndex])
{
_EditAiActionHistory.Add(AktuellerEditDokutext);
_EditAiActionHistoryIndex++;
}
_EditAiActionHistory.Add(str);
_EditAiActionHistoryIndex++;
AktuellerEditDokutext = str;
};
viewModel.Replace_Button_Clicked += (s, e) =>
{
var str = viewModel.Result;
var idx = _EditAiActionHistoryIndex;
var count = _EditAiActionHistory.Count;
if (count - 1 > idx)
{
_EditAiActionHistory.RemoveRange(idx + 1, count - idx - 1);
}
if (AktuellerEditDokutext != _EditAiActionHistory[_EditAiActionHistoryIndex])
{
_EditAiActionHistory.Add(AktuellerEditDokutext);
_EditAiActionHistoryIndex++;
}
_EditAiActionHistory.Add(str);
_EditAiActionHistoryIndex++;
AktuellerEditDokutext = str;
};
viewModel.Retry_Button_Clicked += (s, e) =>
{
ItemAccepted(sender, prompt);
};
BeWoApp.MainControl.WindowService.Show(viewModel);
}
);
}
public void UpdateViewYearFilter(IEnumerable<ServiceRecordVM> enumerable)
{
if (!IsAiChatButtonVisible)
{
AiConversationButtonState = AiConversationButtonState.Hidden;
return;
}
AiConversationButtonState = AiConversationButtonState.Loading;
var context = GetVisibleInformationReferences(enumerable);
if (context != null)
{
var context2 = context.ToDictionary(kv => kv.Key, kv => kv.Value.ToList());
ServiceFacade.DoAiEnhancedServiceAsnyc(x => x.CheckContextSize(AiContextType.ServiceRecord, context2, null),
isValid =>
{
if (isValid)
AiConversationButtonState = AiConversationButtonState.Normal;
else
AiConversationButtonState = AiConversationButtonState.Warning;
},
(exp) => AiConversationButtonState = AiConversationButtonState.Disabled);
}
AiChatButtonConversationViewModel.CheckContextSize();
AiChatButtonDocumentationViewModel.CheckContextSize();
}
public Dictionary<TableID, long[]> GetVisibleInformationReferences(IEnumerable<ServiceRecordVM> selected_records)

View File

@@ -912,12 +912,12 @@ namespace BeWo.ViewModel
einheit_vm_list.VMList.Sort(WohneinheitVM.Compare);
}
public static AiConversationChatViewModel CreateAiConversationChatViewModel(AiContextType uIContext, Dictionary<TableID, long[]> bewoObjects,
public static AiConversationChatViewModel CreateAiConversationChatViewModel(AiActionType actionType, Dictionary<TableID, long[]> bewoObjects,
long? reference_oid = null, bool canSendNewMessage = true)
{
var vm = new AiConversationChatViewModel();
vm.AiContext = uIContext;
vm.ActionType = actionType;
vm.ContextBeWoObjects = bewoObjects;
vm.ReferenceObjectOid = reference_oid;
vm.CanSendNewMessage = canSendNewMessage;
@@ -925,19 +925,19 @@ namespace BeWo.ViewModel
return vm;
}
public static AiConversationListVM CreateAiConversationListVM(AiContextType uIContext, long? reference_oid)
public static AiConversationListVM CreateAiConversationListVM(AiActionType actionType, long? reference_oid)
{
var list = ServiceFacade.DoAiEnhancedServiceSnyc(s => s.GetAiConversations(uIContext, reference_oid));
var list = ServiceFacade.DoAiEnhancedServiceSnyc(s => s.GetAiConversations(actionType, reference_oid));
list.Reverse();
return new AiConversationListVM(list);
}
public static void CreateAiConversationListVMAsync(AiContextType uIContext, long? reference_oid, Action<AiConversationListVM> callback)
public static void CreateAiConversationListVMAsync(AiActionType actionType, long? reference_oid, Action<AiConversationListVM> callback)
{
ServiceFacade.DoAiEnhancedServiceAsnyc(
s => s.GetAiConversations(uIContext, reference_oid),
s => s.GetAiConversations(actionType, reference_oid),
cb =>
{
cb.Reverse();

View File

@@ -163,7 +163,7 @@ namespace BeWo.ViewModel.View.AI
}
public bool IsNewConversationVisible => ListVM.SelectedVM is null;
public AiContextType AiContext { get; set; }
public AiActionType ActionType { get; set; }
public long? ReferenceObjectOid { get; set; }
public Dictionary<TableID, long[]> ContextBeWoObjects { get; set; }
@@ -200,7 +200,7 @@ namespace BeWo.ViewModel.View.AI
conv.Created = DateTime.Now;
conv.Updated = DateTime.Now;
conv.UIContext = AiContext;
conv.ActionType = ActionType;
conv.ContextBeWoObjects = ContextBeWoObjects;
conv.Messages = new List<AiConversationMessageDC>()
{
@@ -355,7 +355,7 @@ namespace BeWo.ViewModel.View.AI
}
private void ReloadConversations()
{
var ui_context = AiContext;
var ui_context = ActionType;
var reference = ReferenceObjectOid;
var list = VMFactory.CreateAiConversationListVM(ui_context, reference);

View File

@@ -21,7 +21,7 @@ namespace BeWo.Data.Entities
public virtual string Context { get; set; }
public virtual long? ApplicationUserOid { get; set; }
public virtual IList<BeWoEntityReference> ContextBeWoObjects { get; set; }
public virtual AiContextType UIContext { get; set; }
public virtual AiActionType ActionType { get; set; }
public virtual AiDataContextType ContextType { get; set; }
public virtual IList<AiConversationMessage> Messages { get; set; }
}

View File

@@ -17,7 +17,7 @@
<property name="Created"/>
<property name="Updated"/>
<property name="Context"/>
<property name="UIContext" type="BS.Shared.AiContextType, BS.Shared"/>
<property name="ActionType" type="BS.Shared.AiActionType, BS.Shared"/>
<property name="ApplicationUserOid"/>
<property name="ContextType" type="BS.Shared.AiDataContextType, BS.Shared"/>

View File

@@ -0,0 +1,5 @@
INSERT INTO `.executedscripts`
VALUES ('Changes_2026-05-22 AiConv ActionType', CURDATE());
ALTER TABLE `aiconversation`
CHANGE COLUMN `UIContext` `ActionType` INT NULL DEFAULT NULL ;

View File

@@ -11,6 +11,6 @@ namespace AICore.Context.SummaryParser
{
internal abstract class BaseContextSummaryParser
{
public abstract string Parse(AiContextType uicontext, BaseContextSummary context);
public abstract string Parse(AiActionType actionType, BaseContextSummary context);
}
}

View File

@@ -26,7 +26,7 @@ namespace AICore.Context.SummaryParser
_StrictEscapeCsvField = strictEscapeCsvField;
}
public override string Parse(AiContextType uicontext, BaseContextSummary context)
public override string Parse(AiActionType actionType, BaseContextSummary context)
{
if (context is null || context.Context is null)
return string.Empty;
@@ -92,7 +92,7 @@ namespace AICore.Context.SummaryParser
return sb.ToString();
}
throw BeWoNotImplementedException.CreateFromEnum(uicontext);
throw BeWoNotImplementedException.CreateFromEnum(actionType);
}
public string ToCsvString(BaseContextEntry entry, bool includeHeaders = true)

View File

@@ -11,7 +11,7 @@ namespace AICore.Context.SummaryParser
{
internal class JsonContextSummaryParser : BaseContextSummaryParser
{
public override string Parse(AiContextType uicontext, BaseContextSummary context)
public override string Parse(AiActionType actionType, BaseContextSummary context)
{
var options = new JsonSerializerOptions { IncludeFields = true };

View File

@@ -20,7 +20,7 @@ namespace AICore.Prompt.SystemPrompts
}
public string CreateSystemPrompt(AiContextType uicontext, BaseContextSummary context, AiDataContextType aiDataContextType)
public string CreateSystemPrompt(AiActionType actionType, BaseContextSummary context, AiDataContextType aiDataContextType)
{
var sb = new StringBuilder();
@@ -33,7 +33,7 @@ namespace AICore.Prompt.SystemPrompts
sb.AppendLine($"- Aktuelle Zeit: {DateTime.Now}");
sb.AppendLine();
sb.AppendLine("### **Ansicht**");
sb.AppendLine($"- Ich befinde mich aktuell in der \"{EnumTranslations.Ai2Translation[uicontext]}\" meiner Anwendung.");
sb.AppendLine($"- Ich befinde mich aktuell in der \"{Translations[actionType]}\" meiner Anwendung.");
sb.AppendLine($"- Es ist kein Filter gesetzt.");
sb.AppendLine();
sb.AppendLine("### **Daten**");
@@ -47,7 +47,7 @@ namespace AICore.Prompt.SystemPrompts
sb.AppendLine("Du erhälst folgende Daten:");
var parser = GetParser(aiDataContextType);
var parsed = parser.Parse(uicontext, context);
var parsed = parser.Parse(actionType, context);
sb.AppendLine(parsed);
}

View File

@@ -33,7 +33,7 @@ namespace AICore.Prompt.SystemPrompts
sb.AppendLine($"- Aktuelle Zeit: {DateTime.Now}");
sb.AppendLine();
sb.AppendLine("### **Ansicht**");
sb.AppendLine($"- Ich befinde mich aktuell in der \"{EnumTranslations.Ai2Translation[AiContextType.ServiceRecord]}\" meiner Anwendung.");
sb.AppendLine($"- Ich befinde mich aktuell in der \"Zeiterfassung\" meiner Anwendung.");
sb.AppendLine($"- Es ist kein Filter gesetzt.");
sb.AppendLine();
sb.AppendLine("### **Daten**");
@@ -47,7 +47,7 @@ namespace AICore.Prompt.SystemPrompts
sb.AppendLine("Du erhälst folgende Daten:");
var parser = new CsvContextSummaryParser();
var parsed = parser.Parse(AiContextType.ServiceRecord, context);
var parsed = parser.Parse(AiActionType.ServiceRecordDocumentation, context);
sb.AppendLine(parsed);
}

View File

@@ -1,4 +1,5 @@
using System;
using BS.Shared;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -9,6 +10,13 @@ namespace AICore.Prompt.SystemPrompts
{
public class BaseSystemPromptBuilder
{
public readonly static Dictionary<AiActionType, string> Translations = new Dictionary<AiActionType, string>
{
{AiActionType.ServiceRecord, "Zeiterfassung" },
{AiActionType.ServiceRecordConversation, "Zeiterfassung" },
{AiActionType.ServiceRecordDocumentation, "Zeiterfassung" },
};
public string Path { get; set; }
public BaseSystemPromptBuilder(string path)

View File

@@ -24,7 +24,7 @@ namespace BeWo.Service.DCEntityMapper
pDataContract.Updated = pEntity.Updated;
pDataContract.Context = pEntity.Context;
pDataContract.ContextBeWoObjects = Parse(pEntity.ContextBeWoObjects);
pDataContract.UIContext = pEntity.UIContext;
pDataContract.ActionType = pEntity.ActionType;
pDataContract.ContextType = pEntity.ContextType;
if (pEntity.Messages is IList<AiConversationMessage> list && list.Any())
@@ -49,7 +49,7 @@ namespace BeWo.Service.DCEntityMapper
pEntity.Created = pDataContract.Created;
pEntity.Updated = pDataContract.Updated;
pEntity.Context = pDataContract.Context;
pEntity.UIContext = pDataContract.UIContext;
pEntity.ActionType = pDataContract.ActionType;
pEntity.ContextBeWoObjects = Parse(pDataContract.ContextBeWoObjects);
pEntity.ContextType = pDataContract.ContextType;

View File

@@ -24,6 +24,7 @@ using BS.Shared.Exceptions;
using BS.Shared.Extensions;
using DevExpress.Charts.Native;
using DevExpress.CodeParser;
using DevExpress.DataAccess.Native.Sql;
using Newtonsoft.Json;
namespace BeWo.Service.Plugins
@@ -83,7 +84,7 @@ namespace BeWo.Service.Plugins
// ======================[ Conversations ]======================
public virtual IEnumerable<AiConversationDC> GetAiConversations(AiContextType uicontext, long? oid)
public virtual IEnumerable<AiConversationDC> GetAiConversations(AiActionType actionType, long? oid)
{
// SearchDAO
var current_user = UserRightHelper.GetLoggedInUserWithOid();
@@ -92,7 +93,7 @@ namespace BeWo.Service.Plugins
var filter = new List<AiConversation>();
foreach (var conv in convs)
{
if (conv.UIContext != uicontext)
if (conv.ActionType != actionType)
continue;
if (conv.ApplicationUserOid != current_user.Oid)
@@ -103,7 +104,7 @@ namespace BeWo.Service.Plugins
var main_ref_obj = conv.ContextBeWoObjects?.FirstOrDefault();
// ServiceRecord
if (uicontext == AiContextType.ServiceRecord)
if (actionType == AiActionType.ServiceRecordConversation || actionType == AiActionType.ServiceRecordDocumentation)
main_ref_obj = conv.ContextBeWoObjects.FirstOrDefault(x => x.Tid == TableID.SupportConcept);
if (main_ref_obj?.Oid != ref_oid)
@@ -122,7 +123,7 @@ namespace BeWo.Service.Plugins
{
var config = GetAiConfig();
var conv = createAiConversation(conversation.UIContext, conversation.ContextBeWoObjects, modell_oid, config.Context_Type);
var conv = createAiConversation(conversation.ActionType, conversation.ContextBeWoObjects, modell_oid, config.Context_Type);
DAOFactory.GenericDAO.Insert(conv);
@@ -134,7 +135,7 @@ namespace BeWo.Service.Plugins
{
var config = GetAiConfig();
var conv = createAiConversation(conversation.UIContext, conversation.ContextBeWoObjects, modell_oid, config.Context_Type);
var conv = createAiConversation(conversation.ActionType, conversation.ContextBeWoObjects, modell_oid, config.Context_Type);
var new_messages = sendNewMessage(conv, message, config);
@@ -158,7 +159,7 @@ namespace BeWo.Service.Plugins
clone_conv.Displayname = "Klon von " + parent_conv.Displayname;
clone_conv.Messages = new List<AiConversationMessage>();
clone_conv.Modell = parent_conv.Modell;
clone_conv.UIContext = parent_conv.UIContext;
clone_conv.ActionType = parent_conv.ActionType;
clone_conv.Updated = DateTime.Now;
clone_conv.ApplicationUserOid = parent_conv.ApplicationUserOid;
@@ -217,7 +218,7 @@ namespace BeWo.Service.Plugins
return sendNewMessage(conv, message);
}
public virtual bool CheckContextSize(AiContextType aiContextType, Dictionary<TableID, long[]> context, long? modell_oid)
public virtual bool CheckContextSize(AiActionType actionType, Dictionary<TableID, long[]> context, long? modell_oid)
{
var modell_oid_value = modell_oid ?? GetAiConfig().SelectedModel.Oid.Value;
@@ -229,7 +230,7 @@ namespace BeWo.Service.Plugins
if (modell_oid is null)
modell_oid = GetAiConfig().SelectedModel.Oid;
var conversation = createAiConversation(aiContextType, context, modell_oid.Value, AiDataContextType.csv2);
var conversation = createAiConversation(actionType, context, modell_oid.Value, AiDataContextType.csv2);
return AiUtils.CheckSystemMessageContextSize(conversation.Messages.Select(x => x.Message), modell.ModelName, modell.Value, out var error);
}
@@ -301,19 +302,18 @@ namespace BeWo.Service.Plugins
DAOFactory.GenericDAO.SetActivationType(toreadd, ActivationTypeId.Active);
var models = DAOFactory.GenericDAO.GetAllActive<AiModel>();
return models;
}
protected virtual AiConversation createAiConversation(AiContextType uicontext, Dictionary<TableID, long[]> context_reference, long modell_oid, AiDataContextType context_Type)
protected virtual AiConversation createAiConversation(AiActionType actionType, Dictionary<TableID, long[]> context_reference, long modell_oid, AiDataContextType context_Type)
{
var current_user = UserRightHelper.GetLoggedInUserWithOid();
var configPath = ConfigReader.GetConfigPath(SpecialConfig.CustomPreSystemPrompt);
var factory = new AiConversationSystemPromptBuilder(configPath);
var context_loaded = AiContextLoader.LoadContext(uicontext, context_reference);
var system_prompt = factory.CreateSystemPrompt(uicontext, context_loaded, context_Type);
var context_loaded = AiContextLoader.LoadContext(actionType, context_reference);
var system_prompt = factory.CreateSystemPrompt(actionType, context_loaded, context_Type);
var conv = new AiConversation();
conv.Created = DateTime.Now;
@@ -323,7 +323,7 @@ namespace BeWo.Service.Plugins
conv.Displayname = "Neue Unterhaltung";
conv.Messages = new List<AiConversationMessage>();
conv.Modell = DAOFactory.GenericDAO.LoadByID<AiModel>(modell_oid);
conv.UIContext = uicontext;
conv.ActionType = actionType;
conv.ContextType = context_Type;
conv.Updated = DateTime.Now;
conv.ApplicationUserOid = current_user.Oid;

View File

@@ -5,6 +5,7 @@ using BS.Shared;
using BS.Shared.Core;
using BS.Shared.DataContracts.Feature.AI;
using BS.Shared.DataContracts.Feature.AI.Functions.ServiceRecords;
using DevExpress.DataAccess.Native.Sql;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -35,7 +36,7 @@ namespace BeWo.Service.ServiceContracts.Enhanced
[FaultContract(typeof(BeWoFault))]
[OperationContract]
[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)]
IEnumerable<AiConversationDC> GetAiConversations(AiContextType uicontext, long? oid);
IEnumerable<AiConversationDC> GetAiConversations(AiActionType actionType, long? oid);
[FaultContract(typeof(BeWoFault))]
[OperationContract]
@@ -70,7 +71,7 @@ namespace BeWo.Service.ServiceContracts.Enhanced
[FaultContract(typeof(BeWoFault))]
[OperationContract]
[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)]
bool CheckContextSize(AiContextType aiContextType, Dictionary<TableID, long[]> context, long? modell_oid);
bool CheckContextSize(AiActionType actionType, Dictionary<TableID, long[]> context, long? modell_oid);
[FaultContract(typeof(BeWoFault))]
[OperationContract]

View File

@@ -8,6 +8,7 @@ using BS.Shared;
using BS.Shared.Core;
using BS.Shared.DataContracts.Feature.AI;
using BS.Shared.DataContracts.Feature.AI.Functions.ServiceRecords;
using DevExpress.DataAccess.Native.Sql;
using System;
using System.Collections.Generic;
using System.ServiceModel;
@@ -24,11 +25,11 @@ namespace BeWo.Service.ServiceImplementations.Enhanced
public AiConfigDC UpdateAiConfig(AiConfigDC toUpdate)
=> GetAiService().UpdateAiConfig(toUpdate);
public IEnumerable<AiModelDC> GetAiModels()
=> GetAiService().GetAiModels();
public IEnumerable<AiModelDC> GetAiModels()
=> GetAiService().GetAiModels();
public IEnumerable<AiConversationDC> GetAiConversations(AiContextType uicontext, long? oid)
=> GetAiService().GetAiConversations(uicontext, oid);
public IEnumerable<AiConversationDC> GetAiConversations(AiActionType actionType, long? oid)
=> GetAiService().GetAiConversations(actionType, oid);
public AiConversationDC CreateAiConversation(AiConversationDC conversation, long modell_oid)
=> GetAiService().CreateAiConversation(conversation, modell_oid);
@@ -47,8 +48,8 @@ namespace BeWo.Service.ServiceImplementations.Enhanced
public AiConversationMessageDC[] SendNewMessage(long conversation, string message)
=> GetAiService().SendNewMessage(conversation, message);
public bool CheckContextSize(AiContextType aiContextType, Dictionary<TableID, long[]> context, long? modell_oid)
=> GetAiService().CheckContextSize(aiContextType, context, modell_oid);
public bool CheckContextSize(AiActionType actionType, Dictionary<TableID, long[]> context, long? modell_oid)
=> GetAiService().CheckContextSize(actionType, context, modell_oid);
public AiUserSettingDC GetUserSetting()
=> GetAiService().GetUserSetting();

View File

@@ -12,92 +12,86 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AICore.Context.Core;
using DevExpress.DataAccess.Native.Sql;
using BS.Shared.Exceptions;
namespace BeWo.Service.ServiceUtils
{
public static class AiContextLoader
{
public static BaseContextSummary LoadContext(AiContextType uicontext, Dictionary<TableID, long[]> context_reference)
public static BaseContextSummary LoadContext(AiActionType actionType, Dictionary<TableID, long[]> context_reference)
{
switch (uicontext)
switch (actionType)
{
case AiContextType.SupportConceptNavigation:
case AiContextType.CustomerNavigation:
case AiContextType.PersonNavigation:
case AiContextType.EmployeeNavigation:
case AiContextType.OrganisationNavigation:
return loadNavigationContext(uicontext, context_reference);
case AiContextType.CustomerDetail:
case AiContextType.PersonDetail:
case AiContextType.EmployeeDetail:
case AiContextType.OrganisationDetail:
case AiContextType.SupportConceptDetail:
return loadDetailContext(uicontext, context_reference);
case AiContextType.ServiceRecord:
case AiActionType.ServiceRecord:
break;
case AiActionType.ServiceRecordConversation:
case AiActionType.ServiceRecordDocumentation:
return loadServiceRecordContext(context_reference);
default:
break;
}
throw new NotImplementedException();
throw BeWoNotImplementedException.CreateFromEnum(actionType);
}
private static BaseContextSummary loadNavigationContext(AiContextType uicontext, Dictionary<TableID, long[]> context_reference)
private static BaseContextSummary loadNavigationContext(AiActionType actionType, Dictionary<TableID, long[]> context_reference)
{
switch (uicontext)
switch (actionType)
{
case AiContextType.SupportConceptNavigation:
var list = new CustomerServiceImp().GetAllAuthorizedCompactSupportConcepts();
var filter = list.Where(x => oidsContainsOid(context_reference[TableID.SupportConcept], x.SupportConceptOid));
return AiContextSummaryFactory.CreateSupportConceptNavigationContextSummary(filter);
case AiContextType.CustomerNavigation:
var list2 = new CustomerServiceImp().GetAllAuthorizedCompactCustomers();
var filter2 = list2.Where(x => oidsContainsOid(context_reference[TableID.Customer], x.CustomerOid));
return AiContextSummaryFactory.CreateCustomerNavigationContextSummary(filter2);
case AiContextType.PersonNavigation:
var list3 = new CustomerServiceImp().GetAllAuthorizedCompactPersons();
var filter3 = list3.Where(x => oidsContainsOid(context_reference[TableID.Person], x.PersonOid));
return AiContextSummaryFactory.CreatePersonNavigationContextSummary(filter3);
case AiContextType.EmployeeNavigation:
var list4 = new EmployeeServiceImp().GetAllCompactEmployees();
var filter4 = list4.Where(x => oidsContainsOid(context_reference[TableID.Employee], x.EmployeeOid));
return AiContextSummaryFactory.CreateEmployeeNavigationContextSummary(filter4);
case AiContextType.OrganisationNavigation:
var list5 = new CustomerServiceImp().GetAllOrganisationsCompact();
var filter5 = list5.Where(x => oidsContainsOid(context_reference[TableID.Organisation], x.OrganisationOid));
return AiContextSummaryFactory.CreateOrganisationNavigationContextSummary(filter5);
//case AiContextType.SupportConceptNavigation:
// var list = new CustomerServiceImp().GetAllAuthorizedCompactSupportConcepts();
// var filter = list.Where(x => oidsContainsOid(context_reference[TableID.SupportConcept], x.SupportConceptOid));
// return AiContextSummaryFactory.CreateSupportConceptNavigationContextSummary(filter);
//case AiContextType.CustomerNavigation:
// var list2 = new CustomerServiceImp().GetAllAuthorizedCompactCustomers();
// var filter2 = list2.Where(x => oidsContainsOid(context_reference[TableID.Customer], x.CustomerOid));
// return AiContextSummaryFactory.CreateCustomerNavigationContextSummary(filter2);
//case AiContextType.PersonNavigation:
// var list3 = new CustomerServiceImp().GetAllAuthorizedCompactPersons();
// var filter3 = list3.Where(x => oidsContainsOid(context_reference[TableID.Person], x.PersonOid));
// return AiContextSummaryFactory.CreatePersonNavigationContextSummary(filter3);
//case AiContextType.EmployeeNavigation:
// var list4 = new EmployeeServiceImp().GetAllCompactEmployees();
// var filter4 = list4.Where(x => oidsContainsOid(context_reference[TableID.Employee], x.EmployeeOid));
// return AiContextSummaryFactory.CreateEmployeeNavigationContextSummary(filter4);
//case AiContextType.OrganisationNavigation:
// var list5 = new CustomerServiceImp().GetAllOrganisationsCompact();
// var filter5 = list5.Where(x => oidsContainsOid(context_reference[TableID.Organisation], x.OrganisationOid));
// return AiContextSummaryFactory.CreateOrganisationNavigationContextSummary(filter5);
}
throw new NotImplementedException();
throw BeWoNotImplementedException.CreateFromEnum(actionType);
}
private static BaseContextSummary loadDetailContext(AiContextType uicontext, Dictionary<TableID, long[]> context_reference)
private static BaseContextSummary loadDetailContext(AiActionType actionType, Dictionary<TableID, long[]> context_reference)
{
switch (uicontext)
switch (actionType)
{
case AiContextType.CustomerDetail:
var oids = context_reference[TableID.Customer];
var dc = new CustomerServiceImp().LoadCustomer(oids[0]);
return AiContextSummaryFactory.CreateCustomerDetailContextSummary(dc);
case AiContextType.PersonDetail:
var oids2 = context_reference[TableID.Person];
var dc2 = new CustomerServiceImp().LoadPerson(oids2[0]);
return AiContextSummaryFactory.CreatePersonDetailContextSummary(dc2);
case AiContextType.EmployeeDetail:
var oids3 = context_reference[TableID.Employee];
var dc3 = new EmployeeServiceImp().LoadEmployee(oids3[0]);
return AiContextSummaryFactory.CreateEmployeeDetailContextSummary(dc3);
case AiContextType.OrganisationDetail:
var oids4 = context_reference[TableID.Organisation];
var dc4 = new CustomerServiceImp().LoadOrganisation(oids4[0]);
return AiContextSummaryFactory.CreateOrganisationDetailContextSummary(dc4);
case AiContextType.SupportConceptDetail:
var oids5 = context_reference[TableID.SupportConcept];
var dc5 = new CustomerServiceImp().LoadSupportConcept(oids5[0]);
return AiContextSummaryFactory.CreateSupportConceptDetailContextSummary(dc5);
//case AiContextType.CustomerDetail:
// var oids = context_reference[TableID.Customer];
// var dc = new CustomerServiceImp().LoadCustomer(oids[0]);
// return AiContextSummaryFactory.CreateCustomerDetailContextSummary(dc);
//case AiContextType.PersonDetail:
// var oids2 = context_reference[TableID.Person];
// var dc2 = new CustomerServiceImp().LoadPerson(oids2[0]);
// return AiContextSummaryFactory.CreatePersonDetailContextSummary(dc2);
//case AiContextType.EmployeeDetail:
// var oids3 = context_reference[TableID.Employee];
// var dc3 = new EmployeeServiceImp().LoadEmployee(oids3[0]);
// return AiContextSummaryFactory.CreateEmployeeDetailContextSummary(dc3);
//case AiContextType.OrganisationDetail:
// var oids4 = context_reference[TableID.Organisation];
// var dc4 = new CustomerServiceImp().LoadOrganisation(oids4[0]);
// return AiContextSummaryFactory.CreateOrganisationDetailContextSummary(dc4);
//case AiContextType.SupportConceptDetail:
// var oids5 = context_reference[TableID.SupportConcept];
// var dc5 = new CustomerServiceImp().LoadSupportConcept(oids5[0]);
// return AiContextSummaryFactory.CreateSupportConceptDetailContextSummary(dc5);
}
throw new NotImplementedException();
throw BeWoNotImplementedException.CreateFromEnum(actionType);
}
private static BaseContextSummary loadServiceRecordContext(Dictionary<TableID, long[]> context_reference)

View File

@@ -1431,40 +1431,6 @@ namespace BS.Shared
ServiceRecordDocumentation
}
public enum AiContextType
{
SupportConceptNavigation = 0,
CustomerNavigation = 1,
PersonNavigation = 2,
EmployeeNavigation = 3,
OrganisationNavigation = 4,
//Team = 5,
//Dokumente = 6,
//User = 7,
//UserGroup = 8,
//Report = 9,
//Scheduler = 10,
//Wohnheim = 11,
//Vertretungen = 12,
//CustomerTeam = 13,
//Scheduling = 14,
//Finance = 15,
//Administration = 16,
//AiConversation = 17,
//AiConversationPopup = 18,
ServiceRecord = 19,
CustomerDetail = 20,
PersonDetail = 21,
EmployeeDetail = 22,
OrganisationDetail = 23,
SupportConceptDetail = 24,
}
public enum AiFunctionType
{
ServiceRecordDocumentation
}
public enum AiModelSource
{
openwebui,

View File

@@ -37,8 +37,6 @@ namespace BS.Shared.Core
public static Dictionary<Enum, string> Gkv2Translation;
public static Dictionary<Enum, string> VgaType2Translation;
public static Dictionary<Enum, string> Ai2Translation;
public static Dictionary<ValueListEntryType, String> ValueListEntryType2Header;
public static Dictionary<ValueListEntryType, String> ValueListEntryTypeTranslations;
@@ -72,7 +70,6 @@ namespace BS.Shared.Core
TempTranslations = new List<Dictionary<Enum, string>>()
{
(Gkv2Translation = GetGkvTranslation()),
(Ai2Translation = GetAiTranslations()),
(VgaType2Translation = GetVgaTypeTranslation())
};
@@ -1177,19 +1174,6 @@ namespace BS.Shared.Core
{ GkvVerfahrensstufe.Echt, "Echt" }
};
private static Dictionary<Enum, string> GetAiTranslations() => new Dictionary<Enum, string>
{
{ AiContextType.SupportConceptNavigation, "Hilfeplan Navigation" },
{ AiContextType.CustomerNavigation, "Klienten Navigation" },
{ AiContextType.PersonNavigation, "Personen Navigation" },
{ AiContextType.EmployeeNavigation, "Mitarbeiter Navigation" },
{ AiContextType.OrganisationNavigation, "Organisationen Navigation" },
{ AiContextType.ServiceRecord, "Zeiterfassung" },
{ AiContextType.CustomerDetail, "Klienten Ansicht" },
{ AiContextType.EmployeeDetail, "Personen Ansicht" },
{ AiContextType.PersonDetail, "Mitarbeiter Ansicht" }
};
private static Dictionary<Enum, string> GetVgaTypeTranslation() => new Dictionary<Enum, string>
{
{ VgaTypeEnum.Vga, Translator.Translate("VgA") },

View File

@@ -27,7 +27,7 @@ namespace BS.Shared.DataContracts.Feature.AI
[DataMember] public AiModelDC Modell { get; set; }
[DataMember] public string Context { get; set; }
[DataMember] public Dictionary<TableID, long[]> ContextBeWoObjects { get; set; } = new Dictionary<TableID, long[]>();
[DataMember] public AiContextType UIContext { get; set; }
[DataMember] public AiActionType ActionType { get; set; }
[DataMember] public AiDataContextType ContextType { get; set; }
[DataMember] public List<AiConversationMessageDC> Messages { get; set; }
}

View File

@@ -0,0 +1,22 @@
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
{
[DataContract]
public class AiViewContextDC : IDataContract
{
[DataMember]
public object Primary { get; set; }
[DataMember]
public object Secondary { get; set; }
[DataMember]
public Dictionary<TableID, long[]> References { get; set; }
}
}

View File

@@ -194,6 +194,7 @@
<Compile Include="DataContracts\AdminService\AdminServiceSumResponseDetailDC.cs" />
<Compile Include="DataContracts\AdminService\IAdminServiceDC.cs" />
<Compile Include="DataContracts\AdminService\AdminServiceSumReqDC.cs" />
<Compile Include="DataContracts\Feature\AI\AiViewContextDC.cs" />
<Compile Include="DataContracts\TeamFolderRightDC.cs" />
<Compile Include="DataContracts\Feature\AI\AiPromptbausteinRoutineDC.cs" />
<Compile Include="DataContracts\Feature\AI\AiPromptbausteinRoutineStepDC.cs" />

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishUrlHistory />
@@ -9,6 +9,6 @@
<ErrorReportUrlHistory />
<FallbackCulture>de-DE</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
<ProjectView>ProjectFiles</ProjectView>
<ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup>
</Project>