feat: Add max continuation tools settings

This commit is contained in:
Petr Mironychev
2026-04-23 19:23:18 +02:00
parent d2c1e39a2e
commit c73b71f328
5 changed files with 20 additions and 0 deletions

View File

@@ -242,6 +242,9 @@ void ClientInterface::sendMessage(
useTools, useTools,
useThinking); useThinking);
provider->client()->setMaxToolContinuations(
Settings::toolsSettings().maxToolContinuations());
connect( connect(
provider->client(), provider->client(),
&::LLMQore::BaseClient::chunkReceived, &::LLMQore::BaseClient::chunkReceived,

View File

@@ -19,6 +19,7 @@
#include <settings/ChatAssistantSettings.hpp> #include <settings/ChatAssistantSettings.hpp>
#include <settings/GeneralSettings.hpp> #include <settings/GeneralSettings.hpp>
#include <settings/QuickRefactorSettings.hpp> #include <settings/QuickRefactorSettings.hpp>
#include <settings/ToolsSettings.hpp>
namespace QodeAssist { namespace QodeAssist {
@@ -139,6 +140,9 @@ void QuickRefactorHandler::prepareAndSendRequest(
enableTools, enableTools,
enableThinking); enableThinking);
provider->client()->setMaxToolContinuations(
Settings::toolsSettings().maxToolContinuations());
m_isRefactoringInProgress = true; m_isRefactoringInProgress = true;
connect( connect(

View File

@@ -87,6 +87,7 @@ const char CA_ENABLE_CHAT_IN_BOTTOM_TOOLBAR[] = "QodeAssist.caEnableChatInBottom
const char CA_ENABLE_CHAT_IN_NAVIGATION_PANEL[] = "QodeAssist.caEnableChatInNavigationPanel"; const char CA_ENABLE_CHAT_IN_NAVIGATION_PANEL[] = "QodeAssist.caEnableChatInNavigationPanel";
const char CA_ENABLE_CHAT_TOOLS[] = "QodeAssist.caEnableChatTools"; const char CA_ENABLE_CHAT_TOOLS[] = "QodeAssist.caEnableChatTools";
const char CA_USE_TOOLS[] = "QodeAssist.caUseTools"; const char CA_USE_TOOLS[] = "QodeAssist.caUseTools";
const char TOOLS_MAX_CONTINUATIONS[] = "QodeAssist.toolsMaxContinuations";
const char CA_ALLOW_ACCESS_OUTSIDE_PROJECT[] = "QodeAssist.caAllowAccessOutsideProject"; const char CA_ALLOW_ACCESS_OUTSIDE_PROJECT[] = "QodeAssist.caAllowAccessOutsideProject";
const char CA_ENABLE_LIST_PROJECT_FILES_TOOL[] = "QodeAssist.caEnableListProjectFilesTool"; const char CA_ENABLE_LIST_PROJECT_FILES_TOOL[] = "QodeAssist.caEnableListProjectFilesTool";
const char CA_ENABLE_FIND_FILE_TOOL[] = "QodeAssist.caEnableFindFileTool"; const char CA_ENABLE_FIND_FILE_TOOL[] = "QodeAssist.caEnableFindFileTool";

View File

@@ -40,6 +40,15 @@ ToolsSettings::ToolsSettings()
"When disabled, each edit is staged for manual approval.")); "When disabled, each edit is staged for manual approval."));
autoApplyFileEdits.setDefaultValue(false); autoApplyFileEdits.setDefaultValue(false);
maxToolContinuations.setSettingsKey(Constants::TOOLS_MAX_CONTINUATIONS);
maxToolContinuations.setLabelText(Tr::tr("Max tool continuations:"));
maxToolContinuations.setToolTip(
Tr::tr("Maximum number of consecutive tool-use rounds in a single request. "
"Each round lets the model call tools and receive results before continuing. "
"Higher values allow more complex multi-step tasks but increase token usage."));
maxToolContinuations.setRange(1, 100);
maxToolContinuations.setDefaultValue(30);
enableListProjectFilesTool.setSettingsKey(Constants::CA_ENABLE_LIST_PROJECT_FILES_TOOL); enableListProjectFilesTool.setSettingsKey(Constants::CA_ENABLE_LIST_PROJECT_FILES_TOOL);
enableListProjectFilesTool.setLabelText(Tr::tr("List Project Files")); enableListProjectFilesTool.setLabelText(Tr::tr("List Project Files"));
enableListProjectFilesTool.setToolTip( enableListProjectFilesTool.setToolTip(
@@ -174,6 +183,7 @@ ToolsSettings::ToolsSettings()
title(Tr::tr("Tool Settings")), title(Tr::tr("Tool Settings")),
Column{ Column{
allowAccessOutsideProject, allowAccessOutsideProject,
Row{maxToolContinuations, Stretch{1}},
Space{4}, Space{4},
Group{ Group{
title(Tr::tr("Edit File")), title(Tr::tr("Edit File")),
@@ -206,6 +216,7 @@ void ToolsSettings::resetSettingsToDefaults()
if (reply == QMessageBox::Yes) { if (reply == QMessageBox::Yes) {
resetAspect(allowAccessOutsideProject); resetAspect(allowAccessOutsideProject);
resetAspect(autoApplyFileEdits); resetAspect(autoApplyFileEdits);
resetAspect(maxToolContinuations);
resetAspect(enableListProjectFilesTool); resetAspect(enableListProjectFilesTool);
resetAspect(enableFindFileTool); resetAspect(enableFindFileTool);
resetAspect(enableReadFileTool); resetAspect(enableReadFileTool);

View File

@@ -18,6 +18,7 @@ public:
Utils::BoolAspect allowAccessOutsideProject{this}; Utils::BoolAspect allowAccessOutsideProject{this};
Utils::BoolAspect autoApplyFileEdits{this}; Utils::BoolAspect autoApplyFileEdits{this};
Utils::IntegerAspect maxToolContinuations{this};
Utils::BoolAspect enableListProjectFilesTool{this}; Utils::BoolAspect enableListProjectFilesTool{this};
Utils::BoolAspect enableFindFileTool{this}; Utils::BoolAspect enableFindFileTool{this};