ComplexeAuswahl

This commit is contained in:
2026-01-13 12:46:43 +01:00
parent 3c062a4e22
commit df4de8ba1e
14 changed files with 431 additions and 25 deletions

View File

@@ -143,6 +143,7 @@
<Compile Include="ViewModel\View\Administration\AiPromptbausteinTreeViewModel.cs" />
<Compile Include="ViewModel\View\AI\AiConversationChatViewModel.cs" />
<Compile Include="ViewModel\View\AI\AiPromptbausteinActionResultViewModel.cs" />
<Compile Include="ViewModel\View\AI\AiPromptbausteinComplexSelectionViewModel.cs" />
<Compile Include="ViewModel\View\AI\AiPromptbausteinSelectionViewModel.cs" />
<Compile Include="ViewModel\View\DialogViewModel.cs" />
<Compile Include="ViewModel\View\Gkv\GkvAbrechnungDialogViewModel.cs" />
@@ -150,6 +151,9 @@
<Compile Include="View\Detail\AI\AiPromptbausteinActionResultView.xaml.cs">
<DependentUpon>AiPromptbausteinActionResultView.xaml</DependentUpon>
</Compile>
<Compile Include="View\Detail\AI\AiPromptbausteinComplexSelectionView.xaml.cs">
<DependentUpon>AiPromptbausteinComplexSelectionView.xaml</DependentUpon>
</Compile>
<Compile Include="View\Detail\AI\AiPromptbausteinPromptView.xaml.cs">
<DependentUpon>AiPromptbausteinPromptView.xaml</DependentUpon>
</Compile>
@@ -225,6 +229,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\Detail\AI\AiPromptbausteinComplexSelectionView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\Detail\AI\AiPromptbausteinPromptView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>

View File

