From 9eaa706c2893aa6ba6681b3dc70f712c39068aba Mon Sep 17 00:00:00 2001 From: Adam Treat Date: Tue, 13 Aug 2024 14:48:34 -0400 Subject: [PATCH] Move to a brave search specific settings page. Signed-off-by: Adam Treat --- gpt4all-chat/CMakeLists.txt | 2 +- gpt4all-chat/bravesearch.h | 2 +- gpt4all-chat/localdocssearch.h | 2 +- ...olSettings.qml => BraveSearchSettings.qml} | 34 +++++++++++++++++-- gpt4all-chat/qml/SettingsView.qml | 4 +-- 5 files changed, 36 insertions(+), 8 deletions(-) rename gpt4all-chat/qml/{ToolSettings.qml => BraveSearchSettings.qml} (59%) diff --git a/gpt4all-chat/CMakeLists.txt b/gpt4all-chat/CMakeLists.txt index 0e07458573921..9ee076c90f278 100644 --- a/gpt4all-chat/CMakeLists.txt +++ b/gpt4all-chat/CMakeLists.txt @@ -138,6 +138,7 @@ qt_add_qml_module(chat qml/AddCollectionView.qml qml/AddModelView.qml qml/ApplicationSettings.qml + qml/BraveSearchSettings.qml qml/ChatDrawer.qml qml/ChatView.qml qml/CollectionsDrawer.qml @@ -156,7 +157,6 @@ qt_add_qml_module(chat qml/ThumbsDownDialog.qml qml/Toast.qml qml/ToastManager.qml - qml/ToolSettings.qml qml/MyBusyIndicator.qml qml/MyButton.qml qml/MyCheckBox.qml diff --git a/gpt4all-chat/bravesearch.h b/gpt4all-chat/bravesearch.h index 45cd0a6e93332..7450b7c8d6f1e 100644 --- a/gpt4all-chat/bravesearch.h +++ b/gpt4all-chat/bravesearch.h @@ -48,7 +48,7 @@ class BraveSearch : public Tool { ToolEnums::Error error() const override { return m_error; } QString errorString() const override { return m_errorString; } - QString name() const override { return tr("Brave web search"); } + QString name() const override { return tr("Brave Web Search"); } QString description() const override { return tr("Search the web using brave"); } QString function() const override { return "brave_search"; } QJsonObject paramSchema() const override; diff --git a/gpt4all-chat/localdocssearch.h b/gpt4all-chat/localdocssearch.h index 66c63414521ca..b4ea3e94b0a0c 100644 --- a/gpt4all-chat/localdocssearch.h +++ b/gpt4all-chat/localdocssearch.h @@ -34,7 +34,7 @@ class LocalDocsSearch : public Tool { ToolEnums::Error error() const override { return m_error; } QString errorString() const override { return m_errorString; } - QString name() const override { return tr("LocalDocs search"); } + QString name() const override { return tr("LocalDocs Search"); } QString description() const override { return tr("Search the local docs"); } QString function() const override { return "localdocs_search"; } QJsonObject paramSchema() const override; diff --git a/gpt4all-chat/qml/ToolSettings.qml b/gpt4all-chat/qml/BraveSearchSettings.qml similarity index 59% rename from gpt4all-chat/qml/ToolSettings.qml rename to gpt4all-chat/qml/BraveSearchSettings.qml index f9b5e72776624..bc189248ea382 100644 --- a/gpt4all-chat/qml/ToolSettings.qml +++ b/gpt4all-chat/qml/BraveSearchSettings.qml @@ -16,7 +16,7 @@ MySettingsTab { showRestoreDefaultsButton: true - title: qsTr("Tools") + title: qsTr("Brave Web Search") contentItem: ColumnLayout { id: root spacing: 30 @@ -27,7 +27,7 @@ MySettingsTab { color: theme.grayRed900 font.pixelSize: theme.fontSizeLarge font.bold: true - text: qsTr("Brave Search") + text: qsTr("Brave Web Search") } Rectangle { @@ -37,6 +37,33 @@ MySettingsTab { } } + RowLayout { + MySettingsLabel { + id: usageModeLabel + text: qsTr("Usage Mode") + helpText: qsTr("When and how the brave search tool is executed.") + } + MyComboBox { + id: usageModeBox + Layout.minimumWidth: 400 + Layout.maximumWidth: 400 + Layout.alignment: Qt.AlignRight + // NOTE: indices match values of UsageMode enum, keep them in sync + model: ListModel { + ListElement { name: qsTr("Never") } + ListElement { name: qsTr("Model decides") } + ListElement { name: qsTr("Ask for confirmation before executing") } + ListElement { name: qsTr("Force usage for every response when possible") } + } + Accessible.name: usageModeLabel.text + Accessible.description: usageModeLabel.helpText + onActivated: { + } + Component.onCompleted: { + } + } + } + RowLayout { MySettingsLabel { id: apiKeyLabel @@ -51,7 +78,8 @@ MySettingsTab { color: theme.textColor font.pixelSize: theme.fontSizeLarge Layout.alignment: Qt.AlignRight - Layout.minimumWidth: 200 + Layout.minimumWidth: 400 + Layout.maximumWidth: 400 onEditingFinished: { MySettings.braveSearchAPIKey = apiKeyField.text; } diff --git a/gpt4all-chat/qml/SettingsView.qml b/gpt4all-chat/qml/SettingsView.qml index d421dad2f9ed3..587a31b2901c0 100644 --- a/gpt4all-chat/qml/SettingsView.qml +++ b/gpt4all-chat/qml/SettingsView.qml @@ -35,7 +35,7 @@ Rectangle { title: qsTr("LocalDocs") } ListElement { - title: qsTr("Tools") + title: qsTr("Brave Web Search") } } @@ -158,7 +158,7 @@ Rectangle { MySettingsStack { tabs: [ - Component { ToolSettings { } } + Component { BraveSearchSettings { } } ] } }