mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-21 06:30:51 +01:00
Merge pull request #979 from Halsey1006/staging
NAI instruct prompt handling
This commit is contained in:
commit
b44c72c639
@ -578,7 +578,7 @@ function calculateLogitBias() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms instruction into compatible format for Novel AI.
|
||||
* Transforms instruction into compatible format for Novel AI if Novel AI instruct format not already detected.
|
||||
* 1. Instruction must begin and end with curly braces followed and preceded by a space.
|
||||
* 2. Instruction must not contain square brackets as it serves different purpose in NAI.
|
||||
* @param {string} prompt Original instruction prompt
|
||||
@ -586,7 +586,10 @@ function calculateLogitBias() {
|
||||
*/
|
||||
export function adjustNovelInstructionPrompt(prompt) {
|
||||
const stripedPrompt = prompt.replace(/[\[\]]/g, '').trim();
|
||||
return `{ ${stripedPrompt} }`;
|
||||
if (!stripedPrompt.includes('{ ')) {
|
||||
return `{ ${stripedPrompt} }`;
|
||||
}
|
||||
return stripedPrompt;
|
||||
}
|
||||
|
||||
export async function generateNovelWithStreaming(generate_data, signal) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user