From 40b976436ad6c712aeaf1d2a589f27d0b66b1e67 Mon Sep 17 00:00:00 2001 From: Adam Treat Date: Mon, 8 May 2023 12:02:31 -0400 Subject: [PATCH] Only generate three words max. --- chatllm.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/chatllm.cpp b/chatllm.cpp index 1700c04f..eb675edc 100644 --- a/chatllm.cpp +++ b/chatllm.cpp @@ -356,9 +356,13 @@ bool ChatLLM::handleNamePrompt(int32_t token) bool ChatLLM::handleNameResponse(int32_t token, const std::string &response) { Q_UNUSED(token); + m_nameResponse.append(response); emit generatedNameChanged(); - return true; + QString gen = QString::fromStdString(m_nameResponse).simplified(); + QStringList words = gen.split(' ', Qt::SkipEmptyParts); + int wordCount = words.size(); + return words.size() <= 3; } bool ChatLLM::handleNameRecalculate(bool isRecalc)