Download web/server/runtime-context.mjs from loveaa/OneAlign: direct link, hf CLI and curl.
- Browser
- Download file 622 Bytes
-
https://huggingface.co/spaces/loveaa/OneAlign/resolve/main/web/server/runtime-context.mjs
- Command line
-
hf download hf://spaces/loveaa/OneAlign/web/server/runtime-context.mjs
-
curl -L -o runtime-context.mjs https://huggingface.co/spaces/loveaa/OneAlign/resolve/main/web/server/runtime-context.mjs
622 Bytes
| import {AsyncLocalStorage} from 'node:async_hooks' | |
| // The cloud gateway supplies a worker-local GPU bridge for this request only. | |
| export const runtimeContext = new AsyncLocalStorage() | |
| export function modelUrl(route) { | |
| const base = runtimeContext.getStore()?.modelBase || process.env.HOME_PULSE_MODEL_URL || 'http://127.0.0.1:8765' | |
| return base.replace(/\/$/,'') + route | |
| } | |
| export const cloudMode = () => process.env.HOME_PULSE_CLOUD === '1' | |
| export function modelHeaders(){ | |
| return {'Content-Type':'application/json',...(runtimeContext.getStore()?.modelBase?{'X-Bridge-Key':process.env.HOME_PULSE_INTERNAL_KEY}: {})} | |
| } | |