DeveloperWindow

+ cleane Shortcuts
This commit is contained in:
2026-06-10 15:41:31 +02:00
parent f3db19c4e9
commit 94c3b00c32
29 changed files with 843 additions and 380 deletions

View File

@@ -173,6 +173,8 @@
<Compile Include="ViewModel\View\AI\AiConversationChatViewModel.cs" /> <Compile Include="ViewModel\View\AI\AiConversationChatViewModel.cs" />
<Compile Include="ViewModel\View\AI\AiPromptbausteinActionResultViewModel.cs" /> <Compile Include="ViewModel\View\AI\AiPromptbausteinActionResultViewModel.cs" />
<Compile Include="ViewModel\View\AI\AiPromptbausteinComplexSelectionViewModel.cs" /> <Compile Include="ViewModel\View\AI\AiPromptbausteinComplexSelectionViewModel.cs" />
<Compile Include="ViewModel\View\Developer\DesignDeveloperViewModel.cs" />
<Compile Include="ViewModel\View\Developer\DeveloperViewModel.cs" />
<Compile Include="ViewModel\View\DialogViewModel.cs" /> <Compile Include="ViewModel\View\DialogViewModel.cs" />
<Compile Include="ViewModel\View\Gkv\GkvAbrechnungDialogViewModel.cs" /> <Compile Include="ViewModel\View\Gkv\GkvAbrechnungDialogViewModel.cs" />
<Compile Include="ViewModel\View\WindowViewModel.cs" /> <Compile Include="ViewModel\View\WindowViewModel.cs" />
@@ -219,6 +221,9 @@
<Compile Include="View\Detail\Report\DatenbereinigungView.xaml.cs"> <Compile Include="View\Detail\Report\DatenbereinigungView.xaml.cs">
<DependentUpon>DatenbereinigungView.xaml</DependentUpon> <DependentUpon>DatenbereinigungView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="View\Developer\DeveloperView.xaml.cs">
<DependentUpon>DeveloperView.xaml</DependentUpon>
</Compile>
<Compile Include="View\Document\TeamFolderRightView.xaml.cs"> <Compile Include="View\Document\TeamFolderRightView.xaml.cs">
<DependentUpon>TeamFolderRightView.xaml</DependentUpon> <DependentUpon>TeamFolderRightView.xaml</DependentUpon>
</Compile> </Compile>
@@ -371,6 +376,10 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Include="View\Developer\DeveloperView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\Document\TeamFolderRightView.xaml"> <Page Include="View\Document\TeamFolderRightView.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>

View File

@@ -37,6 +37,7 @@ using DevExpress.XtraScheduler;
using System.ServiceModel; using System.ServiceModel;
using BeWo.View.Windows; using BeWo.View.Windows;
using System.Diagnostics; using System.Diagnostics;
using BeWo.Services;
namespace BeWo namespace BeWo
{ {
@@ -81,6 +82,8 @@ namespace BeWo
public static bool IsInDesignMode = DesignerProperties.GetIsInDesignMode(new DependencyObject()); public static bool IsInDesignMode = DesignerProperties.GetIsInDesignMode(new DependencyObject());
internal static IBeWoWindowService WindowService { get; set; }
public static EmployeeDC LoggedOnEmployee public static EmployeeDC LoggedOnEmployee
{ {
get => _LoggedOnEmployee; get => _LoggedOnEmployee;
@@ -1083,16 +1086,11 @@ namespace BeWo
FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
BeWoAppInfo.BeWoAppVersion.TryActiveDeveloperMode(e.Args); var controlFactory = new BeWoControlFactory();
var windowFactory = new BeWoWindowFactory();
WindowService = new BeWoWindowService(windowFactory, controlFactory);
//if(e.Args.LastOrDefault(x => x.StartsWith("/timeout:") || x.StartsWith("--timeout:")) is string str) BeWoAppInfo.BeWoAppVersion.TryActiveDeveloperMode(e.Args);
//{
// var valuePart = str.Substring(str.IndexOf(':') + 1);
// if(int.TryParse(valuePart, out int parsedTimeout))
// {
// AiTimeout = parsedTimeout;
// }
//}
} }
public static void ShowInfoMessage(string message) public static void ShowInfoMessage(string message)

View File

@@ -1,4 +1,5 @@
using BeWo.ViewModel; using BeWo.ViewModel;
using DevExpress.Mvvm;
using System; using System;
using System.Globalization; using System.Globalization;
using System.Windows.Data; using System.Windows.Data;
@@ -12,6 +13,8 @@ namespace BeWo.Converter
if (value is null) if (value is null)
return null; return null;
var t = ((DelegateCommand)value).CanExecute(null);
return value; return value;
} }

View File

@@ -53,6 +53,8 @@ namespace BeWo
public bool EnableAutoRemoteDebugging { get; set; } public bool EnableAutoRemoteDebugging { get; set; }
public bool EnableAllUserRightsInDebug { get; set; } = false; public bool EnableAllUserRightsInDebug { get; set; } = false;
public bool EnableDeveloperView { get; set; } = false;
public static DebugConfig SimpleAutoLogin => new DebugConfig() public static DebugConfig SimpleAutoLogin => new DebugConfig()
{ {
DebugConfigMode = DebugConfigMode.SimpleAutoLogin, DebugConfigMode = DebugConfigMode.SimpleAutoLogin,
@@ -152,7 +154,8 @@ namespace BeWo
//DefaultLoginUsername = "m1", //DefaultLoginUsername = "m1",
//DefaultLoginPassword = "bewobewo", //DefaultLoginPassword = "bewobewo",
//DefaultProfilename = "5000000000", //DefaultProfilename = "5000000000",
EnableAutoRemoteDebugging = true EnableAutoRemoteDebugging = true,
EnableDeveloperView = true
}); });
name2config.Add("FeatureXRechnung", name2config.Add("FeatureXRechnung",

View File

@@ -192,11 +192,16 @@ namespace BeWo
UpdateMandator(); UpdateMandator();
var controlFactory = new BeWoControlFactory(); #if DEBUG
var windowFactory = new BeWoWindowFactory(); if (DebugConfig.CurrentConfig is DebugConfig config && config.EnableDeveloperView)
WindowService = new BeWoWindowService(windowFactory, controlFactory); {
WindowService.ShowDeveloper();
}
#endif
} }
public IBeWoWindowService WindowService => BeWoApp.WindowService;
private AnimatedBeWoWindow _CurrentAnimatedBeWoWindow; private AnimatedBeWoWindow _CurrentAnimatedBeWoWindow;
public AnimatedBeWoWindow CurrentAnimatedBeWoWindow public AnimatedBeWoWindow CurrentAnimatedBeWoWindow
{ {
@@ -217,8 +222,6 @@ namespace BeWo
} }
} }
internal IBeWoWindowService WindowService { get; set; }
public List<ModalViewWindow> OpenedModalViewWindows { get; set; } public List<ModalViewWindow> OpenedModalViewWindows { get; set; }
internal Dictionary<UIContext, BeWoView> Views internal Dictionary<UIContext, BeWoView> Views

View File

