diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj index 3168b7ccb..b01b12908 100644 --- a/BeWo/BeWo.csproj +++ b/BeWo/BeWo.csproj @@ -99,6 +99,9 @@ AiConfigView.xaml + + AiConversationChatModalPopup.xaml + AnimatedBeWoWindow.xaml @@ -107,6 +110,10 @@ Designer MSBuild:Compile + + MSBuild:Compile + Designer + Designer MSBuild:Compile @@ -439,7 +446,7 @@ Designer MSBuild:Compile - + Designer MSBuild:Compile @@ -1374,7 +1381,7 @@ SoziotherapieSettingsView.xaml - + AiConversationChatView.xaml diff --git a/BeWo/BeWoApp.xaml b/BeWo/BeWoApp.xaml index 469b9f71c..675292e16 100644 --- a/BeWo/BeWoApp.xaml +++ b/BeWo/BeWoApp.xaml @@ -608,11 +608,11 @@ Grid.ColumnSpan="2" Padding="5,5,5,5" HorizontalAlignment="Stretch" - VerticalAlignment="Stretch"> + VerticalAlignment="Stretch"> = 0) + { + abc.Close(); + } } MainControl.HideCurrentModalViewWindows(); diff --git a/BeWo/MainControl.xaml.cs b/BeWo/MainControl.xaml.cs index 4c1b94fa7..27cd6d357 100644 --- a/BeWo/MainControl.xaml.cs +++ b/BeWo/MainControl.xaml.cs @@ -25,6 +25,7 @@ using BeWo.View.Detail.Zeiterfassung; using BeWo.View.Document; using BeWo.View.Master; using BeWo.View.Navigation; +using BeWo.View.Windows; using BeWo.ViewModel; using BS.Shared; @@ -177,6 +178,8 @@ namespace BeWo UpdateMandator(); } + public AnimatedBeWoWindow CurrentAnimatedBeWoWindow { get; set; } + public List OpenedModalViewWindows { get; set; } internal Dictionary Views @@ -464,6 +467,16 @@ namespace BeWo } } + public void ShowViewAsModalPopup(string title, Control control, HorizontalAlignment horizontalAlignment = HorizontalAlignment.Center, VerticalAlignment verticalAlignment = VerticalAlignment.Center) + { + var groupbox = new GroupBox(); + + groupbox.Header = title; + groupbox.Content = control; + + ShowControlAsModalPopup(groupbox, horizontalAlignment, verticalAlignment); + } + public void ShowControlAsModalPopup(Control control) { ShowControlAsModalPopup(control, HorizontalAlignment.Center, VerticalAlignment.Center); @@ -491,7 +504,7 @@ namespace BeWo Grid.SetColumnSpan(control, 3); Grid.SetRowSpan(control, 3); grid_main.Children.Add(control); - Panel.SetZIndex(control, int.MaxValue); + Panel.SetZIndex(control, 1000); }); } @@ -928,7 +941,7 @@ namespace BeWo grid_main.Children.Add(ModalPopupBackGround); - Panel.SetZIndex(ModalPopupBackGround, int.MaxValue); + Panel.SetZIndex(ModalPopupBackGround, 500); } private void logoutanimation_Completed(object sender, EventArgs e) diff --git a/BeWo/ServiceProxy/ServiceFacade.cs b/BeWo/ServiceProxy/ServiceFacade.cs index 4b769f0d8..0bee0e2c3 100644 --- a/BeWo/ServiceProxy/ServiceFacade.cs +++ b/BeWo/ServiceProxy/ServiceFacade.cs @@ -1007,10 +1007,10 @@ namespace BeWo.ServiceProxy Monitor.Enter(_Lock); if ((++_RunningAsyncs) == 1 && BeWoApp.MainControl != null) { - if (BeWoApp.CurrentAnimatedBeWoWindow is null) + if (BeWoApp.MainControl.CurrentAnimatedBeWoWindow is null) BeWoApp.MainControl.StartWaiting(); else - BeWoApp.CurrentAnimatedBeWoWindow.StartWaiting(); + BeWoApp.MainControl.CurrentAnimatedBeWoWindow.StartWaiting(); } Monitor.Exit(_Lock); @@ -1021,7 +1021,7 @@ namespace BeWo.ServiceProxy Monitor.Enter(_Lock); if ((--_RunningAsyncs) == 0 && BeWoApp.MainControl != null) { - BeWoApp.CurrentAnimatedBeWoWindow?.EndWaiting(); + BeWoApp.MainControl.CurrentAnimatedBeWoWindow?.EndWaiting(); BeWoApp.MainControl.EndWaiting(); } diff --git a/BeWo/Styles/ModernOrangeBlack.xaml b/BeWo/Styles/ModernOrangeBlack.xaml index 94aeabb63..fc4ec3142 100644 --- a/BeWo/Styles/ModernOrangeBlack.xaml +++ b/BeWo/Styles/ModernOrangeBlack.xaml @@ -3,7 +3,8 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:controls="clr-namespace:BeWo.Controls;assembly=BeWo.Controls" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" - xmlns:uc="clr-namespace:BeWo.View.Controls" xmlns:templateselectors="clr-namespace:BeWo.View.TemplateSelectors"> + xmlns:templateselectors="clr-namespace:BeWo.View.TemplateSelectors" + xmlns:uc="clr-namespace:BeWo.View.Controls"> @@ -43,6 +44,6 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/BeWo/View/Detail/AI/AiConfigView.xaml b/BeWo/View/Detail/AI/AiConfigView.xaml index 66fc52f9b..55d58ea29 100644 --- a/BeWo/View/Detail/AI/AiConfigView.xaml +++ b/BeWo/View/Detail/AI/AiConfigView.xaml @@ -21,6 +21,7 @@ + diff --git a/BeWo/View/Detail/AI/AiConversationChatModalPopup.xaml b/BeWo/View/Detail/AI/AiConversationChatModalPopup.xaml new file mode 100644 index 000000000..a07150df8 --- /dev/null +++ b/BeWo/View/Detail/AI/AiConversationChatModalPopup.xaml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/BeWo/View/Detail/AI/AiConversationChatModalPopup.xaml.cs b/BeWo/View/Detail/AI/AiConversationChatModalPopup.xaml.cs new file mode 100644 index 000000000..a37d766ff --- /dev/null +++ b/BeWo/View/Detail/AI/AiConversationChatModalPopup.xaml.cs @@ -0,0 +1,39 @@ +using BeWo.ServiceProxy; +using BeWo.ViewModel.ListViewModel; +using BS.Shared.Extensions; +using DevExpress.Mvvm; +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BeWo.View.Detail.AI +{ + /// + /// Interaktionslogik für AiConversationChatView.xaml + /// + public partial class AiConversationChatModalPopup : BeWoView + { + public AiConversationChatModalPopup() + { + InitializeComponent(); + } + + public AiConversationListVM ViewModel + { + get => DataContext as AiConversationListVM; + } + } +} diff --git a/BeWo/View/Detail/AiConversationChatView.xaml b/BeWo/View/Detail/AI/AiConversationChatView.xaml similarity index 83% rename from BeWo/View/Detail/AiConversationChatView.xaml rename to BeWo/View/Detail/AI/AiConversationChatView.xaml index bcddd98bc..8ed084a04 100644 --- a/BeWo/View/Detail/AiConversationChatView.xaml +++ b/BeWo/View/Detail/AI/AiConversationChatView.xaml @@ -1,5 +1,5 @@  - + @@ -129,45 +129,20 @@ + + + + + + + - - - - - - - - - + + + + GetVisibleRecordVMs() { var list = new List(); diff --git a/BeWo/View/Windows/AnimatedBeWoWindow.xaml b/BeWo/View/Windows/AnimatedBeWoWindow.xaml index c45c4b77f..aed1982a1 100644 --- a/BeWo/View/Windows/AnimatedBeWoWindow.xaml +++ b/BeWo/View/Windows/AnimatedBeWoWindow.xaml @@ -11,6 +11,7 @@ Closing="Window_Closing" ResizeMode="CanResizeWithGrip" SnapsToDevicePixels="True" + TextOptions.TextFormattingMode="Display" WindowStartupLocation="CenterOwner" WindowStyle="None"> diff --git a/BeWo/View/Windows/AnimatedBeWoWindow.xaml.cs b/BeWo/View/Windows/AnimatedBeWoWindow.xaml.cs index 03eb6efd3..c1f9055e3 100644 --- a/BeWo/View/Windows/AnimatedBeWoWindow.xaml.cs +++ b/BeWo/View/Windows/AnimatedBeWoWindow.xaml.cs @@ -24,6 +24,7 @@ namespace BeWo.View.Windows public partial class AnimatedBeWoWindow : Window { private bool closeStoryBoardCompleted = false; + private bool isClosing = false; private WaitLayer2 _WaitLayer; private object _GroupBoxContent; @@ -48,9 +49,9 @@ namespace BeWo.View.Windows StartWaiting(); - if (BeWoApp.CurrentAnimatedBeWoWindow == null) + if (BeWoApp.MainControl.CurrentAnimatedBeWoWindow == null) { - BeWoApp.CurrentAnimatedBeWoWindow = this; + BeWoApp.MainControl.CurrentAnimatedBeWoWindow = this; } else { @@ -70,11 +71,13 @@ namespace BeWo.View.Windows public void Window_Closing(object sender, CancelEventArgs e) { - if (!closeStoryBoardCompleted) + if (!closeStoryBoardCompleted && !isClosing) { - if (BeWoApp.CurrentAnimatedBeWoWindow == this) + isClosing = true; + + if (BeWoApp.MainControl.CurrentAnimatedBeWoWindow == this) { - BeWoApp.CurrentAnimatedBeWoWindow = null; + BeWoApp.MainControl.CurrentAnimatedBeWoWindow = null; } else { @@ -99,7 +102,8 @@ namespace BeWo.View.Windows private void closeStoryBoard_Completed(object sender, EventArgs e) { closeStoryBoardCompleted = true; - + isClosing = false; + Close(); } diff --git a/Service/ServiceImplementations/OperationsEnhancedServiceImp.cs b/Service/ServiceImplementations/OperationsEnhancedServiceImp.cs index b3807de90..c48a6ace6 100644 --- a/Service/ServiceImplementations/OperationsEnhancedServiceImp.cs +++ b/Service/ServiceImplementations/OperationsEnhancedServiceImp.cs @@ -134,6 +134,7 @@ namespace BeWo.Service.ServiceImplementations var config = GetAiConfig(); // Send Request, wait for Response + var dt_before_request = DateTime.Now; var result = ServiceFacade.OpenWebUI.SendAiMessageRequest(conv_dc, config, out var model, out var duration); // Antwort @@ -141,7 +142,7 @@ namespace BeWo.Service.ServiceImplementations assi_msg.Message = result; assi_msg.AiConversation = conv; assi_msg.Role = BS.Shared.AiConversationMessageRole.Assistent; - assi_msg.Created = DateTime.Now; + assi_msg.Created = dt_before_request; assi_msg.Duration = duration ?? 0; assi_msg.ModelName = model; diff --git a/Service/ServiceProxy/OpenWebUIFacade.cs b/Service/ServiceProxy/OpenWebUIFacade.cs index b0bd8a6db..09cbcf332 100644 --- a/Service/ServiceProxy/OpenWebUIFacade.cs +++ b/Service/ServiceProxy/OpenWebUIFacade.cs @@ -46,13 +46,8 @@ namespace BeWo.Service.ServiceProxy var payload = new { - model = conversation.Modell.ModelName, - messages = conversation.Messages.Select(m => new { role = m.Role.ToString().ToLower(), content = m.Message }), - options = new - { - temperature = config.Temperature, - num_predict = config.Max_Gen_Len - } + model = config.SelectedModel.ModelName, + messages = conversation.Messages.Select(m => new { role = m.Role.ToString().ToLower(), content = m.Message }) }; //var requestData = JsonConvert.SerializeObject(payload);