AiPromptbaustein SelectionView

This commit is contained in:
2025-11-05 11:49:53 +01:00
parent aab52ad5d0
commit cf9327b6d6
30 changed files with 294 additions and 32 deletions

View File

@@ -116,7 +116,9 @@
<Compile Include="ViewModel\AiPromptbausteinVM.cs" />
<Compile Include="ViewModel\View\Administration\AiPromptbausteinDetailViewModel.cs" />
<Compile Include="ViewModel\View\Administration\AiPromptbausteinTreeViewModel.cs" />
<Compile Include="ViewModel\View\AiConversationChatViewModel.cs" />
<Compile Include="ViewModel\View\AI\AiConversationChatViewModel.cs" />
<Compile Include="ViewModel\View\AI\AiPromptbausteinSelectionViewModel.cs" />
<Compile Include="ViewModel\View\DialogViewModel.cs" />
<Compile Include="ViewModel\View\WindowViewModel.cs" />
<Compile Include="View\Controls\AiPromptbausteinDetailView.xaml.cs">
<DependentUpon>AiPromptbausteinDetailView.xaml</DependentUpon>
@@ -133,6 +135,9 @@
<Compile Include="View\Detail\AI\AiConfigView.xaml.cs">
<DependentUpon>AiConfigView.xaml</DependentUpon>
</Compile>
<Compile Include="View\Detail\AI\AiPromptbausteinSelectionView.xaml.cs">
<DependentUpon>AiPromptbausteinSelectionView.xaml</DependentUpon>
</Compile>
<Compile Include="View\Detail\AI\AiPromptbausteinView.xaml.cs">
<DependentUpon>AiPromptbausteinView.xaml</DependentUpon>
</Compile>
@@ -199,6 +204,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\Detail\AI\AiPromptbausteinSelectionView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\Detail\AI\AiPromptbausteinView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>

View File

@@ -56,7 +56,7 @@ namespace BeWo
public static LoginControl LoginControl;
public static MainControl MainControl;
public static string ShortVersion = "3.27.2";
public static string ShortVersion = "3.28";
public static string Version => BeWoAppInfo.BeWoAppVersion.ToString();
public static int RenderTier = 0;

View File

