Compare commits

...

26 Commits

Author SHA1 Message Date
LenAnderson 646f77f9f8 use textarea-owning layer instead of topmost modal layer 2024-07-25 18:06:48 -04:00
LenAnderson 19c7e1c763 Merge branch 'staging' into parser-followup-2 2024-07-25 18:02:29 -04:00
Cohee e59fb85db8
Merge pull request #2559 from SillyTavern/mistral-prompt-convert
Improve Mistral prompt conversion
2024-07-25 23:15:31 +03:00
Cohee b80ca93a1a Fix misplaced class on Claude prefill fields 2024-07-25 21:05:29 +03:00
Cohee ef59e8abae #2557 Improve Mistral prompt conversion 2024-07-25 21:04:57 +03:00
Cohee d31e44dec8 Chat Completion: split "none" and "default" names behavior 2024-07-25 20:13:06 +03:00
Cohee de38b06eec
Merge pull request #2555 from Succubyss/timestamp-hell
Timestamp Fixes & Refactoring
2024-07-25 09:46:49 +03:00
RossAscends aa6df2cfb4 Merge branch 'staging' of https://github.com/Cohee1207/SillyTavern into staging 2024-07-25 15:42:21 +09:00
RossAscends 545386f52c fix last mes swipe button loc when chat avatars are hidden 2024-07-25 15:42:19 +09:00
Cohee 170039150c
Merge pull request #2554 from Succubyss/groupChat-timestamp
Minor group chat timestamp fix
2024-07-25 09:33:25 +03:00
Cohee 807487ce85 Fix streams getting stuck on regen 2024-07-25 08:51:49 +03:00
Cohee c12a283efc Null safety for streaming processor 2024-07-25 08:40:24 +03:00
LenAnderson 50cba9622c check that debugController exists 2024-07-24 21:00:58 -04:00
Wolfsblvt c605037fbb number parsing, add jsdoc 2024-07-25 00:27:39 +02:00
Wolfsblvt d30fc5d165 Fix lint issues 2024-07-25 00:23:02 +02:00
Succubyss 7956dc0b3f parseTimestamp refactor, was broken for non-ms-bearing humanized timestamps 2024-07-24 16:58:08 -05:00
Succubyss b40012973e humanizedDateTime zero-pads month & day 2024-07-24 16:58:06 -05:00
Succubyss a031dbfbc8
fix initial group chat message timestamp when empty 2024-07-24 16:46:19 -05:00
Cohee 83f458fe49
Merge pull request #2553 from SillyTavern/fix-command-send-not-saving
Fix /send not saving chat in all cases
2024-07-24 22:13:43 +03:00
Wolfsblvt 18099c5a58 Fix /send not saving chat in all cases 2024-07-24 20:54:05 +02:00
Cohee af2dcd39e9
Merge pull request #2551 from steve02081504/patch-4
Update zh-cn.json
2024-07-24 21:15:08 +03:00
steve02081504 3e5f98223d fixes 2024-07-25 01:33:00 +08:00
Cohee e49da60bda New mistral large model 2024-07-24 20:19:57 +03:00
steve02081504 1f30d6d850 typo fix 2024-07-24 13:45:46 +08:00
steve02081504 fe89bc9cdf little fix 2024-07-24 10:47:52 +08:00
steve green 021edfdb2e Update zh-cn.json
- Remove the carriage return from Key so that I18N will work properly in some browsers.
- Append two HTML files that will not actually be utilized so that the I18N tool will work properly.
2024-07-24 10:40:18 +08:00
29 changed files with 242 additions and 144 deletions

View File

@ -28,6 +28,10 @@ body.hideChatAvatars .mesAvatarWrapper .avatar {
display: none !important;
}
body.hideChatAvatars .last_mes {
padding-bottom: 40px !important;
}
body.square-avatars .avatar,
body.square-avatars .avatar img {
border-radius: var(--avatar-base-border-radius) !important;
@ -450,4 +454,4 @@ body.expandMessageActions .mes .mes_buttons .extraMesButtonsHint {
#smooth_streaming:checked~#smooth_streaming_speed_control {
display: block;
}
}

View File

@ -1660,16 +1660,24 @@
</div>
<div class="inline-drawer-content">
<label class="checkbox_label flexWrap alignItemsCenter" for="character_names_none">
<input type="radio" id="character_names_none" name="character_names" value="0">
<input type="radio" id="character_names_none" name="character_names" value="-1">
<span data-i18n="None">None</span>
<i class="right_menu_button fa-solid fa-circle-exclamation" title="Except for groups and past personas. Otherwise, make sure you provide names in the prompt." data-i18n="[title]character_names_none"></i>
<small class="flexBasis100p" data-i18n="Don't add character names.">
Don't add character names.
<i class="right_menu_button fa-solid fa-circle-exclamation" title="Never add character name prefixes. May behave poorly in groups, choose with caution." data-i18n="[title]character_names_none"></i>
<small class="flexBasis100p" data-i18n="Never add character names.">
Never add character names.
</small>
</label>
<label class="checkbox_label flexWrap alignItemsCenter" for="character_names_default">
<input type="radio" id="character_names_default" name="character_names" value="0">
<span data-i18n="Default">Default</span>
<i class="right_menu_button fa-solid fa-circle-exclamation" title="Add prefixes for groups and past personas. Otherwise, make sure you provide names in the prompt." data-i18n="[title]character_names_default"></i>
<small class="flexBasis100p" data-i18n="Don't add character names unless necessary.">
Don't add character names unless necessary.
</small>
</label>
<label class="checkbox_label flexWrap alignItemsCenter" for="character_names_completion">
<input type="radio" id="character_names_completion" name="character_names" value="1">
<span data-i18n="Completion">Completion Object</span>
<span data-i18n="Completion Object">Completion Object</span>
<i class="right_menu_button fa-solid fa-circle-exclamation" title="Restrictions apply: only Latin alphanumerics and underscores. Doesn't work for all sources, notably: Claude, MistralAI, Google." data-i18n="[title]character_names_completion"></i>
<small class="flexBasis100p" data-i18n="Add character names to completion objects.">
Add character names to completion objects.
@ -1816,9 +1824,9 @@
<div data-newbie-hidden class="range-block" data-source="claude">
<div class="wide100p">
<span id="claude_assistant_prefill_text" data-i18n="Assistant Prefill">Assistant Prefill</span>
<textarea id="claude_assistant_prefill" class="text_pole textarea_compact" name="assistant_prefill autoSetHeight" rows="3" maxlength="10000" data-i18n="[placeholder]Start Claude's answer with..." placeholder="Start Claude's answer with..."></textarea>
<textarea id="claude_assistant_prefill" class="text_pole textarea_compact autoSetHeight" name="assistant_prefill" rows="3" maxlength="10000" data-i18n="[placeholder]Start Claude's answer with..." placeholder="Start Claude's answer with..."></textarea>
<span id="claude_assistant_impersonation_text" data-i18n="Assistant Impersonation Prefill">Assistant Impersonation Prefill</span>
<textarea id="claude_assistant_impersonation" class="text_pole textarea_compact" name="assistant_impersonation autoSetHeight" rows="3" maxlength="10000" data-i18n="[placeholder]Start Claude's answer with..." placeholder="Start Claude's answer with..."></textarea>
<textarea id="claude_assistant_impersonation" class="text_pole textarea_compact autoSetHeight" name="assistant_impersonation" rows="3" maxlength="10000" data-i18n="[placeholder]Start Claude's answer with..." placeholder="Start Claude's answer with..."></textarea>
</div>
<label for="claude_use_sysprompt" class="checkbox_label widthFreeExpand">
<input id="claude_use_sysprompt" type="checkbox" />
@ -2845,6 +2853,7 @@
<option value="mistral-small-2402">mistral-small-2402</option>
<option value="mistral-medium-2312">mistral-medium-2312</option>
<option value="mistral-large-2402">mistral-large-2402</option>
<option value="mistral-large-2407">mistral-large-2407</option>
<option value="codestral-2405">codestral-2405</option>
<option value="codestral-mamba-2407">codestral-mamba-2407</option>
</optgroup>
@ -4285,7 +4294,7 @@
<span class="fa-solid fa-circle-question note-link-span"></span>
</a>
</label>
<label class="checkbox_label" title="Prevents {{getvar::}} {{getglobalvar::}} macros from having literal macro-like values auto-evaluated.&NewLine;e.g. &quot;{{newline}}&quot; remains as literal string &quot;{{newline}}&quot;&NewLine;&NewLine;(This is done by internally replacing {{getvar::}} {{getglobalvar::}} macros with scoped variables.)" data-i18n="[title]Prevents {{getvar::}} {{getglobalvar::}} macros from having literal macro-like values auto-evaluated.&NewLine;e.g. &quot;{{newline}}&quot; remains as literal string &quot;{{newline}}&quot;&NewLine;&NewLine;(This is done by internally replacing {{getvar::}} {{getglobalvar::}} macros with scoped variables.)">
<label class="checkbox_label" title="Prevents {{getvar::}} {{getglobalvar::}} macros from having literal macro-like values auto-evaluated.&NewLine;e.g. &quot;{{newline}}&quot; remains as literal string &quot;{{newline}}&quot;&NewLine;&NewLine;(This is done by internally replacing {{getvar::}} {{getglobalvar::}} macros with scoped variables.)" data-i18n="[title]stscript_parser_flag_replace_getvar_label">
<input id="stscript_parser_flag_replace_getvar" type="checkbox" />
<span data-i18n="REPLACE_GETVAR"><small>REPLACE_GETVAR</small></span>
<a href="https://docs.sillytavern.app/usage/st-script/#replace-variable-macros" target="_blank" class="notes-link">

