enh: Actions __webui__ flag support

This commit is contained in:
Timothy J. Baek
2024-08-15 17:28:43 +02:00
parent dc6ca61548
commit 8c2ba7f7ea
5 changed files with 99 additions and 10 deletions

View File

@@ -1026,6 +1026,10 @@ async def get_all_models():
function_module, _, _ = load_function_module_by_id(action_id)
webui_app.state.FUNCTIONS[action_id] = function_module
__webui__ = False
if hasattr(function_module, "__webui__"):
__webui__ = function_module.__webui__
if hasattr(function_module, "actions"):
actions = function_module.actions
model["actions"].extend(
@@ -1039,6 +1043,7 @@ async def get_all_models():
"icon_url": _action.get(
"icon_url", action.meta.manifest.get("icon_url", None)
),
**({"__webui__": __webui__} if __webui__ else {}),
}
for _action in actions
]
@@ -1050,6 +1055,7 @@ async def get_all_models():
"name": action.name,
"description": action.meta.description,
"icon_url": action.meta.manifest.get("icon_url", None),
**({"__webui__": __webui__} if __webui__ else {}),
}
)