添加项目文件。
This commit is contained in:
30
Models/ChatMessage.cs
Normal file
30
Models/ChatMessage.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user