Exported reloadEditor
| @@ -79,7 +79,7 @@ import { ToolManager } from './tool-calling.js'; | |||
| 79 | import { accountStorage } from './util/AccountStorage.js'; | 79 | import { accountStorage } from './util/AccountStorage.js'; |
| 80 | import { timestampToMoment, uuidv4 } from './utils.js'; | 80 | import { timestampToMoment, uuidv4 } from './utils.js'; |
| 81 | import { getGlobalVariable, getLocalVariable, setGlobalVariable, setLocalVariable } from './variables.js'; | 81 | import { getGlobalVariable, getLocalVariable, setGlobalVariable, setLocalVariable } from './variables.js'; |
| 82 | import { convertCharacterBook, getWorldInfoPrompt, loadWorldInfo, saveWorldInfo, updateWorldInfoList } from './world-info.js'; | 82 | import { convertCharacterBook, getWorldInfoPrompt, loadWorldInfo, reloadEditor, saveWorldInfo, updateWorldInfoList } from './world-info.js'; |
| 83 | import { ChatCompletionService, TextCompletionService } from './custom-request.js'; | 83 | import { ChatCompletionService, TextCompletionService } from './custom-request.js'; |
| 84 | import { ConnectionManagerRequestService } from './extensions/shared.js'; | 84 | import { ConnectionManagerRequestService } from './extensions/shared.js'; |
| 85 | import { updateReasoningUI, parseReasoningFromString } from './reasoning.js'; | 85 | import { updateReasoningUI, parseReasoningFromString } from './reasoning.js'; |
| @@ -207,6 +207,7 @@ export function getContext() { | |||
| 207 | }, | 207 | }, |
| 208 | loadWorldInfo, | 208 | loadWorldInfo, |
| 209 | saveWorldInfo, | 209 | saveWorldInfo, |
| 210 | reloadWorldInfoEditor: reloadEditor, | ||
| 210 | updateWorldInfoList, | 211 | updateWorldInfoList, |
| 211 | convertCharacterBook, | 212 | convertCharacterBook, |
| 212 | getWorldInfoPrompt, | 213 | getWorldInfoPrompt, |
| @@ -908,13 +908,12 @@ export function setWorldInfoSettings(settings, data) { | |||
| 908 | registerWorldInfoSlashCommands(); | 908 | registerWorldInfoSlashCommands(); |
| 909 | } | 909 | } |
| 910 | 910 | ||
| 911 | function registerWorldInfoSlashCommands() { | ||
| 912 | /** | 911 | /** |
| 913 | * Reloads the editor with the specified world info file | 912 | * Reloads the editor with the specified world info file |
| 914 | * @param {string} file - The file to load in the editor | 913 | * @param {string} file - The file to load in the editor |
| 915 | * @param {boolean} [loadIfNotSelected=false] - Indicates whether to load the file even if it's not currently selected | 914 | * @param {boolean} [loadIfNotSelected=false] - Indicates whether to load the file even if it's not currently selected |
| 916 | */ | 915 | */ |
| 917 | function reloadEditor(file, loadIfNotSelected = false) { | 916 | export function reloadEditor(file, loadIfNotSelected = false) { |
| 918 | const currentIndex = Number($('#world_editor_select').val()); | 917 | const currentIndex = Number($('#world_editor_select').val()); |
| 919 | const selectedIndex = world_names.indexOf(file); | 918 | const selectedIndex = world_names.indexOf(file); |
| 920 | if (selectedIndex !== -1 && (loadIfNotSelected || currentIndex === selectedIndex)) { | 919 | if (selectedIndex !== -1 && (loadIfNotSelected || currentIndex === selectedIndex)) { |
| @@ -922,6 +921,7 @@ function registerWorldInfoSlashCommands() { | |||
| 922 | } | 921 | } |
| 923 | } | 922 | } |
| 924 | 923 | ||
| 924 | function registerWorldInfoSlashCommands() { | ||
| 925 | /** | 925 | /** |
| 926 | * Gets a *rough* approximation of the current chat context. | 926 | * Gets a *rough* approximation of the current chat context. |
| 927 | * Normally, it is provided externally by the prompt builder. | 927 | * Normally, it is provided externally by the prompt builder. |