mirror of
				https://github.com/SillyTavern/SillyTavern.git
				synced 2025-06-05 21:59:27 +02:00 
			
		
		
		
	#605 JB prompt override for Poe.
This commit is contained in:
		| @@ -2788,7 +2788,7 @@ | |||||||
|  |  | ||||||
|         <div class="inline-drawer"> |         <div class="inline-drawer"> | ||||||
|             <div class="inline-drawer-toggle inline-drawer-header"> |             <div class="inline-drawer-toggle inline-drawer-header"> | ||||||
|                 <h4>Prompt Overrides <small>(For OpenAI/Claude APIs, and Instruct mode)</small></h4> |                 <h4>Prompt Overrides <small>(For OpenAI/Claude APIs, Window/OpenRouter, Poe, and Instruct mode)</small></h4> | ||||||
|  |  | ||||||
|  |  | ||||||
|                 <div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div> |                 <div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div> | ||||||
| @@ -2801,7 +2801,7 @@ | |||||||
|                 </div> |                 </div> | ||||||
|                 <div> |                 <div> | ||||||
|                     <h4>Jailbreak</h4> |                     <h4>Jailbreak</h4> | ||||||
|                     <textarea id="post_history_instructions_textarea" name="post_history_instructions" placeholder="Any contents here will replace the default Jailbreak Prompt used for this character.
(v2 spec: post_history_instructions)" form="form_create" class="text_pole" autocomplete="off" rows="3" maxlength="20000"></textarea> |                     <textarea id="post_history_instructions_textarea" name="post_history_instructions" placeholder="Any contents here will replace the default Jailbreak Prompt (Character Note for Poe) used for this character.
(v2 spec: post_history_instructions)" form="form_create" class="text_pole" autocomplete="off" rows="3" maxlength="20000"></textarea> | ||||||
|                 </div> |                 </div> | ||||||
|             </div> |             </div> | ||||||
|         </div> |         </div> | ||||||
|   | |||||||
| @@ -2126,8 +2126,8 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject, | |||||||
|  |  | ||||||
|         // Moved here to not overflow the Poe context with added prompt bits |         // Moved here to not overflow the Poe context with added prompt bits | ||||||
|         if (main_api == 'poe') { |         if (main_api == 'poe') { | ||||||
|             allAnchors = appendPoeAnchors(type, allAnchors); |             allAnchors = appendPoeAnchors(type, allAnchors, jailbreakPrompt); | ||||||
|             zeroDepthAnchor = appendPoeAnchors(type, zeroDepthAnchor); |             zeroDepthAnchor = appendPoeAnchors(type, zeroDepthAnchor, jailbreakPrompt); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         // hack for regeneration of the first message |         // hack for regeneration of the first message | ||||||
| @@ -2710,7 +2710,7 @@ export function getBiasStrings(textareaText, type) { | |||||||
|             if (type === 'swipe' && chat.length - 1 === i) { |             if (type === 'swipe' && chat.length - 1 === i) { | ||||||
|                 continue; |                 continue; | ||||||
|             } |             } | ||||||
|             if (mes && (mes.is_user || mes.is_system || mes.extra.type === system_message_types.NARRATOR)) { |             if (mes && (mes.is_user || mes.is_system || mes.extra?.type === system_message_types.NARRATOR)) { | ||||||
|                 if (mes.extra?.bias?.trim()?.length > 0) { |                 if (mes.extra?.bias?.trim()?.length > 0) { | ||||||
|                     promptBias = mes.extra.bias; |                     promptBias = mes.extra.bias; | ||||||
|                 } |                 } | ||||||
|   | |||||||
| @@ -8,7 +8,10 @@ import { | |||||||
|     eventSource, |     eventSource, | ||||||
|     event_types, |     event_types, | ||||||
|     scrollChatToBottom, |     scrollChatToBottom, | ||||||
|  |     name1, | ||||||
|  |     name2, | ||||||
| } from "../script.js"; | } from "../script.js"; | ||||||
|  | import { power_user } from "./power-user.js"; | ||||||
| import { | import { | ||||||
|     SECRET_KEYS, |     SECRET_KEYS, | ||||||
|     secret_state, |     secret_state, | ||||||
| @@ -186,13 +189,16 @@ function onBotChange() { | |||||||
|     saveSettingsDebounced(); |     saveSettingsDebounced(); | ||||||
| } | } | ||||||
|  |  | ||||||
| export function appendPoeAnchors(type, prompt) { | export function appendPoeAnchors(type, prompt, jailbreakPrompt) { | ||||||
|     const isImpersonate = type === 'impersonate'; |     const isImpersonate = type === 'impersonate'; | ||||||
|     const isQuiet = type === 'quiet'; |     const isQuiet = type === 'quiet'; | ||||||
|  |  | ||||||
|     if (poe_settings.character_nudge && !isQuiet && !isImpersonate) { |     if (poe_settings.character_nudge && !isQuiet && !isImpersonate) { | ||||||
|         let characterNudge = '\n' + substituteParams(poe_settings.character_nudge_message); |         if (power_user.prefer_character_jailbreak && jailbreakPrompt) { | ||||||
|         prompt += characterNudge; |             prompt += '\n' + substituteParams(jailbreakPrompt, name1, name2, poe_settings.character_nudge_message); | ||||||
|  |         } else { | ||||||
|  |             prompt += '\n' + substituteParams(poe_settings.character_nudge_message); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (poe_settings.impersonation_prompt && isImpersonate) { |     if (poe_settings.impersonation_prompt && isImpersonate) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user