Files
LehrerApp/LehrerApp.Desktop/Views/Groups/AiAssistDialog.axaml.cs
T
adminandClaude Sonnet 5 f703fe7b66 KI-Feature 4.5.20: Medienvorschlag + Zwischenablage-Prompt für externe Erzeugung
Die KI liefert je Verlaufsplan-Phase optional einen kurzen Vorschlag, was ein
Medium/Material (z.B. Tafelbild) zeigen sollte (AiPhaseStep.MaterialSuggestion),
nur wenn das über das ohnehin genannte Material hinaus einen Mehrwert hätte.
Bewusst nicht ins Domänenmodell übernommen (keine Migration nötig) — nur für
die Review-Anzeige relevant.

AiPlanningService.BuildMaterialPrompt baut daraus rein lokal (kein weiterer
KI-Aufruf) einen vollständigen Prompt aus Fach/Stufe/Gruppe, Einheit, Stunde
und Phase. Im AiAssistDialog landet er per Klick in der Zwischenablage, zum
Einfügen in eine separate Claude-Sitzung für die eigentliche Materialerzeugung.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-16 21:22:12 +02:00

45 lines
1.4 KiB
C#

using Avalonia.Controls;
using Avalonia.Input.Platform;
using Avalonia.Interactivity;
using LehrerApp.Desktop.Services;
using LehrerApp.Desktop.ViewModels.Groups;
using Microsoft.Extensions.DependencyInjection;
namespace LehrerApp.Desktop.Views.Groups;
public partial class AiAssistDialog : Window
{
public AiAssistDialog() => InitializeComponent();
private async void OnCopyMaterialPrompt(object? s, RoutedEventArgs e)
{
if (s is not Button { DataContext: MaterialPromptItem item }) return;
var clipboard = TopLevel.GetTopLevel(this)?.Clipboard;
if (clipboard is null) return;
await clipboard.SetTextAsync(item.PromptText);
App.Services.GetRequiredService<NotificationService>().ShowSuccess("Prompt in die Zwischenablage kopiert.");
}
private async void OnSend(object? s, RoutedEventArgs e)
{
if (DataContext is AiAssistDialogViewModel vm && vm.SendCommand.CanExecute(null))
await vm.SendCommand.ExecuteAsync(null);
}
private void OnApply(object? s, RoutedEventArgs e)
{
if (DataContext is AiAssistDialogViewModel vm && vm.ApplyCommand.CanExecute(null))
{
vm.ApplyCommand.Execute(null);
Close(true);
}
}
private void OnCancel(object? s, RoutedEventArgs e)
{
if (DataContext is AiAssistDialogViewModel vm) vm.CancelCommand.Execute(null);
Close(false);
}
}