diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj index 0c2476b66..b68a34656 100644 --- a/BeWo/BeWo.csproj +++ b/BeWo/BeWo.csproj @@ -97,6 +97,7 @@ + diff --git a/BeWo/BeWoApp.xaml b/BeWo/BeWoApp.xaml index 5f846a7c8..042c908b3 100644 --- a/BeWo/BeWoApp.xaml +++ b/BeWo/BeWoApp.xaml @@ -85,6 +85,7 @@ + diff --git a/BeWo/Converter/IconToImageSourceConverter.cs b/BeWo/Converter/IconToImageSourceConverter.cs new file mode 100644 index 000000000..e4c8e7445 --- /dev/null +++ b/BeWo/Converter/IconToImageSourceConverter.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Drawing; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using System.Windows.Interop; +using System.Windows.Media.Imaging; +using System.Windows; +using System.Windows.Media; + +namespace BeWo.Converter +{ + // Source - https://stackoverflow.com/a/29757845 + // Posted by run2thesun, modified by community. See post 'Timeline' for change history + // Retrieved 2026-01-30, License - CC BY-SA 3.0 + + public class IconToImageSourceConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var icon = value as Icon; + if (icon == null) + { + Trace.TraceWarning("Attempted to convert {0} instead of Icon object in IconToImageSourceConverter", value); + return null; + } + + ImageSource imageSource = Imaging.CreateBitmapSourceFromHIcon( + icon.Handle, + Int32Rect.Empty, + BitmapSizeOptions.FromEmptyOptions()); + return imageSource; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } + +} diff --git a/BeWo/View/Detail/AI/AiConversationChatView.xaml b/BeWo/View/Detail/AI/AiConversationChatView.xaml index 83255f772..31f9a14a5 100644 --- a/BeWo/View/Detail/AI/AiConversationChatView.xaml +++ b/BeWo/View/Detail/AI/AiConversationChatView.xaml @@ -306,10 +306,17 @@ - - Bitte formulieren Sie eine Frage, um einen neuen Chat zu beginnen. - Weitere Details erfahren Sie in der Hilfe - + + + Bitte formulieren Sie eine Frage, um einen neuen Chat zu beginnen. + + Weitere Details erfahren Sie in der Hilfe. + + (i) + + + + @@ -210,10 +210,10 @@ Style="{StaticResource ObjectEditGroupBox}"> --> diff --git a/BeWo/View/Detail/Zeiterfassung/ServiceRecordView2.xaml b/BeWo/View/Detail/Zeiterfassung/ServiceRecordView2.xaml index 3fc3c2ff7..cbe6dfa9a 100644 --- a/BeWo/View/Detail/Zeiterfassung/ServiceRecordView2.xaml +++ b/BeWo/View/Detail/Zeiterfassung/ServiceRecordView2.xaml @@ -5,6 +5,7 @@ xmlns:core="clr-namespace:BS.Shared.Core;assembly=BS.Shared" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:detail="clr-namespace:BeWo.View.Detail" + xmlns:draw="clr-namespace:System.Drawing;assembly=System.Drawing" xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars" xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" @@ -3327,6 +3328,15 @@ Command="{Binding Path=OpenAiWindowCommand, RelativeSource={RelativeSource AncestorType={x:Type localView:BeWoView}}}" Content="{StaticResource AiDesignsIconKIChatWeissOrange}" Style="{StaticResource NavigationToolbarButtonStyle}" /> + + + Die aktuelle Ansicht beinhaltet zu viele Daten. + Es können keine neuen Chats zu dieser Ansicht erstellt werden. + + - @@ -126,6 +125,7 @@ + diff --git a/Service/Plugins/AiFunctionService.cs b/Service/Plugins/AiFunctionService.cs index 6ee981e43..553ebe13a 100644 --- a/Service/Plugins/AiFunctionService.cs +++ b/Service/Plugins/AiFunctionService.cs @@ -15,11 +15,11 @@ using System.Threading.Tasks; using AICore.Prompt.SystemPrompts; using BeWo.Service.Core; using BS.Shared.Extensions.CustomInterfaces; -using AICore.Prompt.Core; using DevExpress.XtraCharts.Native; using System.IO; using BS.Shared.Interface; using System.Text.Json; +using BS.Shared.Core; namespace BeWo.Service.Plugins { diff --git a/Service/Plugins/AiService2.cs b/Service/Plugins/AiService2.cs index 1fd4d7d33..96056cb5c 100644 --- a/Service/Plugins/AiService2.cs +++ b/Service/Plugins/AiService2.cs @@ -8,7 +8,6 @@ using System.Net; using System.ServiceModel; using System.Text; using System.Web.Hosting; -using AICore.Prompt.Core; using AICore.Prompt.SystemPrompts; using BeWo.Data.Access; using BeWo.Data.Entities; diff --git a/Server/Components/AICore/Prompt/Core/AiUtils.cs b/Shared/Core/AiUtils.cs similarity index 76% rename from Server/Components/AICore/Prompt/Core/AiUtils.cs rename to Shared/Core/AiUtils.cs index 7e6a01bfa..a63ca42c3 100644 --- a/Server/Components/AICore/Prompt/Core/AiUtils.cs +++ b/Shared/Core/AiUtils.cs @@ -3,7 +3,7 @@ using BS.Shared.Interface.Feature.AICore; using System.Collections.Generic; using System.Linq; -namespace AICore.Prompt.Core +namespace BS.Shared.Core { public static class AiUtils { @@ -14,7 +14,9 @@ namespace AICore.Prompt.Core public static void CheckTokenSize(IEnumerable messages, string modelName, int max_context_size) { - var buffer = 500; + var max_tokens_perc = 90.0d; + + var buffer_tokens_fix = 500; if (max_context_size < 0) return; @@ -23,13 +25,13 @@ namespace AICore.Prompt.Core var prev_tokens = CalculateTokensByModel(messages, modelName); - var calc_tokens = prev_tokens + buffer; + var calc_tokens = prev_tokens + buffer_tokens_fix; var percentage = (double)calc_tokens * 100 / max_tokens; - if (calc_tokens > max_tokens) + if (percentage > max_tokens_perc) { - var msg = $"Windowsize exceeded: ({prev_tokens}+{buffer})/{max_tokens} ({percentage}%)"; + var msg = $"Windowsize exceeded: ({prev_tokens}+{buffer_tokens_fix})/{max_tokens} ({percentage}%>{max_tokens_perc}%)"; throw new BeWoNotImplementedException(msg); } } diff --git a/Shared/Shared.csproj b/Shared/Shared.csproj index 9ea6f2b54..62c37fea9 100644 --- a/Shared/Shared.csproj +++ b/Shared/Shared.csproj @@ -139,6 +139,7 @@ +