@@ -14,8 +14,8 @@ namespace BeWo
static BeWoAppInfo()
{
var baseVersion = new Version(BeWoApp.ShortVersion);
var stage = BeWoClientReleaseStage.Sandbox;
var stageVersion = new Version("1.4.1");
var stage = BeWoClientReleaseStage.ProofOfConcept;
var stageVersion = new Version("1.5");
var feature = BeWoClientFeature.AI;
BeWoAppVersion = new BeWoAppVersion(baseVersion, stage, stageVersion, feature);

View File

@@ -3,6 +3,7 @@ using BeWo.View.Detail.AI;
using BeWo.ViewModel;
using BeWo.ViewModel.View;
using BeWo.ViewModel.View.Administration;
using BeWo.ViewModel.View.AI;
using BS.Shared;
using System;
using System.Collections.Generic;
@@ -25,11 +26,6 @@ namespace BeWo.Services
return control;
}
public Control GetAiPromptbausteinControl(AiPromptbausteinDetailViewModel vm)
{
return new AiPromptbausteinDetailView(vm);
}
private string getStyleString(AiContextType uIContext) {
switch (uIContext)
{

View File

@@ -1,6 +1,7 @@
using BeWo.View.Detail.AI;
using BeWo.View.Windows;
using BeWo.ViewModel.View;
using BeWo.ViewModel.View.AI;
using BS.Shared;
using DevExpress.Mvvm.Native;
using System;

View File

@@ -1,7 +1,10 @@
using BeWo.View.Windows;
using BeWo.View.Controls;
using BeWo.View.Detail.AI;
using BeWo.View.Windows;
using BeWo.ViewModel;
using BeWo.ViewModel.View;
using BeWo.ViewModel.View.Administration;
using BeWo.ViewModel.View.AI;
using BS.Shared;
using BS.Shared.DataContracts;
using System;
@@ -38,23 +41,43 @@ namespace BeWo.Services
(wf, ctrl) => wf.GetAiModalViewWindow(viewModel, ctrl));
}
public void ShowAiPromptbausteinWindow(AiPromptbausteinDetailViewModel viewModel)
public void ShowAiPromptbausteinDetailWindow(AiPromptbausteinDetailViewModel viewModel)
{
ShowWindowDialog(
cf => cf.GetAiPromptbausteinControl(viewModel),
(wf, ctrl) => { var window = wf.GetAnimatedBeWoWindow("AiPromptbaustein", ctrl, 200, 400);
viewModel.CloseWindow = window.Close;
return window;
});
ShowDialog(
cf => new AiPromptbausteinDetailView(viewModel),
(wf, ctrl) => wf.GetAnimatedBeWoWindow("AiPromptbaustein", ctrl, 200, 400),
viewModel);
}
public void ShowAiPromptbausteinSelectionWindow(AiPromptbausteinSelectionViewModel viewModel)
{
ShowDialog(
cf => new AiPromptbausteinSelectionView(viewModel),
(wf, ctrl) => wf.GetAnimatedBeWoWindow("AiPromptbausteinSelection", ctrl, 400, 600),
viewModel);
}
private void ShowWindow(Func<IControlFactory, Control> getControl, Func<IWindowFactory, Control, Window> getWindow)
{
// Problem mit dem Warte Fenster
throw new NotImplementedException();
var control = getControl(_controlFactory);
var window = getWindow(_builder, control);
window.Show();
}
private void ShowDialog(Func<IControlFactory, Control> getControl, Func<IWindowFactory, Control, Window> getWindow, DialogViewModel dialogViewModel)
{
var control = getControl(_controlFactory);
var window = getWindow(_builder, control);
if(dialogViewModel != null)
{
dialogViewModel.RequestClose += (s, e) => window.Close();
}
window.ShowDialog();
}
private void ShowWindowDialog(Func<IControlFactory, Control> getControl, Func<IWindowFactory, Control, Window> getWindow)
{
var control = getControl(_controlFactory);

View File

@@ -1,6 +1,7 @@
using BeWo.ViewModel;
using BeWo.ViewModel.View;
using BeWo.ViewModel.View.Administration;
using BeWo.ViewModel.View.AI;
using BS.Shared;
using System;
using System.Collections.Generic;
@@ -15,6 +16,5 @@ namespace BeWo.Services
public interface IControlFactory
{
Control GetAiConversationControl(AiConversationChatViewModel vm);
Control GetAiPromptbausteinControl(AiPromptbausteinDetailViewModel vm);
}
}

View File

@@ -1,5 +1,5 @@
using BeWo.View.Windows;
using BeWo.ViewModel.View;
using BeWo.ViewModel.View.AI;
using BS.Shared;
using System;
using System.Collections.Generic;

View File

@@ -1,6 +1,7 @@
using BeWo.ViewModel;
using BeWo.ViewModel.View;
using BeWo.ViewModel.View.Administration;
using BeWo.ViewModel.View.AI;
using BS.Shared;
using System;
using System.Collections.Generic;
@@ -17,6 +18,7 @@ namespace BeWo.Services
void ShowAiConversationWindow(AiConversationChatViewModel viewModel);
void ShowAiConversationModalViewWindow(AiConversationChatViewModel viewModel);
void ShowAiPromptbausteinWindow(AiPromptbausteinDetailViewModel viewModel);
void ShowAiPromptbausteinDetailWindow(AiPromptbausteinDetailViewModel viewModel);
void ShowAiPromptbausteinSelectionWindow(AiPromptbausteinSelectionViewModel viewModel);
}
}

View File

@@ -8,7 +8,7 @@
xmlns:local="clr-namespace:BeWo.View.Detail.AI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:shared="clr-namespace:BS.Shared;assembly=BS.Shared"
xmlns:vmv="clr-namespace:BeWo.ViewModel.View"
xmlns:vmv="clr-namespace:BeWo.ViewModel.View.AI"
d:DataContext="{d:DesignInstance Type=vmv:AiConversationChatViewModel,
IsDesignTimeCreatable=True}"
mc:Ignorable="d">
@@ -70,7 +70,7 @@
Grid.Row="1"
Grid.Column="2"
IsEnabled="False"
Value="{Binding Config.Temperature}"/>
Value="{Binding Config.Temperature}" />
<Label Grid.Row="2" IsEnabled="False">
top__p

