diff --git a/BeWo/Services/BeWoWindowService.cs b/BeWo/Services/BeWoWindowService.cs
index 39ae5d51f..fbabab803 100644
--- a/BeWo/Services/BeWoWindowService.cs
+++ b/BeWo/Services/BeWoWindowService.cs
@@ -237,7 +237,8 @@ namespace BeWo.Services
if (windowViewModel is DialogViewModel dialogViewModel)
{
- dialogViewModel.RequestCloseFinal += (s, e) => window.Close();
+ dialogViewModel.Closing += (s, e) => window.Close();
+ window.Closed += (s, e) => dialogViewModel.CloseFinalCommand.Execute(null);
}
if (options.ShowAsDialog)
diff --git a/BeWo/Styles/ControlStyles/GroupBoxStyles.xaml b/BeWo/Styles/ControlStyles/GroupBoxStyles.xaml
index deb694f71..b145aae5b 100644
--- a/BeWo/Styles/ControlStyles/GroupBoxStyles.xaml
+++ b/BeWo/Styles/ControlStyles/GroupBoxStyles.xaml
@@ -52,4 +52,129 @@
+
+
\ No newline at end of file
diff --git a/BeWo/View/Controls/AI/AiChatButton.xaml.cs b/BeWo/View/Controls/AI/AiChatButton.xaml.cs
index 72ad7c438..644ff35e0 100644
--- a/BeWo/View/Controls/AI/AiChatButton.xaml.cs
+++ b/BeWo/View/Controls/AI/AiChatButton.xaml.cs
@@ -67,12 +67,13 @@ namespace BeWo.View.Controls.AI
{
var viewmodel = new AiPromptbausteinSelectionComplexViewModel(actionType, listvm);
viewmodel.ItemAccepted += ItemAccepted;
- viewmodel.RequestCloseFinal += (s, e) => viewmodel.ResetSelection();
+ viewmodel.Closed += (s, e) => viewmodel.ResetSelection();
ViewModel.AllPromptsViewModel = viewmodel;
var viewmodel2 = new AiPromptbausteinSelectionComplexViewModel(actionType, listvm, true);
viewmodel2.ItemAccepted += ItemAccepted;
- popup_promptbaustein_favoriten.Closed += (s, e) => viewmodel2.ResetSelection();
+ popup_promptbaustein_favoriten.Closed += (s, e) => viewmodel2.CloseFinalCommand.Execute(null);
+ viewmodel2.Closed += (s, e) => viewmodel2.ResetSelection();
var view2 = new AiPromptbausteinComplexSelectionFavoritenView(viewmodel2);
viewmodel2.SelectedFolder = viewmodel2.Folders.VMList[0];
view2.Padding = new Thickness(3);
diff --git a/BeWo/View/Controls/AI/AiPromptbausteinLibraryControl.xaml b/BeWo/View/Controls/AI/AiPromptbausteinLibraryControl.xaml
index e2ab79dab..38b8b42c1 100644
--- a/BeWo/View/Controls/AI/AiPromptbausteinLibraryControl.xaml
+++ b/BeWo/View/Controls/AI/AiPromptbausteinLibraryControl.xaml
@@ -186,8 +186,8 @@
-
-
+
+
@@ -238,25 +238,26 @@
Background="Transparent"
ContextMenuOpening="ListBox_ContextMenuOpening"
PreviewMouseDown="Grid_PreviewMouseDown_2">
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
-
-
-
-
+
+
+
-
-
-
-
-
+
+
+
+
-
-
-
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
@@ -414,22 +416,16 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
+ Text="{Binding Oid, Mode=OneWay}" />
diff --git a/BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml.cs b/BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml.cs
index c3fd6ea87..f6bdf7844 100644
--- a/BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml.cs
+++ b/BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml.cs
@@ -230,24 +230,19 @@ namespace BeWo.View.Detail.Accounting
var dialog = new GkvAbrechnungDialogViewModel(vm);
- dialog.RequestCloseFinal += (s, ee) => Detail_Window_Closing(s, new CancelEventArgs());
+ dialog.Closing += (s, ee) => Detail_Window_Closing(s, new CancelEventArgs());
BeWoApp.MainControl.WindowService.ShowGkvAbrechnungDetailWindow(dialog);
}
private void Detail_Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
- var bewo_window = sender as AnimatedBeWoWindow;
- var detail_control = bewo_window.GroupBoxContent as GkvAbrechnungDetailControl;
-
- var vm = detail_control.DataContext as GkvAbrechnungLightVM;
+ var dialog = sender as GkvAbrechnungDialogViewModel;
+ var vm = dialog.Abrechnung;
vm.CheckAllInvoiceBases();
- var checkbox_checked = detail_control.Checkbox_Bezahlt.IsChecked;
- var textbox_text = detail_control.txt_Notice.Text;
-
- vm.Notice = textbox_text;
+ //vm.Notice = textbox_text;
if (vm.IsDirty)
{
diff --git a/BeWo/View/Windows/AnimatedBeWoWindow.xaml b/BeWo/View/Windows/AnimatedBeWoWindow.xaml
index 7e50c5a03..3966aea47 100644
--- a/BeWo/View/Windows/AnimatedBeWoWindow.xaml
+++ b/BeWo/View/Windows/AnimatedBeWoWindow.xaml
@@ -41,7 +41,7 @@
x:FieldModifier="public"
MouseDoubleClick="RootGroupBox_OnMouseDoubleClick"
MouseLeftButtonDown="RootGroupBox_OnMouseLeftButtonDown"
- Style="{DynamicResource PopUpWindowStyle}">
+ Style="{DynamicResource PopUpWindowStyle2}">
diff --git a/BeWo/View/Windows/AnimatedBeWoWindow.xaml.cs b/BeWo/View/Windows/AnimatedBeWoWindow.xaml.cs
index a0b15e24c..bb9b5a419 100644
--- a/BeWo/View/Windows/AnimatedBeWoWindow.xaml.cs
+++ b/BeWo/View/Windows/AnimatedBeWoWindow.xaml.cs
@@ -57,7 +57,7 @@ namespace BeWo.View.Windows
{
InitializeComponent();
- CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (s, e) => Close()));
+ //CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (s, e) => Close()));
if(ServiceFacade.IsWaiting())
StartWaiting();
@@ -169,7 +169,7 @@ namespace BeWo.View.Windows
public void Window_Closed(object sender, EventArgs e)
{
-
+
}
public void StartWaiting()
diff --git a/BeWo/ViewModel/AiPromptbausteinFolderVM.cs b/BeWo/ViewModel/AiPromptbausteinFolderVM.cs
index 8f2363deb..9fd3a4b53 100644
--- a/BeWo/ViewModel/AiPromptbausteinFolderVM.cs
+++ b/BeWo/ViewModel/AiPromptbausteinFolderVM.cs
@@ -245,7 +245,7 @@ namespace BeWo.ViewModel
public AiPromptbausteinFolderVM Parent { get; set; }
- public FontWeight FontWeight => !IsNew && Parent is null ? FontWeights.SemiBold : FontWeights.Medium;
+ public FontWeight FontWeight => !IsNew && (Parent is null || Parent.Parent is null) ? FontWeights.SemiBold : FontWeights.Medium;
public bool HasSubFolders => SubFolders is object && SubFolders.Count > 0;
public int TotalPromptCount
diff --git a/BeWo/ViewModel/Light/GkvAbrechnungLightVM.cs b/BeWo/ViewModel/Light/GkvAbrechnungLightVM.cs
index 5f07d28bc..a182d933d 100644
--- a/BeWo/ViewModel/Light/GkvAbrechnungLightVM.cs
+++ b/BeWo/ViewModel/Light/GkvAbrechnungLightVM.cs
@@ -26,8 +26,6 @@ namespace BeWo.ViewModel.Light
public static string PropertyName_ErstelltAm = "ErstelltAm";
- private long _Oid;
- private long _Version;
private string _Notice;
private long _OrganisationOid;
@@ -118,31 +116,11 @@ namespace BeWo.ViewModel.Light
public DateTime ErstelltAmDate => ErstelltAm.Date;
public long Oid
{
- get { return this._Oid; }
-
- set
- {
- if (this.AreDifferent(this._Oid, value))
- {
- this._Oid = value;
- this.StoreDirtyInformation(this.AreDifferent(this.DataContract.Oid, value), nameof(Oid));
- this.FirePropertyChanged(nameof(Oid));
- }
- }
+ get => DataContract.Oid;
}
public long Version
{
- get { return this._Version; }
-
- set
- {
- if (this.AreDifferent(this._Version, value))
- {
- this._Version = value;
- this.StoreDirtyInformation(this.AreDifferent(this.DataContract.Version, value), nameof(Version));
- this.FirePropertyChanged(nameof(Version));
- }
- }
+ get => DataContract.Version;
}
public string Notice
{
@@ -352,7 +330,7 @@ namespace BeWo.ViewModel.Light
public override void UpdateByDataContract(GkvAbrechnungLightDC pDataContract)
{
- Version = pDataContract.Version;
+ DataContract = pDataContract;
Notice = pDataContract.Notice;
@@ -373,9 +351,6 @@ namespace BeWo.ViewModel.Light
_ErstelltAm = pDataContract.ErstelltAm;
- _Oid = pDataContract.Oid;
- _Version = pDataContract.Version;
-
_Notice = pDataContract.Notice;
_Betrag = pDataContract.Betrag;
@@ -402,8 +377,6 @@ namespace BeWo.ViewModel.Light
}
protected override GkvAbrechnungLightDC MapToDataContract(GkvAbrechnungLightDC pDataContract, bool doCommit)
{
- pDataContract.Version = _Version;
-
pDataContract.Notice = _Notice;
pDataContract.Betrag = _Betrag;
pDataContract.Bezahlt = _Bezahlt;
@@ -421,7 +394,6 @@ namespace BeWo.ViewModel.Light
return;
}
- Version = dc.Version;
Protokolle = dc.Protokolle.ToList();
IsReady2Send = dc.IsReady2Send;
diff --git a/BeWo/ViewModel/VMFactory.cs b/BeWo/ViewModel/VMFactory.cs
index 82e025693..4509e3c28 100644
--- a/BeWo/ViewModel/VMFactory.cs
+++ b/BeWo/ViewModel/VMFactory.cs
@@ -970,11 +970,13 @@ namespace BeWo.ViewModel
Oid = -5,
Title = "Favoriten",
Description = "Eigene Favoriten",
- SubPrompts = new List()
+ SubPrompts = new List(),
+ SubRoutines = new List()
};
var fav_vm = new AiPromptbausteinFolderVM(favoriten);
fav_vm.SubPrompts.VMList.Clear();
+ fav_vm.SubRoutines.VMList.Clear();
folders.VMList.Insert(0, fav_vm);
diff --git a/BeWo/ViewModel/View/AI/AiPromptbausteinComplexSelectionViewModel.cs b/BeWo/ViewModel/View/AI/AiPromptbausteinComplexSelectionViewModel.cs
index 01916ca69..07e15a504 100644
--- a/BeWo/ViewModel/View/AI/AiPromptbausteinComplexSelectionViewModel.cs
+++ b/BeWo/ViewModel/View/AI/AiPromptbausteinComplexSelectionViewModel.cs
@@ -74,6 +74,8 @@ namespace BeWo.ViewModel.View.AI
{
Folders = new AiPromptbausteinFolderListVM();
}
+
+ //Closing += (s, e) => ResetSelection();
}
public AiPromptbausteinSelectionComplexViewModel(AiActionType aiActionType) : this()
{
@@ -84,7 +86,7 @@ namespace BeWo.ViewModel.View.AI
public AiPromptbausteinSelectionComplexViewModel(AiActionType aiActionType, AiPromptbausteinFolderListVM viewModel, bool isFavorite = false, bool canOpen = true) : this(aiActionType)
{
LoadedActionType = aiActionType;
- Folders = viewModel;
+ UpdateVMList(viewModel);
IsFavorite = isFavorite;
CanOpenContextMenu = canOpen;
}
@@ -154,6 +156,9 @@ namespace BeWo.ViewModel.View.AI
public AiPromptbausteinFolderListVM Folders { get; private set; }
public AiActionType LoadedActionType { get; set; }
+ public AiPromptbausteinFolderVM FavoritenFolder => Folders.VMList[0];
+ public AiPromptbausteinFolderVM RootFolders => Folders.VMList[1];
+
public bool HasFavoriten
{
get
@@ -163,7 +168,7 @@ namespace BeWo.ViewModel.View.AI
return true;
#endif
- return Folders.Count > 3 && (Folders.VMList[0].Prompts.Count > 0 || Folders.VMList[0].Routines.Count > 0);
+ return Folders.Count > 1 && (FavoritenFolder.Prompts.Count > 0 || FavoritenFolder.Routines.Count > 0);
}
}
@@ -175,10 +180,8 @@ namespace BeWo.ViewModel.View.AI
SelectedFolder = null;
- // Favoriten-Popup: Favoriten (VMList[0]), sonst "Eigene" (VMList[1]) vorauswählen.
- var target = IsFavorite
- ? (Folders.VMList.Count > 0 ? Folders.VMList[0] : null)
- : (Folders.VMList.Count > 1 ? Folders.VMList[1] : null);
+ // Favoriten-Popup:
+ var target = IsFavorite ? FavoritenFolder : RootFolders;
if (target != null)
{
@@ -211,7 +214,7 @@ namespace BeWo.ViewModel.View.AI
{
VMFactory.CreateAiPromptbausteinFolderListVMAsync(AiActionType, UpdateVMList);
- if(notify)
+ if (notify)
VMListReloaded?.Invoke(this, EventArgs.Empty);
}
private void UpdateVMList(AiPromptbausteinFolderListVM new_list)
@@ -220,17 +223,23 @@ namespace BeWo.ViewModel.View.AI
FirePropertyChanged(nameof(Folders));
- if (Folders.VMList.Count > 0 && Folders.VMList[0].DataContract.Oid == -5)
+ if (Folders.VMList.Count > 0
+ && Folders.VMList[0].DataContract.Oid == -51
+ && Folders.VMList[0].SubFolders.Count > 0
+ && Folders.VMList[0].SubFolders.VMList[0].DataContract.Oid == -5)
{
- Favoriten = Folders.VMList[0];
+ Favoriten = Folders.VMList[0].SubFolders.VMList[0];
if (IsFavorite)
SelectedFolder = Favoriten;
}
- // "Eigene" (VMList[1]) im normalen Modus vorauswählen.
- if (!IsFavorite && Folders.VMList.Count > 1)
- Folders.VMList[1].IsSelected = true;
+ if (!IsFavorite &&
+ Folders.VMList.Count > 0
+ && Folders.VMList[0].DataContract.Oid == -51
+ && Folders.VMList[0].SubFolders.Count > 1
+ && Folders.VMList[0].SubFolders.VMList[1].DataContract.Oid == -1)
+ Folders.VMList[0].SubFolders.VMList[1].IsSelected = true;
FirePropertyChanged(nameof(HasFavoriten));
}
diff --git a/BeWo/ViewModel/View/Administration/AiPromptbausteinComplexTreeViewModel.cs b/BeWo/ViewModel/View/Administration/AiPromptbausteinComplexTreeViewModel.cs
index b9fa0643d..8926281ad 100644
--- a/BeWo/ViewModel/View/Administration/AiPromptbausteinComplexTreeViewModel.cs
+++ b/BeWo/ViewModel/View/Administration/AiPromptbausteinComplexTreeViewModel.cs
@@ -29,7 +29,8 @@ namespace BeWo.ViewModel.View.Administration
private AiActionType AiActionType { get; set; }
public AiPromptbausteinFolderListVM Folders { get; set; }
- public AiPromptbausteinFolderVM Favoriten { get; set; }
+ public AiPromptbausteinFolderVM Favoriten => Folders.VMList[0];
+ public AiPromptbausteinFolderVM RootFolders => Folders.VMList[1];
public AiPromptbausteinFolderVM CopiedFolder { get; set; }
public AiPromptbausteinPromptVM CopiedPrompt { get; set; }
@@ -81,7 +82,8 @@ namespace BeWo.ViewModel.View.Administration
public AbstractBaseVM SelectedItem
{
get => _SelectedItem;
- set {
+ set
+ {
var success = SetProperty(ref _SelectedItem, value, nameof(SelectedItem));
if (!success)
@@ -169,7 +171,7 @@ namespace BeWo.ViewModel.View.Administration
OpenAddRoutineDialogCommand.RaiseCanExecuteChanged();
OpenEditRoutineDialogCommand.RaiseCanExecuteChanged();
DeleteRoutineCommand.RaiseCanExecuteChanged();
- ChangeFavoritenStateRoutineCommand.RaiseCanExecuteChanged();
+ ChangeFavoritenStateRoutineCommand.RaiseCanExecuteChanged();
}
public void UpdateItemCommands()
{
@@ -185,13 +187,11 @@ namespace BeWo.ViewModel.View.Administration
listvm =>
{
Folders = listvm;
- if (Folders.VMList.Count > 0 && Folders.VMList[0].DataContract.Oid == -5)
- {
- Favoriten = Folders.VMList[0];
- }
- if (Folders.VMList.Count > 1)
- Folders.VMList[1].IsSelected = true;
+ if (RootFolders.SubFolders.VMList[0].DataContract.Oid == -1)
+ {
+ RootFolders.SubFolders.VMList[0].IsSelected = true;
+ }
FirePropertyChanged(nameof(Folders));
});
diff --git a/BeWo/ViewModel/View/DialogViewModel.cs b/BeWo/ViewModel/View/DialogViewModel.cs
index 72736e271..c926c6d59 100644
--- a/BeWo/ViewModel/View/DialogViewModel.cs
+++ b/BeWo/ViewModel/View/DialogViewModel.cs
@@ -1,25 +1,35 @@
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 RequestCloseFinal;
+ public event EventHandler Closing;
+ public event EventHandler Closed;
- public DialogViewModel() : base()
+ public DelegateCommand CloseCommand { get; set; }
+ public DelegateCommand CloseFinalCommand { get; set; }
+
+ protected DialogViewModel() : base()
{
-
+ CloseCommand = new DelegateCommand(Close, canClose, false);
+ CloseFinalCommand = new DelegateCommand(CloseFinal, canClose, false);
}
protected virtual void Close()
{
- RequestCloseFinal?.Invoke(this, EventArgs.Empty);
+ Closing?.Invoke(this, EventArgs.Empty);
+ }
+
+ protected virtual void CloseFinal()
+ {
+ Closed?.Invoke(this, EventArgs.Empty);
+ }
+
+ protected virtual bool canClose()
+ {
+ return true;
}
}
}
diff --git a/Host/Config/ai/systemPrompts/customFunctionPreSystemPrompt.txt b/Host/Config/ai/systemPrompts/customFunctionPreSystemPrompt.txt
index 8690091be..fb8d1a772 100644
--- a/Host/Config/ai/systemPrompts/customFunctionPreSystemPrompt.txt
+++ b/Host/Config/ai/systemPrompts/customFunctionPreSystemPrompt.txt
@@ -9,3 +9,18 @@ Du bist ein hilfreicher Dokumentations-Assistent, der ausschließlich auf die be
- Antworte nur basierend auf dem Kontext. Wenn die Antwort nicht im Kontext zu finden ist, sage 'Ich weiß es nicht'.
- Antworte nur mit Fakten und Daten aus dem Kontext. Unterlasse Spekulationen, Meinungen oder persönliche Erfahrungen.
- Übersetzungen sind erlaubt.
+
+
+---
+
+### **Allgemein**
+- Aktuelle Zeit: {AktuelleZeit}
+
+### **Ansicht**
+- Ich befinde mich aktuell in der "{AktuellesModule}" meiner Anwendung.
+- {FilterEinstellungen}
+
+### **Daten**
+{DatenBlock}
+
+abs
diff --git a/Host/Config/ai/systemPrompts/customPreSystemPrompt.txt b/Host/Config/ai/systemPrompts/customPreSystemPrompt.txt
index b8e9cea0b..772818b6d 100644
--- a/Host/Config/ai/systemPrompts/customPreSystemPrompt.txt
+++ b/Host/Config/ai/systemPrompts/customPreSystemPrompt.txt
@@ -7,3 +7,16 @@ WICHTIG:
- Falls die Daten nicht die benötigte Information enthalten, gib an, dass die Daten fehlen, anstatt zu raten.
- KEINE Erklärungen, KEIN Fließtext, KEINE zusätzlichen Notizen!
- Deine Antwort soll eine direkte und verständliche Antwort für den Nutzer sein.
+
+
+---
+
+### **Allgemein**
+- Aktuelle Zeit: {AktuelleZeit}
+
+### **Ansicht**
+- Ich befinde mich aktuell in der "{AktuellesModule}" meiner Anwendung.
+- {FilterEinstellungen}
+
+### **Daten**
+{DatenBlock}
\ No newline at end of file
diff --git a/Server/Components/AICore/AICore.csproj b/Server/Components/AICore/AICore.csproj
index 99585ad6b..a6d1948fa 100644
--- a/Server/Components/AICore/AICore.csproj
+++ b/Server/Components/AICore/AICore.csproj
@@ -125,6 +125,7 @@
+
diff --git a/Server/Components/AICore/Prompt/AiSystemPromptFactory.cs b/Server/Components/AICore/Prompt/AiSystemPromptFactory.cs
index afd91dde5..e56613881 100644
--- a/Server/Components/AICore/Prompt/AiSystemPromptFactory.cs
+++ b/Server/Components/AICore/Prompt/AiSystemPromptFactory.cs
@@ -1,6 +1,7 @@
using AICore.Context.Summary;
using AICore.Prompt.SystemPrompts;
using BS.Shared;
+using BS.Shared.DataContracts.Feature.AI;
using BS.Shared.Exceptions;
using System;
using System.Collections.Generic;
@@ -13,25 +14,27 @@ namespace AICore.Prompt
{
public class AiSystemPromptFactory
{
- public static string BuildContext(AiActionType actionType, string prompt_path, BaseContextSummary context, AiDataContextType context_type)
+ public static string BuildContext(AiActionType actionType, string prompt_path, AiViewContextDC view_context, BaseContextSummary context, AiDataContextType context_type)
{
switch (actionType)
{
case AiActionType.ServiceRecord:
break;
case AiActionType.ServiceRecordConversation:
- var factory = new AiConversationSystemPromptBuilder(prompt_path);
- var prompt = factory.CreateSystemPrompt(actionType, context, context_type);
- return prompt;
case AiActionType.ServiceRecordDocumentation:
- var factory2 = new AiFunctionSystemPromptBuilder(prompt_path);
- var prompt2 = factory2.CreateServiceRecordDocumentationSystemPrompt(context);
- return prompt2;
+ return BuildGenericContext(actionType, prompt_path, view_context, context, context_type);
default:
break;
}
throw BeWoNotImplementedException.CreateFromEnum(actionType);
}
+
+ public static string BuildGenericContext(AiActionType actionType, string prompt_path, AiViewContextDC view_context, BaseContextSummary context, AiDataContextType context_type)
+ {
+ var factory = new AiGenericSystemPromptBuilder(prompt_path);
+
+ return factory.CreateSystemPrompt(actionType, view_context, context, context_type);
+ }
}
}
diff --git a/Server/Components/AICore/Prompt/SystemPrompts/AiConversationSystemPromptBuilder.cs b/Server/Components/AICore/Prompt/SystemPrompts/AiConversationSystemPromptBuilder.cs
index a21fb8682..6674a3d2a 100644
--- a/Server/Components/AICore/Prompt/SystemPrompts/AiConversationSystemPromptBuilder.cs
+++ b/Server/Components/AICore/Prompt/SystemPrompts/AiConversationSystemPromptBuilder.cs
@@ -2,6 +2,7 @@
using AICore.Context.SummaryParser;
using BS.Shared;
using BS.Shared.Core;
+using BS.Shared.DataContracts.Feature.AI;
using BS.Shared.Exceptions;
using BS.Shared.Translation;
using System;
@@ -14,66 +15,74 @@ using System.Text.Json;
namespace AICore.Prompt.SystemPrompts
{
- internal class AiConversationSystemPromptBuilder : BaseSystemPromptBuilder
- {
- public AiConversationSystemPromptBuilder(string prompt_path) : base(prompt_path) {
+ //internal class AiConversationSystemPromptBuilder : BaseSystemPromptBuilder
+ //{
+ // public AiConversationSystemPromptBuilder(string prompt_path) : base(prompt_path) {
- }
+ // }
- public string CreateSystemPrompt(AiActionType actionType, BaseContextSummary context, AiDataContextType aiDataContextType)
- {
- var sb = new StringBuilder();
+ // public string CreateSystemPrompt(AiActionType actionType, AiViewContextDC view_context, BaseContextSummary context, AiDataContextType aiDataContextType)
+ // {
+ // var currentDateTime = DateTime.Now;
+ // var moduleName = Translations[actionType];
+ // var filter = view_context.Filter is string filter_str
+ // ? $"Es ist folgender Filter gesetzt: {filter_str}"
+ // : "Es ist kein Filter gesetzt.";
- sb.AppendLine(getCustomSystemPrompt());
- sb.AppendLine();
- sb.AppendLine();
- sb.AppendLine("---");
- sb.AppendLine();
- sb.AppendLine("### **Allgemein**");
- sb.AppendLine($"- Aktuelle Zeit: {DateTime.Now}");
- sb.AppendLine();
- sb.AppendLine("### **Ansicht**");
- sb.AppendLine($"- Ich befinde mich aktuell in der \"{Translations[actionType]}\" meiner Anwendung.");
- sb.AppendLine($"- Es ist kein Filter gesetzt.");
- sb.AppendLine();
- sb.AppendLine("### **Daten**");
+ // var context =
- if (context?.Context is null)
- {
- sb.AppendLine("Dir wurden keine Daten bereitgestellt.");
- }
- else
- {
- sb.AppendLine("Du erhälst folgende Daten:");
+ // var sb = new StringBuilder();
- var parser = GetParser(aiDataContextType);
- var parsed = parser.Parse(actionType, context);
+ // sb.AppendLine(getCustomSystemPrompt());
+ // sb.AppendLine();
+ // sb.AppendLine();
+ // sb.AppendLine("---");
+ // sb.AppendLine();
+ // sb.AppendLine("### **Allgemein**");
+ // sb.AppendLine($"- Aktuelle Zeit: {DateTime.Now}");
+ // sb.AppendLine();
+ // sb.AppendLine("### **Ansicht**");
+ // sb.AppendLine($"- Ich befinde mich aktuell in der \"{Translations[actionType]}\" meiner Anwendung.");
+
+ // sb.AppendLine();
+ // sb.AppendLine("### **Daten**");
- sb.AppendLine(parsed);
- }
+ // if (context?.Context is null)
+ // {
+ // sb.AppendLine("Dir wurden keine Daten bereitgestellt.");
+ // }
+ // else
+ // {
+ // sb.AppendLine("Du erhälst folgende Daten:");
- return sb.ToString();
- }
+ // var parser = GetParser(aiDataContextType);
+ // var parsed = parser.Parse(actionType, context);
- private BaseContextSummaryParser GetParser(AiDataContextType aiDataContextType)
- {
- switch (aiDataContextType)
- {
- case AiDataContextType.json:
- return new JsonContextSummaryParser();
- case AiDataContextType.csv:
- return new CsvContextSummaryParser();
- case AiDataContextType.tsv:
- return new CsvContextSummaryParser("\t");
- case AiDataContextType.csv2:
- return new CsvContextSummaryParser(";", true);
- case AiDataContextType.tsv2:
- return new CsvContextSummaryParser("\t", true);
- default:
- break;
- }
+ // sb.AppendLine(parsed);
+ // }
- throw BeWoNotImplementedException.CreateFromEnum(aiDataContextType);
- }
- }
+ // return sb.ToString();
+ // }
+
+ // private BaseContextSummaryParser GetParser(AiDataContextType aiDataContextType)
+ // {
+ // switch (aiDataContextType)
+ // {
+ // case AiDataContextType.json:
+ // return new JsonContextSummaryParser();
+ // case AiDataContextType.csv:
+ // return new CsvContextSummaryParser();
+ // case AiDataContextType.tsv:
+ // return new CsvContextSummaryParser("\t");
+ // case AiDataContextType.csv2:
+ // return new CsvContextSummaryParser(";", true);
+ // case AiDataContextType.tsv2:
+ // return new CsvContextSummaryParser("\t", true);
+ // default:
+ // break;
+ // }
+
+ // throw BeWoNotImplementedException.CreateFromEnum(aiDataContextType);
+ // }
+ //}
}
\ No newline at end of file
diff --git a/Server/Components/AICore/Prompt/SystemPrompts/AiFunctionSystemPromptBuilder.cs b/Server/Components/AICore/Prompt/SystemPrompts/AiFunctionSystemPromptBuilder.cs
index 6ffb6a3c9..5b1c7dbec 100644
--- a/Server/Components/AICore/Prompt/SystemPrompts/AiFunctionSystemPromptBuilder.cs
+++ b/Server/Components/AICore/Prompt/SystemPrompts/AiFunctionSystemPromptBuilder.cs
@@ -3,6 +3,7 @@ using AICore.Context.Summary.Function;
using AICore.Context.SummaryParser;
using BS.Shared;
using BS.Shared.Core;
+using BS.Shared.DataContracts.Feature.AI;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
@@ -13,46 +14,53 @@ using System.Threading.Tasks;
namespace AICore.Prompt.SystemPrompts
{
- internal class AiFunctionSystemPromptBuilder : BaseSystemPromptBuilder
- {
- public AiFunctionSystemPromptBuilder(string prompt_path) : base(prompt_path)
- {
+ //internal class AiFunctionSystemPromptBuilder : BaseSystemPromptBuilder
+ //{
+ // public AiFunctionSystemPromptBuilder(string prompt_path) : base(prompt_path)
+ // {
- }
+ // }
- public string CreateServiceRecordDocumentationSystemPrompt(BaseContextSummary context)
- {
- var sb = new StringBuilder();
+ // public string CreateServiceRecordDocumentationSystemPrompt(AiViewContextDC view_context, BaseContextSummary context)
+ // {
+ // var sb = new StringBuilder();
- sb.AppendLine(getCustomSystemPrompt());
- sb.AppendLine();
- sb.AppendLine();
- sb.AppendLine("---");
- sb.AppendLine();
- sb.AppendLine("### **Allgemein**");
- sb.AppendLine($"- Aktuelle Zeit: {DateTime.Now}");
- sb.AppendLine();
- sb.AppendLine("### **Ansicht**");
- sb.AppendLine($"- Ich befinde mich aktuell in der \"Zeiterfassung\" meiner Anwendung.");
- sb.AppendLine($"- Es ist kein Filter gesetzt.");
- sb.AppendLine();
- sb.AppendLine("### **Daten**");
+ // sb.AppendLine(getCustomSystemPrompt());
+ // sb.AppendLine();
+ // sb.AppendLine();
+ // sb.AppendLine("---");
+ // sb.AppendLine();
+ // sb.AppendLine("### **Allgemein**");
+ // sb.AppendLine($"- Aktuelle Zeit: {DateTime.Now}");
+ // sb.AppendLine();
+ // sb.AppendLine("### **Ansicht**");
+ // sb.AppendLine($"- Ich befinde mich aktuell in der \"Zeiterfassung\" meiner Anwendung.");
+ // if(view_context.Filter is string filter_str)
+ // {
+ // sb.AppendLine($"- Es ist folgender Filter gesetzt: {filter_str}");
+ // }
+ // else
+ // {
+ // sb.AppendLine($"- Es ist kein Filter gesetzt.");
+ // }
+ // sb.AppendLine();
+ // sb.AppendLine("### **Daten**");
- if (context?.Context is null)
- {
- sb.AppendLine("Dir wurden keine Daten bereitgestellt.");
- }
- else
- {
- sb.AppendLine("Du erhälst folgende Daten:");
+ // if (context?.Context is null)
+ // {
+ // sb.AppendLine("Dir wurden keine Daten bereitgestellt.");
+ // }
+ // else
+ // {
+ // sb.AppendLine("Du erhälst folgende Daten:");
- var parser = new CsvContextSummaryParser();
- var parsed = parser.Parse(AiActionType.ServiceRecordDocumentation, context);
+ // var parser = new CsvContextSummaryParser();
+ // var parsed = parser.Parse(AiActionType.ServiceRecordDocumentation, context);
- sb.AppendLine(parsed);
- }
+ // sb.AppendLine(parsed);
+ // }
- return sb.ToString();
- }
- }
+ // return sb.ToString();
+ // }
+ //}
}
\ No newline at end of file
diff --git a/Server/Components/AICore/Prompt/SystemPrompts/AiGenericSystemPromptBuilder.cs b/Server/Components/AICore/Prompt/SystemPrompts/AiGenericSystemPromptBuilder.cs
new file mode 100644
index 000000000..33d88f498
--- /dev/null
+++ b/Server/Components/AICore/Prompt/SystemPrompts/AiGenericSystemPromptBuilder.cs
@@ -0,0 +1,57 @@
+using AICore.Context.Summary;
+using AICore.Context.SummaryParser;
+using BS.Shared.DataContracts.Feature.AI;
+using BS.Shared.Exceptions;
+using BS.Shared;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Runtime.Remoting.Messaging;
+
+namespace AICore.Prompt.SystemPrompts
+{
+ internal class AiGenericSystemPromptBuilder : BaseSystemPromptBuilder
+ {
+ public AiGenericSystemPromptBuilder(string prompt_path) : base(prompt_path)
+ {
+
+ }
+
+ public string CreateSystemPrompt(AiActionType actionType, AiViewContextDC view_context, BaseContextSummary context, AiDataContextType aiDataContextType)
+ {
+ var replace_dict = new Dictionary()
+ {
+ {"{AktuelleZeit}", DateTime.Now.ToString() },
+ {"{AktuellesModule}", Translations[actionType]},
+ {"{FilterEinstellungen}", getFilterString(view_context.Filter)},
+ {"{DatenBlock}", getContextBlock(actionType, context, aiDataContextType)}
+ };
+
+ return createSystemPrompt(replace_dict);
+ }
+
+ private string getFilterString(object filter)
+ {
+ if (filter is null)
+ return "Es ist kein Filter gesetzt.";
+
+ return $"Es ist folgender Filter gesetzt: {filter}";
+ }
+
+ private string getContextBlock(AiActionType actionType, BaseContextSummary context, AiDataContextType aiDataContextType)
+ {
+ if (context is null)
+ {
+ return "Dir wurden keine Daten bereitgestellt.";
+ }
+
+ var parser = getParser(aiDataContextType);
+ var parsed = parser.Parse(actionType, context);
+
+ return $"Du erhälst folgende Daten: {Environment.NewLine}"
+ + parsed;
+ }
+ }
+}
diff --git a/Server/Components/AICore/Prompt/SystemPrompts/BaseSystemPromptBuilder.cs b/Server/Components/AICore/Prompt/SystemPrompts/BaseSystemPromptBuilder.cs
index 759459afe..9768fcf70 100644
--- a/Server/Components/AICore/Prompt/SystemPrompts/BaseSystemPromptBuilder.cs
+++ b/Server/Components/AICore/Prompt/SystemPrompts/BaseSystemPromptBuilder.cs
@@ -1,4 +1,8 @@
-using BS.Shared;
+using AICore.Context.Summary;
+using AICore.Context.SummaryParser;
+using BS.Shared;
+using BS.Shared.DataContracts.Feature.AI;
+using BS.Shared.Exceptions;
using System;
using System.Collections.Generic;
using System.IO;
@@ -24,7 +28,45 @@ namespace AICore.Prompt.SystemPrompts
Path = path;
}
- protected string getCustomSystemPrompt()
+ protected string createSystemPrompt(Dictionary replace_dict)
+ {
+ var sb = new StringBuilder();
+
+ sb.AppendLine(getCustomSystemPrompt());
+
+ foreach (var kvp in replace_dict)
+ {
+ var key = kvp.Key;
+ var value = kvp.Value;
+
+ sb.Replace(key, value);
+ }
+
+ return sb.ToString();
+ }
+
+ protected BaseContextSummaryParser getParser(AiDataContextType aiDataContextType)
+ {
+ switch (aiDataContextType)
+ {
+ case AiDataContextType.json:
+ return new JsonContextSummaryParser();
+ case AiDataContextType.csv:
+ return new CsvContextSummaryParser();
+ case AiDataContextType.tsv:
+ return new CsvContextSummaryParser("\t");
+ case AiDataContextType.csv2:
+ return new CsvContextSummaryParser(";", true);
+ case AiDataContextType.tsv2:
+ return new CsvContextSummaryParser("\t", true);
+ default:
+ break;
+ }
+
+ throw BeWoNotImplementedException.CreateFromEnum(aiDataContextType);
+ }
+
+ private string getCustomSystemPrompt()
{
var path = Path;
return File.ReadAllText(path);
diff --git a/Service/Plugins/AiPromptbausteineService.cs b/Service/Plugins/AiPromptbausteineService.cs
index de4cc5e66..2e63a867d 100644
--- a/Service/Plugins/AiPromptbausteineService.cs
+++ b/Service/Plugins/AiPromptbausteineService.cs
@@ -29,16 +29,26 @@ namespace BeWo.Service.Plugins
public IEnumerable GetAiPromptbausteinFolder(AiActionType aiActionType)
{
+ var bib = PredefinedAiPromptbausteinFolders.CreateRootBibNode(aiActionType);
+
var own_bib = getOwnFolder(aiActionType);
var public_bib = getPublicFolders(aiActionType);
var ownsoft_bib = getOwnsoftFolder(aiActionType);
- var result = new List() {
- own_bib, public_bib
- };
+ bib.SubFolders.Add(own_bib);
+ bib.SubFolders.Add(public_bib);
- if(ownsoft_bib is object)
- result.Add(ownsoft_bib);
+ if (ownsoft_bib is object)
+ bib.SubFolders.Add(ownsoft_bib);
+
+ foreach(var folder in bib.SubFolders)
+ {
+ folder.ParentFolderOid = bib.ParentFolderOid;
+ }
+
+ var result = new List() {
+ bib
+ };
return result;
}
@@ -62,6 +72,8 @@ namespace BeWo.Service.Plugins
initOwnFolder(own_bib);
+ own_bib.CanEdit = false;
+
return own_bib;
}
diff --git a/Service/Plugins/AiService2.cs b/Service/Plugins/AiService2.cs
index facb4ecd1..c0fa9e329 100644
--- a/Service/Plugins/AiService2.cs
+++ b/Service/Plugins/AiService2.cs
@@ -397,7 +397,7 @@ namespace BeWo.Service.Plugins
var context_loaded = AiContextLoader.LoadContext(actionType, view_context, sampleCount);
var configPath = getPromptPath(actionType);
- var system_prompt = AiSystemPromptFactory.BuildContext(actionType, configPath, context_loaded, context_Type);
+ var system_prompt = AiSystemPromptFactory.BuildContext(actionType, configPath, view_context, context_loaded, context_Type);
var msg = new AiConversationMessage();
msg.Message = system_prompt;
diff --git a/Shared/DataContracts/Feature/AI/AiPromptbausteinFolderDC.cs b/Shared/DataContracts/Feature/AI/AiPromptbausteinFolderDC.cs
index 9fd31b498..b673467cb 100644
--- a/Shared/DataContracts/Feature/AI/AiPromptbausteinFolderDC.cs
+++ b/Shared/DataContracts/Feature/AI/AiPromptbausteinFolderDC.cs
@@ -50,112 +50,72 @@ namespace BS.Shared.DataContracts.Feature.AI
};
}
- public static AiPromptbausteinFolderDC CreateOwnBibNode(AiActionType aiActionType)
+ public static AiPromptbausteinFolderDC CreateRootBibNode(AiActionType aiActionType)
{
- return new AiPromptbausteinFolderDC()
- {
- ActionType = aiActionType,
- Description = AiPromptbausteineTexts.OwnBibNodeDescription,
- Oid = -1,
- ParentFolderOid = null,
- SubFolders = new List(),
- SubPrompts = new List(),
- SubRoutines = new List(),
- Title = AiPromptbausteineTexts.OwnBibNodeTitle,
- Version = 1,
- CanAddFolder = true,
- CanAddPrompt = true,
- CanAddRoutine = true,
- IsExpanded = true,
- };
+ var title = AiPromptbausteineTexts.RootBibNodeTitle;
+ var description = AiPromptbausteineTexts.RootBibNodeDescription;
+
+ var node = CreateNode(aiActionType, -51, title, description, null);
+
+ return node;
}
- //public static AiPromptbausteinFolderDC CreateSharedBibNode(AiActionType aiActionType)
- //{
- // return new AiPromptbausteinFolderDC()
- // {
- // ActionType = aiActionType,
- // Description = AiPromptbausteineTexts.SharedBibNodeDescription,
- // Oid = -2,
- // ParentFolderOid = null,
- // SubFolders = new List(),
- // SubPrompts = new List(),
- // Title = AiPromptbausteineTexts.SharedBibNodeTitle,
- // Version = 1,
- // IsExpanded = true,
- // IsNewFeature = true
- // };
- //}
+ public static AiPromptbausteinFolderDC CreateOwnBibNode(AiActionType aiActionType)
+ {
+ var title = AiPromptbausteineTexts.OwnBibNodeTitle;
+ var description = AiPromptbausteineTexts.OwnBibNodeDescription;
+
+ var node = CreateNode(aiActionType, -1, title, description, null);
+
+ node.CanAddFolder = true;
+ node.CanAddPrompt = true;
+ node.CanAddRoutine = true;
+
+ return node;
+ }
public static AiPromptbausteinFolderDC CreatePublicBibNode(AiActionType aiActionType)
{
- return new AiPromptbausteinFolderDC()
- {
- ActionType = aiActionType,
- Description = AiPromptbausteineTexts.PublicBibNodeDescription,
- Oid = -3,
- ParentFolderOid = null,
- SubFolders = new List(),
- SubPrompts = new List(),
- SubRoutines = new List(),
- Title = AiPromptbausteineTexts.PublicBibNodeTitle,
- Version = 1,
- IsExpanded = true
- };
+ var title = AiPromptbausteineTexts.PublicBibNodeTitle;
+ var description = AiPromptbausteineTexts.PublicBibNodeDescription;
+
+ var node = CreateNode(aiActionType, -3, title, description, null);
+
+ return node;
}
public static AiPromptbausteinFolderDC CreatePublicSharedBibNode(AiActionType aiActionType, string display)
{
- return new AiPromptbausteinFolderDC()
- {
- ActionType = aiActionType,
- Description = string.Format(AiPromptbausteineTexts.PublicSharedBibNodeDescription, display),
- Oid = -31,
- ParentFolderOid = null,
- SubFolders = new List(),
- SubPrompts = new List(),
- SubRoutines = new List(),
- Title = string.Format(AiPromptbausteineTexts.PublicSharedBibNodeTitle, display),
- Version = 1,
- IsExpanded = false
- };
+ var title = string.Format(AiPromptbausteineTexts.PublicSharedBibNodeTitle, display);
+ var description = string.Format(AiPromptbausteineTexts.PublicSharedBibNodeDescription, display);
+
+ var node = CreateNode(aiActionType, -31, title, description, null);
+
+ node.IsExpanded = false;
+
+ return node;
}
public static AiPromptbausteinFolderDC CreateOwnsoftBibNode(AiActionType aiActionType)
{
- return new AiPromptbausteinFolderDC()
- {
- ActionType = aiActionType,
- Description = AiPromptbausteineTexts.OwnsoftBibNodeDescription,
- Oid = -4,
- ParentFolderOid = null,
- SubFolders = new List(),
- SubPrompts = new List(),
- SubRoutines = new List(),
- Title = AiPromptbausteineTexts.OwnsoftBibNodeTitle,
- Version = 1,
- IsExpanded = true,
- IsNewFeature = false
- };
+ var title = AiPromptbausteineTexts.OwnsoftBibNodeTitle;
+ var description = AiPromptbausteineTexts.OwnsoftBibNodeDescription;
+
+ var node = CreateNode(aiActionType, -4, title, description, null);
+
+ return node;
}
public static AiPromptbausteinFolderDC CreateExampleNode(AiActionType aiActionType)
{
- return new AiPromptbausteinFolderDC()
- {
- ActionType = aiActionType,
- Description = "Beispielbeschreibung",
- Oid = -100,
- ParentFolderOid = null,
- SubFolders = new List(),
- SubPrompts = new List(),
- SubRoutines = new List(),
- Title = "Beispiel Ordner",
- Version = 1,
- CanAddFolder = true,
- CanAddPrompt = true,
- CanEdit = true
- };
+ var node = CreateNode(aiActionType, -100, "Beispiel Ordner", "Beispielbeschreibung", null);
+
+ node.CanAddFolder = true;
+ node.CanAddPrompt = true;
+ node.CanAddRoutine = true;
+ node.CanEdit = true;
+
+ return node;
}
public static AiPromptbausteinPromptDC CreateExamplePrompt(AiActionType aiActionType)
@@ -170,5 +130,26 @@ namespace BS.Shared.DataContracts.Feature.AI
OwnsoftRefLink = "https://help.bewoplaner.de/"
};
}
+
+ public static AiPromptbausteinFolderDC CreateNode(AiActionType aiActionType, long oid, string title, string description, long? parent_folder_oid)
+ {
+ return new AiPromptbausteinFolderDC()
+ {
+ ActionType = aiActionType,
+ Description = description,
+ Oid = oid,
+ ParentFolderOid = parent_folder_oid,
+ SubFolders = new List(),
+ SubPrompts = new List(),
+ SubRoutines = new List(),
+ Title = title,
+ Version = 1,
+ CanAddFolder = false,
+ CanAddPrompt = false,
+ CanAddRoutine = false,
+ CanEdit = false,
+ IsExpanded = true,
+ };
+ }
}
}
diff --git a/Shared/DataContracts/Feature/AI/AiViewContextDC.cs b/Shared/DataContracts/Feature/AI/AiViewContextDC.cs
index f5a23237e..70b5e18f3 100644
--- a/Shared/DataContracts/Feature/AI/AiViewContextDC.cs
+++ b/Shared/DataContracts/Feature/AI/AiViewContextDC.cs
@@ -16,6 +16,9 @@ namespace BS.Shared.DataContracts.Feature.AI
[DataMember]
public object Secondary { get; set; }
+ [DataMember]
+ public object Filter { get; set; }
+
[DataMember]
public Dictionary References { get; set; }
}
diff --git a/Shared/Text/AiPromptbausteineTexts.cs b/Shared/Text/AiPromptbausteineTexts.cs
index d68e170a9..bd0f73ecd 100644
--- a/Shared/Text/AiPromptbausteineTexts.cs
+++ b/Shared/Text/AiPromptbausteineTexts.cs
@@ -8,6 +8,8 @@ namespace BS.Shared.Text
{
public static class AiPromptbausteineTexts
{
+ public static string RootBibNodeTitle => "Bibliothek";
+ public static string RootBibNodeDescription => "Hier sehen Sie alle Prompts";
public static string OwnBibNodeTitle => "Eigene";
public static string OwnBibNodeDescription => "Hier können Sie Ihre eigenen Prompts verwalten";
public static string PublicBibNodeTitle => "Geteilt";