mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-09-12 14:01:38 +00:00
Complete the settings for localdocs.
This commit is contained in:
@@ -8,9 +8,31 @@ import localdocs
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property string collection: ""
|
||||
property string folder_path: ""
|
||||
|
||||
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"
|
||||
@@ -188,6 +210,21 @@ 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()
|
||||
validator: IntValidator {
|
||||
bottom: 1
|
||||
}
|
||||
onEditingFinished: {
|
||||
var val = parseInt(text)
|
||||
if (!isNaN(val)) {
|
||||
settings.chunkSize = val
|
||||
settings.sync()
|
||||
focus = false
|
||||
LocalDocs.chunkSize = settings.chunkSize
|
||||
} else {
|
||||
text = settings.chunkSize.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
@@ -203,6 +240,21 @@ 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()
|
||||
validator: IntValidator {
|
||||
bottom: 1
|
||||
}
|
||||
onEditingFinished: {
|
||||
var val = parseInt(text)
|
||||
if (!isNaN(val)) {
|
||||
settings.retrievalSize = val
|
||||
settings.sync()
|
||||
focus = false
|
||||
LocalDocs.retrievalSize = settings.retrievalSize
|
||||
} else {
|
||||
text = settings.retrievalSize.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MyButton {
|
||||
@@ -215,7 +267,7 @@ Item {
|
||||
Accessible.name: text
|
||||
Accessible.description: qsTr("Restores the settings dialog to a default state")
|
||||
onClicked: {
|
||||
// settingsDialog.restoreGenerationDefaults()
|
||||
root.restoreLocalDocsDefaults();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user