View File

@ -216,7 +216,7 @@
"Character Names Behavior": "سلوك أسماء الشخصيات",
"Helps the model to associate messages with characters.": "يساعد النموذج على ربط الرسائل بالأحرف.",
"None": "لا شيء",
"character_names_none": "باستثناء المجموعات والشخصيات السابقة. بخلاف ذلك، تأكد من تقديم الأسماء في المطالبة.",
"character_names_default": "باستثناء المجموعات والشخصيات السابقة. بخلاف ذلك، تأكد من تقديم الأسماء في المطالبة.",
"Don't add character names.": "لا تضيف أسماء الشخصيات.",
"Completion": "كائن الإكمال",
"character_names_completion": "تنطبق القيود: فقط الحروف الأبجدية اللاتينية والأرقام والشرطات السفلية. لا يعمل مع جميع المصادر، ولا سيما: Claude وMistralAI وGoogle.",

View File

@ -216,7 +216,7 @@
"Character Names Behavior": "Charakternamen Verhalten",
"Helps the model to associate messages with characters.": "Hilft dem Modell, Nachrichten mit Zeichen zu verknüpfen.",
"None": "Keins",
"character_names_none": "Außer für Gruppen und frühere Personas. Andernfalls stellen Sie sicher, dass Sie in der Eingabeaufforderung Namen angeben.",
"character_names_default": "Außer für Gruppen und frühere Personas. Andernfalls stellen Sie sicher, dass Sie in der Eingabeaufforderung Namen angeben.",
"Don't add character names.": "Fügen Sie keine Charakternamen hinzu.",
"Completion": "Vervollständigungsobjekt",
"character_names_completion": "Es gelten Einschränkungen: nur lateinische alphanumerische Zeichen und Unterstriche. Funktioniert nicht für alle Quellen, insbesondere: Claude, MistralAI, Google.",

View File

@ -216,7 +216,7 @@
"Character Names Behavior": "Comportamiento de los nombres de personajes",
"Helps the model to associate messages with characters.": "Ayuda al modelo a asociar mensajes con personajes.",
"None": "Ninguno",
"character_names_none": "Excepto grupos y personas pasadas. De lo contrario, asegúrese de proporcionar nombres en el mensaje.",
"character_names_default": "Excepto grupos y personas pasadas. De lo contrario, asegúrese de proporcionar nombres en el mensaje.",
"Don't add character names.": "No agregues nombres de personajes.",
"Completion": "Objeto de finalización",
"character_names_completion": "Aplican restricciones: solo caracteres alfanuméricos latinos y guiones bajos. No funciona para todas las fuentes, en particular: Claude, MistralAI, Google.",

View File

@ -216,7 +216,7 @@
"Character Names Behavior": "Comportement des noms de personnages",
"Helps the model to associate messages with characters.": "Aide le modèle à associer des messages à des personnages.",
"None": "Aucun",
"character_names_none": "Sauf pour les groupes et les personnages passés. Sinon, assurez-vous de fournir des noms dans l'invite.",
"character_names_default": "Sauf pour les groupes et les personnages passés. Sinon, assurez-vous de fournir des noms dans l'invite.",
"Don't add character names.": "N'ajoutez pas de noms de personnages.",
"Completion": "Objet d'achèvement",
"character_names_completion": "Des restrictions s'appliquent : uniquement les caractères alphanumériques latins et les traits de soulignement. Ne fonctionne pas pour toutes les sources, notamment : Claude, MistralAI, Google.",

View File

@ -216,7 +216,7 @@
"Character Names Behavior": "Hegðun persónunafna",
"Helps the model to associate messages with characters.": "Hjálpar líkaninu að tengja skilaboð við stafi.",
"None": "Enginn",
"character_names_none": "Nema hópar og fyrri persónur. Annars, vertu viss um að gefa upp nöfn í hvetjunni.",
"character_names_default": "Nema hópar og fyrri persónur. Annars, vertu viss um að gefa upp nöfn í hvetjunni.",
"Don't add character names.": "Ekki bæta við persónunöfnum.",
"Completion": "Lokunarhlutur",
"character_names_completion": "Takmarkanir gilda: aðeins latneskar tölustafir og undirstrik. Virkar ekki fyrir allar heimildir, sérstaklega: Claude, MistralAI, Google.",

View File

@ -216,7 +216,7 @@
"Character Names Behavior": "Comportamento dei nomi dei personaggi",
"Helps the model to associate messages with characters.": "Aiuta il modello ad associare i messaggi ai personaggi.",
"None": "Nessuno",
"character_names_none": "Fatta eccezione per i gruppi e i personaggi passati. Altrimenti, assicurati di fornire i nomi nel prompt.",
"character_names_default": "Fatta eccezione per i gruppi e i personaggi passati. Altrimenti, assicurati di fornire i nomi nel prompt.",
"Don't add character names.": "Non aggiungere nomi di personaggi.",
"Completion": "Oggetto di completamento",
"character_names_completion": "Si applicano restrizioni: solo caratteri alfanumerici latini e trattini bassi. Non funziona con tutte le fonti, in particolare: Claude, MistralAI, Google.",

View File

@ -216,7 +216,7 @@
"Character Names Behavior": "キャラクター名の動作",
"Helps the model to associate messages with characters.": "モデルがメッセージをキャラクターに関連付けるのに役立ちます。",
"None": "なし",
"character_names_none": "グループと過去のペルソナを除きます。それ以外の場合は、プロンプトに名前を必ず入力してください。",
"character_names_default": "グループと過去のペルソナを除きます。それ以外の場合は、プロンプトに名前を必ず入力してください。",
"Don't add character names.": "キャラクター名を追加しないでください。",
"Completion": "完了オブジェクト",
"character_names_completion": "制限事項: ラテン英数字とアンダースコアのみ。すべてのソースで機能するわけではありません。特に、Claude、MistralAI、Google では機能しません。",

View File

