Merge pull request #3744 from bmen25124/updateEditor_export_new_parm Exported reloadEditor

a8f1bf7a17e69f6cbbf325f3dc2d0c4b9b96293b

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
2 files changed, +4 -3Showing whitespace changes
public/scripts/st-context.js+2 -1
@@ -79,7 +79,7 @@ import { ToolManager } from './tool-calling.js';
79import { accountStorage } from './util/AccountStorage.js';79import { accountStorage } from './util/AccountStorage.js';
80import { timestampToMoment, uuidv4 } from './utils.js';80import { timestampToMoment, uuidv4 } from './utils.js';
81import { getGlobalVariable, getLocalVariable, setGlobalVariable, setLocalVariable } from './variables.js';81import { getGlobalVariable, getLocalVariable, setGlobalVariable, setLocalVariable } from './variables.js';
82import { convertCharacterBook, getWorldInfoPrompt, loadWorldInfo, saveWorldInfo, updateWorldInfoList } from './world-info.js';82import { convertCharacterBook, getWorldInfoPrompt, loadWorldInfo, reloadEditor, saveWorldInfo, updateWorldInfoList } from './world-info.js';
83import { ChatCompletionService, TextCompletionService } from './custom-request.js';83import { ChatCompletionService, TextCompletionService } from './custom-request.js';
84import { ConnectionManagerRequestService } from './extensions/shared.js';84import { ConnectionManagerRequestService } from './extensions/shared.js';
85import { updateReasoningUI, parseReasoningFromString } from './reasoning.js';85import { 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,
public/scripts/world-info.js+2 -2
@@ -908,13 +908,12 @@ export function setWorldInfoSettings(settings, data) {
908 registerWorldInfoSlashCommands();908 registerWorldInfoSlashCommands();
909}909}
910910
911function registerWorldInfoSlashCommands() {
912/**911/**
913 * Reloads the editor with the specified world info file912 * Reloads the editor with the specified world info file
914 * @param {string} file - The file to load in the editor913 * @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 selected914 * @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) {916export 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}
924923
924function 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.