Files

1 line
39 KiB
JSON

{"repo": "57uu/merrybot", "files": {"OpenAiClient/ModelPreset.cs": {"7f9fee6edebef265089d687eab95d4a7a822fd3a": {"t": 1785746207.2645886, "n": 6216, "h": "42a93ec8e1fced45", "c": "using System.Collections.Immutable;\nusing System.Text;\n\nnamespace OpenAiClient;\n\npublic class ModelPreset\n{\n public readonly string model;\n /// <summary>\n /// 是否启用内置的 搜索 工具\n /// </summary>\n public readonly bool enableSearch;\n public readonly string url;\n public readonly string provider;\n public readonly bool supportImageInput;\n public readonly float? temperature;\n public readonly ImmutableDictionary<string, object> extraBody;\n private static ImmutableDictionary<string, object> Empty = ImmutableDictionary<string, object>.Empty;\n\n private static readonly Dictionary<string, ModelPreset> modelsByName = new();\n /// <summary>\n /// OpenAI api format\n /// </summary>\n public string CompletionUrl => $\"{url}/chat/completions\";\n public ModelPreset(\n string model,\n string url,\n string provider,\n ImmutableDictionary<string, object>? extraBody = null,\n bool enableSearch = true,\n bool supportImageInput = false,\n float? temperature = null,\n bool? storeInDict = true\n )\n {\n this.model = model;\n this.url = url;\n this.provider = provider;\n this.extraBody = extraBody ?? Empty;\n this.enableSearch = enableSearch;\n this.supportImageInput = supportImageInput;\n this.temperature = temperature;\n if (storeInDict == true)\n {\n modelsByName[ModelTag] = this;\n }\n }\n public string ModelTag=>$\"{provider}/{model}\";\n public ModelPreset With(\n string? model = null,\n string? url = null,\n string? provider = null,\n ImmutableDictionary<string, object>? extraBody = null,\n bool? enableSearch = null,\n bool? supportImageInput = null,\n float? temperature = null,\n bool? storeInDict = true\n )\n {\n return new(\n model ?? this.model,\n url ?? this.url,\n provider ?? this.provider,\n extraBody ?? this.extraBody,\n enableSearch ?? this.enableSearch,\n supportImageInput ?? this.supportImageInput,\n temperature ?? this.temperature,\n storeInDict ?? false\n );\n\n }\n public ModelPreset SavedWith(\n string? model = null,\n string? url = null,\n string? provider = null,\n ImmutableDictionary<string, object>? extraBody = null,\n bool? enableSearch = null,\n bool? supportImageInput = null,\n float? temperature = null\n )\n {\n return With(model,\n url,\n provider,\n extraBody,\n enableSearch,\n supportImageInput,\n temperature,\n storeInDict: true\n );\n\n }\n /// <summary>\n /// 根据模型名称获取模型预设\n /// </summary>\n /// <param name=\"name\">模型名称,格式为 provider/model</param>\n /// <returns>模型预设</returns>\n public static ModelPreset? GetModelByName(string? name)\n {\n if (name == null)\n {\n return null;\n }\n if (modelsByName.TryGetValue(name, out var v))\n {\n return v;\n }\n return null;\n }\n public static void DisplayAllModels()\n {\n Console.WriteLine(\"Available Models\");\n foreach (var item in modelsByName)\n {\n Console.Write($\"{item.Value.model} By {item.Value.provider};\");\n }\n Console.WriteLine();\n }\n public static string AllModels()\n {\n StringBuilder sb = new();\n foreach (var item in modelsByName)\n {\n sb.Append($\"{item.Value.model} By {item.Value.provider};\");\n }\n sb.AppendLine();\n return sb.ToString();\n }\n public static ImmutableDictionary<string, ModelPreset> AllModelsDict => modelsByName.ToImmutableDictionary();\n public string ApiTokenDictKey => $\"ai-token-{provider}\";\n\n\n\n public static readonly ModelPreset Glm_4_5_Free = new ModelPreset(\n model: \"GLM-4.5-Flash\",\n url: \"https://open.bigmodel.cn/api/paas/v4\",\n provider: \"zhipu\",\n extraBody: Empty.Add(\"thinking\", Empty.Add(\"type\", \"enabled\"))\n );\n public static readonly ModelPreset GLM_4_6V_Flash_Free = Glm_4_5_Free.SavedWith(\"GLM-4.6V-Flash\", supportImageInput: true);\n public static readonly ModelPreset Glm_4V_Flash_Free = GLM_4_6V_Flash_Free.SavedWith(\"GLM-4V-Flash\");\n public static readonly ModelPreset Glm_4_1V_Flash_Free = Glm_4V_Flash_Free.SavedWith(\"GLM-4.1V-Thinking-Flash\");\n public static readonly ModelPreset Glm_4_Free = Glm_4_5_Free.SavedWith(\"GLM-4-Flash-250414\");\n public static readonly ModelPreset Glm_4_7 = Glm_4_5_Free.SavedWith(\"GLM-4.7\", extraBody: Empty);\n public static readonly ModelPreset Glm_4_7_Flash_Free = Glm_4_5_Free.SavedWith(\"glm-4.7-flash\");\n public static readonly ModelPreset DeepSeekChat = new ModelPreset(\n \"deepseek-v4-flash\",\n \"https://api.deepseek.com\",\n \"deepseek\",\n extraBody: Empty.Add(\"thinking\", Empty.Add(\"type\", \"enabled\"))\n );\n public static readonly ModelPreset DeepSeekReasoner = DeepSeekChat.SavedWith(model: \"deepseek-v4-pro\");\n public static readonly ModelPreset Qwen3Max = new(\n \"qwen3-max\",\n \"https://dashscope.aliyuncs.com/compatible-mode/v1\",\n \"ali\",\n Empty.Add(\"enable_search\", true)\n );\n public static readonly ModelPreset Qwen3Plus = Qwen3Max.SavedWith(\"qwen-plus-latest\");\n public static readonly ModelPreset XiaomiMimoV2 = new(\n \"mimo-v2-flash\",\n \"https://api.xiaomimimo.com/v1\",\n \"xiaomi\"\n );\n public static readonly ModelPreset MiniMax3 = new(\n \"MiniMax-M3\",\n \"https://api.minimax.chat/v1\",\n \"minimax\"\n );\n}\n\npublic record DashscopeModelPreset(\n string model,\n string url,\n string provider\n )\n{\n public string ApiTokenDictKey => $\"ai-token-{provider}\";\n public string ImageGenerateUrl => $\"{url}/services/aigc/multimodal-generation/generation\";\n public static DashscopeModelPreset QwenImageMax = new(\n \"qwen-image-max\",\n \"https://dashscope.aliyuncs.com/api/v1\",\n \"ali\"\n );\n}"}, "a0f23d4d9a9b2eccacab9a3c22eb13eb46e49c0b": {"t": 1785760618.398516, "n": 6216, "h": "42a93ec8e1fced45", "c": "using System.Collections.Immutable;\nusing System.Text;\n\nnamespace OpenAiClient;\n\npublic class ModelPreset\n{\n public readonly string model;\n /// <summary>\n /// 是否启用内置的 搜索 工具\n /// </summary>\n public readonly bool enableSearch;\n public readonly string url;\n public readonly string provider;\n public readonly bool supportImageInput;\n public readonly float? temperature;\n public readonly ImmutableDictionary<string, object> extraBody;\n private static ImmutableDictionary<string, object> Empty = ImmutableDictionary<string, object>.Empty;\n\n private static readonly Dictionary<string, ModelPreset> modelsByName = new();\n /// <summary>\n /// OpenAI api format\n /// </summary>\n public string CompletionUrl => $\"{url}/chat/completions\";\n public ModelPreset(\n string model,\n string url,\n string provider,\n ImmutableDictionary<string, object>? extraBody = null,\n bool enableSearch = true,\n bool supportImageInput = false,\n float? temperature = null,\n bool? storeInDict = true\n )\n {\n this.model = model;\n this.url = url;\n this.provider = provider;\n this.extraBody = extraBody ?? Empty;\n this.enableSearch = enableSearch;\n this.supportImageInput = supportImageInput;\n this.temperature = temperature;\n if (storeInDict == true)\n {\n modelsByName[ModelTag] = this;\n }\n }\n public string ModelTag=>$\"{provider}/{model}\";\n public ModelPreset With(\n string? model = null,\n string? url = null,\n string? provider = null,\n ImmutableDictionary<string, object>? extraBody = null,\n bool? enableSearch = null,\n bool? supportImageInput = null,\n float? temperature = null,\n bool? storeInDict = true\n )\n {\n return new(\n model ?? this.model,\n url ?? this.url,\n provider ?? this.provider,\n extraBody ?? this.extraBody,\n enableSearch ?? this.enableSearch,\n supportImageInput ?? this.supportImageInput,\n temperature ?? this.temperature,\n storeInDict ?? false\n );\n\n }\n public ModelPreset SavedWith(\n string? model = null,\n string? url = null,\n string? provider = null,\n ImmutableDictionary<string, object>? extraBody = null,\n bool? enableSearch = null,\n bool? supportImageInput = null,\n float? temperature = null\n )\n {\n return With(model,\n url,\n provider,\n extraBody,\n enableSearch,\n supportImageInput,\n temperature,\n storeInDict: true\n );\n\n }\n /// <summary>\n /// 根据模型名称获取模型预设\n /// </summary>\n /// <param name=\"name\">模型名称,格式为 provider/model</param>\n /// <returns>模型预设</returns>\n public static ModelPreset? GetModelByName(string? name)\n {\n if (name == null)\n {\n return null;\n }\n if (modelsByName.TryGetValue(name, out var v))\n {\n return v;\n }\n return null;\n }\n public static void DisplayAllModels()\n {\n Console.WriteLine(\"Available Models\");\n foreach (var item in modelsByName)\n {\n Console.Write($\"{item.Value.model} By {item.Value.provider};\");\n }\n Console.WriteLine();\n }\n public static string AllModels()\n {\n StringBuilder sb = new();\n foreach (var item in modelsByName)\n {\n sb.Append($\"{item.Value.model} By {item.Value.provider};\");\n }\n sb.AppendLine();\n return sb.ToString();\n }\n public static ImmutableDictionary<string, ModelPreset> AllModelsDict => modelsByName.ToImmutableDictionary();\n public string ApiTokenDictKey => $\"ai-token-{provider}\";\n\n\n\n public static readonly ModelPreset Glm_4_5_Free = new ModelPreset(\n model: \"GLM-4.5-Flash\",\n url: \"https://open.bigmodel.cn/api/paas/v4\",\n provider: \"zhipu\",\n extraBody: Empty.Add(\"thinking\", Empty.Add(\"type\", \"enabled\"))\n );\n public static readonly ModelPreset GLM_4_6V_Flash_Free = Glm_4_5_Free.SavedWith(\"GLM-4.6V-Flash\", supportImageInput: true);\n public static readonly ModelPreset Glm_4V_Flash_Free = GLM_4_6V_Flash_Free.SavedWith(\"GLM-4V-Flash\");\n public static readonly ModelPreset Glm_4_1V_Flash_Free = Glm_4V_Flash_Free.SavedWith(\"GLM-4.1V-Thinking-Flash\");\n public static readonly ModelPreset Glm_4_Free = Glm_4_5_Free.SavedWith(\"GLM-4-Flash-250414\");\n public static readonly ModelPreset Glm_4_7 = Glm_4_5_Free.SavedWith(\"GLM-4.7\", extraBody: Empty);\n public static readonly ModelPreset Glm_4_7_Flash_Free = Glm_4_5_Free.SavedWith(\"glm-4.7-flash\");\n public static readonly ModelPreset DeepSeekChat = new ModelPreset(\n \"deepseek-v4-flash\",\n \"https://api.deepseek.com\",\n \"deepseek\",\n extraBody: Empty.Add(\"thinking\", Empty.Add(\"type\", \"enabled\"))\n );\n public static readonly ModelPreset DeepSeekReasoner = DeepSeekChat.SavedWith(model: \"deepseek-v4-pro\");\n public static readonly ModelPreset Qwen3Max = new(\n \"qwen3-max\",\n \"https://dashscope.aliyuncs.com/compatible-mode/v1\",\n \"ali\",\n Empty.Add(\"enable_search\", true)\n );\n public static readonly ModelPreset Qwen3Plus = Qwen3Max.SavedWith(\"qwen-plus-latest\");\n public static readonly ModelPreset XiaomiMimoV2 = new(\n \"mimo-v2-flash\",\n \"https://api.xiaomimimo.com/v1\",\n \"xiaomi\"\n );\n public static readonly ModelPreset MiniMax3 = new(\n \"MiniMax-M3\",\n \"https://api.minimax.chat/v1\",\n \"minimax\"\n );\n}\n\npublic record DashscopeModelPreset(\n string model,\n string url,\n string provider\n )\n{\n public string ApiTokenDictKey => $\"ai-token-{provider}\";\n public string ImageGenerateUrl => $\"{url}/services/aigc/multimodal-generation/generation\";\n public static DashscopeModelPreset QwenImageMax = new(\n \"qwen-image-max\",\n \"https://dashscope.aliyuncs.com/api/v1\",\n \"ali\"\n );\n}"}, "42d99096709c3ddd4e50b482ac6668b906be3858": {"t": 1785760619.66192, "n": 6220, "h": "a4063aba5b7bcebe", "c": "using System.Collections.Immutable;\nusing System.Text;\n\nnamespace OpenAiClient;\n\npublic class ModelPreset\n{\n public readonly string model;\n /// <summary>\n /// 是否启用内置的 搜索 工具\n /// </summary>\n public readonly bool enableSearch;\n public readonly string url;\n public readonly string provider;\n public readonly bool supportImageInput;\n public readonly float? temperature;\n public readonly ImmutableDictionary<string, object> extraBody;\n private static ImmutableDictionary<string, object> Empty = ImmutableDictionary<string, object>.Empty;\n\n private static readonly Dictionary<string, ModelPreset> modelsByName = new();\n /// <summary>\n /// OpenAI api format\n /// </summary>\n public string CompletionUrl => $\"{url}/chat/completions\";\n public ModelPreset(\n string model,\n string url,\n string provider,\n ImmutableDictionary<string, object>? extraBody = null,\n bool enableSearch = true,\n bool supportImageInput = false,\n float? temperature = null,\n bool? storeInDict = true\n )\n {\n this.model = model;\n this.url = url;\n this.provider = provider;\n this.extraBody = extraBody ?? Empty;\n this.enableSearch = enableSearch;\n this.supportImageInput = supportImageInput;\n this.temperature = temperature;\n if (storeInDict == true)\n {\n modelsByName[ModelTag] = this;\n }\n }\n public string ModelTag=>$\"{provider}/{model}\";\n public ModelPreset With(\n string? model = null,\n string? url = null,\n string? provider = null,\n ImmutableDictionary<string, object>? extraBody = null,\n bool? enableSearch = null,\n bool? supportImageInput = null,\n float? temperature = null,\n bool? storeInDict = true\n )\n {\n return new(\n model ?? this.model,\n url ?? this.url,\n provider ?? this.provider,\n extraBody ?? this.extraBody,\n enableSearch ?? this.enableSearch,\n supportImageInput ?? this.supportImageInput,\n temperature ?? this.temperature,\n storeInDict ?? false\n );\n\n }\n public ModelPreset SavedWith(\n string? model = null,\n string? url = null,\n string? provider = null,\n ImmutableDictionary<string, object>? extraBody = null,\n bool? enableSearch = null,\n bool? supportImageInput = null,\n float? temperature = null\n )\n {\n return With(model,\n url,\n provider,\n extraBody,\n enableSearch,\n supportImageInput,\n temperature,\n storeInDict: true\n );\n\n }\n /// <summary>\n /// 根据模型名称获取模型预设\n /// </summary>\n /// <param name=\"name\">模型名称,格式为 provider/model</param>\n /// <returns>模型预设</returns>\n public static ModelPreset? GetModelByName(string? name)\n {\n if (name == null)\n {\n return null;\n }\n if (modelsByName.TryGetValue(name, out var v))\n {\n return v;\n }\n return null;\n }\n public static void DisplayAllModels()\n {\n Console.WriteLine(\"Available Models\");\n foreach (var item in modelsByName)\n {\n Console.Write($\"{item.Value.model} By {item.Value.provider};\");\n }\n Console.WriteLine();\n }\n public static string AllModels()\n {\n StringBuilder sb = new();\n foreach (var item in modelsByName)\n {\n sb.Append($\"{item.Value.model} By {item.Value.provider};\");\n }\n sb.AppendLine();\n return sb.ToString();\n }\n public static ImmutableDictionary<string, ModelPreset> AllModelsDict => modelsByName.ToImmutableDictionary();\n public string ApiTokenDictKey => $\"ai-token-{provider}\";\n\n\n\n public static readonly ModelPreset Glm_4_5_Free = new ModelPreset(\n model: \"GLM-4.5-Flash\",\n url: \"https://open.bigmodel.cn/api/paas/v4\",\n provider: \"zhipu\",\n extraBody: Empty.Add(\"thinking\", Empty.Add(\"type\", \"enabled\"))\n );\n public static readonly ModelPreset GLM_4_6V_Flash_Free = Glm_4_5_Free.SavedWith(\"GLM-4.6V-Flash\", supportImageInput: true);\n public static readonly ModelPreset Glm_4V_Flash_Free = GLM_4_6V_Flash_Free.SavedWith(\"GLM-4V-Flash\");\n public static readonly ModelPreset Glm_4_1V_Flash_Free = Glm_4V_Flash_Free.SavedWith(\"GLM-4.1V-Thinking-Flash\");\n public static readonly ModelPreset Glm_4_Free = Glm_4_5_Free.SavedWith(\"GLM-4-Flash-250414\");\n public static readonly ModelPreset Glm_4_7 = Glm_4_5_Free.SavedWith(\"GLM-4.7\", extraBody: Empty);\n public static readonly ModelPreset Glm_4_7_Flash_Free = Glm_4_5_Free.SavedWith(\"glm-4.7-flash\");\n public static readonly ModelPreset DeepSeekChat = new ModelPreset(\n \"deepseek-v4-flash\",\n \"https://api.deepseek.com\",\n \"deepseek\",\n extraBody: Empty.Add(\"thinking\", Empty.Add(\"type\", \"enabled\"))\n );\n public static readonly ModelPreset DeepSeekReasoner = DeepSeekChat.SavedWith(model: \"deepseek-v4-pro\");\n public static readonly ModelPreset Qwen3Max = new(\n \"qwen3-max\",\n \"https://dashscope.aliyuncs.com/compatible-mode/v1\",\n \"ali\",\n Empty.Add(\"enable_search\", true)\n );\n public static readonly ModelPreset Qwen3Plus = Qwen3Max.SavedWith(\"qwen-plus-latest\");\n public static readonly ModelPreset XiaomiMimoV2 = new(\n \"mimo-v2-flash\",\n \"https://api.xiaomimimo.com/v1\",\n \"xiaomi\"\n );\n public static readonly ModelPreset MiniMax2_7 = new(\n \"MiniMax-M2.7\",\n \"https://api.minimax.chat/v1\",\n \"minimax\"\n );\n}\n\npublic record DashscopeModelPreset(\n string model,\n string url,\n string provider\n )\n{\n public string ApiTokenDictKey => $\"ai-token-{provider}\";\n public string ImageGenerateUrl => $\"{url}/services/aigc/multimodal-generation/generation\";\n public static DashscopeModelPreset QwenImageMax = new(\n \"qwen-image-max\",\n \"https://dashscope.aliyuncs.com/api/v1\",\n \"ali\"\n );\n}"}, "7d5678ce2a2f5ab93d88a5a097d1436d57f98b3c": {"t": 1785760621.2269125, "n": 6217, "h": "32bd60d4acf7ef47", "c": "using System.Collections.Immutable;\nusing System.Text;\n\nnamespace OpenAiClient;\n\npublic class ModelPreset\n{\n public readonly string model;\n /// <summary>\n /// 是否启用内置的 搜索 工具\n /// </summary>\n public readonly bool enableSearch;\n public readonly string url;\n public readonly string provider;\n public readonly bool supportImageInput;\n public readonly float? temperature;\n public readonly ImmutableDictionary<string, object> extraBody;\n private static ImmutableDictionary<string, object> Empty = ImmutableDictionary<string, object>.Empty;\n\n private static readonly Dictionary<string, ModelPreset> modelsByName = new();\n /// <summary>\n /// OpenAI api format\n /// </summary>\n public string CompletionUrl => $\"{url}/chat/completions\";\n public ModelPreset(\n string model,\n string url,\n string provider,\n ImmutableDictionary<string, object>? extraBody = null,\n bool enableSearch = true,\n bool supportImageInput = false,\n float? temperature = null,\n bool? storeInDict = true\n )\n {\n this.model = model;\n this.url = url;\n this.provider = provider;\n this.extraBody = extraBody ?? Empty;\n this.enableSearch = enableSearch;\n this.supportImageInput = supportImageInput;\n this.temperature = temperature;\n if (storeInDict == true)\n {\n modelsByName[ModelTag] = this;\n }\n }\n public string ModelTag=>$\"{provider}/{model}\";\n public ModelPreset With(\n string? model = null,\n string? url = null,\n string? provider = null,\n ImmutableDictionary<string, object>? extraBody = null,\n bool? enableSearch = null,\n bool? supportImageInput = null,\n float? temperature = null,\n bool? storeInDict = true\n )\n {\n return new(\n model ?? this.model,\n url ?? this.url,\n provider ?? this.provider,\n extraBody ?? this.extraBody,\n enableSearch ?? this.enableSearch,\n supportImageInput ?? this.supportImageInput,\n temperature ?? this.temperature,\n storeInDict ?? false\n );\n\n }\n public ModelPreset SavedWith(\n string? model = null,\n string? url = null,\n string? provider = null,\n ImmutableDictionary<string, object>? extraBody = null,\n bool? enableSearch = null,\n bool? supportImageInput = null,\n float? temperature = null\n )\n {\n return With(model,\n url,\n provider,\n extraBody,\n enableSearch,\n supportImageInput,\n temperature,\n storeInDict: true\n );\n\n }\n /// <summary>\n /// 根据模型名称获取模型预设\n /// </summary>\n /// <param name=\"name\">模型名称,格式为 provider/model</param>\n /// <returns>模型预设</returns>\n public static ModelPreset? GetModelByName(string? name)\n {\n if (name == null)\n {\n return null;\n }\n if (modelsByName.TryGetValue(name, out var v))\n {\n return v;\n }\n return null;\n }\n public static void DisplayAllModels()\n {\n Console.WriteLine(\"Available Models\");\n foreach (var item in modelsByName)\n {\n Console.Write($\"{item.Value.model} By {item.Value.provider};\");\n }\n Console.WriteLine();\n }\n public static string AllModels()\n {\n StringBuilder sb = new();\n foreach (var item in modelsByName)\n {\n sb.Append($\"{item.Value.model} By {item.Value.provider};\");\n }\n sb.AppendLine();\n return sb.ToString();\n }\n public static ImmutableDictionary<string, ModelPreset> AllModelsDict => modelsByName.ToImmutableDictionary();\n public string ApiTokenDictKey => $\"ai-token-{provider}\";\n\n\n\n public static readonly ModelPreset Glm_4_5_Free = new ModelPreset(\n model: \"GLM-4.5-Flash\",\n url: \"https://open.bigmodel.cn/api/paas/v4\",\n provider: \"zhipu\",\n extraBody: Empty.Add(\"thinking\", Empty.Add(\"type\", \"enabled\"))\n );\n public static readonly ModelPreset GLM_4_6V_Flash_Free = Glm_4_5_Free.SavedWith(\"GLM-4.6V-Flash\", supportImageInput: true);\n public static readonly ModelPreset Glm_4V_Flash_Free = GLM_4_6V_Flash_Free.SavedWith(\"GLM-4V-Flash\");\n public static readonly ModelPreset Glm_4_1V_Flash_Free = Glm_4V_Flash_Free.SavedWith(\"GLM-4.1V-Thinking-Flash\");\n public static readonly ModelPreset Glm_4_Free = Glm_4_5_Free.SavedWith(\"GLM-4-Flash-250414\");\n public static readonly ModelPreset Glm_4_7 = Glm_4_5_Free.SavedWith(\"GLM-4.7\", extraBody: Empty);\n public static readonly ModelPreset Glm_4_7_Flash_Free = Glm_4_5_Free.SavedWith(\"glm-4.7-flash\");\n public static readonly ModelPreset DeepSeekChat = new ModelPreset(\n \"deepseek-v4-flash\",\n \"https://api.deepseek.com\",\n \"deepseek\",\n extraBody: Empty.Add(\"thinking\", Empty.Add(\"type\", \"true\"))\n );\n public static readonly ModelPreset DeepSeekReasoner = DeepSeekChat.SavedWith(model: \"deepseek-v4-pro\");\n public static readonly ModelPreset Qwen3Max = new(\n \"qwen3-max\",\n \"https://dashscope.aliyuncs.com/compatible-mode/v1\",\n \"ali\",\n Empty.Add(\"enable_search\", true)\n );\n public static readonly ModelPreset Qwen3Plus = Qwen3Max.SavedWith(\"qwen-plus-latest\");\n public static readonly ModelPreset XiaomiMimoV2 = new(\n \"mimo-v2-flash\",\n \"https://api.xiaomimimo.com/v1\",\n \"xiaomi\"\n );\n public static readonly ModelPreset MiniMax2_7 = new(\n \"MiniMax-M2.7\",\n \"https://api.minimax.chat/v1\",\n \"minimax\"\n );\n}\n\npublic record DashscopeModelPreset(\n string model,\n string url,\n string provider\n )\n{\n public string ApiTokenDictKey => $\"ai-token-{provider}\";\n public string ImageGenerateUrl => $\"{url}/services/aigc/multimodal-generation/generation\";\n public static DashscopeModelPreset QwenImageMax = new(\n \"qwen-image-max\",\n \"https://dashscope.aliyuncs.com/api/v1\",\n \"ali\"\n );\n}"}, "0d4be2b288c8e4eab3c6f0d717c82cffb59e4113": {"t": 1785760622.4686174, "n": 6144, "h": "ea5e39396187dce8", "c": "using System.Collections.Immutable;\nusing System.Text;\n\nnamespace OpenAiClient;\n\npublic class ModelPreset\n{\n public readonly string model;\n /// <summary>\n /// 是否启用内置的 搜索 工具\n /// </summary>\n public readonly bool enableSearch;\n public readonly string url;\n public readonly string provider;\n public readonly bool supportImageInput;\n public readonly float? temperature;\n public readonly ImmutableDictionary<string, object> extraBody;\n private static ImmutableDictionary<string, object> Empty = ImmutableDictionary<string, object>.Empty;\n\n private static readonly Dictionary<string, ModelPreset> modelsByName = new();\n /// <summary>\n /// OpenAI api format\n /// </summary>\n public string CompletionUrl => $\"{url}/chat/completions\";\n public ModelPreset(\n string model,\n string url,\n string provider,\n ImmutableDictionary<string, object>? extraBody = null,\n bool enableSearch = true,\n bool supportImageInput = false,\n float? temperature = null,\n bool? storeInDict = true\n )\n {\n this.model = model;\n this.url = url;\n this.provider = provider;\n this.extraBody = extraBody ?? Empty;\n this.enableSearch = enableSearch;\n this.supportImageInput = supportImageInput;\n this.temperature = temperature;\n if (storeInDict == true)\n {\n modelsByName[ModelTag] = this;\n }\n }\n public string ModelTag=>$\"{provider}/{model}\";\n public ModelPreset With(\n string? model = null,\n string? url = null,\n string? provider = null,\n ImmutableDictionary<string, object>? extraBody = null,\n bool? enableSearch = null,\n bool? supportImageInput = null,\n float? temperature = null,\n bool? storeInDict = true\n )\n {\n return new(\n model ?? this.model,\n url ?? this.url,\n provider ?? this.provider,\n extraBody ?? this.extraBody,\n enableSearch ?? this.enableSearch,\n supportImageInput ?? this.supportImageInput,\n temperature ?? this.temperature,\n storeInDict ?? false\n );\n\n }\n public ModelPreset SavedWith(\n string? model = null,\n string? url = null,\n string? provider = null,\n ImmutableDictionary<string, object>? extraBody = null,\n bool? enableSearch = null,\n bool? supportImageInput = null,\n float? temperature = null\n )\n {\n return With(model,\n url,\n provider,\n extraBody,\n enableSearch,\n supportImageInput,\n temperature,\n storeInDict: true\n );\n\n }\n /// <summary>\n /// 根据模型名称获取模型预设\n /// </summary>\n /// <param name=\"name\">模型名称,格式为 provider/model</param>\n /// <returns>模型预设</returns>\n public static ModelPreset? GetModelByName(string? name)\n {\n if (name == null)\n {\n return null;\n }\n if (modelsByName.TryGetValue(name, out var v))\n {\n return v;\n }\n return null;\n }\n public static void DisplayAllModels()\n {\n Console.WriteLine(\"Available Models\");\n foreach (var item in modelsByName)\n {\n Console.Write($\"{item.Value.model} By {item.Value.provider};\");\n }\n Console.WriteLine();\n }\n public static string AllModels()\n {\n StringBuilder sb = new();\n foreach (var item in modelsByName)\n {\n sb.Append($\"{item.Value.model} By {item.Value.provider};\");\n }\n sb.AppendLine();\n return sb.ToString();\n }\n public static ImmutableDictionary<string, ModelPreset> AllModelsDict => modelsByName.ToImmutableDictionary();\n public string ApiTokenDictKey => $\"ai-token-{provider}\";\n\n\n\n public static readonly ModelPreset Glm_4_5_Free = new ModelPreset(\n model: \"GLM-4.5-Flash\",\n url: \"https://open.bigmodel.cn/api/paas/v4\",\n provider: \"zhipu\",\n extraBody: Empty.Add(\"thinking\", Empty.Add(\"type\", \"enabled\"))\n );\n public static readonly ModelPreset GLM_4_6V_Flash_Free = Glm_4_5_Free.SavedWith(\"GLM-4.6V-Flash\", supportImageInput: true);\n public static readonly ModelPreset Glm_4V_Flash_Free = GLM_4_6V_Flash_Free.SavedWith(\"GLM-4V-Flash\");\n public static readonly ModelPreset Glm_4_1V_Flash_Free = Glm_4V_Flash_Free.SavedWith(\"GLM-4.1V-Thinking-Flash\");\n public static readonly ModelPreset Glm_4_Free = Glm_4_5_Free.SavedWith(\"GLM-4-Flash-250414\");\n public static readonly ModelPreset Glm_4_7 = Glm_4_5_Free.SavedWith(\"GLM-4.7\", extraBody: Empty);\n public static readonly ModelPreset Glm_4_7_Flash_Free = Glm_4_5_Free.SavedWith(\"glm-4.7-flash\");\n public static readonly ModelPreset DeepSeekChat = new ModelPreset(\n \"deepseek-v4-flash\",\n \"https://api.deepseek.com\",\n \"deepseek\"\n );\n public static readonly ModelPreset DeepSeekReasoner = DeepSeekChat.SavedWith(model: \"deepseek-v4-pro\");\n public static readonly ModelPreset Qwen3Max = new(\n \"qwen3-max\",\n \"https://dashscope.aliyuncs.com/compatible-mode/v1\",\n \"ali\",\n Empty.Add(\"enable_search\", true)\n );\n public static readonly ModelPreset Qwen3Plus = Qwen3Max.SavedWith(\"qwen-plus-latest\");\n public static readonly ModelPreset XiaomiMimoV2 = new(\n \"mimo-v2-flash\",\n \"https://api.xiaomimimo.com/v1\",\n \"xiaomi\"\n );\n public static readonly ModelPreset MiniMax2_7 = new(\n \"MiniMax-M2.7\",\n \"https://api.minimax.chat/v1\",\n \"minimax\"\n );\n}\n\npublic record DashscopeModelPreset(\n string model,\n string url,\n string provider\n )\n{\n public string ApiTokenDictKey => $\"ai-token-{provider}\";\n public string ImageGenerateUrl => $\"{url}/services/aigc/multimodal-generation/generation\";\n public static DashscopeModelPreset QwenImageMax = new(\n \"qwen-image-max\",\n \"https://dashscope.aliyuncs.com/api/v1\",\n \"ali\"\n );\n}"}, "a77076a960b05e1c73adf40468bddec08dd8ff6d": {"t": 1785760623.7414165, "n": 6142, "h": "d4eebb78303f6f82", "c": "using System.Collections.Immutable;\nusing System.Text;\n\nnamespace OpenAiClient;\n\npublic class ModelPreset\n{\n public readonly string model;\n /// <summary>\n /// 是否启用内置的 搜索 工具\n /// </summary>\n public readonly bool enableSearch;\n public readonly string url;\n public readonly string provider;\n public readonly bool supportImageInput;\n public readonly float? temperature;\n public readonly ImmutableDictionary<string, object> extraBody;\n private static ImmutableDictionary<string, object> Empty = ImmutableDictionary<string, object>.Empty;\n\n private static readonly Dictionary<string, ModelPreset> modelsByName = new();\n /// <summary>\n /// OpenAI api format\n /// </summary>\n public string CompletionUrl => $\"{url}/chat/completions\";\n public ModelPreset(\n string model,\n string url,\n string provider,\n ImmutableDictionary<string, object>? extraBody = null,\n bool enableSearch = true,\n bool supportImageInput = false,\n float? temperature = null,\n bool? storeInDict = true\n )\n {\n this.model = model;\n this.url = url;\n this.provider = provider;\n this.extraBody = extraBody ?? Empty;\n this.enableSearch = enableSearch;\n this.supportImageInput = supportImageInput;\n this.temperature = temperature;\n if (storeInDict == true)\n {\n modelsByName[ModelTag] = this;\n }\n }\n public string ModelTag=>$\"{provider}/{model}\";\n public ModelPreset With(\n string? model = null,\n string? url = null,\n string? provider = null,\n ImmutableDictionary<string, object>? extraBody = null,\n bool? enableSearch = null,\n bool? supportImageInput = null,\n float? temperature = null,\n bool? storeInDict = true\n )\n {\n return new(\n model ?? this.model,\n url ?? this.url,\n provider ?? this.provider,\n extraBody ?? this.extraBody,\n enableSearch ?? this.enableSearch,\n supportImageInput ?? this.supportImageInput,\n temperature ?? this.temperature,\n storeInDict ?? false\n );\n\n }\n public ModelPreset SavedWith(\n string? model = null,\n string? url = null,\n string? provider = null,\n ImmutableDictionary<string, object>? extraBody = null,\n bool? enableSearch = null,\n bool? supportImageInput = null,\n float? temperature = null\n )\n {\n return With(model,\n url,\n provider,\n extraBody,\n enableSearch,\n supportImageInput,\n temperature,\n storeInDict: true\n );\n\n }\n /// <summary>\n /// 根据模型名称获取模型预设\n /// </summary>\n /// <param name=\"name\">模型名称,格式为 provider/model</param>\n /// <returns>模型预设</returns>\n public static ModelPreset? GetModelByName(string? name)\n {\n if (name == null)\n {\n return null;\n }\n if (modelsByName.TryGetValue(name, out var v))\n {\n return v;\n }\n return null;\n }\n public static void DisplayAllModels()\n {\n Console.WriteLine(\"Available Models\");\n foreach (var item in modelsByName)\n {\n Console.Write($\"{item.Value.model} By {item.Value.provider};\");\n }\n Console.WriteLine();\n }\n public static string AllModels()\n {\n StringBuilder sb = new();\n foreach (var item in modelsByName)\n {\n sb.Append($\"{item.Value.model} By {item.Value.provider};\");\n }\n sb.AppendLine();\n return sb.ToString();\n }\n public static ImmutableDictionary<string, ModelPreset> AllModelsDict => modelsByName.ToImmutableDictionary();\n public string ApiTokenDictKey => $\"ai-token-{provider}\";\n\n\n\n public static readonly ModelPreset Glm_4_5_Free = new ModelPreset(\n model: \"GLM-4.5-Flash\",\n url: \"https://open.bigmodel.cn/api/paas/v4\",\n provider: \"zhipu\",\n extraBody: Empty.Add(\"thinking\", Empty.Add(\"type\", \"enabled\"))\n );\n public static readonly ModelPreset GLM_4_6V_Flash_Free = Glm_4_5_Free.SavedWith(\"GLM-4.6V-Flash\", supportImageInput: true);\n public static readonly ModelPreset Glm_4V_Flash_Free = GLM_4_6V_Flash_Free.SavedWith(\"GLM-4V-Flash\");\n public static readonly ModelPreset Glm_4_1V_Flash_Free = Glm_4V_Flash_Free.SavedWith(\"GLM-4.1V-Thinking-Flash\");\n public static readonly ModelPreset Glm_4_Free = Glm_4_5_Free.SavedWith(\"GLM-4-Flash-250414\");\n public static readonly ModelPreset Glm_4_7 = Glm_4_5_Free.SavedWith(\"GLM-4.7\", extraBody: Empty);\n public static readonly ModelPreset Glm_4_7_Flash_Free = Glm_4_5_Free.SavedWith(\"glm-4.7-flash\");\n public static readonly ModelPreset DeepSeekChat = new ModelPreset(\n \"deepseek-chat\",\n \"https://api.deepseek.com\",\n \"deepseek\"\n );\n public static readonly ModelPreset DeepSeekReasoner = DeepSeekChat.SavedWith(model: \"deepseek-reasoner\");\n public static readonly ModelPreset Qwen3Max = new(\n \"qwen3-max\",\n \"https://dashscope.aliyuncs.com/compatible-mode/v1\",\n \"ali\",\n Empty.Add(\"enable_search\", true)\n );\n public static readonly ModelPreset Qwen3Plus = Qwen3Max.SavedWith(\"qwen-plus-latest\");\n public static readonly ModelPreset XiaomiMimoV2 = new(\n \"mimo-v2-flash\",\n \"https://api.xiaomimimo.com/v1\",\n \"xiaomi\"\n );\n public static readonly ModelPreset MiniMax2_7 = new(\n \"MiniMax-M2.7\",\n \"https://api.minimax.chat/v1\",\n \"minimax\"\n );\n}\n\npublic record DashscopeModelPreset(\n string model,\n string url,\n string provider\n )\n{\n public string ApiTokenDictKey => $\"ai-token-{provider}\";\n public string ImageGenerateUrl => $\"{url}/services/aigc/multimodal-generation/generation\";\n public static DashscopeModelPreset QwenImageMax = new(\n \"qwen-image-max\",\n \"https://dashscope.aliyuncs.com/api/v1\",\n \"ali\"\n );\n}"}}}}