using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Runtime.CompilerServices; namespace AI.Models.SpecialMessages { /// /// 工作流状态特殊消息 - 在聊天流中显示工作流进度 /// public class WorkflowStatusMessage : ISpecialMessage, INotifyPropertyChanged { private string _title = "工作流进度"; private ObservableCollection _steps = new(); /// /// 消息唯一标识符 /// public string Id { get; set; } = Guid.NewGuid().ToString(); /// /// 类型名称 /// public string TypeName => "WorkflowStatus"; /// /// 需要实时更新 /// public bool IsLive => true; /// /// 工作流标题 /// public string Title { get => _title; set => SetProperty(ref _title, value); } /// /// 工作流步骤列表 /// public ObservableCollection Steps { get => _steps; set => SetProperty(ref _steps, value); } public event PropertyChangedEventHandler? PropertyChanged; protected void OnPropertyChanged([CallerMemberName] string? propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } protected bool SetProperty(ref T field, T value, [CallerMemberName] string? propertyName = null) { if (EqualityComparer.Default.Equals(field, value)) { return false; } field = value; OnPropertyChanged(propertyName); return true; } } }