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>
Signed| @@ -6442,21 +6442,19 @@ | ||
| 6442 | 6442 | <label for="completion_prompt_manager_popup_entry_form_name"> |
| 6443 | 6443 | <span data-i18n="prompt_manager_name">Name</span> |
| 6444 | 6444 | </label> |
| 6445 | - <div class="text_muted" data-i18n="A name for this prompt.">A name for this prompt.</div> | |
| 6446 | 6445 | <input id="completion_prompt_manager_popup_entry_form_name" class="text_pole" type="text" name="name" /> |
| 6446 | + <div class="text_muted" data-i18n="A name for this prompt.">A name for this prompt.</div> | |
| 6447 | 6447 | </div> |
| 6448 | 6448 | <div class="completion_prompt_manager_popup_entry_form_control flex1"> |
| 6449 | 6449 | <label for="completion_prompt_manager_popup_entry_form_role"> |
| 6450 | 6450 | <span data-i18n="Role">Role</span> |
| 6451 | 6451 | </label> |
| 6452 | - <div class="text_muted"> | |
| 6453 | - <span data-i18n="To whom this message will be attributed.">To whom this message will be attributed.</span> | |
| 6454 | - </div> | |
| 6455 | 6452 | <select id="completion_prompt_manager_popup_entry_form_role" class="text_pole" name="role"> |
| 6456 | 6453 | <option data-i18n="System" value="system">System</option> |
| 6457 | 6454 | <option data-i18n="User" value="user">User</option> |
| 6458 | 6455 | <option data-i18n="AI Assistant" value="assistant">AI Assistant</option> |
| 6459 | 6456 | </select> |
| 6457 | + <div class="text_muted" data-i18n="To whom this message will be attributed.">To whom this message will be attributed.</div> | |
| 6460 | 6458 | </div> |
| 6461 | 6459 | </div> |
| 6462 | 6460 | <div class="flex-container gap10px"> |
| @@ -6464,18 +6462,25 @@ | ||
| 6464 | 6462 | <label for="completion_prompt_manager_popup_entry_form_injection_position"> |
| 6465 | 6463 | <span data-i18n="prompt_manager_position">Position</span> |
| 6466 | 6464 | </label> |
| 6467 | - <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> | |
| 6468 | 6465 | <select id="completion_prompt_manager_popup_entry_form_injection_position" class="text_pole" name="injection_position"> |
| 6469 | 6466 | <option data-i18n="prompt_manager_relative" value="0">Relative</option> |
| 6470 | 6467 | <option data-i18n="prompt_manager_in_chat" value="1">In-chat</option> |
| 6471 | 6468 | </select> |
| 6469 | + <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> | |
| 6472 | 6470 | </div> |
| 6473 | 6471 | <div id="completion_prompt_manager_depth_block" class="completion_prompt_manager_popup_entry_form_control flex1"> |
| 6474 | 6472 | <label for="completion_prompt_manager_popup_entry_form_injection_depth"> |
| 6475 | 6473 | <span data-i18n="prompt_manager_depth">Depth</span> |
| 6476 | 6474 | </label> |
| 6477 | - <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> | |
| 6478 | 6475 | <input id="completion_prompt_manager_popup_entry_form_injection_depth" class="text_pole" type="number" name="injection_depth" min="0" max="9999" value="4" /> |
| 6476 | + <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> | |
| 6477 | + </div> | |
| 6478 | + <div id="completion_prompt_manager_order_block" class="completion_prompt_manager_popup_entry_form_control flex1"> | |
| 6479 | + <label for="completion_prompt_manager_popup_entry_form_injection_order"> | |
| 6480 | + <span data-i18n="prompt_manager_order">Order</span> | |
| 6481 | + </label> | |
| 6482 | + <input id="completion_prompt_manager_popup_entry_form_injection_order" class="text_pole" type="number" name="injection_order" min="0" max="9999" value="0" /> | |
| 6483 | + <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> | |
| 6479 | 6484 | </div> |
| 6480 | 6485 | </div> |
| 6481 | 6486 | <div class="completion_prompt_manager_popup_entry_form_control"> |
| @@ -6484,7 +6489,6 @@ | ||
| 6484 | 6489 | <label for="completion_prompt_manager_popup_entry_form_prompt"> |
| 6485 | 6490 | <span data-i18n="Prompt">Prompt</span> |
| 6486 | 6491 | </label> |
| 6487 | - <div class="text_muted" data-i18n="The prompt to be sent.">The prompt to be sent.</div> | |
| 6488 | 6492 | </div> |
| 6489 | 6493 | <div id="completion_prompt_manager_forbid_overrides_block"> |
| 6490 | 6494 | <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 @@ | ||
| 6498 | 6502 | <span> </span> |
| 6499 | 6503 | <span id="completion_prompt_manager_popup_entry_source"></span> |
| 6500 | 6504 | </div> |
| 6501 | 6505 | <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> |
| 6502 | 6506 | </textarea> |
| 6503 | 6507 | </div> |
| 6504 | 6508 | <div class="completion_prompt_manager_popup_entry_form_footer"> |
| @@ -1009,10 +1009,10 @@ | ||
| 1009 | 1009 | "To whom this message will be attributed.": "لمن ستنسب هذه الرسالة؟", |
| 1010 | 1010 | "AI Assistant": "مساعد الذكاء الاصطناعي", |
| 1011 | 1011 | "prompt_manager_position": "موضع", |
| 1012 | 1012 | "Injection position. Next to other prompts (relative) or in-chat (absolute).": "موضع الحقن. بجوار المطالبات الأخرى (نسبية) أو داخل الدردشة (مطلقة).", |
| 1013 | 1013 | "prompt_manager_relative": "نسبي", |
| 1014 | 1014 | "prompt_manager_depth": "عمق", |
| 1015 | 1015 | "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "عمق الحقن. 0 = بعد الرسالة الأخيرة، 1 = قبل الرسالة الأخيرة، الخ.", |
| 1016 | 1016 | "Prompt": "موضوع", |
| 1017 | 1017 | "The prompt to be sent.": "المطالبة ليتم إرسالها.", |
| 1018 | 1018 | "This prompt cannot be overridden by character cards, even if overrides are preferred.": "لا يمكن تجاوز هذه المطالبة بواسطة بطاقات الأحرف، حتى إذا كان التجاوزات مفضلاً.", |
| @@ -1009,10 +1009,10 @@ | ||
| 1009 | 1009 | "To whom this message will be attributed.": "Wem diese Nachricht zugeschrieben wird.", |
| 1010 | 1010 | "AI Assistant": "KI-Assistent", |
| 1011 | 1011 | "prompt_manager_position": "Position", |
| 1012 | 1012 | "Injection position. Next to other prompts (relative) or in-chat (absolute).": "Injektionsposition. Neben anderen Eingabeaufforderungen (relativ) oder im Chat (absolut).", |
| 1013 | 1013 | "prompt_manager_relative": "Relativ", |
| 1014 | 1014 | "prompt_manager_depth": "Tiefe", |
| 1015 | 1015 | "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.", |
| 1016 | 1016 | "Prompt": "Aufforderung", |
| 1017 | 1017 | "The prompt to be sent.": "Die zu sendende Eingabeaufforderung.", |
| 1018 | 1018 | "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.", |
| @@ -1009,10 +1009,10 @@ | ||
| 1009 | 1009 | "To whom this message will be attributed.": "A quién se le atribuirá este mensaje.", |
| 1010 | 1010 | "AI Assistant": "Asistente de IA", |
| 1011 | 1011 | "prompt_manager_position": "Posición", |
| 1012 | 1012 | "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).", |
| 1013 | 1013 | "prompt_manager_relative": "Relativo", |
| 1014 | 1014 | "prompt_manager_depth": "Profundidad", |
| 1015 | 1015 | "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.", |
| 1016 | 1016 | "Prompt": "Indicar", |
| 1017 | 1017 | "The prompt to be sent.": "El mensaje que se enviará.", |
| 1018 | 1018 | "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.", |
| @@ -950,7 +950,7 @@ | ||
| 950 | 950 | "prompt_manager_position": "Position", |
| 951 | 951 | "prompt_manager_relative": "Relatif", |
| 952 | 952 | "prompt_manager_depth": "Profondeur", |
| 953 | 953 | "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.", |
| 954 | 954 | "Prompt": "Prompt", |
| 955 | 955 | "The prompt to be sent.": "Le prompt à envoyer.", |
| 956 | 956 | "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 @@ | ||
| 1544 | 1544 | "Filter to Characters or Tags": "Filtre sur les personnages ou les tags", |
| 1545 | 1545 | "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.", |
| 1546 | 1546 | "Exclude": "Exclure", |
| 1547 | 1547 | "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.", |
| 1548 | 1548 | "prompt_manager_in_chat": "In-chat", |
| 1549 | 1549 | "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..", |
| 1550 | 1550 | "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.", |
| @@ -1009,10 +1009,10 @@ | ||
| 1009 | 1009 | "To whom this message will be attributed.": "Hverjum þessi skilaboð verða eignuð.", |
| 1010 | 1010 | "AI Assistant": "AI aðstoðarmaður", |
| 1011 | 1011 | "prompt_manager_position": "Staða", |
| 1012 | 1012 | "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).", |
| 1013 | 1013 | "prompt_manager_relative": "Aðstandandi", |
| 1014 | 1014 | "prompt_manager_depth": "Dýpt", |
| 1015 | 1015 | "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.", |
| 1016 | 1016 | "Prompt": "Ábending", |
| 1017 | 1017 | "The prompt to be sent.": "Tilvitnunin sem á að senda.", |
| 1018 | 1018 | "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.", |
| @@ -1009,10 +1009,10 @@ | ||
| 1009 | 1009 | "To whom this message will be attributed.": "A chi verrà attribuito questo messaggio.", |
| 1010 | 1010 | "AI Assistant": "Assistente AI", |
| 1011 | 1011 | "prompt_manager_position": "Posizione", |
| 1012 | 1012 | "Injection position. Next to other prompts (relative) or in-chat (absolute).": "Posizione di iniezione. Accanto ad altri suggerimenti (relativo) o in chat (assoluto).", |
| 1013 | 1013 | "prompt_manager_relative": "Parente", |
| 1014 | 1014 | "prompt_manager_depth": "Profondità", |
| 1015 | 1015 | "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.", |
| 1016 | 1016 | "Prompt": "Prompt", |
| 1017 | 1017 | "The prompt to be sent.": "La richiesta da inviare.", |
| 1018 | 1018 | "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.", |
| @@ -1009,10 +1009,10 @@ | ||
| 1009 | 1009 | "To whom this message will be attributed.": "このメッセージの送信者。", |
| 1010 | 1010 | "AI Assistant": "AIアシスタント", |
| 1011 | 1011 | "prompt_manager_position": "位置", |
| 1012 | 1012 | "Injection position. Next to other prompts (relative) or in-chat (absolute).": "挿入位置。他のプロンプトの隣 (相対) またはチャット内 (絶対)。", |
| 1013 | 1013 | "prompt_manager_relative": "相対的", |
| 1014 | 1014 | "prompt_manager_depth": "深さ", |
| 1015 | 1015 | "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "注入の深さ。0 = 最後のメッセージの後、1 = 最後のメッセージの前など。", |
| 1016 | 1016 | "Prompt": "プロンプト", |
| 1017 | 1017 | "The prompt to be sent.": "送信されるプロンプト。", |
| 1018 | 1018 | "This prompt cannot be overridden by character cards, even if overrides are preferred.": "このプロンプトは、オーバーライドが優先される場合でも、キャラクター カードによってオーバーライドすることはできません。", |
| @@ -1026,11 +1026,11 @@ | ||
| 1026 | 1026 | "To whom this message will be attributed.": "해당 프롬프트에 부여할 역할은 무엇인가요?", |
| 1027 | 1027 | "AI Assistant": "AI 어시스턴트", |
| 1028 | 1028 | "prompt_manager_position": "위치", |
| 1029 | 1029 | "Injection position. Next to other prompts (relative) or in-chat (absolute).": "주입 위치. 다른 프롬프트 옆(상대적) 또는 채팅 내(절대적).", |
| 1030 | 1030 | "prompt_manager_relative": "상대적인", |
| 1031 | 1031 | "prompt_manager_in_chat": "깊이에 따라", |
| 1032 | 1032 | "prompt_manager_depth": "깊이", |
| 1033 | 1033 | "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "주입 깊이. 0 = 마지막 메시지 뒤, 1 = 마지막 메시지 앞 등", |
| 1034 | 1034 | "Prompt": "프롬프트", |
| 1035 | 1035 | "The prompt to be sent.": "보내질 프롬프트 내용을 작성하는 부분입니다.", |
| 1036 | 1036 | "This prompt cannot be overridden by character cards, even if overrides are preferred.": "이 프롬프트는 고급 정의에서 재정의가 선호되는 경우에도 재정의될 수 없습니다.", |
| @@ -1500,7 +1500,7 @@ | ||
| 1500 | 1500 | "enable_functions_desc_1": "다양한 확장 프로그램에서 추가 기능을 제공하기 위한", |
| 1501 | 1501 | "enable_functions_desc_2": "기능 도구", |
| 1502 | 1502 | "enable_functions_desc_3": "를 사용할 수 있게 합니다.", |
| 1503 | 1503 | "Injection position. Relative (to other prompts in prompt manager) or In-chat @ Depth.": "삽입 깊이. 상대적인 (프롬프트 관리 목록에 있는 다른 프롬프트들에 비해) 또는 @Depth 깊이에 따라.", |
| 1504 | 1504 | "Instruct Template": "지시 템플릿", |
| 1505 | 1505 | "System Message Sequences": "시스템 메시지 시퀀스", |
| 1506 | 1506 | "System Prompt Sequences": "시스템 프롬프트 시퀀스", |
| @@ -1009,10 +1009,10 @@ | ||
| 1009 | 1009 | "To whom this message will be attributed.": "Aan wie dit bericht wordt toegeschreven.", |
| 1010 | 1010 | "AI Assistant": "AI-assistent", |
| 1011 | 1011 | "prompt_manager_position": "Positie", |
| 1012 | 1012 | "Injection position. Next to other prompts (relative) or in-chat (absolute).": "Injectiepositie. Naast andere prompts (relatief) of in-chat (absoluut).", |
| 1013 | 1013 | "prompt_manager_relative": "Familielid", |
| 1014 | 1014 | "prompt_manager_depth": "Diepte", |
| 1015 | 1015 | "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.", |
| 1016 | 1016 | "Prompt": "Prompt", |
| 1017 | 1017 | "The prompt to be sent.": "De prompt die verzonden moet worden.", |
| 1018 | 1018 | "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.", |
| @@ -1009,10 +1009,10 @@ | ||
| 1009 | 1009 | "To whom this message will be attributed.": "A quem esta mensagem será atribuída.", |
| 1010 | 1010 | "AI Assistant": "Assistente de IA", |
| 1011 | 1011 | "prompt_manager_position": "Posição", |
| 1012 | 1012 | "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).", |
| 1013 | 1013 | "prompt_manager_relative": "Relativo", |
| 1014 | 1014 | "prompt_manager_depth": "Profundidade", |
| 1015 | 1015 | "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.", |
| 1016 | 1016 | "Prompt": "Prompt", |
| 1017 | 1017 | "The prompt to be sent.": "O prompt a ser enviado.", |
| 1018 | 1018 | "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.", |
| @@ -1012,10 +1012,10 @@ | ||
| 1012 | 1012 | "To whom this message will be attributed.": "От чьего лица будет отправляться сообщение.", |
| 1013 | 1013 | "AI Assistant": "ИИ-ассистент", |
| 1014 | 1014 | "prompt_manager_position": "Точка инжекта", |
| 1015 | 1015 | "Injection position. Next to other prompts (relative) or in-chat (absolute).": "Как рассчитывать позицию для инжекта. Она может располагаться по отношению к другим промптам (относительная) либо по отношению к чату (абсолютная).", |
| 1016 | 1016 | "prompt_manager_relative": "Относительная", |
| 1017 | 1017 | "prompt_manager_depth": "Глубина", |
| 1018 | 1018 | "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "Глубина вставки. 0 = после последнего сообщения, 1 = перед последним сообщением, и т.д.", |
| 1019 | 1019 | "The prompt to be sent.": "Текст промпта.", |
| 1020 | 1020 | "prompt_manager_forbid_overrides": "Запретить перезапись", |
| 1021 | 1021 | "This prompt cannot be overridden by character cards, even if overrides are preferred.": "Карточка персонажа не сможет перезаписать этот промпт, даже если настройки отдают приоритет именно ей.", |
| @@ -1620,7 +1620,7 @@ | ||
| 1620 | 1620 | "Using a proxy that you're not running yourself is a risk to your data privacy.": "Помните, что используя чужую прокси, вы подвергаете риску конфиденциальность своих данных.", |
| 1621 | 1621 | "ANY support requests will be REFUSED if you are using a proxy.": "НЕ РАССЧИТЫВАЙТЕ на нашу поддержку, если используете прокси.", |
| 1622 | 1622 | "Do not proceed if you do not agree to this!": "Не продолжайте, если не согласны с этими условиями!", |
| 1623 | 1623 | "Injection position. Relative (to other prompts in prompt manager) or In-chat @ Depth.": "Как рассчитывать позицию, на которую вставляется данный промпт. Относительно других промтов в менеджере, либо на опред. глубину в чате.", |
| 1624 | 1624 | "prompt_manager_in_chat": "На глубине в чате", |
| 1625 | 1625 | "01.AI API Key": "Ключ от API 01.AI", |
| 1626 | 1626 | "01.AI Model": "Модель 01.AI", |
| @@ -1009,10 +1009,10 @@ | ||
| 1009 | 1009 | "To whom this message will be attributed.": "Кому буде віднесено це повідомлення.", |
| 1010 | 1010 | "AI Assistant": "ШІ помічник", |
| 1011 | 1011 | "prompt_manager_position": "Позиція", |
| 1012 | 1012 | "Injection position. Next to other prompts (relative) or in-chat (absolute).": "Позиція ін'єкції. Поруч з іншими підказками (відносні) або в чаті (абсолютні).", |
| 1013 | 1013 | "prompt_manager_relative": "Відносна", |
| 1014 | 1014 | "prompt_manager_depth": "Глибина", |
| 1015 | 1015 | "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "Глибина ін'єкції. 0 = після останнього повідомлення, 1 = перед останнім повідомленням тощо.", |
| 1016 | 1016 | "Prompt": "Запит", |
| 1017 | 1017 | "The prompt to be sent.": "Підказка для надсилання.", |
| 1018 | 1018 | "This prompt cannot be overridden by character cards, even if overrides are preferred.": "Це підказка не може бути перевизначено картками символів, навіть якщо перевизначення є кращим.", |
| @@ -1009,10 +1009,10 @@ | ||
| 1009 | 1009 | "To whom this message will be attributed.": "Tin nhắn này sẽ được quy cho ai.", |
| 1010 | 1010 | "AI Assistant": "Trợ lý AI", |
| 1011 | 1011 | "prompt_manager_position": "Chức vụ", |
| 1012 | 1012 | "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).", |
| 1013 | 1013 | "prompt_manager_relative": "Liên quan đến", |
| 1014 | 1014 | "prompt_manager_depth": "Chiều sâu", |
| 1015 | 1015 | "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.", |
| 1016 | 1016 | "Prompt": "Prompt", |
| 1017 | 1017 | "The prompt to be sent.": "Lời nhắc được gửi đi.", |
| 1018 | 1018 | "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 đè.", |
| @@ -1168,11 +1168,11 @@ | ||
| 1168 | 1168 | "To whom this message will be attributed.": "此消息应归于谁。", |
| 1169 | 1169 | "AI Assistant": "AI助手", |
| 1170 | 1170 | "prompt_manager_position": "位置", |
| 1171 | 1171 | "Injection position. Relative (to other prompts in prompt manager) or In-chat @ Depth.": "注入位置。相对(相对于提示管理器中的其他提示)或在聊天中@深度。", |
| 1172 | 1172 | "prompt_manager_relative": "相对", |
| 1173 | 1173 | "prompt_manager_in_chat": "聊天中", |
| 1174 | 1174 | "prompt_manager_depth": "深度", |
| 1175 | 1175 | "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "注入深度。“0”为在最后一条消息之后,“1”为在最后一条消息之前,等等。", |
| 1176 | 1176 | "The content of this prompt is pulled from elsewhere and cannot be edited here.": "此提示词的内容是从其他地方提取的,无法在此处进行编辑。", |
| 1177 | 1177 | "Prompt": "提示词", |
| 1178 | 1178 | "The prompt to be sent.": "要发送的提示词。", |
| @@ -1010,10 +1010,10 @@ | ||
| 1010 | 1010 | "To whom this message will be attributed.": "此訊息所屬的角色。", |
| 1011 | 1011 | "AI Assistant": "人工智慧助手", |
| 1012 | 1012 | "prompt_manager_position": "位置", |
| 1013 | 1013 | "Injection position. Next to other prompts (relative) or in-chat (absolute).": "注入位置。與其他提示詞相鄰(相對位置)或在聊天中(絕對位置)。", |
| 1014 | 1014 | "prompt_manager_relative": "相對位置", |
| 1015 | 1015 | "prompt_manager_depth": "深度", |
| 1016 | 1016 | "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "注入深度。0 = 在最後一則訊息之後,1 = 在最後一則訊息之前,以此類推。", |
| 1017 | 1017 | "Prompt": "提示詞", |
| 1018 | 1018 | "The prompt to be sent.": "要傳送的提示詞。", |
| 1019 | 1019 | "This prompt cannot be overridden by character cards, even if overrides are preferred.": "即使啟用優先覆寫,此提示詞也不能被角色卡片覆寫。", |
| @@ -1650,7 +1650,7 @@ | ||
| 1650 | 1650 | "Image Captioning": "圖片註解", |
| 1651 | 1651 | "Generate Caption": "產生圖片註解", |
| 1652 | 1652 | "Injection Position": "插入位置", |
| 1653 | 1653 | "Injection position. Relative (to other prompts in prompt manager) or In-chat @ Depth.": "插入位置(與提示詞管理器中的其他提示相比)或聊天中的深度位置。", |
| 1654 | 1654 | "Injection Template": "插入範本", |
| 1655 | 1655 | "Insert#": "插入#", |
| 1656 | 1656 | "Instruct Sequences": "指令序列", |
| @@ -77,7 +77,7 @@ const registerPromptManagerMigration = () => { | ||
| 77 | 77 | * Represents a prompt. |
| 78 | 78 | */ |
| 79 | 79 | class Prompt { |
| 80 | 80 | identifier; role; content; name; system_prompt; position; injection_position; injection_depth; injection_order; forbid_overrides; extension; |
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | 83 | * Create a new Prompt instance. |
| @@ -91,10 +91,11 @@ class Prompt { | ||
| 91 | 91 | * @param {string} [param0.position] - The position of the prompt in the prompt list. |
| 92 | 92 | * @param {number} [param0.injection_position] - The insert position of the prompt. |
| 93 | 93 | * @param {number} [param0.injection_depth] - The depth of the prompt in the chat. |
| 94 | + * @param {number} [param0.injection_order] - The order of the prompt in the chat. | |
| 94 | 95 | * @param {boolean} [param0.forbid_overrides] - Indicates if the prompt should not be overridden. |
| 95 | 96 | * @param {boolean} [param0.extension] - Prompt is added by an extension. |
| 96 | 97 | */ |
| 97 | 98 | constructor({ identifier, role, content, name, system_prompt, position, injection_depth, injection_position, forbid_overrides, extension, injection_order } = {}) { |
| 98 | 99 | this.identifier = identifier; |
| 99 | 100 | this.role = role; |
| 100 | 101 | this.content = content; |
| @@ -105,6 +106,7 @@ class Prompt { | ||
| 105 | 106 | this.injection_position = injection_position; |
| 106 | 107 | this.forbid_overrides = forbid_overrides; |
| 107 | 108 | this.extension = extension ?? false; |
| 109 | + this.injection_order = injection_order ?? 0; | |
| 108 | 110 | } |
| 109 | 111 | } |
| 110 | 112 | |
| @@ -447,7 +449,9 @@ class PromptManager { | ||
| 447 | 449 | document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_prompt').value = prompt.content ?? ''; |
| 448 | 450 | document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_position').value = prompt.injection_position ?? 0; |
| 449 | 451 | document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_depth').value = prompt.injection_depth ?? DEFAULT_DEPTH; |
| 452 | + document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_order').value = prompt.injection_order ?? 0; | |
| 450 | 453 | document.getElementById(this.configuration.prefix + 'prompt_manager_depth_block').style.visibility = prompt.injection_position === INJECTION_POSITION.ABSOLUTE ? 'visible' : 'hidden'; |
| 454 | + document.getElementById(this.configuration.prefix + 'prompt_manager_order_block').style.visibility = prompt.injection_position === INJECTION_POSITION.ABSOLUTE ? 'visible' : 'hidden'; | |
| 451 | 455 | document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_forbid_overrides').checked = prompt.forbid_overrides ?? false; |
| 452 | 456 | document.getElementById(this.configuration.prefix + 'prompt_manager_forbid_overrides_block').style.visibility = this.overridablePrompts.includes(prompt.identifier) ? 'visible' : 'hidden'; |
| 453 | 457 | document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_prompt').disabled = prompt.marker ?? false; |
| @@ -782,6 +786,7 @@ class PromptManager { | ||
| 782 | 786 | prompt.content = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_prompt').value; |
| 783 | 787 | prompt.injection_position = Number(document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_position').value); |
| 784 | 788 | prompt.injection_depth = Number(document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_depth').value); |
| 789 | + prompt.injection_order = Number(document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_order').value); | |
| 785 | 790 | prompt.forbid_overrides = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_forbid_overrides').checked; |
| 786 | 791 | } |
| 787 | 792 | |
| @@ -1222,7 +1227,9 @@ class PromptManager { | ||
| 1222 | 1227 | const promptField = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_prompt'); |
| 1223 | 1228 | const injectionPositionField = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_position'); |
| 1224 | 1229 | const injectionDepthField = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_depth'); |
| 1230 | + const injectionOrderField = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_order'); | |
| 1225 | 1231 | const injectionDepthBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_depth_block'); |
| 1232 | + const injectionOrderBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_order_block'); | |
| 1226 | 1233 | const forbidOverridesField = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_forbid_overrides'); |
| 1227 | 1234 | const forbidOverridesBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_forbid_overrides_block'); |
| 1228 | 1235 | const entrySourceBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_source_block'); |
| @@ -1235,7 +1242,9 @@ class PromptManager { | ||
| 1235 | 1242 | promptField.disabled = prompt.marker ?? false; |
| 1236 | 1243 | injectionPositionField.value = prompt.injection_position ?? INJECTION_POSITION.RELATIVE; |
| 1237 | 1244 | injectionDepthField.value = prompt.injection_depth ?? DEFAULT_DEPTH; |
| 1245 | + injectionOrderField.value = prompt.injection_order ?? 0; | |
| 1238 | 1246 | injectionDepthBlock.style.visibility = prompt.injection_position === INJECTION_POSITION.ABSOLUTE ? 'visible' : 'hidden'; |
| 1247 | + injectionOrderBlock.style.visibility = prompt.injection_position === INJECTION_POSITION.ABSOLUTE ? 'visible' : 'hidden'; | |
| 1239 | 1248 | injectionPositionField.removeAttribute('disabled'); |
| 1240 | 1249 | forbidOverridesField.checked = prompt.forbid_overrides ?? false; |
| 1241 | 1250 | forbidOverridesBlock.style.visibility = this.overridablePrompts.includes(prompt.identifier) ? 'visible' : 'hidden'; |
| @@ -1267,11 +1276,14 @@ class PromptManager { | ||
| 1267 | 1276 | |
| 1268 | 1277 | handleInjectionPositionChange(event) { |
| 1269 | 1278 | const injectionDepthBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_depth_block'); |
| 1279 | + const injectionOrderBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_order_block'); | |
| 1270 | 1280 | const injectionPosition = Number(event.target.value); |
| 1271 | 1281 | if (injectionPosition === INJECTION_POSITION.ABSOLUTE) { |
| 1272 | 1282 | injectionDepthBlock.style.visibility = 'visible'; |
| 1283 | + injectionOrderBlock.style.visibility = 'visible'; | |
| 1273 | 1284 | } else { |
| 1274 | 1285 | injectionDepthBlock.style.visibility = 'hidden'; |
| 1286 | + injectionOrderBlock.style.visibility = 'hidden'; | |
| 1275 | 1287 | } |
| 1276 | 1288 | } |
| 1277 | 1289 | |
| @@ -1328,6 +1340,7 @@ class PromptManager { | ||
| 1328 | 1340 | const injectionPositionField = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_position'); |
| 1329 | 1341 | const injectionDepthField = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_injection_depth'); |
| 1330 | 1342 | const injectionDepthBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_depth_block'); |
| 1343 | + const injectionOrderBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_order_block'); | |
| 1331 | 1344 | const forbidOverridesField = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_form_forbid_overrides'); |
| 1332 | 1345 | const forbidOverridesBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_forbid_overrides_block'); |
| 1333 | 1346 | const entrySourceBlock = document.getElementById(this.configuration.prefix + 'prompt_manager_popup_entry_source_block'); |
| @@ -1341,6 +1354,7 @@ class PromptManager { | ||
| 1341 | 1354 | injectionPositionField.removeAttribute('disabled'); |
| 1342 | 1355 | injectionDepthField.value = DEFAULT_DEPTH; |
| 1343 | 1356 | injectionDepthBlock.style.visibility = 'unset'; |
| 1357 | + injectionOrderBlock.style.visibility = 'unset'; | |
| 1344 | 1358 | forbidOverridesBlock.style.visibility = 'unset'; |
| 1345 | 1359 | forbidOverridesField.checked = false; |
| 1346 | 1360 | entrySourceBlock.style.display = 'none'; |
| @@ -760,24 +760,42 @@ async function populationInjectionPrompts(prompts, messages) { | ||
| 760 | 760 | // Get prompts for current depth |
| 761 | 761 | const depthPrompts = prompts.filter(prompt => prompt.injection_depth === i && prompt.content); |
| 762 | 762 | |
| 763 | - // Order of priority (most important go lower) | |
| 764 | - const roles = ['system', 'user', 'assistant']; | |
| 765 | 763 | const roleMessages = []; |
| 766 | 764 | const separator = '\n'; |
| 767 | 765 | const wrap = false; |
| 768 | 766 | |
| 767 | + // Group prompts by priority | |
| 768 | + const orderGroups = {}; | |
| 769 | + for (const prompt of depthPrompts) { | |
| 770 | + const order = prompt.injection_order || 0; | |
| 771 | + if (!orderGroups[order]) { | |
| 772 | + orderGroups[order] = []; | |
| 773 | + } | |
| 774 | + orderGroups[order].push(prompt); | |
| 775 | + } | |
| 776 | + | |
| 777 | + // Process each order group in order (b - a = low to high ; a - b = high to low) | |
| 778 | + const orders = Object.keys(orderGroups).sort((a, b) => +a - +b); | |
| 779 | + for (const order of orders) { | |
| 780 | + const orderPrompts = orderGroups[order]; | |
| 781 | + | |
| 782 | + // Order of priority for roles (most important go lower) | |
| 783 | + const roles = ['system', 'user', 'assistant']; | |
| 769 | 784 | for (const role of roles) { |
| 770 | - // Get prompts for current role | |
| 785 | + const rolePrompts = orderPrompts | |
| 771 | 786 | const rolePrompts = depthPrompts .filter(prompt => prompt.role === role).map(x => x.content).join(separator); |
| 787 | + .map(x => x.content) | |
| 788 | + .join(separator); | |
| 789 | + | |
| 772 | 790 | // Get extension prompt |
| 773 | 791 | const extensionPrompt = await getExtensionPrompt(extension_prompt_types.IN_CHAT, i, separator, roleTypes[role], wrap); |
| 774 | - | |
| 775 | 792 | const jointPrompt = [rolePrompts, extensionPrompt].filter(x => x).map(x => x.trim()).join(separator); |
| 776 | 793 | |
| 777 | 794 | if (jointPrompt && jointPrompt.length) { |
| 778 | 795 | roleMessages.push({ 'role': role, 'content': jointPrompt, injected: true }); |
| 779 | 796 | } |
| 780 | 797 | } |
| 798 | + } | |
| 781 | 799 | |
| 782 | 800 | if (roleMessages.length) { |
| 783 | 801 | const injectIdx = i + totalInsertedMessages; |
| @@ -1314,6 +1332,8 @@ async function preparePromptsForChatCompletion({ scenario, charPersonality, name | ||
| 1314 | 1332 | prompt.injection_position = collectionPrompt.injection_position ?? prompt.injection_position; |
| 1315 | 1333 | // Depth for In-Chat |
| 1316 | 1334 | prompt.injection_depth = collectionPrompt.injection_depth ?? prompt.injection_depth; |
| 1335 | + // Priority for In-Chat | |
| 1336 | + prompt.injection_order = collectionPrompt.injection_order ?? prompt.injection_order; | |
| 1317 | 1337 | // Role (system, user, assistant) |
| 1318 | 1338 | prompt.role = collectionPrompt.role ?? prompt.role; |
| 1319 | 1339 | } |