Changes to the UI and icons.

Signed-off-by: Adam Treat <treat.adam@gmail.com>
This commit is contained in:
Adam Treat
2024-04-01 10:53:34 -04:00
committed by AT
parent 9c23d44ad3
commit 77d5adfb02
15 changed files with 268 additions and 322 deletions

View File

@@ -21,6 +21,8 @@ Rectangle {
property var currentChat: ChatListModel.currentChat
property var chatModel: currentChat.chatModel
signal settingsViewRequested(int page)
signal downloadViewRequested(bool showEmbeddingModels)
color: theme.black
@@ -36,13 +38,6 @@ Rectangle {
}
}
Connections {
target: downloadNewModels
function onClosed() {
startupDialogs();
}
}
Connections {
target: Download
function onHasNewerReleaseChanged() {
@@ -90,15 +85,15 @@ Rectangle {
return;
}
// check for any current models and if not, open download dialog once
// check for any current models and if not, open download view once
if (!hasShownModelDownload && ModelList.installedModels.count === 0 && !firstStartDialog.opened) {
downloadNewModels.open();
downloadViewRequested();
hasShownModelDownload = true;
return;
}
// check for new version
if (Download.hasNewerRelease && !firstStartDialog.opened && !downloadNewModels.opened) {
if (Download.hasNewerRelease && !firstStartDialog.opened) {
newVersionDialog.open();
return;
}
@@ -296,22 +291,29 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter
spacing: 20
MyToolButton {
id: drawerButton
Rectangle {
Layout.alignment: Qt.AlignLeft
Layout.leftMargin: 30
backgroundColor: theme.iconBackgroundLight
width: 40
height: 40
scale: 1.5
z: 200
padding: 15
source: conversation.state === "expanded" ? "qrc:/gpt4all/icons/left_panel_open.svg" : "qrc:/gpt4all/icons/left_panel_closed.svg"
Accessible.role: Accessible.ButtonMenu
Accessible.name: qsTr("Chat panel")
Accessible.description: qsTr("Chat panel with options")
onClicked: {
conversation.toggleLeftPanel()
Layout.fillWidth: true
Layout.preferredWidth: 100
Layout.topMargin: 20
color: "transparent"
Layout.preferredHeight: childrenRect.height
MyToolButton {
id: drawerButton
anchors.left: parent.left
backgroundColor: theme.iconBackgroundLight
width: 40
height: 40
scale: 1.5
padding: 15
source: conversation.state === "expanded" ? "qrc:/gpt4all/icons/left_panel_open.svg" : "qrc:/gpt4all/icons/left_panel_closed.svg"
Accessible.role: Accessible.ButtonMenu
Accessible.name: qsTr("Chat panel")
Accessible.description: qsTr("Chat panel with options")
onClicked: {
conversation.toggleLeftPanel()
}
}
}
@@ -320,7 +322,7 @@ Rectangle {
Layout.alignment: Qt.AlignHCenter
Layout.fillHeight: true
Layout.fillWidth: true
Layout.minimumWidth: 375
Layout.preferredWidth: 100
Layout.maximumWidth: 675
enabled: !currentChat.isServer
&& !window.trySwitchContextInProgress
@@ -478,86 +480,67 @@ Rectangle {
}
}
RowLayout {
Rectangle {
color: "transparent"
Layout.alignment: Qt.AlignRight
Layout.rightMargin: 30
spacing: 20
Layout.fillWidth: true
Layout.preferredWidth: 100
Layout.preferredHeight: childrenRect.height
Layout.topMargin: 20
MyToolButton {
id: resetContextButton
backgroundColor: theme.iconBackgroundLight
width: 40
height: 40
z: 200
padding: 15
source: "qrc:/gpt4all/icons/regenerate.svg"
RowLayout {
spacing: 20
anchors.right: parent.right
MyButton {
id: collectionsButton
Image {
id: collectionsImage
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 15
width: 24
height: 24
mipmap: true
source: "qrc:/gpt4all/icons/db.svg"
}
Accessible.name: text
Accessible.description: qsTr("Reset the context and erase current conversation")
ColorOverlay {
anchors.fill: collectionsImage
source: collectionsImage
color: collectionsButton.hovered || collectionsImage.toggled ? theme.iconBackgroundHovered : theme.iconBackgroundLight
}
onClicked: {
Network.sendResetContext(chatModel.count)
currentChat.reset();
currentChat.processSystemPrompt();
}
}
leftPadding: 50
borderWidth: 0
backgroundColor: theme.mainComboBackground
backgroundColorHovered: theme.conversationButtonBackgroundHovered
backgroundRadius: 5
padding: 15
topPadding: 8
bottomPadding: 8
textColor: hovered || toggled ? theme.iconBackgroundHovered : theme.iconBackgroundLight
text: qsTr("local docs")
fontPixelSize: theme.fontSizeSmall
MyToolButton {
id: copyButton
backgroundColor: theme.iconBackgroundLight
width: 40
height: 40
z: 200
padding: 15
source: "qrc:/gpt4all/icons/copy.svg"
Accessible.name: qsTr("Copy")
Accessible.description: qsTr("Copy the conversation to the clipboard")
property bool toggled: currentChat.collectionList.length
background: Rectangle {
radius: collectionsButton.backgroundRadius
color: collectionsButton.toggled ? collectionsButton.backgroundColorHovered : collectionsButton.backgroundColor
}
TextEdit{
id: copyEdit
visible: false
}
Accessible.name: qsTr("Add documents")
Accessible.description: qsTr("add collections of documents to the chat")
onClicked: {
var conversation = getConversation()
copyEdit.text = conversation
copyEdit.selectAll()
copyEdit.copy()
copyMessage.open()
}
}
MyToolButton {
id: collectionsButton
backgroundColor: theme.iconBackgroundLight
width: 40
height: 42.5
z: 200
padding: 15
toggled: currentChat.collectionList.length
source: "qrc:/gpt4all/icons/db.svg"
Accessible.name: qsTr("Add documents")
Accessible.description: qsTr("add collections of documents to the chat")
onClicked: {
collectionsDialog.open()
onClicked: {
collectionsDialog.open()
}
}
}
}
}
}
SettingsDialog {
id: settingsDialog
anchors.centerIn: parent
width: Math.min(1920, window.width - (window.width * .1))
height: window.height - (window.height * .1)
onDownloadClicked: {
downloadNewModels.showEmbeddingModels = true
downloadNewModels.open()
}
}
Connections {
target: Network
function onHealthCheckFailed(code) {
@@ -569,8 +552,7 @@ Rectangle {
id: collectionsDialog
anchors.centerIn: parent
onAddRemoveClicked: {
settingsDialog.pageToDisplay = 2;
settingsDialog.open();
settingsViewRequested(2 /*page 2*/)
}
}
@@ -680,18 +662,6 @@ Rectangle {
}
}
ModelDownloaderDialog {
id: downloadNewModels
anchors.centerIn: parent
width: Math.min(1920, window.width - (window.width * .1))
height: window.height - (window.height * .1)
Item {
Accessible.role: Accessible.Dialog
Accessible.name: qsTr("Download new models")
Accessible.description: qsTr("Dialog for downloading new models")
}
}
ChatDrawer {
id: drawer
anchors.left: parent.left
@@ -877,7 +847,7 @@ Rectangle {
padding: 18
leftPadding: 50
Image {
id: image
id: downloadImage
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: 15
@@ -887,12 +857,13 @@ Rectangle {
source: "qrc:/gpt4all/icons/download.svg"
}
ColorOverlay {
anchors.fill: image
source: image
anchors.fill: downloadImage
source: downloadImage
color: theme.accentColor
}
onClicked: {
downloadNewModels.open();
console.log("download button")
downloadViewRequested(false /*showEmbeddingModels*/);
}
}
}