@@ -68,6 +68,10 @@ namespace BeWo.Services
{
ShowAiPromptbausteinActionResultPopup(viewModel5);
}
else if(windowViewModel is AiPromptbausteinSelectionComplexViewModel viewModel6)
{
ShowAiPromptbausteinSelectionComplexPopup(viewModel6);
}
else
{
throw new NotImplementedException($"type not implemented: {typeof(T)}");
@@ -136,6 +140,17 @@ namespace BeWo.Services
Show("KI Promptbaustein Ergebnis", control, viewModel, options);
}
public void ShowAiPromptbausteinSelectionComplexPopup(AiPromptbausteinSelectionComplexViewModel viewModel)
{
var control = new AiPromptbausteinComplexSelectionView(viewModel);
var options = new BeWoWindowOptions()
{
Height = 400,
Width = 600
};
Show("KI Promptbaustein Auswahl", control, viewModel, options);
}
public void ShowGkvAbrechnungDetailWindow(GkvAbrechnungDialogViewModel vm)
{

View File

@@ -28,14 +28,14 @@
<TextBox
Height="auto"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" Text="{Binding Result}" TextWrapping="Wrap">
</TextBox>
VerticalAlignment="Stretch"
Text="{Binding Result}"
TextWrapping="Wrap" />
<StackPanel
Grid.Row="1"
HorizontalAlignment="Right"
Orientation="Horizontal">
<Button Command="{Binding CancelCommand}">Abrechen</Button>
<Button Command="{Binding CancelCommand}">Abbrechen</Button>
<Button Command="{Binding RetryCommand}">Nochmal versuchen</Button>
<Button Command="{Binding AcceptCommand}">Anfügen</Button>
<Button Command="{Binding ReplaceCommand}">Ersetzen</Button>

View File

@@ -0,0 +1,221 @@
<UserControl
x:Class="BeWo.View.Detail.AI.AiPromptbausteinComplexSelectionView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ai="clr-namespace:BeWo.ViewModel.View.AI"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:local="clr-namespace:BeWo.View.Detail.AI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BeWo.ViewModel"
d:DataContext="{d:DesignInstance Type=ai:AiPromptbausteinSelectionComplexViewModel,
IsDesignTimeCreatable=True}"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\..\..\Styles\ModernOrangeBlack.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style
x:Key="PromptListBoxItem"
BasedOn="{StaticResource PhotoListBoxItem}"
TargetType="ListBoxItem">
<Setter Property="IsSelected" Value="{Binding IsSelected}" />
</Style>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MinWidth="200" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="2*" MinWidth="200" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<GroupBox
Grid.Column="0"
HorizontalAlignment="Stretch"
Header="Ordner"
Style="{StaticResource ObjectEditGroupBox}">
<TreeView
x:Name="treeView"
MinHeight="100"
Padding="4,16,4,16"
ItemContainerStyle="{DynamicResource igoal_treeitemstyle}"
ItemTemplate="{StaticResource ai_promptbaustein_folder_itemtemplate}"
ItemsSource="{Binding Folders.VMList, UpdateSourceTrigger=PropertyChanged}"
SelectedItemChanged="treeView_SelectedItemChanged">
<TreeView.Resources>
<Style x:Key="igoal_treeitemstyle" TargetType="TreeViewItem">
<Setter Property="IsEnabled" Value="{Binding IsEnabled}" />
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
</Style>
</TreeView.Resources>
</TreeView>
</GroupBox>
<GridSplitter
Grid.Column="1"
Width="1"
HorizontalAlignment="Center"
Background="#878890" />
<GroupBox
Grid.Column="2"
Grid.ColumnSpan="2"
HorizontalAlignment="Stretch"
Header="Prompts"
Style="{StaticResource ObjectEditGroupBox}">
<dxe:ListBoxEdit
x:Name="listBoxEdit1"
Padding="4,16,4,16"
ItemContainerStyle="{StaticResource PromptListBoxItem}"
ItemsSource="{Binding SelectedFolder.SubPrompts.VMList, UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding SelectedPrompt, Mode=TwoWay}">
<dxe:ListBoxEdit.ItemTemplate>
<DataTemplate>
<Grid
Margin="0,3,0,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBox
Height="21"
Margin="0"
Padding="0"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
Cursor="Arrow"
Focusable="False"
FontWeight="Medium"
IsReadOnly="True"
Text="{Binding Path=Title, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
ToolTipService.ShowDuration="100000">
<TextBox.ToolTip>
<StackPanel Orientation="Vertical">
<Label Content="{Binding Path=Title, Mode=OneWay}" FontWeight="Bold" />
<TextBox
MaxWidth="500"
Padding="3,1,0,0"
VerticalAlignment="Center"
AcceptsReturn="True"
Background="Transparent"
BorderThickness="0"
IsReadOnly="True"
Text="{Binding Path=Description}"
TextWrapping="Wrap" />
</StackPanel>
</TextBox.ToolTip>
</TextBox>
<TextBlock
Grid.Column="1"
Margin="0"
Padding="0"
Visibility="{Binding IsInfoVisible, Converter={StaticResource BoolVisibilityConverter}}">
<Hyperlink NavigateUri="{Binding OwnsoftRefLink}" RequestNavigate="Hyperlink_RequestNavigate">
(i)
</Hyperlink>
</TextBlock>
</Grid>
</DataTemplate>
</dxe:ListBoxEdit.ItemTemplate>
</dxe:ListBoxEdit>
</GroupBox>
<!--<GroupBox
Grid.Row="1"
Grid.Column="2"
Header="Details"
Style="{StaticResource ObjectEditGroupBox}">
<Grid
MaxWidth="700"
HorizontalAlignment="Stretch"
Background="#fdfdfd">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" MinWidth="80" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="3*" MinWidth="100" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0">Name</Label>
<TextBox
Grid.Row="0"
Grid.Column="2"
IsEnabled="{Binding IsEditingMode}"
Text="{Binding ViewModel.Title, UpdateSourceTrigger=PropertyChanged}" />
<Label
Grid.Row="1"
Grid.Column="0"
Content="Beschreibung" />
<TextBox
Grid.Row="1"
Grid.Column="2"
IsEnabled="{Binding IsEditingMode}"
MaxLength="1024"
Style="{StaticResource TextBoxNotice}"
Text="{Binding ViewModel.Description, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap" />
<Label
Grid.Row="2"
Grid.Column="0"
Content="Prompt" />
<TextBox
Grid.Row="2"
Grid.Column="2"
IsEnabled="{Binding IsEditingMode}"
MaxLength="1024"
Style="{StaticResource TextBoxNoticeLarge}"
Text="{Binding ViewModel.Prompt, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap" />
<Label
Grid.Row="3"
Grid.Column="0"
Content="Ersteller:" />
<comboboxes:ComboBoxEmployeeSearch
Grid.Row="3"
Grid.Column="2"
Margin="3"
IsEnabled="False"
SelectedCompactEmployeeDC="{Binding ViewModel.Creator}" />
<Label Grid.Row="4" Grid.Column="0">Öffentlich</Label>
<dxe:CheckEdit
Grid.Row="4"
Grid.Column="2"
Margin="3"
IsChecked="{Binding ViewModel.IsPublic}"
IsEnabled="{Binding IsEditingMode, UpdateSourceTrigger=PropertyChanged}" />
</Grid>
</GroupBox>-->
<Button
Grid.Row="1"
Grid.ColumnSpan="3"
Command="{Binding SendCommand}"
Style="{StaticResource PrimaryButton}">
Absenden
</Button>
</Grid>
</UserControl>

View File

