Wahndreieck + link in conversation
This commit is contained in:
@@ -97,6 +97,7 @@
|
||||
<Compile Include="BeWoAppInfo.cs" />
|
||||
<Compile Include="Converter\AddressToStringConverter.cs" />
|
||||
<Compile Include="Converter\ComparisonConverter.cs" />
|
||||
<Compile Include="Converter\IconToImageSourceConverter.cs" />
|
||||
<Compile Include="Converter\NewlineConverter.cs" />
|
||||
<Compile Include="Core\BeWoAppVersion.cs" />
|
||||
<Compile Include="Core\Commands\CommandFactory.cs" />
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
<conv:NewlineConverter x:Key="NewlineConverter" />
|
||||
<conv:AddressToStringConverter x:Key="AddressToStringConverter" />
|
||||
<conv:ComparisonConverter x:Key="ComparisonConverter" />
|
||||
<conv:IconToImageSourceConverter x:Key="IconToImageSourceConverter" />
|
||||
|
||||
<conv:ValidationConverter x:Key="ValidationConverter" />
|
||||
<conv:ValueConverterGroup x:Key="Validation2BrushConverter">
|
||||
|
||||
45
BeWo/Converter/IconToImageSourceConverter.cs
Normal file
45
BeWo/Converter/IconToImageSourceConverter.cs
Normal file
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -306,10 +306,17 @@
|
||||
<Binding Converter="{StaticResource UserPermission2BoolConverter}" ConverterParameter="{x:Static shared:UserRightType.AiModuleChatAdd}" />
|
||||
</MultiBinding>
|
||||
</Grid.Visibility>
|
||||
<TextBlock Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
Bitte formulieren Sie eine Frage, um einen neuen Chat zu beginnen. <LineBreak/>
|
||||
Weitere Details erfahren Sie in der Hilfe
|
||||
</TextBlock>
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" >
|
||||
<TextBlock FontSize="12" FontWeight="Medium">
|
||||
Bitte formulieren Sie eine Frage, um einen neuen Chat zu beginnen.
|
||||
<LineBreak/>
|
||||
Weitere Details erfahren Sie in der Hilfe.
|
||||
<Hyperlink NavigateUri="https://help.bewoplaner.de" RequestNavigate="Hyperlink_RequestNavigate">
|
||||
(i)
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
|
||||
<TextBox
|
||||
x:Name="txt_input_message2"
|
||||
Grid.Row="1"
|
||||
|
||||
@@ -160,5 +160,11 @@ namespace BeWo.View.Detail.AI
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
|
||||
{
|
||||
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
BorderThickness="0"
|
||||
Cursor="Arrow"
|
||||
Focusable="False"
|
||||
FontWeight="Medium"
|
||||
FontWeight="{Binding FontWeight, UpdateSourceTrigger=PropertyChanged}"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding Path=Title, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
|
||||
ToolTipService.ShowDuration="100000">
|
||||
@@ -210,10 +210,10 @@ Style="{StaticResource ObjectEditGroupBox}">
|
||||
</Grid>
|
||||
</GroupBox>-->
|
||||
<Button
|
||||
Grid.Row="1"
|
||||
Grid.Row="1"
|
||||
Grid.ColumnSpan="3"
|
||||
Command="{Binding SendCommand}"
|
||||
Style="{StaticResource PrimaryButton}">
|
||||
Command="{Binding SendCommand}"
|
||||
Style="{StaticResource PrimaryButton}">
|
||||
Absenden
|
||||
</Button>
|
||||
</Grid>
|
||||
|
||||
@@ -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}" />
|
||||
<Image
|
||||
Height="20"
|
||||
Source="{Binding Source={x:Static draw:SystemIcons.Warning}, Converter={StaticResource IconToImageSourceConverter}, Mode=OneWay}"
|
||||
Visibility="{Binding ElementName=btnOpenAi4, Path=Visibility}">
|
||||
<Image.ToolTip>
|
||||
Die aktuelle Ansicht beinhaltet zu viele Daten.
|
||||
Es können keine neuen Chats zu dieser Ansicht erstellt werden.
|
||||
</Image.ToolTip>
|
||||
</Image>
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
Grid.Column="2"
|
||||
|
||||
@@ -110,7 +110,6 @@
|
||||
<Compile Include="Facade\LLM\OllamaApiClient.cs" />
|
||||
<Compile Include="Facade\LLM\OpenWebApiClient.cs" />
|
||||
<Compile Include="Prompt\SystemPrompts\AiFunctionSystemPromptBuilder.cs" />
|
||||
<Compile Include="Prompt\Core\AiUtils.cs" />
|
||||
<Compile Include="Prompt\SystemPrompts\AiConversationSystemPromptBuilder.cs" />
|
||||
<Compile Include="Prompt\Models\AiConversationContext.cs" />
|
||||
<Compile Include="Prompt\SystemPrompts\BaseSystemPromptBuilder.cs" />
|
||||
@@ -126,6 +125,7 @@
|
||||
<EmbeddedResource Include="Prompt\SystemPrompts\Examples\system_prompt3.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Prompt\Core\" />
|
||||
<Folder Include="Prompt\Factories\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<string> 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);
|
||||
}
|
||||
}
|
||||
@@ -139,6 +139,7 @@
|
||||
<Compile Include="AppSender\ApiSender.cs" />
|
||||
<Compile Include="AppSender\GkvSender.cs" />
|
||||
<Compile Include="BeWoEntityEnums.cs" />
|
||||
<Compile Include="Core\AiUtils.cs" />
|
||||
<Compile Include="Core\ApiResponseUtils.cs" />
|
||||
<Compile Include="Core\AppError.cs" />
|
||||
<Compile Include="Core\AppSettingReader.cs" />
|
||||
|
||||
Reference in New Issue
Block a user