Consolidate these into single api from qml to backend.

This commit is contained in:
Adam Treat 2023-05-01 12:24:51 -04:00
parent 4d87c46948
commit ed59190e48
3 changed files with 3 additions and 8 deletions

View File

@ -32,7 +32,10 @@ Chat::Chat(QObject *parent)
void Chat::reset() void Chat::reset()
{ {
stopGenerating();
emit resetContextRequested(); // blocking queued connection
m_id = Network::globalInstance()->generateUniqueId(); m_id = Network::globalInstance()->generateUniqueId();
emit idChanged();
m_chatModel->clear(); m_chatModel->clear();
} }
@ -57,11 +60,6 @@ void Chat::resetResponse()
emit resetResponseRequested(); // blocking queued connection emit resetResponseRequested(); // blocking queued connection
} }
void Chat::resetContext()
{
emit resetContextRequested(); // blocking queued connection
}
void Chat::stopGenerating() void Chat::stopGenerating()
{ {
m_llmodel->stopGenerating(); m_llmodel->stopGenerating();

1
chat.h
View File

@ -35,7 +35,6 @@ public:
float temp, int32_t n_batch, float repeat_penalty, int32_t repeat_penalty_tokens); float temp, int32_t n_batch, float repeat_penalty, int32_t repeat_penalty_tokens);
Q_INVOKABLE void regenerateResponse(); Q_INVOKABLE void regenerateResponse();
Q_INVOKABLE void resetResponse(); Q_INVOKABLE void resetResponse();
Q_INVOKABLE void resetContext();
Q_INVOKABLE void stopGenerating(); Q_INVOKABLE void stopGenerating();
Q_INVOKABLE void syncThreadCount(); Q_INVOKABLE void syncThreadCount();
Q_INVOKABLE void setThreadCount(int32_t n_threads); Q_INVOKABLE void setThreadCount(int32_t n_threads);

View File

@ -472,8 +472,6 @@ Window {
} }
onClicked: { onClicked: {
LLM.currentChat.stopGenerating()
LLM.currentChat.resetContext()
LLM.currentChat.reset(); LLM.currentChat.reset();
} }
} }