AIChatControl.SaveMessages() Method
Saves messages from chat history.
Namespace: DevExpress.AIIntegration.WinForms.Chat
Assembly: DevExpress.AIIntegration.WinForms.Chat.v26.1.dll
NuGet Package: DevExpress.AIIntegration.WinForms.Chat
Declaration
Returns
| Type | Description |
|---|---|
| IEnumerable<BlazorChatMessage> | A collection of messages. |
Remarks
Use the following methods to manage chat history:
SaveMessages- Returns anIEnumerable<BlazorChatMessage>collection of messages.- LoadMessages - Loads messages from the specified
IEnumerable<BlazorChatMessage>collection to the AI Chat Control and refreshes the control.
Example
The following example saves and loads chat history when a user clicks the Save/Load button:
public partial class Chat : XtraForm {
List<BlazorChatMessage> chatHistory;
public Chat() {
InitializeComponent();
buttonSave.Click += ButtonSave_Click;
buttonLoad.Click += ButtonLoad_Click;
}
void ButtonSave_Click(object sender, EventArgs e) {
chatHistory = (List<BlazorChatMessage>)aiChatControl1.SaveMessages();
}
void ButtonLoad_Click(object sender, EventArgs e) {
if(chatHistory != null)
aiChatControl1.LoadMessages(chatHistory);
}
}

Refer to the following help topic for additional information: AI Chat Control
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the SaveMessages() method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.