修复:移除 AI 预测强制指定的 response_format JSON 约束,解决国内开源模型(GLM、StepFun)通过第三方代理调用时静默返回空串无法解析的问题

This commit is contained in:
2026-04-02 13:39:45 +08:00
parent 0a192c4f33
commit 8a809e3cc0

View File

@@ -193,7 +193,7 @@ PROMPT;
'model' => $config->model,
'temperature' => 0.6, // 预测任务需要生成推理和灵活评估,适当提高温度
'max_tokens' => 300, // 输出 JSON 包含 reason加大 token 限制
'response_format' => ['type' => 'json_object'], // 强制平台尝试规范 JSON 输出(对某些模型自动生效)
// 不硬性强制 response_format (经测试某些平台代理对于非原生支持 JSON Mode 的模型,配置此参数会返回空白内容)
'messages' => [
[
'role' => 'system',