diff --git a/public/index.html b/public/index.html index a287a6c57..5844a4a95 100644 --- a/public/index.html +++ b/public/index.html @@ -1289,7 +1289,7 @@
@@ -1297,12 +1297,20 @@
+
+ +
+ +
+
diff --git a/public/instruct/Alpaca.json b/public/instruct/Alpaca.json index 5c326bdba..df538760c 100644 --- a/public/instruct/Alpaca.json +++ b/public/instruct/Alpaca.json @@ -5,5 +5,6 @@ "stop_sequence": "", "input_sequence": "### Instruction:", "output_sequence": "### Response:", + "separator_sequence": "", "wrap": true } \ No newline at end of file diff --git a/public/instruct/Koala.json b/public/instruct/Koala.json index 48a8abd67..36b21637e 100644 --- a/public/instruct/Koala.json +++ b/public/instruct/Koala.json @@ -1,9 +1,10 @@ { "name": "Koala", "system_prompt": "Write {{char}}'s next reply in a fictional roleplay chat between {{user}} and {{char}}.\n", - "system_sequence": "BEGINNING OF CONVERSATION:", + "system_sequence": "BEGINNING OF CONVERSATION: ", "stop_sequence": "", "input_sequence": "USER: ", "output_sequence": "GPT: ", + "separator_sequence": "", "wrap": false } \ No newline at end of file diff --git a/public/instruct/Metharme.json b/public/instruct/Metharme.json index 31be23535..82827211a 100644 --- a/public/instruct/Metharme.json +++ b/public/instruct/Metharme.json @@ -5,5 +5,6 @@ "stop_sequence": "", "input_sequence": "<|user|>", "output_sequence": "<|model|>", + "separator_sequence": "", "wrap": false } \ No newline at end of file diff --git a/public/instruct/Vicuna 1.0.json b/public/instruct/Vicuna 1.0.json index ce5a11d93..2c27e75d2 100644 --- a/public/instruct/Vicuna 1.0.json +++ b/public/instruct/Vicuna 1.0.json @@ -5,5 +5,6 @@ "stop_sequence": "", "input_sequence": "### Human:", "output_sequence": "### Assistant:", + "separator_sequence": "", "wrap": true } \ No newline at end of file diff --git a/public/instruct/Vicuna 1.1.json b/public/instruct/Vicuna 1.1.json index 365f0f0ee..e35d88970 100644 --- a/public/instruct/Vicuna 1.1.json +++ b/public/instruct/Vicuna 1.1.json @@ -5,5 +5,6 @@ "stop_sequence": "", "input_sequence": "USER: ", "output_sequence": "ASSISTANT: ", - "wrap": true + "separator_sequence": "", + "wrap": false } \ No newline at end of file diff --git a/public/instruct/WizardLM.json b/public/instruct/WizardLM.json index 29fc6dcce..aa83c1a64 100644 --- a/public/instruct/WizardLM.json +++ b/public/instruct/WizardLM.json @@ -3,7 +3,8 @@ "system_prompt": "Write {{char}}'s next reply in a fictional roleplay chat between {{user}} and {{char}}.\n", "system_sequence": "", "stop_sequence": "", - "input_sequence": "### Instruction:", + "input_sequence": "", "output_sequence": "### Response:", + "separator_sequence": "", "wrap": true } \ No newline at end of file diff --git a/public/notes/content.md b/public/notes/content.md index f9ea20a39..2ebdcd8cd 100644 --- a/public/notes/content.md +++ b/public/notes/content.md @@ -435,6 +435,10 @@ Text added before the character's reply. Text added before the system prompt. +#### Separator Sequence + +Text added after the character reply to separate the chat history logs. + #### Stop Sequence Text that denotes the end of the reply. Will be trimmed from the output text. diff --git a/public/script.js b/public/script.js index 244424f45..36cf965b9 100644 --- a/public/script.js +++ b/public/script.js @@ -2014,7 +2014,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject, if (!mesSendString.endsWith('\n')) { mesSendString += '\n'; } - mesSendString += name2 + ':' + promptBias; + mesSendString += (`${name2}:${promptBias || ''}`); } return mesSendString; diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index ba2fabb4c..fcac16ae7 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -134,6 +134,7 @@ let power_user = { input_sequence: '### Instruction:', output_sequence: '### Response:', preset: 'Alpaca', + separator_sequence: '', } }; @@ -584,6 +585,7 @@ function loadInstructMode() { { id: "instruct_wrap", property: "wrap", isCheckbox: true }, { id: "instruct_system_prompt", property: "system_prompt", isCheckbox: false }, { id: "instruct_system_sequence", property: "system_sequence", isCheckbox: false }, + { id: "instruct_separator_sequence", property: "separator_sequence", isCheckbox: false }, { id: "instruct_input_sequence", property: "input_sequence", isCheckbox: false }, { id: "instruct_output_sequence", property: "output_sequence", isCheckbox: false }, { id: "instruct_stop_sequence", property: "stop_sequence", isCheckbox: false }, @@ -641,8 +643,11 @@ function loadInstructMode() { export function formatInstructModeChat(name, mes, isUser, isNarrator) { const includeNames = isNarrator ? false : power_user.instruct.names || !!selected_group; const sequence = (isUser || isNarrator) ? power_user.instruct.input_sequence : power_user.instruct.output_sequence; - const separator = power_user.instruct.wrap ? '\n' : ''; - const textArray = includeNames ? [sequence, `${name}: ${mes}`, separator] : [sequence, mes, separator]; + const separator = power_user.instruct.wrap ? '\n' : ''; + const separatorSequence = power_user.instruct.separator_sequence && !isUser + ? power_user.instruct.separator_sequence + : (power_user.instruct.wrap ? '\n' : ''); + const textArray = includeNames ? [sequence, `${name}: ${mes}`, separatorSequence] : [sequence, mes, separatorSequence]; const text = textArray.filter(x => x).join(separator); return text; } @@ -661,7 +666,7 @@ export function formatInstructModePrompt(name, isImpersonate) { const sequence = isImpersonate ? power_user.instruct.input_sequence : power_user.instruct.output_sequence; const separator = power_user.instruct.wrap ? '\n' : ''; const text = includeNames ? (separator + sequence + separator + `${name}:`) : (separator + sequence); - return text; + return text.trimEnd(); } const sortFunc = (a, b) => power_user.sort_order == 'asc' ? compareFunc(a, b) : compareFunc(b, a);