Skip to content

Commit 38c6fcd

Browse files
committed
change max tool call to 10
1 parent 8852d1e commit 38c6fcd

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

src/main/presenter/llmProviderPresenter/baseProvider.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ export interface ChatMessage {
1717
}
1818

1919
export abstract class BaseLLMProvider {
20+
// 最大工具调用次数限制
21+
protected static readonly MAX_TOOL_CALLS = 10
22+
2023
protected provider: LLM_PROVIDER
2124
protected models: MODEL_META[] = []
2225
protected customModels: MODEL_META[] = []
@@ -28,6 +31,11 @@ export abstract class BaseLLMProvider {
2831
this.configPresenter = configPresenter
2932
}
3033

34+
// 获取最大工具调用次数
35+
public static getMaxToolCalls(): number {
36+
return BaseLLMProvider.MAX_TOOL_CALLS
37+
}
38+
3139
protected async init() {
3240
if (this.provider.enable) {
3341
try {

src/main/presenter/llmProviderPresenter/providers/anthropicProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ ${context}
431431

432432
// 添加工具调用计数
433433
let toolCallCount = 0
434-
const MAX_TOOL_CALLS = 25 // 最大工具调用次数限制
434+
const MAX_TOOL_CALLS = BaseLLMProvider.MAX_TOOL_CALLS // 最大工具调用次数限制
435435

436436
// 维护消息上下文
437437
const currentMessages = [...messages]

src/main/presenter/llmProviderPresenter/providers/geminiProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ export class GeminiProvider extends BaseLLMProvider {
504504

505505
// 添加工具调用计数
506506
let toolCallCount = 0
507-
const MAX_TOOL_CALLS = 25 // 最大工具调用次数限制
507+
const MAX_TOOL_CALLS = BaseLLMProvider.MAX_TOOL_CALLS // 最大工具调用次数限制
508508

509509
// 维护消息上下文
510510
const conversationMessages: ChatMessage[] = [...messages]

src/main/presenter/llmProviderPresenter/providers/ollamaProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ export class OllamaProvider extends BaseLLMProvider {
262262

263263
// 添加工具调用计数
264264
let toolCallCount = 0
265-
const MAX_TOOL_CALLS = 25 // 最大工具调用次数限制
265+
const MAX_TOOL_CALLS = BaseLLMProvider.MAX_TOOL_CALLS // 最大工具调用次数限制
266266

267267
// 启动初始流
268268
let stream = await this.ollama.chat({

src/main/presenter/llmProviderPresenter/providers/openAICompatibleProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export class OpenAICompatibleProvider extends BaseLLMProvider {
153153

154154
// 添加工具调用计数
155155
let toolCallCount = 0
156-
const MAX_TOOL_CALLS = 25 // 最大工具调用次数限制
156+
const MAX_TOOL_CALLS = BaseLLMProvider.MAX_TOOL_CALLS // 最大工具调用次数限制
157157

158158
// 创建基本请求参数
159159
const requestParams: OpenAI.Chat.ChatCompletionCreateParams = {

0 commit comments

Comments
 (0)