import QtCore import QtQuick import QtQuick.Controls import QtQuick.Controls.Basic import QtQuick.Layouts import Qt5Compat.GraphicalEffects import llm import chatlistmodel import download import modellist import network import gpt4all Window { id: window width: 1280 height: 720 minimumWidth: 720 minimumHeight: 480 visible: true title: qsTr("GPT4All v") + Qt.application.version Theme { id: theme } property var currentChat: ChatListModel.currentChat property var chatModel: currentChat.chatModel property bool hasSaved: false onClosing: function(close) { if (window.hasSaved) return; savingPopup.open(); ChatListModel.saveChats(); close.accepted = false } Connections { target: ChatListModel function onSaveChatsFinished() { window.hasSaved = true; savingPopup.close(); window.close() } } color: theme.backgroundDarkest // Startup code Component.onCompleted: { if (!LLM.compatHardware) { Network.sendNonCompatHardware(); errorCompatHardware.open(); } else 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 (Network.isActive && !currentChat.responseInProgress) Network.sendConversation(currentChat.id, getConversationJson()); } function onModelLoadingErrorChanged() { if (currentChat.modelLoadingError !== "") modelLoadingErrorPopup.open() } } function startupDialogs() { // check for first time start of this version if (Download.isFirstStart()) { firstStartDialog.open(); return; } // check for any current models and if not, open download dialog if (ModelList.count === 0 && !firstStartDialog.opened) { downloadNewModels.open(); return; } // check for new version if (Download.hasNewerRelease && !firstStartDialog.opened && !downloadNewModels.opened) { newVersionDialog.open(); return; } } PopupDialog { id: errorCompatHardware anchors.centerIn: parent shouldTimeOut: false shouldShowBusy: false closePolicy: Popup.NoAutoClose modal: true text: qsTr("Incompatible hardware detected. Your hardware does not meet the minimal requirements to run GPT4All. In particular, it does not seem to support AVX intrinsics. See here for more: https://en.wikipedia.org/wiki/Advanced_Vector_Extensions") } 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 or an incompatible model type. Here are some suggestions for resolving the problem:" + "