@@ -23,6 +23,10 @@ using System.Windows.Controls.Primitives;
using static DevExpress.XtraPrinting.Native.ExportOptionsPropertiesNames; using static DevExpress.XtraPrinting.Native.ExportOptionsPropertiesNames;
using DevExpress.Mvvm.Native; using DevExpress.Mvvm.Native;
using BeWo.ViewModel.View.Gkv; using BeWo.ViewModel.View.Gkv;
using BeWo.ViewModel.View.Developer;
using BeWo.View.Developer;
using System.Windows.Forms;
using static DevExpress.Mvvm.Native.Either;
namespace BeWo.Services namespace BeWo.Services
{ {
@@ -78,7 +82,7 @@ namespace BeWo.Services
} }
} }
public void ShowAiConversationWindow(AiConversationChatViewModel viewModel) private void ShowAiConversationWindow(AiConversationChatViewModel viewModel)
{ {
var control = _controlFactory.GetAiConversationControl(viewModel); var control = _controlFactory.GetAiConversationControl(viewModel);
var title = _windowFactory.GetAiTitle(viewModel.ActionType); var title = _windowFactory.GetAiTitle(viewModel.ActionType);
@@ -89,7 +93,7 @@ namespace BeWo.Services
}; };
Show(title, control, viewModel, options); Show(title, control, viewModel, options);
} }
public void ShowAiPromptbausteinFolderWindow(AiPromptbausteinFolderViewModel viewModel) private void ShowAiPromptbausteinFolderWindow(AiPromptbausteinFolderViewModel viewModel)
{ {
var control = new AiPromptbausteinFolderView(viewModel); var control = new AiPromptbausteinFolderView(viewModel);
var options = new BeWoWindowOptions() var options = new BeWoWindowOptions()
@@ -99,7 +103,7 @@ namespace BeWo.Services
}; };
Show("KI Promptbaustein Ordner", control, viewModel, options); Show("KI Promptbaustein Ordner", control, viewModel, options);
} }
public void ShowAiPromptbausteinPromptWindow(AiPromptbausteinPromptViewModel viewModel) private void ShowAiPromptbausteinPromptWindow(AiPromptbausteinPromptViewModel viewModel)
{ {
var control = new AiPromptbausteinPromptView(viewModel); var control = new AiPromptbausteinPromptView(viewModel);
var options = new BeWoWindowOptions() var options = new BeWoWindowOptions()
@@ -109,7 +113,7 @@ namespace BeWo.Services
}; };
Show("KI Promptbaustein Prompt", control, viewModel, options); Show("KI Promptbaustein Prompt", control, viewModel, options);
} }
public void ShowAiPromptbausteinRoutineWindow(AiPromptbausteinRoutineViewModel viewModel) private void ShowAiPromptbausteinRoutineWindow(AiPromptbausteinRoutineViewModel viewModel)
{ {
var control = new AiPromptbausteinRoutineView(viewModel); var control = new AiPromptbausteinRoutineView(viewModel);
var options = new BeWoWindowOptions() var options = new BeWoWindowOptions()
@@ -119,7 +123,7 @@ namespace BeWo.Services
}; };
Show("KI Promptbaustein Routine", control, viewModel, options); Show("KI Promptbaustein Routine", control, viewModel, options);
} }
public void ShowAiPromptbausteinActionResultWindow(AiPromptbausteinActionResultViewModel viewModel) private void ShowAiPromptbausteinActionResultWindow(AiPromptbausteinActionResultViewModel viewModel)
{ {
var control = new AiPromptbausteinActionResultView(viewModel); var control = new AiPromptbausteinActionResultView(viewModel);
var options = new BeWoWindowOptions() var options = new BeWoWindowOptions()
@@ -130,7 +134,7 @@ namespace BeWo.Services
Show("KI Promptbaustein Ergebnis", control, viewModel, options); Show("KI Promptbaustein Ergebnis", control, viewModel, options);
} }
public void ShowAiPromptbausteinSelectionComplexWindow(AiPromptbausteinSelectionComplexViewModel viewModel) private void ShowAiPromptbausteinSelectionComplexWindow(AiPromptbausteinSelectionComplexViewModel viewModel)
{ {
var control = new AiPromptbausteinComplexSelectionView(viewModel); var control = new AiPromptbausteinComplexSelectionView(viewModel);
var options = new BeWoWindowOptions() var options = new BeWoWindowOptions()
@@ -140,7 +144,45 @@ namespace BeWo.Services
}; };
Show("KI Promptbaustein Auswahl", control, viewModel, options); Show("KI Promptbaustein Auswahl", control, viewModel, options);
} }
#if DEBUG
public void ShowDeveloper(DeveloperViewModel viewModel = null)
{
if(viewModel == null)
viewModel = new DeveloperViewModel();
var control = new DeveloperView(viewModel);
var window = new Window();
window.Title = "Developer Informations";
window.Content = control;
window.Height = 600;
window.Width = 800;
window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
window.Topmost = true;
window.Deactivated += (s, e) =>
{
window.Topmost = false; // set topmost false first
window.Topmost = true; // then set topmost true again.
};
var screens = Screen.AllScreens;
var firstSecondary = screens.LastOrDefault(s => s.Primary == false);
if (firstSecondary != null)
{
window.WindowStartupLocation = WindowStartupLocation.Manual;
// Ensure Window is minimized on creation
window.WindowState = WindowState.Minimized;
// Define Position on Secondary screen, for "Normal" window-mode
// ( Here Top/Left-Position )
window.Left = firstSecondary.Bounds.Left;
window.Top = firstSecondary.Bounds.Top;
}
window.Show();
}
#endif
public void ShowGkvAbrechnungDetailWindow(GkvAbrechnungDialogViewModel vm) public void ShowGkvAbrechnungDetailWindow(GkvAbrechnungDialogViewModel vm)
{ {
@@ -179,7 +221,7 @@ namespace BeWo.Services
Show(title, control, null, pOptions); Show(title, control, null, pOptions);
} }
private void Show(string title, Control control, WindowViewModel windowViewModel, BeWoWindowOptions options) private void Show(string title, System.Windows.Controls.Control control, WindowViewModel windowViewModel, BeWoWindowOptions options)
{ {
if (options.ShowAsModal) if (options.ShowAsModal)
{ {

View File

@@ -1,8 +1,10 @@
using BeWo.ViewModel; using BeWo.View.Developer;
using BeWo.ViewModel;
using BeWo.ViewModel.Light; using BeWo.ViewModel.Light;
using BeWo.ViewModel.View; using BeWo.ViewModel.View;
using BeWo.ViewModel.View.Administration; using BeWo.ViewModel.View.Administration;
using BeWo.ViewModel.View.AI; using BeWo.ViewModel.View.AI;
using BeWo.ViewModel.View.Developer;
using BeWo.ViewModel.View.Gkv; using BeWo.ViewModel.View.Gkv;
using BS.Shared; using BS.Shared;
using System; using System;
@@ -20,7 +22,6 @@ namespace BeWo.Services
public interface IBeWoWindowService public interface IBeWoWindowService
{ {
#region special #region special
void ShowAiConversationWindow(AiConversationChatViewModel viewModel);
void ShowGkvAbrechnungDetailWindow(GkvAbrechnungDialogViewModel vm); void ShowGkvAbrechnungDetailWindow(GkvAbrechnungDialogViewModel vm);
#endregion #endregion
@@ -34,5 +35,9 @@ namespace BeWo.Services
#endregion #endregion
void Show<T>(T windowViewModel) where T : WindowViewModel; void Show<T>(T windowViewModel) where T : WindowViewModel;
#if DEBUG
void ShowDeveloper(DeveloperViewModel windowViewModel = null);
#endif
} }
} }

View File

@@ -2,6 +2,7 @@
<!-- Base --> <!-- Base -->
<Style x:Key="BaseButton" TargetType="{x:Type Button}"> <Style x:Key="BaseButton" TargetType="{x:Type Button}">
<Setter Property="Margin" Value="3" /> <Setter Property="Margin" Value="3" />
<Setter Property="MinWidth" Value="25" />
<Setter Property="Height" Value="25" /> <Setter Property="Height" Value="25" />
<Setter Property="HorizontalAlignment" Value="Center" /> <Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="VerticalContentAlignment" Value="Center" />

View File

@@ -48,9 +48,9 @@
</Style> </Style>
<Style <Style
x:Key="PopupBlackLabel2" x:Key="PopupBlackLabel2"
BasedOn="{StaticResource BaseLabel}" BasedOn="{StaticResource BaseLabel}"
TargetType="Label"> TargetType="Label">
<Setter Property="Foreground" Value="{DynamicResource TextForegroundDarkPrimary}" /> <Setter Property="Foreground" Value="{DynamicResource TextForegroundDarkPrimary}" />
<Setter Property="HorizontalAlignment" Value="Right" /> <Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="VerticalAlignment" Value="Center" />

View File

@@ -6,11 +6,11 @@
</Style> </Style>
<Style <Style
x:Key="PopupBlackRadioButton" x:Key="PopupBlackRadioButton"
BasedOn="{StaticResource BaseRadioButton}" BasedOn="{StaticResource BaseRadioButton}"
TargetType="RadioButton"> TargetType="RadioButton">
<Setter Property="Foreground" Value="Black"/> <Setter Property="Foreground" Value="Black" />
<Setter Property="Padding" Value="2"/> <Setter Property="Padding" Value="2" />
<Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="VerticalContentAlignment" Value="Center" />
</Style> </Style>
</ResourceDictionary> </ResourceDictionary>

View File

@@ -13,8 +13,10 @@
xmlns:view="clr-namespace:BeWo.View" xmlns:view="clr-namespace:BeWo.View"
xmlns:vm="clr-namespace:BeWo.ViewModel" xmlns:vm="clr-namespace:BeWo.ViewModel"
x:Name="root" x:Name="root"
Focusable="True"
Background="Transparent"
d:DataContext="{d:DesignInstance Type=administration:AiPromptbausteinComplexTreeViewModel, d:DataContext="{d:DesignInstance Type=administration:AiPromptbausteinComplexTreeViewModel,
IsDesignTimeCreatable=True}" IsDesignTimeCreatable=True}"
d:DesignHeight="450" d:DesignHeight="450"
d:DesignWidth="800" d:DesignWidth="800"
mc:Ignorable="d"> mc:Ignorable="d">
@@ -29,6 +31,7 @@
TargetType="ListBoxItem" /> TargetType="ListBoxItem" />
<DataTemplate x:Key="AiPromptbausteinPromptItemTemplate" DataType="{x:Type vm:AiPromptbausteinPromptVM}"> <DataTemplate x:Key="AiPromptbausteinPromptItemTemplate" DataType="{x:Type vm:AiPromptbausteinPromptVM}">
<Border <Border
x:Name="border"
Background="#09000000" Background="#09000000"
BorderThickness="1" BorderThickness="1"
CornerRadius="5" CornerRadius="5"
@@ -180,6 +183,11 @@
BorderThickness="1" BorderThickness="1"
CornerRadius="5" CornerRadius="5"
Tag="{Binding DataContext, RelativeSource={RelativeSource AncestorType=dxe:ListBoxEdit}}"> Tag="{Binding DataContext, RelativeSource={RelativeSource AncestorType=dxe:ListBoxEdit}}">
<Border.InputBindings>
<KeyBinding Key="Delete" Command="{Binding PlacementTarget.Tag.DeleteRoutineCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" />
<KeyBinding Key="Enter" Command="{Binding PlacementTarget.Tag.OpenEditRoutineDialogCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" />
<KeyBinding Key="F" Command="{Binding PlacementTarget.Tag.ChangeFavoritenStateRoutineCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" />
</Border.InputBindings>
<Border.ContextMenu> <Border.ContextMenu>
<ContextMenu> <ContextMenu>
<ContextMenu.Resources> <ContextMenu.Resources>
@@ -399,6 +407,7 @@
AllowDrop="True" AllowDrop="True"
BorderThickness="1,0,0,1" BorderThickness="1,0,0,1"
ContextMenuOpening="treeView_ContextMenuOpening" ContextMenuOpening="treeView_ContextMenuOpening"
Focusable="True"
ItemContainerStyle="{DynamicResource igoal_treeitemstyle}" ItemContainerStyle="{DynamicResource igoal_treeitemstyle}"
ItemTemplate="{StaticResource ai_promptbaustein_folder_itemtemplate}" ItemTemplate="{StaticResource ai_promptbaustein_folder_itemtemplate}"
ItemsSource="{Binding Folders.VMList, UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding Folders.VMList, UpdateSourceTrigger=PropertyChanged}"
@@ -416,14 +425,14 @@
<KeyBinding Key="Delete" Command="{Binding DeleteFolderCommand}" /> <KeyBinding Key="Delete" Command="{Binding DeleteFolderCommand}" />
<KeyBinding Key="Enter" Command="{Binding OpenEditFolderDialogCommand}" /> <KeyBinding Key="Enter" Command="{Binding OpenEditFolderDialogCommand}" />
<KeyBinding Key="N" Command="{Binding OpenAddFolderDialogCommand}" /> <KeyBinding Key="N" Command="{Binding OpenAddFolderDialogCommand}" />
<KeyBinding <!--<KeyBinding
Key="C" Key="C"
Command="{Binding CopyFolderCommand}" Command="{Binding CopyFolderCommand}"
Modifiers="Ctrl" /> Modifiers="Ctrl" />
<KeyBinding <KeyBinding
Key="V" Key="V"
Command="{Binding PasteFolderCommand}" Command="{Binding PasteFolderCommand}"
Modifiers="Ctrl" /> Modifiers="Ctrl" />-->
</TreeView.InputBindings> </TreeView.InputBindings>
<TreeView.ContextMenu> <TreeView.ContextMenu>
<ContextMenu> <ContextMenu>
@@ -436,7 +445,7 @@
</ContextMenu.Resources> </ContextMenu.Resources>
<MenuItem <MenuItem
Command="{Binding OpenAddFolderDialogCommand}" Command="{Binding OpenAddFolderDialogCommand}"
Header="Neu" Header="Neuer Ordner"
ToolTip="Shortcut: N"> ToolTip="Shortcut: N">
<MenuItem.Icon> <MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Add24.png" /> <Image Source="..\..\..\Ressources\Icons\Add24.png" />
@@ -486,245 +495,329 @@
Width="1" Width="1"
HorizontalAlignment="Center" HorizontalAlignment="Center"
Background="#878890" /> Background="#878890" />
<TabControl <Grid
Grid.Row="1" Grid.Row="1"
Grid.Column="2" Grid.Column="2"
Grid.ColumnSpan="2" Grid.ColumnSpan="2">
Padding="0" <Grid.Resources>
BorderBrush="Gray" <Style TargetType="Grid">
BorderThickness="0,1,1,1"
SelectionChanged="TabControl_SelectionChanged">
<TabControl.Resources>
<Style TargetType="TabControl">
<Style.Triggers> <Style.Triggers>
<DataTrigger Binding="{Binding ElementName=treeView, Path=SelectedItem}" Value="{x:Null}"> <DataTrigger Binding="{Binding ElementName=treeView, Path=SelectedItem}" Value="{x:Null}">
<Setter Property="Visibility" Value="Hidden" /> <Setter Property="Visibility" Value="Hidden" />
</DataTrigger> </DataTrigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
<Style TargetType="{x:Type TabItem}"> </Grid.Resources>
<Setter Property="Template"> <TabControl
<Setter.Value> x:Name="tabcontrol_1"
<ControlTemplate TargetType="{x:Type TabItem}"> Padding="0"
<Border BorderBrush="Gray"
x:Name="Border" BorderThickness="0,1,1,1"
Grid.Row="0" SelectionChanged="TabControl_SelectionChanged">
Grid.Column="0" <TabControl.Resources>
MinHeight="20" <Style TargetType="{x:Type TabItem}">
Padding="12,3,12,3" <Setter Property="Template">
Background="Transparent" <Setter.Value>
TextElement.FontFamily="Microsoft Sans Serif" <ControlTemplate TargetType="{x:Type TabItem}">
TextElement.FontSize="16" <Border
TextElement.Foreground="{StaticResource TabItemHotTextBrush}"> x:Name="Border"
<ContentPresenter ContentSource="Header" RecognizesAccessKey="True" /> Grid.Row="0"
</Border> Grid.Column="0"
<ControlTemplate.Triggers> MinHeight="20"
<Trigger Property="IsSelected" Value="True"> Padding="12,3,12,3"
<Setter Property="Panel.ZIndex" Value="100" /> Background="Transparent"
<Setter TargetName="Border" Property="Background" Value="#22000000" /> TextElement.FontFamily="Microsoft Sans Serif"
<Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0" /> TextElement.FontSize="16"
</Trigger> TextElement.Foreground="{StaticResource TabItemHotTextBrush}">
<Trigger Property="IsEnabled" Value="False"> <ContentPresenter ContentSource="Header" RecognizesAccessKey="True" />
<Setter TargetName="Border" Property="Background" Value="DarkRed" /> </Border>
<Setter TargetName="Border" Property="BorderBrush" Value="Black" /> <ControlTemplate.Triggers>
<Setter Property="Foreground" Value="DarkGray" /> <Trigger Property="IsSelected" Value="True">
</Trigger> <Setter Property="Panel.ZIndex" Value="100" />
</ControlTemplate.Triggers> <Setter TargetName="Border" Property="Background" Value="#22000000" />
</ControlTemplate> <Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0" />
</Setter.Value> </Trigger>
</Setter> <Trigger Property="IsEnabled" Value="False">
</Style> <Setter TargetName="Border" Property="Background" Value="DarkRed" />
</TabControl.Resources> <Setter TargetName="Border" Property="BorderBrush" Value="Black" />
<Setter Property="Foreground" Value="DarkGray" />
<TabItem Header="Alle"> </Trigger>
<Grid> </ControlTemplate.Triggers>
<dxe:ListBoxEdit </ControlTemplate>
x:Name="listBoxEdit3" </Setter.Value>
Padding="8,16,8,16" </Setter>
HorizontalContentAlignment="Stretch" </Style>
VerticalContentAlignment="Stretch" <Style BasedOn="{StaticResource {x:Type dxe:ListBoxEdit}}" TargetType="dxe:ListBoxEdit">
AllowDrop="False" <Setter Property="Padding" Value="8,16" />
ContextMenuOpening="ListBox_ContextMenuOpening" <Setter Property="HorizontalContentAlignment" Value="Stretch" />
ItemContainerStyle="{StaticResource PromptListBoxItem}" <Setter Property="VerticalContentAlignment" Value="Stretch" />
ItemTemplateSelector="{StaticResource AiPromptbausteinFolderItemTemplateSelector}" <Setter Property="AllowDrop" Value="False" />
ItemsSource="{Binding SelectedFolder.AlleFolderItems, UpdateSourceTrigger=PropertyChanged}" <Setter Property="ItemContainerStyle" Value="{StaticResource PromptListBoxItem}" />
SelectedItem="{Binding SelectedItem, Mode=TwoWay}" <Setter Property="ItemTemplate" Value="{StaticResource AiPromptbausteinPromptItemTemplate}" />
SelectionMode="Single" <Setter Property="SelectedItem" Value="{Binding SelectedItem, Mode=TwoWay}" />
ShowBorder="False"> <Setter Property="SelectionMode" Value="Single" />
<dxe:ListBoxEdit.ContextMenu> <Setter Property="ShowBorder" Value="False" />
<ContextMenu> <Setter Property="Focusable" Value="True" />
<ContextMenu.Resources> <Setter Property="IsTabStop" Value="True" />
<ResourceDictionary> <EventSetter Event="ContextMenuOpening" Handler="ListBox_ContextMenuOpening" />
<Style TargetType="{x:Type Image}"> <EventSetter Event="PreviewMouseDown" Handler="listBoxEdit3_PreviewMouseDown" />
<Setter Property="Height" Value="24" /> </Style>
</Style> </TabControl.Resources>
</ResourceDictionary> <TabItem Header="Alle">
</ContextMenu.Resources> <TabItem.InputBindings>
<MenuItem Command="{Binding OpenAddPromptDialogCommand}" Header="Neuer Prompt"> <KeyBinding Key="Delete" Command="{Binding DeleteItemCommand}" />
<MenuItem.Icon> <KeyBinding Key="Enter" Command="{Binding OpenEditItemDialogCommand}" />
<Image Source="..\..\..\Ressources\Icons\Add24.png" /> <KeyBinding
</MenuItem.Icon> Key="C"
</MenuItem> Command="{Binding CopyPromptCommand}"
<MenuItem Command="{Binding OpenAddRoutineDialogCommand}" Header="Neue Routine"> Modifiers="Ctrl" />
<MenuItem.Icon> <KeyBinding
<Image Source="..\..\..\Ressources\Icons\Add24.png" /> Key="V"
</MenuItem.Icon> Command="{Binding PastePromptCommand}"
</MenuItem> Modifiers="Ctrl" />
<Separator /> <KeyBinding Key="F" Command="{Binding ChangeFavoritenStateItemCommand}" />
<MenuItem Command="{Binding PastePromptCommand}" Header="Einfügen"> <KeyBinding Key="N" Command="{Binding OpenAddPromptDialogCommand}" />
<MenuItem.Icon> </TabItem.InputBindings>
<Image Source="..\..\..\Ressources\Icons\Paste24.png" /> <Grid Background="Transparent">
</MenuItem.Icon> <dxe:ListBoxEdit x:Name="listBoxEdit3"
</MenuItem> ItemsSource="{Binding SelectedFolder.AlleFolderItems, UpdateSourceTrigger=PropertyChanged}">
</ContextMenu> <dxe:ListBoxEdit.StyleSettings>
</dxe:ListBoxEdit.ContextMenu> <dxe:ListBoxEditStyleSettings />
</dxe:ListBoxEdit> </dxe:ListBoxEdit.StyleSettings>
<StackPanel <dxe:ListBoxEdit.ContextMenu>
HorizontalAlignment="Center" <ContextMenu>
VerticalAlignment="Center" <ContextMenu.Resources>
IsHitTestVisible="False"> <ResourceDictionary>
<StackPanel.Visibility> <Style TargetType="{x:Type Image}">
<MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}"> <Setter Property="Height" Value="24" />
<Binding </Style>
Converter="{StaticResource CollectionCountToBoolConverter}" </ResourceDictionary>
ConverterParameter="reverse" </ContextMenu.Resources>
Path="SelectedFolder.AlleFolderItems.Count" /> <MenuItem Command="{Binding OpenAddPromptDialogCommand}" Header="Neuer Prompt">
<Binding Path="SelectedFolder.CanAddPrompt" /> <MenuItem.Icon>
</MultiBinding> <Image Source="..\..\..\Ressources\Icons\Add24.png" />
</StackPanel.Visibility> </MenuItem.Icon>
<Path </MenuItem>
Height="32" <MenuItem Command="{Binding OpenAddRoutineDialogCommand}" Header="Neue Routine">
Margin="6" <MenuItem.Icon>
Data="{StaticResource GeometryFileAdd2}" <Image Source="..\..\..\Ressources\Icons\Add24.png" />
Fill="Black" </MenuItem.Icon>
Stretch="Uniform" /> </MenuItem>
<TextBlock> <Separator />
Hier sind noch keine Prompts/Routinen angelegt. <MenuItem Command="{Binding PastePromptCommand}" Header="Einfügen">
</TextBlock> <MenuItem.Icon>
</StackPanel> <Image Source="..\..\..\Ressources\Icons\Paste24.png" />
</Grid> </MenuItem.Icon>
</TabItem> </MenuItem>
<TabItem Header="Prompts"> </ContextMenu>
<Grid> </dxe:ListBoxEdit.ContextMenu>
<dxe:ListBoxEdit </dxe:ListBoxEdit>
x:Name="listBoxEdit1" <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
Padding="8,16,8,16" <StackPanel.Visibility>
HorizontalContentAlignment="Stretch" <MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}">
VerticalContentAlignment="Stretch" <Binding
AllowDrop="False" Converter="{StaticResource CollectionCountToBoolConverter}"
ContextMenuOpening="ListBox_ContextMenuOpening" ConverterParameter="reverse"
ItemContainerStyle="{StaticResource PromptListBoxItem}" Path="SelectedFolder.AlleFolderItems.Count" />
ItemTemplate="{StaticResource AiPromptbausteinPromptItemTemplate}" <Binding Path="SelectedFolder.CanAddPrompt" />
ItemsSource="{Binding SelectedFolder.Prompts, UpdateSourceTrigger=PropertyChanged}" </MultiBinding>
SelectedItem="{Binding SelectedItem, Mode=TwoWay}" </StackPanel.Visibility>
SelectionMode="Single" <Path
ShowBorder="False"> Height="32"
<dxe:ListBoxEdit.ContextMenu> Margin="6"
<ContextMenu> Data="{StaticResource GeometryFileAdd2}"
<ContextMenu.Resources> Fill="Black"
<ResourceDictionary> IsHitTestVisible="False"
<Style TargetType="{x:Type Image}"> Stretch="Uniform" />
<Setter Property="Height" Value="24" /> <TextBlock IsHitTestVisible="False">
</Style> Hier sind noch keine Prompts/Routinen angelegt.
</ResourceDictionary> </TextBlock>
</ContextMenu.Resources> <Button
<MenuItem Command="{Binding OpenAddPromptDialogCommand}" Header="Neuer Prompt"> Width="150"
<MenuItem.Icon> Margin="3,12,3,3"
<Image Source="..\..\..\Ressources\Icons\Add24.png" /> Command="{Binding OpenAddPromptDialogCommand}">
</MenuItem.Icon> Ersten Prompt anlegen
</MenuItem> </Button>
<Separator /> <Button
<MenuItem Command="{Binding PastePromptCommand}" Header="Einfügen"> Width="150"
<MenuItem.Icon> Margin="3,3,3,3"
<Image Source="..\..\..\Ressources\Icons\Paste24.png" /> Command="{Binding OpenAddRoutineDialogCommand}">
</MenuItem.Icon> Erste Routine anlegen
</MenuItem> </Button>
</ContextMenu> </StackPanel>
</dxe:ListBoxEdit.ContextMenu> </Grid>
</dxe:ListBoxEdit> </TabItem>
<StackPanel <TabItem Header="Prompts">
HorizontalAlignment="Center" <TabItem.InputBindings>
VerticalAlignment="Center" <KeyBinding Key="Delete" Command="{Binding DeletePromptCommand}" />
IsHitTestVisible="False"> <KeyBinding Key="Enter" Command="{Binding OpenEditPromptDialogCommand}" />
<StackPanel.Visibility> <KeyBinding
<MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}"> Key="C"
<Binding Command="{Binding CopyPromptCommand}"
Converter="{StaticResource CollectionCountToBoolConverter}" Modifiers="Ctrl" />
ConverterParameter="reverse" <KeyBinding
Path="SelectedFolder.Prompts.Count" /> Key="V"
<Binding Path="SelectedFolder.CanAddPrompt" /> Command="{Binding PastePromptCommand}"
</MultiBinding> Modifiers="Ctrl" />
</StackPanel.Visibility> <KeyBinding Key="F" Command="{Binding ChangeFavoritenStatePromptCommand}" />
<Path <KeyBinding Key="N" Command="{Binding OpenAddPromptDialogCommand}" />
Height="32" </TabItem.InputBindings>
Margin="6" <Grid Background="Transparent">
Data="{StaticResource GeometryFileAdd2}" <dxe:ListBoxEdit x:Name="listBoxEdit1" ItemsSource="{Binding SelectedFolder.Prompts, UpdateSourceTrigger=PropertyChanged}">
Fill="Black" <dxe:ListBoxEdit.ContextMenu>
Stretch="Uniform" /> <ContextMenu>
<TextBlock> <ContextMenu.Resources>
Hier sind noch keine Prompts angelegt. <ResourceDictionary>
</TextBlock> <Style TargetType="{x:Type Image}">
</StackPanel> <Setter Property="Height" Value="24" />
</Grid> </Style>
</TabItem> </ResourceDictionary>
<TabItem Header="Routinen"> </ContextMenu.Resources>
<Grid> <MenuItem Command="{Binding OpenAddPromptDialogCommand}" Header="Neuer Prompt">
<dxe:ListBoxEdit <MenuItem.Icon>
x:Name="listBoxEdit2" <Image Source="..\..\..\Ressources\Icons\Add24.png" />
Padding="8,16,8,16" </MenuItem.Icon>
HorizontalContentAlignment="Stretch" </MenuItem>
VerticalContentAlignment="Stretch" <Separator />
AllowDrop="False" <MenuItem Command="{Binding PastePromptCommand}" Header="Einfügen">
ContextMenuOpening="ListBox_ContextMenuOpening" <MenuItem.Icon>
ItemContainerStyle="{StaticResource PromptListBoxItem}" <Image Source="..\..\..\Ressources\Icons\Paste24.png" />
ItemTemplate="{StaticResource AiPromptbausteinRoutineItemTemplate}" </MenuItem.Icon>
ItemsSource="{Binding SelectedFolder.Routines, UpdateSourceTrigger=PropertyChanged}" </MenuItem>
SelectedItem="{Binding SelectedItem, Mode=TwoWay}" </ContextMenu>
SelectionMode="Single" </dxe:ListBoxEdit.ContextMenu>
ShowBorder="False"> </dxe:ListBoxEdit>
<dxe:ListBoxEdit.ContextMenu> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<ContextMenu> <StackPanel.Visibility>
<ContextMenu.Resources> <MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}">
<ResourceDictionary> <Binding
<Style TargetType="{x:Type Image}"> Converter="{StaticResource CollectionCountToBoolConverter}"
<Setter Property="Height" Value="24" /> ConverterParameter="reverse"
</Style> Path="SelectedFolder.Prompts.Count" />
</ResourceDictionary> <Binding Path="SelectedFolder.CanAddPrompt" />
</ContextMenu.Resources> </MultiBinding>
<MenuItem Command="{Binding OpenAddRoutineDialogCommand}" Header="Neue Routine"> </StackPanel.Visibility>
<MenuItem.Icon> <Path
<Image Source="..\..\..\Ressources\Icons\Add24.png" /> Height="32"
</MenuItem.Icon> Margin="6"
</MenuItem> Data="{StaticResource GeometryFileAdd2}"
</ContextMenu> Fill="Black"
</dxe:ListBoxEdit.ContextMenu> IsHitTestVisible="False"
</dxe:ListBoxEdit> Stretch="Uniform" />
<StackPanel <TextBlock IsHitTestVisible="False">
HorizontalAlignment="Center" Hier sind noch keine Prompts angelegt.
VerticalAlignment="Center" </TextBlock>
IsHitTestVisible="False"> <Button
<StackPanel.Visibility> Width="150"
<MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}"> Margin="3,12,3,3"
<Binding Command="{Binding OpenAddPromptDialogCommand}">
Converter="{StaticResource CollectionCountToBoolConverter}" Ersten Prompt anlegen
ConverterParameter="reverse" </Button>
Path="SelectedFolder.Routines.Count" /> </StackPanel>
<Binding Path="SelectedFolder.CanAddRoutine" /> </Grid>
</MultiBinding> </TabItem>
</StackPanel.Visibility> <TabItem Header="Routinen">
<Path <TabItem.InputBindings>
Height="32" <KeyBinding Key="Delete" Command="{Binding DeleteRoutineCommand}" />
Margin="6" <KeyBinding Key="Enter" Command="{Binding OpenEditRoutineDialogCommand}" />
Data="{StaticResource GeometryFileAdd2}" <KeyBinding Key="F" Command="{Binding ChangeFavoritenStateRoutineCommand}" />
Fill="Black" <KeyBinding Key="N" Command="{Binding OpenAddRoutineDialogCommand}" />
Stretch="Uniform" /> </TabItem.InputBindings>
<TextBlock> <Grid Background="Transparent">
Hier sind noch keine Routinen angelegt. <dxe:ListBoxEdit x:Name="listBoxEdit2" ItemsSource="{Binding SelectedFolder.Routines, UpdateSourceTrigger=PropertyChanged}">
</TextBlock> <dxe:ListBoxEdit.ContextMenu>
</StackPanel> <ContextMenu>
</Grid> <ContextMenu.Resources>
</TabItem> <ResourceDictionary>
</TabControl> <Style TargetType="{x:Type Image}">
<Setter Property="Height" Value="24" />
</Style>
</ResourceDictionary>
</ContextMenu.Resources>
<MenuItem Command="{Binding OpenAddRoutineDialogCommand}" Header="Neue Routine">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Add24.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</dxe:ListBoxEdit.ContextMenu>
</dxe:ListBoxEdit>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<StackPanel.Visibility>
<MultiBinding Converter="{StaticResource BooleanAndVisibilityMultiConverter}">
<Binding
Converter="{StaticResource CollectionCountToBoolConverter}"
ConverterParameter="reverse"
Path="SelectedFolder.Routines.Count" />
<Binding Path="SelectedFolder.CanAddRoutine" />
</MultiBinding>
</StackPanel.Visibility>
<Path
Height="32"
Margin="6"
Data="{StaticResource GeometryFileAdd2}"
Fill="Black"
IsHitTestVisible="False"
Stretch="Uniform" />
<TextBlock IsHitTestVisible="False">
Hier sind noch keine Routinen angelegt.
</TextBlock>
<Button
Width="150"
Margin="3,12,3,3"
Command="{Binding OpenAddRoutineDialogCommand}">
Erste Routine anlegen
</Button>
</StackPanel>
</Grid>
</TabItem>
</TabControl>
<StackPanel
HorizontalAlignment="Right"
VerticalAlignment="Top"
Orientation="Horizontal"
Visibility="{Binding SelectedFolder.CanAddPrompt, Converter={StaticResource BoolVisibilityConverter}}">
<StackPanel.Resources>
<ResourceDictionary>
<Style BasedOn="{StaticResource HideDisabledButton}" TargetType="Button">
<Setter Property="Width" Value="120" />
<Setter Property="Height" Value="23" />
<Setter Property="Visibility" Value="Collapsed" />
</Style>
</ResourceDictionary>
</StackPanel.Resources>
<Button x:Name="btn_addPrompt" Command="{Binding OpenAddPromptDialogCommand}">
<Button.Style>
<Style BasedOn="{StaticResource {x:Type Button}}" TargetType="Button">
<Style.Triggers>
<DataTrigger Binding="{Binding SelectedIndex, ElementName=tabcontrol_1}" Value="0">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
<DataTrigger Binding="{Binding SelectedIndex, ElementName=tabcontrol_1}" Value="1">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
+ Prompt
</Button>
<Button x:Name="btn_addRoutine" Command="{Binding OpenAddRoutineDialogCommand}">
<Button.Style>
<Style BasedOn="{StaticResource {x:Type Button}}" TargetType="Button">
<Style.Triggers>
<DataTrigger Binding="{Binding SelectedIndex, ElementName=tabcontrol_1}" Value="0">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
<DataTrigger Binding="{Binding SelectedIndex, ElementName=tabcontrol_1}" Value="2">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
+ Routine
</Button>
</StackPanel>
</Grid>
</Grid> </Grid>
</GroupBox> </GroupBox>
</view:BeWoView> </view:BeWoView>

