Provide a more stark warning for localdocs and add more size to dialogs.

This commit is contained in:
Adam Treat 2023-06-26 12:58:33 -04:00
parent 1b5aa4617f
commit 71c972f8fa
2 changed files with 109 additions and 83 deletions

View File

@ -282,8 +282,8 @@ Window {
SettingsDialog { SettingsDialog {
id: settingsDialog id: settingsDialog
anchors.centerIn: parent anchors.centerIn: parent
width: Math.min(1024, window.width - (window.width * .2)) width: Math.min(1280, window.width - (window.width * .1))
height: Math.min(600, window.height - (window.height * .2)) height: window.height - (window.height * .1)
} }
Button { Button {
@ -589,8 +589,8 @@ Window {
ModelDownloaderDialog { ModelDownloaderDialog {
id: downloadNewModels id: downloadNewModels
anchors.centerIn: parent anchors.centerIn: parent
width: Math.min(1024, window.width - (window.width * .2)) width: Math.min(1280, window.width - (window.width * .1))
height: window.height - (window.height * .2) height: window.height - (window.height * .1)
Item { Item {
Accessible.role: Accessible.Dialog Accessible.role: Accessible.Dialog
Accessible.name: qsTr("Download new models dialog") Accessible.name: qsTr("Download new models dialog")
@ -601,7 +601,7 @@ Window {
ChatDrawer { ChatDrawer {
id: drawer id: drawer
y: header.height y: header.height
width: 0.3 * window.width width: Math.min(600, 0.3 * window.width)
height: window.height - y height: window.height - y
onDownloadClicked: { onDownloadClicked: {
downloadNewModels.open() downloadNewModels.open()

View File

@ -49,83 +49,78 @@ Item {
height: collection.height + 20 height: collection.height + 20
color: theme.backgroundDark color: theme.backgroundDark
MyTextField { RowLayout {
id: collection
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left anchors.left: parent.left
width: 225
horizontalAlignment: Text.AlignJustify
color: theme.textColor
placeholderText: qsTr("Collection name...")
placeholderTextColor: theme.mutedTextColor
ToolTip.text: qsTr("Name of the collection to add (Required)")
ToolTip.visible: hovered
Accessible.role: Accessible.EditableText
Accessible.name: collection.text
Accessible.description: ToolTip.text
function showError() {
collection.placeholderTextColor = theme.textErrorColor
}
onTextChanged: {
collection.placeholderTextColor = theme.mutedTextColor
}
}
MyDirectoryField {
id: folderEdit
anchors.left: collection.right
anchors.leftMargin: 10
anchors.right: browseButton.left
anchors.rightMargin: 10
anchors.verticalCenter: parent.verticalCenter
text: root.folder_path
placeholderText: qsTr("Folder path...")
placeholderTextColor: theme.mutedTextColor
ToolTip.text: qsTr("Folder path to documents (Required)")
ToolTip.visible: hovered
function showError() {
folderEdit.placeholderTextColor = theme.textErrorColor
}
onTextChanged: {
folderEdit.placeholderTextColor = theme.mutedTextColor
}
}
MyButton {
id: browseButton
text: qsTr("Browse")
anchors.right: addButton.left
anchors.rightMargin: 10
anchors.verticalCenter: parent.verticalCenter
onClicked: {
folderDialog.open();
}
}
MyButton {
id: addButton
text: qsTr("Add")
anchors.right: parent.right anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter spacing: 10
Accessible.role: Accessible.Button MyTextField {
Accessible.name: text id: collection
Accessible.description: qsTr("Add button") width: 225
onClicked: { horizontalAlignment: Text.AlignJustify
var isError = false; color: theme.textColor
if (root.collection === "") { placeholderText: qsTr("Collection name...")
isError = true; placeholderTextColor: theme.mutedTextColor
collection.showError(); ToolTip.text: qsTr("Name of the collection to add (Required)")
ToolTip.visible: hovered
Accessible.role: Accessible.EditableText
Accessible.name: collection.text
Accessible.description: ToolTip.text
function showError() {
collection.placeholderTextColor = theme.textErrorColor
} }
if (root.folder_path === "" || !folderEdit.isValid) { onTextChanged: {
isError = true; collection.placeholderTextColor = theme.mutedTextColor
folderEdit.showError(); }
}
MyDirectoryField {
id: folderEdit
Layout.fillWidth: true
text: root.folder_path
placeholderText: qsTr("Folder path...")
placeholderTextColor: theme.mutedTextColor
ToolTip.text: qsTr("Folder path to documents (Required)")
ToolTip.visible: hovered
function showError() {
folderEdit.placeholderTextColor = theme.textErrorColor
}
onTextChanged: {
folderEdit.placeholderTextColor = theme.mutedTextColor
}
}
MyButton {
id: browseButton
text: qsTr("Browse")
onClicked: {
folderDialog.open();
}
}
MyButton {
id: addButton
text: qsTr("Add")
Accessible.role: Accessible.Button
Accessible.name: text
Accessible.description: qsTr("Add button")
onClicked: {
var isError = false;
if (root.collection === "") {
isError = true;
collection.showError();
}
if (root.folder_path === "" || !folderEdit.isValid) {
isError = true;
folderEdit.showError();
}
if (isError)
return;
LocalDocs.addFolder(root.collection, root.folder_path)
root.collection = ""
root.folder_path = ""
collection.clear()
} }
if (isError)
return;
LocalDocs.addFolder(root.collection, root.folder_path)
root.collection = ""
root.folder_path = ""
collection.clear()
} }
} }
} }
@ -213,9 +208,27 @@ Item {
rowSpacing: 10 rowSpacing: 10
columnSpacing: 10 columnSpacing: 10
Rectangle {
Layout.row: 0
Layout.column: 0
Layout.fillWidth: true
Layout.columnSpan: 3
height: 1
color: theme.dialogBorder
}
Rectangle {
Layout.row: 3
Layout.column: 0
Layout.fillWidth: true
Layout.columnSpan: 3
height: 1
color: theme.dialogBorder
}
Label { Label {
id: chunkLabel id: chunkLabel
Layout.row: 0 Layout.row: 1
Layout.column: 0 Layout.column: 0
color: theme.textColor color: theme.textColor
text: qsTr("Document snippet size (characters):") text: qsTr("Document snippet size (characters):")
@ -223,7 +236,7 @@ Item {
MyTextField { MyTextField {
id: chunkSizeTextField id: chunkSizeTextField
Layout.row: 0 Layout.row: 1
Layout.column: 1 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.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 ToolTip.visible: hovered
@ -246,14 +259,14 @@ Item {
Label { Label {
id: contextItemsPerPrompt id: contextItemsPerPrompt
Layout.row: 1 Layout.row: 2
Layout.column: 0 Layout.column: 0
color: theme.textColor color: theme.textColor
text: qsTr("Document snippets to process per prompt:") text: qsTr("Document snippets per prompt:")
} }
MyTextField { MyTextField {
Layout.row: 1 Layout.row: 2
Layout.column: 1 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.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 ToolTip.visible: hovered
@ -274,10 +287,23 @@ Item {
} }
} }
Label {
id: warningLabel
Layout.row: 1
Layout.column: 2
Layout.rowSpan: 2
Layout.maximumWidth: 330
Layout.alignment: Qt.AlignTop
color: theme.textErrorColor
wrapMode: Text.WordWrap
text: qsTr("Warning: Advanced users only. Values too large may cause localdocs to fail or result in extremely slow responses.")
}
MyButton { MyButton {
id: restoreDefaultsButton id: restoreDefaultsButton
Layout.row: 2 Layout.row: 4
Layout.column: 1 Layout.column: 1
Layout.columnSpan: 2
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr("Restore Defaults") text: qsTr("Restore Defaults")
Accessible.role: Accessible.Button Accessible.role: Accessible.Button