Move to a brave search specific settings page.

Signed-off-by: Adam Treat <treat.adam@gmail.com>
This commit is contained in:
Adam Treat 2024-08-13 14:48:34 -04:00
parent 48117cda46
commit a6730879dd
5 changed files with 36 additions and 8 deletions

View File

@ -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

View File

@ -48,7 +48,7 @@ public:
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;

View File

@ -34,7 +34,7 @@ public:
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;

View File

@ -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;
}

View File

@ -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 { } }
]
}
}