mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-09-08 11:58:53 +00:00
LocalDocs version 2 with text embeddings.
This commit is contained in:
@@ -21,7 +21,7 @@ MyDialog {
|
||||
id: listLabel
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
text: "Available LocalDocs Collections:"
|
||||
text: qsTr("Local Documents:")
|
||||
font.pixelSize: theme.fontSizeLarge
|
||||
color: theme.textColor
|
||||
}
|
||||
@@ -63,17 +63,60 @@ MyDialog {
|
||||
currentChat.removeCollection(collection)
|
||||
}
|
||||
}
|
||||
ToolTip.text: qsTr("Warning: searching collections while indexing can return incomplete results")
|
||||
ToolTip.visible: hovered && model.indexing
|
||||
}
|
||||
Text {
|
||||
id: collectionId
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: checkBox.right
|
||||
anchors.margins: 20
|
||||
anchors.leftMargin: 10
|
||||
text: collection
|
||||
font.pixelSize: theme.fontSizeLarge
|
||||
elide: Text.ElideRight
|
||||
color: theme.textColor
|
||||
}
|
||||
ProgressBar {
|
||||
id: itemProgressBar
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: collectionId.right
|
||||
anchors.right: parent.right
|
||||
anchors.margins: 20
|
||||
anchors.leftMargin: 40
|
||||
visible: model.indexing
|
||||
value: (model.totalBytesToIndex - model.currentBytesToIndex) / model.totalBytesToIndex
|
||||
background: Rectangle {
|
||||
implicitHeight: 45
|
||||
color: theme.backgroundDarkest
|
||||
radius: 3
|
||||
}
|
||||
contentItem: Item {
|
||||
implicitHeight: 40
|
||||
|
||||
Rectangle {
|
||||
width: itemProgressBar.visualPosition * parent.width
|
||||
height: parent.height
|
||||
radius: 2
|
||||
color: theme.assistantColor
|
||||
}
|
||||
}
|
||||
Accessible.role: Accessible.ProgressBar
|
||||
Accessible.name: qsTr("Indexing progressBar")
|
||||
Accessible.description: qsTr("Shows the progress made in the indexing")
|
||||
}
|
||||
Label {
|
||||
id: speedLabel
|
||||
color: theme.textColor
|
||||
visible: model.indexing
|
||||
anchors.verticalCenter: itemProgressBar.verticalCenter
|
||||
anchors.left: itemProgressBar.left
|
||||
anchors.right: itemProgressBar.right
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: qsTr("indexing...")
|
||||
elide: Text.ElideRight
|
||||
font.pixelSize: theme.fontSizeLarge
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@ import QtQuick.Controls.Basic
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Dialogs
|
||||
import localdocs
|
||||
import modellist
|
||||
import mysettings
|
||||
import network
|
||||
|
||||
@@ -13,7 +14,11 @@ MySettingsTab {
|
||||
MySettings.restoreLocalDocsDefaults();
|
||||
}
|
||||
|
||||
title: qsTr("LocalDocs Plugin (BETA)")
|
||||
property bool hasEmbeddingModel: ModelList.embeddingModels.count !== 0
|
||||
showAdvancedSettingsButton: hasEmbeddingModel
|
||||
showRestoreDefaultsButton: hasEmbeddingModel
|
||||
|
||||
title: qsTr("LocalDocs")
|
||||
contentItem: ColumnLayout {
|
||||
id: root
|
||||
spacing: 10
|
||||
@@ -21,7 +26,30 @@ MySettingsTab {
|
||||
property alias collection: collection.text
|
||||
property alias folder_path: folderEdit.text
|
||||
|
||||
Label {
|
||||
id: downloadLabel
|
||||
Layout.fillWidth: true
|
||||
Layout.maximumWidth: parent.width
|
||||
wrapMode: Text.Wrap
|
||||
visible: !hasEmbeddingModel
|
||||
Layout.alignment: Qt.AlignLeft
|
||||
text: qsTr("This feature requires the download of a text embedding model in order to index documents for later search. Please download the <b>SBert</a> text embedding model from the download dialog to proceed.")
|
||||
font.pixelSize: theme.fontSizeLarger
|
||||
}
|
||||
|
||||
MyButton {
|
||||
visible: !hasEmbeddingModel
|
||||
Layout.topMargin: 20
|
||||
Layout.alignment: Qt.AlignLeft
|
||||
text: qsTr("Download")
|
||||
font.pixelSize: theme.fontSizeLarger
|
||||
onClicked: {
|
||||
downloadClicked()
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
visible: hasEmbeddingModel
|
||||
Layout.fillWidth: true
|
||||
height: row.height
|
||||
RowLayout {
|
||||
@@ -106,6 +134,7 @@ MySettingsTab {
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
visible: hasEmbeddingModel
|
||||
spacing: 0
|
||||
Repeater {
|
||||
model: LocalDocs.localDocsModel
|
||||
@@ -145,29 +174,25 @@ MySettingsTab {
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.margins: 20
|
||||
width: Math.max(removeButton.width, busyIndicator.width)
|
||||
height: Math.max(removeButton.height, busyIndicator.height)
|
||||
width: removeButton.width
|
||||
height:removeButton.height
|
||||
MyButton {
|
||||
id: removeButton
|
||||
anchors.centerIn: parent
|
||||
text: qsTr("Remove")
|
||||
visible: !item.removing && installed
|
||||
visible: !item.removing
|
||||
onClicked: {
|
||||
item.removing = true
|
||||
LocalDocs.removeFolder(collection, folder_path)
|
||||
}
|
||||
}
|
||||
MyBusyIndicator {
|
||||
id: busyIndicator
|
||||
anchors.centerIn: parent
|
||||
visible: item.removing || !installed
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
visible: hasEmbeddingModel
|
||||
Label {
|
||||
id: showReferencesLabel
|
||||
text: qsTr("Show references:")
|
||||
@@ -186,6 +211,7 @@ MySettingsTab {
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
visible: hasEmbeddingModel
|
||||
Layout.fillWidth: true
|
||||
height: 1
|
||||
color: theme.tabBorder
|
||||
@@ -196,6 +222,7 @@ MySettingsTab {
|
||||
columns: 3
|
||||
rowSpacing: 10
|
||||
columnSpacing: 10
|
||||
visible: hasEmbeddingModel
|
||||
|
||||
Rectangle {
|
||||
Layout.row: 3
|
||||
|
@@ -16,9 +16,17 @@ MyDialog {
|
||||
modal: true
|
||||
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
|
||||
padding: 10
|
||||
property bool showEmbeddingModels: false
|
||||
|
||||
onOpened: {
|
||||
Network.sendModelDownloaderDialog();
|
||||
|
||||
if (showEmbeddingModels) {
|
||||
ModelList.downloadableModels.expanded = true
|
||||
var targetModelIndex = ModelList.defaultEmbeddingModelIndex
|
||||
console.log("targetModelIndex " + targetModelIndex)
|
||||
modelListView.positionViewAtIndex(targetModelIndex, ListView.Contain);
|
||||
}
|
||||
}
|
||||
|
||||
PopupDialog {
|
||||
|
@@ -9,8 +9,11 @@ Item {
|
||||
property string title: ""
|
||||
property Item contentItem: null
|
||||
property Item advancedSettings: null
|
||||
property bool showAdvancedSettingsButton: true
|
||||
property bool showRestoreDefaultsButton: true
|
||||
property var openFolderDialog
|
||||
signal restoreDefaultsClicked
|
||||
signal downloadClicked
|
||||
|
||||
onContentItemChanged: function() {
|
||||
if (contentItem) {
|
||||
@@ -64,6 +67,7 @@ Item {
|
||||
MyButton {
|
||||
id: restoreDefaultsButton
|
||||
anchors.left: parent.left
|
||||
visible: showRestoreDefaultsButton
|
||||
width: implicitWidth
|
||||
text: qsTr("Restore Defaults")
|
||||
font.pixelSize: theme.fontSizeLarge
|
||||
@@ -77,7 +81,7 @@ Item {
|
||||
MyButton {
|
||||
id: advancedSettingsButton
|
||||
anchors.right: parent.right
|
||||
visible: root.advancedSettings
|
||||
visible: root.advancedSettings && showAdvancedSettingsButton
|
||||
width: implicitWidth
|
||||
text: !advancedInner.visible ? qsTr("Advanced Settings") : qsTr("Hide Advanced Settings")
|
||||
font.pixelSize: theme.fontSizeLarge
|
||||
|
@@ -19,6 +19,8 @@ MyDialog {
|
||||
Network.sendSettingsDialog();
|
||||
}
|
||||
|
||||
signal downloadClicked
|
||||
|
||||
Item {
|
||||
Accessible.role: Accessible.Dialog
|
||||
Accessible.name: qsTr("Settings")
|
||||
@@ -28,13 +30,13 @@ MyDialog {
|
||||
ListModel {
|
||||
id: stacksModel
|
||||
ListElement {
|
||||
title: "Models"
|
||||
title: qsTr("Models")
|
||||
}
|
||||
ListElement {
|
||||
title: "Application"
|
||||
title: qsTr("Application")
|
||||
}
|
||||
ListElement {
|
||||
title: "Plugins"
|
||||
title: qsTr("LocalDocs")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,9 +109,16 @@ MyDialog {
|
||||
}
|
||||
|
||||
MySettingsStack {
|
||||
title: qsTr("LocalDocs Plugin (BETA) Settings")
|
||||
title: qsTr("Local Document Collections")
|
||||
tabs: [
|
||||
Component { LocalDocsSettings { } }
|
||||
Component {
|
||||
LocalDocsSettings {
|
||||
id: localDocsSettings
|
||||
Component.onCompleted: {
|
||||
localDocsSettings.downloadClicked.connect(settingsDialog.downloadClicked);
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user