View File

@@ -38,7 +38,7 @@ namespace BeWo.View.Detail.AI
InitializeComponent(); InitializeComponent();
if (viewModel == null ) if (viewModel == null )
viewModel = new AiPromptbausteinComplexTreeViewModel(BeWoApp.MainControl.WindowService, BS.Shared.AiActionType.ServiceRecordConversation); viewModel = new AiPromptbausteinComplexTreeViewModel(BeWoApp.WindowService, BS.Shared.AiActionType.ServiceRecordConversation);
DataContext = ViewModel = viewModel; DataContext = ViewModel = viewModel;
@@ -51,7 +51,7 @@ namespace BeWo.View.Detail.AI
private void OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e) private void OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
{ {
TreeViewItem treeViewItem = VisualUpwardSearch(e.OriginalSource as DependencyObject); TreeViewItem treeViewItem = VisualUpwardSearch<TreeViewItem>(e.OriginalSource as DependencyObject);
if (treeViewItem != null) if (treeViewItem != null)
{ {
@@ -72,12 +72,12 @@ namespace BeWo.View.Detail.AI
} }
} }
static TreeViewItem VisualUpwardSearch(DependencyObject source) static T VisualUpwardSearch<T>(DependencyObject source) where T : DependencyObject
{ {
while (source != null && !(source is TreeViewItem)) while (source != null && !(source is T))
source = VisualTreeHelper.GetParent(source); source = VisualTreeHelper.GetParent(source);
return source as TreeViewItem; return source as T;
} }
private void treeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e) private void treeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
@@ -90,14 +90,17 @@ namespace BeWo.View.Detail.AI
private void Grid_PreviewMouseDown(object sender, MouseButtonEventArgs e) private void Grid_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{ {
TreeViewItem treeViewItem = VisualUpwardSearch(e.OriginalSource as DependencyObject); TreeViewItem treeViewItem = VisualUpwardSearch<TreeViewItem>(e.OriginalSource as DependencyObject);
if (treeViewItem is null) if (treeViewItem is null)
{
treeView.Focus();
e.Handled = true;
return; return;
}
if (e.ClickCount == 2) if (e.ClickCount == 2)
{ {
ViewModel.OpenEditFolderDialogCommand.Execute(null); ViewModel.OpenEditFolderDialogCommand.Execute(null);
e.Handled = true; e.Handled = true;
} }
@@ -111,7 +114,7 @@ namespace BeWo.View.Detail.AI
private void treeView_ContextMenuOpening(object sender, ContextMenuEventArgs e) private void treeView_ContextMenuOpening(object sender, ContextMenuEventArgs e)
{ {
ViewModel.UpdateFolderCommands();
} }
private void ListBox_ContextMenuOpening(object sender, ContextMenuEventArgs e) private void ListBox_ContextMenuOpening(object sender, ContextMenuEventArgs e)
@@ -158,5 +161,40 @@ namespace BeWo.View.Detail.AI
e.Handled = true; e.Handled = true;
} }
} }
private void listBoxEdit3_PreviewKeyDown(object sender, KeyEventArgs e)
{
//TreeViewItem treeViewItem = VisualUpwardSearch<ListViewItem>(e.OriginalSource as DependencyObject);
//if (treeViewItem is null)
//{
// treeView.Focus();
// e.Handled = true;
// return;
//}
//if (e.ClickCount == 2)
//{
// ViewModel.OpenEditFolderDialogCommand.Execute(null);
// e.Handled = true;
//}
}
private void listBoxEdit3_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
ListBoxItem listBoxItem = VisualUpwardSearch<ListBoxItem>(e.OriginalSource as DependencyObject);
if(listBoxItem is null)
{
((ListBoxEdit)sender).Focus();
e.Handled = true;
return;
}
}
private void listBoxEdit3_PreviewMouseDown_1(object sender, MouseButtonEventArgs e)
{
}
} }
} }

