feat: Add tools permissions (#238)

This commit is contained in:
Petr Mironychev
2025-10-12 03:56:05 +02:00
committed by GitHub
parent 5f094887e7
commit ce66c8e4f7
21 changed files with 103 additions and 23 deletions

View File

@ -68,14 +68,6 @@ ChatAssistantSettings::ChatAssistantSettings()
enableChatInNavigationPanel.setLabelText(Tr::tr("Enable chat in navigation panel"));
enableChatInNavigationPanel.setDefaultValue(false);
useTools.setSettingsKey(Constants::CA_USE_TOOLS);
useTools.setLabelText(Tr::tr("Enable tools"));
useTools.setToolTip(
Tr::tr(
"Enable tool use capabilities for the assistant(OpenAI function calling, Claude tools "
"and etc) "
"if plugin and provider support"));
useTools.setDefaultValue(true);
// General Parameters Settings
temperature.setSettingsKey(Constants::CA_TEMPERATURE);
@ -261,8 +253,7 @@ ChatAssistantSettings::ChatAssistantSettings()
linkOpenFiles,
autosave,
enableChatInBottomToolBar,
enableChatInNavigationPanel,
useTools}},
enableChatInNavigationPanel}},
Space{8},
Group{
title(Tr::tr("General Parameters")),
@ -324,7 +315,6 @@ void ChatAssistantSettings::resetSettingsToDefaults()
resetAspect(codeFontSize);
resetAspect(textFormat);
resetAspect(chatRenderer);
resetAspect(useTools);
}
}

View File

@ -38,7 +38,6 @@ public:
Utils::BoolAspect autosave{this};
Utils::BoolAspect enableChatInBottomToolBar{this};
Utils::BoolAspect enableChatInNavigationPanel{this};
Utils::BoolAspect useTools{this};
// General Parameters Settings
Utils::DoubleAspect temperature{this};

View File

@ -205,6 +205,21 @@ GeneralSettings::GeneralSettings()
caTemplateDescription.setDefaultValue("");
caTemplateDescription.setLabelText(TrConstants::CURRENT_TEMPLATE_DESCRIPTION);
useTools.setSettingsKey(Constants::CA_USE_TOOLS);
useTools.setLabelText(Tr::tr("Enable tools"));
useTools.setToolTip(
Tr::tr(
"Enable tool use capabilities for the assistant(OpenAI function calling, Claude tools "
"and etc) "
"if plugin and provider support"));
useTools.setDefaultValue(true);
allowFileSystemRead.setSettingsKey(Constants::CA_ALLOW_FILE_SYSTEM_READ);
allowFileSystemRead.setLabelText(Tr::tr("Allow File System Read Access for tools"));
allowFileSystemRead.setToolTip(
Tr::tr("Allow tools to read files from disk (project files, open editors)"));
allowFileSystemRead.setDefaultValue(true);
readSettings();
Logger::instance().setLoggingEnabled(enableLogging());
@ -247,8 +262,10 @@ GeneralSettings::GeneralSettings()
ccTemplateDescription,
Row{specifyPreset1, preset1Language, Stretch{1}},
ccPreset1Grid}};
auto caGroup
= Group{title(TrConstants::CHAT_ASSISTANT), Column{caGrid, caTemplateDescription}};
auto caGroup = Group{
title(TrConstants::CHAT_ASSISTANT),
Column{caGrid, Column{useTools, allowFileSystemRead}, caTemplateDescription}};
auto rootLayout = Column{
Row{enableQodeAssist, Stretch{1}, Row{checkUpdate, resetToDefaults}},
@ -492,6 +509,8 @@ void GeneralSettings::resetPageToDefaults()
resetAspect(ccPreset1CustomEndpoint);
resetAspect(caEndpointMode);
resetAspect(caCustomEndpoint);
resetAspect(useTools);
resetAspect(allowFileSystemRead);
writeSettings();
}
}

View File

@ -100,6 +100,9 @@ public:
Utils::StringAspect caStatus{this};
ButtonAspect caTest{this};
Utils::BoolAspect useTools{this};
Utils::BoolAspect allowFileSystemRead{this};
Utils::StringAspect caTemplateDescription{this};
void showSelectionDialog(

View File

@ -85,6 +85,7 @@ const char CC_CUSTOM_LANGUAGES[] = "QodeAssist.ccCustomLanguages";
const char CA_ENABLE_CHAT_IN_BOTTOM_TOOLBAR[] = "QodeAssist.caEnableChatInBottomToolbar";
const char CA_ENABLE_CHAT_IN_NAVIGATION_PANEL[] = "QodeAssist.caEnableChatInNavigationPanel";
const char CA_USE_TOOLS[] = "QodeAssist.caUseTools";
const char CA_ALLOW_FILE_SYSTEM_READ[] = "QodeAssist.caAllowFileSystemRead";
const char QODE_ASSIST_GENERAL_OPTIONS_ID[] = "QodeAssist.GeneralOptions";
const char QODE_ASSIST_GENERAL_SETTINGS_PAGE_ID[] = "QodeAssist.1GeneralSettingsPageId";