Fix user prompt prefix injection

This commit is contained in:
Webifi 2023-07-24 22:20:52 -05:00
parent af08f5c99e
commit 833633991a
1 changed files with 1 additions and 1 deletions

View File

@ -301,7 +301,7 @@ export class ChatRequest {
if (m.length) { if (m.length) {
if (m.match(/\[\[USER_PROMPT\]\]/)) { if (m.match(/\[\[USER_PROMPT\]\]/)) {
injectedPrompt = true injectedPrompt = true
m.replace(/\[\[USER_PROMPT\]\]/g, lastMessage.content) m = m.replace(/\[\[USER_PROMPT\]\]/g, lastMessage.content)
} }
a.push({ role: a.length % 2 === 0 ? 'user' : 'assistant', content: m } as Message) a.push({ role: a.length % 2 === 0 ? 'user' : 'assistant', content: m } as Message)
} }