OpenAiChat with Prompt

This commit is contained in:
2026-02-03 14:25:02 +01:00
parent 8555311c4b
commit f98316cc66
5 changed files with 50 additions and 3 deletions

View File

@@ -147,7 +147,7 @@ namespace BeWo
{
DebugConfigMode = DebugConfigMode.FeatureAiModule,
AutoLogin = true,
SelectView = UIContext.Administration,
//SelectView = UIContext.Administration,
//SelectIndex = 8,
//DefaultLoginUsername = "m1",
//DefaultLoginPassword = "bewobewo",

View File

@@ -71,6 +71,7 @@
<dxe:ListBoxEdit
x:Name="listBoxEdit1"
Padding="4,16,4,16"
SelectionMode="Single"
ItemContainerStyle="{StaticResource PromptListBoxItem}"
ItemsSource="{Binding SelectedFolder.Prompts, UpdateSourceTrigger=PropertyChanged}"
SelectedItem="{Binding SelectedPrompt, Mode=TwoWay}">

View File

@@ -3327,7 +3327,8 @@
Margin="10,0,0,0"
Command="{Binding Path=OpenAiWindowCommand, RelativeSource={RelativeSource AncestorType={x:Type localView:BeWoView}}}"
Content="{StaticResource AiDesignsIconKIChatWeissOrange}"
Style="{StaticResource NavigationToolbarButtonStyle}" />
Style="{StaticResource NavigationToolbarButtonStyle}"
ToolTip="KI Chat öffnen"/>
<Image
Height="20"
Source="{Binding Source={x:Static draw:SystemIcons.Warning}, Converter={StaticResource IconToImageSourceConverter}, Mode=OneWay}"
@@ -3337,6 +3338,14 @@
Es können keine neuen Chats zu dieser Ansicht erstellt werden.
</Image.ToolTip>
</Image>
<Button x:Name="btnOpenAi5"
Height="30"
Margin="10,0,0,0"
Command="{Binding Path=OpenAiChatPromptWindowCommand, RelativeSource={RelativeSource AncestorType={x:Type localView:BeWoView}}}"
Style="{StaticResource NavigationToolbarButtonStyle}"
ToolTip="KI Chat mit Promptbaustein starten">
Prompt mit KI Chat
</Button>
</StackPanel>
<StackPanel
Grid.Column="2"

View File

@@ -53,6 +53,8 @@ using DependencyObject = System.Windows.DependencyObject;
using BeWo.View.Windows;
using BeWo.Core.Commands;
using BeWo.ViewModel.View.AI;
using BS.Shared.DataContracts.Feature.AI.Functions.ServiceRecords;
using System.Text;
namespace BeWo.View.Detail.Zeiterfassung
{
@@ -348,10 +350,12 @@ namespace BeWo.View.Detail.Zeiterfassung
Func<bool> canExecuteAi = () => supportConceptSelectionControl.SelectedItem.SupportConceptTreeNodeDC?.Customer is object;
OpenAiWindowCommand = CommandFactory.GetAiViewCommand(OpenAiWindow, UserRightType.AiModuleView, canExecuteAi);
OpenAiChatPromptWindowCommand = CommandFactory.GetAiViewCommand(OpenAiChatPromptWindow, UserRightType.AiModuleChatAdd, canExecuteAi);
}
}
public ICommand OpenAiWindowCommand { get; set; }
public ICommand OpenAiChatPromptWindowCommand { get; set; }
private void SrGridControl_ItemsSourceChanged(object sender, DevExpress.Xpf.Grid.ItemsSourceChangedEventArgs e)
{
@@ -5089,6 +5093,37 @@ namespace BeWo.View.Detail.Zeiterfassung
MainControl.WindowService.ShowAiConversationWindow(getAiConversationChatViewModel());
}
private void OpenAiChatPromptWindow()
{
var vm_chat = new AiPromptbausteinSelectionComplexViewModel(AiActionType.ServiceRecordConversation);
//var vm_doku = new AiPromptbausteinSelectionViewModel(AiActionType.ServiceRecordDocumentation);
vm_chat.PromptAccepted += PromptAccepted;
MainControl.WindowService.Show(vm_chat);
}
private void PromptAccepted(object sender, AiPromptbausteinPromptVM prompt)
{
if (prompt is null)
throw new NotImplementedException();
// 1. Information aufbereiten
// 1.1 Prompt
var prompt_oid = prompt.DataContract.Oid.Value;
var prompt_version = prompt.DataContract.Version;
// 1.2 Restliche Informationen
var vm = getAiConversationChatViewModel();
// 2 Validieren
// 3 Auswerten
vm.MessageInput = prompt.Prompt;
MainControl.WindowService.ShowAiConversationWindow(vm);
}
private IEnumerable<ServiceRecordVM> GetVisibleRecordVMs()
{
var list = new List<ServiceRecordVM>();

View File

@@ -68,6 +68,8 @@ namespace BeWo.ViewModel.View.AI
public ICommand OpenCloneCommand { get; set; }
public ICommand CloneCommand { get; set; }
public bool SendAfterLoaded { get; set; }
public AiConversationListVM ListVM { get; set; }
public ObservableCollection<AiModelDC> Models { get; set; }