Add more of the UI for selecting collections for chats.

This commit is contained in:
Adam Treat
2023-05-23 14:51:14 -04:00
committed by AT
parent 2827c5876c
commit 01b8c7617f
8 changed files with 182 additions and 9 deletions

View File

@@ -0,0 +1,86 @@
import QtCore
import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Basic
import QtQuick.Layouts
import QtQuick.Dialogs
import localdocs
import llm
Dialog {
id: collectionsDialog
modal: true
opacity: 0.9
padding: 20
width: 480
height: 640
property var currentChat: LLM.chatListModel.currentChat
background: Rectangle {
anchors.fill: parent
color: theme.backgroundDarkest
border.width: 1
border.color: theme.dialogBorder
radius: 10
}
Label {
id: listLabel
anchors.top: parent.top
anchors.left: parent.left
text: "Available Collections:"
color: theme.textColor
}
ScrollView {
id: scrollView
anchors.top: listLabel.bottom
anchors.topMargin: 20
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
clip: true
contentHeight: 300
ScrollBar.vertical.policy: ScrollBar.AlwaysOn
background: Rectangle {
color: theme.backgroundLighter
}
ListView {
id: listView
model: LocalDocs.localDocsModel
boundsBehavior: Flickable.StopAtBounds
delegate: Rectangle {
id: item
width: listView.width
height: collectionId.height + 40
color: index % 2 === 0 ? theme.backgroundLight : theme.backgroundLighter
MyCheckBox {
id: checkBox
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.margins: 20
checked: currentChat.hasCollection(collection)
onClicked: {
if (checkBox.checked) {
currentChat.addCollection(collection)
} else {
currentChat.removeCollection(collection)
}
}
}
Text {
id: collectionId
anchors.verticalCenter: parent.verticalCenter
anchors.left: checkBox.right
anchors.margins: 20
text: collection
elide: Text.ElideRight
color: theme.textColor
}
}
}
}
}

View File

@@ -186,7 +186,7 @@ Item {
id: chunkSizeTextField
Layout.row: 0
Layout.column: 1
ToolTip.text: qsTr("Number of characters per document snippet. NOTE: 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
}
@@ -201,7 +201,7 @@ Item {
MyTextField {
Layout.row: 1
Layout.column: 1
ToolTip.text: qsTr("Best N matches of retrieved document snippets to add to the context for prompt. NOTE: 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
}

View File

@@ -225,8 +225,7 @@ Dialog {
contentItem: IconLabel {
color: theme.textColor
font.bold: localDocsButton.checked
font.pixelSize: localDocsButton.checked ? theme.fontSizeLarger : theme.fontSizeLarge
text: qsTr("Local Docs Plugin")
text: qsTr("LocalDocs Plugin (BETA)")
}
background: Rectangle {
color: localDocsButton.checked ? theme.backgroundDarkest : theme.backgroundLight