Spaces:
Paused
Paused
Download src/lib/server/apiToken.ts from Mike0021/chat-ui-agent-demo: direct link, hf CLI and curl.
- Browser
- Download file 299 Bytes
-
https://huggingface.co/spaces/Mike0021/chat-ui-agent-demo/resolve/main/src/lib/server/apiToken.ts
- Command line
-
hf download hf://spaces/Mike0021/chat-ui-agent-demo/src/lib/server/apiToken.ts
-
curl -L -o apiToken.ts https://huggingface.co/spaces/Mike0021/chat-ui-agent-demo/resolve/main/src/lib/server/apiToken.ts
299 Bytes
| import { config } from "$lib/server/config"; | |
| export function getApiToken(locals: App.Locals | undefined) { | |
| if (config.USE_USER_TOKEN === "true") { | |
| if (!locals?.token) { | |
| throw new Error("User token not found"); | |
| } | |
| return locals.token; | |
| } | |
| return config.OPENAI_API_KEY || config.HF_TOKEN; | |
| } | |