diff --git a/gpt4all-chat/CMakeLists.txt b/gpt4all-chat/CMakeLists.txt index d2576f4f..0c627840 100644 --- a/gpt4all-chat/CMakeLists.txt +++ b/gpt4all-chat/CMakeLists.txt @@ -131,6 +131,7 @@ qt_add_qml_module(chat icons/send_message.svg icons/stop_generating.svg icons/regenerate.svg + icons/chat.svg icons/close.svg icons/copy.svg icons/db.svg @@ -139,6 +140,8 @@ qt_add_qml_module(chat icons/eject.svg icons/edit.svg icons/image.svg + icons/info.svg + icons/search.svg icons/trash.svg icons/network.svg icons/thumbs_up.svg diff --git a/gpt4all-chat/icons/chat.svg b/gpt4all-chat/icons/chat.svg new file mode 100644 index 00000000..14f264e2 --- /dev/null +++ b/gpt4all-chat/icons/chat.svg @@ -0,0 +1,6 @@ + + + diff --git a/gpt4all-chat/icons/info.svg b/gpt4all-chat/icons/info.svg new file mode 100644 index 00000000..3c68311e --- /dev/null +++ b/gpt4all-chat/icons/info.svg @@ -0,0 +1,6 @@ + + + diff --git a/gpt4all-chat/icons/search.svg b/gpt4all-chat/icons/search.svg new file mode 100644 index 00000000..bae556fc --- /dev/null +++ b/gpt4all-chat/icons/search.svg @@ -0,0 +1,6 @@ + + + diff --git a/gpt4all-chat/main.qml b/gpt4all-chat/main.qml index c9d0ad67..9bcbd94e 100644 --- a/gpt4all-chat/main.qml +++ b/gpt4all-chat/main.qml @@ -43,6 +43,48 @@ Window { font.pixelSize: theme.fontSizeLarge } + 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() + } + } + + 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") + } + } + + NetworkDialog { + id: networkDialog + anchors.centerIn: parent + width: Math.min(1024, window.width - (window.width * .2)) + height: Math.min(600, window.height - (window.height * .2)) + Item { + Accessible.role: Accessible.Dialog + Accessible.name: qsTr("Network dialog") + Accessible.description: qsTr("opt-in to share feedback/conversations") + } + } + + AboutDialog { + id: aboutDialog + anchors.centerIn: parent + width: Math.min(1024, window.width - (window.width * .2)) + height: Math.min(600, window.height - (window.height * .2)) + } + onClosing: function(close) { if (window.hasSaved) return; @@ -63,7 +105,123 @@ Window { color: theme.black + Rectangle { + id: viewBar + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.left: parent.left + width: 80 + color: theme.viewBarBackground + + ColumnLayout { + id: viewsLayout + anchors.top: parent.top + anchors.topMargin: 30 + anchors.horizontalCenter: parent.horizontalCenter + Layout.margins: 0 + spacing: 25 + + MyToolButton { + id: chatButton + backgroundColor: toggled ? theme.iconBackgroundViewBarToggled : theme.iconBackgroundViewBar + backgroundColorHovered: theme.iconBackgroundViewBarHovered + toggledWidth: 0 + toggled: true + Layout.preferredWidth: 50 + Layout.preferredHeight: 50 + scale: 1.5 + source: "qrc:/gpt4all/icons/chat.svg" + Accessible.name: qsTr("Chat view") + Accessible.description: qsTr("Chat view to interact with models") + onClicked: { + } + } + + MyToolButton { + id: searchButton + backgroundColor: theme.iconBackgroundViewBar + backgroundColorHovered: theme.iconBackgroundViewBarHovered + Layout.preferredWidth: 50 + Layout.preferredHeight: 50 + scale: 1.5 + source: "qrc:/gpt4all/icons/search.svg" + Accessible.name: qsTr("Search") + Accessible.description: qsTr("Launch a dialog to download new models") + onClicked: { + downloadNewModels.showEmbeddingModels = false + downloadNewModels.open() + } + } + + MyToolButton { + id: settingsButton + backgroundColor: theme.iconBackgroundViewBar + backgroundColorHovered: theme.iconBackgroundViewBarHovered + Layout.preferredWidth: 50 + Layout.preferredHeight: 50 + scale: 1.5 + source: "qrc:/gpt4all/icons/settings.svg" + Accessible.name: qsTr("Settings") + Accessible.description: qsTr("Reveals a dialogue with settings") + + onClicked: { + settingsDialog.open() + } + } + } + + ColumnLayout { + id: buttonsLayout + anchors.bottom: parent.bottom + anchors.margins: 0 + anchors.bottomMargin: 25 + anchors.horizontalCenter: parent.horizontalCenter + Layout.margins: 0 + spacing: 25 + + MyToolButton { + id: networkButton + backgroundColor: theme.iconBackgroundViewBar + backgroundColorHovered: theme.iconBackgroundViewBarHovered + toggledColor: theme.iconBackgroundViewBar + Layout.preferredWidth: 40 + Layout.preferredHeight: 40 + scale: 1.2 + toggled: MySettings.networkIsActive + source: "qrc:/gpt4all/icons/network.svg" + Accessible.name: qsTr("Network") + Accessible.description: qsTr("Reveals a dialogue where you can opt-in for sharing data over network") + + onClicked: { + if (MySettings.networkIsActive) { + MySettings.networkIsActive = false + Network.sendNetworkToggled(false); + } else + networkDialog.open() + } + } + + MyToolButton { + id: infoButton + backgroundColor: theme.iconBackgroundViewBar + backgroundColorHovered: theme.iconBackgroundViewBarHovered + Layout.preferredWidth: 40 + Layout.preferredHeight: 40 + scale: 1.2 + source: "qrc:/gpt4all/icons/info.svg" + Accessible.name: qsTr("About") + Accessible.description: qsTr("Reveals an about dialog") + onClicked: { + aboutDialog.open() + } + } + } + } + ChatView { - anchors.fill: parent + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.left: viewBar.right + anchors.right: parent.right } } diff --git a/gpt4all-chat/qml/AboutDialog.qml b/gpt4all-chat/qml/AboutDialog.qml index ca63f9e6..8ce5ae7a 100644 --- a/gpt4all-chat/qml/AboutDialog.qml +++ b/gpt4all-chat/qml/AboutDialog.qml @@ -98,4 +98,17 @@ MyDialog { Accessible.description: qsTr("Contains embedded link to https://home.nomic.ai") } } + + MyButton { + id: checkForUpdatesButton + anchors.right: parent.right + anchors.bottom: parent.bottom + text: qsTr("Check for updates...") + font.pixelSize: theme.fontSizeLarge + Accessible.description: qsTr("Launch an external application that will check for updates to the installer") + onClicked: { + if (!LLM.checkForUpdates()) + checkForUpdatesError.open() + } + } } diff --git a/gpt4all-chat/qml/ChatDrawer.qml b/gpt4all-chat/qml/ChatDrawer.qml index 2f243f36..dee8843a 100644 --- a/gpt4all-chat/qml/ChatDrawer.qml +++ b/gpt4all-chat/qml/ChatDrawer.qml @@ -16,13 +16,22 @@ Rectangle { id: theme } - signal downloadClicked - signal aboutClicked - color: theme.containerBackground + Rectangle { + id: borderRight + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.right: parent.right + width: 2 + color: theme.containerForeground + } + Item { - anchors.fill: parent + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: borderRight.left anchors.margins: 10 Accessible.role: Accessible.Pane @@ -50,7 +59,7 @@ Rectangle { anchors.rightMargin: -10 anchors.topMargin: 10 anchors.top: newChat.bottom - anchors.bottom: checkForUpdatesButton.top + anchors.bottom: parent.bottom anchors.bottomMargin: 10 ScrollBar.vertical.policy: ScrollBar.AlwaysOff clip: true @@ -236,45 +245,5 @@ Rectangle { Accessible.description: qsTr("List of chats in the drawer dialog") } } - - MyButton { - id: checkForUpdatesButton - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: downloadButton.top - anchors.bottomMargin: 10 - text: qsTr("Updates") - font.pixelSize: theme.fontSizeLarge - Accessible.description: qsTr("Launch an external application that will check for updates to the installer") - onClicked: { - if (!LLM.checkForUpdates()) - checkForUpdatesError.open() - } - } - - MyButton { - id: downloadButton - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: aboutButton.top - anchors.bottomMargin: 10 - text: qsTr("Downloads") - Accessible.description: qsTr("Launch a dialog to download new models") - onClicked: { - downloadClicked() - } - } - - MyButton { - id: aboutButton - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - text: qsTr("About") - Accessible.description: qsTr("Launch a dialog to show the about page") - onClicked: { - aboutClicked() - } - } } } diff --git a/gpt4all-chat/qml/ChatView.qml b/gpt4all-chat/qml/ChatView.qml index d3535b2f..0b52d3fa 100644 --- a/gpt4all-chat/qml/ChatView.qml +++ b/gpt4all-chat/qml/ChatView.qml @@ -153,13 +153,6 @@ Rectangle { anchors.centerIn: parent } - AboutDialog { - id: aboutDialog - anchors.centerIn: parent - width: Math.min(1024, window.width - (window.width * .2)) - height: Math.min(600, window.height - (window.height * .2)) - } - Item { Accessible.role: Accessible.Window Accessible.name: title @@ -294,190 +287,260 @@ Rectangle { anchors.top: parent.top height: 100 color: theme.mainHeader - Item { - anchors.centerIn: parent - height: childrenRect.height - visible: true - Label { - id: modelLabel - color: theme.textColor - padding: 20 - font.pixelSize: theme.fontSizeLarger - text: "" - background: Rectangle { - color: theme.mainHeader + RowLayout { + id: comboLayout + height: 80 + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + spacing: 20 + + MyToolButton { + id: drawerButton + 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() } - horizontalAlignment: TextInput.AlignRight } - RowLayout { - id: comboLayout - anchors.top: modelLabel.top - anchors.bottom: modelLabel.bottom - anchors.horizontalCenter: parent.horizontalCenter - anchors.horizontalCenterOffset: window.width >= 950 ? 0 : Math.max(-((950 - window.width) / 2), -99.5) - spacing: 20 + MyComboBox { + id: comboBox + Layout.alignment: Qt.AlignHCenter + Layout.fillHeight: true + Layout.fillWidth: true + Layout.minimumWidth: 375 + Layout.maximumWidth: 675 + enabled: !currentChat.isServer + && !window.trySwitchContextInProgress + && !window.isCurrentlyLoading + model: ModelList.installedModels + valueRole: "id" + textRole: "name" - MyComboBox { - id: comboBox - Layout.fillWidth: true - Layout.fillHeight: true - implicitWidth: 575 - width: window.width >= 750 ? implicitWidth : implicitWidth - (750 - window.width) - enabled: !currentChat.isServer - && !window.trySwitchContextInProgress - && !window.isCurrentlyLoading - model: ModelList.installedModels - valueRole: "id" - textRole: "name" + function changeModel(index) { + window.modelLoadingPercentage = 0.0; + window.isCurrentlyLoading = true; + currentChat.stopGenerating() + currentChat.reset(); + currentChat.modelInfo = ModelList.modelInfo(comboBox.valueAt(index)) + } - function changeModel(index) { - window.modelLoadingPercentage = 0.0; - window.isCurrentlyLoading = true; - currentChat.stopGenerating() - currentChat.reset(); - currentChat.modelInfo = ModelList.modelInfo(comboBox.valueAt(index)) + Connections { + target: currentChat + function onModelLoadingPercentageChanged() { + window.modelLoadingPercentage = currentChat.modelLoadingPercentage; + window.isCurrentlyLoading = currentChat.modelLoadingPercentage !== 0.0 + && currentChat.modelLoadingPercentage !== 1.0; } - - Connections { - target: currentChat - function onModelLoadingPercentageChanged() { - window.modelLoadingPercentage = currentChat.modelLoadingPercentage; - window.isCurrentlyLoading = currentChat.modelLoadingPercentage !== 0.0 - && currentChat.modelLoadingPercentage !== 1.0; - } - function onTrySwitchContextOfLoadedModelAttempted() { - window.trySwitchContextInProgress = true; - } - function onTrySwitchContextOfLoadedModelCompleted() { - window.trySwitchContextInProgress = false; - } + function onTrySwitchContextOfLoadedModelAttempted() { + window.trySwitchContextInProgress = true; } - Connections { - target: switchModelDialog - function onAccepted() { - comboBox.changeModel(switchModelDialog.index) - } + function onTrySwitchContextOfLoadedModelCompleted() { + window.trySwitchContextInProgress = false; + } + } + Connections { + target: switchModelDialog + function onAccepted() { + comboBox.changeModel(switchModelDialog.index) } + } - background: ProgressBar { - id: modelProgress - value: window.modelLoadingPercentage - background: Rectangle { - color: theme.mainComboBackground - radius: 10 - } - contentItem: Item { - Rectangle { - visible: window.isCurrentlyLoading - anchors.bottom: parent.bottom - width: modelProgress.visualPosition * parent.width - height: 10 - radius: 2 - color: theme.progressForeground - } + background: ProgressBar { + id: modelProgress + value: window.modelLoadingPercentage + background: Rectangle { + color: theme.mainComboBackground + radius: 10 + } + contentItem: Item { + Rectangle { + visible: window.isCurrentlyLoading + anchors.bottom: parent.bottom + width: modelProgress.visualPosition * parent.width + height: 10 + radius: 2 + color: theme.progressForeground } } + } + contentItem: Text { + anchors.horizontalCenter: parent.horizontalCenter + leftPadding: 10 + rightPadding: { + if (ejectButton.visible && reloadButton) + return 105; + if (reloadButton.visible) + return 65 + return 25 + } + text: { + if (currentChat.modelLoadingError !== "") + return qsTr("Model loading error...") + if (window.trySwitchContextInProgress) + return qsTr("Switching context...") + if (currentModelName() === "") + return qsTr("Choose a model...") + if (currentChat.modelLoadingPercentage === 0.0) + return qsTr("Reload \u00B7 ") + currentModelName() + if (window.isCurrentlyLoading) + return qsTr("Loading \u00B7 ") + currentModelName() + return currentModelName() + } + font.pixelSize: theme.fontSizeLarger + color: theme.white + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + elide: Text.ElideRight + } + delegate: ItemDelegate { + id: comboItemDelegate + width: comboBox.width contentItem: Text { - anchors.horizontalCenter: parent.horizontalCenter - leftPadding: 10 - rightPadding: { - if (ejectButton.visible && reloadButton) - return 105; - if (reloadButton.visible) - return 65 - return 25 - } - text: { - if (currentChat.modelLoadingError !== "") - return qsTr("Model loading error...") - if (window.trySwitchContextInProgress) - return qsTr("Switching context...") - if (currentModelName() === "") - return qsTr("Choose a model...") - if (currentChat.modelLoadingPercentage === 0.0) - return qsTr("Reload \u00B7 ") + currentModelName() - if (window.isCurrentlyLoading) - return qsTr("Loading \u00B7 ") + currentModelName() - return currentModelName() - } - font.pixelSize: theme.fontSizeLarger - color: theme.white - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter + text: name + color: theme.textColor + font: comboBox.font elide: Text.ElideRight + verticalAlignment: Text.AlignVCenter } - delegate: ItemDelegate { - id: comboItemDelegate - width: comboBox.width - contentItem: Text { - text: name - color: theme.textColor - font: comboBox.font - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - } - background: Rectangle { - color: (index % 2 === 0 ? theme.darkContrast : theme.lightContrast) - border.width: highlighted - border.color: theme.accentColor - } - highlighted: comboBox.highlightedIndex === index + background: Rectangle { + color: (index % 2 === 0 ? theme.darkContrast : theme.lightContrast) + border.width: highlighted + border.color: theme.accentColor + } + highlighted: comboBox.highlightedIndex === index + } + Accessible.role: Accessible.ComboBox + Accessible.name: currentModelName() + Accessible.description: qsTr("The top item is the current model") + onActivated: function (index) { + var newInfo = ModelList.modelInfo(comboBox.valueAt(index)); + if (newInfo === currentChat.modelInfo) { + currentChat.reloadModel(); + } else if (currentModelName() !== "" && chatModel.count !== 0) { + switchModelDialog.index = index; + switchModelDialog.open(); + } else { + comboBox.changeModel(index); } - Accessible.role: Accessible.ComboBox - Accessible.name: currentModelName() - Accessible.description: qsTr("The top item is the current model") - onActivated: function (index) { - var newInfo = ModelList.modelInfo(comboBox.valueAt(index)); - if (newInfo === currentChat.modelInfo) { + } + + MyMiniButton { + id: ejectButton + visible: currentChat.isModelLoaded && !window.isCurrentlyLoading + z: 500 + anchors.right: parent.right + anchors.rightMargin: 50 + anchors.verticalCenter: parent.verticalCenter + source: "qrc:/gpt4all/icons/eject.svg" + backgroundColor: theme.gray300 + backgroundColorHovered: theme.iconBackgroundLight + onClicked: { + currentChat.forceUnloadModel(); + } + ToolTip.text: qsTr("Eject the currently loaded model") + ToolTip.visible: hovered + } + + MyMiniButton { + id: reloadButton + visible: currentChat.modelLoadingError === "" + && !window.trySwitchContextInProgress + && !window.isCurrentlyLoading + && (currentChat.isModelLoaded || currentModelName() !== "") + z: 500 + anchors.right: ejectButton.visible ? ejectButton.left : parent.right + anchors.rightMargin: ejectButton.visible ? 10 : 50 + anchors.verticalCenter: parent.verticalCenter + source: "qrc:/gpt4all/icons/regenerate.svg" + backgroundColor: theme.gray300 + backgroundColorHovered: theme.iconBackgroundLight + onClicked: { + if (currentChat.isModelLoaded) + currentChat.forceReloadModel(); + else currentChat.reloadModel(); - } else if (currentModelName() !== "" && chatModel.count !== 0) { - switchModelDialog.index = index; - switchModelDialog.open(); - } else { - comboBox.changeModel(index); - } } + ToolTip.text: qsTr("Reload the currently loaded model") + ToolTip.visible: hovered + } + } - MyMiniButton { - id: ejectButton - visible: currentChat.isModelLoaded && !window.isCurrentlyLoading - z: 500 - anchors.right: parent.right - anchors.rightMargin: 50 - anchors.verticalCenter: parent.verticalCenter - source: "qrc:/gpt4all/icons/eject.svg" - backgroundColor: theme.gray300 - backgroundColorHovered: theme.iconBackgroundLight - onClicked: { - currentChat.forceUnloadModel(); - } - ToolTip.text: qsTr("Eject the currently loaded model") - ToolTip.visible: hovered + RowLayout { + Layout.alignment: Qt.AlignRight + Layout.rightMargin: 30 + spacing: 20 + + MyToolButton { + id: resetContextButton + backgroundColor: theme.iconBackgroundLight + width: 40 + height: 40 + z: 200 + padding: 15 + source: "qrc:/gpt4all/icons/regenerate.svg" + + Accessible.name: text + Accessible.description: qsTr("Reset the context and erase current conversation") + + onClicked: { + Network.sendResetContext(chatModel.count) + currentChat.reset(); + currentChat.processSystemPrompt(); } + } - MyMiniButton { - id: reloadButton - visible: currentChat.modelLoadingError === "" - && !window.trySwitchContextInProgress - && !window.isCurrentlyLoading - && (currentChat.isModelLoaded || currentModelName() !== "") - z: 500 - anchors.right: ejectButton.visible ? ejectButton.left : parent.right - anchors.rightMargin: ejectButton.visible ? 10 : 50 - anchors.verticalCenter: parent.verticalCenter - source: "qrc:/gpt4all/icons/regenerate.svg" - backgroundColor: theme.gray300 - backgroundColorHovered: theme.iconBackgroundLight - onClicked: { - if (currentChat.isModelLoaded) - currentChat.forceReloadModel(); - else - currentChat.reloadModel(); - } - ToolTip.text: qsTr("Reload the currently loaded model") - ToolTip.visible: hovered + 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") + + TextEdit{ + id: copyEdit + visible: false + } + + 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() } } } @@ -495,64 +558,6 @@ Rectangle { } } - MyToolButton { - id: drawerButton - backgroundColor: theme.iconBackgroundLight - anchors.left: parent.left - anchors.top: parent.top - anchors.topMargin: 42.5 - anchors.leftMargin: 30 - 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() - } - } - - NetworkDialog { - id: networkDialog - anchors.centerIn: parent - width: Math.min(1024, window.width - (window.width * .2)) - height: Math.min(600, window.height - (window.height * .2)) - Item { - Accessible.role: Accessible.Dialog - Accessible.name: qsTr("Network dialog") - Accessible.description: qsTr("opt-in to share feedback/conversations") - } - } - - MyToolButton { - id: networkButton - backgroundColor: theme.iconBackgroundLight - anchors.right: parent.right - anchors.top: parent.top - anchors.topMargin: 42.5 - anchors.rightMargin: 30 - width: 40 - height: 40 - z: 200 - padding: 15 - toggled: MySettings.networkIsActive - source: "qrc:/gpt4all/icons/network.svg" - Accessible.name: qsTr("Network") - Accessible.description: qsTr("Reveals a dialogue where you can opt-in for sharing data over network") - - onClicked: { - if (MySettings.networkIsActive) { - MySettings.networkIsActive = false - Network.sendNetworkToggled(false); - } else - networkDialog.open() - } - } - Connections { target: Network function onHealthCheckFailed(code) { @@ -569,47 +574,6 @@ Rectangle { } } - MyToolButton { - id: collectionsButton - backgroundColor: theme.iconBackgroundLight - anchors.right: networkButton.left - anchors.top: parent.top - anchors.topMargin: 42.5 - anchors.rightMargin: 10 - 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() - } - } - - MyToolButton { - id: settingsButton - backgroundColor: theme.iconBackgroundLight - anchors.right: collectionsButton.left - anchors.top: parent.top - anchors.topMargin: 42.5 - anchors.rightMargin: 10 - width: 40 - height: 40 - z: 200 - padding: 15 - source: "qrc:/gpt4all/icons/settings.svg" - Accessible.name: qsTr("Settings") - Accessible.description: qsTr("Reveals a dialogue with settings") - - onClicked: { - settingsDialog.open() - } - } - PopupDialog { id: copyMessage anchors.centerIn: parent @@ -650,35 +614,6 @@ Rectangle { } } - MyToolButton { - id: copyButton - backgroundColor: theme.iconBackgroundLight - anchors.right: settingsButton.left - anchors.top: parent.top - anchors.topMargin: 42.5 - anchors.rightMargin: 10 - 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") - - TextEdit{ - id: copyEdit - visible: false - } - - onClicked: { - var conversation = getConversation() - copyEdit.text = conversation - copyEdit.selectAll() - copyEdit.copy() - copyMessage.open() - } - } - function getConversation() { var conversation = ""; for (var i = 0; i < chatModel.count; i++) { @@ -716,29 +651,6 @@ Rectangle { return str + "]}" } - MyToolButton { - id: resetContextButton - backgroundColor: theme.iconBackgroundLight - anchors.right: copyButton.left - anchors.top: parent.top - anchors.topMargin: 42.5 - anchors.rightMargin: 10 - width: 40 - height: 40 - z: 200 - padding: 15 - source: "qrc:/gpt4all/icons/regenerate.svg" - - Accessible.name: text - Accessible.description: qsTr("Reset the context and erase current conversation") - - onClicked: { - Network.sendResetContext(chatModel.count) - currentChat.reset(); - currentChat.processSystemPrompt(); - } - } - Dialog { id: checkForUpdatesError anchors.centerIn: parent @@ -785,14 +697,7 @@ Rectangle { anchors.left: parent.left anchors.top: accentRibbon.bottom anchors.bottom: parent.bottom - width: Math.min(600, 0.2 * window.width) - onDownloadClicked: { - downloadNewModels.showEmbeddingModels = false - downloadNewModels.open() - } - onAboutClicked: { - aboutDialog.open() - } + width: Math.max(180, Math.min(600, 0.2 * window.width)) } PopupDialog { @@ -970,10 +875,7 @@ Rectangle { ListView { id: listView visible: ModelList.installedModels.count !== 0 && chatModel.count !== 0 - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - width: Math.min(1280, parent.width) + anchors.fill: parent model: chatModel ScrollBar.vertical: ScrollBar { @@ -987,7 +889,8 @@ Rectangle { delegate: TextArea { id: myTextArea text: value + references - width: listView.width + anchors.horizontalCenter: listView.contentItem.horizontalCenter + width: Math.min(1280, listView.contentItem.width) color: theme.textColor wrapMode: Text.WordWrap textFormat: TextEdit.PlainText diff --git a/gpt4all-chat/qml/MyToolButton.qml b/gpt4all-chat/qml/MyToolButton.qml index 2e79e37b..34dc5464 100644 --- a/gpt4all-chat/qml/MyToolButton.qml +++ b/gpt4all-chat/qml/MyToolButton.qml @@ -9,6 +9,8 @@ Button { padding: 10 property color backgroundColor: theme.iconBackgroundDark property color backgroundColorHovered: theme.iconBackgroundHovered + property color toggledColor: theme.accentColor + property real toggledWidth: 1 property bool toggled: false property alias source: image.source property alias fillMode: image.fillMode @@ -27,8 +29,8 @@ Button { anchors.fill: parent color: "transparent" visible: myButton.toggled - border.color: theme.accentColor - border.width: 1 + border.color: myButton.toggledColor + border.width: myButton.toggledWidth radius: 10 } Image { diff --git a/gpt4all-chat/qml/Theme.qml b/gpt4all-chat/qml/Theme.qml index 2b8c9733..9622506f 100644 --- a/gpt4all-chat/qml/Theme.qml +++ b/gpt4all-chat/qml/Theme.qml @@ -200,6 +200,17 @@ QtObject { } } + property color viewBarBackground: { + switch (MySettings.chatTheme) { + case "LegacyDark": + return blue950; + case "Dark": + return darkgray300; + default: + return gray300; + } + } + property color progressForeground: { switch (MySettings.chatTheme) { case "LegacyDark": @@ -376,6 +387,39 @@ QtObject { } } + property color iconBackgroundViewBar: { + switch (MySettings.chatTheme) { + case "LegacyDark": + return blue200; + case "Dark": + return green400; + default: + return green700; + } + } + + property color iconBackgroundViewBarToggled: { + switch (MySettings.chatTheme) { + case "LegacyDark": + return purple400; + case "Dark": + return accentColor; + default: + return black; + } + } + + property color iconBackgroundViewBarHovered: { + switch (MySettings.chatTheme) { + case "LegacyDark": + return blue400; + case "Dark": + return green600; + default: + return green500; + } + } + property color slugBackground: { switch (MySettings.chatTheme) { case "LegacyDark":