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