Files
MAF1/MAF1.Core/Utils/DeepSeekThinking.cs
admin777 b0e89b6092 feat: 新增方案 C 的 Handoff 路由宿主,并让抽城市支持自然语言。
把图 JSON 编译成 CreateHandoffBuilderWith + WithHandoff;Agent 固定 Id 以免交接工具名错位;DeepSeek 关闭 thinking,避免多轮丢掉 reasoning_content 导致 400。
2026-09-01 17:56:41 +08:00

29 lines
830 B
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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;
};
}
}