Move saving chats to a thread and display what we're doing to the user.

This commit is contained in:
Adam Treat
2023-06-20 17:14:11 -04:00
parent c8a590bc6f
commit 968868415e
5 changed files with 75 additions and 15 deletions

View File

@@ -24,6 +24,25 @@ Window {
property var currentChat: LLM.chatListModel.currentChat
property var chatModel: currentChat.chatModel
property bool hasSaved: false
onClosing: function(close) {
if (window.hasSaved)
return;
savingPopup.open();
LLM.chatListModel.saveChats();
close.accepted = false
}
Connections {
target: LLM.chatListModel
function onSaveChatsFinished() {
window.hasSaved = true;
savingPopup.close();
window.close()
}
}
color: theme.backgroundDarkest
@@ -406,6 +425,14 @@ Window {
}
}
PopupDialog {
id: savingPopup
anchors.centerIn: parent
shouldTimeOut: false
shouldShowBusy: true
text: qsTr("Saving chats.")
}
MyToolButton {
id: copyButton
anchors.right: settingsButton.left