@ -216,7 +216,7 @@
"Character Names Behavior": "캐릭터 이름 행동",
"Helps the model to associate messages with characters.": "모델이 메시지를 캐릭터와 연관시키는 데 도움이 됩니다.",
"None": "없음",
"character_names_none": "그룹 및 과거 페르소나는 제외됩니다. 그렇지 않으면 프롬프트에 이름을 제공해야 합니다.",
"character_names_default": "그룹 및 과거 페르소나는 제외됩니다. 그렇지 않으면 프롬프트에 이름을 제공해야 합니다.",
"Don't add character names.": "캐릭터 이름을 추가하지 마세요.",
"Completion": "완료 객체",
"character_names_completion": "제한 사항이 적용됩니다. 라틴 영숫자 및 밑줄만 사용할 수 있습니다. 모든 소스, 특히 Claude, MistralAI, Google에서 작동하지 않습니다.",

View File

@ -216,7 +216,7 @@
"Character Names Behavior": "Karakternamen Gedrag",
"Helps the model to associate messages with characters.": "Helpt het model berichten aan karakters te koppelen.",
"None": "Geen",
"character_names_none": "Behalve voor groepen en vroegere persona's. Zorg er anders voor dat u namen opgeeft in de prompt.",
"character_names_default": "Behalve voor groepen en vroegere persona's. Zorg er anders voor dat u namen opgeeft in de prompt.",
"Don't add character names.": "Voeg geen namen van personages toe.",
"Completion": "Voltooiingsobject",
"character_names_completion": "Er zijn beperkingen van toepassing: alleen Latijnse alfanumerieke tekens en onderstrepingstekens. Werkt niet voor alle bronnen, met name: Claude, MistralAI, Google.",

View File

@ -216,7 +216,7 @@
"Character Names Behavior": "Comportamento dos nomes dos personagens",
"Helps the model to associate messages with characters.": "Ajuda o modelo a associar mensagens a personagens.",
"None": "Nenhum",
"character_names_none": "Exceto para grupos e personas passadas. Caso contrário, certifique-se de fornecer nomes no prompt.",
"character_names_default": "Exceto para grupos e personas passadas. Caso contrário, certifique-se de fornecer nomes no prompt.",
"Don't add character names.": "Não adicione nomes de personagens.",
"Completion": "Objeto de conclusão",
"character_names_completion": "Aplicam-se restrições: apenas alfanuméricos latinos e sublinhados. Não funciona para todas as fontes, nomeadamente: Claude, MistralAI, Google.",

View File

@ -1246,7 +1246,7 @@
"Top P & Min P": "Top P & Min P",
"llama.cpp only. Determines the order of samplers. If Mirostat mode is not 0, sampler order is ignored.": "llama.cpp only. Determines the order of samplers. If Mirostat mode is not 0, sampler order is ignored.",
"Helps the model to associate messages with characters.": "Помогает модели связывать сообщения с персонажами.",
"character_names_none": "Except for groups and past personas. Otherwise, make sure you provide names in the prompt.",
"character_names_default": "Except for groups and past personas. Otherwise, make sure you provide names in the prompt.",
"Completion": "Completion Object",
"character_names_completion": "Только латинские буквы, цифры и знак подчёркивания. Работает не для всех бэкендов, в частности для Claude, MistralAI, Google.",
"Use AI21 Tokenizer": "Использовать токенайзер AI21",
@ -1662,4 +1662,4 @@
"ext_regex_sts_desc": "Сообщения, отправленные с помощью команд STscript",
"ext_regex_wi_desc": "Содержимое лорбуков и миров. Для работы требует включения флажка \"Только промпт\"!",
"ext_regex_only_format_display_desc": "История чата не изменится, замена будет осуществляться только в отображаемом сообщении (в UI)"
}
}

View File

@ -216,7 +216,7 @@
"Character Names Behavior": "Поведінка імен персонажів",
"Helps the model to associate messages with characters.": "Допомагає моделі пов’язувати повідомлення з символами.",
"None": "Немає",
"character_names_none": "За винятком груп і минулих персонажів. В іншому випадку переконайтеся, що ви вказали імена в підказці.",
"character_names_default": "За винятком груп і минулих персонажів. В іншому випадку переконайтеся, що ви вказали імена в підказці.",
"Don't add character names.": "Не додавайте імена персонажів.",
"Completion": "Об'єкт завершення",
"character_names_completion": "Застосовуються обмеження: лише латинські букви та цифри підкреслення. Працює не для всіх джерел, зокрема: Claude, MistralAI, Google.",

View File

@ -216,7 +216,7 @@
"Character Names Behavior": "Tên nhân vật Hành vi",
"Helps the model to associate messages with characters.": "Giúp mô hình liên kết tin nhắn với các ký tự.",
"None": "Không",
"character_names_none": "Ngoại trừ các nhóm và cá tính trong quá khứ. Nếu không, hãy đảm bảo bạn cung cấp tên trong lời nhắc.",
"character_names_default": "Ngoại trừ các nhóm và cá tính trong quá khứ. Nếu không, hãy đảm bảo bạn cung cấp tên trong lời nhắc.",
"Don't add character names.": "Không thêm tên nhân vật.",
"Completion": "Đối tượng hoàn thành",
"character_names_completion": "Áp dụng hạn chế: chỉ chữ và số Latinh và dấu gạch dưới. Không hoạt động với tất cả các nguồn, đặc biệt là: Claude, MistralAI, Google.",

View File

