Merge pull request #3410 from bmen25124/export_some_world_methods New exported methods: loadWorldInfo(), saveWorldInfo(), updateWorldIn…

aecbc48d43e5c12bc888823d7da555e7dfdf286a

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
2 files changed, +7 -2Showing whitespace changes
public/scripts/st-context.js+5 -0
@@ -70,6 +70,7 @@ import { tokenizers, getTextTokens, getTokenCount, getTokenCountAsync, getTokeni
70import { ToolManager } from './tool-calling.js';70import { ToolManager } from './tool-calling.js';
71import { timestampToMoment, uuidv4 } from './utils.js';71import { timestampToMoment, uuidv4 } from './utils.js';
72import { getGlobalVariable, getLocalVariable, setGlobalVariable, setLocalVariable } from './variables.js';72import { getGlobalVariable, getLocalVariable, setGlobalVariable, setLocalVariable } from './variables.js';
73import { convertCharacterBook, loadWorldInfo, saveWorldInfo, updateWorldInfoList } from './world-info.js';
7374
74export function getContext() {75export function getContext() {
75 return {76 return {
@@ -186,6 +187,10 @@ export function getContext() {
186 set: setGlobalVariable,187 set: setGlobalVariable,
187 },188 },
188 },189 },
190 loadWorldInfo,
191 saveWorldInfo,
192 updateWorldInfoList,
193 convertCharacterBook,
189 };194 };
190}195}
191196
public/scripts/world-info.js+2 -2
@@ -1708,7 +1708,7 @@ export async function loadWorldInfo(name) {
1708 return null;1708 return null;
1709}1709}
17101710
1711async function updateWorldInfoList() {1711export async function updateWorldInfoList() {
1712 const result = await fetch('/api/settings/get', {1712 const result = await fetch('/api/settings/get', {
1713 method: 'POST',1713 method: 'POST',
1714 headers: getRequestHeaders(),1714 headers: getRequestHeaders(),
@@ -4658,7 +4658,7 @@ function convertNovelLorebook(inputObj) {
4658 return outputObj;4658 return outputObj;
4659}4659}
46604660
4661function convertCharacterBook(characterBook) {4661export function convertCharacterBook(characterBook) {
4662 const result = { entries: {}, originalData: characterBook };4662 const result = { entries: {}, originalData: characterBook };
46634663
4664 characterBook.entries.forEach((entry, index) => {4664 characterBook.entries.forEach((entry, index) => {