添加了 AI 助手接口

This commit is contained in:
OLDREDSTONE
2025-04-14 11:15:40 +08:00
parent 8305c5b3d6
commit a7210e527e
4 changed files with 124 additions and 3 deletions
+12 -1
View File
@@ -1,10 +1,11 @@
using Microsoft.Win32;
using Ollama;
using RDTKEditor.AIAssistant;
using RDTKEditor.Models;
using RhythmBase.Events;
using SkiaSharp;
using SkiaSharp.Views.Desktop;
using System.ComponentModel;
using System.Diagnostics;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
@@ -17,6 +18,7 @@ namespace RDTKEditor
/// </summary>
public partial class MainWindow : Window
{
private Assistant Assistant = new(Assistant.Qwen_3);
private SKSizeI _vsScale = new(1600,900);
private readonly RDTKView viewModel = new();
public MainWindow()
@@ -282,6 +284,15 @@ namespace RDTKEditor
IsStroke = true,
});
}
private async void AIAssistantButton_Click(object sender, RoutedEventArgs e)
{
string input = AIAssistantText.Text;
if (string.IsNullOrEmpty(input))
return;
Message responce = await Assistant.Chat.SendAsync(input);
AIAssistantText.Text = responce.Content;
}
}
public class MainViewModel : INotifyPropertyChanged
{