@ -69,8 +69,8 @@
"Top A": "Top A",
"Quick Prompts Edit": "快速提示词编辑",
"Main": "主要",
"NSFW": "NSFW",
"Jailbreak": "越狱",
"Auxiliary": "辅助的",
"Post-History Instructions": "后续历史指令",
"Utility Prompts": "实用提示词",
"Impersonation prompt": "AI帮答提示词",
"Restore default prompt": "恢复默认提示词",
@ -217,8 +217,7 @@
"Character Names Behavior": "角色名称行为",
"Helps the model to associate messages with characters.": "有助于模型将消息与角色关联起来。",
"None": "无",
"tag_import_none": "无",
"character_names_none": "群聊和过去的角色除外。否则,请确保在提示词中提供了姓名。",
"character_names_default": "群聊和过去的角色除外。否则,请确保在提示词中提供了姓名。",
"Don't add character names.": "不添加角色名称。",
"Completion": "补全对象",
"character_names_completion": "适用限制仅限拉丁字母数字和下划线。不适用于所有补全源尤其是Claude、MistralAI、Google。",
@ -318,6 +317,7 @@
"View Remaining Credits": "查看剩余额度",
"OpenRouter Model": "OpenRouter 模型",
"Model Providers": "模型提供者",
"Allow fallback providers": "允许后备提供者",
"InfermaticAI API Key": "InfermaticAI API 密钥",
"InfermaticAI Model": "InfermaticAI 模型",
"DreamGen API key": "DreamGen API 密钥",
@ -346,6 +346,7 @@
"Ollama Model": "Ollama 模型",
"Download": "下载",
"Tabby API key": "Tabby API 密钥",
"Tabby Model": "Tabby 模型",
"koboldcpp API key (optional)": "koboldcpp API 密钥(可选)",
"Example: 127.0.0.1:5001": "示例127.0.0.1:5001",
"Authorize": "授权",
@ -363,13 +364,14 @@
"This will show up as your saved preset.": "这将显示为您保存的预设。",
"Proxy Server URL": "代理服务器 URL",
"Alternative server URL (leave empty to use the default value).": "备用服务器 URL留空以使用默认值。",
"Remove your real OAI API Key from the API panel BEFORE typing anything into this box": "在键入任何内容之前,从 API 面板中删除您的真实 OAI API 密钥",
"We cannot provide support for problems encountered while using an unofficial OpenAI proxy": "我们无法为使用非官方 OpenAI 代理时遇到的问题提供支持",
"Doesn't work? Try adding": "不起作用?尝试在最后添加",
"at the end!": "",
"Proxy Password": "代理密码",
"Will be used as a password for the proxy instead of API key.": "将用作代理的密码,而不是 API 密钥。",
"Peek a password": "查看密码",
"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.": "如果您使用代理,任何支持请求都将被拒绝。",
"Do not proceed if you do not agree to this!": "如果您不同意,请不要继续!",
"OpenAI API key": "OpenAI API 密钥",
"View API Usage Metrics": "查看API使用情况",
"Follow": "跟随",
@ -384,14 +386,14 @@
"Slack and Poe cookies will not work here, do not bother trying.": "Slack和Poe的cookie在这里不起作用请不要尝试。",
"Claude Model": "Claude 模型",
"Window AI Model": "Window AI 模型",
"Allow fallback routes Description": "如果所选模型无法响应您的请求,则自动选择备用模型。",
"Allow fallback models": "允许后备模型",
"Model Order": "OpenRouter 模型顺序",
"Alphabetically": "按字母顺序",
"Price": "价格(最便宜)",
"Context Size": "上下文大小",
"Group by vendors": "按供应商分组",
"Group by vendors Description": "将 OpenAI 模型放在一组,将 Anthropic 模型放在另一组,等等。可以与排序结合。",
"Allow fallback routes": "允许后备方案",
"Allow fallback routes Description": "如果所选模型无法响应您的请求,则自动选择备用模型。",
"openrouter_force_instruct": "此选项已过时,将来会被删除。要使用指令格式,请改用文本完成 API 下的 OpenRouter。",
"LEGACY": "旧版",
"Force Instruct Mode formatting": "强制指令模式格式化",
@ -440,8 +442,8 @@
"Chat Start": "聊天开始",
"Add Chat Start and Example Separator to a list of stopping strings.": "将聊天开始和示例分隔符添加到停止字符串列表中。",
"Use as Stop Strings": "用作停止字符串",
"context_allow_jailbreak": "如果在角色卡中定义并且启用了“首选角色越狱”,则在提示词末尾包含越狱。\n不建议在文本完成模型中使用此功能,否则会导致输出错误。",
"Allow Jailbreak": "允许越狱",
"context_allow_post_history_instructions": "如果在角色卡中定义并且启用了“首选角色卡说明”,则在提示末尾包含后历史说明。\n不建议在文本补全模型中使用此功能,否则会导致输出错误。",
"Allow Post-History Instructions": "允许后历史说明",
"Context Order": "上下文顺序",
"Summary": "总结",
"Author's Note": "作者注释",
@ -534,6 +536,7 @@
"Sorted Evenly": "均匀排序",
"Character Lore First": "角色世界书优先",
"Global Lore First": "全局世界书优先",
"Include names with each message into the context for scanning": "将每条消息的名称纳入上下文中以供扫描",
"Entries can activate other entries by mentioning their keywords": "条目可以通过提及它们的关键字来激活其他条目",
"Recursive Scan": "递归扫描",
"Lookup for the entry keys in the context will respect the case": "在上下文中查找条目键将保持大小写敏感",
@ -552,6 +555,7 @@
"Close all Entries": "关闭所有条目",
"New Entry": "新条目",
"Fill empty Memo/Titles with Keywords": "使用关键字填充空的备忘录/标题",
"Apply custom sorting as Order": "应用自定义排序作为顺序",
"Import World Info": "导入世界书",
"Export World Info": "导出世界书",
"Duplicate World Info": "复制世界书",
@ -659,14 +663,15 @@
"Defines on importing cards which action should be chosen for importing its listed tags. 'Ask' will always display the dialog.": "定义在导入卡片时应选择哪种操作来导入其列出的标签。“询问”将始终显示对话框。",
"Import Card Tags": "导入卡片标签",
"Ask": "询问",
"tag_import_none": "无",
"tag_import_all": "全部",
"Existing": "现存的",
"Use fuzzy matching, and search characters in the list by all data fields, not just by a name substring": "使用模糊匹配,在列表中通过所有数据字段搜索角色,而不仅仅是名称子字符串",
"Advanced Character Search": "高级角色搜索",
"If checked and the character card contains a prompt override (System Prompt), use that instead": "如果角色卡包含提示词,则使用它替代系统提示词",
"Prefer Character Card Prompt": "角色卡提示词优先",
"If checked and the character card contains a jailbreak override (Post History Instruction), use that instead": "如果角色卡包含越狱(后置历史记录指令),则使用它替代系统越狱",
"Prefer Character Card Jailbreak": "角色卡越狱优先",
"If checked and the character card contains a Post-History Instructions override, use that instead": "如果选中并且角色卡包含后历史指令覆盖,则使用它。",
"Prefer Character Card Instructions": "首选角色卡说明",
"Avoid cropping and resizing imported character images. When off, crop/resize to 512x768": "避免裁剪和调整导入的角色图像的大小。关闭时,裁剪/调整大小为 512x768。",
"Never resize avatars": "永不调整头像大小",
"Show actual file names on the disk, in the characters list display only": "在角色列表显示中,显示磁盘上实际的文件名。",
@ -739,6 +744,8 @@
"Log prompts to console": "将提示词记录到控制台",
"Requests logprobs from the API for the Token Probabilities feature": "从API请求对数概率数据用于实现词符概率功能。",
"Request token probabilities": "请求词符概率",
"In group chat, highlight the character(s) that are currently queued to generate responses and the order in which they will respond.": "在群聊中,突出显示当前排队等待生成响应的角色以及他们响应的顺序。",
"Show group chat queue": "显示群聊队列",
"Automatically reject and re-generate AI message based on configurable criteria": "根据可配置的条件自动拒绝并重新生成AI消息",
"Auto-swipe": "自动滑动",
"Enable the auto-swipe function. Settings in this section only have an effect when auto-swipe is enabled": "启用自动滑动功能。仅当启用自动滑动时,本节中的设置才会生效",
@ -770,7 +777,7 @@
"Parser Flags": "解析器标志",
"Switch to stricter escaping, allowing all delimiting characters to be escaped with a backslash, and backslashes to be escaped as well.": "切换到更严格的转义,允许所有分隔字符用反斜杠转义,并且反斜杠也可以转义。",
"STRICT_ESCAPING": "严格转义",
"Replace all {{getvar::}} and {{getglobalvar::}} macros with scoped variables to avoid double macro substitution.": "用范围变量替换所有 {{getvar::}} 和 {{getglobalvar::}} 宏,以避免双重宏替换。",
"stscript_parser_flag_replace_getvar_label": "防止 {{getvar::}} {{getglobalvar::}} 宏具有自动评估的文字宏类值。\n例如“{{newline}}”保留为文字字符串“{{newline}}”\n\n这是通过在内部用范围变量替换 {{getvar::}} {{getglobalvar::}} 宏来实现的。)",
"REPLACE_GETVAR": "替换GETVAR",
"Change Background Image": "更改背景图片",
"Filter": "搜索",
@ -921,7 +928,7 @@
"Insert {{original}} into either box to include the respective default prompt from system settings.": "将{{original}}插入到任一框中,以包含系统设置中的相应默认提示词。",
"Main Prompt": "主要提示词",
"Any contents here will replace the default Main Prompt used for this character. (v2 spec: system_prompt)": "此处的任何内容都将替换用于此角色的默认主提示词。v2规范system_prompt",
"Any contents here will replace the default Jailbreak Prompt used for this character. (v2 spec: post_history_instructions)": "此处的任何内容都将替换用于此角色的默认越狱提示词。v2规范post_history_instructions",
"Any contents here will replace the default Post-History Instructions used for this character. (v2 spec: post_history_instructions)": "此处的任何内容都将替换此角色使用的默认后历史说明。\nv2 规范post_history_instructions",
"Creator's Metadata (Not sent with the AI prompt)": "创作者的元数据不与AI提示词一起发送",
"Creator's Metadata": "创作者的元数据",
"(Not sent with the AI Prompt)": "(不随 AI 提示词发送)",
@ -957,9 +964,6 @@
"Lock": "加锁",
"Unlock": "解锁",
"Delete background": "删除背景",
"Chat Scenario Override": "聊天场景覆盖",
"Remove": "移除",
"Type here...": "在此处输入...",
"Chat Lorebook": "聊天知识书",
"Chat Lorebook for": "聊天知识书",
"chat_world_template_txt": "选定的世界信息将绑定到此聊天。生成 AI 回复时,\n它将与全球和角色传说书中的条目相结合。",
@ -1047,6 +1051,7 @@
"Use Probability": "使用概率",
"Add Memo": "添加备忘录",
"Text or token ids": "文本或 [token ID]",
"Type here...": "在此处输入...",
"close": "关闭",
"prompt_manager_edit": "编辑",
"prompt_manager_name": "姓名",
@ -1054,8 +1059,9 @@
"To whom this message will be attributed.": "此消息应归于谁。",
"AI Assistant": "AI助手",
"prompt_manager_position": "位置",
"Injection position. Next to other prompts (relative) or in-chat (absolute).": "注入位置。其他提示词旁边(相对)或在聊天中(绝对)。",
"Injection position. Relative (to other prompts in prompt manager) or In-chat @ Depth.": "注入位置。相对(相对于提示管理器中的其他提示)或在聊天中@深度。",
"prompt_manager_relative": "相对",
"prompt_manager_in_chat": "聊天中",
"prompt_manager_depth": "深度",
"Injection depth. 0 = after the last message, 1 = before the last message, etc.": "注入深度。0 = 在最后一条消息之后1 = 在最后一条消息之前,等等。",
"Prompt": "提示词",
@ -1187,7 +1193,12 @@
"These characters are the finalists of character design contests and have remarkable quality.": "这些角色都是角色设计大赛的入围作品,品质十分出色。",
"Featured Characters": "特色角色",
"Download Extensions & Assets": "下载扩展和资源菜单",
"Load a custom asset list or select": "加载自定义资产列表或选择",
"to install 3rd party extensions.": "安装第三方扩展。",
"Assets URL": "资产网址",
"load_asset_list_desc": "根据资产列表文件加载扩展和资产列表。\n\n此字段中的默认资产 URL 指向官方第一方扩展和资产列表。\n如果您有自定义资产列表可以在此处插入。\n\n要安装单个第三方扩展请使用右上角的“安装扩展”按钮。",
"Load an asset list": "加载资产列表",
"Load Asset List": "加载资产列表",
"Characters": "人物",
"Attach a File": "附加文件",
"Enter a URL or the ID of a Fandom wiki page to scrape:": "输入要抓取的 Fandom wiki 页面的 URL 或 ID",
@ -1271,6 +1282,7 @@
"Put images with expressions there. File names should follow the pattern:": "将带有表情的图像放在那里。文件名应遵循以下模式:",
"expression_label_pattern": "[表达式标签].[图像格式]",
"Sprite set:": "表情集:",
"Show Gallery": "展示图库",
"ext_sum_title": "总结",
"ext_sum_with": "总结如下:",
"ext_sum_main_api": "主要 API",
@ -1361,7 +1373,7 @@
"ext_regex_scoped_scripts_desc": "只影响当前角色,保存在角色卡片中",
"Regex Editor": "正则表达式编辑器",
"Test Mode": "测试模式",
"ext_regex_desc": "Regex 是一款使用正则表达式查找/替换字符串的工具。如果您想了解更多信息,请点击标题旁边的 ?。",
"ext_regex_desc": "正则是一款使用正则表达式查找/替换字符串的工具。如果您想了解更多信息,请点击标题旁边的 ?。",
"Input": "输入",
"ext_regex_test_input_placeholder": "在此输入...",
"Output": "输出",
@ -1445,6 +1457,10 @@
"Delete workflow": "删除工作流",
"Enhance": "提高",
"Refine": "优化",
"API Key": "API 密钥",
"Click to set": "点击设置",
"You can find your API key in the Stability AI dashboard.": "您可以在 Stability AI 仪表板中找到您的 API 密钥。",
"Style Preset": "风格预设",
"Sampling method": "采样方法",
"Scheduler": "调度器",
"Resolution": "分辨率",
@ -1564,12 +1580,10 @@
"New Tags": "新标签",
"Folder Tags": "文件夹标签",
"The following tags will be auto-imported based on the currently selected folders": "根据当前选定的文件夹将自动导入以下标签",
"Remember my choice": "记住我的选择",
"Remember the chosen import option If anything besides 'Cancel' is selected, this dialog will not show up anymore. To change this, go to the settings and modify \"Tag Import Option\". If the \"Import\" option is chosen, the global setting will stay on \"Ask\".": "记住所选的导入选项\n如果选择了“取消”以外的任何选项此对话框将不再显示。\n要更改此设置请转到设置并修改“标签导入选项”。\n\n如果选择了“导入”选项则全局设置将保留为“询问”。",
"Import None": "不导入",
"Import All": "全部导入",
"Import Existing": "导入现有",
"Import tags button": "导入",
"Import": "导入",
"Include Body Parameters": "包括主体参数",
"custom_include_body_desc": "聊天完成请求主体中要包含的参数YAML 对象)\n\n示例\n- top_k20\n- repetition_penalty1.1",
"Exclude Body Parameters": "排除主体参数",
@ -1671,6 +1685,9 @@
"char_import_8": "RisuRealm 角色(直链)",
"Supports importing multiple characters.": "支持导入多个角色。",
"Write each URL or ID into a new line.": "将每个 URL 或 ID 写入新行。",
"Show Raw Prompt": "显示原始提示",
"Copy Prompt": "复制提示",
"Show Prompt Differences": "显示提示差异",
"System-wide Replacement Macros (in order of evaluation):": "系统范围的替换宏(按评估顺序):",
"help_macros_1": "仅适用于斜线命令批处理。替换为上一个命令的返回结果。",
"help_macros_2": "仅插入一个换行符。",
@ -1687,6 +1704,7 @@
"help_macros_13": "角色对话示例",
"help_macros_14": "未格式化的对话示例",
"(only for Story String)": "(仅适用于故事字符串)",
"help_macros_summary": "“Summarize”扩展生成的最新聊天摘要如果有。",
"help_macros_15": "您当前的 Persona 用户名",
"help_macros_16": "角色的名字",
"help_macros_17": "角色的版本号",
@ -1700,6 +1718,7 @@
"help_macros_22": "上下文中包含的第一条消息的 ID。要求在当前会话中至少运行一次生成。",
"help_macros_23": "最后一条聊天消息中当前滑动的 ID以 1 为基数)。如果最后一条消息是用户或提示隐藏的,则为空字符串。",
"help_macros_24": "最后一条聊天消息中的滑动次数。如果最后一条消息是用户隐藏或提示隐藏的,则为空字符串。",
"help_macros_reverse": "反转宏的内容。",
"help_macros_25": "您可以在此处留言宏将被替换为空白内容。AI 看不到。",
"help_macros_26": "当前时间",
"help_macros_27": "当前日期",
@ -1769,10 +1788,21 @@
"prompt_manager_tokens": "词符",
"Are you sure you want to reset your settings to factory defaults?": "您确定要将设置重置为出厂默认设置吗?",
"Don't forget to save a snapshot of your settings before proceeding.": "在继续之前,不要忘记保存您的设置快照。",
"Chat Scenario Override": "聊天场景覆盖",
"Remove": "移除",
"Settings Snapshots": "设置快照",
"Record a snapshot of your current settings.": "记录当前设置的快照。",
"Make a Snapshot": "制作快照",
"Restore this snapshot": "恢复此快照",
"Downloader Options": "下载器选项",
"Extra parameters for downloading/HuggingFace API": "下载/HuggingFace API 的额外参数。如果不确定,请将其留空。",
"Revision": "修订",
"Folder Name": "输出文件夹名称",
"HF Token": "HF代币",
"Include Patterns": "包含模式",
"Glob patterns of files to include in the download.": "要包含在下载中的文件的全局模式。每个模式用换行符分隔。",
"Exclude Patterns": "排除模式",
"Glob patterns of files to exclude in the download.": "下载中要排除的文件的 Glob 模式。每个模式用换行符分隔。",
"Hi,": "嘿,",
"To enable multi-account features, restart the SillyTavern server with": "要启用多帐户功能,请使用以下命令重新启动 SillyTavern 服务器",
"set to true in the config.yaml file.": "在 config.yaml 文件中设置为 true。",

View File

@ -217,7 +217,7 @@
"Character Names Behavior": "角色人物名稱行為",
"Helps the model to associate messages with characters.": "幫助模型將訊息與角色人物關聯起來。",
"None": "無",
"character_names_none": "除了團體和過去的玩家角色人物外。否則,請確保在提示中提供名字。",
"character_names_default": "除了團體和過去的玩家角色人物外。否則,請確保在提示中提供名字。",
"Don't add character names.": "不要新增角色人物名稱",
"Completion": "補充",
"character_names_completion": "字元限制僅限拉丁字母數字和底線。不適用於所有來源特別是Claude、MistralAI、Google。",

View File

@ -2800,6 +2800,8 @@ class StreamingProcessor {
this.messageDom = null;
this.messageTextDom = null;
this.messageTimerDom = null;
this.messageTokenCounterDom = null;
/** @type {HTMLTextAreaElement} */
this.sendTextarea = document.querySelector('#send_textarea');
this.type = type;
this.force_name2 = force_name2;
@ -2815,6 +2817,15 @@ class StreamingProcessor {
this.messageLogprobs = [];
}
#checkDomElements(messageId) {
if (this.messageDom === null || this.messageTextDom === null) {
this.messageDom = document.querySelector(`#chat .mes[mesid="${messageId}"]`);
this.messageTextDom = this.messageDom?.querySelector('.mes_text');
this.messageTimerDom = this.messageDom?.querySelector('.mes_timer');
this.messageTokenCounterDom = this.messageDom?.querySelector('.tokenCounterDisplay');
}
}
showMessageButtons(messageId) {
if (messageId == -1) {
return;
@ -2843,9 +2854,7 @@ class StreamingProcessor {
else {
await saveReply(this.type, text, true);
messageId = chat.length - 1;
this.messageDom = document.querySelector(`#chat .mes[mesid="${messageId}"]`);
this.messageTextDom = this.messageDom.querySelector('.mes_text');
this.messageTimerDom = this.messageDom.querySelector('.mes_timer');
this.#checkDomElements(messageId);
this.showMessageButtons(messageId);
}
@ -2881,9 +2890,10 @@ class StreamingProcessor {
this.sendTextarea.dispatchEvent(new Event('input', { bubbles: true }));
}
else {
let currentTime = new Date();
this.#checkDomElements(messageId);
const currentTime = new Date();
// Don't waste time calculating token count for streaming
let currentTokenCount = isFinal && power_user.message_token_count_enabled ? getTokenCount(processedText, 0) : 0;
const currentTokenCount = isFinal && power_user.message_token_count_enabled ? getTokenCount(processedText, 0) : 0;
const timePassed = formatGenerationTimer(this.timeStarted, currentTime, currentTokenCount);
chat[messageId]['mes'] = processedText;
chat[messageId]['gen_started'] = this.timeStarted;
@ -2895,8 +2905,9 @@ class StreamingProcessor {
}
chat[messageId]['extra']['token_count'] = currentTokenCount;
const tokenCounter = $(`#chat .mes[mesid="${messageId}"] .tokenCounterDisplay`);
tokenCounter.text(`${currentTokenCount}t`);
if (this.messageTokenCounterDom instanceof HTMLElement) {
this.messageTokenCounterDom.textContent = `${currentTokenCount}t`;
}
}
if ((this.type == 'swipe' || this.type === 'continue') && Array.isArray(chat[messageId]['swipes'])) {
@ -2904,16 +2915,20 @@ class StreamingProcessor {
chat[messageId]['swipe_info'][chat[messageId]['swipe_id']] = { 'send_date': chat[messageId]['send_date'], 'gen_started': chat[messageId]['gen_started'], 'gen_finished': chat[messageId]['gen_finished'], 'extra': JSON.parse(JSON.stringify(chat[messageId]['extra'])) };
}
let formattedText = messageFormatting(
const formattedText = messageFormatting(
processedText,
chat[messageId].name,
chat[messageId].is_system,
chat[messageId].is_user,
messageId,
);
this.messageTextDom.innerHTML = formattedText;
this.messageTimerDom.textContent = timePassed.timerValue;
this.messageTimerDom.title = timePassed.timerTitle;
if (this.messageTextDom instanceof HTMLElement) {
this.messageTextDom.innerHTML = formattedText;
}
if (this.messageTimerDom instanceof HTMLElement) {
this.messageTimerDom.textContent = timePassed.timerValue;
this.messageTimerDom.title = timePassed.timerTitle;
}
this.setFirstSwipe(messageId);
}
@ -3199,6 +3214,23 @@ function restoreResponseLength(api, responseLength) {
}
}
/**
* Removes last message from the chat DOM.
* @returns {Promise<void>} Resolves when the message is removed.
*/
function removeLastMessage() {
return new Promise((resolve) => {
const lastMes = $('#chat').children('.mes').last();
if (lastMes.length === 0) {
return resolve();
}
lastMes.hide(animation_duration, function () {
$(this).remove();
resolve();
});
});
}
/**
* Runs a generation using the current chat context.
* @param {string} type Generation type
@ -3331,9 +3363,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
}
else if (type !== 'quiet' && type !== 'swipe' && !isImpersonate && !dryRun && chat.length) {
chat.length = chat.length - 1;
$('#chat').children().last().hide(250, function () {
$(this).remove();
});
await removeLastMessage();
await eventSource.emit(event_types.MESSAGE_DELETED, chat.length);
}
}
@ -4698,6 +4728,7 @@ export async function sendMessageAsUser(messageText, messageBias, insertAt = nul
await eventSource.emit(event_types.MESSAGE_SENT, chat_id);
addOneMessage(message);
await eventSource.emit(event_types.USER_MESSAGE_RENDERED, chat_id);
await saveChatConditional();
}
}

View File

@ -157,18 +157,15 @@ export function shouldSendOnEnter() {
//Does not break old characters/chats, as the code just uses whatever timestamp exists in the chat.
//New chats made with characters will use this new formatting.
export function humanizedDateTime() {
let baseDate = new Date(Date.now());
let humanYear = baseDate.getFullYear();
let humanMonth = baseDate.getMonth() + 1;
let humanDate = baseDate.getDate();
let humanHour = (baseDate.getHours() < 10 ? '0' : '') + baseDate.getHours();
let humanMinute =
(baseDate.getMinutes() < 10 ? '0' : '') + baseDate.getMinutes();
let humanSecond =
(baseDate.getSeconds() < 10 ? '0' : '') + baseDate.getSeconds();
let HumanizedDateTime =
humanYear + '-' + humanMonth + '-' + humanDate + '@' + humanHour + 'h' + humanMinute + 'm' + humanSecond + 's';
return HumanizedDateTime;
const now = new Date(Date.now());
const dt = {
year: now.getFullYear(), month: now.getMonth() + 1, day: now.getDate(),
hour: now.getHours(), minute: now.getMinutes(), second: now.getSeconds(),
};
for (const key in dt) {
dt[key] = dt[key].toString().padStart(2, '0');
}
return `${dt.year}-${dt.month}-${dt.day}@${dt.hour}h${dt.minute}m${dt.second}s`;
}
//this is a common format version to display a timestamp on each chat message

View File

@ -463,7 +463,7 @@ export class AutoComplete {
}
this.dom.append(frag);
this.updatePosition();
getTopmostModalLayer().append(this.domWrap);
this.getLayer().append(this.domWrap);
} else {
this.domWrap.remove();
}
@ -478,10 +478,17 @@ export class AutoComplete {
if (!this.isShowingDetails && this.isReplaceable) return this.detailsWrap.remove();
this.detailsDom.innerHTML = '';
this.detailsDom.append(this.selectedItem?.renderDetails() ?? 'NO ITEM');
getTopmostModalLayer().append(this.detailsWrap);
this.getLayer().append(this.detailsWrap);
this.updateDetailsPositionDebounced();
}
/**
* @returns {HTMLElement} closest ancestor dialog or body
*/
getLayer() {
return this.textarea.closest('dialog, body');
}
/**
@ -494,7 +501,7 @@ export class AutoComplete {
const rect = {};
rect[AUTOCOMPLETE_WIDTH.INPUT] = this.textarea.getBoundingClientRect();
rect[AUTOCOMPLETE_WIDTH.CHAT] = document.querySelector('#sheld').getBoundingClientRect();
rect[AUTOCOMPLETE_WIDTH.FULL] = getTopmostModalLayer().getBoundingClientRect();
rect[AUTOCOMPLETE_WIDTH.FULL] = this.getLayer().getBoundingClientRect();
this.domWrap.style.setProperty('--bottom', `${window.innerHeight - rect[AUTOCOMPLETE_WIDTH.INPUT].top}px`);
this.dom.style.setProperty('--bottom', `${window.innerHeight - rect[AUTOCOMPLETE_WIDTH.INPUT].top}px`);
this.domWrap.style.bottom = `${window.innerHeight - rect[AUTOCOMPLETE_WIDTH.INPUT].top}px`;
@ -521,7 +528,7 @@ export class AutoComplete {
const rect = {};
rect[AUTOCOMPLETE_WIDTH.INPUT] = this.textarea.getBoundingClientRect();
rect[AUTOCOMPLETE_WIDTH.CHAT] = document.querySelector('#sheld').getBoundingClientRect();
rect[AUTOCOMPLETE_WIDTH.FULL] = getTopmostModalLayer().getBoundingClientRect();
rect[AUTOCOMPLETE_WIDTH.FULL] = this.getLayer().getBoundingClientRect();
if (this.isReplaceable) {
this.detailsWrap.classList.remove('full');
const selRect = this.selectedItem.dom.children[0].getBoundingClientRect();
@ -547,7 +554,7 @@ export class AutoComplete {
updateFloatingPosition() {
const location = this.getCursorPosition();
const rect = this.textarea.getBoundingClientRect();
const layerRect = this.textarea.closest('dialog, body').getBoundingClientRect();
const layerRect = this.getLayer().getBoundingClientRect();
// cursor is out of view -> hide
if (location.bottom < rect.top || location.top > rect.bottom || location.left < rect.left || location.left > rect.right) {
return this.hide();
@ -570,7 +577,7 @@ export class AutoComplete {
updateFloatingDetailsPosition(location = null) {
if (!location) location = this.getCursorPosition();
const rect = this.textarea.getBoundingClientRect();
const layerRect = this.textarea.closest('dialog, body').getBoundingClientRect();
const layerRect = this.getLayer().getBoundingClientRect();
if (location.bottom < rect.top || location.top > rect.bottom || location.left < rect.left || location.left > rect.right) {
return this.hide();
}

View File

@ -14,7 +14,7 @@ import {
saveChatConditional,
saveItemizedPrompts,
} from '../script.js';
import { humanizedDateTime } from './RossAscends-mods.js';
import { humanizedDateTime, getMessageTimeStamp } from './RossAscends-mods.js';
import {
getGroupPastChats,
group_activation_strategy,
@ -297,7 +297,7 @@ async function convertSoloToGroupChat() {
if (groupChat.length === 0) {
const newMessage = {
...system_messages[system_message_types.GROUP],
send_date: humanizedDateTime(),
send_date: getMessageTimeStamp(),
extra: { type: system_message_types.GROUP },
};
groupChat.push(newMessage);

View File

@ -0,0 +1,2 @@
<!-- I18n data for tools used to auto generate translations -->
<div data-i18n="Show Gallery">Show Gallery</div>

View File

@ -13,6 +13,7 @@ import { SlashCommand } from '../../slash-commands/SlashCommand.js';
import { ARGUMENT_TYPE, SlashCommandNamedArgument } from '../../slash-commands/SlashCommandArgument.js';
import { DragAndDropHandler } from '../../dragdrop.js';
import { commonEnumProviders } from '../../slash-commands/SlashCommandCommonEnumsProvider.js';
import { translate } from '../../i18n.js';
const extensionName = 'gallery';
const extensionFolderPath = `scripts/extensions/${extensionName}/`;
@ -228,7 +229,7 @@ $(document).ready(function () {
$('#char-management-dropdown').append(
$('<option>', {
id: 'show_char_gallery',
text: 'Show Gallery',
text: translate('Show Gallery'),
}),
);
});

View File

@ -188,7 +188,8 @@ export const chat_completion_sources = {
};
const character_names_behavior = {
NONE: 0,
NONE: -1,
DEFAULT: 0,
COMPLETION: 1,
CONTENT: 2,
};
@ -300,7 +301,7 @@ const default_settings = {
bypass_status_check: false,
continue_prefill: false,
function_calling: false,
names_behavior: character_names_behavior.NONE,
names_behavior: character_names_behavior.DEFAULT,
continue_postfix: continue_postfix_types.SPACE,
custom_prompt_post_processing: custom_prompt_post_processing_types.NONE,
seed: -1,
@ -380,7 +381,7 @@ const oai_settings = {
bypass_status_check: false,
continue_prefill: false,
function_calling: false,
names_behavior: character_names_behavior.NONE,
names_behavior: character_names_behavior.DEFAULT,
continue_postfix: continue_postfix_types.SPACE,
custom_prompt_post_processing: custom_prompt_post_processing_types.NONE,
seed: -1,
@ -554,6 +555,8 @@ function setOpenAIMessages(chat) {
// for groups or sendas command - prepend a character's name
switch (oai_settings.names_behavior) {
case character_names_behavior.NONE:
break;
case character_names_behavior.DEFAULT:
if (selected_group || (chat[j].force_avatar && chat[j].name !== name1 && chat[j].extra?.type !== system_message_types.NARRATOR)) {
content = `${chat[j].name}: ${content}`;
}
@ -563,8 +566,9 @@ function setOpenAIMessages(chat) {
content = `${chat[j].name}: ${content}`;
}
break;
case character_names_behavior.COMPLETION:
break;
default:
// No action for character_names_behavior.COMPLETION
break;
}
@ -3189,6 +3193,9 @@ function setNamesBehaviorControls() {
case character_names_behavior.NONE:
$('#character_names_none').prop('checked', true);
break;
case character_names_behavior.DEFAULT:
$('#character_names_default').prop('checked', true);
break;
case character_names_behavior.COMPLETION:
$('#character_names_completion').prop('checked', true);
break;
@ -4149,6 +4156,8 @@ async function onModelChange() {
$('#openai_max_context').attr('max', unlocked_max);
} else if (oai_settings.mistralai_model.includes('codestral-mamba')) {
$('#openai_max_context').attr('max', max_256k);
} else if (['mistral-large-2407', 'mistral-large-latest'].includes(oai_settings.mistralai_model)) {
$('#openai_max_context').attr('max', max_128k);
} else if (oai_settings.mistralai_model.includes('mistral-nemo')) {
$('#openai_max_context').attr('max', max_128k);
} else if (oai_settings.mistralai_model.includes('mixtral-8x22b')) {
@ -5182,6 +5191,12 @@ $(document).ready(async function () {
saveSettingsDebounced();
});
$('#character_names_default').on('input', function () {
oai_settings.names_behavior = character_names_behavior.DEFAULT;
setNamesBehaviorControls();
saveSettingsDebounced();
});
$('#character_names_completion').on('input', function () {
oai_settings.names_behavior = character_names_behavior.COMPLETION;
setNamesBehaviorControls();

View File

@ -275,9 +275,11 @@ export class SlashCommandClosure {
let isFirst = true;
for (const executor of this.executorList) {
this.onProgress?.(done, this.commandCount);
this.debugController?.setExecutor(executor);
this.debugController.namedArguments = undefined;
this.debugController.unnamedArguments = undefined;
if (this.debugController) {
this.debugController.setExecutor(executor);
this.debugController.namedArguments = undefined;
this.debugController.unnamedArguments = undefined;
}
// yield before doing anything with this executor, the debugger might want to do
// something with it (e.g., breakpoint, immediate closures that need resolving
// or stepping into)

View File

@ -0,0 +1,5 @@
<!-- I18n data for tools used to auto generate translations -->
<div data-i18n="Import None">Import None</div>
<div data-i18n="Import All">Import All</div>
<div data-i18n="Import Existing">Import Existing</div>
<div data-i18n="Import">Import</div>

View File

@ -722,43 +722,54 @@ export function timestampToMoment(timestamp) {
return moment;
}
/**
* Parses a timestamp and returns a moment object representing the parsed date and time.
* @param {string|number} timestamp - The timestamp to parse. It can be a string or a number.
* @returns {moment.Moment} - A moment object representing the parsed date and time. If the timestamp is invalid, an invalid moment object is returned.
*/
function parseTimestamp(timestamp) {
if (!timestamp) {
return moment.invalid();
}
if (!timestamp) return moment.invalid();
// Unix time (legacy TAI / tags)
if (typeof timestamp === 'number' || /^\d+$/.test(timestamp)) {
if (isNaN(timestamp) || !isFinite(timestamp) || timestamp < 0) {
return moment.invalid();
}
return moment(Number(timestamp));
const number = Number(timestamp);
if (isNaN(number)) return moment.invalid();
if (!isFinite(number)) return moment.invalid();
if (number < 0) return moment.invalid();
return moment(number);
}
// ST "humanized" format pattern
const pattern1 = /(\d{4})-(\d{1,2})-(\d{1,2}) @(\d{1,2})h (\d{1,2})m (\d{1,2})s (\d{1,3})ms/;
const replacement1 = (match, year, month, day, hour, minute, second, millisecond) => {
return `${year.padStart(4, '0')}-${month.padStart(2, '0')}-${day.padStart(2, '0')}T${hour.padStart(2, '0')}:${minute.padStart(2, '0')}:${second.padStart(2, '0')}.${millisecond.padStart(3, '0')}Z`;
};
const isoTimestamp1 = timestamp.replace(pattern1, replacement1);
if (moment(isoTimestamp1).isValid()) {
return moment(isoTimestamp1);
}
let dtFmt = [];
// New format pattern: "June 19, 2023 4:13pm"
const pattern2 = /(\w+)\s(\d{1,2}),\s(\d{4})\s(\d{1,2}):(\d{1,2})(am|pm)/i;
const replacement2 = (match, month, day, year, hour, minute, meridiem) => {
// meridiem-based format
const convertFromMeridiemBased = (_, month, day, year, hour, minute, meridiem) => {
const monthNum = moment().month(month).format('MM');
const hour24 = meridiem.toLowerCase() === 'pm' ? (parseInt(hour, 10) % 12) + 12 : parseInt(hour, 10) % 12;
return `${year}-${monthNum}-${day.padStart(2, '0')}T${hour24.toString().padStart(2, '0')}:${minute.padStart(2, '0')}:00`;
};
const isoTimestamp2 = timestamp.replace(pattern2, replacement2);
if (moment(isoTimestamp2).isValid()) {
return moment(isoTimestamp2);
// June 19, 2023 2:20pm
dtFmt.push({ callback: convertFromMeridiemBased, pattern: /(\w+)\s(\d{1,2}),\s(\d{4})\s(\d{1,2}):(\d{1,2})(am|pm)/i });
// ST "humanized" format patterns
const convertFromHumanized = (_, year, month, day, hour, min, sec, ms) => {
ms = typeof ms !== 'undefined' ? `.${ms.padStart(3, '0')}` : '';
return `${year.padStart(4, '0')}-${month.padStart(2, '0')}-${day.padStart(2, '0')}T${hour.padStart(2, '0')}:${min.padStart(2, '0')}:${sec.padStart(2, '0')}${ms}Z`;
};
// 2024-7-12@01h31m37s
dtFmt.push({ callback: convertFromHumanized, pattern: /(\d{4})-(\d{1,2})-(\d{1,2})@(\d{1,2})h(\d{1,2})m(\d{1,2})s/ });
// 2024-6-5 @14h 56m 50s 682ms
dtFmt.push({ callback: convertFromHumanized, pattern: /(\d{4})-(\d{1,2})-(\d{1,2}) @(\d{1,2})h (\d{1,2})m (\d{1,2})s (\d{1,3})ms/ });
let iso8601;
for (const x of dtFmt) {
let rgxMatch = timestamp.match(x.pattern);
if (!rgxMatch) continue;
iso8601 = x.callback(...rgxMatch);
break;
}
// If none of the patterns match, return an invalid moment object
return moment.invalid();
// If one of the patterns matched, return a valid moment object, otherwise return an invalid moment object
return iso8601 ? moment(iso8601) : moment.invalid();
}
/**

View File

@ -483,7 +483,7 @@ async function sendMistralAIRequest(request, response) {
}
try {
const messages = convertMistralMessages(request.body.messages, request.body.model, request.body.char_name, request.body.user_name);
const messages = convertMistralMessages(request.body.messages, request.body.char_name, request.body.user_name);
const controller = new AbortController();
request.socket.removeAllListeners('close');
request.socket.on('close', function () {

View File

@ -364,65 +364,49 @@ function convertGooglePrompt(messages, model, useSysPrompt = false, charName = '
/**
* Convert a prompt from the ChatML objects to the format used by MistralAI.
* @param {object[]} messages Array of messages
* @param {string} model Model name
* @param {string} charName Character name
* @param {string} userName User name
*/
function convertMistralMessages(messages, model, charName = '', userName = '') {
function convertMistralMessages(messages, charName = '', userName = '') {
if (!Array.isArray(messages)) {
return [];
}
//large seems to be throwing a 500 error if we don't make the first message a user role, most likely a bug since the other models won't do this
if (model.includes('large')) {
messages[0].role = 'user';
}
//must send a user role as last message
// Make the last assistant message a prefill
const lastMsg = messages[messages.length - 1];
if (messages.length > 0 && lastMsg && (lastMsg.role === 'system' || lastMsg.role === 'assistant')) {
if (lastMsg.role === 'assistant' && lastMsg.name) {
lastMsg.content = lastMsg.name + ': ' + lastMsg.content;
} else if (lastMsg.role === 'system') {
lastMsg.content = '[INST] ' + lastMsg.content + ' [/INST]';
}
lastMsg.role = 'user';
if (messages.length > 0 && lastMsg && (lastMsg.role === 'assistant')) {
lastMsg.prefix = true;
}
//system prompts can be stacked at the start, but any futher sys prompts after the first user/assistant message will break the model
let encounteredNonSystemMessage = false;
// Doesn't support completion names, so prepend if not already done by the frontend (e.g. for group chats).
messages.forEach(msg => {
if (msg.role === 'system' && msg.name === 'example_assistant') {
if (charName) {
if (charName && !msg.content.startsWith(`${charName}: `)) {
msg.content = `${charName}: ${msg.content}`;
}
delete msg.name;
}
if (msg.role === 'system' && msg.name === 'example_user') {
if (userName) {
if (userName && !msg.content.startsWith(`${userName}: `)) {
msg.content = `${userName}: ${msg.content}`;
}
delete msg.name;
}
if (msg.name) {
if (msg.name && msg.role !== 'system' && !msg.content.startsWith(`${msg.name}: `)) {
msg.content = `${msg.name}: ${msg.content}`;
delete msg.name;
}
if ((msg.role === 'user' || msg.role === 'assistant') && !encounteredNonSystemMessage) {
encounteredNonSystemMessage = true;
}
if (encounteredNonSystemMessage && msg.role === 'system') {
msg.role = 'user';
//unsure if the instruct version is what they've deployed on their endpoints and if this will make a difference or not.
//it should be better than just sending the message as a user role without context though
msg.content = '[INST] ' + msg.content + ' [/INST]';
}
});
// If system role message immediately follows an assistant message, change its role to user
for (let i = 0; i < messages.length - 1; i++) {
if (messages[i].role === 'assistant' && messages[i + 1].role === 'system') {
messages[i + 1].role = 'user';
}
}
return messages;
}