feat: 新增方案 C 的 Handoff 路由宿主,并让抽城市支持自然语言。
把图 JSON 编译成 CreateHandoffBuilderWith + WithHandoff;Agent 固定 Id 以免交接工具名错位;DeepSeek 关闭 thinking,避免多轮丢掉 reasoning_content 导致 400。
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using System.ClientModel.Primitives;
|
||||
using System.Text.Json;
|
||||
using Microsoft.Extensions.AI;
|
||||
using OpenAI.Chat;
|
||||
|
||||
namespace MAF1.Utils;
|
||||
|
||||
/// <summary>
|
||||
/// DeepSeek V4 默认开 thinking。Handoff 多轮带 tools 时必须回传 reasoning_content,
|
||||
/// 客户端会丢掉该字段导致 HTTP 400。请求里关闭 thinking 即可。
|
||||
/// </summary>
|
||||
internal static class DeepSeekThinking
|
||||
{
|
||||
public static void Disable(ChatOptions options)
|
||||
{
|
||||
options.RawRepresentationFactory = _ =>
|
||||
{
|
||||
ChatCompletionOptions raw = new();
|
||||
#pragma warning disable SCME0001
|
||||
raw.Patch.Set("$.thinking"u8, BinaryData.FromObjectAsJson(new Dictionary<string, string>
|
||||
{
|
||||
["type"] = "disabled",
|
||||
}));
|
||||
#pragma warning restore SCME0001
|
||||
return raw;
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user