View File

@@ -308,21 +308,21 @@ namespace BeWo.View.Detail
return dict; return dict;
} }
private AiConversationChatViewModel getAiConversationChatViewModel() // private AiConversationChatViewModel getAiConversationChatViewModel()
{ // {
throw new NotImplementedException(); // throw new NotImplementedException();
//var customer_oid = ViewModel.DataContract.CustomerOid; // //var customer_oid = ViewModel.DataContract.CustomerOid;
//var context = GetVisibleInformationReferences(); // //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() //private void OpenAiWindow()
{ //{
MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel()); // MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
} //}
void Image_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e) void Image_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
{ {

View File

@@ -0,0 +1,60 @@
<view:BeWoView
x:Class="BeWo.View.Developer.DeveloperView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:developer="clr-namespace:BeWo.ViewModel.View.Developer"
xmlns:local="clr-namespace:BeWo.View.Developer"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:view="clr-namespace:BeWo.View"
d:DataContext="{d:DesignInstance Type=developer:DesignDeveloperViewModel}"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<view:BeWoView.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="..\..\Styles\ModernOrangeBlack.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style BasedOn="{StaticResource {x:Type Label}}" TargetType="Label">
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="Margin" Value="3,6" />
</Style>
</ResourceDictionary>
</view:BeWoView.Resources>
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<TabControl SelectedIndex="1">
<TabItem Header="Allgemein" />
<TabItem Header="WPF">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="45" />
<ColumnDefinition Width="90" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="45" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Label Grid.Column="1">KeyboardFocus:</Label>
<TextBox
Grid.Column="2"
IsReadOnly="True"
Text="{Binding KeyboardFocus}" />
<Label Grid.Row="1" Grid.Column="1">LogicalFocus:</Label>
<TextBox
Grid.Row="1"
Grid.Column="2"
IsReadOnly="True"
Text="{Binding LogicalFocus}" />
</Grid>
</TabItem>
<TabItem Header="Logs" />
<TabItem Header="Configs" />
</TabControl>
</Grid>
</view:BeWoView>

View File

@@ -0,0 +1,38 @@
using BeWo.ViewModel.View.Administration;
using BeWo.ViewModel.View.Developer;
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.Developer
{
/// <summary>
/// Interaktionslogik für DeveloperView.xaml
/// </summary>
public partial class DeveloperView : BeWoView
{
public DeveloperViewModel ViewModel
{
get => DataContext as DeveloperViewModel;
set => DataContext = value;
}
public DeveloperView(DeveloperViewModel viewModel)
{
InitializeComponent();
ViewModel = viewModel;
}
}
}

View File

@@ -233,20 +233,20 @@ namespace BeWo.View.Navigation
return dict; return dict;
} }
private AiConversationChatViewModel getAiConversationChatViewModel() //private AiConversationChatViewModel getAiConversationChatViewModel()
{ //{
throw new NotImplementedException(); // throw new NotImplementedException();
// var context = GetVisibleInformationReferences(); //// var context = GetVisibleInformationReferences();
// var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.CustomerNavigation, context); //// var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.CustomerNavigation, context);
// return vm; //// return vm;
} //}
private void OpenAiWindow() //private void OpenAiWindow()
{ //{
MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel()); // MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
} //}
private void SupportConceptFilterComboBoxOnSelectionChanged(object o, SelectionChangedEventArgs selectionChangedEventArgs) private void SupportConceptFilterComboBoxOnSelectionChanged(object o, SelectionChangedEventArgs selectionChangedEventArgs)
{ {

View File

@@ -108,20 +108,20 @@ namespace BeWo.View.Navigation
return dict; return dict;
} }
private AiConversationChatViewModel getAiConversationChatViewModel() //private AiConversationChatViewModel getAiConversationChatViewModel()
{ //{
throw new NotImplementedException(); // throw new NotImplementedException();
//var context = GetVisibleInformationReferences(); // //var context = GetVisibleInformationReferences();
//var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.EmployeeNavigation, context); // //var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.EmployeeNavigation, context);
//return vm; // //return vm;
} //}
private void OpenAiWindow() //private void OpenAiWindow()
{ //{
MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel()); // MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
} //}
private bool MainNavigationView_ArchiveObject(IFilterableDC obj) private bool MainNavigationView_ArchiveObject(IFilterableDC obj)
{ {

View File

@@ -73,20 +73,20 @@ namespace BeWo.View.Navigation
return dict; return dict;
} }
private AiConversationChatViewModel getAiConversationChatViewModel() //private AiConversationChatViewModel getAiConversationChatViewModel()
{ //{
throw new NotImplementedException(); // throw new NotImplementedException();
//var context = GetVisibleInformationReferences(); // //var context = GetVisibleInformationReferences();
//var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.OrganisationNavigation, context); // //var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.OrganisationNavigation, context);
//return vm; // //return vm;
} //}
private void OpenAiWindow() //private void OpenAiWindow()
{ //{
MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel()); // MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
} //}
private void mainNavigationView_CreateNewObject() private void mainNavigationView_CreateNewObject()
{ {

View File

@@ -148,20 +148,20 @@ namespace BeWo.View.Navigation
return dict; return dict;
} }
private AiConversationChatViewModel getAiConversationChatViewModel() //private AiConversationChatViewModel getAiConversationChatViewModel()
{ //{
throw new NotImplementedException(); // throw new NotImplementedException();
//var context = GetVisibleInformationReferences(); // //var context = GetVisibleInformationReferences();
//var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.PersonNavigation, context); // //var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.PersonNavigation, context);
//return vm; // //return vm;
} //}
private void OpenAiWindow() //private void OpenAiWindow()
{ //{
MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel()); // MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
} //}
private void SupportConceptFilterComboBoxOnSelectionChanged(object o, SelectionChangedEventArgs selectionChangedEventArgs) private void SupportConceptFilterComboBoxOnSelectionChanged(object o, SelectionChangedEventArgs selectionChangedEventArgs)
{ {

View File

@@ -223,21 +223,21 @@ namespace BeWo.View.Navigation
return dict; return dict;
} }
private AiConversationChatViewModel getAiConversationChatViewModel() //private AiConversationChatViewModel getAiConversationChatViewModel()
{ //{
throw new NotImplementedException(); // throw new NotImplementedException();
//var context = GetVisibleInformationReferences(); // //var context = GetVisibleInformationReferences();
//var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.SupportConceptNavigation, context); // //var vm = VMFactory.CreateAiConversationChatViewModel(AiContextType.SupportConceptNavigation, context);
//return vm; // //return vm;
} //}
private void OpenAiWindow() //private void OpenAiWindow()
{ //{
MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel()); // MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
} //}
private void SupportConceptFilterComboBoxOnSelectionChanged(object o, SelectionChangedEventArgs selectionChangedEventArgs) private void SupportConceptFilterComboBoxOnSelectionChanged(object o, SelectionChangedEventArgs selectionChangedEventArgs)
{ {

View File

@@ -143,7 +143,7 @@ namespace BeWo.ViewModel.Controls.AI
vm.SendAfterLoaded = true; vm.SendAfterLoaded = true;
vm.PromptInput = prompt; vm.PromptInput = prompt;
vm.MessageInput = prompt.Prompt; vm.MessageInput = prompt.Prompt;
BeWoApp.MainControl.WindowService.Show(vm); BeWoApp.WindowService.Show(vm);
return; return;
} }
else if (e is AiPromptbausteinRoutineVM routine) else if (e is AiPromptbausteinRoutineVM routine)
@@ -152,7 +152,7 @@ namespace BeWo.ViewModel.Controls.AI
vm.SendAfterLoaded = true; vm.SendAfterLoaded = true;
vm.RoutineInput = routine; vm.RoutineInput = routine;
vm.MessageInput = routine.Steps.VMList[0].PromptReference.Prompt; vm.MessageInput = routine.Steps.VMList[0].PromptReference.Prompt;
BeWoApp.MainControl.WindowService.Show(vm); BeWoApp.WindowService.Show(vm);
return; return;
} }
@@ -170,12 +170,12 @@ namespace BeWo.ViewModel.Controls.AI
private protected void OpenConversationPopup() private protected void OpenConversationPopup()
{ {
BeWoApp.MainControl.WindowService.Show(GetConversationViewModel()); BeWoApp.WindowService.Show(GetConversationViewModel());
} }
private protected void OpenAllPromptsPopup() private protected void OpenAllPromptsPopup()
{ {
BeWoApp.MainControl.WindowService.Show(AllPromptsViewModel); BeWoApp.WindowService.Show(AllPromptsViewModel);
} }
private protected void OpenFavoritePromptsPopup() private protected void OpenFavoritePromptsPopup()

