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();
|
||||
// Add WI to prompt (and also inject WI to AN value via hijack)
|
||||
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
|
||||
addPersonaDescriptionExtensionPrompt();
|
||||
// Call combined AN into Generate
|
||||
|
@ -2592,14 +2601,6 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
|||
|
||||
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') {
|
||||
message_already_generated = '';
|
||||
setOpenAIMessages(coreChat);
|
||||
|
|
|
@ -46,7 +46,6 @@ import {
|
|||
} from "./secrets.js";
|
||||
|
||||
import {
|
||||
deepClone,
|
||||
delay,
|
||||
download,
|
||||
getFileText, getSortableDelay,
|
||||
|
@ -2398,7 +2397,7 @@ async function onExportPresetClick() {
|
|||
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.proxy_password;
|
||||
|
|
|
@ -24,7 +24,7 @@ import {
|
|||
textgenerationwebui_presets,
|
||||
textgenerationwebui_settings,
|
||||
} from "./textgen-settings.js";
|
||||
import { deepClone, download, parseJsonFile, waitUntilCondition } from "./utils.js";
|
||||
import { download, parseJsonFile, waitUntilCondition } from "./utils.js";
|
||||
|
||||
const presetManagers = {};
|
||||
|
||||
|
@ -236,11 +236,11 @@ class PresetManager {
|
|||
case "textgenerationwebui":
|
||||
return textgenerationwebui_settings;
|
||||
case "context":
|
||||
const context_preset = deepClone(power_user.context);
|
||||
const context_preset = structuredClone(power_user.context);
|
||||
context_preset['name'] = name || power_user.context.preset;
|
||||
return context_preset;
|
||||
case "instruct":
|
||||
const instruct_preset = deepClone(power_user.instruct);
|
||||
const instruct_preset = structuredClone(power_user.instruct);
|
||||
instruct_preset['name'] = name || power_user.instruct.preset;
|
||||
return instruct_preset;
|
||||
default:
|
||||
|
|
|
@ -988,12 +988,3 @@ export function uuidv4() {
|
|||
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 { 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 { NOTE_MODULE_NAME, metadata_keys, shouldWIAddPrompt } from "./authors-note.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}`);
|
||||
|
||||
// Need to deep clone the entries to avoid modifying the cached data
|
||||
return deepClone(entries);
|
||||
return structuredClone(entries);
|
||||
}
|
||||
catch (e) {
|
||||
console.error(e);
|
||||
|
|
Loading…
Reference in New Issue