View File

@@ -17,7 +17,7 @@
xmlns:templateselectors="clr-namespace:BeWo.View.TemplateSelectors"
xmlns:uc="clr-namespace:BeWo.Controls;assembly=BeWo.Controls"
xmlns:viewmodel="clr-namespace:BeWo.ViewModel"
xmlns:vmv="clr-namespace:BeWo.ViewModel.View"
xmlns:vmv="clr-namespace:BeWo.ViewModel.View.AI"
Width="auto"
Height="auto"
HorizontalAlignment="Stretch"

View File

@@ -3,6 +3,7 @@ using BeWo.ServiceProxy;
using BeWo.ViewModel;
using BeWo.ViewModel.ListViewModel;
using BeWo.ViewModel.View;
using BeWo.ViewModel.View.AI;
using BS.Shared.Extensions;
using DevExpress.Mvvm;
using System;

View File

@@ -0,0 +1,98 @@
<UserControl
x:Class="BeWo.View.Detail.AI.AiPromptbausteinSelectionView"
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: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:AiPromptbausteinSelectionViewModel, IsDesignTimeCreatable=True}"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\..\..\Styles\ModernOrangeBlack.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<TreeView
x:Name="treeView"
MinHeight="100"
AllowDrop="True"
Padding="3,20,3,3"
ContextMenuService.IsEnabled="{Binding IsChecked, ElementName=EditToggleButton}"
ItemContainerStyle="{DynamicResource igoal_treeitemstyle}"
ItemTemplate="{DynamicResource igoal_treeitemtemplate}"
ItemsSource="{Binding ListVM.VMList, UpdateSourceTrigger=PropertyChanged}"
SelectedItemChanged="treeView_SelectedItemChanged">
<TreeView.Resources>
<Style x:Key="igoal_treeitemstyle" TargetType="TreeViewItem">
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
<Setter Property="FontWeight" Value="Normal" />
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="FontWeight" Value="Bold" />
</Trigger>
</Style.Triggers>
</Style>
<HierarchicalDataTemplate
x:Key="igoal_treeitemtemplate"
DataType="{x:Type vm:AiPromptbausteinTreeVM}"
ItemsSource="{Binding Path=Children.VMList}">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBox
Height="21"
Margin="0,0,0,0"
Padding="0,3,0,0"
VerticalAlignment="Center"
Background="Transparent"
BorderThickness="0"
Cursor="Arrow"
Focusable="False"
FontWeight="{Binding Path=FontWeight}"
IsReadOnly="True"
Text="{Binding Path=Name, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
ToolTipService.ShowDuration="100000">
<TextBox.ToolTip>
<StackPanel Orientation="Vertical">
<Label Content="{Binding Path=Name, 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=Prompt}"
TextWrapping="Wrap" />
</StackPanel>
</TextBox.ToolTip>
</TextBox>
</Grid>
</HierarchicalDataTemplate>
</TreeView.Resources>
</TreeView>
<Button Grid.Row="1" Command="{Binding SendCommand}" Style="{StaticResource PrimaryButton}">Absenden</Button>
</Grid>
</UserControl>

View File

@@ -0,0 +1,42 @@
using BeWo.ViewModel;
using BeWo.ViewModel.View.AI;
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 AiPromptbausteinSelectionView.xaml
/// </summary>
public partial class AiPromptbausteinSelectionView : UserControl
{
public AiPromptbausteinSelectionViewModel ViewModel { get; set; }
public AiPromptbausteinSelectionView(AiPromptbausteinSelectionViewModel viewModel)
{
InitializeComponent();
DataContext = ViewModel = viewModel;
}
private void treeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
if (ViewModel is null)
return;
ViewModel.SelectedNode = treeView.SelectedValue as AiPromptbausteinTreeVM;
}
}
}

View File

