File tree Expand file tree Collapse file tree
src/core/infrastructure/adapters/llm Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ export class AnthropicClient extends LLMClient {
4141 } ;
4242
4343 // 只在提供了有效的 maxTokens 时才添加到请求体
44- if ( normalizedOptions . maxTokens && normalizedOptions . maxTokens > 0 ) {
44+ if ( typeof normalizedOptions . maxTokens === 'number' && normalizedOptions . maxTokens > 0 ) {
4545 requestBody . max_tokens = normalizedOptions . maxTokens ;
4646 }
4747
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ export class GeminiClient extends LLMClient {
4040 } ;
4141
4242 // 只在提供了有效的 maxTokens 时才添加到请求体
43- if ( normalizedOptions . maxTokens && normalizedOptions . maxTokens > 0 ) {
43+ if ( typeof normalizedOptions . maxTokens === 'number' && normalizedOptions . maxTokens > 0 ) {
4444 requestBody . generationConfig . maxOutputTokens = normalizedOptions . maxTokens ;
4545 }
4646
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ export class OllamaClient extends LLMClient {
4242 }
4343
4444 // 只在提供了有效的 maxTokens 时才添加到请求体
45- if ( normalizedOptions . maxTokens && normalizedOptions . maxTokens > 0 ) {
45+ if ( typeof normalizedOptions . maxTokens === 'number' && normalizedOptions . maxTokens > 0 ) {
4646 requestBody . options . num_predict = normalizedOptions . maxTokens ;
4747 }
4848
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ export class OpenAIClient extends LLMClient {
3838 } ;
3939
4040 // 只在提供了有效的 maxTokens 时才添加到请求体
41- if ( normalizedOptions . maxTokens && normalizedOptions . maxTokens > 0 ) {
41+ if ( typeof normalizedOptions . maxTokens === 'number' && normalizedOptions . maxTokens > 0 ) {
4242 requestBody . max_tokens = normalizedOptions . maxTokens ;
4343 }
4444
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ export class OpenAIResponsesClient extends LLMClient {
3939 } ;
4040
4141 // 只在提供了有效的 maxTokens 时才添加到请求体
42- if ( normalizedOptions . maxTokens && normalizedOptions . maxTokens > 0 ) {
42+ if ( typeof normalizedOptions . maxTokens === 'number' && normalizedOptions . maxTokens > 0 ) {
4343 requestBody . max_tokens = normalizedOptions . maxTokens ;
4444 }
4545
You can’t perform that action at this time.
0 commit comments