mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add function to write extension fields to character cards.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { saveSettings, callPopup, substituteParams, getRequestHeaders, chat_metadata, this_chid, characters, saveCharacterDebounced, menu_type, eventSource, event_types, getExtensionPromptByName, saveMetadata, getCurrentChatId } from '../script.js';
|
||||
import { download, debounce, initScrollHeight, resetScrollHeight, parseJsonFile, extractDataFromPng, getFileBuffer, getCharaFilename, getSortableDelay, escapeRegex, PAGINATION_TEMPLATE, navigation_option, waitUntilCondition, isTrueBoolean } from './utils.js';
|
||||
import { download, debounce, initScrollHeight, resetScrollHeight, parseJsonFile, extractDataFromPng, getFileBuffer, getCharaFilename, getSortableDelay, escapeRegex, PAGINATION_TEMPLATE, navigation_option, waitUntilCondition, isTrueBoolean, setValueByPath } from './utils.js';
|
||||
import { extension_settings, getContext } from './extensions.js';
|
||||
import { NOTE_MODULE_NAME, metadata_keys, shouldWIAddPrompt } from './authors-note.js';
|
||||
import { registerSlashCommand } from './slash-commands.js';
|
||||
@@ -950,20 +950,7 @@ function setOriginalDataValue(data, uid, key, value) {
|
||||
return;
|
||||
}
|
||||
|
||||
const keyParts = key.split('.');
|
||||
let currentObject = originalEntry;
|
||||
|
||||
for (let i = 0; i < keyParts.length - 1; i++) {
|
||||
const part = keyParts[i];
|
||||
|
||||
if (!Object.hasOwn(currentObject, part)) {
|
||||
currentObject[part] = {};
|
||||
}
|
||||
|
||||
currentObject = currentObject[part];
|
||||
}
|
||||
|
||||
currentObject[keyParts[keyParts.length - 1]] = value;
|
||||
setValueByPath(originalEntry, key, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user