summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan.goodliffe@octal.co.uk>2026-06-19 12:49:22 +0100
committerDan Goodliffe <dan.goodliffe@octal.co.uk>2026-06-19 17:41:01 +0100
commitfe8f3a00a2750be614f82514fb6f9c3ca3028148 (patch)
treeb335f810e2737d97979a2c1d42a737e5c0bfed61
parentTidy callAPI_chatJSON and improve error handling (diff)
downloadtoy-fe8f3a00a2750be614f82514fb6f9c3ca3028148.zip
Improve the handling of the dismissal process
-rw-r--r--scripts/toy/llmSession.groovy5
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/toy/llmSession.groovy b/scripts/toy/llmSession.groovy
index 68bbaf0..f140d75 100644
--- a/scripts/toy/llmSession.groovy
+++ b/scripts/toy/llmSession.groovy
@@ -29,7 +29,8 @@
}
def messages = chatInitialMessages("You want to play with ${loadString("intro.name")}. You can dismiss ${loadString("intro.name")} when you wish by writing \"DISMISSED.\" only.");
if (summon(messages)) {
- while (messages.last().content != "DISMISSED.") {
+ while (!messages.last().content.toUpperCase().startsWith("DISMISSED") && !messages.last().content.toUpperCase().contains("YOU ARE DISMISSED")) {
+ llmPresent(messages.last().content);
def userInput = getString(null, "");
if (userInput) {
messages += [ role: "user", content: userInput ];
@@ -49,7 +50,7 @@
return;
}
}
- messages += [role: "assistant", content: llmPresent(callAPI_chat(messages)).message];
+ messages += [role: "assistant", content: callAPI_chat(messages)];
}
}
else {