@@ -56,6 +56,7 @@ using DevExpress.Mvvm;
using System.Collections;
using BeWo.Core.Commands;
using BeWo.ViewModel.View;
using BeWo.ViewModel.View.AI;
namespace BeWo.View.Detail
{

View File

@@ -1723,7 +1723,8 @@
<Button
x:Name="btn_AiPromptbaustein"
Padding="0"
Content="{StaticResource AiDesignsIconKIFunktionWeissGruen}" />
Content="{StaticResource AiDesignsIconKIFunktionWeissGruen}"
Command="{Binding OpenAiPromptSelectionCommand}"/>
</StackPanel>
<Button

View File

@@ -56,6 +56,7 @@ using BeWo.View.Detail.AI;
using BeWo.View.Windows;
using BeWo.Core.Commands;
using BeWo.ViewModel.View;
using BeWo.ViewModel.View.AI;
namespace BeWo.View.Detail.Zeiterfassung
{

View File

@@ -33,6 +33,7 @@ using System.Collections;
using System.Windows.Input;
using BeWo.Core.Commands;
using BeWo.ViewModel.View;
using BeWo.ViewModel.View.AI;
namespace BeWo.View.Navigation
{

View File

@@ -16,6 +16,7 @@ using BeWo.View.Navigation.Sorter;
using BeWo.View.Windows;
using BeWo.ViewModel;
using BeWo.ViewModel.View;
using BeWo.ViewModel.View.AI;
using BS.Shared;
using BS.Shared.Core;
using BS.Shared.DataContracts;

View File

@@ -12,6 +12,7 @@ using BeWo.View.Detail;
using BeWo.View.Navigation.Sorter;
using BeWo.ViewModel;
using BeWo.ViewModel.View;
using BeWo.ViewModel.View.AI;
using BS.Shared;
using BS.Shared.Core;
using BS.Shared.DataContracts;

View File

@@ -22,6 +22,7 @@ using System.Windows.Input;
using BeWo.Core.Commands;
using BeWo.ViewModel.View;
using DevExpress.XtraBars.Docking;
using BeWo.ViewModel.View.AI;
namespace BeWo.View.Navigation
{

View File

@@ -28,6 +28,7 @@ using System.Collections;
using System.Windows.Input;
using BeWo.Core.Commands;
using BeWo.ViewModel.View;
using BeWo.ViewModel.View.AI;
namespace BeWo.View.Navigation
{

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading;
@@ -16,6 +17,7 @@ using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using BS.Shared.Extensions;
using BS.Shared.Services;
using DevExpress.Mvvm;
using Microsoft.VisualBasic;
using Newtonsoft.Json;
using DispatcherObject = System.Windows.Threading.DispatcherObject;
@@ -92,6 +94,8 @@ namespace BeWo.ViewModel.ListViewModel
//private static List<DarreichungsformDC> _AllDosageForms;
public ICommand OpenAiPromptSelectionCommand { get; set; }
public ServiceRecordListVM(
Dictionary<ServiceCategoryDC, List<ServiceDescriptionDC>> pCategory2Services,
IEnumerable<ValueListEntryDC> pAllGoalCategories,
@@ -157,6 +161,10 @@ namespace BeWo.ViewModel.ListViewModel
AllDocTypes.Sort((a, b) => a.ValueListEntryOid.Value.CompareTo(b.ValueListEntryOid.Value));
}
VMList.ListChanged += (s, e) => CheckCustomerAbsenceTimes();
OpenAiPromptSelectionCommand = new DelegateCommand(() => {
BeWoApp.MainControl.WindowService.ShowAiPromptbausteinSelectionWindow(new View.AI.AiPromptbausteinSelectionViewModel());
}, () => SelectedCustomerNode is object);
}
//CB EINKOMMENTIEREN

View File

@@ -7,6 +7,7 @@ using BeWo.SchulbegleitenderDienst.ViewModel;
using BeWo.ServiceProxy;
using BeWo.ViewModel.ListViewModel;
using BeWo.ViewModel.View;
using BeWo.ViewModel.View.AI;
using BS.Shared;
using BS.Shared.Core;
using BS.Shared.DataContracts;

View File

@@ -15,9 +15,9 @@ using DevExpress.Mvvm;
using BeWo.ServiceProxy;
using BS.Shared.Extensions;
namespace BeWo.ViewModel.View
namespace BeWo.ViewModel.View.AI
{
public class AiConversationChatViewModel : AbstractBaseVM
public class AiConversationChatViewModel : DialogViewModel
{
private bool _IsSettingsOpen;
private bool _IsCloneOpen;

View File

@@ -0,0 +1,45 @@
using BeWo.Services;
using BeWo.ViewModel.ListViewModel;
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 AiPromptbausteinSelectionViewModel : DialogViewModel
{
public AiPromptbausteinSelectionViewModel()
{
Func<bool> isPrompt = () => SelectedNode is object && !SelectedNode.IsKategorie;
SendCommand = new DelegateCommand(Send, isPrompt);
//if (BeWoApp.IsInDesignMode)
//{
ListVM = new AiPromptbausteinTreeListVM();
//}
}
public AiPromptbausteinSelectionViewModel(AiPromptbausteinTreeListVM viewModel) : this()
{
ListVM = viewModel;
}
public AiPromptbausteinTreeVM SelectedNode { get; set; }
public AiPromptbausteinTreeListVM ListVM { get; set; }
public ICommand SendCommand { get; set; }
public void Send()
{
MessageBox.Show("Hi");
CloseDialogCommand.Execute(null);
}
}
}

View File

@@ -1,5 +1,6 @@
using BeWo.ViewModel.ListViewModel;
using DevExpress.Mvvm;
using DevExpress.Xpf.Docking;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -9,7 +10,7 @@ using System.Windows.Input;
namespace BeWo.ViewModel.View.Administration
{
public class AiPromptbausteinDetailViewModel
public class AiPromptbausteinDetailViewModel : DialogViewModel
{
private AiPromptbausteinDetailViewModel(AiPromptbausteinTreeViewModel viewModel, AiPromptbausteinTreeVM node, bool isAdd, AiPromptbausteinTreeListVM parent = null)
{
@@ -33,8 +34,6 @@ namespace BeWo.ViewModel.View.Administration
public bool IsAdd { get; set; }
public bool IsEditingMode { get; set; }
public Action CloseWindow { get; set; }
public bool IsKategorie => Node.IsKategorie;
public string PromptLabelDescription => IsKategorie ? "Beschreibung:" : "Prompt:";
@@ -42,7 +41,7 @@ namespace BeWo.ViewModel.View.Administration
public void Add()
{
Parent.AddNewVMToListAndSelect(false);
CloseWindow();
CloseDialogCommand?.Execute(null);
}
public static AiPromptbausteinDetailViewModel CreateAdd(AiPromptbausteinTreeViewModel viewModel, AiPromptbausteinTreeVM node, AiPromptbausteinTreeListVM parent)

View File

@@ -63,12 +63,12 @@ namespace BeWo.ViewModel.View.Administration
parent.NewVM = null;
parent.NewVM.IsKategorie = isKategorie;
WindowService.ShowAiPromptbausteinWindow(AiPromptbausteinDetailViewModel.CreateAdd(this, parent.NewVM, parent));
WindowService.ShowAiPromptbausteinDetailWindow(AiPromptbausteinDetailViewModel.CreateAdd(this, parent.NewVM, parent));
}
public void EditPromptbaustein()
{
WindowService.ShowAiPromptbausteinWindow(AiPromptbausteinDetailViewModel.CreateEdit(this, SelectedNode));
WindowService.ShowAiPromptbausteinDetailWindow(AiPromptbausteinDetailViewModel.CreateEdit(this, SelectedNode));
}
public void CopyPromptbaustein()

View File

@@ -0,0 +1,27 @@
using DevExpress.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace BeWo.ViewModel.View
{
public class DialogViewModel : WindowViewModel
{
public event EventHandler RequestClose;
public DialogViewModel() : base()
{
CloseDialogCommand = new DelegateCommand(Close);
}
public ICommand CloseDialogCommand { get; set; }
private void Close()
{
RequestClose?.Invoke(this, EventArgs.Empty);
}
}
}

View File

@@ -1428,8 +1428,10 @@ namespace BS.Shared
public enum BeWoClientReleaseStage
{
ProofOfConcept,
Sandbox,
Staging,
FriendlyUserBeta,
Preview,
Release
}