31 lines
823 B
C#
31 lines
823 B
C#
using System.ComponentModel;
|
|
using System.Runtime.CompilerServices;
|
|
|
|
namespace YwxApp.AiChat.Models
|
|
{
|
|
public class ChatMessage : INotifyPropertyChanged
|
|
{
|
|
public enum MessageRole { User, Assistant }
|
|
|
|
private MessageRole _role;
|
|
public MessageRole Role
|
|
{
|
|
get => _role;
|
|
set { _role = value; OnPropertyChanged(); }
|
|
}
|
|
|
|
private string _content;
|
|
public string Content
|
|
{
|
|
get => _content;
|
|
set { _content = value; OnPropertyChanged(); }
|
|
}
|
|
|
|
public event PropertyChangedEventHandler? PropertyChanged;
|
|
protected virtual void OnPropertyChanged([CallerMemberName] string? name = null)
|
|
{
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
|
}
|
|
}
|
|
}
|