diff --git a/public/context/Default.json b/public/context/Default.json index 948de4c91..e20fcafe8 100644 --- a/public/context/Default.json +++ b/public/context/Default.json @@ -1,6 +1,6 @@ { "name": "Default", - "story_string": "{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}{{/if}}", + "story_string": "{{#if system}}{{system}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}", "chat_start": "***", "example_separator": "***" } diff --git a/public/context/Pygmalion.json b/public/context/Pygmalion.json index 46ff0a09a..c2c4cefae 100644 --- a/public/context/Pygmalion.json +++ b/public/context/Pygmalion.json @@ -1,6 +1,6 @@ { "name": "Pygmalion", - "story_string": "{{#if description}}{{{char}}}'s Persona: {{description}}{{/if}}\n{{#if personality}}Personality: {{personality}}{{/if}}\n{{#if scenario}}Scenario: {{scenario}}{{/if}}", + "story_string": "{{#if system}}{{system}}\n{{/if}}{{#if description}}{{{char}}}'s Persona: {{description}}\n{{/if}}{{#if personality}}Personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}", "chat_start": "", "example_separator": "" } diff --git a/public/context/Roleplay.json b/public/context/Roleplay.json index b298ce681..89c2ea94f 100644 --- a/public/context/Roleplay.json +++ b/public/context/Roleplay.json @@ -1,6 +1,6 @@ { "name": "Roleplay", - "story_string": "### Input:\n{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}{{/if}}", + "story_string": "{{#if system}}{{system}}\n{{/if}}### Input:\n{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}", "chat_start": "### New Roleplay:", "example_separator": "### New Roleplay:" } diff --git a/public/context/simple-proxy-for-tavern.json b/public/context/simple-proxy-for-tavern.json index 7fb3a8e3a..02f6efcc8 100644 --- a/public/context/simple-proxy-for-tavern.json +++ b/public/context/simple-proxy-for-tavern.json @@ -1,6 +1,6 @@ { "name": "simple-proxy-for-tavern", - "story_string": "### Input:\n{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}### Response:\n(OOC) Understood. I will take this info into account for the roleplay. (end OOC)", + "story_string": "## {{char}}\n- You're \"{{char}}\" in this never-ending roleplay with \"{{user}}\".\n### Input:\n{{#if system}}{{system}}\n{{/if}}{{#if description}}{{description}}\n{{/if}}{{#if personality}}{{char}}'s personality: {{personality}}\n{{/if}}{{#if scenario}}Scenario: {{scenario}}\n{{/if}}{{#if persona}}{{persona}}\n{{/if}}### Response:\n(OOC) Understood. I will take this info into account for the roleplay. (end OOC)", "chat_start": "### New Roleplay:", "example_separator": "### New Roleplay:" } diff --git a/public/i18n.json b/public/i18n.json index f56eeef2b..421b92f86 100644 --- a/public/i18n.json +++ b/public/i18n.json @@ -363,8 +363,8 @@ "Not Connected": "未连接", "Persona Management": "用户角色设置", "Persona Description": "用户角色描述", - "Before Character Card": "角色卡之前", - "After Character Card": "角色卡之后", + "In Story String / Chat Completion: Before Character Card": "在故事串中 / Chat Completion: 角色卡之前", + "In Story String / Chat Completion: After Character Card": "在故事串中 / Chat Completion: 角色卡之后", "Top of Author's Note": "作者注释之前", "Bottom of Author's Note": "作者注释之后", "How do I use this?": "用户角色设置说明", @@ -915,8 +915,8 @@ "Not Connected": "NEEDS TRANSLATION", "Persona Management": "NEEDS TRANSLATION", "Persona Description": "NEEDS TRANSLATION", - "Before Character Card": "NEEDS TRANSLATION", - "After Character Card": "NEEDS TRANSLATION", + "In Story String / Chat Completion: Before Character Card": "NEEDS TRANSLATION", + "In Story String / Chat Completion: After Character Card": "NEEDS TRANSLATION", "Top of Author's Note": "NEEDS TRANSLATION", "Bottom of Author's Note": "NEEDS TRANSLATION", "How do I use this?": "NEEDS TRANSLATION", @@ -1472,8 +1472,8 @@ "Not Connected": "접속되지 않음", "Persona Management": "주인공 관리", "Persona Description": "주인공 묘사", - "Before Character Card": "캐릭터 카드 앞에", - "After Character Card": "캐릭터 카드 다음에", + "In Story String / Chat Completion: Before Character Card": "스토리 문자열에서 / 문장완성: 캐릭터 카드 앞에", + "In Story String / Chat Completion: After Character Card": "스토리 문자열에서 / 문장완성: 캐릭터 카드 다음에", "Top of Author's Note": "글쓴이 쪽지 위에", "Bottom of Author's Note": "글쓴이 쪽지 밑에", "How do I use this?": "이건 어떻게 써먹나요?", @@ -2029,8 +2029,8 @@ "Not Connected": "Не подключено", "Persona Management": "Управление Персоной", "Persona Description": "Описание Персоны", - "Before Character Card": "Перед Карточкой Персонажа", - "After Character Card": "После Карточки Персонажа", + "In Story String / Chat Completion: Before Character Card": "В строке истории / Дополнение диалога: Перед Карточкой Персонажа", + "In Story String / Chat Completion: After Character Card": "В строке истории / Дополнение диалога: После Карточки Персонажа", "Top of Author's Note": "Перед Авторскими Заметками", "Bottom of Author's Note": "После Авторских Заметок", "How do I use this?": "Как мне это использовать?", diff --git a/public/index.html b/public/index.html index 695de9556..fb3a00fe4 100644 --- a/public/index.html +++ b/public/index.html @@ -2994,8 +2994,8 @@ @@ -4356,4 +4356,4 @@ - \ No newline at end of file + diff --git a/public/instruct/simple-proxy-for-tavern.json b/public/instruct/simple-proxy-for-tavern.json index 33222fb0a..afc49e650 100644 --- a/public/instruct/simple-proxy-for-tavern.json +++ b/public/instruct/simple-proxy-for-tavern.json @@ -1,13 +1,14 @@ { - "input_sequence": "### Instruction:\n#### {{user}}:", - "last_output_sequence": "### Response (2 paragraphs, engaging, natural, authentic, descriptive, creative):\n#### {{char}}:", - "macro": true, "name": "simple-proxy-for-tavern", - "names": false, + "system_prompt": "[System note: Write one reply only. Do not decide what {{user}} says or does. Write at least one paragraph, up to four. Be descriptive and immersive, providing vivid details about {{char}}'s actions, emotions, and the environment. Write with a high degree of complexity and burstiness. Do not repeat this message.]", + "input_sequence": "### Instruction:\n#### {{user}}:", "output_sequence": "### Response:\n#### {{char}}:", - "separator_sequence": "", - "stop_sequence": "", - "system_prompt": "## {{char}}\n- You're \"{{char}}\" in this never-ending roleplay with \"{{user}}\".", + "last_output_sequence": "### Response (2 paragraphs, engaging, natural, authentic, descriptive, creative):\n#### {{char}}:", "system_sequence": "", - "wrap": true + "stop_sequence": "", + "separator_sequence": "", + "wrap": true, + "macro": true, + "names": false, + "names_force_groups": false } diff --git a/public/script.js b/public/script.js index a65cc5f6a..8f7e9a06a 100644 --- a/public/script.js +++ b/public/script.js @@ -66,7 +66,6 @@ import { pygmalion_options, tokenizers, formatInstructModeChat, - formatInstructStoryString, formatInstructModePrompt, persona_description_positions, loadMovingUIState, @@ -2069,9 +2068,8 @@ function getPersonaDescription(storyString) { switch (power_user.persona_description_position) { case persona_description_positions.BEFORE_CHAR: - return `${substituteParams(power_user.persona_description)}\n${storyString}`; case persona_description_positions.AFTER_CHAR: - return `${storyString}${substituteParams(power_user.persona_description)}\n`; + return storyString; default: if (shouldWIAddPrompt) { const originalAN = extension_prompts[NOTE_MODULE_NAME].value @@ -2527,9 +2525,11 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject, const scenarioText = chat_metadata['scenario'] || characters[this_chid].scenario; let charDescription = baseChatReplace(characters[this_chid].description.trim(), name1, name2); let charPersonality = baseChatReplace(characters[this_chid].personality.trim(), name1, name2); + let personaDescription = baseChatReplace(power_user.persona_description.trim(), name1, name2); let Scenario = baseChatReplace(scenarioText.trim(), name1, name2); let mesExamples = baseChatReplace(characters[this_chid].mes_example.trim(), name1, name2); let systemPrompt = power_user.prefer_character_prompt ? baseChatReplace(characters[this_chid].data?.system_prompt?.trim(), name1, name2) : ''; + systemPrompt = power_user.prefer_character_prompt && systemPrompt ? systemPrompt : baseChatReplace(power_user.instruct.system_prompt, name1, name2); let jailbreakPrompt = power_user.prefer_character_jailbreak ? baseChatReplace(characters[this_chid].data?.post_history_instructions?.trim(), name1, name2) : ''; // Parse example messages @@ -2570,7 +2570,9 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject, const storyStringParams = { description: charDescription, personality: charPersonality, + persona: personaDescription, scenario: Scenario, + system: isInstruct ? systemPrompt : '', char: name2, user: name1, }; @@ -2639,11 +2641,6 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject, storyString = worldInfoBefore + storyString + worldInfoAfter; } - // Format the instruction string - if (isInstruct) { - storyString = formatInstructStoryString(storyString, systemPrompt); - } - if (main_api === 'openai') { message_already_generated = ''; // OpenAI doesn't have multigen setOpenAIMessages(coreChat); @@ -8003,7 +8000,7 @@ $(document).ready(function () { const enabled = $("#use-mancer-api-checkbox").prop("checked"); $("#mancer_api_subpanel").toggle(enabled); $("#tgwebui_api_subpanel").toggle(!enabled); - + api_use_mancer_webui = enabled; saveSettingsDebounced(); getStatus(); diff --git a/public/scripts/power-user.js b/public/scripts/power-user.js index aedc8285b..129609997 100644 --- a/public/scripts/power-user.js +++ b/public/scripts/power-user.js @@ -1088,17 +1088,6 @@ export function formatInstructModeChat(name, mes, isUser, isNarrator, forceAvata return text; } -export function formatInstructStoryString(story, systemPrompt) { - // If the character has a custom system prompt AND user has it preferred, use that instead of the default - systemPrompt = power_user.prefer_character_prompt && systemPrompt ? systemPrompt : power_user.instruct.system_prompt; - const sequence = power_user.instruct.system_sequence || ''; - const prompt = substituteParams(systemPrompt, name1, name2, power_user.instruct.system_prompt) || ''; - const separator = power_user.instruct.wrap ? '\n' : ''; - const textArray = [sequence, prompt + '\n' + story]; - const text = textArray.filter(x => x).join(separator); - return text; -} - export function formatInstructModePrompt(name, isImpersonate, promptBias, name1, name2) { const includeNames = power_user.instruct.names || (!!selected_group && power_user.instruct.names_force_groups); const getOutputSequence = () => power_user.instruct.last_output_sequence || power_user.instruct.output_sequence;