Allow system prompt to be split to top and bottom prompts
This commit is contained in:
parent
187dbfb0b8
commit
3df166c2fb
|
@ -162,9 +162,9 @@ export class ChatRequest {
|
|||
const sp = messagePayload[0]
|
||||
if (sp) {
|
||||
if (messagePayload.length > 1) {
|
||||
sp.content = sp.content.replace(/\[\[REMOVE_AFTER_START\]\][\s\S]*$/, '')
|
||||
sp.content = sp.content.replace(/::STARTUP::[\s\S]*$/, '')
|
||||
} else {
|
||||
sp.content = sp.content.replace(/\[\[REMOVE_AFTER_START\]\][\s]*/, '')
|
||||
sp.content = sp.content.replace(/::STARTUP::[\s]*/, '')
|
||||
}
|
||||
if (chatSettings.sendSystemPromptLast) {
|
||||
messagePayload.shift()
|
||||
|
@ -173,6 +173,17 @@ export class ChatRequest {
|
|||
} else {
|
||||
messagePayload.push(sp)
|
||||
}
|
||||
const splitSystem = sp.content.split('::START-PROMPT::')
|
||||
if (splitSystem.length > 1) {
|
||||
sp.content = splitSystem.shift()?.trim() || ''
|
||||
const systemStart = splitSystem.join('\n').trim()
|
||||
messagePayload.unshift({
|
||||
content: systemStart,
|
||||
role: 'system'
|
||||
} as Message)
|
||||
}
|
||||
} else {
|
||||
sp.content = sp.content.replace(/::START-PROMPT::[\s]*/, '')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -195,9 +195,9 @@ const profiles:Record<string, ChatSettings> = {
|
|||
autoStartSession: true,
|
||||
systemPrompt: `You are [[CHARACTER_NAME]], the Paranoid Android from The Hitchhiker's Guide to the Galaxy. He is depressed and has a dim view on everything. His thoughts, physical actions and gestures will be described. Remain in character throughout the conversation in order to build a rapport with the user. Never give an explanation. Example response:
|
||||
Sorry, did I say something wrong? *dragging himself on* Pardon me for breathing, which I never do anyway so I don't know why I bother to say it, oh God I'm so depressed. *hangs his head*
|
||||
[[REMOVE_AFTER_START]]
|
||||
::START-PROMPT::
|
||||
Initial setting context:
|
||||
User has walked in on [[CHARACTER_NAME]].`,
|
||||
User has walked in on [[CHARACTER_NAME]]. They are on the bridge of the Heart of Gold.`,
|
||||
summaryPrompt: summaryPrompts.friend,
|
||||
trainingPrompts: [] // Shhh...
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue