feature: ignore budget switch (#4354) * feature: ignore budget switch The budget cap default at 25% is a big gotcha at the start of chats, as a person may assume that a constant lore book entry will always be present, no matter what. This pull request adds a budget ignore switch which ignores the budget cap and includes the lore book entry even if it would exceed the budget cap. * Move the toggle to entry details --------- Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
Signed| @@ -6337,25 +6337,35 @@ | ||
| 6337 | 6337 | (<span data-i18n="extension_token_counter">Tokens:</span> <span class="world_entry_form_token_counter" data-first-run="true">counting...</span>) |
| 6338 | 6338 | <span class="world_entry_form_uid_value" data-first-run="true"></span> |
| 6339 | 6339 | </span> |
| 6340 | 6340 | <div class="flex-container"> |
| 6341 | 6341 | <labeldiv class="checkbox flex-container alignitemscenter flexNoGapflexFlowColumn"> |
| 6342 | - <input type="checkbox" name="excludeRecursion" /> | |
| 6342 | + <label class="checkbox flex-container alignitemscenter flexNoGap" title="This entry will not be recursively activated by other entries."> | |
| 6343 | - <span data-i18n="Non-recursable (will not be activated by another)"> | |
| 6343 | + <input type="checkbox" name="excludeRecursion" /> | |
| 6344 | - Non-recursable (will not be activated by another) | |
| 6344 | + <span data-i18n="Non-recursable"> | |
| 6345 | - </span> | |
| 6345 | + Non-recursable | |
| 6346 | 6346 | </labelspan> |
| 6347 | - <label class="checkbox flex-container alignitemscenter flexNoGap"> | |
| 6347 | + </label> | |
| 6348 | - <input type="checkbox" name="preventRecursion" /> | |
| 6348 | + <label class="checkbox flex-container alignitemscenter flexNoGap" title="This entry will not activate other entries recursively." data-i18n="[title]This entry will not activate other entries recursively."> | |
| 6349 | - <span data-i18n="Prevent further recursion (this entry will not activate others)"> | |
| 6349 | + <input type="checkbox" name="preventRecursion" /> | |
| 6350 | - Prevent further recursion (will not activate others) | |
| 6350 | + <span data-i18n="Prevent further recursion"> | |
| 6351 | - </span> | |
| 6351 | + Prevent further recursion | |
| 6352 | 6352 | </labelspan> |
| 6353 | - <label class="checkbox flex-container alignitemscenter flexNoGap"> | |
| 6353 | + </label> | |
| 6354 | - <input type="checkbox" name="delay_until_recursion" /> | |
| 6354 | + </div> | |
| 6355 | - <span data-i18n="Delay until recursion (can only be activated on recursive checking)"> | |
| 6355 | + <div class="flex-container flexFlowColumn"> | |
| 6356 | - Delay until recursion (can only be activated on recursive checking) | |
| 6356 | + <label class="checkbox flex-container alignitemscenter flexNoGap" title="This entry can only be activated on recursive checking." data-i18n="[title]This entry can only be activated on recursive checking."> | |
| 6357 | - </span> | |
| 6357 | + <input type="checkbox" name="delay_until_recursion" /> | |
| 6358 | - </label> | |
| 6358 | + <span data-i18n="Delay until recursion"> | |
| 6359 | + Delay until recursion | |
| 6360 | + </span> | |
| 6361 | + </label> | |
| 6362 | + <label class="checkbox flex-container alignitemscenter flexNoGap" title="This entry will be included ignoring budget constraints, assuming all other checks pass." data-i18n="[title]This entry will be included ignoring budget constraints, assuming all other checks pass."> | |
| 6363 | + <input type="checkbox" name="ignoreBudget" /> | |
| 6364 | + <span data-i18n="Ignore budget"> | |
| 6365 | + Ignore budget | |
| 6366 | + </span> | |
| 6367 | + </label> | |
| 6368 | + </div> | |
| 6359 | 6369 | </div> |
| 6360 | 6370 | </span> |
| 6361 | 6371 | </small> |
| @@ -983,8 +983,8 @@ | ||
| 983 | 983 | "( None )": "( لا أحد )", |
| 984 | 984 | "Content": "المحتوى", |
| 985 | 985 | "Exclude from recursion": "استبعاد من التكرار", |
| 986 | 986 | "Prevent further recursion (this entry will not activate others)": "منع المزيد من التكرار (هذا الإدخال لن ينشط الإدخالات الأخرى)", |
| 987 | - "Delay until recursion (this entry can only be activated on recursive checking)": "التأخير حتى العودية (لا يمكن تفعيل هذا الإدخال إلا عند التحقق العودي)", | |
| 987 | + "Delay until recursion": "التأخير حتى العودية", | |
| 988 | 988 | "What this keyword should mean to the AI, sent verbatim": "ما يجب أن يعني هذا الكلمة الرئيسية للذكاء الاصطناعي، ترسل حرفيًا", |
| 989 | 989 | "Filter to Character(s)": "تصفية إلى الشخصيات", |
| 990 | 990 | "Character Exclusion": "استبعاد الشخصيات", |
| @@ -983,8 +983,8 @@ | ||
| 983 | 983 | "( None )": "( Keiner )", |
| 984 | 984 | "Content": "Inhalt", |
| 985 | 985 | "Exclude from recursion": "Aus Rekursion ausschließen", |
| 986 | 986 | "Prevent further recursion (this entry will not activate others)": "Weitere Rekursion verhindern (dieser Eintrag aktiviert keine anderen)", |
| 987 | 987 | "Delay until recursion (this entry can only be activated on recursive checking)": "Verzögerung bis zur Rekursion (dieser Eintrag kann nur bei rekursiver Prüfung aktiviert werden)", |
| 988 | 988 | "What this keyword should mean to the AI, sent verbatim": "Was dieses Schlüsselwort für die KI bedeuten soll, wörtlich gesendet", |
| 989 | 989 | "Filter to Character(s)": "Filtern auf Charakter(e)", |
| 990 | 990 | "Character Exclusion": "Charakterausschluss", |
| @@ -983,8 +983,8 @@ | ||
| 983 | 983 | "( None )": "( Ninguno )", |
| 984 | 984 | "Content": "Contenido", |
| 985 | 985 | "Exclude from recursion": "Excluir de la recursión", |
| 986 | 986 | "Prevent further recursion (this entry will not activate others)": "Evitar una mayor recurrencia (esta entrada no activará otras)", |
| 987 | - "Delay until recursion (this entry can only be activated on recursive checking)": "Retraso hasta la recursión (esta entrada solo se puede activar en la comprobación recursiva)", | |
| 987 | + "Delay until recursion": "Retraso hasta la recursión", | |
| 988 | 988 | "What this keyword should mean to the AI, sent verbatim": "Lo que este palabra clave debería significar para la IA, enviado textualmente", |
| 989 | 989 | "Filter to Character(s)": "Filtrar a Personaje(s)", |
| 990 | 990 | "Character Exclusion": "Exclusión de Personaje", |
| @@ -925,7 +925,7 @@ | ||
| 925 | 925 | "Automation ID": "ID d'automatisation", |
| 926 | 926 | "( None )": "( Aucun )", |
| 927 | 927 | "Content": "Contenu", |
| 928 | 928 | "Prevent further recursion (this entry will not activate others)": "Empêcher toute récursion ultérieure (cette entrée n’en activera pas d’autres)", |
| 929 | 929 | "What this keyword should mean to the AI, sent verbatim": "Ce que ce mot-clé devrait signifier pour l'IA, envoyé textuellement", |
| 930 | 930 | "-- Characters not found --": "-- Personnages non trouvés --", |
| 931 | 931 | "Inclusion Group": "Groupe d'inclusion", |
| @@ -1529,8 +1529,8 @@ | ||
| 1529 | 1529 | "Group Scoring": "Notation des groupes", |
| 1530 | 1530 | "delay_until_recursion_level": "Définit les niveaux de délai pour les balayages récursifs.\r\rDans un premier temps, seul le premier niveau (le plus petit nombre) sera pris en compte.\rSi aucune correspondance n'est trouvée, le niveau suivant devient éligible pour la correspondance.\rCette opération est répétée jusqu'à ce que tous les niveaux soient vérifiés.\r\rLié au réglage \"Délai avant récursion\".", |
| 1531 | 1531 | "Recursion Level": "Niveau de récursivité", |
| 1532 | - "Non-recursable (will not be activated by another)": "Non récursable (ne peut être activé par un autre)", | |
| 1532 | + "Non-recursable": "Non récursable", | |
| 1533 | 1533 | "Delay until recursion (can only be activated on recursive checking)": "Délai jusqu'à la récursion (ne peut être activé que lors d'un contrôle récursif)", |
| 1534 | 1534 | "Prioritize": "Priorités", |
| 1535 | 1535 | "Sticky entries will stay active for N messages after being triggered.": "Les entrées collantes restent actives pendant N messages après avoir été déclenchées.", |
| 1536 | 1536 | "Sticky": "Collant", |
| @@ -983,8 +983,8 @@ | ||
| 983 | 983 | "( None )": "( Enginn )", |
| 984 | 984 | "Content": "Efnisatriði", |
| 985 | 985 | "Exclude from recursion": "Útiloka frá endurtekningu", |
| 986 | 986 | "Prevent further recursion (this entry will not activate others)": "Koma í veg fyrir frekari endurkomu (þessi færsla mun ekki virkja aðra)", |
| 987 | - "Delay until recursion (this entry can only be activated on recursive checking)": "Seinkað þar til endurkomu (þessi færsla er aðeins hægt að virkja við endurkvæma athugun)", | |
| 987 | + "Delay until recursion": "Seinkað þar til endurkomu", | |
| 988 | 988 | "What this keyword should mean to the AI, sent verbatim": "Hvað þetta lykilorð ætti að þýða fyrir AI, sent bókstaflega", |
| 989 | 989 | "Filter to Character(s)": "Sía til Persónu(r)", |
| 990 | 990 | "Character Exclusion": "Persónuúteslutningur", |
| @@ -983,8 +983,8 @@ | ||
| 983 | 983 | "( None )": "( Nessuno )", |
| 984 | 984 | "Content": "Contenuto", |
| 985 | 985 | "Exclude from recursion": "Escludi dalla ricorsione", |
| 986 | 986 | "Prevent further recursion (this entry will not activate others)": "Prevenire ulteriore ricorsione (questa voce non ne attiverà altre)", |
| 987 | - "Delay until recursion (this entry can only be activated on recursive checking)": "Ritardo fino alla ricorsione (questa voce può essere attivata solo durante il controllo ricorsivo)", | |
| 987 | + "Delay until recursion": "Ritardo fino alla ricorsione", | |
| 988 | 988 | "What this keyword should mean to the AI, sent verbatim": "Cosa dovrebbe significare questa parola chiave per l'AI, inviata testualmente", |
| 989 | 989 | "Filter to Character(s)": "Filtra per Personaggio(i)", |
| 990 | 990 | "Character Exclusion": "Esclusione Personaggio", |
| @@ -983,8 +983,8 @@ | ||
| 983 | 983 | "( None )": "( なし )", |
| 984 | 984 | "Content": "内容", |
| 985 | 985 | "Exclude from recursion": "再帰から除外", |
| 986 | 986 | "Prevent further recursion (this entry will not activate others)": "それ以上の再帰を防止します(このエントリは他のエントリをアクティブにしません)", |
| 987 | 987 | "Delay until recursion (this entry can only be activated on recursive checking)": "再帰まで遅延 (このエントリは再帰チェックでのみ有効になります)", |
| 988 | 988 | "What this keyword should mean to the AI, sent verbatim": "このキーワードがAIにとって何を意味するか、そのまま送信されます", |
| 989 | 989 | "Filter to Character(s)": "キャラクターにフィルター", |
| 990 | 990 | "Character Exclusion": "キャラクターの除外", |
| @@ -1000,8 +1000,8 @@ | ||
| 1000 | 1000 | "( None )": "( 없음 )", |
| 1001 | 1001 | "Content": "콘텐츠", |
| 1002 | 1002 | "Exclude from recursion": "재귀에서 제외", |
| 1003 | 1003 | "Prevent further recursion (this entry will not activate others)": "추가 재귀 방지(이 항목은 다른 항목을 활성화하지 않습니다)", |
| 1004 | - "Delay until recursion (this entry can only be activated on recursive checking)": "재귀까지 지연(이 항목은 재귀 검사에서만 활성화될 수 있음)", | |
| 1004 | + "Delay until recursion": "재귀까지 지연", | |
| 1005 | 1005 | "What this keyword should mean to the AI, sent verbatim": "AI에게 이 키워드가 무엇을 의미하는지를 원래 그대로 보냄", |
| 1006 | 1006 | "Filter to Character(s)": "캐릭터로 필터링", |
| 1007 | 1007 | "Character Exclusion": "캐릭터 제외", |
| @@ -983,8 +983,8 @@ | ||
| 983 | 983 | "( None )": "( Geen )", |
| 984 | 984 | "Content": "Inhoud", |
| 985 | 985 | "Exclude from recursion": "Uitsluiten van recursie", |
| 986 | 986 | "Prevent further recursion (this entry will not activate others)": "Voorkom verdere recursie (dit item activeert andere niet)", |
| 987 | - "Delay until recursion (this entry can only be activated on recursive checking)": "Vertraging tot recursie (deze invoer kan alleen worden geactiveerd bij recursieve controle)", | |
| 987 | + "Delay until recursion": "Vertraging tot recursie", | |
| 988 | 988 | "What this keyword should mean to the AI, sent verbatim": "Wat dit trefwoord voor de AI zou moeten betekenen, woordelijk verzonden", |
| 989 | 989 | "Filter to Character(s)": "Filteren op personage(s)", |
| 990 | 990 | "Character Exclusion": "Personage uitsluiting", |
| @@ -983,8 +983,8 @@ | ||
| 983 | 983 | "( None )": "( Nenhum )", |
| 984 | 984 | "Content": "Conteúdo", |
| 985 | 985 | "Exclude from recursion": "Excluir da recursão", |
| 986 | 986 | "Prevent further recursion (this entry will not activate others)": "Impedir mais recursões (esta entrada não ativará outras)", |
| 987 | 987 | "Delay until recursion (this entry can only be activated on recursive checking)": "Atraso até a recursão (esta entrada só pode ser ativada na verificação recursiva)", |
| 988 | 988 | "What this keyword should mean to the AI, sent verbatim": "O que essa palavra-chave deve significar para a IA, enviada literalmente", |
| 989 | 989 | "Filter to Character(s)": "Filtrar para Personagem(s)", |
| 990 | 990 | "Character Exclusion": "Exclusão de personagem", |
| @@ -819,7 +819,7 @@ | ||
| 819 | 819 | "Chat CFG": "CFG для чата", |
| 820 | 820 | "bg_chat_hint_1": "Здесь будут появляться фоны, сгенерированные расширением", |
| 821 | 821 | "bg_chat_hint_2": ".", |
| 822 | 822 | "Prevent further recursion (this entry will not activate others)": "Пресечь дальнейшую рекурсию (эта запись не будет активировать другие)", |
| 823 | 823 | "Alert if your world info is greater than the allocated budget.": "Оповещать, если ваш мир выходит за выделенный бюджет.", |
| 824 | 824 | "Convert to Persona": "Преобразовать в персону", |
| 825 | 825 | "Link to Source": "Ссылка на источник", |
| @@ -2050,8 +2050,8 @@ | ||
| 2050 | 2050 | "Trigger %": "% срабатывания", |
| 2051 | 2051 | "Use global": "Глоб. настройка", |
| 2052 | 2052 | "Whole Words": "Целые слова", |
| 2053 | 2053 | "Non-recursable (will not be activated by another)": "Не рекурсивная (не активируется другими)", |
| 2054 | 2054 | "Delay until recursion (can only be activated on recursive checking)": "Рекурсивная (активируется только рекурсией)", |
| 2055 | 2055 | "Toggle entry's active state.": "Вкл/выкл запись.", |
| 2056 | 2056 | "Prioritize": "Важная", |
| 2057 | 2057 | "Prioritize this entry: When checked, this entry is prioritized out of all selections.If multiple are prioritized, the one with the highest 'Order' is chosen.": "Важная запись получает приоритет среди всех выбранных. Если важных записей несколько, выбирается та, у которой выше \"Очерёдность\".", |
| @@ -983,8 +983,8 @@ | ||
| 983 | 983 | "( None )": "( Жодного )", |
| 984 | 984 | "Content": "Зміст", |
| 985 | 985 | "Exclude from recursion": "Виключити з рекурсії", |
| 986 | 986 | "Prevent further recursion (this entry will not activate others)": "Запобігти подальшій рекурсії (цей запис не активує інші)", |
| 987 | - "Delay until recursion (this entry can only be activated on recursive checking)": "Затримка до рекурсії (цей запис можна активувати лише під час рекурсивної перевірки)", | |
| 987 | + "Delay until recursion": "Затримка до рекурсії", | |
| 988 | 988 | "What this keyword should mean to the AI, sent verbatim": "Що це ключове слово повинно означати для ШІ, надсилається дослівно", |
| 989 | 989 | "Filter to Character(s)": "Фільтр для персонажів", |
| 990 | 990 | "Character Exclusion": "Виключення персонажів", |
| @@ -983,8 +983,8 @@ | ||
| 983 | 983 | "( None )": "( Không có )", |
| 984 | 984 | "Content": "Nội dung", |
| 985 | 985 | "Exclude from recursion": "Loại trừ khỏi đệ quy", |
| 986 | 986 | "Prevent further recursion (this entry will not activate others)": "Ngăn chặn đệ quy tiếp theo (mục này sẽ không kích hoạt mục khác)", |
| 987 | 987 | "Delay until recursion (this entry can only be activated on recursive checking)": "Trì hoãn cho đến khi đệ quy (mục này chỉ có thể được kích hoạt khi kiểm tra đệ quy)", |
| 988 | 988 | "What this keyword should mean to the AI, sent verbatim": "Nghĩa của từ khóa này đối với AI, gửi một cách nguyên văn", |
| 989 | 989 | "Filter to Character(s)": "Lọc đến Nhân vật", |
| 990 | 990 | "Character Exclusion": "Loại trừ Nhân vật", |
| @@ -1127,9 +1127,9 @@ | ||
| 1127 | 1127 | "delay_until_recursion_level": "Defines delay levels for recursive scans.\r\rInitially, only the first level (smallest number) will match.\rOnce no matches are found, the next level becomes eligible for matching.\rThis repeats until all levels are checked.\r\rTied to the \"Delay until recursion\" setting.", |
| 1128 | 1128 | "Recursion Level": "递归等级", |
| 1129 | 1129 | "Content": "内容", |
| 1130 | 1130 | "Non-recursable (will not be activated by another)": "不可递归(不会被其他条目激活)", |
| 1131 | 1131 | "Prevent further recursion (this entry will not activate others)": "防止进一步递归(本条目将不会激活其他条目)", |
| 1132 | 1132 | "Delay until recursion (can only be activated on recursive checking)": "延迟到递归(本条目只能在递归检查时激活)", |
| 1133 | 1133 | "What this keyword should mean to the AI, sent verbatim": "这个关键词对AI的含义,逐字发送", |
| 1134 | 1134 | "Inclusion Group": "包含组", |
| 1135 | 1135 | "Inclusion Groups ensure only one entry from a group is activated at a time, if multiple are triggered.Documentation: World Info - Inclusion Group": "包含组可确保每次仅激活组中的一项(如果触发了多项)。支持多个逗号分隔的组。文档:世界信息 - 包含组", |
| @@ -983,9 +983,9 @@ | ||
| 983 | 983 | "Automation ID": "自動化 ID", |
| 984 | 984 | "( None )": "(無)", |
| 985 | 985 | "Content": "內容", |
| 986 | 986 | "Exclude from recursion": "不可遞迴(此條目不會被其他條目啟用)", |
| 987 | 987 | "Prevent further recursion (this entry will not activate others)": "防止進一步遞迴(此條目不會啟用其他條目)", |
| 988 | 988 | "Delay until recursion (this entry can only be activated on recursive checking)": "延遲遞迴(此條目只能在遞迴檢查時啟用)", |
| 989 | 989 | "What this keyword should mean to the AI, sent verbatim": "這個關鍵字對 AI 應意味著什麼,逐字傳送", |
| 990 | 990 | "Filter to Character(s)": "角色篩選", |
| 991 | 991 | "Character Exclusion": "角色排除", |
| @@ -1601,7 +1601,6 @@ | ||
| 1601 | 1601 | "Data Bank files": "資料庫文件", |
| 1602 | 1602 | "Default / Fallback Expression": "預設/回退表情", |
| 1603 | 1603 | "Delay": "延遲", |
| 1604 | - "Delay until recursion (can only be activated on recursive checking)": "遞迴掃描延遲(僅在啟用遞迴掃描時可用)", | |
| 1605 | 1604 | "Do not proceed if you do not agree to this!": "若不同意此條款,請勿繼續!", |
| 1606 | 1605 | "Edge Color": "邊緣顏色", |
| 1607 | 1606 | "Edit captions before saving": "在儲存前編輯註解", |
| @@ -1681,7 +1680,7 @@ | ||
| 1681 | 1680 | "Names as Stop Strings": "將名稱用作停止字串", |
| 1682 | 1681 | "Never": "從不", |
| 1683 | 1682 | "NomicAI API Key": "NomicAI API 金鑰", |
| 1684 | 1683 | "Non-recursable (will not be activated by another)": "不可遞迴(不會被其他條目啟動)", |
| 1685 | 1684 | "None (disabled)": "無(已停用)", |
| 1686 | 1685 | "OK": "確定", |
| 1687 | 1686 | "Old messages are vectorized gradually as you chat. To process all previous messages, click the button below.": "舊訊息會在聊天時逐步向量化。\n若要處理所有先前訊息,請點選下方按鈕。", |
| @@ -2481,6 +2481,7 @@ export const originalWIDataKeyMap = { | ||
| 2481 | 2481 | 'cooldown': 'extensions.cooldown', |
| 2482 | 2482 | 'delay': 'extensions.delay', |
| 2483 | 2483 | 'triggers': 'extensions.triggers', |
| 2484 | + 'ignoreBudget': 'extensions.ignore_budget', | |
| 2484 | 2485 | }; |
| 2485 | 2486 | |
| 2486 | 2487 | /** Checks the state of the current search, and adds/removes the search sorting option accordingly */ |
| @@ -3568,6 +3569,18 @@ export async function getWorldEntry(name, data, entry) { | ||
| 3568 | 3569 | .trigger('input', { noSave: true }) |
| 3569 | 3570 | .trigger('change'); |
| 3570 | 3571 | |
| 3572 | + // Ignore budget | |
| 3573 | + const ignoreBudgetInput = editTemplate.find('input[name="ignoreBudget"]'); | |
| 3574 | + ignoreBudgetInput.data('uid', entry.uid); | |
| 3575 | + ignoreBudgetInput.on('input', async function (_, { noSave = false } = {}) { | |
| 3576 | + const uid = $(this).data('uid'); | |
| 3577 | + const value = $(this).prop('checked'); | |
| 3578 | + data.entries[uid].ignoreBudget = value; | |
| 3579 | + setWIOriginalDataValue(data, uid, 'extensions.ignore_budget', data.entries[uid].ignoreBudget); | |
| 3580 | + !noSave && await saveWorldInfo(name, data); | |
| 3581 | + }); | |
| 3582 | + ignoreBudgetInput.prop('checked', entry.ignoreBudget ?? false).trigger('input', { noSave: true }); | |
| 3583 | + | |
| 3571 | 3584 | countTokensDebounced(counter, contentInput.val()); |
| 3572 | 3585 | |
| 3573 | 3586 | editTemplate.find('.inline-drawer-content').css('display', 'none'); |
| @@ -3739,6 +3752,7 @@ export const newWorldInfoEntryDefinition = { | ||
| 3739 | 3752 | order: { default: 100, type: 'number' }, |
| 3740 | 3753 | position: { default: 0, type: 'number' }, |
| 3741 | 3754 | disable: { default: false, type: 'boolean' }, |
| 3755 | + ignoreBudget: { default: false, type: 'boolean' }, | |
| 3742 | 3756 | excludeRecursion: { default: false, type: 'boolean' }, |
| 3743 | 3757 | preventRecursion: { default: false, type: 'boolean' }, |
| 3744 | 3758 | matchPersonaDescription: { default: false, type: 'boolean' }, |
| @@ -4522,7 +4536,17 @@ export async function checkWorldInfo(chat, maxContext, isDryRun, globalScanData | ||
| 4522 | 4536 | console.debug('[WI] --- PROBABILITY CHECKS ---'); |
| 4523 | 4537 | !newEntries.length && console.debug('[WI] No probability checks to do'); |
| 4524 | 4538 | |
| 4539 | + let ignoresBudget = newEntries.filter(e => e.ignoreBudget).length; | |
| 4540 | + | |
| 4525 | 4541 | for (const entry of newEntries) { |
| 4542 | + ignoresBudget -= (entry.ignoreBudget ? 1 : 0); | |
| 4543 | + if (token_budget_overflowed && !entry.ignoreBudget) { | |
| 4544 | + if (ignoresBudget > 0) { | |
| 4545 | + continue; | |
| 4546 | + } | |
| 4547 | + break; | |
| 4548 | + } | |
| 4549 | + | |
| 4526 | 4550 | function verifyProbability() { |
| 4527 | 4551 | // If we don't need to roll, it's always true |
| 4528 | 4552 | if (!entry.useProbability || entry.probability === 100) { |
| @@ -4556,16 +4580,18 @@ export async function checkWorldInfo(chat, maxContext, isDryRun, globalScanData | ||
| 4556 | 4580 | entry.content = substituteParams(entry.content); |
| 4557 | 4581 | newContent += `${entry.content}\n`; |
| 4558 | 4582 | |
| 4559 | 4583 | if (!entry.ignoreBudget && (textToScanTokens + (await getTokenCountAsync(newContent))) >= budget) { |
| 4560 | - console.debug('[WI] --- BUDGET OVERFLOW CHECK ---'); | |
| 4584 | + if (!token_budget_overflowed) { | |
| 4561 | - if (world_info_overflow_alert) { | |
| 4585 | + console.debug('[WI] --- BUDGET OVERFLOW CHECK ---'); | |
| 4562 | - console.warn(`[WI] budget of ${budget} reached, stopping after ${allActivatedEntries.size} entries`); | |
| 4586 | + if (world_info_overflow_alert) { | |
| 4563 | 4587 | toastr console.warningwarn(`World[WI] infobudget of ${budget} reached, stopping after ${allActivatedEntries.size} entries.`, 'World Info'); |
| 4564 | - } else { | |
| 4588 | + toastr.warning(`World info budget reached after ${allActivatedEntries.size} entries.`, 'World Info'); | |
| 4565 | - console.debug(`[WI] budget of ${budget} reached, stopping after ${allActivatedEntries.size} entries`); | |
| 4589 | + } else { | |
| 4590 | + console.debug(`[WI] budget of ${budget} reached, stopping after ${allActivatedEntries.size} entries`); | |
| 4591 | + } | |
| 4592 | + token_budget_overflowed = true; | |
| 4566 | 4593 | } |
| 4567 | - token_budget_overflowed = true; | |
| 4594 | + continue; | |
| 4568 | - break; | |
| 4569 | 4595 | } |
| 4570 | 4596 | |
| 4571 | 4597 | allActivatedEntries.set(`${entry.world}.${entry.uid}`, entry); |
| @@ -4953,6 +4979,7 @@ function convertAgnaiMemoryBook(inputObj) { | ||
| 4953 | 4979 | cooldown: null, |
| 4954 | 4980 | delay: null, |
| 4955 | 4981 | triggers: [], |
| 4982 | + ignoreBudget: false, | |
| 4956 | 4983 | }; |
| 4957 | 4984 | }); |
| 4958 | 4985 | |
| @@ -4996,6 +5023,7 @@ function convertRisuLorebook(inputObj) { | ||
| 4996 | 5023 | cooldown: null, |
| 4997 | 5024 | delay: null, |
| 4998 | 5025 | triggers: [], |
| 5026 | + ignoreBudget: false, | |
| 4999 | 5027 | }; |
| 5000 | 5028 | }); |
| 5001 | 5029 | |
| @@ -5044,6 +5072,7 @@ function convertNovelLorebook(inputObj) { | ||
| 5044 | 5072 | cooldown: null, |
| 5045 | 5073 | delay: null, |
| 5046 | 5074 | triggers: [], |
| 5075 | + ignoreBudget: false, | |
| 5047 | 5076 | }; |
| 5048 | 5077 | }); |
| 5049 | 5078 | |
| @@ -5101,6 +5130,7 @@ export function convertCharacterBook(characterBook) { | ||
| 5101 | 5130 | matchCreatorNotes: entry.extensions?.match_creator_notes ?? false, |
| 5102 | 5131 | extensions: entry.extensions ?? {}, |
| 5103 | 5132 | triggers: entry.extensions?.triggers || [], |
| 5133 | + ignoreBudget: entry.extensions?.ignore_budget ?? false, | |
| 5104 | 5134 | }; |
| 5105 | 5135 | }); |
| 5106 | 5136 | |
| @@ -710,6 +710,7 @@ function convertWorldInfoToCharacterBook(name, entries) { | ||
| 710 | 710 | match_scenario: entry.matchScenario ?? false, |
| 711 | 711 | match_creator_notes: entry.matchCreatorNotes ?? false, |
| 712 | 712 | triggers: entry.triggers ?? [], |
| 713 | + ignore_budget: entry.ignoreBudget ?? false, | |
| 713 | 714 | }, |
| 714 | 715 | }; |
| 715 | 716 | |