소스 검색

修复gpt模型请求参数

lh 1 주 전
부모
커밋
ce8193d42f
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      app/Services/DeepSeek/DeepSeekService.php

+ 6 - 1
app/Services/DeepSeek/DeepSeekService.php

@@ -3886,7 +3886,10 @@ Q版卡通风格,头大身小,造型圆润可爱,线条简单,色彩明
         // 流式场景下保留 response_format(json 输出时强制模型输出完整 JSON,与非流式 gpt54ChatOnly 对齐)
         // 中转站对 response_format 的兼容性由请求方控制:仅在需要 json 输出时传入
         $post_data['max_completion_tokens'] = 100000;
-        $post_data['max_tokens'] = 100000;
+        // GPT-5.x 上游仅支持 max_completion_tokens,同时携带 max_tokens 会返回 400:
+        // Unsupported parameter: 'max_tokens' is not supported with this model.
+        // 这里显式移除,防止调用方在 post_data 中残留 max_tokens。
+        unset($post_data['max_tokens']);
         // 流式请求显式声明返回 usage(在最后一个 chunk 中返回)
         $post_data['stream_options'] = ['include_usage' => true];
 
@@ -16287,6 +16290,8 @@ Q版卡通风格,头大身小,造型圆润可爱,线条简单,色彩明
             unset($post_data['reasoning_effort']);
         }
         $post_data['max_completion_tokens'] = 100000;
+        // GPT-5.x 上游不支持 max_tokens,与 gpt54StreamResponse 保持一致,显式移除避免 400。
+        unset($post_data['max_tokens']);
 
         // 确保 stream 为 false
         $post_data['stream'] = false;