Archived
forked from RDTKEditor/RDTKEditor
添加了 AI 助手接口
This commit is contained in:
+12
-1
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user