You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
using AI.Interface;
|
|
|
|
|
|
|
|
|
|
|
|
namespace AI.Service
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 消息通知器,用于在 Filter 和 ViewModel 之间传递工具调用通知
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class MessageNotifier : IMessageNotifier
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 当工具调用发生时触发此事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public event EventHandler<string>? ToolCallReceived;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 通知添加一条工具调用消息到 UI(仅显示,不进入 AI 上下文)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="message">消息内容</param>
|
|
|
|
|
|
public void NotifyToolCall(string message)
|
|
|
|
|
|
{
|
|
|
|
|
|
// 触发事件,让订阅者(如 MainWindowViewModel)处理
|
|
|
|
|
|
ToolCallReceived?.Invoke(this, message);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|