View File

@@ -79,7 +79,7 @@ namespace BeWo.ViewModel.ListViewModel
// Holt bereits geladene // Holt bereits geladene
if (invoice_base.XRechnungStoredFileVM is StoredFileVM vm && vm.Data is byte[] bytes) if (invoice_base.XRechnungStoredFileVM is StoredFileVM vm && vm.Data is byte[] bytes)
{ {
BeWoApp.MainControl.WindowService.ShowERechnungWindow(new MemoryStream(bytes)); BeWoApp.WindowService.ShowERechnungWindow(new MemoryStream(bytes));
return; return;
} }
@@ -103,7 +103,7 @@ namespace BeWo.ViewModel.ListViewModel
invoice_base.XRechnungStoredFileVM.Data = bytes; invoice_base.XRechnungStoredFileVM.Data = bytes;
BeWoApp.MainControl.WindowService.ShowERechnungWindow(new MemoryStream(bytes)); BeWoApp.WindowService.ShowERechnungWindow(new MemoryStream(bytes));
} }
else else
{ {

View File

@@ -74,7 +74,7 @@ namespace BeWo.ViewModel.View.AI
public AiPromptbausteinSelectionComplexViewModel(AiActionType aiActionType) : this() public AiPromptbausteinSelectionComplexViewModel(AiActionType aiActionType) : this()
{ {
AiActionType = aiActionType; AiActionType = aiActionType;
WindowService = BeWoApp.MainControl.WindowService; WindowService = BeWoApp.WindowService;
InitCommands(); InitCommands();
} }
public AiPromptbausteinSelectionComplexViewModel(AiActionType aiActionType, AiPromptbausteinFolderListVM viewModel, bool isFavorite = false, bool canOpen = true) : this(aiActionType) public AiPromptbausteinSelectionComplexViewModel(AiActionType aiActionType, AiPromptbausteinFolderListVM viewModel, bool isFavorite = false, bool canOpen = true) : this(aiActionType)

View File

@@ -4,6 +4,7 @@ using BeWo.ViewModel.ListViewModel;
using BS.Shared; using BS.Shared;
using BS.Shared.DataContracts.Compact; using BS.Shared.DataContracts.Compact;
using BS.Shared.DataContracts.Feature.AI; using BS.Shared.DataContracts.Feature.AI;
using DevExpress.DataProcessing;
using DevExpress.Mvvm; using DevExpress.Mvvm;
using DevExpress.Utils.Extensions; using DevExpress.Utils.Extensions;
using DevExpress.Xpf.Layout.Core; using DevExpress.Xpf.Layout.Core;
@@ -51,6 +52,9 @@ namespace BeWo.ViewModel.View.Administration
public DelegateCommand DeleteRoutineCommand { get; private set; } public DelegateCommand DeleteRoutineCommand { get; private set; }
public DelegateCommand ChangeFavoritenStateRoutineCommand { get; private set; } public DelegateCommand ChangeFavoritenStateRoutineCommand { get; private set; }
public DelegateCommand OpenEditItemDialogCommand { get; private set; }
public DelegateCommand DeleteItemCommand { get; private set; }
public DelegateCommand ChangeFavoritenStateItemCommand { get; private set; }
public bool CanEditPromptbausteine { get; set; } public bool CanEditPromptbausteine { get; set; }
@@ -59,19 +63,32 @@ namespace BeWo.ViewModel.View.Administration
get => _SelectedFolder; get => _SelectedFolder;
set set
{ {
SetProperty(ref _SelectedFolder, value, nameof(SelectedFolder)); var success = SetProperty(ref _SelectedFolder, value, nameof(SelectedFolder));
if (SelectedItem is AiPromptbausteinPromptVM vm) if (SelectedItem is AiPromptbausteinPromptVM vm)
{ {
SelectedItem = null; SelectedItem = null;
} }
if (!success)
return;
UpdateFolderCommands();
UpdatePromptCommands();
} }
} }
public AbstractBaseVM SelectedItem public AbstractBaseVM SelectedItem
{ {
get => _SelectedItem; get => _SelectedItem;
set => SetProperty(ref _SelectedItem, value, nameof(SelectedItem)); set {
var success = SetProperty(ref _SelectedItem, value, nameof(SelectedItem));
if (!success)
return;
UpdateItemCommands();
}
} }
public AiPromptbausteinComplexTreeViewModel() : this(null, AiActionType.ServiceRecordConversation) public AiPromptbausteinComplexTreeViewModel() : this(null, AiActionType.ServiceRecordConversation)
@@ -107,6 +124,18 @@ namespace BeWo.ViewModel.View.Administration
DeleteRoutineCommand = new DelegateCommand(OpenDeleteRoutineDialog, canOpenDeleteRoutineDialog, false); DeleteRoutineCommand = new DelegateCommand(OpenDeleteRoutineDialog, canOpenDeleteRoutineDialog, false);
ChangeFavoritenStateRoutineCommand = new DelegateCommand(ChangeFavoritenStateRoutine, canChangeFavoritenStateRoutine, false); ChangeFavoritenStateRoutineCommand = new DelegateCommand(ChangeFavoritenStateRoutine, canChangeFavoritenStateRoutine, false);
Action executeEditItem = () => ExecuteItem(OpenEditPromptDialog, OpenEditRoutineDialog);
Func<bool> canExecuteEditItem = () => canExecuteItem(canOpenEditPromptDialog, canOpenEditRoutineDialog);
OpenEditItemDialogCommand = new DelegateCommand(executeEditItem, canExecuteEditItem, true);
Action executeDeleteItem = () => ExecuteItem(OpenDeletePromptDialog, OpenDeleteRoutineDialog);
Func<bool> canExecuteDeleteItem = () => canExecuteItem(canOpenDeletePromptDialog, canOpenDeleteRoutineDialog);
DeleteItemCommand = new DelegateCommand(executeDeleteItem, canExecuteDeleteItem, true);
Action executeFavoriteItem = () => ExecuteItem(ChangeFavoritenStatePrompt, ChangeFavoritenStateRoutine);
Func<bool> canExecuteFavoriteItem = () => canExecuteItem(canChangeFavoritenStatePrompt, canChangeFavoritenStateRoutine);
ChangeFavoritenStateItemCommand = new DelegateCommand(executeFavoriteItem, canExecuteFavoriteItem, true);
CanEditPromptbausteine = BeWoApp.HasLoggedOnUserRight(UserRightType.AiModulePromptbausteineEdit); CanEditPromptbausteine = BeWoApp.HasLoggedOnUserRight(UserRightType.AiModulePromptbausteineEdit);
} }
@@ -140,7 +169,13 @@ namespace BeWo.ViewModel.View.Administration
OpenAddRoutineDialogCommand.RaiseCanExecuteChanged(); OpenAddRoutineDialogCommand.RaiseCanExecuteChanged();
OpenEditRoutineDialogCommand.RaiseCanExecuteChanged(); OpenEditRoutineDialogCommand.RaiseCanExecuteChanged();
DeleteRoutineCommand.RaiseCanExecuteChanged(); DeleteRoutineCommand.RaiseCanExecuteChanged();
ChangeFavoritenStateRoutineCommand.RaiseCanExecuteChanged(); ChangeFavoritenStateRoutineCommand.RaiseCanExecuteChanged();
}
public void UpdateItemCommands()
{
OpenEditItemDialogCommand.RaiseCanExecuteChanged();
DeleteItemCommand.RaiseCanExecuteChanged();
ChangeFavoritenStateItemCommand.RaiseCanExecuteChanged();
} }
internal void ReloadVMList() internal void ReloadVMList()
@@ -226,7 +261,7 @@ namespace BeWo.ViewModel.View.Administration
bool canOpenAddFolderDialog() bool canOpenAddFolderDialog()
{ {
return CanEditPromptbausteine && (SelectedFolder?.CanAddFolder ?? true); return CanEditPromptbausteine && (SelectedFolder?.CanAddFolder ?? false);
} }
bool canOpenEditFolderDialog() bool canOpenEditFolderDialog()
{ {
@@ -533,6 +568,25 @@ namespace BeWo.ViewModel.View.Administration
bool canOpenDeleteRoutineDialog() => CanEditPromptbausteine && ((SelectedItem as AiPromptbausteinRoutineVM)?.CanEdit ?? false); bool canOpenDeleteRoutineDialog() => CanEditPromptbausteine && ((SelectedItem as AiPromptbausteinRoutineVM)?.CanEdit ?? false);
bool canChangeFavoritenStateRoutine() => SelectedItem is AiPromptbausteinRoutineVM; bool canChangeFavoritenStateRoutine() => SelectedItem is AiPromptbausteinRoutineVM;
void ExecuteItem(Action prompt_action, Action routine_action)
{
if (SelectedItem is AiPromptbausteinPromptVM)
prompt_action();
else if (SelectedItem is AiPromptbausteinRoutineVM)
routine_action();
else
throw new NotImplementedException("item is not AiPromptbausteinPromptVM or AiPromptbausteinRoutineVM");
}
bool canExecuteItem(Func<bool> prompt_func, Func<bool> routine_func)
{
if (SelectedItem is AiPromptbausteinPromptVM)
return prompt_func();
else if (SelectedItem is AiPromptbausteinRoutineVM)
return routine_func();
return false;
}
void InitDesigner() void InitDesigner()
{ {
var root = PredefinedAiPromptbausteinFolders.CreateSubTree(AiActionType.ServiceRecordConversation); var root = PredefinedAiPromptbausteinFolders.CreateSubTree(AiActionType.ServiceRecordConversation);

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BeWo.ViewModel.View.Developer
{
public class DesignDeveloperViewModel : DeveloperViewModel
{
public DesignDeveloperViewModel()
{
KeyboardFocus = "Button";
LogicalFocus = "Button";
}
}
}

View File

@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using System.Windows.Threading;
using System.Windows;
namespace BeWo.ViewModel.View.Developer
{
public class DeveloperViewModel : WindowViewModel
{
private string _keyboardFocus;
private string _logicalFocus;
public string KeyboardFocus
{
get => _keyboardFocus;
set => SetProperty(ref _keyboardFocus, value, nameof(KeyboardFocus));
}
public string LogicalFocus
{
get => _logicalFocus;
set => SetProperty(ref _logicalFocus, value, nameof(LogicalFocus));
}
public DeveloperViewModel()
{
var timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(200) };
timer.Tick += (s, e) => Refresh();
timer.Start();
}
private void Refresh()
{
// Keyboard Focus globaler Input-Fokus, nur ein Element systemweit
var keyboard = Keyboard.FocusedElement;
KeyboardFocus = FormatElement(keyboard);
// Logical Focus pro FocusScope, kann vom Keyboard Focus abweichen
// z.B. wenn ein Menü oder Toolbar aktiv ist
var mainWindow = Application.Current.MainWindow;
var logical = mainWindow != null
? FocusManager.GetFocusedElement(mainWindow)
: null;
LogicalFocus = FormatElement(logical);
}
private static string FormatElement(object element)
{
if (element is null)
return "(kein Fokus)";
if (element is FrameworkElement fe)
{
var name = string.IsNullOrEmpty(fe.Name) ? "(kein Name)" : fe.Name;
var dc = fe.DataContext?.GetType().Name ?? "";
return $"{fe.GetType().Name} | Name: {name} | DC: {dc}";
}
return element.GetType().Name;
}
}
}

View File

@@ -147,22 +147,22 @@ namespace BeWo.Service.Plugins
return conv_dc; return conv_dc;
} }
public AiConversationDC CreateAiConversationWithPromptbaustein(AiConversationDC conversation, AiViewContextDC view_context, long oid) //public AiConversationDC CreateAiConversationWithPromptbaustein(AiConversationDC conversation, AiViewContextDC view_context, long oid)
{ //{
var config = GetAiConfig(); // var config = GetAiConfig();
var conv = createAiConversation(conversation.ActionType, view_context, config); // var conv = createAiConversation(conversation.ActionType, view_context, config);
var promptbaustein = DAOFactory.GenericDAO.LoadByID<AiPromptbausteinPrompt>(oid); // var promptbaustein = DAOFactory.GenericDAO.LoadByID<AiPromptbausteinPrompt>(oid);
var new_messages = sendNewMessage(conv, promptbaustein.Prompt, config); // var new_messages = sendNewMessage(conv, promptbaustein.Prompt, config);
DAOFactory.GenericDAO.Insert(conv); // DAOFactory.GenericDAO.Insert(conv);
var conv_dc = MapperFactory.AiConversation.MapToNewDC(conv); // var conv_dc = MapperFactory.AiConversation.MapToNewDC(conv);
return conv_dc; // return conv_dc;
} //}
public virtual AiConversationDC CloneAiConversation(long conversation_oid, long? last_message_oid) public virtual AiConversationDC CloneAiConversation(long conversation_oid, long? last_message_oid)
{ {
var parent_conv = DAOFactory.GenericDAO.GetByID<AiConversation>(conversation_oid); var parent_conv = DAOFactory.GenericDAO.GetByID<AiConversation>(conversation_oid);
@@ -236,6 +236,40 @@ namespace BeWo.Service.Plugins
return sendNewMessage(conv, message); return sendNewMessage(conv, message);
} }
public virtual AiConversationMessageDC[] ExecuteAiConversationWithMessage(long conversation, AiViewContextDC view_context, long routine, int step)
{
var conv = DAOFactory.GenericDAO.LoadByID<AiConversation>(conversation);
var routine_ent = DAOFactory.GenericDAO.LoadByID<AiPromptbausteinRoutine>(routine);
var step_ent = routine_ent.Steps[step];
var message = step_ent.PromptReference.Prompt;
var actionType = conv.ActionType;
var conv_messages = conv.Messages;
var conv_messages_filtered = conv_messages.Where(x => x.Role != AiConversationMessageRole.System);
var new_conv = createAiConversation(actionType, view_context);
if (routine_ent.RoutineType == AiRoutineType.Stack)
{
// Stack
return sendNewMessage(new_conv, message);
}
else if (routine_ent.RoutineType == AiRoutineType.Chain)
{
}
else
{
throw BeWoNotImplementedException.CreateFromEnum(routine_ent.RoutineType);
}
return sendNewMessage(conv, message);
}
public virtual bool CheckContextSize(AiActionType actionType, AiViewContextDC view_context) public virtual bool CheckContextSize(AiActionType actionType, AiViewContextDC view_context)
{ {
var modell_oid_value = GetAiConfig().SelectedModel.Oid.Value; var modell_oid_value = GetAiConfig().SelectedModel.Oid.Value;

View File

@@ -20,22 +20,22 @@ namespace BeWo.Service.ServiceContracts.Enhanced
{ {
[FaultContract(typeof(BeWoFault))] [FaultContract(typeof(BeWoFault))]
[OperationContract] [OperationContract]
[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)] //[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)]
AiConfigDC GetAiConfig(); AiConfigDC GetAiConfig();
[FaultContract(typeof(BeWoFault))] [FaultContract(typeof(BeWoFault))]
[OperationContract] [OperationContract]
[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)] //[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)]
AiConfigDC UpdateAiConfig(AiConfigDC toUpdate); AiConfigDC UpdateAiConfig(AiConfigDC toUpdate);
[FaultContract(typeof(BeWoFault))] [FaultContract(typeof(BeWoFault))]
[OperationContract] [OperationContract]
[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)] //[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)]
IEnumerable<AiModelDC> GetAiModels(); IEnumerable<AiModelDC> GetAiModels();
[FaultContract(typeof(BeWoFault))] [FaultContract(typeof(BeWoFault))]
[OperationContract] [OperationContract]
[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)] //[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)]
IEnumerable<AiConversationDC> GetAiConversations(AiActionType actionType, long? oid); IEnumerable<AiConversationDC> GetAiConversations(AiActionType actionType, long? oid);
[FaultContract(typeof(BeWoFault))] [FaultContract(typeof(BeWoFault))]
@@ -48,31 +48,29 @@ namespace BeWo.Service.ServiceContracts.Enhanced
[FaultContract(typeof(BeWoFault))] [FaultContract(typeof(BeWoFault))]
[OperationContract] [OperationContract]
AiConversationDC CreateAiConversationWithPromptbaustein(AiConversationDC conversation, AiViewContextDC view_context, long prompt_oid); //[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)]
[FaultContract(typeof(BeWoFault))]
[OperationContract]
[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)]
AiConversationDC CloneAiConversation(long conversation_oid, long? message_oid); AiConversationDC CloneAiConversation(long conversation_oid, long? message_oid);
[FaultContract(typeof(BeWoFault))] [FaultContract(typeof(BeWoFault))]
[OperationContract] [OperationContract]
[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)] //[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)]
long UpdateAiConversationDisplayname(long oid, long version, string displayname); long UpdateAiConversationDisplayname(long oid, long version, string displayname);
[FaultContract(typeof(BeWoFault))] [FaultContract(typeof(BeWoFault))]
[OperationContract] [OperationContract]
[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)]
void DeleteAiConversation(long conversation_oid); void DeleteAiConversation(long conversation_oid);
[FaultContract(typeof(BeWoFault))] [FaultContract(typeof(BeWoFault))]
[OperationContract] [OperationContract]
[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)]
AiConversationMessageDC[] SendNewMessage(long conversation, string message); AiConversationMessageDC[] SendNewMessage(long conversation, string message);
[FaultContract(typeof(BeWoFault))] [FaultContract(typeof(BeWoFault))]
[OperationContract] [OperationContract]
[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)] AiConversationMessageDC[] ExecuteAiConversationWithMessage(long conversation, AiViewContextDC view_context, long routine, int step);
[FaultContract(typeof(BeWoFault))]
[OperationContract]
//[RequireWcfAuthorization(UserRightType.AiModuleServiceRecordChat)]
bool CheckContextSize(AiActionType actionType, AiViewContextDC view_context); bool CheckContextSize(AiActionType actionType, AiViewContextDC view_context);
[FaultContract(typeof(BeWoFault))] [FaultContract(typeof(BeWoFault))]

