mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-15 11:40:44 +01:00
Extra fixes (#1185)
This commit is contained in:
parent
03e5ca054d
commit
bfda5a5492
@ -2568,6 +2568,15 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
|||||||
setFloatingPrompt();
|
setFloatingPrompt();
|
||||||
// Add WI to prompt (and also inject WI to AN value via hijack)
|
// Add WI to prompt (and also inject WI to AN value via hijack)
|
||||||
let { worldInfoString, worldInfoBefore, worldInfoAfter, worldInfoDepth } = await getWorldInfoPrompt(chat2, this_max_context);
|
let { worldInfoString, worldInfoBefore, worldInfoAfter, worldInfoDepth } = await getWorldInfoPrompt(chat2, this_max_context);
|
||||||
|
|
||||||
|
// Add all depth WI entries to prompt
|
||||||
|
if (Array.isArray(worldInfoDepth)) {
|
||||||
|
worldInfoDepth.forEach((e) => {
|
||||||
|
const joinedEntries = e.entries.join("\n");
|
||||||
|
setExtensionPrompt(`customDepthWI-${e.depth}`, joinedEntries, extension_prompt_types.IN_CHAT, e.depth)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Add persona description to prompt
|
// Add persona description to prompt
|
||||||
addPersonaDescriptionExtensionPrompt();
|
addPersonaDescriptionExtensionPrompt();
|
||||||
// Call combined AN into Generate
|
// Call combined AN into Generate
|
||||||
@ -2592,14 +2601,6 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
|||||||
|
|
||||||
const storyString = renderStoryString(storyStringParams);
|
const storyString = renderStoryString(storyStringParams);
|
||||||
|
|
||||||
// Add all depth WI entries to prompt
|
|
||||||
if (Array.isArray(worldInfoDepth)) {
|
|
||||||
worldInfoDepth.forEach((e) => {
|
|
||||||
const joinedEntries = e.entries.join("\n");
|
|
||||||
setExtensionPrompt(`customDepthWI-${e.depth}`, joinedEntries, extension_prompt_types.IN_CHAT, e.depth)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (main_api === 'openai') {
|
if (main_api === 'openai') {
|
||||||
message_already_generated = '';
|
message_already_generated = '';
|
||||||
setOpenAIMessages(coreChat);
|
setOpenAIMessages(coreChat);
|
||||||
|
@ -46,7 +46,6 @@ import {
|
|||||||
} from "./secrets.js";
|
} from "./secrets.js";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
deepClone,
|
|
||||||
delay,
|
delay,
|
||||||
download,
|
download,
|
||||||
getFileText, getSortableDelay,
|
getFileText, getSortableDelay,
|
||||||
@ -2398,7 +2397,7 @@ async function onExportPresetClick() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const preset = deepClone(openai_settings[openai_setting_names[oai_settings.preset_settings_openai]]);
|
const preset = structuredClone(openai_settings[openai_setting_names[oai_settings.preset_settings_openai]]);
|
||||||
|
|
||||||
delete preset.reverse_proxy;
|
delete preset.reverse_proxy;
|
||||||
delete preset.proxy_password;
|
delete preset.proxy_password;
|
||||||
|
@ -24,7 +24,7 @@ import {
|
|||||||
textgenerationwebui_presets,
|
textgenerationwebui_presets,
|
||||||
textgenerationwebui_settings,
|
textgenerationwebui_settings,
|
||||||
} from "./textgen-settings.js";
|
} from "./textgen-settings.js";
|
||||||
import { deepClone, download, parseJsonFile, waitUntilCondition } from "./utils.js";
|
import { download, parseJsonFile, waitUntilCondition } from "./utils.js";
|
||||||
|
|
||||||
const presetManagers = {};
|
const presetManagers = {};
|
||||||
|
|
||||||
@ -236,11 +236,11 @@ class PresetManager {
|
|||||||
case "textgenerationwebui":
|
case "textgenerationwebui":
|
||||||
return textgenerationwebui_settings;
|
return textgenerationwebui_settings;
|
||||||
case "context":
|
case "context":
|
||||||
const context_preset = deepClone(power_user.context);
|
const context_preset = structuredClone(power_user.context);
|
||||||
context_preset['name'] = name || power_user.context.preset;
|
context_preset['name'] = name || power_user.context.preset;
|
||||||
return context_preset;
|
return context_preset;
|
||||||
case "instruct":
|
case "instruct":
|
||||||
const instruct_preset = deepClone(power_user.instruct);
|
const instruct_preset = structuredClone(power_user.instruct);
|
||||||
instruct_preset['name'] = name || power_user.instruct.preset;
|
instruct_preset['name'] = name || power_user.instruct.preset;
|
||||||
return instruct_preset;
|
return instruct_preset;
|
||||||
default:
|
default:
|
||||||
|
@ -988,12 +988,3 @@ export function uuidv4() {
|
|||||||
return v.toString(16);
|
return v.toString(16);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Clones an object using JSON serialization.
|
|
||||||
* @param {any} obj The object to clone.
|
|
||||||
* @returns {any} A deep clone of the object.
|
|
||||||
*/
|
|
||||||
export function deepClone(obj) {
|
|
||||||
return JSON.parse(JSON.stringify(obj));
|
|
||||||
}
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { saveSettings, callPopup, substituteParams, getRequestHeaders, chat_metadata, this_chid, characters, saveCharacterDebounced, menu_type, eventSource, event_types } from "../script.js";
|
import { saveSettings, callPopup, substituteParams, getRequestHeaders, chat_metadata, this_chid, characters, saveCharacterDebounced, menu_type, eventSource, event_types } from "../script.js";
|
||||||
import { download, debounce, initScrollHeight, resetScrollHeight, parseJsonFile, extractDataFromPng, getFileBuffer, getCharaFilename, deepClone, getSortableDelay, escapeRegex, PAGINATION_TEMPLATE, navigation_option } from "./utils.js";
|
import { download, debounce, initScrollHeight, resetScrollHeight, parseJsonFile, extractDataFromPng, getFileBuffer, getCharaFilename, getSortableDelay, escapeRegex, PAGINATION_TEMPLATE, navigation_option } from "./utils.js";
|
||||||
import { getContext } from "./extensions.js";
|
import { getContext } from "./extensions.js";
|
||||||
import { NOTE_MODULE_NAME, metadata_keys, shouldWIAddPrompt } from "./authors-note.js";
|
import { NOTE_MODULE_NAME, metadata_keys, shouldWIAddPrompt } from "./authors-note.js";
|
||||||
import { registerSlashCommand } from "./slash-commands.js";
|
import { registerSlashCommand } from "./slash-commands.js";
|
||||||
@ -1119,7 +1119,7 @@ async function getSortedEntries() {
|
|||||||
console.debug(`Sorted ${entries.length} world lore entries using strategy ${world_info_character_strategy}`);
|
console.debug(`Sorted ${entries.length} world lore entries using strategy ${world_info_character_strategy}`);
|
||||||
|
|
||||||
// Need to deep clone the entries to avoid modifying the cached data
|
// Need to deep clone the entries to avoid modifying the cached data
|
||||||
return deepClone(entries);
|
return structuredClone(entries);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user