Implement a priority for prompt injections in CC (#3978)

* Implement a priority for prompt injections in CC

Adds a numeric order for injected prompts, 0 being default and placed at the top, and higher numbers placing further down. If two messages have the same priority, then order is determined by role as was before.

* Update data-i18n for new setting field

* Rename priority to order, sort higher first/lower last

* Hide order when position is relative, adjust hint text

* Fix type error

* Fix capitalization

* Cut UI texts

* Reposition text labels

---------

Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
This commit is contained in:
Kristian Schlikow
2025-05-12 22:59:54 +02:00
committed by GitHub
parent e25a033caa
commit 8100a542e2
18 changed files with 91 additions and 53 deletions

View File

@ -6442,21 +6442,19 @@
<label for="completion_prompt_manager_popup_entry_form_name"> <label for="completion_prompt_manager_popup_entry_form_name">
<span data-i18n="prompt_manager_name">Name</span> <span data-i18n="prompt_manager_name">Name</span>
</label> </label>
<div class="text_muted" data-i18n="A name for this prompt.">A name for this prompt.</div>
<input id="completion_prompt_manager_popup_entry_form_name" class="text_pole" type="text" name="name" /> <input id="completion_prompt_manager_popup_entry_form_name" class="text_pole" type="text" name="name" />
<div class="text_muted" data-i18n="A name for this prompt.">A name for this prompt.</div>
</div> </div>
<div class="completion_prompt_manager_popup_entry_form_control flex1"> <div class="completion_prompt_manager_popup_entry_form_control flex1">
<label for="completion_prompt_manager_popup_entry_form_role"> <label for="completion_prompt_manager_popup_entry_form_role">
<span data-i18n="Role">Role</span> <span data-i18n="Role">Role</span>
</label> </label>
<div class="text_muted">
<span data-i18n="To whom this message will be attributed.">To whom this message will be attributed.</span>
</div>
<select id="completion_prompt_manager_popup_entry_form_role" class="text_pole" name="role"> <select id="completion_prompt_manager_popup_entry_form_role" class="text_pole" name="role">
<option data-i18n="System" value="system">System</option> <option data-i18n="System" value="system">System</option>
<option data-i18n="User" value="user">User</option> <option data-i18n="User" value="user">User</option>
<option data-i18n="AI Assistant" value="assistant">AI Assistant</option> <option data-i18n="AI Assistant" value="assistant">AI Assistant</option>
</select> </select>
<div class="text_muted" data-i18n="To whom this message will be attributed.">To whom this message will be attributed.</div>
</div> </div>
</div> </div>
<div class="flex-container gap10px"> <div class="flex-container gap10px">
@ -6464,18 +6462,25 @@
<label for="completion_prompt_manager_popup_entry_form_injection_position"> <label for="completion_prompt_manager_popup_entry_form_injection_position">
<span data-i18n="prompt_manager_position">Position</span> <span data-i18n="prompt_manager_position">Position</span>
</label> </label>
<div class="text_muted" data-i18n="Injection position. Relative (to other prompts in prompt manager) or In-chat @ Depth.">Injection position. Relative (to other prompts in prompt manager) or In-chat @ Depth.</div>
<select id="completion_prompt_manager_popup_entry_form_injection_position" class="text_pole" name="injection_position"> <select id="completion_prompt_manager_popup_entry_form_injection_position" class="text_pole" name="injection_position">
<option data-i18n="prompt_manager_relative" value="0">Relative</option> <option data-i18n="prompt_manager_relative" value="0">Relative</option>
<option data-i18n="prompt_manager_in_chat" value="1">In-chat</option> <option data-i18n="prompt_manager_in_chat" value="1">In-chat</option>
</select> </select>
<div class="text_muted" data-i18n="Relative (to other prompts in prompt manager) or In-chat @ Depth.">Relative (to other prompts in prompt manager) or In-chat @ Depth.</div>
</div> </div>
<div id="completion_prompt_manager_depth_block" class="completion_prompt_manager_popup_entry_form_control flex1"> <div id="completion_prompt_manager_depth_block" class="completion_prompt_manager_popup_entry_form_control flex1">
<label for="completion_prompt_manager_popup_entry_form_injection_depth"> <label for="completion_prompt_manager_popup_entry_form_injection_depth">
<span data-i18n="prompt_manager_depth">Depth</span> <span data-i18n="prompt_manager_depth">Depth</span>
</label> </label>
<div class="text_muted" data-i18n="Injection depth. 0 = after the last message, 1 = before the last message, etc.">Injection depth. 0 = after the last message, 1 = before the last message, etc.</div>
<input id="completion_prompt_manager_popup_entry_form_injection_depth" class="text_pole" type="number" name="injection_depth" min="0" max="9999" value="4" /> <input id="completion_prompt_manager_popup_entry_form_injection_depth" class="text_pole" type="number" name="injection_depth" min="0" max="9999" value="4" />
<div class="text_muted" data-i18n="0 = after the last message, 1 = before the last message, etc.">0 = after the last message, 1 = before the last message, etc.</div>
</div>
<div id="completion_prompt_manager_order_block" class="completion_prompt_manager_popup_entry_form_control flex1">
<label for="completion_prompt_manager_popup_entry_form_injection_order">
<span data-i18n="prompt_manager_order">Order</span>
</label>
<input id="completion_prompt_manager_popup_entry_form_injection_order" class="text_pole" type="number" name="injection_order" min="0" max="9999" value="0" />
<div class="text_muted" data-i18n="Ordered from high/top to low/bottom, and at same order: System, User, Assistant.">Ordered from high/top to low/bottom, and at same order: System, User, Assistant.</div>
</div> </div>
</div> </div>
<div class="completion_prompt_manager_popup_entry_form_control"> <div class="completion_prompt_manager_popup_entry_form_control">
@ -6484,7 +6489,6 @@
<label for="completion_prompt_manager_popup_entry_form_prompt"> <label for="completion_prompt_manager_popup_entry_form_prompt">
<span data-i18n="Prompt">Prompt</span> <span data-i18n="Prompt">Prompt</span>
</label> </label>
<div class="text_muted" data-i18n="The prompt to be sent.">The prompt to be sent.</div>
</div> </div>
<div id="completion_prompt_manager_forbid_overrides_block"> <div id="completion_prompt_manager_forbid_overrides_block">
<label class="checkbox_label" for="completion_prompt_manager_popup_entry_form_forbid_overrides" title="This prompt cannot be overridden by character cards, even if overrides are preferred." data-i18n="[title]This prompt cannot be overridden by character cards, even if overrides are preferred."> <label class="checkbox_label" for="completion_prompt_manager_popup_entry_form_forbid_overrides" title="This prompt cannot be overridden by character cards, even if overrides are preferred." data-i18n="[title]This prompt cannot be overridden by character cards, even if overrides are preferred.">
@ -6498,7 +6502,7 @@
<span>&nbsp;</span> <span>&nbsp;</span>
<span id="completion_prompt_manager_popup_entry_source"></span> <span id="completion_prompt_manager_popup_entry_source"></span>
</div> </div>
<textarea id="completion_prompt_manager_popup_entry_form_prompt" class="text_pole" name="prompt"> <textarea id="completion_prompt_manager_popup_entry_form_prompt" class="text_pole" name="prompt" placeholder="The prompt to be sent." data-i18n="[placeholder]The prompt to be sent."></textarea>
</textarea> </textarea>
</div> </div>
<div class="completion_prompt_manager_popup_entry_form_footer"> <div class="completion_prompt_manager_popup_entry_form_footer">

View File

@ -1009,10 +1009,10 @@
"To whom this message will be attributed.": "لمن ستنسب هذه الرسالة؟", "To whom this message will be attributed.": "لمن ستنسب هذه الرسالة؟",
"AI Assistant": "مساعد الذكاء الاصطناعي", "AI Assistant": "مساعد الذكاء الاصطناعي",
"prompt_manager_position": "موضع", "prompt_manager_position": "موضع",
"Injection position. Next to other prompts (relative) or in-chat (absolute).": "موضع الحقن. بجوار المطالبات الأخرى (نسبية) أو داخل الدردشة (مطلقة).", "Next to other prompts (relative) or in-chat (absolute).": "موضع الحقن. بجوار المطالبات الأخرى (نسبية) أو داخل الدردشة (مطلقة).",
"prompt_manager_relative": "نسبي", "prompt_manager_relative": "نسبي",
"prompt_manager_depth": "عمق", "prompt_manager_depth": "عمق",
"Injection depth. 0 = after the last message, 1 = before the last message, etc.": "عمق الحقن. 0 = بعد الرسالة الأخيرة، 1 = قبل الرسالة الأخيرة، الخ.", "0 = after the last message, 1 = before the last message, etc.": "عمق الحقن. 0 = بعد الرسالة الأخيرة، 1 = قبل الرسالة الأخيرة، الخ.",
"Prompt": "موضوع", "Prompt": "موضوع",
"The prompt to be sent.": "المطالبة ليتم إرسالها.", "The prompt to be sent.": "المطالبة ليتم إرسالها.",
"This prompt cannot be overridden by character cards, even if overrides are preferred.": "لا يمكن تجاوز هذه المطالبة بواسطة بطاقات الأحرف، حتى إذا كان التجاوزات مفضلاً.", "This prompt cannot be overridden by character cards, even if overrides are preferred.": "لا يمكن تجاوز هذه المطالبة بواسطة بطاقات الأحرف، حتى إذا كان التجاوزات مفضلاً.",

View File

@ -1009,10 +1009,10 @@
"To whom this message will be attributed.": "Wem diese Nachricht zugeschrieben wird.", "To whom this message will be attributed.": "Wem diese Nachricht zugeschrieben wird.",
"AI Assistant": "KI-Assistent", "AI Assistant": "KI-Assistent",
"prompt_manager_position": "Position", "prompt_manager_position": "Position",
"Injection position. Next to other prompts (relative) or in-chat (absolute).": "Injektionsposition. Neben anderen Eingabeaufforderungen (relativ) oder im Chat (absolut).", "Next to other prompts (relative) or in-chat (absolute).": "Neben anderen Eingabeaufforderungen (relativ) oder im Chat (absolut).",
"prompt_manager_relative": "Relativ", "prompt_manager_relative": "Relativ",
"prompt_manager_depth": "Tiefe", "prompt_manager_depth": "Tiefe",
"Injection depth. 0 = after the last message, 1 = before the last message, etc.": "Injektionstiefe. 0 = nach der letzten Nachricht, 1 = vor der letzten Nachricht usw.", "0 = after the last message, 1 = before the last message, etc.": "0 = nach der letzten Nachricht, 1 = vor der letzten Nachricht usw.",
"Prompt": "Aufforderung", "Prompt": "Aufforderung",
"The prompt to be sent.": "Die zu sendende Eingabeaufforderung.", "The prompt to be sent.": "Die zu sendende Eingabeaufforderung.",
"This prompt cannot be overridden by character cards, even if overrides are preferred.": "Diese Eingabeaufforderung kann nicht durch Charakterkarten überschrieben werden, selbst wenn dies bevorzugt wird.", "This prompt cannot be overridden by character cards, even if overrides are preferred.": "Diese Eingabeaufforderung kann nicht durch Charakterkarten überschrieben werden, selbst wenn dies bevorzugt wird.",

View File

@ -1009,10 +1009,10 @@
"To whom this message will be attributed.": "A quién se le atribuirá este mensaje.", "To whom this message will be attributed.": "A quién se le atribuirá este mensaje.",
"AI Assistant": "Asistente de IA", "AI Assistant": "Asistente de IA",
"prompt_manager_position": "Posición", "prompt_manager_position": "Posición",
"Injection position. Next to other prompts (relative) or in-chat (absolute).": "Posición de inyección. Junto a otras indicaciones (relativa) o en el chat (absoluta).", "Next to other prompts (relative) or in-chat (absolute).": "Junto a otras indicaciones (relativa) o en el chat (absoluta).",
"prompt_manager_relative": "Relativo", "prompt_manager_relative": "Relativo",
"prompt_manager_depth": "Profundidad", "prompt_manager_depth": "Profundidad",
"Injection depth. 0 = after the last message, 1 = before the last message, etc.": "Profundidad de inyección. 0 = después del último mensaje, 1 = antes del último mensaje, etc.", "0 = after the last message, 1 = before the last message, etc.": "0 = después del último mensaje, 1 = antes del último mensaje, etc.",
"Prompt": "Indicar", "Prompt": "Indicar",
"The prompt to be sent.": "El mensaje que se enviará.", "The prompt to be sent.": "El mensaje que se enviará.",
"This prompt cannot be overridden by character cards, even if overrides are preferred.": "Este mensaje no puede ser anulado por tarjetas de personaje, incluso si se prefieren las anulaciones.", "This prompt cannot be overridden by character cards, even if overrides are preferred.": "Este mensaje no puede ser anulado por tarjetas de personaje, incluso si se prefieren las anulaciones.",

View File

@ -950,7 +950,7 @@
"prompt_manager_position": "Position", "prompt_manager_position": "Position",
"prompt_manager_relative": "Relatif", "prompt_manager_relative": "Relatif",
"prompt_manager_depth": "Profondeur", "prompt_manager_depth": "Profondeur",
"Injection depth. 0 = after the last message, 1 = before the last message, etc.": "Profondeur d'injection. 0 = après le dernier message, 1 = avant le dernier message, etc.", "0 = after the last message, 1 = before the last message, etc.": "0 = après le dernier message, 1 = avant le dernier message, etc.",
"Prompt": "Prompt", "Prompt": "Prompt",
"The prompt to be sent.": "Le prompt à envoyer.", "The prompt to be sent.": "Le prompt à envoyer.",
"This prompt cannot be overridden by character cards, even if overrides are preferred.": "Ce prompt ne peut pas être remplacé par les cartes de personnage, même si les remplacements sont préférés.", "This prompt cannot be overridden by character cards, even if overrides are preferred.": "Ce prompt ne peut pas être remplacé par les cartes de personnage, même si les remplacements sont préférés.",
@ -1544,7 +1544,7 @@
"Filter to Characters or Tags": "Filtre sur les personnages ou les tags", "Filter to Characters or Tags": "Filtre sur les personnages ou les tags",
"Switch the Character/Tags filter around to exclude the listed characters and tags from matching for this entry": "Changez le filtre Personnages/Tags pour exclure les personnages et tags listés de la correspondance pour cette entrée.", "Switch the Character/Tags filter around to exclude the listed characters and tags from matching for this entry": "Changez le filtre Personnages/Tags pour exclure les personnages et tags listés de la correspondance pour cette entrée.",
"Exclude": "Exclure", "Exclude": "Exclure",
"Injection position. Relative (to other prompts in prompt manager) or In-chat @ Depth.": "Position d'injection. Relative (par rapport à d'autres prompts dans le gestionnaire de prompts) ou In-chat @ Depth.", "Relative (to other prompts in prompt manager) or In-chat @ Depth.": "Relative (par rapport à d'autres prompts dans le gestionnaire de prompts) ou In-chat @ Depth.",
"prompt_manager_in_chat": "In-chat", "prompt_manager_in_chat": "In-chat",
"The content of this prompt is pulled from elsewhere and cannot be edited here.": "Le contenu de ce message est tiré d'autres sources et ne peut être modifié ici..", "The content of this prompt is pulled from elsewhere and cannot be edited here.": "Le contenu de ce message est tiré d'autres sources et ne peut être modifié ici..",
"Open checkpoint chat\nShift+Click to replace the existing checkpoint with a new one": "Cliquer pour ouvrir le chat du point de contrôle\nShift+Click pour remplacer le point de contrôle existant par un nouveau.", "Open checkpoint chat\nShift+Click to replace the existing checkpoint with a new one": "Cliquer pour ouvrir le chat du point de contrôle\nShift+Click pour remplacer le point de contrôle existant par un nouveau.",

View File

@ -1009,10 +1009,10 @@
"To whom this message will be attributed.": "Hverjum þessi skilaboð verða eignuð.", "To whom this message will be attributed.": "Hverjum þessi skilaboð verða eignuð.",
"AI Assistant": "AI aðstoðarmaður", "AI Assistant": "AI aðstoðarmaður",
"prompt_manager_position": "Staða", "prompt_manager_position": "Staða",
"Injection position. Next to other prompts (relative) or in-chat (absolute).": "Inndælingarstaða. Við hliðina á öðrum leiðbeiningum (afstætt) eða í spjalli (algert).", "Next to other prompts (relative) or in-chat (absolute).": "Við hliðina á öðrum leiðbeiningum (afstætt) eða í spjalli (algert).",
"prompt_manager_relative": "Aðstandandi", "prompt_manager_relative": "Aðstandandi",
"prompt_manager_depth": "Dýpt", "prompt_manager_depth": "Dýpt",
"Injection depth. 0 = after the last message, 1 = before the last message, etc.": "Inndælingardýpt. 0 = eftir síðustu skilaboð, 1 = fyrir síðustu skilaboð o.s.frv.", "0 = after the last message, 1 = before the last message, etc.": "0 = eftir síðustu skilaboð, 1 = fyrir síðustu skilaboð o.s.frv.",
"Prompt": "Ábending", "Prompt": "Ábending",
"The prompt to be sent.": "Tilvitnunin sem á að senda.", "The prompt to be sent.": "Tilvitnunin sem á að senda.",
"This prompt cannot be overridden by character cards, even if overrides are preferred.": "Ekki er hægt að hnekkja þessari vísbendingu með persónuspjöldum, jafnvel þótt hnekkingar séu æskilegar.", "This prompt cannot be overridden by character cards, even if overrides are preferred.": "Ekki er hægt að hnekkja þessari vísbendingu með persónuspjöldum, jafnvel þótt hnekkingar séu æskilegar.",

View File

@ -1009,10 +1009,10 @@
"To whom this message will be attributed.": "A chi verrà attribuito questo messaggio.", "To whom this message will be attributed.": "A chi verrà attribuito questo messaggio.",
"AI Assistant": "Assistente AI", "AI Assistant": "Assistente AI",
"prompt_manager_position": "Posizione", "prompt_manager_position": "Posizione",
"Injection position. Next to other prompts (relative) or in-chat (absolute).": "Posizione di iniezione. Accanto ad altri suggerimenti (relativo) o in chat (assoluto).", "Next to other prompts (relative) or in-chat (absolute).": "Accanto ad altri suggerimenti (relativo) o in chat (assoluto).",
"prompt_manager_relative": "Parente", "prompt_manager_relative": "Parente",
"prompt_manager_depth": "Profondità", "prompt_manager_depth": "Profondità",
"Injection depth. 0 = after the last message, 1 = before the last message, etc.": "Profondità di iniezione. 0 = dopo l'ultimo messaggio, 1 = prima dell'ultimo messaggio, ecc.", "0 = after the last message, 1 = before the last message, etc.": "0 = dopo l'ultimo messaggio, 1 = prima dell'ultimo messaggio, ecc.",
"Prompt": "Prompt", "Prompt": "Prompt",
"The prompt to be sent.": "La richiesta da inviare.", "The prompt to be sent.": "La richiesta da inviare.",
"This prompt cannot be overridden by character cards, even if overrides are preferred.": "Questo prompt non può essere sostituito dalle schede personaggio, anche se si preferisce sostituirlo.", "This prompt cannot be overridden by character cards, even if overrides are preferred.": "Questo prompt non può essere sostituito dalle schede personaggio, anche se si preferisce sostituirlo.",

View File

@ -1009,10 +1009,10 @@
"To whom this message will be attributed.": "このメッセージの送信者。", "To whom this message will be attributed.": "このメッセージの送信者。",
"AI Assistant": "AIアシスタント", "AI Assistant": "AIアシスタント",
"prompt_manager_position": "位置", "prompt_manager_position": "位置",
"Injection position. Next to other prompts (relative) or in-chat (absolute).": "挿入位置。他のプロンプトの隣 (相対) またはチャット内 (絶対)。", "Next to other prompts (relative) or in-chat (absolute).": "他のプロンプトの隣 (相対) またはチャット内 (絶対)。",
"prompt_manager_relative": "相対的", "prompt_manager_relative": "相対的",
"prompt_manager_depth": "深さ", "prompt_manager_depth": "深さ",
"Injection depth. 0 = after the last message, 1 = before the last message, etc.": "注入の深さ。0 = 最後のメッセージの後、1 = 最後のメッセージの前など。", "0 = after the last message, 1 = before the last message, etc.": "0 = 最後のメッセージの後、1 = 最後のメッセージの前など。",
"Prompt": "プロンプト", "Prompt": "プロンプト",
"The prompt to be sent.": "送信されるプロンプト。", "The prompt to be sent.": "送信されるプロンプト。",
"This prompt cannot be overridden by character cards, even if overrides are preferred.": "このプロンプトは、オーバーライドが優先される場合でも、キャラクター カードによってオーバーライドすることはできません。", "This prompt cannot be overridden by character cards, even if overrides are preferred.": "このプロンプトは、オーバーライドが優先される場合でも、キャラクター カードによってオーバーライドすることはできません。",

View File

@ -1026,11 +1026,11 @@
"To whom this message will be attributed.": "해당 프롬프트에 부여할 역할은 무엇인가요?", "To whom this message will be attributed.": "해당 프롬프트에 부여할 역할은 무엇인가요?",
"AI Assistant": "AI 어시스턴트", "AI Assistant": "AI 어시스턴트",
"prompt_manager_position": "위치", "prompt_manager_position": "위치",
"Injection position. Next to other prompts (relative) or in-chat (absolute).": "주입 위치. 다른 프롬프트 옆(상대적) 또는 채팅 내(절대적).", "Next to other prompts (relative) or in-chat (absolute).": "다른 프롬프트 옆(상대적) 또는 채팅 내(절대적).",
"prompt_manager_relative": "상대적인", "prompt_manager_relative": "상대적인",
"prompt_manager_in_chat": "깊이에 따라", "prompt_manager_in_chat": "깊이에 따라",
"prompt_manager_depth": "깊이", "prompt_manager_depth": "깊이",
"Injection depth. 0 = after the last message, 1 = before the last message, etc.": "주입 깊이. 0 = 마지막 메시지 뒤, 1 = 마지막 메시지 앞 등", "0 = after the last message, 1 = before the last message, etc.": "0 = 마지막 메시지 뒤, 1 = 마지막 메시지 앞 등",
"Prompt": "프롬프트", "Prompt": "프롬프트",
"The prompt to be sent.": "보내질 프롬프트 내용을 작성하는 부분입니다.", "The prompt to be sent.": "보내질 프롬프트 내용을 작성하는 부분입니다.",
"This prompt cannot be overridden by character cards, even if overrides are preferred.": "이 프롬프트는 고급 정의에서 재정의가 선호되는 경우에도 재정의될 수 없습니다.", "This prompt cannot be overridden by character cards, even if overrides are preferred.": "이 프롬프트는 고급 정의에서 재정의가 선호되는 경우에도 재정의될 수 없습니다.",
@ -1500,7 +1500,7 @@
"enable_functions_desc_1": "다양한 확장 프로그램에서 추가 기능을 제공하기 위한", "enable_functions_desc_1": "다양한 확장 프로그램에서 추가 기능을 제공하기 위한",
"enable_functions_desc_2": "기능 도구", "enable_functions_desc_2": "기능 도구",
"enable_functions_desc_3": "를 사용할 수 있게 합니다.", "enable_functions_desc_3": "를 사용할 수 있게 합니다.",
"Injection position. Relative (to other prompts in prompt manager) or In-chat @ Depth.": "삽입 깊이. 상대적인 (프롬프트 관리 목록에 있는 다른 프롬프트들에 비해) 또는 @Depth 깊이에 따라.", "Relative (to other prompts in prompt manager) or In-chat @ Depth.": "상대적인 (프롬프트 관리 목록에 있는 다른 프롬프트들에 비해) 또는 @Depth 깊이에 따라.",
"Instruct Template": "지시 템플릿", "Instruct Template": "지시 템플릿",
"System Message Sequences": "시스템 메시지 시퀀스", "System Message Sequences": "시스템 메시지 시퀀스",
"System Prompt Sequences": "시스템 프롬프트 시퀀스", "System Prompt Sequences": "시스템 프롬프트 시퀀스",

View File

@ -1009,10 +1009,10 @@
"To whom this message will be attributed.": "Aan wie dit bericht wordt toegeschreven.", "To whom this message will be attributed.": "Aan wie dit bericht wordt toegeschreven.",
"AI Assistant": "AI-assistent", "AI Assistant": "AI-assistent",
"prompt_manager_position": "Positie", "prompt_manager_position": "Positie",
"Injection position. Next to other prompts (relative) or in-chat (absolute).": "Injectiepositie. Naast andere prompts (relatief) of in-chat (absoluut).", "Next to other prompts (relative) or in-chat (absolute).": "Naast andere prompts (relatief) of in-chat (absoluut).",
"prompt_manager_relative": "Familielid", "prompt_manager_relative": "Familielid",
"prompt_manager_depth": "Diepte", "prompt_manager_depth": "Diepte",
"Injection depth. 0 = after the last message, 1 = before the last message, etc.": "Injectiediepte. 0 = na het laatste bericht, 1 = voor het laatste bericht, etc.", "0 = after the last message, 1 = before the last message, etc.": "0 = na het laatste bericht, 1 = voor het laatste bericht, etc.",
"Prompt": "Prompt", "Prompt": "Prompt",
"The prompt to be sent.": "De prompt die verzonden moet worden.", "The prompt to be sent.": "De prompt die verzonden moet worden.",
"This prompt cannot be overridden by character cards, even if overrides are preferred.": "Deze prompt kan niet worden overschreven door karakterkaarten, zelfs als overschrijvingen de voorkeur hebben.", "This prompt cannot be overridden by character cards, even if overrides are preferred.": "Deze prompt kan niet worden overschreven door karakterkaarten, zelfs als overschrijvingen de voorkeur hebben.",

View File

@ -1009,10 +1009,10 @@
"To whom this message will be attributed.": "A quem esta mensagem será atribuída.", "To whom this message will be attributed.": "A quem esta mensagem será atribuída.",
"AI Assistant": "Assistente de IA", "AI Assistant": "Assistente de IA",
"prompt_manager_position": "Posição", "prompt_manager_position": "Posição",
"Injection position. Next to other prompts (relative) or in-chat (absolute).": "Posição de injeção. Ao lado de outras solicitações (relativas) ou no chat (absolutas).", "Next to other prompts (relative) or in-chat (absolute).": "Ao lado de outras solicitações (relativas) ou no chat (absolutas).",
"prompt_manager_relative": "Relativo", "prompt_manager_relative": "Relativo",
"prompt_manager_depth": "Profundidade", "prompt_manager_depth": "Profundidade",
"Injection depth. 0 = after the last message, 1 = before the last message, etc.": "Profundidade de injeção. 0 = após a última mensagem, 1 = antes da última mensagem, etc.", "0 = after the last message, 1 = before the last message, etc.": "0 = após a última mensagem, 1 = antes da última mensagem, etc.",
"Prompt": "Prompt", "Prompt": "Prompt",
"The prompt to be sent.": "O prompt a ser enviado.", "The prompt to be sent.": "O prompt a ser enviado.",
"This prompt cannot be overridden by character cards, even if overrides are preferred.": "Este prompt não pode ser substituído por cartas de personagem, mesmo que as substituições sejam preferidas.", "This prompt cannot be overridden by character cards, even if overrides are preferred.": "Este prompt não pode ser substituído por cartas de personagem, mesmo que as substituições sejam preferidas.",

View File

@ -1012,10 +1012,10 @@
"To whom this message will be attributed.": "От чьего лица будет отправляться сообщение.", "To whom this message will be attributed.": "От чьего лица будет отправляться сообщение.",
"AI Assistant": "ИИ-ассистент", "AI Assistant": "ИИ-ассистент",
"prompt_manager_position": "Точка инжекта", "prompt_manager_position": "Точка инжекта",
"Injection position. Next to other prompts (relative) or in-chat (absolute).": "Как рассчитывать позицию для инжекта. Она может располагаться по отношению к другим промптам (относительная) либо по отношению к чату (абсолютная).", "Next to other prompts (relative) or in-chat (absolute).": "Она может располагаться по отношению к другим промптам (относительная) либо по отношению к чату (абсолютная).",
"prompt_manager_relative": "Относительная", "prompt_manager_relative": "Относительная",
"prompt_manager_depth": "Глубина", "prompt_manager_depth": "Глубина",
"Injection depth. 0 = after the last message, 1 = before the last message, etc.": "Глубина вставки. 0 = после последнего сообщения, 1 = перед последним сообщением, и т.д.", "0 = after the last message, 1 = before the last message, etc.": "0 = после последнего сообщения, 1 = перед последним сообщением, и т.д.",
"The prompt to be sent.": "Текст промпта.", "The prompt to be sent.": "Текст промпта.",
"prompt_manager_forbid_overrides": "Запретить перезапись", "prompt_manager_forbid_overrides": "Запретить перезапись",
"This prompt cannot be overridden by character cards, even if overrides are preferred.": "Карточка персонажа не сможет перезаписать этот промпт, даже если настройки отдают приоритет именно ей.", "This prompt cannot be overridden by character cards, even if overrides are preferred.": "Карточка персонажа не сможет перезаписать этот промпт, даже если настройки отдают приоритет именно ей.",
@ -1620,7 +1620,7 @@
"Using a proxy that you're not running yourself is a risk to your data privacy.": "Помните, что используя чужую прокси, вы подвергаете риску конфиденциальность своих данных.", "Using a proxy that you're not running yourself is a risk to your data privacy.": "Помните, что используя чужую прокси, вы подвергаете риску конфиденциальность своих данных.",
"ANY support requests will be REFUSED if you are using a proxy.": "НЕ РАССЧИТЫВАЙТЕ на нашу поддержку, если используете прокси.", "ANY support requests will be REFUSED if you are using a proxy.": "НЕ РАССЧИТЫВАЙТЕ на нашу поддержку, если используете прокси.",
"Do not proceed if you do not agree to this!": "Не продолжайте, если не согласны с этими условиями!", "Do not proceed if you do not agree to this!": "Не продолжайте, если не согласны с этими условиями!",
"Injection position. Relative (to other prompts in prompt manager) or In-chat @ Depth.": "Как рассчитывать позицию, на которую вставляется данный промпт. Относительно других промтов в менеджере, либо на опред. глубину в чате.", "Relative (to other prompts in prompt manager) or In-chat @ Depth.": "Относительно других промтов в менеджере, либо на опред. глубину в чате.",
"prompt_manager_in_chat": "На глубине в чате", "prompt_manager_in_chat": "На глубине в чате",
"01.AI API Key": "Ключ от API 01.AI", "01.AI API Key": "Ключ от API 01.AI",
"01.AI Model": "Модель 01.AI", "01.AI Model": "Модель 01.AI",

View File

@ -1009,10 +1009,10 @@
"To whom this message will be attributed.": "Кому буде віднесено це повідомлення.", "To whom this message will be attributed.": "Кому буде віднесено це повідомлення.",
"AI Assistant": "ШІ помічник", "AI Assistant": "ШІ помічник",
"prompt_manager_position": "Позиція", "prompt_manager_position": "Позиція",
"Injection position. Next to other prompts (relative) or in-chat (absolute).": "Позиція ін'єкції. Поруч з іншими підказками (відносні) або в чаті (абсолютні).", "Next to other prompts (relative) or in-chat (absolute).": "Поруч з іншими підказками (відносні) або в чаті (абсолютні).",
"prompt_manager_relative": "Відносна", "prompt_manager_relative": "Відносна",
"prompt_manager_depth": "Глибина", "prompt_manager_depth": "Глибина",
"Injection depth. 0 = after the last message, 1 = before the last message, etc.": "Глибина ін'єкції. 0 = після останнього повідомлення, 1 = перед останнім повідомленням тощо.", "0 = after the last message, 1 = before the last message, etc.": "0 = після останнього повідомлення, 1 = перед останнім повідомленням тощо.",
"Prompt": "Запит", "Prompt": "Запит",
"The prompt to be sent.": "Підказка для надсилання.", "The prompt to be sent.": "Підказка для надсилання.",
"This prompt cannot be overridden by character cards, even if overrides are preferred.": "Це підказка не може бути перевизначено картками символів, навіть якщо перевизначення є кращим.", "This prompt cannot be overridden by character cards, even if overrides are preferred.": "Це підказка не може бути перевизначено картками символів, навіть якщо перевизначення є кращим.",

View File

@ -1009,10 +1009,10 @@
"To whom this message will be attributed.": "Tin nhắn này sẽ được quy cho ai.", "To whom this message will be attributed.": "Tin nhắn này sẽ được quy cho ai.",
"AI Assistant": "Trợ lý AI", "AI Assistant": "Trợ lý AI",
"prompt_manager_position": "Chức vụ", "prompt_manager_position": "Chức vụ",
"Injection position. Next to other prompts (relative) or in-chat (absolute).": "Vị trí tiêm. Bên cạnh các Prompt khác (tương đối) hoặc trong trò chuyện (tuyệt đối).", "Next to other prompts (relative) or in-chat (absolute).": "Bên cạnh các Prompt khác (tương đối) hoặc trong trò chuyện (tuyệt đối).",
"prompt_manager_relative": "Liên quan đến", "prompt_manager_relative": "Liên quan đến",
"prompt_manager_depth": "Chiều sâu", "prompt_manager_depth": "Chiều sâu",
"Injection depth. 0 = after the last message, 1 = before the last message, etc.": "Độ sâu phun. 0 = sau tin nhắn cuối cùng, 1 = trước tin nhắn cuối cùng, v.v.", "0 = after the last message, 1 = before the last message, etc.": "0 = sau tin nhắn cuối cùng, 1 = trước tin nhắn cuối cùng, v.v.",
"Prompt": "Prompt", "Prompt": "Prompt",
"The prompt to be sent.": "Lời nhắc được gửi đi.", "The prompt to be sent.": "Lời nhắc được gửi đi.",
"This prompt cannot be overridden by character cards, even if overrides are preferred.": "Lời nhắc này không thể bị ghi đè bằng thẻ ký tự, ngay cả khi ưu tiên ghi đè.", "This prompt cannot be overridden by character cards, even if overrides are preferred.": "Lời nhắc này không thể bị ghi đè bằng thẻ ký tự, ngay cả khi ưu tiên ghi đè.",

View File

@ -1168,11 +1168,11 @@
"To whom this message will be attributed.": "此消息应归于谁。", "To whom this message will be attributed.": "此消息应归于谁。",
"AI Assistant": "AI助手", "AI Assistant": "AI助手",
"prompt_manager_position": "位置", "prompt_manager_position": "位置",
"Injection position. Relative (to other prompts in prompt manager) or In-chat @ Depth.": "注入位置。相对(相对于提示管理器中的其他提示)或在聊天中@深度。", "Relative (to other prompts in prompt manager) or In-chat @ Depth.": "相对(相对于提示管理器中的其他提示)或在聊天中@深度。",
"prompt_manager_relative": "相对", "prompt_manager_relative": "相对",
"prompt_manager_in_chat": "聊天中", "prompt_manager_in_chat": "聊天中",
"prompt_manager_depth": "深度", "prompt_manager_depth": "深度",
"Injection depth. 0 = after the last message, 1 = before the last message, etc.": "注入深度。“0”为在最后一条消息之后“1”为在最后一条消息之前等等。", "0 = after the last message, 1 = before the last message, etc.": "“0”为在最后一条消息之后“1”为在最后一条消息之前等等。",
"The content of this prompt is pulled from elsewhere and cannot be edited here.": "此提示词的内容是从其他地方提取的,无法在此处进行编辑。", "The content of this prompt is pulled from elsewhere and cannot be edited here.": "此提示词的内容是从其他地方提取的,无法在此处进行编辑。",
"Prompt": "提示词", "Prompt": "提示词",
"The prompt to be sent.": "要发送的提示词。", "The prompt to be sent.": "要发送的提示词。",

View File

@ -1010,10 +1010,10 @@
"To whom this message will be attributed.": "此訊息所屬的角色。", "To whom this message will be attributed.": "此訊息所屬的角色。",
"AI Assistant": "人工智慧助手", "AI Assistant": "人工智慧助手",
"prompt_manager_position": "位置", "prompt_manager_position": "位置",
"Injection position. Next to other prompts (relative) or in-chat (absolute).": "注入位置。與其他提示詞相鄰(相對位置)或在聊天中(絕對位置)。", "Next to other prompts (relative) or in-chat (absolute).": "與其他提示詞相鄰(相對位置)或在聊天中(絕對位置)。",
"prompt_manager_relative": "相對位置", "prompt_manager_relative": "相對位置",
"prompt_manager_depth": "深度", "prompt_manager_depth": "深度",
"Injection depth. 0 = after the last message, 1 = before the last message, etc.": "注入深度。0 = 在最後一則訊息之後1 = 在最後一則訊息之前,以此類推。", "0 = after the last message, 1 = before the last message, etc.": "0 = 在最後一則訊息之後1 = 在最後一則訊息之前,以此類推。",
"Prompt": "提示詞", "Prompt": "提示詞",
"The prompt to be sent.": "要傳送的提示詞。", "The prompt to be sent.": "要傳送的提示詞。",
"This prompt cannot be overridden by character cards, even if overrides are preferred.": "即使啟用優先覆寫,此提示詞也不能被角色卡片覆寫。", "This prompt cannot be overridden by character cards, even if overrides are preferred.": "即使啟用優先覆寫,此提示詞也不能被角色卡片覆寫。",
@ -1650,7 +1650,7 @@
"Image Captioning": "圖片註解", "Image Captioning": "圖片註解",
"Generate Caption": "產生圖片註解", "Generate Caption": "產生圖片註解",
"Injection Position": "插入位置", "Injection Position": "插入位置",
"Injection position. Relative (to other prompts in prompt manager) or In-chat @ Depth.": "插入位置(與提示詞管理器中的其他提示相比)或聊天中的深度位置。", "Relative (to other prompts in prompt manager) or In-chat @ Depth.": "插入位置(與提示詞管理器中的其他提示相比)或聊天中的深度位置。",
"Injection Template": "插入範本", "Injection Template": "插入範本",
"Insert#": "插入#", "Insert#": "插入#",
"Instruct Sequences": "指令序列", "Instruct Sequences": "指令序列",

View File

@ -77,7 +77,7 @@ const registerPromptManagerMigration = () => {
* Represents a prompt. * Represents a prompt.
*/ */
class Prompt { class Prompt {
identifier; role; content; name; system_prompt; position; injection_position; injection_depth; forbid_overrides; extension; identifier; role; content; name; system_prompt; position; injection_position; injection_depth; injection_order; forbid_overrides; extension;
/** /**
* Create a new Prompt instance. * Create a new Prompt instance.
@ -91,10 +91,11 @@ class Prompt {
* @param {string} [param0.position] - The position of the prompt in the prompt list. * @param {string} [param0.position] - The position of the prompt in the prompt list.
* @param {number} [param0.injection_position] - The insert position of the prompt. * @param {number} [param0.injection_position] - The insert position of the prompt.
* @param {number} [param0.injection_depth] - The depth of the prompt in the chat. * @param {number} [param0.injection_depth] - The depth of the prompt in the chat.
* @param {number} [param0.injection_order] - The order of the prompt in the chat.
* @param {boolean} [param0.forbid_overrides] - Indicates if the prompt should not be overridden. * @param {boolean} [param0.forbid_overrides] - Indicates if the prompt should not be overridden.
* @param {boolean} [param0.extension] - Prompt is added by an extension. * @param {boolean} [param0.extension] - Prompt is added by an extension.
*/ */
constructor({ identifier, role, content, name, system_prompt, position, injection_depth, injection_position, forbid_overrides, extension }) { constructor({ identifier, role, content, name, system_prompt, position, injection_depth, injection_position, forbid_overrides, extension, injection_order } = {}) {
this.identifier = identifier; this.identifier = identifier;
this.role = role; this.role = role;
this.content = content; this.content = content;
@ -105,6 +106,7 @@ class Prompt {
this.injection_position = injection_position; this.injection_position = injection_position;
this.forbid_overrides = forbid_overrides; this.forbid_overrides = forbid_overrides;
this.extension = extension ?? false; this.extension = extension ?? false;
this.injection_order = injection_order ?? 0;
} }
} }
@ -447,7 +449,9 @@ class PromptManager {
document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_prompt').value = prompt.content ?? ''; document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_prompt').value = prompt.content ?? '';
document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_position').value = prompt.injection_position ?? 0; document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_position').value = prompt.injection_position ?? 0;
document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_depth').value = prompt.injection_depth ?? DEFAULT_DEPTH; document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_depth').value = prompt.injection_depth ?? DEFAULT_DEPTH;
document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_order').value = prompt.injection_order ?? 0;
document.getElementById(this.configuration.prefix + 'prompt_manager_depth_block').style.visibility = prompt.injection_position === INJECTION_POSITION.ABSOLUTE ? 'visible' : 'hidden'; document.getElementById(this.configuration.prefix + 'prompt_manager_depth_block').style.visibility = prompt.injection_position === INJECTION_POSITION.ABSOLUTE ? 'visible' : 'hidden';
document.getElementById(this.configuration.prefix + 'prompt_manager_order_block').style.visibility = prompt.injection_position === INJECTION_POSITION.ABSOLUTE ? 'visible' : 'hidden';
document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_forbid_overrides').checked = prompt.forbid_overrides ?? false; document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_forbid_overrides').checked = prompt.forbid_overrides ?? false;
document.getElementById(this.configuration.prefix + 'prompt_manager_forbid_overrides_block').style.visibility = this.overridablePrompts.includes(prompt.identifier) ? 'visible' : 'hidden'; document.getElementById(this.configuration.prefix + 'prompt_manager_forbid_overrides_block').style.visibility = this.overridablePrompts.includes(prompt.identifier) ? 'visible' : 'hidden';
document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_prompt').disabled = prompt.marker ?? false; document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_prompt').disabled = prompt.marker ?? false;
@ -782,6 +786,7 @@ class PromptManager {
prompt.content = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_prompt').value; prompt.content = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_prompt').value;
prompt.injection_position = Number(document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_position').value); prompt.injection_position = Number(document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_position').value);
prompt.injection_depth = Number(document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_depth').value); prompt.injection_depth = Number(document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_depth').value);
prompt.injection_order = Number(document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_order').value);
prompt.forbid_overrides = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_forbid_overrides').checked; prompt.forbid_overrides = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_forbid_overrides').checked;
} }
@ -1222,7 +1227,9 @@ class PromptManager {
const promptField = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_prompt'); const promptField = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_prompt');
const injectionPositionField = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_position'); const injectionPositionField = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_position');
const injectionDepthField = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_depth'); const injectionDepthField = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_depth');
const injectionOrderField = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_order');
const injectionDepthBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_depth_block'); const injectionDepthBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_depth_block');
const injectionOrderBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_order_block');
const forbidOverridesField = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_forbid_overrides'); const forbidOverridesField = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_forbid_overrides');
const forbidOverridesBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_forbid_overrides_block'); const forbidOverridesBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_forbid_overrides_block');
const entrySourceBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_source_block'); const entrySourceBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_source_block');
@ -1235,7 +1242,9 @@ class PromptManager {
promptField.disabled = prompt.marker ?? false; promptField.disabled = prompt.marker ?? false;
injectionPositionField.value = prompt.injection_position ?? INJECTION_POSITION.RELATIVE; injectionPositionField.value = prompt.injection_position ?? INJECTION_POSITION.RELATIVE;
injectionDepthField.value = prompt.injection_depth ?? DEFAULT_DEPTH; injectionDepthField.value = prompt.injection_depth ?? DEFAULT_DEPTH;
injectionOrderField.value = prompt.injection_order ?? 0;
injectionDepthBlock.style.visibility = prompt.injection_position === INJECTION_POSITION.ABSOLUTE ? 'visible' : 'hidden'; injectionDepthBlock.style.visibility = prompt.injection_position === INJECTION_POSITION.ABSOLUTE ? 'visible' : 'hidden';
injectionOrderBlock.style.visibility = prompt.injection_position === INJECTION_POSITION.ABSOLUTE ? 'visible' : 'hidden';
injectionPositionField.removeAttribute('disabled'); injectionPositionField.removeAttribute('disabled');
forbidOverridesField.checked = prompt.forbid_overrides ?? false; forbidOverridesField.checked = prompt.forbid_overrides ?? false;
forbidOverridesBlock.style.visibility = this.overridablePrompts.includes(prompt.identifier) ? 'visible' : 'hidden'; forbidOverridesBlock.style.visibility = this.overridablePrompts.includes(prompt.identifier) ? 'visible' : 'hidden';
@ -1267,11 +1276,14 @@ class PromptManager {
handleInjectionPositionChange(event) { handleInjectionPositionChange(event) {
const injectionDepthBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_depth_block'); const injectionDepthBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_depth_block');
const injectionOrderBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_order_block');
const injectionPosition = Number(event.target.value); const injectionPosition = Number(event.target.value);
if (injectionPosition === INJECTION_POSITION.ABSOLUTE) { if (injectionPosition === INJECTION_POSITION.ABSOLUTE) {
injectionDepthBlock.style.visibility = 'visible'; injectionDepthBlock.style.visibility = 'visible';
injectionOrderBlock.style.visibility = 'visible';
} else { } else {
injectionDepthBlock.style.visibility = 'hidden'; injectionDepthBlock.style.visibility = 'hidden';
injectionOrderBlock.style.visibility = 'hidden';
} }
} }
@ -1328,6 +1340,7 @@ class PromptManager {
const injectionPositionField = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_position'); const injectionPositionField = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_position');
const injectionDepthField = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_depth'); const injectionDepthField = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_depth');
const injectionDepthBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_depth_block'); const injectionDepthBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_depth_block');
const injectionOrderBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_order_block');
const forbidOverridesField = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_forbid_overrides'); const forbidOverridesField = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_forbid_overrides');
const forbidOverridesBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_forbid_overrides_block'); const forbidOverridesBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_forbid_overrides_block');
const entrySourceBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_source_block'); const entrySourceBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_source_block');
@ -1341,6 +1354,7 @@ class PromptManager {
injectionPositionField.removeAttribute('disabled'); injectionPositionField.removeAttribute('disabled');
injectionDepthField.value = DEFAULT_DEPTH; injectionDepthField.value = DEFAULT_DEPTH;
injectionDepthBlock.style.visibility = 'unset'; injectionDepthBlock.style.visibility = 'unset';
injectionOrderBlock.style.visibility = 'unset';
forbidOverridesBlock.style.visibility = 'unset'; forbidOverridesBlock.style.visibility = 'unset';
forbidOverridesField.checked = false; forbidOverridesField.checked = false;
entrySourceBlock.style.display = 'none'; entrySourceBlock.style.display = 'none';

View File

@ -760,22 +760,40 @@ async function populationInjectionPrompts(prompts, messages) {
// Get prompts for current depth // Get prompts for current depth
const depthPrompts = prompts.filter(prompt => prompt.injection_depth === i && prompt.content); const depthPrompts = prompts.filter(prompt => prompt.injection_depth === i && prompt.content);
// Order of priority (most important go lower)
const roles = ['system', 'user', 'assistant'];
const roleMessages = []; const roleMessages = [];
const separator = '\n'; const separator = '\n';
const wrap = false; const wrap = false;
for (const role of roles) { // Group prompts by priority
// Get prompts for current role const orderGroups = {};
const rolePrompts = depthPrompts.filter(prompt => prompt.role === role).map(x => x.content).join(separator); for (const prompt of depthPrompts) {
// Get extension prompt const order = prompt.injection_order || 0;
const extensionPrompt = await getExtensionPrompt(extension_prompt_types.IN_CHAT, i, separator, roleTypes[role], wrap); if (!orderGroups[order]) {
orderGroups[order] = [];
}
orderGroups[order].push(prompt);
}
const jointPrompt = [rolePrompts, extensionPrompt].filter(x => x).map(x => x.trim()).join(separator); // Process each order group in order (b - a = low to high ; a - b = high to low)
const orders = Object.keys(orderGroups).sort((a, b) => +a - +b);
for (const order of orders) {
const orderPrompts = orderGroups[order];
if (jointPrompt && jointPrompt.length) { // Order of priority for roles (most important go lower)
roleMessages.push({ 'role': role, 'content': jointPrompt, injected: true }); const roles = ['system', 'user', 'assistant'];
for (const role of roles) {
const rolePrompts = orderPrompts
.filter(prompt => prompt.role === role)
.map(x => x.content)
.join(separator);
// Get extension prompt
const extensionPrompt = await getExtensionPrompt(extension_prompt_types.IN_CHAT, i, separator, roleTypes[role], wrap);
const jointPrompt = [rolePrompts, extensionPrompt].filter(x => x).map(x => x.trim()).join(separator);
if (jointPrompt && jointPrompt.length) {
roleMessages.push({ 'role': role, 'content': jointPrompt, injected: true });
}
} }
} }
@ -1314,6 +1332,8 @@ async function preparePromptsForChatCompletion({ scenario, charPersonality, name
prompt.injection_position = collectionPrompt.injection_position ?? prompt.injection_position; prompt.injection_position = collectionPrompt.injection_position ?? prompt.injection_position;
// Depth for In-Chat // Depth for In-Chat
prompt.injection_depth = collectionPrompt.injection_depth ?? prompt.injection_depth; prompt.injection_depth = collectionPrompt.injection_depth ?? prompt.injection_depth;
// Priority for In-Chat
prompt.injection_order = collectionPrompt.injection_order ?? prompt.injection_order;
// Role (system, user, assistant) // Role (system, user, assistant)
prompt.role = collectionPrompt.role ?? prompt.role; prompt.role = collectionPrompt.role ?? prompt.role;
} }