View File

@@ -35,8 +35,6 @@ namespace BeWo.Service.ServiceImplementations.Enhanced
=> GetAiService().CreateAiConversation(conversation, view_context); => GetAiService().CreateAiConversation(conversation, view_context);
public AiConversationDC CreateAiConversationWithMessage(AiConversationDC conversation, AiViewContextDC view_context, string message) public AiConversationDC CreateAiConversationWithMessage(AiConversationDC conversation, AiViewContextDC view_context, string message)
=> GetAiService().CreateAiConversationWithMessage(conversation, view_context, message); => GetAiService().CreateAiConversationWithMessage(conversation, view_context, message);
public AiConversationDC CreateAiConversationWithPromptbaustein(AiConversationDC conversation, AiViewContextDC view_context, long prompt_oid)
=> GetAiService().CreateAiConversationWithPromptbaustein(conversation, view_context, prompt_oid);
public AiConversationDC CloneAiConversation(long conversation_oid, long? last_message_oid) public AiConversationDC CloneAiConversation(long conversation_oid, long? last_message_oid)
=> GetAiService().CloneAiConversation(conversation_oid, last_message_oid); => GetAiService().CloneAiConversation(conversation_oid, last_message_oid);
@@ -50,6 +48,9 @@ namespace BeWo.Service.ServiceImplementations.Enhanced
public AiConversationMessageDC[] SendNewMessage(long conversation, string message) public AiConversationMessageDC[] SendNewMessage(long conversation, string message)
=> GetAiService().SendNewMessage(conversation, message); => GetAiService().SendNewMessage(conversation, message);
public AiConversationMessageDC[] ExecuteAiConversationWithMessage(long conversation, AiViewContextDC view_context, long routine, int step)
=> GetAiService().ExecuteAiConversationWithMessage(conversation, view_context, routine, step);
public bool CheckContextSize(AiActionType actionType, AiViewContextDC view_context) public bool CheckContextSize(AiActionType actionType, AiViewContextDC view_context)
=> GetAiService().CheckContextSize(actionType, view_context); => GetAiService().CheckContextSize(actionType, view_context);