Merge pull request #3410 from bmen25124/export_some_world_methods

New exported methods: loadWorldInfo(), saveWorldInfo(), updateWorldIn…
This commit is contained in:
Cohee
2025-02-02 15:44:55 +02:00
committed by GitHub
2 changed files with 7 additions and 2 deletions

View File

@@ -70,6 +70,7 @@ import { tokenizers, getTextTokens, getTokenCount, getTokenCountAsync, getTokeni
import { ToolManager } from './tool-calling.js';
import { timestampToMoment, uuidv4 } from './utils.js';
import { getGlobalVariable, getLocalVariable, setGlobalVariable, setLocalVariable } from './variables.js';
import { convertCharacterBook, loadWorldInfo, saveWorldInfo, updateWorldInfoList } from './world-info.js';
export function getContext() {
return {
@@ -186,6 +187,10 @@ export function getContext() {
set: setGlobalVariable,
},
},
loadWorldInfo,
saveWorldInfo,
updateWorldInfoList,
convertCharacterBook,
};
}

View File

@@ -1708,7 +1708,7 @@ export async function loadWorldInfo(name) {
return null;
}
async function updateWorldInfoList() {
export async function updateWorldInfoList() {
const result = await fetch('/api/settings/get', {
method: 'POST',
headers: getRequestHeaders(),
@@ -4658,7 +4658,7 @@ function convertNovelLorebook(inputObj) {
return outputObj;
}
function convertCharacterBook(characterBook) {
export function convertCharacterBook(characterBook) {
const result = { entries: {}, originalData: characterBook };
characterBook.entries.forEach((entry, index) => {