@@ -0,0 +1,73 @@
using BeWo.ViewModel.View.AI;
using BeWo.ViewModel;
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;
using System.Diagnostics;
namespace BeWo.View.Detail.AI
{
/// <summary>
/// Interaktionslogik für AiPromptbausteinComplexSelectionView.xaml
/// </summary>
public partial class AiPromptbausteinComplexSelectionView : UserControl
{
public AiPromptbausteinSelectionComplexViewModel ViewModel { get; set; }
public AiPromptbausteinComplexSelectionView(AiPromptbausteinSelectionComplexViewModel viewModel)
{
InitializeComponent();
DataContext = ViewModel = viewModel;
Loaded += (s, e) => ViewModel.ReloadVMList();
}
private void treeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
if (ViewModel is null)
return;
ViewModel.SelectedFolder = treeView.SelectedValue as AiPromptbausteinFolderVM;
}
static TreeViewItem VisualUpwardSearch(DependencyObject source)
{
while (source != null && !(source is TreeViewItem))
source = VisualTreeHelper.GetParent(source);
return source as TreeViewItem;
}
private void treeView_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
TreeViewItem treeViewItem = VisualUpwardSearch(e.OriginalSource as DependencyObject);
if (treeViewItem is null)
return;
if (e.ClickCount == 2)
{
if (ViewModel.CanSend())
ViewModel.Send();
}
}
private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
{
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
e.Handled = true;
}
}
}

View File

@@ -37,7 +37,7 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MinWidth="200" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" MinWidth="200" />
<ColumnDefinition Width="2*" MinWidth="200" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />

View File

@@ -172,13 +172,15 @@ namespace BeWo.ViewModel.ListViewModel
}
VMList.ListChanged += (s, e) => CheckCustomerAbsenceTimes();
var vm_doku = new AiPromptbausteinSelectionViewModel(AiActionType.ServiceRecordDocumentation);
var vm_doku = new AiPromptbausteinSelectionComplexViewModel(AiActionType.ServiceRecordDocumentation);
//var vm_doku = new AiPromptbausteinSelectionViewModel(AiActionType.ServiceRecordDocumentation);
vm_doku.PromptAccepted += PromptAccepted;
OpenAiPromptSelectionCommand = new DelegateCommand(() =>
{
BeWoApp.MainControl.WindowService.ShowAiPromptbausteinSelectionWindow(vm_doku);
BeWoApp.MainControl.WindowService.Show(vm_doku);
//BeWoApp.MainControl.WindowService.ShowAiPromptbausteinSelectionWindow(vm_doku);
}, () => !string.IsNullOrWhiteSpace(AktuellerDokutext));
UndoAiActionCommand = new DelegateCommand(UndoAiAction);
@@ -205,9 +207,9 @@ namespace BeWo.ViewModel.ListViewModel
public bool IsUndoButtonVisible => _AiActionHistoryIndex > 0;
public bool IsRedoButtonVisible => _AiActionHistoryIndex < _AiActionHistory.Count - 1;
private void PromptAccepted(object sender, AiPromptbausteinTreeVM prompt)
private void PromptAccepted(object sender, AiPromptbausteinPromptVM prompt)
{
if (prompt is null || prompt.PromptbausteinType != AiPromptbausteinType.Prompt)
if (prompt is null)
throw new NotImplementedException();
// 1. Information aufbereiten
@@ -235,7 +237,7 @@ namespace BeWo.ViewModel.ListViewModel
// Service Aufruf
var req = new AiFunctionDocRequest()
{
AiPromptbaustein = new BeWoRefDC(prompt_oid, prompt_version),
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),

View File

@@ -955,5 +955,12 @@ namespace BeWo.ViewModel
req => req.GetAiPromptbausteineSubTree(aiActionType),
res => get_viewmodel(new AiPromptbausteinTreeListVM(res)));
}
internal static void CreateAiPromptbausteinFolderListVMAsync(AiActionType aiActionType, Action<AiPromptbausteinFolderListVM> get_viewmodel)
{
ServiceFacade.DoAiEnhancedServiceAsnyc(
req => req.GetAiPromptbausteinFolder(aiActionType),
res => get_viewmodel(new AiPromptbausteinFolderListVM(res)));
}
}
}

View File

@@ -45,7 +45,6 @@ namespace BeWo.ViewModel.View.AI
OpenCloneCommand = new DelegateCommand(OpenClone, () => BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleChatClone) && ListVM.SelectedVM is object && BeWoAppInfo.IsInAiDeveloperMode);
CloneCommand = new DelegateCommand(Clone);
AskDeleteCommand = new DelegateCommand(AskDelete, () => BeWoApp.HasLoggedOnUserRight(UserRightType.AiModuleChatDelete) && ListVM.SelectedVM is object);
ListVM = new AiConversationListVM();

View File

