feat: 新增功能

- ChatManager:
  - 引入 System.Text.Json,用于将 agent thread 序列化与反序列化(示例:thread.Serialize(...) -> JsonSerializer.Deserialize -> agent.DeserializeThread)。
  - 增加示例:创建 OpenAIClient、初始化 agent、运行流式响应并处理更新。
  - 小幅格式和空行调整。
- AiChatService:
  - 为 Agent 发送接口 PostAgentSendAsync 增加注释与路由标记 HttpPost("ai-chat/agent/send")。

注意:提交中出现了硬编码的 API Key,请尽快改为从配置或机密管理中读取以防泄露。
This commit is contained in:
chenchun
2025-12-23 17:29:07 +08:00
parent ec4fdc39fe
commit bd3a9a5ce8
2 changed files with 18 additions and 7 deletions

View File

@@ -148,6 +148,9 @@ public class AiChatService : ApplicationService
// 使用 ChatManager
}
/// <summary>
/// Agent 发送消息
/// </summary>
[HttpPost("ai-chat/agent/send")]
public async Task PostAgentSendAsync()
{