mirror of
https://github.com/nomic-ai/gpt4all
synced 2024-11-06 09:20:33 +00:00
Don't block the GUI when reloading via combobox.
This commit is contained in:
parent
745a8c3ac5
commit
a7c02a52ca
3
chat.cpp
3
chat.cpp
@ -25,18 +25,19 @@ Chat::Chat(QObject *parent)
|
|||||||
connect(this, &Chat::unloadRequested, m_llmodel, &ChatLLM::unload, Qt::QueuedConnection);
|
connect(this, &Chat::unloadRequested, m_llmodel, &ChatLLM::unload, Qt::QueuedConnection);
|
||||||
connect(this, &Chat::reloadRequested, m_llmodel, &ChatLLM::reload, Qt::QueuedConnection);
|
connect(this, &Chat::reloadRequested, m_llmodel, &ChatLLM::reload, Qt::QueuedConnection);
|
||||||
connect(this, &Chat::generateNameRequested, m_llmodel, &ChatLLM::generateName, Qt::QueuedConnection);
|
connect(this, &Chat::generateNameRequested, m_llmodel, &ChatLLM::generateName, Qt::QueuedConnection);
|
||||||
|
connect(this, &Chat::setThreadCountRequested, m_llmodel, &ChatLLM::setThreadCount, Qt::QueuedConnection);
|
||||||
|
|
||||||
// The following are blocking operations and will block the gui thread, therefore must be fast
|
// The following are blocking operations and will block the gui thread, therefore must be fast
|
||||||
// to respond to
|
// to respond to
|
||||||
connect(this, &Chat::regenerateResponseRequested, m_llmodel, &ChatLLM::regenerateResponse, Qt::BlockingQueuedConnection);
|
connect(this, &Chat::regenerateResponseRequested, m_llmodel, &ChatLLM::regenerateResponse, Qt::BlockingQueuedConnection);
|
||||||
connect(this, &Chat::resetResponseRequested, m_llmodel, &ChatLLM::resetResponse, Qt::BlockingQueuedConnection);
|
connect(this, &Chat::resetResponseRequested, m_llmodel, &ChatLLM::resetResponse, Qt::BlockingQueuedConnection);
|
||||||
connect(this, &Chat::resetContextRequested, m_llmodel, &ChatLLM::resetContext, Qt::BlockingQueuedConnection);
|
connect(this, &Chat::resetContextRequested, m_llmodel, &ChatLLM::resetContext, Qt::BlockingQueuedConnection);
|
||||||
connect(this, &Chat::setThreadCountRequested, m_llmodel, &ChatLLM::setThreadCount, Qt::QueuedConnection);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Chat::reset()
|
void Chat::reset()
|
||||||
{
|
{
|
||||||
stopGenerating();
|
stopGenerating();
|
||||||
|
qDebug() << "reset blocking";
|
||||||
emit resetContextRequested(); // blocking queued connection
|
emit resetContextRequested(); // blocking queued connection
|
||||||
m_id = Network::globalInstance()->generateUniqueId();
|
m_id = Network::globalInstance()->generateUniqueId();
|
||||||
emit idChanged();
|
emit idChanged();
|
||||||
|
2
main.qml
2
main.qml
@ -171,8 +171,8 @@ Window {
|
|||||||
|
|
||||||
onActivated: {
|
onActivated: {
|
||||||
currentChat.stopGenerating()
|
currentChat.stopGenerating()
|
||||||
currentChat.modelName = comboBox.currentText
|
|
||||||
currentChat.reset();
|
currentChat.reset();
|
||||||
|
currentChat.modelName = comboBox.currentText
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -343,7 +343,8 @@ Drawer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
downloadClicked() }
|
downloadClicked()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user