Spaces:
Sleeping
Sleeping
Download dashboard/features/autonomy/api.js from JuanCS-Dev/twitch-byte-bot: direct link, hf CLI and curl.
- Browser
- Download file 843 Bytes
-
https://huggingface.co/spaces/JuanCS-Dev/twitch-byte-bot/resolve/main/dashboard/features/autonomy/api.js
- Command line
-
hf download hf://spaces/JuanCS-Dev/twitch-byte-bot/dashboard/features/autonomy/api.js
-
curl -L -o api.js https://huggingface.co/spaces/JuanCS-Dev/twitch-byte-bot/resolve/main/dashboard/features/autonomy/api.js
843 Bytes
| import { fetchWithTimeout } from "../shared/api.js"; | |
| import { getStorageItem } from "../shared/dom.js"; | |
| const TOKEN_KEY = "byte_dashboard_admin_token"; | |
| const AUTONOMY_TICK_ENDPOINT = "./api/autonomy/tick"; | |
| const REQUEST_TIMEOUT_MS = 15000; | |
| function authHeaders() { | |
| const headers = {}; | |
| const token = getStorageItem(TOKEN_KEY); | |
| if (token) { | |
| headers["X-Byte-Admin-Token"] = token; | |
| } | |
| return headers; | |
| } | |
| export async function triggerAutonomyTick({ force = true, reason = "manual_dashboard" } = {}, timeoutMs = REQUEST_TIMEOUT_MS) { | |
| return await fetchWithTimeout( | |
| AUTONOMY_TICK_ENDPOINT, | |
| { | |
| method: "POST", | |
| headers: authHeaders(), | |
| body: JSON.stringify({ force: Boolean(force), reason: String(reason || "manual_dashboard") }), | |
| }, | |
| timeoutMs | |
| ); | |
| } | |