Merge branch 'staging' into group-join-examples

d7328af4c8d4541e792e83169c9f24df15c34452

Cohee <18619528+Cohee1207@users.noreply.github.com>

25 files changed, +426 -346Showing whitespace changes
package-lock.json+7 -0
@@ -63,6 +63,7 @@
6363 "showdown": "^2.1.0",
6464 "sillytavern-transformers": "2.14.6",
6565 "simple-git": "^3.19.1",
66+ "slidetoggle": "^4.0.0",
6667 "tiktoken": "^1.0.16",
6768 "vectra": "^0.2.2",
6869 "wavefile": "^11.0.0",
@@ -6531,6 +6532,12 @@
65316532 "integrity": "sha512-VZBmZP8WU3sMOZm1bdgTadsQbcscK0UM8oKxKVBs4XAhUo2Xxzm/OFMGBkPusxw9xL3Uy8LrzEqGqJhclsr0yA==",
65326533 "license": "MIT"
65336534 },
6535+ "node_modules/slidetoggle": {
6536+ "version": "4.0.0",
6537+ "resolved": "https://registry.npmjs.org/slidetoggle/-/slidetoggle-4.0.0.tgz",
6538+ "integrity": "sha512-6qvrOS1dnDFEr41UEEFFRQE8nswaAFIYZAHer6dVlznRIjHyCISjNJoxIn5U5QlAbZfBBxTELQk4jS7miHto1A==",
6539+ "license": "MIT"
6540+ },
65346541 "node_modules/smart-buffer": {
65356542 "version": "4.2.0",
65366543 "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
package.json+1 -0
@@ -53,6 +53,7 @@
5353 "showdown": "^2.1.0",
5454 "sillytavern-transformers": "2.14.6",
5555 "simple-git": "^3.19.1",
56+ "slidetoggle": "^4.0.0",
5657 "tiktoken": "^1.0.16",
5758 "vectra": "^0.2.2",
5859 "wavefile": "^11.0.0",
public/img/generic.svg+15 -0
@@ -0,0 +1,15 @@
1+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+<svg
3+ width="616.86328"
4+ height="616.86328"
5+ viewBox="0 0 77.10791 77.10791"
6+ version="1.1"
7+ id="svg4"
8+ xmlns="http://www.w3.org/2000/svg"
9+ xmlns:svg="http://www.w3.org/2000/svg">
10+ <defs
11+ id="defs4" />
12+ <path
13+ id="circle1"
14+ d="M 38.553955,0 A 38.554,38.554 0 0 0 0,38.553955 38.554,38.554 0 0 0 38.553955,77.107911 38.554,38.554 0 0 0 77.107911,38.553955 38.554,38.554 0 0 0 38.553955,0 Z m -3.125976,13.545898 h 6.251953 v 19.593751 l 16.968751,-9.796875 3.125974,5.414306 -16.968506,9.796875 16.968506,9.796877 -3.125974,5.414305 -16.968751,-9.796874 V 63.56201 H 35.427979 V 43.968263 l -16.968506,9.796874 -3.125977,-5.414305 16.96875,-9.796877 -16.96875,-9.796875 3.125977,-5.414306 16.968506,9.796875 z" />
15+</svg>
public/index.html+16 -18
@@ -1736,6 +1736,7 @@
17361736 <div data-name="tfs_z" draggable="true"><span>Tail Free Sampling</span><small></small></div>
17371737 <div data-name="min_p" draggable="true"><span>Min P</span><small></small></div>
17381738 <div data-name="xtc" draggable="true"><span>Exclude Top Choices</span><small></small></div>
1739+ <div data-name="dry" draggable="true"><span>DRY</span><small></small></div>
17391740 </div>
17401741 <div id="llamacpp_samplers_default_order" class="menu_button menu_button_icon">
17411742 <span data-i18n="Load default order">Load default order</span>
@@ -2616,7 +2617,7 @@
26162617 </div>
26172618 </div>
26182619 <div class="flex-container flexFlowColumn marginTopBot5">
26192620 <label data-tg-type="ooba, generic" class="checkbox_label" for="bypass_status_check_textgenerationwebui">
26202621 <input type="checkbox" id="bypass_status_check_textgenerationwebui" />
26212622 <span data-i18n="Bypass status check">Bypass status check</span>
26222623 </label>
@@ -3025,34 +3026,30 @@
30253026 <optgroup label="Primary">
30263027 <option value="gemini-1.5-pro">Gemini 1.5 Pro</option>
30273028 <option value="gemini-1.5-flash">Gemini 1.5 Flash</option>
30283029 <option value="gemini-1.0-pro">Gemini 1.0 Pro (Deprecated)</option>
30293030 <option value="gemini-pro">Gemini Pro (1.0) (Deprecated)</option>
3030- <option value="gemini-pro-vision">Gemini Pro Vision (1.0)</option>
30313031 <option value="gemini-ultra">Gemini Ultra (1.0)</option>
30323032 <option value="gemini-1.0-ultra-latest">Gemini 1.0 Ultra</option>
3033- <option value="text-bison-001">PaLM 2 (Legacy)</option>
3034- <option value="chat-bison-001">PaLM 2 Chat (Legacy)</option>
30353033 </optgroup>
30363034 <optgroup label="Subversions">
30373035 <option value="gemini-2.0-flash-exp">Gemini 2.0 Flash ExperimentExperimental</option>
30383036 <option value="gemini-exp-1114">Gemini Experimental 2024-11-14</option>
30393037 <option value="gemini-exp-1121">Gemini Experimental 2024-11-21</option>
30403038 <option value="gemini-exp-1206">Gemini Experimental 2024-12-06</option>
30413039 <option value="gemini-1.5-pro-exp-0801">Gemini 1.5 Pro ExperimentExperimental 2024-08-01</option>
30423040 <option value="gemini-1.5-pro-exp-0827">Gemini 1.5 Pro ExperimentExperimental 2024-08-27</option>
30433041 <option value="gemini-1.5-pro-latest">Gemini 1.5 Pro [latest]</option>
30443042 <option value="gemini-1.5-pro-001">Gemini 1.5 Pro [001]</option>
30453043 <option value="gemini-1.5-pro-002">Gemini 1.5 Pro [002]</option>
30463044 <option value="gemini-1.5-flash-8b">Gemini 1.5 Flash 8B</option>
30473045 <option value="gemini-1.5-flash-exp-0827">Gemini 1.5 Flash ExperimentExperimental 2024-08-27</option>
30483046 <option value="gemini-1.5-flash-8b-exp-0827">Gemini 1.5 Flash 8B ExperimentExperimental 2024-08-27</option>
30493047 <option value="gemini-1.5-flash-8b-exp-0924">Gemini 1.5 Flash 8B ExperimentExperimental 2024-09-24</option>
30503048 <option value="gemini-1.5-flash-latest">Gemini 1.5 Flash [latest]</option>
30513049 <option value="gemini-1.5-flash-001">Gemini 1.5 Flash [001]</option>
30523050 <option value="gemini-1.5-flash-002">Gemini 1.5 Flash [002]</option>
30533051 <option value="gemini-1.0-pro-latest">Gemini 1.0 Pro [latest] (Deprecated)</option>
30543052 <option value="gemini-1.0-pro-001">Gemini 1.0 Pro (Tuning) [001] (Deprecated)</option>
3055- <option value="gemini-1.0-pro-vision-latest">Gemini 1.0 Pro Vision [latest]</option>
30563053 </optgroup>
30573054 </select>
30583055 </div>
@@ -3220,16 +3217,17 @@
32203217 <h4 data-i18n="Cohere Model">Cohere Model</h4>
32213218 <select id="model_cohere_select">
32223219 <optgroup label="Stable">
3223- <option value="c4ai-aya-expanse-32b">c4ai-aya-expanse-32b</option>
3224- <option value="c4ai-aya-expanse-8b">c4ai-aya-expanse-8b</option>
3225- <option value="c4ai-aya-23-35b">c4ai-aya-23-35b</option>
32263220 <option value="c4ai-aya-23-8b">c4ai-aya-23-8b</option>
3221+ <option value="c4ai-aya-23">c4ai-aya-23</option>
3222+ <option value="c4ai-aya-expanse-8b">c4ai-aya-expanse-8b</option>
3223+ <option value="c4ai-aya-expanse-32b">c4ai-aya-expanse-32b</option>
32273224 <option value="command-light">command-light</option>
32283225 <option value="command">command</option>
32293226 <option value="command-r">command-r</option>
32303227 <option value="command-r-plus">command-r-plus</option>
32313228 <option value="command-r-08-2024">command-r-08-2024</option>
32323229 <option value="command-r-plus-08-2024">command-r-plus-08-2024</option>
3230+ <option value="command-r7b-12-2024">command-r7b-12-2024</option>
32333231 </optgroup>
32343232 <optgroup label="Nightly">
32353233 <option value="command-light-nightly">command-light-nightly</option>
public/lib.js+3 -0
@@ -19,6 +19,7 @@ import seedrandom from 'seedrandom';
1919import * as Popper from '@popperjs/core';
2020import droll from 'droll';
2121import morphdom from 'morphdom';
22+import { toggle as slideToggle } from 'slidetoggle';
2223
2324/**
2425 * Expose the libraries to the 'window' object.
@@ -94,6 +95,7 @@ export default {
9495 Popper,
9596 droll,
9697 morphdom,
98+ slideToggle,
9799};
98100
99101export {
@@ -115,4 +117,5 @@ export {
115117 Popper,
116118 droll,
117119 morphdom,
120+ slideToggle,
118121};
public/locales/ja-jp.json+6 -1
@@ -1274,6 +1274,8 @@
12741274 "sd_Raw_Last_Message": "生の最後のメッセージ",
12751275 "sd_Background": "背景",
12761276 "Image Generation": "画像生成",
1277+ "Stop Image Generation": "画像生成を停止",
1278+ "Generate Caption": "画像説明を生成",
12771279 "sd_refine_mode": "プロンプトを生成 API に送信する前に手動で編集できるようにする",
12781280 "sd_refine_mode_txt": "生成前にプロンプ​​トを編集する",
12791281 "sd_interactive_mode": "「猫の写真を送ってください」のようなメッセージを送信するときに、画像を自動的に生成します。",
@@ -1439,5 +1441,8 @@
14391441 "Still have questions?": "まだ質問がありますか?",
14401442 "Join the SillyTavern Discord": "SillyTavernのDiscordに参加",
14411443 "Post a GitHub issue": "GitHubの問題を投稿",
14421444 "Contact the developers": "開発者に連絡",
1445+ "Stop Inspecting": "検査を停止",
1446+ "Inspect Prompts": "プロンプトを検査",
1447+ "Toggle prompt inspection": "プロンプト検査の切り替え"
14431448}
public/locales/zh-cn.json+6 -1
@@ -1241,6 +1241,7 @@
12411241 "Enter web URLs to scrape (one per line):": "输入要抓取的网址(每行一个):",
12421242 "Enter a video URL to download its transcript.": "输入视频 URL 或 ID 即可下载其文本。",
12431243 "Image Captioning": "图像描述",
1244+ "Generate Caption": "生成图片说明",
12441245 "Source": "来源",
12451246 "Local": "本地",
12461247 "Multimodal (OpenAI / Anthropic / llama / Google)": "多模式(OpenAI / Anthropic / llama / Google)",
@@ -1430,6 +1431,7 @@
14301431 "sd_Raw_Last_Message": "原始最后一条消息",
14311432 "sd_Background": "背景",
14321433 "Image Generation": "图像生成",
1434+ "Stop Image Generation": "中止图像生成",
14331435 "sd_refine_mode": "允许在将提示词发送到生成 API 之前手动编辑提示词",
14341436 "sd_refine_mode_txt": "生成之前编辑提示词",
14351437 "sd_interactive_mode": "发送消息时自动生成图像,例如“给我发一张猫的照片”。",
@@ -1861,5 +1863,8 @@
18611863 "Still have questions?": "仍有疑问?",
18621864 "Join the SillyTavern Discord": "加入SillyTavern Discord",
18631865 "Post a GitHub issue": "发布GitHub问题",
18641866 "Contact the developers": "联系开发人员",
1867+ "Stop Inspecting": "停止检查",
1868+ "Inspect Prompts": "检查提示词",
1869+ "Toggle prompt inspection": "切换提示词检查"
18651870}
public/locales/zh-tw.json+127 -122
@@ -65,20 +65,20 @@
6565 "Min P": "Min P",
6666 "Top A": "Top A",
6767 "Quick Prompts Edit": "快速提示詞編輯",
6868 "Main": "主要主要提示詞",
6969 "NSFW": "NSFW",
7070 "Jailbreak": "越獄",
7171 "Utility Prompts": "實用提示詞",
7272 "Impersonation prompt": "AI 扮演提示詞",
7373 "Restore default prompt": "還原預設提示詞",
7474 "Prompt that is used for Impersonation function": "用於 AI 模仿功能的提示詞",
7575 "World Info Format Template": "世界資訊格式範本世界資訊格式",
7676 "Restore default format": "還原預設格式",
7777 "Wraps activated World Info entries before inserting into the prompt.": "在插入提示詞前包裝已啟用的世界資訊條目。",
7878 "scenario_format_template_part_1": "使用",
7979 "scenario_format_template_part_2": "來標示要插入內容的位置。",
8080 "Scenario Format Template": "情境格式範本情境格式",
8181 "Personality Format Template": "個性格式範本個性格式",
8282 "Group Nudge Prompt Template": "群組推動提示詞範本",
8383 "Sent at the end of the group chat history to force reply from a specific character.": "在群組聊天歷史結束時發送以強制特定角色回覆",
8484 "New Chat": "新聊天",
@@ -412,7 +412,7 @@
412412 "Chat Start": "聊天開始符號",
413413 "Add Chat Start and Example Separator to a list of stopping strings.": "將聊天開始和範例分隔符號加入終止字串中。",
414414 "Use as Stop Strings": "用作停止字串",
415415 "context_allow_jailbreak": "如果在角色卡中定義了越獄,且啟用了「偏好角色卡越獄角色卡越獄優先」,則會在提示詞的結尾加入越獄內容。\n這不建議用於文字完成模型,因為可能導致不良的輸出結果。",
416416 "Allow Jailbreak": "允許越獄",
417417 "Context Order": "上下文順序",
418418 "Summary": "摘要",
@@ -631,9 +631,9 @@
631631 "Use fuzzy matching, and search characters in the list by all data fields, not just by a name substring": "使用模糊配對,並通過所有資料欄位在列表中搜尋角色,而不僅僅是通過名稱子字串。",
632632 "Advanced Character Search": "進階角色搜尋",
633633 "If checked and the character card contains a prompt override (System Prompt), use that instead": "如果選中並且角色卡包含提示詞覆寫(系統提示詞),則使用該提示詞。",
634634 "Prefer Character Card Prompt": "偏好角色卡主要提示詞角色卡主要提示詞優先",
635635 "If checked and the character card contains a jailbreak override (Post History Instruction), use that instead": "如果選中並且角色卡包含越獄覆寫(聊天歷史後指示),則使用該提示詞。",
636636 "Prefer Character Card Jailbreak": "偏好角色卡越獄角色卡越獄優先",
637637 "Avoid cropping and resizing imported character images. When off, crop/resize to 512x768": "避免裁剪和調整匯入的角色圖像大小。未勾選時將會裁剪/調整大小到 512x768。",
638638 "Never resize avatars": "永不調整頭像大小",
639639 "Show actual file names on the disk, in the characters list display only": "僅在角色列表顯示實際檔案名稱。",
@@ -1018,7 +1018,7 @@
10181018 "Injection depth. 0 = after the last message, 1 = before the last message, etc.": "注入深度。0 = 在最後一則訊息之後,1 = 在最後一則訊息之前,以此類推。",
10191019 "Prompt": "提示詞",
10201020 "The prompt to be sent.": "要發送的提示詞。",
10211021 "This prompt cannot be overridden by character cards, even if overrides are preferred.": "即使啟用偏好覆寫即使啟用優先覆寫,此提示詞也不能被角色卡片覆寫。",
10221022 "prompt_manager_forbid_overrides": "禁止覆寫",
10231023 "reset": "重設",
10241024 "save": "節省",
@@ -1026,6 +1026,7 @@
10261026 "Message Actions": "訊息動作",
10271027 "Translate message": "翻譯訊息",
10281028 "Generate Image": "生成圖片",
1029+ "Stop Image Generation": "終止圖片生成",
10291030 "Narrate": "敘述",
10301031 "Exclude message from prompts": "從提示詞中排除訊息",
10311032 "Include message in prompts": "在提示詞中包含訊息",
@@ -1343,12 +1344,12 @@
13431344 "sd_prompt_prefix_placeholder": "使用 {prompt} 指定生成的提示詞將被插入的位置。",
13441345 "Negative common prompt prefix": "負面通用提示詞前綴",
13451346 "Character-specific prompt prefix": "角色特定提示詞前綴",
13461347 "Won't be used in groups.": "不會用在群組群聊中無效",
13471348 "sd_character_prompt_placeholder": "描述該選擇角色的特徵。這些特徵將增加在通用提示詞前綴之後。\n例如:女性、綠色眼睛、棕色頭髮、粉紅色襯衫。",
13481349 "Character-specific negative prompt prefix": "角色特定負面提示詞前綴",
13491350 "sd_character_negative_prompt_placeholder": "不應出現在選定角色上的任何特徵。這些特徵將增加在負面通用提示詞前綴之後。例如:珠寶、鞋子、眼鏡。",
13501351 "Shareable": "可分享",
13511352 "Image Prompt Templates": "圖片提示詞範本AI 算圖提示詞範本",
13521353 "Vectors Model Warning": "向量模型警告",
13531354 "Translate files into English before processing": "處理前將檔案翻譯成英文",
13541355 "Manager Users": "管理使用者",
@@ -1446,107 +1447,107 @@
14461447 "(-1 for random)": "(-1 表示隨機)",
14471448 "(Optional)": "(可選)",
14481449 "(use _space": "(使用",
14491450 "[no_connection_text]api_no_connection": "未連線⋯",
14501451 "[no_desc_text]No model description": "[無描述]",
14511452 "[no_items_text]openai_logit_bias_no_items": "無項目",
14521453 "[placeholder]Any contents here will replace the default Post-History Instructions used for this character. (v2 specpost_history_instructions)": "此處填入的內容將取代該角色的默認聊天歷史後指示(Post-History Instructions)。\n(v2 specpost_history_instructions)",
14531454 "[placeholder]comma delimited,no spaces between": "逗號分割,無需空格",
14541455 "[placeholder]e.g. black-forest-labs/FLUX.1-dev": "例如:black-forest-labs/FLUX.1-dev",
14551456 "[placeholder]Example: gpt-3.5-turbo": "例如:gpt-3.5-turbo",
14561457 "[placeholder]Example: http://localhost:1234/v1": "例如:http://localhost:1234/v1",
14571458 "[popup-button-crop]popup-button-crop": "裁剪",
14581459 "[title](disabled when max recursion steps are used)": "(當最大遞歸步驟數使用時將停用)",
14591460 "[title]0 = unlimited, 1 = scans once and doesn't recurse, 2 = scans once and recurses once, etc\n(disabled when min activations are used)": "0 = 無限制,1 = 掃描一次且不遞歸,2 = 掃描一次並遞歸一次,以此類推\n(使用最小啟動設定時將停用)",
14601461 "[title]A greedy, brute-force algorithm used in LLM sampling to find the most likely sequence of words or tokens. It expands multiple candidate sequences at once, maintaining a fixed number (beam width) of top sequences at each step.": "一種用於 LLM 抽樣的貪婪演算法,用於尋找最可能的單詞或標記序列。該方法會同時展開多個候選序列,並在每一步中保持固定數量的頂級序列(beam width)。",
14611462 "[title]A multiplicative factor to expand the overall area that the nodes take up.": "節點佔用區域擴展的倍數。",
14621463 "[title]Abort current image generation task": "終止目前的圖片生成任務",
14631464 "[title]Add Character and User names to a list of stopping strings.": "將角色和使用者角色名稱添加至停止字符列表。",
14641465 "[title]Alignment for rank nodes.": "對排名節點的對齊方式。",
14651466 "[title]Always show the node full info panel at the bottom left of the timeline view. When off, show it near the node.": "始終將節點的完整資訊面板顯示在時間軸視圖的左下角。關閉時,將顯示在節點附近。",
14661467 "[title]Always show the node tooltip at the bottom left of the timeline view. When off, show it near the node.": "始終將節點的工具提示欄顯示在時間軸視圖的左下角。關閉時,將顯示在節點附近。",
14671468 "[title]Apply current sorting as Order": "應用此排序為順序",
14681469 "[title]Cap the number of entry activation recursions": "限制入口啟動的遞歸次數",
14691470 "[title]Caption": "標題",
14701471 "[title]Close popup": "關閉彈出視窗",
14711472 "[title]Color configuration for Timelines when 'Use UI Theme' in Style Settings is off.": "關閉「使用介面主題」的時間線顏色。",
14721473 "[title]context_allow_post_history_instructions": "在文本完成模式中包含聊天歷史後指示(Post-History Instructions),但可能導致不良輸出。",
14731474 "[title]Create a new connection profile": "建立新的連線設定檔",
14741475 "[title]Defines on importing cards which action should be chosen for importing its listed tags. 'Ask' will always display the dialog.": "定義導入卡片時應採取的動作。選擇「詢問」將始終顯示對話框。",
14751476 "[title]delay_until_recursion_level": "定義遞迴掃描的延遲層級。\r最初僅匹配第一層(數字最小的層級)。\r未找到匹配時,下一層將成為可匹配的層級。\r此過程會重複,直到所有層級都被檢查完畢。\r與「延遲至遞歸」設定相關聯。",
14761477 "[title]Delete a connection profile": "刪除連線設定檔",
14771478 "[title]Delete template": "刪除模板",
14781479 "[title]Delete the template": "刪除此模板",
14791480 "[title]Disabling is not recommended.": "不建議禁用。",
14801481 "[title]Display swipe numbers for all messages, not just the last.": "顯示所有訊息的滑動編號,而不僅是最後一條訊息。",
14811482 "[title]Duplicate persona": "複製使用者角色",
14821483 "[title]Edit a connection profile": "編輯連線設定檔",
14831484 "[title]Enable auto-select of input text in some text fields when clicking/selecting them. Applies to popup input textboxes, and possible other custom input fields.": "啟用自動選擇輸入框中的文本,適用於彈出輸入框及其他自定義輸入框。",
14841485 "[title]Entries with a cooldown can't be activated N messages after being triggered.": "設有冷卻時間的條目於觸發後的 N 條訊息內無法再次啟用。",
14851486 "[title]Entries with a delay can't be activated until there are N messages present in the chat.": "有延遲的條目需等待聊天中出現 N 條訊息後才能啟用。",
14861487 "[title]Expand swipe nodes when the timeline view first opens, and whenever the graph is refreshed. When off, you can expand them by long-pressing a node, or by pressing the Toggle Swipes button.": "時間線視圖首次打開或刷新時展開滑動節點。關閉時可通過長按節點或點選「切換滑動」按鈕展開。",
14871488 "[title]Export Advanced Formatting settings": "匯出高級格式設定",
14881489 "[title]Export template": "匯出模板",
14891490 "[title]Find similar characters": "尋找相似角色",
14901491 "[title]Height of a node, in pixels at zoom level 1.0.": "縮放等級為 1.0 時的節點像素高度。",
14911492 "[title]How the automatic graph builder assigns a rank (layout depth) to graph nodes.": "自動圖表生成器分配圖節點等級(佈局深度)的方式。",
14921493 "[title]If checked and the character card contains a Post-History Instructions override, use that instead": "勾選後,將使用角色卡中的聊天歷史後指示(Post-History Instructions)覆蓋。",
14931494 "[title]Import Advanced Formatting settings": "匯入進階格式設定\n\n您也可以提供舊版檔案作為提示詞和上下文範本使用。",
14941495 "[title]Import template": "匯入模板",
14951496 "[title]In group chat, highlight the character(s) that are currently queued to generate responses and the order in which they will respond.": "在群組聊天中,突出顯示該生成回應的角色及順序。",
14961497 "[title]Include names with each message into the context for scanning": "將每條訊息的名稱納入掃描上下文",
14971498 "[title]Inserted before the first User's message": "插入到第一條使用者訊息前。",
14981499 "[title]instruct_enabled": "啟用指令模式(Instruct Mode)",
14991500 "[title]instruct_last_input_sequence": "插入到最後一條使用者訊息之前。",
15001501 "[title]instruct_template_activation_regex_desc": "連接 API 或選擇模型時,若模型名稱符合所提供的正規表達式,則自動啟動該指令模板(Instruct Template)。",
15011502 "[title]Load Asset List": "載入資源列表",
15021503 "[title]load_asset_list_desc": "根據資源列表文件載入擴展及資源。\n\n該字段中的默認資源 URL 指向官方的擴展及資源的列表。\n可在此插入您的自定義資源列表。\n\n若需安裝單個第三方擴展,請使用右上角的「安裝擴展」按鈕。",
15031504 "[title]markdown_hotkeys_desc": "啟用熱鍵以在某些文本輸入框中插入 Markdown 格式字符。詳見「/help hotkeys」。",
15041505 "[title]Not all samplers supported.": "並非所有採樣器均受支援。",
15051506 "[title]Open the timeline view. Same as the slash command '/tl'.": "打開時間線視圖,與斜杠指令「/tl」相同。",
15061507 "[title]Penalize sequences based on their length.": "根據序列長度進行懲罰。",
15071508 "[title]Reload a connection profile": "重新載入連線設定檔",
15081509 "[title]Rename current preset": "重新命名此預設",
15091510 "[title]Rename current prompt": "重新命名此提示詞",
15101511 "[title]Rename current template": "重新密名此模板",
15111512 "[title]Reset all Timelines settings to their default values.": "將所有時間軸設定重置為預設值。",
15121513 "[title]Restore current prompt": "還原目前的提示詞",
15131514 "[title]Restore current template": "還原目前的模板",
15141515 "[title]Save prompt as": "另存提示詞為",
15151516 "[title]Save template as": "另存模板為",
15161517 "[title]sd_adetailer_face": "在生成過程中使用 ADetailer 臉部模型。需在後端安裝 ADetailer 擴展。",
15171518 "[title]sd_free_extend": "自動使用目前選定的 LLM 擴展自由模式主題提示詞(不包括肖像或背景)。",
15181519 "[title]sd_function_tool": "使用功能工具自動檢測意圖以生成圖片。",
15191520 "[title]Seed_desc": "用於生成確定性和可重現輸出的隨機種子。設定為 -1 時將使用隨機種子。",
15201521 "[title]Select your current Context Template": "選擇您目前的上下文模板",
15211522 "[title]Select your current Instruct Template": "選擇您目前的指令模板",
15221523 "[title]Select your current System Prompt": "選擇您目前的系統提示詞",
15231524 "[title]Separation between adjacent edges in the same rank.": "同一層級中相鄰邊之間的間距。",
15241525 "[title]Separation between adjacent nodes in the same rank.": "同一層級中相鄰節點之間的間距。",
15251526 "[title]Separation between each rank in the layout.": "佈局中各層級之間的間距。",
15261527 "[title]Settings for the visual appearance of the Timelines graph.": "時間線圖形的視覺外觀設置。",
15271528 "[title]Show a button in the input area to ask the AI to impersonate your character for a single message": "在輸入框中添加按鈕,讓 AI 模仿您的角色身份發送一則訊息。",
15281529 "[title]Show a legend for colors corresponding to different characters and chat checkpoints.": "顯示一個圖例,標註不同角色和對話檢查點對應的顏色。",
15291530 "[title]Show the AI character's avatar as the graph root node. When off, the root node is blank.": "將 AI 角色的頭像作為圖形的根節點;關閉時,根節點為空。",
15301531 "[title]Sticky entries will stay active for N messages after being triggered.": "觸發後,置頂條目將在接下來的 N 條訊息中保持活躍。",
15311532 "[title]stscript_parser_flag_replace_getvar_label": "防止 {{getvar::}} 和 {{getglobalvar::}} 巨集的字面巨集樣值被自動解析。\n例如,{{newline}} 將保持為字面字串 {{newline}}。\n\n(此功能通過內部將 {{getvar::}} 和 {{getglobalvar::}} 巨集替換為具範圍的變數來實現。)",
15321533 "[title]Style and routing of graph edges.": "圖形邊的樣式和路徑。",
15331534 "[title]Swap width and height": "交換寬度與高度",
15341535 "[title]Swipe left": "向左滑動",
15351536 "[title]Swipe right": "向右滑動",
15361537 "[title]Switch the Character/Tags filter around to exclude the listed characters and tags from matching for this entry": "切換角色/標籤篩選,將列出的角色和標籤從此條目的匹配中排除",
15371538 "[title]sysprompt_enabled": "啟用系統提示詞",
15381539 "[title]The number of sequences generated at each step with Beam Search.": "在 Beam Search 中每一步生成的序列數量。",
15391540 "[title]The visual appearance of a node in the graph.": "圖形中節點的視覺外觀。",
15401541 "[title]Update a connection profile": "更新連線設定檔",
15411542 "[title]Update current prompt": "更新此提示詞",
15421543 "[title]Update current template": "更新此模板",
15431544 "[title]Use GPU acceleration for positioning the full info panel that appears when you click a node. If the tooltip arrow tends to disappear, turning this off may help.": "啟用 GPU 加速來定位點擊節點時出現的完整資訊面板。若發現工具提示箭頭經常消失,可考慮關閉此功能。",
15441545 "[title]Use the colors of the ST GUI theme, instead of the colors configured in Color Settings specifically for this extension.": "以 ST GUI 主題的顏色,取代「顏色設定」中針對此擴展特別配置的顏色。",
15451546 "[title]View connection profile details": "查看連線設定檔詳情",
15461547 "[title]When enabled, nodes that have swipes splitting off of them will appear subtly larger, in addition to having the double border.": "啟用後,具分支滑動的節點將顯示雙重邊框,還會略微放大。",
15471548 "[title]WI Entry Status:🔵 Constant🟢 Normal🔗 Vectorized": "世界資訊條目狀態:\\r🔵 恆定\\r🟢 正常\\r🔗 向量化",
15481549 "[title]Width of a node, in pixels at zoom level 1.0.": "縮放等級為 1.0 時,節點的像素寬度。",
15491550 "[title]world_button_title": "角色背景設定\\n\\n點擊以載入\\nShift+ 點擊開啟「連結至世界資訊」彈窗",
15501551 "# of Beams": "# of Beams",
15511552 "01.AI API Key": "01.AI API 金鑰",
15521553 "01.AI Model": "01.AI 模型",
@@ -1573,8 +1574,8 @@
15731574 "at the end of the URL!": "在 URL 末尾!",
15741575 "Audio Playback Speed": "音檔播放速度",
15751576 "Auto-select Input Text": "自動選擇輸入文本",
15761577 "Automatically caption images": "自動為圖片添加字幕自動為圖片添加註解",
15771578 "Auxiliary": "輔助輔助提示詞",
15781579 "Background Image": "背景圖片",
15791580 "Block Entropy API Key": "Block Entropy API 金鑰",
15801581 "Can be set manually or with an _space": "可以手動設置或使用 _space",
@@ -1610,7 +1611,7 @@
16101611 "Delay until recursion (can only be activated on recursive checking)": "遞迴掃描延遲(僅在啟用遞迴掃描時可用)",
16111612 "Do not proceed if you do not agree to this!": "若不同意此條款,請勿繼續!",
16121613 "Edge Color": "邊緣顏色",
16131614 "Edit captions before saving": "在保存前編輯字幕在保存前編輯註解",
16141615 "Enable for files": "為文件啟用",
16151616 "Enable for World Info": "為世界資訊啟用",
16161617 "enable_functions_desc_1": "允許使用",
@@ -1651,6 +1652,7 @@
16511652 "Horde": "Horde",
16521653 "HuggingFace Token": "HuggingFace 符元",
16531654 "Image Captioning": "圖片標註",
1655+ "Generate Caption": "生成圖片說明",
16541656 "Image Type - talkinghead (extras)": "圖片類型 - talkinghead(額外選項)",
16551657 "Injection Position": "插入位置",
16561658 "Injection position. Relative (to other prompts in prompt manager) or In-chat @ Depth.": "插入位置(與提示詞管理器中的其他提示相比)或聊天中的深度位置。",
@@ -1694,7 +1696,7 @@
16941696 "Only used when Main API or WebLLM Extension is selected.": "僅在選擇主要 API 或 WebLLM 擴展時使用。",
16951697 "Open a chat to see the character expressions.": "開啟聊天以查看角色表情。",
16961698 "Post-History Instructions": "聊天歷史後指示",
16971699 "Prefer Character Card Instructions": "偏好角色卡聊天歷史後指示角色卡聊天歷史後指示優先",
16981700 "Prioritize": "優先處理",
16991701 "Prompt Content": "提示詞內容",
17001702 "prompt_manager_in_chat": "聊天中的提示詞管理",
@@ -1734,23 +1736,23 @@
17341736 "Select with Tab or Enter": "按 Tab 或 Enter 選擇",
17351737 "Separators as Stop Strings": "以分隔符作為停止字串",
17361738 "Set the default and fallback expression being used when no matching expression is found.": "設定在無法配對到表情時所使用的預設和替代圖片。",
17371739 "Set your API keys and endpoints in the API Connections tab first.": "請先在「API 連接」頁面中設定您的 API 密鑰和端點金鑰和端點。",
17381740 "Show default images (emojis) if sprite missing": "無對應圖片時,顯示為預設表情符號(emoji)",
17391741 "Show group chat queue": "顯示群組聊天隊列",
17401742 "Size threshold (KB)": "大小閾值(KB)",
17411743 "Slash Command": "斜線命令",
17421744 "space_ slash command.": "斜線命令。",
17431745 "Sprite Folder Override": "表情立繪資料夾覆蓋",
17441746 "Sprite set:": "表情集立繪組:",
17451747 "Show Gallery": "查看畫廊",
17461748 "Sticky": "固定",
17471749 "Style Preset": "預設樣式",
17481750 "Summarize chat messages for vector generation": "摘要聊天訊息以進行向量化處理",
17491751 "Summarize chat messages when sending": "傳送時摘要聊天內容",
17501752 "Swipe # for All Messages": "為所有訊息分配滑動編號 #",
17511753 "System Message Sequences": "系統訊息順序系統訊息序列",
17521754 "System Prefix": "系統訊息前綴",
17531755 "System Prompt Sequences": "系統提示詞順序系統提示詞序列",
17541756 "System Suffix": "系統訊息後綴",
17551757 "Tabby Model": "Tabby 模型",
17561758 "tag_import_all": "全部匯入",
@@ -1767,9 +1769,9 @@
17671769 "Upload sprite pack (ZIP)": "打包上傳立繪(ZIP 格式)",
17681770 "Use a forward slash to specify a subfolder. Example: _space": "使用「/」來設置子目錄,例如:_space",
17691771 "Use ADetailer (Face)": "使用 ADetailer 進行臉部處理。",
17701772 "Use an admin API key.": "使用管理員的 API 密鑰金鑰。",
17711773 "Use global": "啟用全域設定",
17721774 "User Message Sequences": "使用者訊息順序使用者訊息序列",
17731775 "User Node Color": "使用者節點顏色",
17741776 "User Prefix": "使用者訊息前綴",
17751777 "User Suffix": "使用者訊息後綴",
@@ -1787,5 +1789,8 @@
17871789 "Will be used if the API doesnt support JSON schemas or function calling.": "若 API 不支持 JSON 模式或函數調用,將使用此設定。",
17881790 "World Info settings": "世界資訊設定",
17891791 "You are in offline mode. Click on the image below to set the expression.": "您目前為離線狀態,請點擊下方圖片進行表情設定。",
17901792 "You can find your API key in the Stability AI dashboard.": "API 金鑰可在 Stability AI 儀表板中查看。",
1793+ "Stop Inspecting": "停止檢查",
1794+ "Inspect Prompts": "檢查提示詞",
1795+ "Toggle prompt inspection": "切換提示詞檢查"
17911796}
public/script.js+121 -78
@@ -10,6 +10,7 @@ import {
1010 SVGInject,
1111 Popper,
1212 initLibraryShims,
13+ slideToggle,
1314 default as libs,
1415} from './lib.js';
1516
@@ -549,6 +550,7 @@ let optionsPopper = Popper.createPopper(document.getElementById('options_button'
549550let exportPopper = Popper.createPopper(document.getElementById('export_button'), document.getElementById('export_format_popup'), {
550551 placement: 'left',
551552});
553+let isExportPopupOpen = false;
552554
553555// Saved here for performance reasons
554556const messageTemplate = $('#message_template .mes');
@@ -895,6 +897,13 @@ export function getRequestHeaders() {
895897 };
896898}
897899
900+export function getSlideToggleOptions() {
901+ return {
902+ miliseconds: animation_duration * 1.5,
903+ transitionFunction: animation_duration > 0 ? 'ease-in-out' : 'step-start',
904+ };
905+}
906+
898907$.ajaxPrefilter((options, originalOptions, xhr) => {
899908 xhr.setRequestHeader('X-CSRF-Token', token);
900909});
@@ -1173,7 +1182,7 @@ async function getStatusTextgen() {
11731182 return resultCheckStatus();
11741183 }
11751184
11761185 if (textgen_settings[textgen_types.type ==GENERIC, textgen_types.OOBA].includes(textgen_settings.type) && textgen_settings.bypass_status_check) {
11771186 setOnlineStatus('Status check bypassed');
11781187 return resultCheckStatus();
11791188 }
@@ -1223,7 +1232,7 @@ async function getStatusTextgen() {
12231232 setOnlineStatus(textgen_settings.tabby_model || data?.result);
12241233 } else if (textgen_settings.type === textgen_types.GENERIC) {
12251234 loadGenericModels(data?.data);
12261235 setOnlineStatus(textgen_settings.generic_model || data?.result || 'Connected');
12271236 } else {
12281237 setOnlineStatus(data?.result);
12291238 }
@@ -4579,9 +4588,12 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
45794588 const shouldDeleteMessage = type !== 'swipe' && ['', '...'].includes(lastMessage?.mes) && ['', '...'].includes(streamingProcessor?.result);
45804589 hasToolCalls && shouldDeleteMessage && await deleteLastMessage();
45814590 const invocationResult = await ToolManager.invokeFunctionTools(streamingProcessor.toolCalls);
4591+ const shouldStopGeneration = (!invocationResult.invocations.length && shouldDeleteMessage) || invocationResult.stealthCalls.length;
45824592 if (hasToolCalls) {
45834593 if (!invocationResult.invocations.length && shouldDeleteMessageshouldStopGeneration) {
4594+ if (Array.isArray(invocationResult.errors) && invocationResult.errors.length) {
45844595 ToolManager.showToolCallError(invocationResult.errors);
4596+ }
45854597 unblockGeneration(type);
45864598 generatedPromptCache = '';
45874599 streamingProcessor = null;
@@ -4681,9 +4693,12 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
46814693 const shouldDeleteMessage = type !== 'swipe' && ['', '...'].includes(getMessage);
46824694 hasToolCalls && shouldDeleteMessage && await deleteLastMessage();
46834695 const invocationResult = await ToolManager.invokeFunctionTools(data);
4696+ const shouldStopGeneration = (!invocationResult.invocations.length && shouldDeleteMessage) || invocationResult.stealthCalls.length;
46844697 if (hasToolCalls) {
46854698 if (!invocationResult.invocations.length && shouldDeleteMessageshouldStopGeneration) {
4699+ if (Array.isArray(invocationResult.errors) && invocationResult.errors.length) {
46864700 ToolManager.showToolCallError(invocationResult.errors);
4701+ }
46874702 unblockGeneration(type);
46884703 generatedPromptCache = '';
46894704 return;
@@ -9203,40 +9218,48 @@ function doDrawerOpenClick() {
92039218 * @returns {void}
92049219 */
92059220function doNavbarIconClick() {
92069221 varconst icon = $(this).find('.drawer-icon');
92079222 varconst drawer = $(this).parent().find('.drawer-content');
92089223 if (drawer.hasClass('resizing')) { return; }
92099224 varconst drawerWasOpenAlready = $(this).parent().find('.drawer-content').hasClass('openDrawer');
92109225 letconst targetDrawerID = $(this).parent().find('.drawer-content').attr('id');
92119226 const pinnedDrawerClicked = drawer.hasClass('pinnedOpen');
92129227
92139228 if (!drawerWasOpenAlready) { //to open the drawer
92149229 $('.openDrawer').not('.pinnedOpen').addClass('resizing').slideToggleeach(200, 'swing'(_, async function (el) => {
9215- await delay(50); $(this).closest('.drawer-content').removeClass('resizing');
9230+ slideToggle(el, {
9231+ ...getSlideToggleOptions(),
9232+ onAnimationEnd: function (el) {
9233+ el.closest('.drawer-content').classList.remove('resizing');
9234+ },
9235+ });
92169236 });
92179237 $('.openIcon').not('.drawerPinnedOpen').toggleClass('closedIcon openIcon');
92189238 $('.openDrawer').not('.pinnedOpen').toggleClass('closedDrawer openDrawer');
92199239 icon.toggleClass('openIcon closedIcon');
92209240 drawer.toggleClass('openDrawer closedDrawer');
92219241
92229242 //console.log(targetDrawerID);
92239243 if (targetDrawerID === 'right-nav-panel') {
92249244 $(this).closest('.drawer').find('.drawer-content').addClass('resizing').slideToggleeach((_, el) => {
9225- duration: 200,
9245+ slideToggle(el, {
9226- easing: 'swing',
9246+ ...getSlideToggleOptions(),
9227- start: function () {
9247+ elementDisplayStyle: 'flex',
9228- jQuery(this).css('display', 'flex'); //flex needed to make charlist scroll
9248+ onAnimationEnd: function (el) {
9229- },
9249+ el.closest('.drawer-content').classList.remove('resizing');
9230- complete: async function () {
92319250 favsToHotswap();
9232- await delay(50);
9233- $(this).closest('.drawer-content').removeClass('resizing');
92349251 $('#rm_print_characters_block').trigger('scroll');
92359252 },
92369253 });
9254+ });
92379255 } else {
92389256 $(this).closest('.drawer').find('.drawer-content').addClass('resizing').slideToggleeach(200, 'swing'(_, async function (el) => {
9239- await delay(50); $(this).closest('.drawer-content').removeClass('resizing');
9257+ slideToggle(el, {
9258+ ...getSlideToggleOptions(),
9259+ onAnimationEnd: function (el) {
9260+ el.closest('.drawer-content').classList.remove('resizing');
9261+ },
9262+ });
92409263 });
92419264 }
92429265
@@ -9252,13 +9275,23 @@ function doNavbarIconClick() {
92529275 icon.toggleClass('closedIcon openIcon');
92539276
92549277 if (pinnedDrawerClicked) {
92559278 $(drawer).addClass('resizing').slideToggleeach(200, 'swing'(_, async function (el) => {
9256- await delay(50); $(this).removeClass('resizing');
9279+ slideToggle(el, {
9280+ ...getSlideToggleOptions(),
9281+ onAnimationEnd: function (el) {
9282+ el.classList.remove('resizing');
9283+ },
9284+ });
92579285 });
92589286 }
92599287 else {
92609288 $('.openDrawer').not('.pinnedOpen').addClass('resizing').slideToggleeach(200, 'swing'(_, async function (el) => {
9261- await delay(50); $(this).closest('.drawer-content').removeClass('resizing');
9289+ slideToggle(el, {
9290+ ...getSlideToggleOptions(),
9291+ onAnimationEnd: function (el) {
9292+ el.closest('.drawer-content').classList.remove('resizing');
9293+ },
9294+ });
92629295 });
92639296 }
92649297
@@ -10080,20 +10113,21 @@ jQuery(async function () {
1008010113 await getStatusNovel();
1008110114 });
1008210115
1008310116 varconst button = $('#options_button');
1008410117 varconst menu = $('#options');
10118+ let isOptionsMenuVisible = false;
1008510119
1008610120 function showMenu() {
1008710121 showBookmarksButtons();
10088- // menu.stop()
1008910122 menu.fadeIn(animation_duration);
1009010123 optionsPopper.update();
10124+ isOptionsMenuVisible = true;
1009110125 }
1009210126
1009310127 function hideMenu() {
10094- // menu.stop();
1009510128 menu.fadeOut(animation_duration);
1009610129 optionsPopper.update();
10130+ isOptionsMenuVisible = false;
1009710131 }
1009810132
1009910133 function isMouseOverButtonOrMenu() {
@@ -10101,26 +10135,15 @@ jQuery(async function () {
1010110135 }
1010210136
1010310137 button.on('click', function () {
1010410138 if (menu.is(':visible')isOptionsMenuVisible) {
1010510139 hideMenu();
1010610140 } else {
1010710141 showMenu();
1010810142 }
1010910143 });
10110- button.on('blur', function () {
10111- //delay to prevent menu hiding when mouse leaves button into menu
10112- setTimeout(() => {
10113- if (!isMouseOverButtonOrMenu()) { hideMenu(); }
10114- }, 100);
10115- });
10116- menu.on('blur', function () {
10117- //delay to prevent menu hide when mouseleaves menu into button
10118- setTimeout(() => {
10119- if (!isMouseOverButtonOrMenu()) { hideMenu(); }
10120- }, 100);
10121- });
1012210144 $(document).on('click', function () {
10123- if (!isMouseOverButtonOrMenu() && menu.is(':visible')) { hideMenu(); }
10145+ if (!isOptionsMenuVisible) return;
10146+ if (!isMouseOverButtonOrMenu()) { hideMenu(); }
1012410147 });
1012510148
1012610149 /* $('#set_chat_scenario').on('click', setScenarioOverride); */
@@ -10516,22 +10539,28 @@ jQuery(async function () {
1051610539 });
1051710540
1051810541 $(document).on('click', '.extraMesButtonsHint', function (e) {
1051910542 const elmnt$hint = $(e.target);
10520- $(elmnt).transition({
10543+ const $buttons = $hint.siblings('.extraMesButtons');
10544+
10545+ $hint.transition({
1052110546 opacity: 0,
1052210547 duration: animation_duration,
1052310548 easing: 'ease-in-out'animation_easing,
10524- });
10549+ complete: function () {
10525- setTimeout(function () {
10550+ $hint.hide();
10526- $(elmnt).hide();
10551+ $buttons
10527- $(elmnt).siblings('.extraMesButtons').css('opcacity', '0');
10552+ .addClass('visible')
10528- $(elmnt).siblings('.extraMesButtons').css('display', 'flex');
10553+ .css({
10529- $(elmnt).siblings('.extraMesButtons').transition({
10554+ opacity: 0,
10555+ display: 'flex',
10556+ })
10557+ .transition({
1053010558 opacity: 1,
1053110559 duration: animation_duration,
10532- easing: 'ease-in-out',
10560+ easing: animation_easing,
10561+ });
10562+ },
1053310563 });
10534- }, animation_duration);
1053510564 });
1053610565
1053710566 $(document).on('click', function (e) {
@@ -10542,19 +10571,32 @@ jQuery(async function () {
1054210571
1054310572 // Check if the click was outside the relevant elements
1054410573 if (!$(e.target).closest('.extraMesButtons, .extraMesButtonsHint').length) {
10574+ const $visibleButtons = $('.extraMesButtons.visible');
10575+
10576+ if (!$visibleButtons.length) {
10577+ return;
10578+ }
10579+
10580+ const $hiddenHints = $('.extraMesButtonsHint:hidden');
10581+
1054510582 // Transition out the .extraMesButtons first
1054610583 $('.extraMesButtons:visible')visibleButtons.transition({
1054710584 opacity: 0,
1054810585 duration: animation_duration,
1054910586 easing: 'ease-in-out'animation_easing,
1055010587 complete: function () {
1055110588 $(this).hide(); // Hide the .extraMesButtons after the transition
10589+ $(this)
10590+ .hide()
10591+ .removeClass('visible');
1055210592
1055310593 // Transition the .extraMesButtonsHint back in
10554- $('.extraMesButtonsHint:not(:visible)').show().transition({
10594+ $hiddenHints
10555- opacity: .3,
10595+ .show()
10596+ .transition({
10597+ opacity: 0.3,
1055610598 duration: animation_duration,
10557- easing: 'ease-in-out',
10599+ easing: animation_easing,
1055810600 complete: function () {
1055910601 $(this).css('opacity', '');
1056010602 },
@@ -10742,8 +10784,9 @@ jQuery(async function () {
1074210784 }
1074310785 });
1074410786
1074510787 $('#export_button').on('click', function (e) {
10746- $('#export_format_popup').toggle();
10788+ isExportPopupOpen = !isExportPopupOpen;
10789+ $('#export_format_popup').toggle(isExportPopupOpen);
1074710790 exportPopper.update();
1074810791 });
1074910792
@@ -10754,6 +10797,10 @@ jQuery(async function () {
1075410797 return;
1075510798 }
1075610799
10800+ $('#export_format_popup').hide();
10801+ isExportPopupOpen = false;
10802+ exportPopper.update();
10803+
1075710804 // Save before exporting
1075810805 await createOrEditCharacter();
1075910806 const body = { format, avatar_url: characters[this_chid].avatar };
@@ -10775,9 +10822,6 @@ jQuery(async function () {
1077510822 URL.revokeObjectURL(a.href);
1077610823 document.body.removeChild(a);
1077710824 }
10778-
10779-
10780- $('#export_format_popup').hide();
1078110825 });
1078210826 //**************************CHAT IMPORT EXPORT*************************//
1078310827 $('#chat_import_button').click(function () {
@@ -10849,15 +10893,18 @@ jQuery(async function () {
1084910893 });
1085010894
1085110895 $(document).on('click', '.drawer-opener', doDrawerOpenClick);
10896+
1085210897 $('.drawer-toggle').on('click', doNavbarIconClick);
1085310898
1085410899 $('html').on('touchstart mousedown', function (e) {
1085510900 var clickTarget = $(e.target);
1085610901
10857- if ($('#export_format_popup').is(':visible')
10902+ if (isExportPopupOpen
1085810903 && clickTarget.closest('#export_button').length == 0
1085910904 && clickTarget.closest('#export_format_popup').length == 0) {
1086010905 $('#export_format_popup').hide();
10906+ isExportPopupOpen = false;
10907+ exportPopper.update();
1086110908 }
1086210909
1086310910 const forbiddenTargets = [
@@ -10882,12 +10929,16 @@ jQuery(async function () {
1088210929 if ($('.openDrawer').length !== 0) {
1088310930 if (targetParentHasOpenDrawer === 0) {
1088410931 //console.log($('.openDrawer').not('.pinnedOpen').length);
1088510932 $('.openDrawer').not('.pinnedOpen').addClass('resizing').slideToggleeach(200, 'swing'(_, function (el) => {
10886- $(this).closest('.drawer-content').removeClass('resizing');
10933+ slideToggle(el, {
10934+ ...getSlideToggleOptions(),
10935+ onAnimationEnd: (el) => {
10936+ el.closest('.drawer-content').classList.remove('resizing');
10937+ },
10938+ });
1088710939 });
1088810940 $('.openIcon').not('.drawerPinnedOpen').toggleClass('closedIcon openIcon');
1088910941 $('.openDrawer').not('.pinnedOpen').toggleClass('closedDrawer openDrawer');
10890-
1089110942 }
1089210943 }
1089310944 }
@@ -11053,14 +11104,6 @@ jQuery(async function () {
1105311104 case 'renameCharButton':
1105411105 renameCharacter();
1105511106 break;
11056- /*case 'dupe_button':
11057- DupeChar();
11058- break;
11059- case 'export_button':
11060- $('#export_format_popup').toggle();
11061- exportPopper.update();
11062- break;
11063- */
1106411107 case 'import_character_info':
1106511108 await importEmbeddedWorldInfo();
1106611109 saveCharacterDebounced();
public/scripts/RossAscends-mods.js+8 -7
@@ -1,4 +1,4 @@
11import { DOMPurify, Bowser, slideToggle } from '../lib.js';
22
33import {
44 characters,
@@ -19,6 +19,7 @@ import {
1919 menu_type,
2020 substituteParams,
2121 sendTextareaMessage,
22+ getSlideToggleOptions,
2223} from '../script.js';
2324
2425import {
@@ -748,8 +749,8 @@ export function initRossMods() {
748749 $(RightNavDrawerIcon).removeClass('drawerPinnedOpen');
749750
750751 if ($(RightNavPanel).hasClass('openDrawer') && $('.openDrawer').length > 1) {
751752 $(RightNavPanel).slideToggle(200RightNavPanel, 'swing'getSlideToggleOptions());
752753 $(RightNavDrawerIcon).toggleClass('openIcon closedIcon openIcon');
753754 $(RightNavPanel).toggleClass('openDrawer closedDrawer');
754755 }
755756 }
@@ -766,8 +767,8 @@ export function initRossMods() {
766767 $(LeftNavDrawerIcon).removeClass('drawerPinnedOpen');
767768
768769 if ($(LeftNavPanel).hasClass('openDrawer') && $('.openDrawer').length > 1) {
769770 $(LeftNavPanel).slideToggle(200LeftNavPanel, 'swing'getSlideToggleOptions());
770771 $(LeftNavDrawerIcon).toggleClass('openIcon closedIcon openIcon');
771772 $(LeftNavPanel).toggleClass('openDrawer closedDrawer');
772773 }
773774 }
@@ -786,8 +787,8 @@ export function initRossMods() {
786787
787788 if ($(WorldInfo).hasClass('openDrawer') && $('.openDrawer').length > 1) {
788789 console.debug('closing WI after lock removal');
789790 $(WorldInfo).slideToggle(200WorldInfo, 'swing'getSlideToggleOptions());
790791 $(WIDrawerIcon).toggleClass('openIcon closedIcon openIcon');
791792 $(WorldInfo).toggleClass('openDrawer closedDrawer');
792793 }
793794 }
public/scripts/extensions.js+8 -4
@@ -417,26 +417,30 @@ async function addExtensionsButtonAndMenu() {
417417
418418 const button = $('#extensionsMenuButton');
419419 const dropdown = $('#extensionsMenu');
420- //dropdown.hide();
420+ let isDropdownVisible = false;
421421
422422 let popper = Popper.createPopper(button.get(0), dropdown.get(0), {
423423 placement: 'top-start',
424424 });
425425
426426 $(button).on('click', function () {
427427 if (dropdown.is(':visible')isDropdownVisible) {
428428 dropdown.fadeOut(animation_duration);
429+ isDropdownVisible = false;
429430 } else {
430431 dropdown.fadeIn(animation_duration);
432+ isDropdownVisible = true;
431433 }
432434 popper.update();
433435 });
434436
435437 $('html').on('click', function (e) {
438+ if (!isDropdownVisible) return;
436439 const clickTarget = $(e.target);
437440 const noCloseTargets = ['#sd_gen', '#extensionsMenuButton', '#roll_dice'];
438441 if (dropdown.is(':visible') && !noCloseTargets.some(id => clickTarget.closest(id).length > 0)) {
439442 $(dropdown).fadeOut(animation_duration);
443+ isDropdownVisible = false;
440444 }
441445 });
442446}
public/scripts/extensions/caption/index.js+1 -1
@@ -393,7 +393,7 @@ jQuery(async function () {
393393 const sendButton = $(`
394394 <div id="send_picture" class="list-group-item flex-container flexGap5">
395395 <div class="fa-solid fa-image extensionsMenuExtensionButton"></div>
396- Generate Caption
396+ <span data-i18n="Generate Caption">Generate Caption</span>
397397 </div>`);
398398
399399 $('#caption_wand_container').append(sendButton);
public/scripts/extensions/caption/settings.html+0 -1
@@ -70,7 +70,6 @@
7070 <option data-type="google" value="gemini-1.5-pro-002">gemini-1.5-pro-002</option>
7171 <option data-type="google" value="gemini-1.5-pro-exp-0801">gemini-1.5-pro-exp-0801</option>
7272 <option data-type="google" value="gemini-1.5-pro-exp-0827">gemini-1.5-pro-exp-0827</option>
73- <option data-type="google" value="gemini-pro-vision">gemini-pro-vision</option>
7473 <option data-type="groq" value="llama-3.2-11b-vision-preview">llama-3.2-11b-vision-preview</option>
7574 <option data-type="groq" value="llama-3.2-90b-vision-preview">llama-3.2-90b-vision-preview</option>
7675 <option data-type="groq" value="llava-v1.5-7b-4096-preview">llava-v1.5-7b-4096-preview</option>
public/scripts/extensions/stable-diffusion/button.html+2 -2
@@ -1,8 +1,8 @@
11<div id="sd_gen" class="list-group-item flex-container flexGap5">
22 <div class="fa-solid fa-paintbrush extensionsMenuExtensionButton" title="Trigger Stable Diffusion" data-i18n="[title]Trigger Stable Diffusion"></div>
33 <span data-i18n="Generate Image">Generate Image</span>
44</div>
55<div id="sd_stop_gen" class="list-group-item flex-container flexGap5">
66 <div class="fa-solid fa-circle-stop extensionsMenuExtensionButton" title="Abort current image generation task" data-i18n="[title]Abort current image generation task"></div>
77 <span data-i18n="Stop Image Generation">Stop Image Generation</span>
88</div>
public/scripts/extensions/stable-diffusion/index.js+10 -0
@@ -319,6 +319,7 @@ const defaultSettings = {
319319 wand_visible: false,
320320 command_visible: false,
321321 interactive_visible: false,
322+ tool_visible: false,
322323
323324 // Stability AI settings
324325 stability_style_preset: 'anime',
@@ -488,6 +489,7 @@ async function loadSettings() {
488489 $('#sd_wand_visible').prop('checked', extension_settings.sd.wand_visible);
489490 $('#sd_command_visible').prop('checked', extension_settings.sd.command_visible);
490491 $('#sd_interactive_visible').prop('checked', extension_settings.sd.interactive_visible);
492+ $('#sd_tool_visible').prop('checked', extension_settings.sd.tool_visible);
491493 $('#sd_stability_style_preset').val(extension_settings.sd.stability_style_preset);
492494 $('#sd_huggingface_model_id').val(extension_settings.sd.huggingface_model_id);
493495 $('#sd_function_tool').prop('checked', extension_settings.sd.function_tool);
@@ -844,6 +846,11 @@ function onInteractiveVisibleInput() {
844846 saveSettingsDebounced();
845847}
846848
849+function onToolVisibleInput() {
850+ extension_settings.sd.tool_visible = !!$('#sd_tool_visible').prop('checked');
851+ saveSettingsDebounced();
852+}
853+
847854function onClipSkipInput() {
848855 extension_settings.sd.clip_skip = Number($('#sd_clip_skip').val());
849856 $('#sd_clip_skip_value').val(extension_settings.sd.clip_skip);
@@ -3670,6 +3677,8 @@ function getVisibilityByInitiator(initiator) {
36703677 return !!extension_settings.sd.wand_visible;
36713678 case initiators.command:
36723679 return !!extension_settings.sd.command_visible;
3680+ case initiators.tool:
3681+ return !!extension_settings.sd.tool_visible;
36733682 default:
36743683 return false;
36753684 }
@@ -4417,6 +4426,7 @@ jQuery(async () => {
44174426 $('#sd_wand_visible').on('input', onWandVisibleInput);
44184427 $('#sd_command_visible').on('input', onCommandVisibleInput);
44194428 $('#sd_interactive_visible').on('input', onInteractiveVisibleInput);
4429+ $('#sd_tool_visible').on('input', onToolVisibleInput);
44204430 $('#sd_swap_dimensions').on('click', onSwapDimensionsClick);
44214431 $('#sd_stability_key').on('click', onStabilityKeyClick);
44224432 $('#sd_stability_style_preset').on('change', onStabilityStylePresetChange);
public/scripts/extensions/stable-diffusion/settings.html+10 -3
@@ -459,25 +459,32 @@
459459 <div class="flex-container flexFlowColumn marginTopBot5 flexGap10">
460460 <label for="sd_wand_visible" class="checkbox_label">
461461 <span class="flex1 flex-container alignItemsCenter">
462462 <i class="fa-solid fa-wand-magic-sparkles fa-fw"></i>
463463 <span data-i18n="Extensions Menu">Extensions Menu</span>
464464 </span>
465465 <input id="sd_wand_visible" type="checkbox" />
466466 </label>
467467 <label for="sd_command_visible" class="checkbox_label">
468468 <span class="flex1 flex-container alignItemsCenter">
469469 <i class="fa-solid fa-terminal fa-fw"></i>
470470 <span data-i18n="Slash Command">Slash Command</span>
471471 </span>
472472 <input id="sd_command_visible" type="checkbox" />
473473 </label>
474474 <label for="sd_interactive_visible" class="checkbox_label">
475475 <span class="flex1 flex-container alignItemsCenter">
476476 <i class="fa-solid fa-message fa-fw"></i>
477477 <span data-i18n="Interactive Mode">Interactive Mode</span>
478478 </span>
479479 <input id="sd_interactive_visible" type="checkbox" />
480480 </label>
481+ <label for="sd_tool_visible" class="checkbox_label">
482+ <span class="flex1 flex-container alignItemsCenter">
483+ <i class="fa-solid fa-code fa-fw"></i>
484+ <span data-i18n="Function Tool">Function Tool</span>
485+ </span>
486+ <input id="sd_tool_visible" type="checkbox" />
487+ </label>
481488 </div>
482489 </div>
483490 </div>
public/scripts/macros.js+4 -0
@@ -516,7 +516,11 @@ export function evaluateMacros(content, env, postProcessFn) {
516516 break;
517517 }
518518
519+ try {
519520 content = content.replace(macro.regex, (...args) => postProcessFn(macro.replace(...args)));
521+ } catch (e) {
522+ console.warn(`Macro content can't be replaced: ${macro.regex} in ${content}`, e);
523+ }
520524 }
521525
522526 return content;
public/scripts/openai.js+3 -12
@@ -4098,13 +4098,8 @@ async function onModelChange() {
40984098 $('#openai_max_context').attr('max', max_2mil);
40994099 } else if (value.includes('gemini-1.5-flash') || value.includes('gemini-2.0-flash-exp')) {
41004100 $('#openai_max_context').attr('max', max_1mil);
4101- } else if (value.includes('gemini-1.0-pro-vision') || value === 'gemini-pro-vision') {
4102- $('#openai_max_context').attr('max', max_16k);
41034101 } else if (value.includes('gemini-1.0-pro') || value === 'gemini-pro') {
41044102 $('#openai_max_context').attr('max', max_32k);
4105- } else if (value === 'text-bison-001') {
4106- $('#openai_max_context').attr('max', max_8k);
4107- // The ultra endpoints are possibly dead:
41084103 } else if (value.includes('gemini-1.0-ultra') || value === 'gemini-ultra') {
41094104 $('#openai_max_context').attr('max', max_32k);
41104105 } else {
@@ -4226,16 +4221,13 @@ async function onModelChange() {
42264221 if (oai_settings.max_context_unlocked) {
42274222 $('#openai_max_context').attr('max', unlocked_max);
42284223 }
42294224 else if (['command-light-nightly', 'command-light', 'command'].includes(oai_settings.cohere_model)) {
42304225 $('#openai_max_context').attr('max', max_4k);
42314226 }
42324227 else if ([oai_settings.cohere_model.includes('command-lightr') || ['c4ai-nightlyaya-23', 'c4ai-aya-expanse-32b', 'command-nightly'].includes(oai_settings.cohere_model)) {
4233- $('#openai_max_context').attr('max', max_8k);
4234- }
4235- else if (oai_settings.cohere_model.includes('command-r') || ['c4ai-aya-expanse-32b'].includes(oai_settings.cohere_model)) {
42364228 $('#openai_max_context').attr('max', max_128k);
42374229 }
42384230 else if (['c4ai-aya-23-8b', 'c4ai-aya-expanse-8b'].includes(oai_settings.cohere_model)) {
42394231 $('#openai_max_context').attr('max', max_8k);
42404232 }
42414233 else {
@@ -4787,7 +4779,6 @@ export function isImageInliningSupported() {
47874779 'gemini-1.5-pro-002',
47884780 'gemini-1.5-pro-exp-0801',
47894781 'gemini-1.5-pro-exp-0827',
4790- 'gemini-pro-vision',
47914782 'claude-3',
47924783 'claude-3-5',
47934784 'gpt-4-turbo',
public/scripts/textgen-settings.js+5 -2
@@ -55,6 +55,7 @@ const {
5555} = textgen_types;
5656
5757const LLAMACPP_DEFAULT_ORDER = [
58+ 'dry',
5859 'top_k',
5960 'tfs_z',
6061 'typical_p',
@@ -1038,11 +1039,13 @@ export function parseTextgenLogprobs(token, logprobs) {
10381039 return { token, topLogprobs: candidates };
10391040 }
10401041 case LLAMACPP: {
1041- /** @type {Record<string, number>[]} */
10421042 if (!logprobs?.length) {
10431043 return null;
10441044 }
10451045 const candidates = logprobs?.[0]?.probs?.map(x => [x.tok_str, x.prob]);
1046+ if (!candidates) {
1047+ return null;
1048+ }
10461049 return { token, topLogprobs: candidates };
10471050 }
10481051 default:
public/scripts/tool-calling.js+58 -5
@@ -25,6 +25,7 @@ import { isTrueBoolean } from './utils.js';
2525 * @typedef {object} ToolInvocationResult
2626 * @property {ToolInvocation[]} invocations Successful tool invocations
2727 * @property {Error[]} errors Errors that occurred during tool invocation
28+ * @property {string[]} stealthCalls Names of stealth tools that were invoked
2829 */
2930
3031/**
@@ -36,6 +37,7 @@ import { isTrueBoolean } from './utils.js';
3637 * @property {function} action - The action to perform when the tool is invoked.
3738 * @property {function} [formatMessage] - A function to format the tool call message.
3839 * @property {function} [shouldRegister] - A function to determine if the tool should be registered.
40+ * @property {boolean} [stealth] - A tool call result will not be shown in the chat. No follow-up generation will be performed.
3941 */
4042
4143/**
@@ -148,6 +150,12 @@ class ToolDefinition {
148150 #shouldRegister;
149151
150152 /**
153+ * A tool call result will not be shown in the chat. No follow-up generation will be performed.
154+ * @type {boolean}
155+ */
156+ #stealth;
157+
158+ /**
151159 * Creates a new ToolDefinition.
152160 * @param {string} name A unique name for the tool.
153161 * @param {string} displayName A user-friendly display name for the tool.
@@ -156,8 +164,9 @@ class ToolDefinition {
156164 * @param {function} action A function that will be called when the tool is executed.
157165 * @param {function} formatMessage A function that will be called to format the tool call toast.
158166 * @param {function} shouldRegister A function that will be called to determine if the tool should be registered.
167+ * @param {boolean} stealth A tool call result will not be shown in the chat. No follow-up generation will be performed.
159168 */
160169 constructor(name, displayName, description, parameters, action, formatMessage, shouldRegister, stealth) {
161170 this.#name = name;
162171 this.#displayName = displayName;
163172 this.#description = description;
@@ -165,6 +174,7 @@ class ToolDefinition {
165174 this.#action = action;
166175 this.#formatMessage = formatMessage;
167176 this.#shouldRegister = shouldRegister;
177+ this.#stealth = stealth;
168178 }
169179
170180 /**
@@ -214,6 +224,10 @@ class ToolDefinition {
214224 get displayName() {
215225 return this.#displayName;
216226 }
227+
228+ get stealth() {
229+ return this.#stealth;
230+ }
217231}
218232
219233/**
@@ -246,7 +260,7 @@ export class ToolManager {
246260 * Registers a new tool with the tool registry.
247261 * @param {ToolRegistration} tool The tool to register.
248262 */
249263 static registerFunctionTool({ name, displayName, description, parameters, action, formatMessage, shouldRegister, stealth }) {
250264 // Convert WIP arguments
251265 if (typeof arguments[0] !== 'object') {
252266 [name, description, parameters, action] = arguments;
@@ -256,7 +270,16 @@ export class ToolManager {
256270 console.warn(`[ToolManager] A tool with the name "${name}" has already been registered. The definition will be overwritten.`);
257271 }
258272
259273 const definition = new ToolDefinition(name, displayName, description, parameters, action, formatMessage, shouldRegister);
274+ name,
275+ displayName,
276+ description,
277+ parameters,
278+ action,
279+ formatMessage,
280+ shouldRegister,
281+ stealth,
282+ );
260283 this.#tools.set(name, definition);
261284 console.log('[ToolManager] Registered function tool:', definition);
262285 }
@@ -303,6 +326,20 @@ export class ToolManager {
303326 }
304327
305328 /**
329+ * Checks if a tool is a stealth tool.
330+ * @param {string} name The name of the tool to check.
331+ * @returns {boolean} Whether the tool is a stealth tool.
332+ */
333+ static isStealthTool(name) {
334+ if (!this.#tools.has(name)) {
335+ return false;
336+ }
337+
338+ const tool = this.#tools.get(name);
339+ return !!tool.stealth;
340+ }
341+
342+ /**
306343 * Formats a message for a tool call by name.
307344 * @param {string} name The name of the tool to format the message for.
308345 * @param {object} parameters Function tool call parameters.
@@ -608,6 +645,7 @@ export class ToolManager {
608645 const result = {
609646 invocations: [],
610647 errors: [],
648+ stealthCalls: [],
611649 };
612650 const toolCalls = ToolManager.#getToolCallsFromData(data);
613651
@@ -625,7 +663,7 @@ export class ToolManager {
625663 const parameters = toolCall.function.arguments;
626664 const name = toolCall.function.name;
627665 const displayName = ToolManager.getDisplayName(name);
628-
666+ const isStealth = ToolManager.isStealthTool(name);
629667 const message = await ToolManager.formatToolCallMessage(name, parameters);
630668 const toast = message && toastr.info(message, 'Tool Calling', { timeOut: 0 });
631669 const toolResult = await ToolManager.invokeFunctionTool(name, parameters);
@@ -638,6 +676,12 @@ export class ToolManager {
638676 continue;
639677 }
640678
679+ // Don't save stealth tool invocations
680+ if (isStealth) {
681+ result.stealthCalls.push(name);
682+ continue;
683+ }
684+
641685 const invocation = {
642686 id,
643687 displayName,
@@ -860,6 +904,14 @@ export class ToolManager {
860904 isRequired: false,
861905 acceptsMultiple: false,
862906 }),
907+ SlashCommandNamedArgument.fromProps({
908+ name: 'stealth',
909+ description: 'If true, a tool call result will not be shown in the chat and no follow-up generation will be performed.',
910+ typeList: [ARGUMENT_TYPE.BOOLEAN],
911+ isRequired: false,
912+ acceptsMultiple: false,
913+ defaultValue: String(false),
914+ }),
863915 ],
864916 unnamedArgumentList: [
865917 SlashCommandArgument.fromProps({
@@ -891,7 +943,7 @@ export class ToolManager {
891943 };
892944 }
893945
894946 const { name, displayName, description, parameters, formatMessage, shouldRegister, stealth } = args;
895947
896948 if (!(action instanceof SlashCommandClosure)) {
897949 throw new Error('The unnamed argument must be a closure.');
@@ -927,6 +979,7 @@ export class ToolManager {
927979 action: actionFunc,
928980 formatMessage: formatMessageFunc,
929981 shouldRegister: shouldRegisterFunc,
982+ stealth: stealth && isTrueBoolean(String(stealth)),
930983 });
931984
932985 return '';
public/scripts/variables.js+8 -0
@@ -46,6 +46,10 @@ function getLocalVariable(name, args = {}) {
4646}
4747
4848function setLocalVariable(name, value, args = {}) {
49+ if (!name) {
50+ throw new Error('Variable name cannot be empty or undefined.');
51+ }
52+
4953 if (!chat_metadata.variables) {
5054 chat_metadata.variables = {};
5155 }
@@ -99,6 +103,10 @@ function getGlobalVariable(name, args = {}) {
99103}
100104
101105function setGlobalVariable(name, value, args = {}) {
106+ if (!name) {
107+ throw new Error('Variable name cannot be empty or undefined.');
108+ }
109+
102110 if (args.index !== undefined) {
103111 try {
104112 let globalVariable = JSON.parse(extension_settings.variables.global[name] ?? 'null');
public/style.css+2 -1
@@ -2874,6 +2874,7 @@ input[type=search]:focus::-webkit-search-cancel-button {
28742874
28752875.mes_block .ch_name {
28762876 max-width: 100%;
2877+ min-height: 22px;
28772878}
28782879
28792880/*applies to both groups and solos chars in the char list*/
@@ -4043,7 +4044,7 @@ input[type="range"]::-webkit-slider-thumb {
40434044.mes_button,
40444045.extraMesButtons>div {
40454046 cursor: pointer;
40464047 transition: opacity 0.3s2s ease-in-out;
40474048 filter: drop-shadow(0px 0px 2px black);
40484049 opacity: 0.3;
40494050 padding: 1px 3px;
src/constants.js+0 -27
@@ -159,33 +159,6 @@ export const GEMINI_SAFETY = [
159159 },
160160];
161161
162-export const BISON_SAFETY = [
163- {
164- category: 'HARM_CATEGORY_DEROGATORY',
165- threshold: 'BLOCK_NONE',
166- },
167- {
168- category: 'HARM_CATEGORY_TOXICITY',
169- threshold: 'BLOCK_NONE',
170- },
171- {
172- category: 'HARM_CATEGORY_VIOLENCE',
173- threshold: 'BLOCK_NONE',
174- },
175- {
176- category: 'HARM_CATEGORY_SEXUAL',
177- threshold: 'BLOCK_NONE',
178- },
179- {
180- category: 'HARM_CATEGORY_MEDICAL',
181- threshold: 'BLOCK_NONE',
182- },
183- {
184- category: 'HARM_CATEGORY_DANGEROUS',
185- threshold: 'BLOCK_NONE',
186- },
187-];
188-
189162export const CHAT_COMPLETION_SOURCES = {
190163 OPENAI: 'openai',
191164 WINDOWAI: 'windowai',
src/endpoints/backends/chat-completions.js+5 -42
@@ -6,7 +6,6 @@ import { jsonParser } from '../../express-common.js';
66import {
77 CHAT_COMPLETION_SOURCES,
88 GEMINI_SAFETY,
9- BISON_SAFETY,
109 OPENROUTER_HEADERS,
1110} from '../../constants.js';
1211import {
@@ -262,9 +261,7 @@ async function sendMakerSuiteRequest(request, response) {
262261 }
263262
264263 const model = String(request.body.model);
265264 const isGeministream = model.includesBoolean('gemini'request.body.stream);
266- const isText = model.includes('text');
267- const stream = Boolean(request.body.stream) && isGemini;
268265
269266 const generationConfig = {
270267 stopSequences: request.body.stop,
@@ -301,39 +298,7 @@ async function sendMakerSuiteRequest(request, response) {
301298 return body;
302299 }
303300
304- function getBisonBody() {
301+ const body = getGeminiBody();
305- const prompt = isText
306- ? ({ text: convertTextCompletionPrompt(request.body.messages) })
307- : ({ messages: convertGooglePrompt(request.body.messages, model).contents });
308-
309- /** @type {any} Shut the lint up */
310- const bisonBody = {
311- ...generationConfig,
312- safetySettings: BISON_SAFETY,
313- candidate_count: 1, // lewgacy spelling
314- prompt: prompt,
315- };
316-
317- if (!isText) {
318- delete bisonBody.stopSequences;
319- delete bisonBody.maxOutputTokens;
320- delete bisonBody.safetySettings;
321-
322- if (Array.isArray(prompt.messages)) {
323- for (const msg of prompt.messages) {
324- msg.author = msg.role;
325- msg.content = msg.parts[0].text;
326- delete msg.parts;
327- delete msg.role;
328- }
329- }
330- }
331-
332- delete bisonBody.candidateCount;
333- return bisonBody;
334- }
335-
336- const body = isGemini ? getGeminiBody() : getBisonBody();
337302 console.log('Google AI Studio request:', body);
338303
339304 try {
@@ -343,10 +308,8 @@ async function sendMakerSuiteRequest(request, response) {
343308 controller.abort();
344309 });
345310
346311 const apiVersion = isGemini ? 'v1beta' : 'v1beta2';
347- const responseType = isGemini
312+ const responseType = (stream ? 'streamGenerateContent' : 'generateContent');
348- ? (stream ? 'streamGenerateContent' : 'generateContent')
349- : (isText ? 'generateText' : 'generateMessage');
350313
351314 const generateResponse = await fetch(`${apiUrl.toString().replace(/\/$/, '')}/${apiVersion}/models/${model}:${responseType}?key=${apiKey}${stream ? '&alt=sse' : ''}`, {
352315 body: JSON.stringify(body),
@@ -897,7 +860,7 @@ router.post('/generate', jsonParser, function (request, response) {
897860 }
898861
899862 let cachingAtDepth = getConfigValue('claude.cachingAtDepth', -1);
900863 if (Number.isInteger(cachingAtDepth) && cachingAtDepth >= 0 && request.body.model?.startsWith('anthropic/claude-3')) {
901864 cachingAtDepthForOpenRouterClaude(request.body.messages, cachingAtDepth);
902865 }
903866 } else if (request.body.chat_completion_source === CHAT_COMPLETION_SOURCES.CUSTOM) {
src/prompt-converters.js+0 -19
@@ -333,8 +333,6 @@ export function convertCohereMessages(messages, charName = '', userName = '') {
333333 * @returns {{contents: *[], system_instruction: {parts: {text: string}}}} Prompt for Google MakerSuite models
334334 */
335335export function convertGooglePrompt(messages, model, useSysPrompt = false, charName = '', userName = '') {
336- // This is a 1x1 transparent PNG
337- const PNG_PIXEL = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';
338336
339337 const visionSupportedModels = [
340338 'gemini-2.0-flash-exp',
@@ -355,13 +353,6 @@ export function convertGooglePrompt(messages, model, useSysPrompt = false, charN
355353 'gemini-1.5-pro-002',
356354 'gemini-1.5-pro-exp-0801',
357355 'gemini-1.5-pro-exp-0827',
358- 'gemini-1.0-pro-vision-latest',
359- 'gemini-pro-vision',
360- ];
361-
362- const dummyRequiredModels = [
363- 'gemini-1.0-pro-vision-latest',
364- 'gemini-pro-vision',
365356 ];
366357
367358 const isMultimodal = visionSupportedModels.includes(model);
@@ -452,16 +443,6 @@ export function convertGooglePrompt(messages, model, useSysPrompt = false, charN
452443 }
453444 });
454445
455- // pro 1.5 doesn't require a dummy image to be attached, other vision models do
456- if (isMultimodal && dummyRequiredModels.includes(model) && !hasImage) {
457- contents[0].parts.push({
458- inlineData: {
459- mimeType: 'image/png',
460- data: PNG_PIXEL,
461- },
462- });
463- }
464-
465446 return { contents: contents, system_instruction: system_instruction };
466447}
467448