mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge pull request #3410 from bmen25124/export_some_world_methods
New exported methods: loadWorldInfo(), saveWorldInfo(), updateWorldIn…
This commit is contained in:
@@ -70,6 +70,7 @@ import { tokenizers, getTextTokens, getTokenCount, getTokenCountAsync, getTokeni
|
|||||||
import { ToolManager } from './tool-calling.js';
|
import { ToolManager } from './tool-calling.js';
|
||||||
import { timestampToMoment, uuidv4 } from './utils.js';
|
import { timestampToMoment, uuidv4 } from './utils.js';
|
||||||
import { getGlobalVariable, getLocalVariable, setGlobalVariable, setLocalVariable } from './variables.js';
|
import { getGlobalVariable, getLocalVariable, setGlobalVariable, setLocalVariable } from './variables.js';
|
||||||
|
import { convertCharacterBook, loadWorldInfo, saveWorldInfo, updateWorldInfoList } from './world-info.js';
|
||||||
|
|
||||||
export function getContext() {
|
export function getContext() {
|
||||||
return {
|
return {
|
||||||
@@ -186,6 +187,10 @@ export function getContext() {
|
|||||||
set: setGlobalVariable,
|
set: setGlobalVariable,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
loadWorldInfo,
|
||||||
|
saveWorldInfo,
|
||||||
|
updateWorldInfoList,
|
||||||
|
convertCharacterBook,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1708,7 +1708,7 @@ export async function loadWorldInfo(name) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateWorldInfoList() {
|
export async function updateWorldInfoList() {
|
||||||
const result = await fetch('/api/settings/get', {
|
const result = await fetch('/api/settings/get', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: getRequestHeaders(),
|
headers: getRequestHeaders(),
|
||||||
@@ -4658,7 +4658,7 @@ function convertNovelLorebook(inputObj) {
|
|||||||
return outputObj;
|
return outputObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
function convertCharacterBook(characterBook) {
|
export function convertCharacterBook(characterBook) {
|
||||||
const result = { entries: {}, originalData: characterBook };
|
const result = { entries: {}, originalData: characterBook };
|
||||||
|
|
||||||
characterBook.entries.forEach((entry, index) => {
|
characterBook.entries.forEach((entry, index) => {
|
||||||
|
Reference in New Issue
Block a user