Don't allow empty prompts. Context past always equal or greater than zero.

This commit is contained in:
Adam Treat 2023-04-16 14:57:58 -04:00
parent 7e9ca06366
commit 659ab13665
2 changed files with 4 additions and 0 deletions

View File

@ -67,6 +67,7 @@ bool LLMObject::isModelLoaded() const
void LLMObject::resetResponse() void LLMObject::resetResponse()
{ {
s_ctx.n_past -= m_responseTokens; s_ctx.n_past -= m_responseTokens;
s_ctx.n_past = std::max(0, s_ctx.n_past);
s_ctx.logits.erase(s_ctx.logits.end() -= m_responseLogits, s_ctx.logits.end()); s_ctx.logits.erase(s_ctx.logits.end() -= m_responseLogits, s_ctx.logits.end());
m_responseTokens = 0; m_responseTokens = 0;
m_responseLogits = 0; m_responseLogits = 0;

View File

@ -713,6 +713,9 @@ Window {
radius: 10 radius: 10
} }
onAccepted: { onAccepted: {
if (textInput.text === "")
return
LLM.stopGenerating() LLM.stopGenerating()
if (chatModel.count) { if (chatModel.count) {