-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathForm1.cs
35 lines (32 loc) · 1.06 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using DevExpress.AIIntegration.WinForms.Chat;
using DevExpress.Blazor.Internal;
using DevExpress.XtraEditors;
using Markdig;
using Microsoft.AspNetCore.Components;
namespace DevExpress.AI.Samples.WinBlazor
{
public partial class Form1 : XtraForm
{
public Form1()
{
InitializeComponent();
InitializeBlazorAIChat();
}
private void InitializeBlazorAIChat()
{
AIChatControl chat = new AIChatControl()
{
Name = "aiChatControl1",
Dock = DockStyle.Fill,
ContentFormat = AIIntegration.Blazor.Chat.ResponseContentFormat.Markdown,
UseStreaming = DevExpress.Utils.DefaultBoolean.True
};
chat.MarkdownConvert += Chat_MarkdownConvert;
Controls.Add(chat);
}
private void Chat_MarkdownConvert(object? sender, AIIntegration.Blazor.Chat.WebView.AIChatControlMarkdownConvertEventArgs e)
{
e.HtmlText = (MarkupString)Markdown.ToHtml(e.MarkdownText);
}
}
}