diff --git a/src/autometabuilder/web/server.py b/src/autometabuilder/web/server.py
index 1ea3cbe..6586f03 100644
--- a/src/autometabuilder/web/server.py
+++ b/src/autometabuilder/web/server.py
@@ -162,6 +162,19 @@ def get_metadata():
with open(metadata_path, "r", encoding="utf-8") as f:
return json.load(f)
+def get_ui_assets():
+ assets_path = os.path.join(os.path.dirname(__file__), "ui_assets.json")
+ if not os.path.exists(assets_path):
+ return {"core_scripts": [], "workflow_scripts": [], "page_scripts": []}
+ try:
+ with open(assets_path, "r", encoding="utf-8") as f:
+ data = json.load(f)
+ except json.JSONDecodeError:
+ return {"core_scripts": [], "workflow_scripts": [], "page_scripts": []}
+ if not isinstance(data, dict):
+ return {"core_scripts": [], "workflow_scripts": [], "page_scripts": []}
+ return data
+
def load_translation_file(messages_map, lang):
pkg_dir = os.path.dirname(os.path.dirname(__file__))
messages_file = messages_map.get(lang, f"messages_{lang}.json")
@@ -285,6 +298,7 @@ async def read_item(request: Request, username: str = Depends(get_current_user))
env_vars = get_env_vars()
translations = get_translations()
metadata = get_metadata()
+ ui_assets = get_ui_assets()
prompt_content = get_prompt_content()
workflow_content = get_workflow_content()
is_running = bot_process is not None or mock_running
@@ -300,6 +314,7 @@ async def read_item(request: Request, username: str = Depends(get_current_user))
"env_vars": env_vars,
"translations": translations,
"metadata": metadata,
+ "ui_assets": ui_assets,
"prompt_content": prompt_content,
"workflow_content": workflow_content,
"is_running": is_running,
diff --git a/src/autometabuilder/web/templates/base.html b/src/autometabuilder/web/templates/base.html
index db63e52..8d81c90 100644
--- a/src/autometabuilder/web/templates/base.html
+++ b/src/autometabuilder/web/templates/base.html
@@ -34,17 +34,7 @@
- {% set core_scripts = [
- '/static/js/app_context.js',
- '/static/js/plugin_registry.js',
- '/static/js/services/toast.js',
- '/static/js/plugins/theme_manager.js',
- '/static/js/plugins/navigation_manager.js',
- '/static/js/plugins/choices_manager.js',
- '/static/js/plugins/workflow_toggle.js',
- '/static/js/plugins/form_validator.js',
- '/static/js/plugins/status_poller.js'
- ] %}
+ {% set core_scripts = ui_assets.get('core_scripts', []) if ui_assets else [] %}
{% for script in core_scripts %}
{% endfor %}
diff --git a/src/autometabuilder/web/templates/index.html b/src/autometabuilder/web/templates/index.html
index 1d39a89..2571431 100644
--- a/src/autometabuilder/web/templates/index.html
+++ b/src/autometabuilder/web/templates/index.html
@@ -14,33 +14,11 @@
{% endblock %}
{% block scripts %}
-{% set workflow_scripts = [
- '/static/js/workflow/workflow_utils.js',
- '/static/js/workflow/workflow_state.js',
- '/static/js/workflow/workflow_mutations.js',
- '/static/js/workflow/workflow_plugin_options.js',
- '/static/js/workflow/workflow_field_renderer.js',
- '/static/js/workflow/workflow_node_template.js',
- '/static/js/workflow/workflow_node_events.js',
- '/static/js/workflow/workflow_loop_renderer.js',
- '/static/js/workflow/workflow_node_renderer.js',
- '/static/js/workflow/workflow_canvas_renderer.js',
- '/static/js/workflow/workflow_builder.js'
-] %}
+{% set workflow_scripts = ui_assets.get('workflow_scripts', []) if ui_assets else [] %}
{% for script in workflow_scripts %}
{% endfor %}
-{% set page_scripts = [
- '/static/js/plugins/navigation_loader.js',
- '/static/js/plugins/workflow_builder.js',
- '/static/js/plugins/workflow_templates.js',
- '/static/js/plugins/run_mode_toggle.js',
- '/static/js/plugins/prompt_builder.js',
- '/static/js/plugins/translation_editor_base.js',
- '/static/js/plugins/translation_editor_render.js',
- '/static/js/plugins/translation_editor_actions.js',
- '/static/js/plugins/translation_editor_network.js'
-] %}
+{% set page_scripts = ui_assets.get('page_scripts', []) if ui_assets else [] %}
{% for script in page_scripts %}
{% endfor %}
diff --git a/src/autometabuilder/web/ui_assets.json b/src/autometabuilder/web/ui_assets.json
new file mode 100644
index 0000000..73541e1
--- /dev/null
+++ b/src/autometabuilder/web/ui_assets.json
@@ -0,0 +1,37 @@
+{
+ "core_scripts": [
+ "/static/js/app_context.js",
+ "/static/js/plugin_registry.js",
+ "/static/js/services/toast.js",
+ "/static/js/plugins/theme_manager.js",
+ "/static/js/plugins/navigation_manager.js",
+ "/static/js/plugins/choices_manager.js",
+ "/static/js/plugins/workflow_toggle.js",
+ "/static/js/plugins/form_validator.js",
+ "/static/js/plugins/status_poller.js"
+ ],
+ "workflow_scripts": [
+ "/static/js/workflow/workflow_utils.js",
+ "/static/js/workflow/workflow_state.js",
+ "/static/js/workflow/workflow_mutations.js",
+ "/static/js/workflow/workflow_plugin_options.js",
+ "/static/js/workflow/workflow_field_renderer.js",
+ "/static/js/workflow/workflow_node_template.js",
+ "/static/js/workflow/workflow_node_events.js",
+ "/static/js/workflow/workflow_loop_renderer.js",
+ "/static/js/workflow/workflow_node_renderer.js",
+ "/static/js/workflow/workflow_canvas_renderer.js",
+ "/static/js/workflow/workflow_builder.js"
+ ],
+ "page_scripts": [
+ "/static/js/plugins/navigation_loader.js",
+ "/static/js/plugins/workflow_builder.js",
+ "/static/js/plugins/workflow_templates.js",
+ "/static/js/plugins/run_mode_toggle.js",
+ "/static/js/plugins/prompt_builder.js",
+ "/static/js/plugins/translation_editor_base.js",
+ "/static/js/plugins/translation_editor_render.js",
+ "/static/js/plugins/translation_editor_actions.js",
+ "/static/js/plugins/translation_editor_network.js"
+ ]
+}