Skip to main content
All docs
V26.1
  • AIChatControl.SaveMessages() Method

    Saves messages from chat history.

    Namespace: DevExpress.AIIntegration.Wpf.Chat

    Assembly: DevExpress.AIIntegration.Wpf.Chat.v26.1.dll

    NuGet Package: DevExpress.AIIntegration.Wpf.Chat

    Declaration

    public IEnumerable<BlazorChatMessage> SaveMessages()

    Returns

    Type Description
    IEnumerable<BlazorChatMessage>

    A collection of messages.

    Remarks

    Use the following methods to manage chat history:

    • SaveMessages – Returns an IEnumerable<ChatMessage> collection of messages.
    • LoadMessages – Loads messages from the specified IEnumerable<ChatMessage> collection to the AI Chat Control and refreshes the control.

    Example

    The following example saves/loads chat history when a user clicks the Save/Load button:

    public partial class MainWindow : ThemedWindow {
        List<BlazorChatMessage> chatHistory;
    
        public MainWindow() {
            InitializeComponent();
        }
    
        void ButtonSave_Click(object sender, EventArgs e) {
            chatHistory = (List<BlazorChatMessage>)aiChatControl.SaveMessages();
        }
    
        void ButtonLoad_Click(object sender, EventArgs e) {
            if(chatHistory != null)
                aiChatControl.LoadMessages(chatHistory);
        }
    }
    

    Refer to the following help topic for additional information: AI Chat Control

    See Also