diff --git a/src/models/local.js b/src/models/local.js
index 509085a..fafa3d8 100644
--- a/src/models/local.js
+++ b/src/models/local.js
@@ -51,11 +51,17 @@ export class Local {
const hasCloseTag = res.includes("");
// If there's a partial mismatch, retry to get a complete response.
- if ((hasOpenTag && !hasCloseTag) || (!hasOpenTag && hasCloseTag)) {
+ if ((hasOpenTag && !hasCloseTag)) {
console.warn("Partial block detected. Re-generating...");
continue;
}
-
+
+ // If is present but is not, prepend
+ if (hasCloseTag && !hasOpenTag) {
+ res = '' + res;
+ }
+ // Changed this so if the model reasons, using and but doesn't start the message with , ges prepended to the message so no error occur.
+
// If both tags appear, remove them (and everything inside).
if (hasOpenTag && hasCloseTag) {
res = res.replace(/[\s\S]*?<\/think>/g, '');