mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-09-13 14:29:19 +00:00
This completes the work of consolidating all settings that can be changed by the user on new settings object.
This commit is contained in:
@@ -5,6 +5,7 @@ import QtQuick.Controls.Basic
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Dialogs
|
||||
import localdocs
|
||||
import mysettings
|
||||
|
||||
Item {
|
||||
id: root
|
||||
@@ -12,27 +13,6 @@ Item {
|
||||
property alias collection: collection.text
|
||||
property alias folder_path: folderEdit.text
|
||||
|
||||
property int defaultChunkSize: 256
|
||||
property int defaultRetrievalSize: 3
|
||||
|
||||
property alias chunkSize: settings.chunkSize
|
||||
property alias retrievalSize: settings.retrievalSize
|
||||
|
||||
Settings {
|
||||
id: settings
|
||||
category: "localdocs"
|
||||
property int chunkSize: root.defaultChunkSize
|
||||
property int retrievalSize: root.defaultRetrievalSize
|
||||
}
|
||||
|
||||
function restoreLocalDocsDefaults() {
|
||||
settings.chunkSize = root.defaultChunkSize
|
||||
settings.retrievalSize = root.defaultRetrievalSize
|
||||
LocalDocs.chunkSize = settings.chunkSize
|
||||
LocalDocs.retrievalSize = settings.retrievalSize
|
||||
settings.sync()
|
||||
}
|
||||
|
||||
FolderDialog {
|
||||
id: folderDialog
|
||||
title: "Please choose a directory"
|
||||
@@ -240,19 +220,17 @@ Item {
|
||||
Layout.column: 1
|
||||
ToolTip.text: qsTr("Number of characters per document snippet.\nNOTE: larger numbers increase likelihood of factual responses, but also result in slower generation.")
|
||||
ToolTip.visible: hovered
|
||||
text: settings.chunkSize.toString()
|
||||
text: MySettings.localDocsChunkSize
|
||||
validator: IntValidator {
|
||||
bottom: 1
|
||||
}
|
||||
onEditingFinished: {
|
||||
var val = parseInt(text)
|
||||
if (!isNaN(val)) {
|
||||
settings.chunkSize = val
|
||||
settings.sync()
|
||||
MySettings.localDocsChunkSize = val
|
||||
focus = false
|
||||
LocalDocs.chunkSize = settings.chunkSize
|
||||
} else {
|
||||
text = settings.chunkSize.toString()
|
||||
text = MySettings.localDocsChunkSize
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -270,19 +248,17 @@ Item {
|
||||
Layout.column: 1
|
||||
ToolTip.text: qsTr("Best N matches of retrieved document snippets to add to the context for prompt.\nNOTE: larger numbers increase likelihood of factual responses, but also result in slower generation.")
|
||||
ToolTip.visible: hovered
|
||||
text: settings.retrievalSize.toString()
|
||||
text: MySettings.localDocsRetrievalSize
|
||||
validator: IntValidator {
|
||||
bottom: 1
|
||||
}
|
||||
onEditingFinished: {
|
||||
var val = parseInt(text)
|
||||
if (!isNaN(val)) {
|
||||
settings.retrievalSize = val
|
||||
settings.sync()
|
||||
MySettings.localDocsRetrievalSize = val
|
||||
focus = false
|
||||
LocalDocs.retrievalSize = settings.retrievalSize
|
||||
} else {
|
||||
text = settings.retrievalSize.toString()
|
||||
text = MySettings.localDocsRetrievalSize
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -311,7 +287,7 @@ Item {
|
||||
Accessible.name: text
|
||||
Accessible.description: qsTr("Restores the settings dialog to a default state")
|
||||
onClicked: {
|
||||
root.restoreLocalDocsDefaults();
|
||||
MySettings.restoreLocalDocsDefaults();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -6,6 +6,7 @@ import QtQuick.Layouts
|
||||
import download
|
||||
import network
|
||||
import llm
|
||||
import mysettings
|
||||
|
||||
Dialog {
|
||||
id: networkDialog
|
||||
@@ -18,16 +19,6 @@ Dialog {
|
||||
id: theme
|
||||
}
|
||||
|
||||
Settings {
|
||||
id: settings
|
||||
category: "network"
|
||||
property string attribution: ""
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
settings.sync()
|
||||
}
|
||||
|
||||
Column {
|
||||
id: column
|
||||
spacing: 20
|
||||
@@ -86,7 +77,7 @@ NOTE: By turning on this feature, you will be sending your data to the GPT4All O
|
||||
color: theme.textColor
|
||||
padding: 20
|
||||
width: parent.width
|
||||
text: settings.attribution
|
||||
text: MySettings.networkAttribution
|
||||
font.pixelSize: theme.fontSizeLarge
|
||||
placeholderText: qsTr("Please provide a name for attribution (optional)")
|
||||
placeholderTextColor: theme.backgroundLightest
|
||||
@@ -98,8 +89,7 @@ NOTE: By turning on this feature, you will be sending your data to the GPT4All O
|
||||
Accessible.name: qsTr("Attribution (optional)")
|
||||
Accessible.description: qsTr("Textfield for providing attribution")
|
||||
onEditingFinished: {
|
||||
settings.attribution = attribution.text;
|
||||
settings.sync();
|
||||
MySettings.networkAttribution = attribution.text;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,16 +123,16 @@ NOTE: By turning on this feature, you will be sending your data to the GPT4All O
|
||||
}
|
||||
|
||||
onAccepted: {
|
||||
if (Network.isActive)
|
||||
if (MySettings.networkIsActive)
|
||||
return
|
||||
Network.isActive = true;
|
||||
MySettings.networkIsActive = true;
|
||||
Network.sendNetworkToggled(true);
|
||||
}
|
||||
|
||||
onRejected: {
|
||||
if (!Network.isActive)
|
||||
if (!MySettings.networkIsActive)
|
||||
return
|
||||
Network.isActive = false;
|
||||
MySettings.networkIsActive = false;
|
||||
Network.sendNetworkToggled(false);
|
||||
}
|
||||
}
|
||||
|
@@ -6,6 +6,7 @@ import QtQuick.Layouts
|
||||
import download
|
||||
import network
|
||||
import llm
|
||||
import mysettings
|
||||
|
||||
Dialog {
|
||||
id: startupDialog
|
||||
@@ -135,7 +136,7 @@ model release that uses your data!")
|
||||
ButtonGroup {
|
||||
buttons: optInStatisticsRadio.children
|
||||
onClicked: {
|
||||
Network.usageStatsActive = optInStatisticsRadio.checked
|
||||
MySettings.networkUsageStatsActive = optInStatisticsRadio.checked
|
||||
if (optInNetworkRadio.choiceMade && optInStatisticsRadio.choiceMade)
|
||||
startupDialog.close();
|
||||
}
|
||||
@@ -246,7 +247,7 @@ model release that uses your data!")
|
||||
ButtonGroup {
|
||||
buttons: optInNetworkRadio.children
|
||||
onClicked: {
|
||||
Network.isActive = optInNetworkRadio.checked
|
||||
MySettings.networkIsActive = optInNetworkRadio.checked
|
||||
if (optInNetworkRadio.choiceMade && optInStatisticsRadio.choiceMade)
|
||||
startupDialog.close();
|
||||
}
|
||||
|
Reference in New Issue
Block a user