mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge branch 'staging' into wi-processing-refactoring
This commit is contained in:
@ -30,7 +30,7 @@ import { SlashCommand } from '../../slash-commands/SlashCommand.js';
|
||||
import { ARGUMENT_TYPE, SlashCommandArgument, SlashCommandNamedArgument } from '../../slash-commands/SlashCommandArgument.js';
|
||||
import { debounce_timeout } from '../../constants.js';
|
||||
import { SlashCommandEnumValue } from '../../slash-commands/SlashCommandEnumValue.js';
|
||||
import { POPUP_TYPE, callGenericPopup } from '../../popup.js';
|
||||
import { POPUP_TYPE, Popup, callGenericPopup } from '../../popup.js';
|
||||
export { MODULE_NAME };
|
||||
|
||||
const MODULE_NAME = 'sd';
|
||||
@ -3150,7 +3150,12 @@ async function onComfyOpenWorkflowEditorClick() {
|
||||
}),
|
||||
})).json();
|
||||
const editorHtml = $(await $.get('scripts/extensions/stable-diffusion/comfyWorkflowEditor.html'));
|
||||
const popupResult = callGenericPopup(editorHtml, POPUP_TYPE.CONFIRM, '', { okButton: 'Save', cancelButton: 'Cancel', wide: true, large: true });
|
||||
const saveValue = (/** @type {Popup} */ _popup) => {
|
||||
workflow = $('#sd_comfy_workflow_editor_workflow').val().toString();
|
||||
return true;
|
||||
};
|
||||
const popup = new Popup(editorHtml, POPUP_TYPE.CONFIRM, '', { okButton: 'Save', cancelButton: 'Cancel', wide: true, large: true, onClosing: saveValue });
|
||||
const popupResult = popup.show();
|
||||
const checkPlaceholders = () => {
|
||||
workflow = $('#sd_comfy_workflow_editor_workflow').val().toString();
|
||||
$('.sd_comfy_workflow_editor_placeholder_list > li[data-placeholder]').each(function (idx) {
|
||||
@ -3219,7 +3224,7 @@ async function onComfyOpenWorkflowEditorClick() {
|
||||
headers: getRequestHeaders(),
|
||||
body: JSON.stringify({
|
||||
file_name: extension_settings.sd.comfy_workflow,
|
||||
workflow: $('#sd_comfy_workflow_editor_workflow').val().toString(),
|
||||
workflow: workflow,
|
||||
}),
|
||||
});
|
||||
if (!response.ok) {
|
||||
|
@ -7,7 +7,7 @@ import { kai_flags } from './kai-settings.js';
|
||||
import { textgen_types, textgenerationwebui_settings as textgen_settings, getTextGenServer, getTextGenModel } from './textgen-settings.js';
|
||||
import { getCurrentDreamGenModelTokenizer, getCurrentOpenRouterModelTokenizer, openRouterModels } from './textgen-models.js';
|
||||
|
||||
const { OOBA, TABBY, KOBOLDCPP, APHRODITE, LLAMACPP, OPENROUTER, DREAMGEN } = textgen_types;
|
||||
const { OOBA, TABBY, KOBOLDCPP, VLLM, APHRODITE, LLAMACPP, OPENROUTER, DREAMGEN } = textgen_types;
|
||||
|
||||
export const CHARACTERS_PER_TOKEN_RATIO = 3.35;
|
||||
const TOKENIZER_WARNING_KEY = 'tokenizationWarningShown';
|
||||
@ -39,7 +39,7 @@ export const SENTENCEPIECE_TOKENIZERS = [
|
||||
//tokenizers.NERD2,
|
||||
];
|
||||
|
||||
export const TEXTGEN_TOKENIZERS = [OOBA, TABBY, KOBOLDCPP, LLAMACPP, APHRODITE];
|
||||
export const TEXTGEN_TOKENIZERS = [OOBA, TABBY, KOBOLDCPP, LLAMACPP, VLLM, APHRODITE];
|
||||
|
||||
const TOKENIZER_URLS = {
|
||||
[tokenizers.GPT2]: {
|
||||
@ -769,6 +769,7 @@ function getTextgenAPITokenizationParams(str) {
|
||||
api_type: textgen_settings.type,
|
||||
url: getTextGenServer(),
|
||||
legacy_api: textgen_settings.legacy_api && (textgen_settings.type === OOBA || textgen_settings.type === APHRODITE),
|
||||
vllm_model: textgen_settings.vllm_model,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ export {
|
||||
world_info_depth,
|
||||
world_info_min_activations,
|
||||
world_info_min_activations_depth_max,
|
||||
world_info_include_names,
|
||||
world_info_recursive,
|
||||
world_info_overflow_alert,
|
||||
world_info_case_sensitive,
|
||||
@ -83,6 +84,7 @@ let world_info_min_activations = 0; // if > 0, will continue seeking chat until
|
||||
let world_info_min_activations_depth_max = 0; // used when (world_info_min_activations > 0)
|
||||
|
||||
let world_info_budget = 25;
|
||||
let world_info_include_names = true;
|
||||
let world_info_recursive = false;
|
||||
let world_info_overflow_alert = false;
|
||||
let world_info_case_sensitive = false;
|
||||
@ -718,6 +720,7 @@ export function getWorldInfoSettings() {
|
||||
world_info_min_activations,
|
||||
world_info_min_activations_depth_max,
|
||||
world_info_budget,
|
||||
world_info_include_names,
|
||||
world_info_recursive,
|
||||
world_info_overflow_alert,
|
||||
world_info_case_sensitive,
|
||||
@ -747,7 +750,7 @@ const worldInfoCache = new Map();
|
||||
|
||||
/**
|
||||
* Gets the world info based on chat messages.
|
||||
* @param {string[]} chat The chat messages to scan.
|
||||
* @param {string[]} chat The chat messages to scan, in reverse order.
|
||||
* @param {number} maxContext The maximum context size of the generation.
|
||||
* @param {boolean} isDryRun If true, the function will not emit any events.
|
||||
* @typedef {{worldInfoString: string, worldInfoBefore: string, worldInfoAfter: string, worldInfoExamples: any[], worldInfoDepth: any[]}} WIPromptResult
|
||||
@ -784,6 +787,8 @@ function setWorldInfoSettings(settings, data) {
|
||||
world_info_min_activations_depth_max = Number(settings.world_info_min_activations_depth_max);
|
||||
if (settings.world_info_budget !== undefined)
|
||||
world_info_budget = Number(settings.world_info_budget);
|
||||
if (settings.world_info_include_names !== undefined)
|
||||
world_info_include_names = Boolean(settings.world_info_include_names);
|
||||
if (settings.world_info_recursive !== undefined)
|
||||
world_info_recursive = Boolean(settings.world_info_recursive);
|
||||
if (settings.world_info_overflow_alert !== undefined)
|
||||
@ -833,6 +838,7 @@ function setWorldInfoSettings(settings, data) {
|
||||
$('#world_info_budget_counter').val(world_info_budget);
|
||||
$('#world_info_budget').val(world_info_budget);
|
||||
|
||||
$('#world_info_include_names').prop('checked', world_info_include_names);
|
||||
$('#world_info_recursive').prop('checked', world_info_recursive);
|
||||
$('#world_info_overflow_alert').prop('checked', world_info_overflow_alert);
|
||||
$('#world_info_case_sensitive').prop('checked', world_info_case_sensitive);
|
||||
@ -3542,7 +3548,7 @@ export async function getSortedEntries() {
|
||||
|
||||
/**
|
||||
* Performs a scan on the chat and returns the world info activated.
|
||||
* @param {string[]} chat The chat messages to scan.
|
||||
* @param {string[]} chat The chat messages to scan, in reverse order.
|
||||
* @param {number} maxContext The maximum context size of the generation.
|
||||
* @param {boolean} isDryRun Whether to perform a dry run.
|
||||
* @typedef {{ worldInfoBefore: string, worldInfoAfter: string, EMEntries: any[], WIDepthEntries: any[], allActivatedEntries: Set<any> }} WIActivated
|
||||
@ -4637,6 +4643,11 @@ jQuery(() => {
|
||||
saveSettings();
|
||||
});
|
||||
|
||||
$('#world_info_include_names').on('input', function () {
|
||||
world_info_include_names = !!$(this).prop('checked');
|
||||
saveSettings();
|
||||
});
|
||||
|
||||
$('#world_info_recursive').on('input', function () {
|
||||
world_info_recursive = !!$(this).prop('checked');
|
||||
saveSettings();
|
||||
|
Reference in New Issue
Block a user