Much better memory mgmt for multi-threaded model loading/unloading.

This commit is contained in:
Adam Treat
2023-05-13 19:05:35 -04:00
committed by AT
parent 2989b74d43
commit ddc24acf33
6 changed files with 243 additions and 74 deletions

View File

@@ -40,6 +40,7 @@ void ChatListModel::setShouldSaveChats(bool b)
void ChatListModel::removeChatFile(Chat *chat) const
{
Q_ASSERT(chat != m_serverChat);
const QString savePath = Download::globalInstance()->downloadLocalModelsPath();
QFile file(savePath + "/gpt4all-" + chat->id() + ".chat");
if (!file.exists())
@@ -58,6 +59,8 @@ void ChatListModel::saveChats() const
timer.start();
const QString savePath = Download::globalInstance()->downloadLocalModelsPath();
for (Chat *chat : m_chats) {
if (chat == m_serverChat)
continue;
QString fileName = "gpt4all-" + chat->id() + ".chat";
QFile file(savePath + "/" + fileName);
bool success = file.open(QIODevice::WriteOnly);