Function
setMaxTokensParam
(
payload: any,
modelName: string,
maxTokens: number | null
)
Source from the content-addressed store, hash-verified
| 337 | |
| 338 | // 设置max_tokens参数(兼容不同模型) |
| 339 | function setMaxTokensParam( |
| 340 | payload: any, |
| 341 | modelName: string, |
| 342 | maxTokens: number | null |
| 343 | ): void { |
| 344 | if (maxTokens === null) return; |
| 345 | |
| 346 | const modelLower = modelName.toLowerCase(); |
| 347 | if (modelLower.startsWith("gpt-5") || modelLower.startsWith("o1-")) { |
| 348 | payload.max_completion_tokens = maxTokens; |
| 349 | } else { |
| 350 | payload.max_tokens = maxTokens; |
| 351 | } |
| 352 | } |
| 353 | |
| 354 | // 调用GPT API |
| 355 | async function callGptApi( |
Tested by
no test coverage detected