Compare commits

...

2 Commits

Author SHA1 Message Date
lihanbo 735fbfb83d 优化渲染逻辑和界面布局
在 `MarkdownWpfRenderer.cs` 中,更新了 `RenderHtmlBlock` 方法以处理以 `<think>` 开头的文本,返回包含进度条和可选择文本块的 `Expander` 控件。更新了 `App.xaml`,移除了 `mu:ThemeDictionary` 的 `ColorMode` 属性。修改了 `AiMessageControll.xaml`,将布局从 `StackPanel` 更改为 `DockPanel`,并添加了 `ButtonGroup`。在 `ImportViewModel.cs` 中,调整了调试模式下的消息处理逻辑,确保正确处理用户输入的消息。
2025-03-05 09:41:15 +08:00
lihanbo 0ab9b35fde 删除回答格式说明,调整用户交互逻辑
删除了关于如何在<思考>和<回答>标签中提供用户问题解答的说明。这一变更可能会影响代码的逻辑和输出格式,从而改变用户的交互方式。
2025-03-05 09:24:17 +08:00
5 changed files with 41 additions and 35 deletions

View File

@ -379,7 +379,6 @@ public class MarkdownWpfRenderer
if (text.StartsWith("<think>"))
{
text = text.Replace("<think>", "").Replace("</think>", "");
}
var htmlText = new SelectableTextBlock();
htmlText.Text = text;
var expander = new Expander();
@ -388,6 +387,14 @@ public class MarkdownWpfRenderer
expander.Header = header;
expander.Content = htmlText;
return expander;
}
else
{
var htmlText = new SelectableTextBlock();
htmlText.Text = text;
return htmlText;
}
}
public FrameworkElement RenderMathBlock(MathBlock mathBlock, CancellationToken cancellationToken)

View File

@ -50,17 +50,6 @@ class PromptUtil
5. 使
<><>
<think>
[在此详细说明你的思考过程]
</think>
[在此给出你的回答]
";
}
}

View File

@ -12,7 +12,7 @@
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml" />
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml" />
<mu:ControlsDictionary />
<mu:ThemeDictionary ColorMode="Light" />
<mu:ThemeDictionary />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

View File

@ -88,6 +88,15 @@
</TabItem>
</TabControl>
<DockPanel>
<hc:ButtonGroup Margin="5,0">
<Button
Height="20"
hc:IconElement.Geometry="{StaticResource WindowRestoreGeometry}"
Background="Transparent"
FontSize="10"
Foreground="#99000000" />
</hc:ButtonGroup>
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<TextBlock
Margin="0,5,5,0"
@ -100,6 +109,7 @@
Foreground="#99000000"
Text="{Binding Timestamp, StringFormat='{}{0:HH:mm}'}" />
</StackPanel>
</DockPanel>
<hc:Divider
Height="10"
Margin="0,3"

View File

@ -321,8 +321,9 @@ public partial class ImportViewModel : ObservableRecipient, IViewModel
};
Messages.Add(aiChat);
#if !DEBUG
var results = TEST_AI_CONTENT.Split('\n');
var promptedMsg = PromptUtil.UsePrompt(message,ExcelPromptString);
#if DEBUG
var results = promptedMsg.Split('\n');
foreach(var result in results)
{
aiChat.Content += result;
@ -330,7 +331,6 @@ public partial class ImportViewModel : ObservableRecipient, IViewModel
await Task.Delay(5);
}
#else
var promptedMsg = PromptUtil.UsePrompt(message,ExcelPromptString);
history.Add(new Microsoft.Extensions.AI.ChatMessage
{
Role = Microsoft.Extensions.AI.ChatRole.User,