LocalDocs version 2 with text embeddings.

This commit is contained in:
Adam Treat
2023-10-24 12:13:32 -04:00
committed by AT
parent d4ce9f4a7c
commit 371e2a5cbc
30 changed files with 3540 additions and 164 deletions

View File

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