@@ -0,0 +1,82 @@
using BeWo.ServiceProxy;
using BeWo.Services;
using BeWo.ViewModel.ListViewModel;
using BS.Shared;
using BS.Shared.Extensions.CustomInterfaces;
using DevExpress.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Input;
namespace BeWo.ViewModel.View.AI
{
public class AiPromptbausteinSelectionComplexViewModel : DialogViewModel
{
private AiPromptbausteinFolderVM _SelectedFolder;
public AiPromptbausteinSelectionComplexViewModel()
{
SendCommand = new DelegateCommand(Send, CanSend, true);
if (BeWoApp.IsInDesignMode)
{
Folders = new AiPromptbausteinFolderListVM();
}
}
public AiPromptbausteinSelectionComplexViewModel(AiActionType aiActionType) : this()
{
AiActionType = aiActionType;
}
public AiPromptbausteinSelectionComplexViewModel(AiActionType aiActionType, AiPromptbausteinFolderListVM viewModel) : this(aiActionType)
{
Folders = viewModel;
}
public event EventHandler<AiPromptbausteinPromptVM> PromptAccepted;
public AiActionType AiActionType { get; set; }
public AiPromptbausteinFolderVM SelectedFolder
{
get => _SelectedFolder;
set
{
_SelectedFolder = value;
FirePropertyChanged(nameof(SelectedFolder));
}
}
public AiPromptbausteinPromptVM SelectedPrompt { get; set; }
public AiPromptbausteinFolderListVM Folders { get; private set; }
public ICommand SendCommand { get; set; }
public void Send()
{
CloseDialogCommand.Execute(null);
PromptAccepted?.Invoke(this, SelectedPrompt);
}
public bool CanSend()
{
return SelectedPrompt is object;
}
public void ReloadVMList()
{
VMFactory.CreateAiPromptbausteinFolderListVMAsync(AiActionType, UpdateVMList);
}
private void UpdateVMList(AiPromptbausteinFolderListVM new_list)
{
Folders = new_list;
FirePropertyChanged(nameof(Folders));
}
}
}

View File

@@ -81,7 +81,6 @@ namespace BeWo.ViewModel.View.Administration
IsEditingMode = true;
}
public override bool IsDirty
{
get
@@ -167,12 +166,11 @@ namespace BeWo.ViewModel.View.Administration
}
internal void ReloadVMList()
{
ServiceFacade.DoAiEnhancedServiceAsnyc(
req => req.GetAiPromptbausteinFolder(AiActionType),
callback =>
VMFactory.CreateAiPromptbausteinFolderListVMAsync(
AiActionType,
listvm =>
{
Folders = new AiPromptbausteinFolderListVM(callback);
Folders = listvm;
FirePropertyChanged(nameof(Folders));
});
}

View File

@@ -37,24 +37,24 @@ namespace BeWo.Service.Plugins
var factory = new AiFunctionSystemPromptBuilder(systemPromptFolderPath);
var system_prompt = factory.CreateServiceRecordDocumentationSystemPrompt(context);
var prompt_baustein_ref = request.AiPromptbaustein;
var prompt_baustein_ref = request.AiPromptbausteinPrompt;
var prompt_baustein_ref_oid = prompt_baustein_ref.Oid;
var prompt_baustein_ref_ver = prompt_baustein_ref.Version;
var prompt_baustein = DAOFactory.GenericDAO.LoadByID<AiPromptbausteinTree>(prompt_baustein_ref_oid);
var prompt_baustein = DAOFactory.GenericDAO.LoadByID<AiPromptbausteinPrompt>(prompt_baustein_ref_oid);
ServiceLogic.ConcurrencyCheck(prompt_baustein_ref_ver, prompt_baustein);
if (prompt_baustein.IsOrdner())
throw new Exception("prompt is folder");
//if (prompt_baustein.IsOrdner())
// throw new Exception("prompt is folder");
if (prompt_baustein.IsKette())
throw new NotImplementedException();
//if (prompt_baustein.IsKette())
// throw new NotImplementedException();
if (prompt_baustein.Oid < 0)
throw new NotImplementedException();
// Anfrage abschicken
var result = getResult(system_prompt, prompt_baustein.Content);
var result = getResult(system_prompt, prompt_baustein.Prompt);
// Response auswerten

View File

@@ -158,6 +158,7 @@ namespace BeWo.Service.Plugins
foreach (var dc in own_dcs)
{
initOwnFolder(dc);
dc.ParentFolderOid = own_bib.Oid;
}
own_bib.SubFolders.AddRange(own_dcs);

View File

@@ -11,7 +11,7 @@ namespace BS.Shared.DataContracts.Feature.AI.Functions.ServiceRecords
public class AiFunctionDocRequest
{
[DataMember]
public BeWoRefDC AiPromptbaustein { get; set; }
public BeWoRefDC AiPromptbausteinPrompt { get; set; }
[DataMember]
public BeWoRefDC SupportConcept { get; set; }