Merge pull request #2580 from SillyTavern/staging

Staging
This commit is contained in:
Cohee
2024-07-28 21:40:24 +03:00
committed by GitHub
12 changed files with 127 additions and 167 deletions

View File

@@ -7,7 +7,8 @@
background-color: green; background-color: green;
} }
.extensions_block input[type="checkbox"] { .extensions_block input[type="checkbox"],
.extensions_block input[type="radio"] {
margin-left: 10px; margin-left: 10px;
margin-right: 10px; margin-right: 10px;
} }

View File

@@ -209,20 +209,20 @@
opacity: 1; opacity: 1;
} }
.tag_as_folder { .tag_as_folder.right_menu_button {
filter: brightness(75%) saturate(0.6); filter: brightness(75%) saturate(0.6);
} }
.tag_as_folder:hover, .tag_as_folder.right_menu_button:hover,
.tag_as_folder.flash { .tag_as_folder.right_menu_button.flash {
filter: brightness(150%) saturate(0.6) !important; filter: brightness(150%) saturate(0.6);
} }
.tag_as_folder.no_folder { .tag_as_folder.right_menu_button.no_folder {
filter: brightness(25%) saturate(0.25); filter: brightness(25%) saturate(0.25);
} }
.tag_as_folder .tag_folder_indicator { .tag_as_folder.right_menu_button .tag_folder_indicator {
position: absolute; position: absolute;
top: calc(var(--mainFontSize) * -0.5); top: calc(var(--mainFontSize) * -0.5);
right: calc(var(--mainFontSize) * -0.5); right: calc(var(--mainFontSize) * -0.5);

View File

@@ -4026,7 +4026,7 @@
<input type="range" id="smooth_streaming_speed" name="smooth_streaming_speed" min="0" max="100" step="10" value="50"> <input type="range" id="smooth_streaming_speed" name="smooth_streaming_speed" min="0" max="100" step="10" value="50">
<div class="slider_hint"> <div class="slider_hint">
<span data-i18n="Slow">Slow</span> <span data-i18n="Slow">Slow</span>
<span data-i18n=""></span> <span></span>
<span data-i18n="Fast">Fast</span> <span data-i18n="Fast">Fast</span>
</div> </div>
</div> </div>

View File

@@ -217,9 +217,11 @@
"Character Names Behavior": "角色名称行为", "Character Names Behavior": "角色名称行为",
"Helps the model to associate messages with characters.": "有助于模型将消息与角色关联起来。", "Helps the model to associate messages with characters.": "有助于模型将消息与角色关联起来。",
"None": "无", "None": "无",
"character_names_none": "不添加角色名称前缀。在群聊中可能导致错误行为,谨慎勾选。",
"Never add character names.": "不添加角色名称。",
"character_names_default": "群聊和过去的角色除外。否则,请确保在提示词中提供了姓名。", "character_names_default": "群聊和过去的角色除外。否则,请确保在提示词中提供了姓名。",
"Don't add character names.": "不添加角色名称。", "Don't add character names unless necessary.": "如非必要,否则不添加角色名称。",
"Completion": "补全对象", "Completion Object": "补全对象",
"character_names_completion": "适用限制仅限拉丁字母数字和下划线。不适用于所有补全源尤其是Claude、MistralAI、Google。", "character_names_completion": "适用限制仅限拉丁字母数字和下划线。不适用于所有补全源尤其是Claude、MistralAI、Google。",
"Add character names to completion objects.": "在补全对象中添加角色名称。", "Add character names to completion objects.": "在补全对象中添加角色名称。",
"Message Content": "消息内容", "Message Content": "消息内容",
@@ -489,6 +491,10 @@
"First Assistant Prefix": "第一个助理前缀", "First Assistant Prefix": "第一个助理前缀",
"instruct_last_output_sequence": "插入到最后一条助手消息之前或作为生成 AI 回复时的最后一行提示词(中立/系统角色除外)。", "instruct_last_output_sequence": "插入到最后一条助手消息之前或作为生成 AI 回复时的最后一行提示词(中立/系统角色除外)。",
"Last Assistant Prefix": "最后一个助理前缀", "Last Assistant Prefix": "最后一个助理前缀",
"Inserted before the first User's message.": "插入在第一个用户的消息之前。",
"First User Prefix": "第一个用户前缀",
"instruct_last_input_sequence": "插入到最后一条用户消息之前。",
"Last User Prefix": "上次用户前缀",
"Will be inserted as a last prompt line when using system/neutral generation.": "当使用系统/中性生成时将作为最后的一行提示词插入。", "Will be inserted as a last prompt line when using system/neutral generation.": "当使用系统/中性生成时将作为最后的一行提示词插入。",
"System Instruction Prefix": "系统指令前缀", "System Instruction Prefix": "系统指令前缀",
"If a stop sequence is generated, everything past it will be removed from the output (inclusive).": "如果生成了停止序列,则该序列之后的所有内容都将从输出中删除(包括在内)。", "If a stop sequence is generated, everything past it will be removed from the output (inclusive).": "如果生成了停止序列,则该序列之后的所有内容都将从输出中删除(包括在内)。",
@@ -555,7 +561,7 @@
"Close all Entries": "关闭所有条目", "Close all Entries": "关闭所有条目",
"New Entry": "新条目", "New Entry": "新条目",
"Fill empty Memo/Titles with Keywords": "使用关键字填充空的备忘录/标题", "Fill empty Memo/Titles with Keywords": "使用关键字填充空的备忘录/标题",
"Apply custom sorting as Order": "应用自定义排序作为顺序", "Apply current sorting as Order": "应用当前排序作为顺序",
"Import World Info": "导入世界书", "Import World Info": "导入世界书",
"Export World Info": "导出世界书", "Export World Info": "导出世界书",
"Duplicate World Info": "复制世界书", "Duplicate World Info": "复制世界书",
@@ -1187,6 +1193,7 @@
"Bind user name to that avatar": "将用户名称绑定到该头像", "Bind user name to that avatar": "将用户名称绑定到该头像",
"Change persona image": "更改用户角色头像", "Change persona image": "更改用户角色头像",
"Select this as default persona for the new chats.": "选择此项作为新聊天的默认用户角色。", "Select this as default persona for the new chats.": "选择此项作为新聊天的默认用户角色。",
"Duplicate persona": "复制用户角色",
"Delete persona": "删除用户角色", "Delete persona": "删除用户角色",
"These characters are the winners of character design contests and have outstandable quality.": "这些角色都是角色设计大赛的获奖者,品质非常出色。", "These characters are the winners of character design contests and have outstandable quality.": "这些角色都是角色设计大赛的获奖者,品质非常出色。",
"Contest Winners": "比赛获胜者", "Contest Winners": "比赛获胜者",
@@ -1327,6 +1334,10 @@
"ext_sum_injection_template": "插入模板", "ext_sum_injection_template": "插入模板",
"ext_sum_memory_template_placeholder": "{{summary}} 将解析当前摘要内容。", "ext_sum_memory_template_placeholder": "{{summary}} 将解析当前摘要内容。",
"ext_sum_injection_position": "插入位置", "ext_sum_injection_position": "插入位置",
"ext_sum_include_wi_scan_desc": "在 WI 扫描中包括最新摘要。",
"ext_sum_include_wi_scan": "纳入世界信息扫描",
"None (not injected)": "无(未注入)",
"ext_sum_injection_position_none": "摘要不会被注入到提示中。您仍然可以通过 {{summary}} 宏访问它。",
"How many messages before the current end of the chat.": "当前聊天结束前还有多少条消息。", "How many messages before the current end of the chat.": "当前聊天结束前还有多少条消息。",
"Labels and Message": "标签和信息", "Labels and Message": "标签和信息",
"Label": "标签", "Label": "标签",
@@ -1757,6 +1768,8 @@
"help_macros_56": "指示系统指令前缀", "help_macros_56": "指示系统指令前缀",
"help_macros_57": "指示第一个用户消息填充器", "help_macros_57": "指示第一个用户消息填充器",
"help_macros_58": "指示停止顺序", "help_macros_58": "指示停止顺序",
"help_macros_first_user": "指示用户第一个输入序列",
"help_macros_last_user": "指示用户最后输入序列",
"Chat variables Macros:": "聊天变量宏:", "Chat variables Macros:": "聊天变量宏:",
"Local variables = unique to the current chat": "局部变量 = 当前聊天所独有", "Local variables = unique to the current chat": "局部变量 = 当前聊天所独有",
"Global variables = works in any chat for any character": "全局变量 = 适用于任何角色的任何聊天", "Global variables = works in any chat for any character": "全局变量 = 适用于任何角色的任何聊天",
@@ -1794,6 +1807,7 @@
"Record a snapshot of your current settings.": "记录当前设置的快照。", "Record a snapshot of your current settings.": "记录当前设置的快照。",
"Make a Snapshot": "制作快照", "Make a Snapshot": "制作快照",
"Restore this snapshot": "恢复此快照", "Restore this snapshot": "恢复此快照",
"Download Model": "下载模型",
"Downloader Options": "下载器选项", "Downloader Options": "下载器选项",
"Extra parameters for downloading/HuggingFace API": "下载/HuggingFace API 的额外参数。如果不确定,请将其留空。", "Extra parameters for downloading/HuggingFace API": "下载/HuggingFace API 的额外参数。如果不确定,请将其留空。",
"Revision": "修订", "Revision": "修订",

View File

@@ -570,6 +570,7 @@ export const system_message_types = {
* @enum {number} Extension prompt types * @enum {number} Extension prompt types
*/ */
export const extension_prompt_types = { export const extension_prompt_types = {
NONE: -1,
IN_PROMPT: 0, IN_PROMPT: 0,
IN_CHAT: 1, IN_CHAT: 1,
BEFORE_PROMPT: 2, BEFORE_PROMPT: 2,
@@ -929,10 +930,17 @@ async function firstLoadInit() {
initCfg(); initCfg();
initLogprobs(); initLogprobs();
doDailyExtensionUpdatesCheck(); doDailyExtensionUpdatesCheck();
hideLoader(); await hideLoader();
await fixViewport();
await eventSource.emit(event_types.APP_READY); await eventSource.emit(event_types.APP_READY);
} }
async function fixViewport() {
document.body.style.position = 'absolute';
await delay(1);
document.body.style.position = '';
}
function cancelStatusCheck() { function cancelStatusCheck() {
abortStatusCheck?.abort(); abortStatusCheck?.abort();
abortStatusCheck = new AbortController(); abortStatusCheck = new AbortController();
@@ -8302,6 +8310,7 @@ const swipe_right = () => {
}; };
const CONNECT_API_MAP = { const CONNECT_API_MAP = {
// Default APIs not contined inside text gen / chat gen
'kobold': { 'kobold': {
selected: 'kobold', selected: 'kobold',
button: '#api_button', button: '#api_button',
@@ -8313,147 +8322,48 @@ const CONNECT_API_MAP = {
selected: 'novel', selected: 'novel',
button: '#api_button_novel', button: '#api_button_novel',
}, },
'ooba': { // KoboldCpp alias
selected: 'textgenerationwebui',
button: '#api_button_textgenerationwebui',
type: textgen_types.OOBA,
},
'tabby': {
selected: 'textgenerationwebui',
button: '#api_button_textgenerationwebui',
type: textgen_types.TABBY,
},
'llamacpp': {
selected: 'textgenerationwebui',
button: '#api_button_textgenerationwebui',
type: textgen_types.LLAMACPP,
},
'ollama': {
selected: 'textgenerationwebui',
button: '#api_button_textgenerationwebui',
type: textgen_types.OLLAMA,
},
'mancer': {
selected: 'textgenerationwebui',
button: '#api_button_textgenerationwebui',
type: textgen_types.MANCER,
},
'vllm': {
selected: 'textgenerationwebui',
button: '#api_button_textgenerationwebui',
type: textgen_types.VLLM,
},
'aphrodite': {
selected: 'textgenerationwebui',
button: '#api_button_textgenerationwebui',
type: textgen_types.APHRODITE,
},
'koboldcpp': {
selected: 'textgenerationwebui',
button: '#api_button_textgenerationwebui',
type: textgen_types.KOBOLDCPP,
},
'kcpp': { 'kcpp': {
selected: 'textgenerationwebui', selected: 'textgenerationwebui',
button: '#api_button_textgenerationwebui', button: '#api_button_textgenerationwebui',
type: textgen_types.KOBOLDCPP, type: textgen_types.KOBOLDCPP,
}, },
'togetherai': { // OpenAI alias
selected: 'textgenerationwebui',
button: '#api_button_textgenerationwebui',
type: textgen_types.TOGETHERAI,
},
'openai': {
selected: 'openai',
button: '#api_button_openai',
source: chat_completion_sources.OPENAI,
},
'oai': { 'oai': {
selected: 'openai', selected: 'openai',
button: '#api_button_openai', button: '#api_button_openai',
source: chat_completion_sources.OPENAI, source: chat_completion_sources.OPENAI,
}, },
'claude': { // OpenRouter special naming, to differentiate between chat comp and text comp
selected: 'openai',
button: '#api_button_openai',
source: chat_completion_sources.CLAUDE,
},
'windowai': {
selected: 'openai',
button: '#api_button_openai',
source: chat_completion_sources.WINDOWAI,
},
'openrouter': { 'openrouter': {
selected: 'openai', selected: 'openai',
button: '#api_button_openai', button: '#api_button_openai',
source: chat_completion_sources.OPENROUTER, source: chat_completion_sources.OPENROUTER,
}, },
'scale': {
selected: 'openai',
button: '#api_button_openai',
source: chat_completion_sources.SCALE,
},
'ai21': {
selected: 'openai',
button: '#api_button_openai',
source: chat_completion_sources.AI21,
},
'makersuite': {
selected: 'openai',
button: '#api_button_openai',
source: chat_completion_sources.MAKERSUITE,
},
'mistralai': {
selected: 'openai',
button: '#api_button_openai',
source: chat_completion_sources.MISTRALAI,
},
'custom': {
selected: 'openai',
button: '#api_button_openai',
source: chat_completion_sources.CUSTOM,
},
'cohere': {
selected: 'openai',
button: '#api_button_openai',
source: chat_completion_sources.COHERE,
},
'perplexity': {
selected: 'openai',
button: '#api_button_openai',
source: chat_completion_sources.PERPLEXITY,
},
'groq': {
selected: 'openai',
button: '#api_button_openai',
source: chat_completion_sources.GROQ,
},
'01ai': {
selected: 'openai',
button: '#api_button_openai',
source: chat_completion_sources.ZEROONEAI,
},
'infermaticai': {
selected: 'textgenerationwebui',
button: '#api_button_textgenerationwebui',
type: textgen_types.INFERMATICAI,
},
'dreamgen': {
selected: 'textgenerationwebui',
button: '#api_button_textgenerationwebui',
type: textgen_types.DREAMGEN,
},
'openrouter-text': { 'openrouter-text': {
selected: 'textgenerationwebui', selected: 'textgenerationwebui',
button: '#api_button_textgenerationwebui', button: '#api_button_textgenerationwebui',
type: textgen_types.OPENROUTER, type: textgen_types.OPENROUTER,
}, },
'huggingface': { };
// Fill connections map from textgen_types and chat_completion_sources
for (const textGenType of Object.values(textgen_types)) {
if (CONNECT_API_MAP[textGenType]) continue;
CONNECT_API_MAP[textGenType] = {
selected: 'textgenerationwebui', selected: 'textgenerationwebui',
button: '#api_button_textgenerationwebui', button: '#api_button_textgenerationwebui',
type: textgen_types.HUGGINGFACE, type: textGenType,
},
}; };
}
for (const chatCompletionSource of Object.values(chat_completion_sources)) {
if (CONNECT_API_MAP[chatCompletionSource]) continue;
CONNECT_API_MAP[chatCompletionSource] = {
selected: 'openai',
button: '#api_button_openai',
source: chatCompletionSource,
};
}
async function selectContextCallback(_, name) { async function selectContextCallback(_, name) {
if (!name) { if (!name) {

View File

@@ -14,6 +14,7 @@ import {
substituteParamsExtended, substituteParamsExtended,
generateRaw, generateRaw,
getMaxContextSize, getMaxContextSize,
setExtensionPrompt,
} from '../../../script.js'; } from '../../../script.js';
import { is_group_generating, selected_group } from '../../group-chats.js'; import { is_group_generating, selected_group } from '../../group-chats.js';
import { loadMovingUIState } from '../../power-user.js'; import { loadMovingUIState } from '../../power-user.js';
@@ -73,6 +74,7 @@ const defaultSettings = {
template: defaultTemplate, template: defaultTemplate,
position: extension_prompt_types.IN_PROMPT, position: extension_prompt_types.IN_PROMPT,
role: extension_prompt_roles.SYSTEM, role: extension_prompt_roles.SYSTEM,
scan: false,
depth: 2, depth: 2,
promptWords: 200, promptWords: 200,
promptMinWords: 25, promptMinWords: 25,
@@ -122,6 +124,7 @@ function loadSettings() {
$(`input[name="memory_prompt_builder"][value="${extension_settings.memory.prompt_builder}"]`).prop('checked', true).trigger('input'); $(`input[name="memory_prompt_builder"][value="${extension_settings.memory.prompt_builder}"]`).prop('checked', true).trigger('input');
$('#memory_override_response_length').val(extension_settings.memory.overrideResponseLength).trigger('input'); $('#memory_override_response_length').val(extension_settings.memory.overrideResponseLength).trigger('input');
$('#memory_max_messages_per_request').val(extension_settings.memory.maxMessagesPerRequest).trigger('input'); $('#memory_max_messages_per_request').val(extension_settings.memory.maxMessagesPerRequest).trigger('input');
$('#memory_include_wi_scan').prop('checked', extension_settings.memory.scan).trigger('input');
switchSourceControls(extension_settings.memory.source); switchSourceControls(extension_settings.memory.source);
} }
@@ -279,6 +282,13 @@ function onMemoryPositionChange(e) {
saveSettingsDebounced(); saveSettingsDebounced();
} }
function onMemoryIncludeWIScanInput() {
const value = !!$(this).prop('checked');
extension_settings.memory.scan = value;
reinsertMemory();
saveSettingsDebounced();
}
function onMemoryPromptWordsForceInput() { function onMemoryPromptWordsForceInput() {
const value = $(this).val(); const value = $(this).val();
extension_settings.memory.promptForceWords = Number(value); extension_settings.memory.promptForceWords = Number(value);
@@ -800,8 +810,7 @@ function reinsertMemory() {
* @param {number|null} index Index of the chat message to save the summary to. If null, the pre-last message is used. * @param {number|null} index Index of the chat message to save the summary to. If null, the pre-last message is used.
*/ */
function setMemoryContext(value, saveToMessage, index = null) { function setMemoryContext(value, saveToMessage, index = null) {
const context = getContext(); setExtensionPrompt(MODULE_NAME, formatMemoryValue(value), extension_settings.memory.position, extension_settings.memory.depth, extension_settings.memory.scan, extension_settings.memory.role);
context.setExtensionPrompt(MODULE_NAME, formatMemoryValue(value), extension_settings.memory.position, extension_settings.memory.depth, false, extension_settings.memory.role);
$('#memory_contents').val(value); $('#memory_contents').val(value);
const summaryLog = value const summaryLog = value
@@ -809,6 +818,7 @@ function setMemoryContext(value, saveToMessage, index = null) {
: 'Summary has no content'; : 'Summary has no content';
console.debug(summaryLog); console.debug(summaryLog);
const context = getContext();
if (saveToMessage && context.chat.length) { if (saveToMessage && context.chat.length) {
const idx = index ?? context.chat.length - 2; const idx = index ?? context.chat.length - 2;
const mes = context.chat[idx < 0 ? 0 : idx]; const mes = context.chat[idx < 0 ? 0 : idx];
@@ -894,6 +904,7 @@ function setupListeners() {
$('#memory_prompt_words_auto').off('click').on('click', onPromptForceWordsAutoClick); $('#memory_prompt_words_auto').off('click').on('click', onPromptForceWordsAutoClick);
$('#memory_override_response_length').off('click').on('input', onOverrideResponseLengthInput); $('#memory_override_response_length').off('click').on('input', onOverrideResponseLengthInput);
$('#memory_max_messages_per_request').off('click').on('input', onMaxMessagesPerRequestInput); $('#memory_max_messages_per_request').off('click').on('input', onMaxMessagesPerRequestInput);
$('#memory_include_wi_scan').off('input').on('input', onMemoryIncludeWIScanInput);
$('#summarySettingsBlockToggle').off('click').on('click', function () { $('#summarySettingsBlockToggle').off('click').on('click', function () {
console.log('saw settings button click'); console.log('saw settings button click');
$('#summarySettingsBlock').slideToggle(200, 'swing'); //toggleClass("hidden"); $('#summarySettingsBlock').slideToggle(200, 'swing'); //toggleClass("hidden");

View File

@@ -109,7 +109,16 @@
<textarea id="memory_template" class="text_pole textarea_compact" rows="2" data-i18n="[placeholder]ext_sum_memory_template_placeholder" placeholder="&lcub;&lcub;summary&rcub;&rcub; will resolve to the current summary contents."></textarea> <textarea id="memory_template" class="text_pole textarea_compact" rows="2" data-i18n="[placeholder]ext_sum_memory_template_placeholder" placeholder="&lcub;&lcub;summary&rcub;&rcub; will resolve to the current summary contents."></textarea>
</div> </div>
<label for="memory_position" data-i18n="ext_sum_injection_position">Injection Position</label> <label for="memory_position" data-i18n="ext_sum_injection_position">Injection Position</label>
<label class="checkbox_label" for="memory_include_wi_scan" data-i18n="[title]ext_sum_include_wi_scan_desc" title="Include the latest summary in the WI scan.">
<input id="memory_include_wi_scan" type="checkbox" />
<span data-i18n="ext_sum_include_wi_scan">Include in World Info Scanning</span>
</label>
<div class="radio_group"> <div class="radio_group">
<label>
<input type="radio" name="memory_position" value="-1" />
<span data-i18n="None (not injected)">None (not injected)</span>
<i class="fa-solid fa-info-circle" title="The summary will not be injected into the prompt. You can still access it via the &lcub;&lcub;summary&rcub;&rcub; macro." data-i18n="[title]ext_sum_injection_position_none"></i>
</label>
<label> <label>
<input type="radio" name="memory_position" value="2" /> <input type="radio" name="memory_position" value="2" />
<span data-i18n="Before Main Prompt / Story String">Before Main Prompt / Story String</span> <span data-i18n="Before Main Prompt / Story String">Before Main Prompt / Story String</span>

View File

@@ -2968,7 +2968,13 @@ function setAvgBG() {
return ''; return '';
} }
async function setThemeCallback(_, text) { async function setThemeCallback(_, themeName) {
if (!themeName) {
// allow reporting of the theme name if called without args
// for use in ST Scripts via pipe
return power_user.theme;
}
// @ts-ignore // @ts-ignore
const fuse = new Fuse(themes, { const fuse = new Fuse(themes, {
keys: [ keys: [
@@ -2976,12 +2982,12 @@ async function setThemeCallback(_, text) {
], ],
}); });
const results = fuse.search(text); const results = fuse.search(themeName);
console.debug('Theme fuzzy search results for ' + text, results); console.debug('Theme fuzzy search results for ' + themeName, results);
const theme = results[0]?.item; const theme = results[0]?.item;
if (!theme) { if (!theme) {
toastr.warning(`Could not find theme with name: ${text}`); toastr.warning(`Could not find theme with name: ${themeName}`);
return; return;
} }
@@ -4056,13 +4062,30 @@ $(document).ready(() => {
callback: setThemeCallback, callback: setThemeCallback,
unnamedArgumentList: [ unnamedArgumentList: [
SlashCommandArgument.fromProps({ SlashCommandArgument.fromProps({
description: 'name', description: 'theme name',
typeList: [ARGUMENT_TYPE.STRING], typeList: [ARGUMENT_TYPE.STRING],
isRequired: true,
enumProvider: () => themes.map(theme => new SlashCommandEnumValue(theme.name)), enumProvider: () => themes.map(theme => new SlashCommandEnumValue(theme.name)),
}), }),
], ],
helpString: 'sets a UI theme by name', helpString: `
<div>
Sets a UI theme by name.
</div>
<div>
If no theme name is is provided, this will return the currently active theme.
</div>
<div>
<strong>Example:</strong>
<ul>
<li>
<pre><code>/theme Cappuccino</code></pre>
</li>
<li>
<pre><code>/theme</code></pre>
</li>
</ul>
</div>
`,
})); }));
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
name: 'movingui', name: 'movingui',

View File

@@ -139,9 +139,8 @@ export function initDefaultSlashCommands() {
returns: 'the current background', returns: 'the current background',
unnamedArgumentList: [ unnamedArgumentList: [
SlashCommandArgument.fromProps({ SlashCommandArgument.fromProps({
description: 'filename', description: 'background filename',
typeList: [ARGUMENT_TYPE.STRING], typeList: [ARGUMENT_TYPE.STRING],
isRequired: true,
enumProvider: () => [...document.querySelectorAll('.bg_example')] enumProvider: () => [...document.querySelectorAll('.bg_example')]
.map(it => new SlashCommandEnumValue(it.getAttribute('bgfile'))) .map(it => new SlashCommandEnumValue(it.getAttribute('bgfile')))
.filter(it => it.value?.length), .filter(it => it.value?.length),
@@ -151,12 +150,18 @@ export function initDefaultSlashCommands() {
<div> <div>
Sets a background according to the provided filename. Partial names allowed. Sets a background according to the provided filename. Partial names allowed.
</div> </div>
<div>
If no background is provided, this will return the currently selected background.
</div>
<div> <div>
<strong>Example:</strong> <strong>Example:</strong>
<ul> <ul>
<li> <li>
<pre><code>/bg beach.jpg</code></pre> <pre><code>/bg beach.jpg</code></pre>
</li> </li>
<li>
<pre><code>/bg</code></pre>
</li>
</ul> </ul>
</div> </div>
`, `,
@@ -1356,7 +1361,7 @@ export function initDefaultSlashCommands() {
enumProvider: commonEnumProviders.injects, enumProvider: commonEnumProviders.injects,
}), }),
new SlashCommandNamedArgument( new SlashCommandNamedArgument(
'position', 'injection position', [ARGUMENT_TYPE.STRING], false, false, 'after', ['before', 'after', 'chat'], 'position', 'injection position', [ARGUMENT_TYPE.STRING], false, false, 'after', ['before', 'after', 'chat', 'none'],
), ),
new SlashCommandNamedArgument( new SlashCommandNamedArgument(
'depth', 'injection depth', [ARGUMENT_TYPE.NUMBER], false, false, '4', 'depth', 'injection depth', [ARGUMENT_TYPE.NUMBER], false, false, '4',
@@ -1384,7 +1389,7 @@ export function initDefaultSlashCommands() {
'text', [ARGUMENT_TYPE.STRING], false, 'text', [ARGUMENT_TYPE.STRING], false,
), ),
], ],
helpString: 'Injects a text into the LLM prompt for the current chat. Requires a unique injection ID. Positions: "before" main prompt, "after" main prompt, in-"chat" (default: after). Depth: injection depth for the prompt (default: 4). Role: role for in-chat injections (default: system). Scan: include injection content into World Info scans (default: false).', helpString: 'Injects a text into the LLM prompt for the current chat. Requires a unique injection ID. Positions: "before" main prompt, "after" main prompt, in-"chat", hidden with "none" (default: after). Depth: injection depth for the prompt (default: 4). Role: role for in-chat injections (default: system). Scan: include injection content into World Info scans (default: false). Hidden injects in "none" position are not inserted into the prompt but can be used for triggering WI entries.',
})); }));
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
name: 'listinjects', name: 'listinjects',
@@ -1486,6 +1491,7 @@ function injectCallback(args, value) {
'before': extension_prompt_types.BEFORE_PROMPT, 'before': extension_prompt_types.BEFORE_PROMPT,
'after': extension_prompt_types.IN_PROMPT, 'after': extension_prompt_types.IN_PROMPT,
'chat': extension_prompt_types.IN_CHAT, 'chat': extension_prompt_types.IN_CHAT,
'none': extension_prompt_types.NONE,
}; };
const roles = { const roles = {
'system': extension_prompt_roles.SYSTEM, 'system': extension_prompt_roles.SYSTEM,
@@ -2846,7 +2852,6 @@ export async function sendMessageAs(args, text) {
if (args.name) { if (args.name) {
name = args.name.trim(); name = args.name.trim();
mesText = text.trim();
if (!name && !text) { if (!name && !text) {
toastr.warning('You must specify a name and text to send as'); toastr.warning('You must specify a name and text to send as');
@@ -2859,7 +2864,13 @@ export async function sendMessageAs(args, text) {
localStorage.setItem(namelessWarningKey, 'true'); localStorage.setItem(namelessWarningKey, 'true');
} }
name = name2; name = name2;
if (!text) {
toastr.warning('You must specify text to send as');
return '';
} }
}
mesText = text.trim();
// Requires a regex check after the slash command is pushed to output // Requires a regex check after the slash command is pushed to output
mesText = getRegexedString(mesText, regex_placement.SLASH_COMMAND, { characterOverride: name }); mesText = getRegexedString(mesText, regex_placement.SLASH_COMMAND, { characterOverride: name });

View File

@@ -1367,27 +1367,8 @@ function makeTagListDraggable(tagContainer) {
const id = $(tagElement).attr('id'); const id = $(tagElement).attr('id');
const tag = tags.find(x => x.id === id); const tag = tags.find(x => x.id === id);
// Fix the defined colors, because if there is no color set, they seem to get automatically set to black
// based on the color picker after drag&drop, even if there was no color chosen. We just set them back.
const color = $(tagElement).find('.tagColorPickerHolder .tag-color').attr('color');
const color2 = $(tagElement).find('.tagColorPicker2Holder .tag-color2').attr('color');
if (color === '' || color === undefined) {
tag.color = '';
fixColor('background-color', tag.color);
}
if (color2 === '' || color2 === undefined) {
tag.color2 = '';
fixColor('color', tag.color2);
}
// Update the sort order // Update the sort order
tag.sort_order = i; tag.sort_order = i;
function fixColor(property, color) {
$(tagElement).find('.tag_view_name').css(property, color);
$(`.tag[id="${id}"]`).css(property, color);
$(`.bogus_folder_select[tagid="${id}"] .avatar`).css(property, color);
}
}); });
// If tags were dragged manually, we have to disable auto sorting // If tags were dragged manually, we have to disable auto sorting

View File

@@ -1,6 +1,6 @@
<div id="tabby_downloader_popup"> <div id="tabby_downloader_popup">
<div> <div>
<h3><strong data-i18n="">Download Model</strong> <h3><strong data-i18n="Download Model">Download Model</strong>
<a href="https://github.com/theroyallab/async-hf-downloader" class="notes-link" target="_blank"> <a href="https://github.com/theroyallab/async-hf-downloader" class="notes-link" target="_blank">
<span class="note-link-span">?</span> <span class="note-link-span">?</span>
</a> </a>

View File

@@ -31,7 +31,7 @@
<h3 data-i18n="Confused or lost?">Confused or lost?</h3> <h3 data-i18n="Confused or lost?">Confused or lost?</h3>
<ul> <ul>
<li> <li>
<span class="note-link-span"><a class="fa-solid fa-circle-question" target="_blank" href="https://docs.sillytavern.app/" data-i18n=""></a></span> - <span data-i18n="click these icons!">click these icons!</span> <span class="note-link-span"><a class="fa-solid fa-circle-question" target="_blank" href="https://docs.sillytavern.app/"></a></span> - <span data-i18n="click these icons!">click these icons!</span>
</li> </li>
<li> <li>
<span data-i18n="Enter">Enter </span><code>/?</code><span data-i18n="in the chat bar"> in the chat bar</span> <span data-i18n="Enter">Enter </span><code>/?</code><span data-i18n="in the chat bar"> in the chat bar</span>