New exported methods: loadWorldInfo(), saveWorldInfo(), updateWorldInfoList(), convertCharacterBook()
| @@ -70,6 +70,7 @@ import { tokenizers, getTextTokens, getTokenCount, getTokenCountAsync, getTokeni | |||
| 70 | import { ToolManager } from './tool-calling.js'; | 70 | import { ToolManager } from './tool-calling.js'; |
| 71 | import { timestampToMoment, uuidv4 } from './utils.js'; | 71 | import { timestampToMoment, uuidv4 } from './utils.js'; |
| 72 | import { getGlobalVariable, getLocalVariable, setGlobalVariable, setLocalVariable } from './variables.js'; | 72 | import { getGlobalVariable, getLocalVariable, setGlobalVariable, setLocalVariable } from './variables.js'; |
| 73 | import { convertCharacterBook, loadWorldInfo, saveWorldInfo, updateWorldInfoList } from './world-info.js'; | ||
| 73 | 74 | ||
| 74 | export function getContext() { | 75 | export 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 | } |
| 191 | 196 | ||
| @@ -1708,7 +1708,7 @@ export async function loadWorldInfo(name) { | |||
| 1708 | return null; | 1708 | return null; |
| 1709 | } | 1709 | } |
| 1710 | 1710 | ||
| 1711 | async function updateWorldInfoList() { | 1711 | export 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 | } |
| 4660 | 4660 | ||
| 4661 | function convertCharacterBook(characterBook) { | 4661 | export function convertCharacterBook(characterBook) { |
| 4662 | const result = { entries: {}, originalData: characterBook }; | 4662 | const result = { entries: {}, originalData: characterBook }; |
| 4663 | 4663 | ||
| 4664 | characterBook.entries.forEach((entry, index) => { | 4664 | characterBook.entries.forEach((entry, index) => { |