diff --git a/gpt4all-chat/CMakeLists.txt b/gpt4all-chat/CMakeLists.txt index 3784701f..1ecf4b7c 100644 --- a/gpt4all-chat/CMakeLists.txt +++ b/gpt4all-chat/CMakeLists.txt @@ -96,6 +96,7 @@ qt_add_qml_module(chat QML_FILES main.qml qml/ChatDrawer.qml + qml/ChatView.qml qml/CollectionsDialog.qml qml/ModelDownloaderDialog.qml qml/NetworkDialog.qml diff --git a/gpt4all-chat/main.qml b/gpt4all-chat/main.qml index 6915c37b..c9d0ad67 100644 --- a/gpt4all-chat/main.qml +++ b/gpt4all-chat/main.qml @@ -21,7 +21,6 @@ Window { visible: true title: qsTr("GPT4All v") + Qt.application.version - Settings { property alias x: window.x property alias y: window.y @@ -33,10 +32,17 @@ Window { id: theme } - property var currentChat: ChatListModel.currentChat - property var chatModel: currentChat.chatModel property bool hasSaved: false + PopupDialog { + id: savingPopup + anchors.centerIn: parent + shouldTimeOut: false + shouldShowBusy: true + text: qsTr("Saving chats.") + font.pixelSize: theme.fontSizeLarge + } + onClosing: function(close) { if (window.hasSaved) return; @@ -57,1432 +63,7 @@ Window { color: theme.black - // Startup code - Component.onCompleted: { - startupDialogs(); - } - - Connections { - target: firstStartDialog - function onClosed() { - startupDialogs(); - } - } - - Connections { - target: downloadNewModels - function onClosed() { - startupDialogs(); - } - } - - Connections { - target: Download - function onHasNewerReleaseChanged() { - startupDialogs(); - } - } - - Connections { - target: currentChat - function onResponseInProgressChanged() { - if (MySettings.networkIsActive && !currentChat.responseInProgress) - Network.sendConversation(currentChat.id, getConversationJson()); - } - function onModelLoadingErrorChanged() { - if (currentChat.modelLoadingError !== "") - modelLoadingErrorPopup.open() - } - function onModelLoadingWarning(warning) { - modelLoadingWarningPopup.open_(warning) - } - } - - property bool hasShownModelDownload: false - property bool hasShownFirstStart: false - property bool hasShownSettingsAccess: false - - function startupDialogs() { - if (!LLM.compatHardware()) { - Network.sendNonCompatHardware(); - errorCompatHardware.open(); - return; - } - - // check if we have access to settings and if not show an error - if (!hasShownSettingsAccess && !LLM.hasSettingsAccess()) { - errorSettingsAccess.open(); - hasShownSettingsAccess = true; - return; - } - - // check for first time start of this version - if (!hasShownFirstStart && Download.isFirstStart()) { - firstStartDialog.open(); - hasShownFirstStart = true; - return; - } - - // check for any current models and if not, open download dialog once - if (!hasShownModelDownload && ModelList.installedModels.count === 0 && !firstStartDialog.opened) { - downloadNewModels.open(); - hasShownModelDownload = true; - return; - } - - // check for new version - if (Download.hasNewerRelease && !firstStartDialog.opened && !downloadNewModels.opened) { - newVersionDialog.open(); - return; - } - } - - function currentModelName() { - return ModelList.modelInfo(currentChat.modelInfo.id).name; - } - - property bool isCurrentlyLoading: false - property real modelLoadingPercentage: 0.0 - property bool trySwitchContextInProgress: false - - PopupDialog { - id: errorCompatHardware - anchors.centerIn: parent - shouldTimeOut: false - shouldShowBusy: false - closePolicy: Popup.NoAutoClose - modal: true - text: qsTr("

Encountered an error starting up:


") - + qsTr("\"Incompatible hardware detected.\"") - + qsTr("

Unfortunately, your CPU does not meet the minimal requirements to run ") - + qsTr("this program. In particular, it does not support AVX intrinsics which this ") - + qsTr("program requires to successfully run a modern large language model. ") - + qsTr("The only solution at this time is to upgrade your hardware to a more modern CPU.") - + qsTr("

See here for more information: ") - + qsTr("https://en.wikipedia.org/wiki/Advanced_Vector_Extensions") - } - - PopupDialog { - id: errorSettingsAccess - anchors.centerIn: parent - shouldTimeOut: false - shouldShowBusy: false - modal: true - text: qsTr("

Encountered an error starting up:


") - + qsTr("\"Inability to access settings file.\"") - + qsTr("

Unfortunately, something is preventing the program from accessing ") - + qsTr("the settings file. This could be caused by incorrect permissions in the local ") - + qsTr("app config directory where the settings file is located. ") - + qsTr("Check out our discord channel for help.") - } - - StartupDialog { - id: firstStartDialog - anchors.centerIn: parent - } - - NewVersionDialog { - id: newVersionDialog - 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 - } - - PopupDialog { - id: modelLoadingErrorPopup - anchors.centerIn: parent - shouldTimeOut: false - text: qsTr("

Encountered an error loading model:


") - + "\"" + currentChat.modelLoadingError + "\"" - + qsTr("

Model loading failures can happen for a variety of reasons, but the most common " - + "causes include a bad file format, an incomplete or corrupted download, the wrong file " - + "type, not enough system RAM or an incompatible model type. Here are some suggestions for resolving the problem:" - + "