From 9c008fb677cc35359b8bf93c85a13ebc3d91e6dc Mon Sep 17 00:00:00 2001 From: Adam Treat Date: Tue, 9 May 2023 11:46:33 -0400 Subject: [PATCH] Simplify. --- chatllm.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/chatllm.cpp b/chatllm.cpp index 64d0912d..d9098e33 100644 --- a/chatllm.cpp +++ b/chatllm.cpp @@ -76,14 +76,11 @@ bool ChatLLM::loadModel(const QString &modelName) if (isModelLoaded() && m_modelName == modelName) return true; - bool isFirstLoad = false; if (isModelLoaded()) { resetContextPrivate(); delete m_llmodel; m_llmodel = nullptr; emit isModelLoadedChanged(); - } else { - isFirstLoad = true; } bool isGPTJ = false; @@ -122,9 +119,11 @@ bool ChatLLM::loadModel(const QString &modelName) emit isModelLoadedChanged(); - if (isFirstLoad) + static bool isFirstLoad = false; + if (isFirstLoad) { emit sendStartup(); - else + isFirstLoad = false; + } else emit sendModelLoaded(); } else { const QString error = QString("Could not find model %1").arg(modelName);