mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-22 10:55:00 +00:00
refactor: rewrite OpenAI integration
- use `OpenAI` and `Azure.AI.OpenAI` - use `developer` role instead of `system` for OpenAI's `o1` series models - use streaming response - re-design `AIAssistant` Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
cf90e51887
commit
a915708db3
12 changed files with 270 additions and 212 deletions
|
@ -10,7 +10,7 @@
|
|||
x:Name="ThisControl"
|
||||
Icon="/App.ico"
|
||||
Title="{DynamicResource Text.AIAssistant}"
|
||||
Width="400" SizeToContent="Height"
|
||||
Width="520" SizeToContent="Height"
|
||||
CanResize="False"
|
||||
WindowStartupLocation="CenterOwner">
|
||||
<Grid RowDefinitions="Auto,Auto,Auto">
|
||||
|
@ -36,18 +36,33 @@
|
|||
IsVisible="{OnPlatform True, macOS=False}"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Animated Icon -->
|
||||
<v:LoadingIcon Grid.Row="1"
|
||||
Width="24" Height="24"
|
||||
Margin="0,16,0,0"/>
|
||||
<!-- AI response -->
|
||||
<v:AIResponseView Grid.Row="1"
|
||||
x:Name="TxtResponse"
|
||||
Margin="8"
|
||||
Height="320"
|
||||
BorderThickness="1"
|
||||
BorderBrush="{DynamicResource Brush.Border2}"
|
||||
Background="{DynamicResource Brush.Contents}"/>
|
||||
|
||||
<!-- Message -->
|
||||
<TextBlock Grid.Row="2"
|
||||
x:Name="ProgressMessage"
|
||||
Margin="16"
|
||||
FontSize="{Binding Source={x:Static vm:Preferences.Instance}, Path=DefaultFontSize, Converter={x:Static c:DoubleConverters.Decrease}}"
|
||||
HorizontalAlignment="Center"
|
||||
Text="Generating commit message... Please wait!"
|
||||
TextTrimming="CharacterEllipsis"/>
|
||||
<!-- Options -->
|
||||
<Border Grid.Row="2" Margin="0,0,0,8">
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<v:LoadingIcon x:Name="IconInProgress" Width="14" Height="14" Margin="0,0,8,0"/>
|
||||
<Button Classes="flat"
|
||||
x:Name="BtnGenerateCommitMessage"
|
||||
Height="28"
|
||||
Margin="0,0,8,0"
|
||||
Padding="12,0"
|
||||
Content="{DynamicResource Text.AIAssistant.Use}"
|
||||
Click="OnGenerateCommitMessage"/>
|
||||
<Button Classes="flat"
|
||||
x:Name="BtnRegenerate"
|
||||
Height="28"
|
||||
Padding="12,0"
|
||||
Content="{DynamicResource Text.AIAssistant.Regen}"
|
||||
Click="OnRegen"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</v:ChromelessWindow>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue