fix(grok): 移除请求体中的tools字段以兼容API

Grok API不支持tools参数,在构建请求负载时主动删除该字段,避免调用失败。
This commit is contained in:
hex2077 2026-03-13 12:13:19 +08:00
parent f82b781214
commit 90ffd83c78
2 changed files with 5 additions and 1 deletions

View file

@ -1 +1 @@
2.11.4.1
2.11.4.2

View file

@ -319,6 +319,10 @@ export class GrokApiService {
}
buildPayload(modelId, requestBody) {
if (requestBody && Object.prototype.hasOwnProperty.call(requestBody, 'tools')) {
delete requestBody.tools;
}
const rawModelId = typeof modelId === 'string' ? modelId : '';
const normalizedModelId = normalizeGrokModelId(rawModelId);
const mapping = MODEL_MAPPING[normalizedModelId] || MODEL_MAPPING['grok-3'];