Spaces:
Running
Running
Download api/banners.py from Leon4gr45/openoperator: direct link, hf CLI and curl.
- Browser
- Download file 712 Bytes
-
https://huggingface.co/spaces/Leon4gr45/openoperator/resolve/main/api/banners.py
- Command line
-
hf download hf://spaces/Leon4gr45/openoperator/api/banners.py
-
curl -L -o banners.py https://huggingface.co/spaces/Leon4gr45/openoperator/resolve/main/api/banners.py
712 Bytes
| from helpers.api import ApiHandler, Request, Response | |
| from helpers.extension import call_extensions_async | |
| class GetBanners(ApiHandler): | |
| """ | |
| API endpoint for Welcome Screen banners. | |
| Add checks as extension scripts in python/extensions/banners/ or usr/extensions/banners/ | |
| """ | |
| async def process(self, input: dict, request: Request) -> dict | Response: | |
| banners = input.get("banners", []) | |
| frontend_context = input.get("context", {}) | |
| # Banners array passed by reference - extensions append directly to it | |
| await call_extensions_async("banners", agent=None, banners=banners, frontend_context=frontend_context) | |
| return {"banners": banners} | |