Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

fix: should not include reasoning text in the chat completion request

Louisfc815dc98e49
diff --git a/web-app/src/lib/messages.ts b/web-app/src/lib/messages.ts
index 05dc0164d..b187fb514 100644
--- a/web-app/src/lib/messages.ts
+++ b/web-app/src/lib/messages.ts
@@ -102,6 +102,15 @@ export class CompletionMessagesBuilder {
content = content.slice(splitIndex).trim()
}
}
+ if (content.includes('<|channel|>analysis<|message|>')) {
+ const match = content.match(
+ /<\|channel\|>analysis<\|message\|>([\s\S]*?)<\|start\|>assistant<\|channel\|>final<\|message\|>/
+ )
+ if (match?.index !== undefined) {
+ const splitIndex = match.index + match[0].length
+ content = content.slice(splitIndex).trim()
+ }
+ }
return content
}
}