实现第一个输出beat左对齐

This commit is contained in:
2025-04-24 21:05:14 +08:00
parent 65dc344f79
commit 6cb66cde36
4 changed files with 67 additions and 23 deletions
+2 -2
View File
@@ -12,10 +12,10 @@ namespace RDTKEditor.AIAssistant
{
public class Assistant
{
public const string Deepseek = "deepseek-r1:8b";
public const string Deepseek = "deepseek-r1:14b";
public const string Smollm = "smollm2:135m";
public const string Qwen_0_5 = "qwen2.5-coder:0.5b";
public const string Qwen_3 = "qwen2.5-coder:3b";
public const string Qwen_3 = "qwen2.5-coder:7b";
public OllamaApiClient Ollama { get; } = new(baseUri: new Uri("http://127.0.0.1:11434/api"));
public Chat Chat { get; }
public Assistant(string modelName)
+18 -5
View File
@@ -15,6 +15,7 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Menu Grid.Row="0" VerticalAlignment="Top">
<MenuItem Header="文件(_F)">
<MenuItem Header="打开文件(_O)" Click="OpenFile" InputGestureText="Ctrl+O"/>
@@ -42,7 +43,7 @@
<Border Grid.Column="0" Background="LightBlue">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<ItemsControl x:Name="ItemProperties" Background="LightGray">
<ComboBox Width="120" Height="21" BorderBrush="#FFDF4444" Foreground="#FFC65E5E" RenderTransformOrigin="0.5,0.5">
<ComboBox Grid.Row="0" BorderBrush="#FFDF4444" Foreground="#FFC65E5E" RenderTransformOrigin="0.5,0.5">
<ComboBox.RenderTransform>
<TransformGroup>
<ScaleTransform/>
@@ -60,7 +61,7 @@
<ComboBoxItem Content="选项 1" />
<ComboBoxItem Content="选项 2" />
</ComboBox>
<Label Content="Label" Height="28" Width="112" RenderTransformOrigin="0.5,0.5">
<Label Grid.Row="1" Content="Label" RenderTransformOrigin="0.5,0.5">
<Label.RenderTransform>
<TransformGroup>
<ScaleTransform/>
@@ -70,7 +71,7 @@
</TransformGroup>
</Label.RenderTransform>
</Label>
<ListView Height="65" Width="192" d:ItemsSource="{d:SampleData ItemCount=5}">
<ListView Grid.Row="3" d:ItemsSource="{d:SampleData ItemCount=3}">
<ListView.View>
<GridView>
<GridViewColumn/>
@@ -89,12 +90,24 @@
<GridSplitter Grid.Column="3" Width="5" Background="Gray" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
<Border Grid.Column="4" Background="LightBlue" >
<ScrollViewer VerticalScrollBarVisibility="Auto">
<Grid x:Name="timelineCanvas3" Background="LightGray" />
<Grid x:Name="timelineCanvas3" Background="LightGray" >
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="20" />
</Grid.RowDefinitions>
<TextBox Grid.Row="0" x:Name="AIAssistantText" TextWrapping="Wrap" >
AI问答
</TextBox>
<Button Grid.Row="1" x:Name="AIButton" VerticalAlignment="Bottom" Click="AIAssistantButton_Click" IsEnabled="{Binding IsButtonEnabled}" >
点击按钮开发
</Button>
</Grid>
</ScrollViewer>
</Border>
<GridSplitter Grid.Row="1" Grid.ColumnSpan="5" Height="5" Background="Gray" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
<Border Grid.ColumnSpan="5" Grid.Row="2" Background="LightSalmon">
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" x:Name="SlV">
<ScrollViewer x:Name="timelineScrollviewer" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" >
<Canvas x:Name="timelineCanvas" Background="LightGray" >
</Canvas>
</ScrollViewer>
+44 -13
View File
@@ -2,6 +2,7 @@
using Ollama;
using RDTKEditor.AIAssistant;
using RDTKEditor.Models;
using RhythmBase.Components;
using RhythmBase.Events;
using SkiaSharp;
using SkiaSharp.Views.Desktop;
@@ -9,6 +10,7 @@ using System.ComponentModel;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;
namespace RDTKEditor
@@ -21,11 +23,32 @@ namespace RDTKEditor
private Assistant Assistant = new(Assistant.Qwen_3);
private SKSizeI _vsScale = new(1600,900);
private readonly RDTKView viewModel = new();
/*public MainWindow()
public MainWindow()
{
InitializeComponent();
SlV.Content = "Button";
}*/
viewModel.Level = RDLevel.Default;
viewModel.Level.Add(new Comment() { Beat = new RDBeat(1,2.33f) });
foreach (var item in viewModel.Level)
{
var time = item.Beat.BeatOnly;
Label label = new();
label.Content = time;
label.Background = new SolidColorBrush(Colors.Red);
if (time < 2)
{
label.Margin = new Thickness(0, 0, 0, 0);
}else
{
label.Margin = new Thickness(time*10, 0, 0, 0);
}
timelineCanvas.Children.Add(label);
}
}
private void OpenFile(object sender, RoutedEventArgs e)
{
OpenFileDialog openFileDialog = new()
@@ -109,7 +132,8 @@ namespace RDTKEditor
Type = RDPropertyType.String,
};
}
internal void OnUpdateEventProperties(RDTKProperty[] properties)
private readonly List<BaseEvent> selectedEvents = new();
internal void OnUpdateEventProperties(RDTKProperty[] properties)
{
ItemProperties.Items.Clear();
foreach (var property in properties)
@@ -261,6 +285,10 @@ namespace RDTKEditor
IsStroke = true,
});
}
private void CheckBox_Checked(object sender, RoutedEventArgs e)
{
MessageBox.Show("已确认");
}
private async void AIAssistantButton_Click(object sender, RoutedEventArgs e)
{
@@ -271,20 +299,23 @@ namespace RDTKEditor
AIAssistantText.Text = responce.Content;
}
}
public class MainViewModel : INotifyPropertyChanged
private void CheckBox_Checked(object sender, RoutedEventArgs e)
{
MessageBox.Show("已确认");
}
}
public class MainViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
}
private bool _isButtonEnabled = true;
public bool IsButtonEnabled
{
get => _isButtonEnabled;
set
{
_isButtonEnabled = value;
}
}
}
+1 -1
View File
@@ -91,7 +91,7 @@ namespace RDTKEditor.Models
internal class RDTKView
{
private RDLevel? Level { get; set; }
public RDLevel? Level { get; set; }
public RDTKView()
{
}