diff --git a/server/src/browser-management/controller.ts b/server/src/browser-management/controller.ts index 8646a5cb..98962c1e 100644 --- a/server/src/browser-management/controller.ts +++ b/server/src/browser-management/controller.ts @@ -139,4 +139,19 @@ export const interpretWholeWorkflow = async() => { logger.log('error', `Cannot interpret the workflow: bad id ${id}.`); } }; + +/** + * Stops the interpretation of the current workflow in the active browser instance. + * If there is no active browser, the function logs an error. + * @returns {Promise} + * @category BrowserManagement-Controller + */ +export const stopRunningInterpretation = async() => { + const id = getActiveBrowserId(); + if (id) { + const browser = browserPool.getRemoteBrowser(id); + await browser?.stopCurrentInterpretation(); + } else { + logger.log('error', 'Cannot stop interpretation: No active browser or generator.'); + } };