Download tools/server/webui/src/lib/utils/api-headers.ts from OpenTransformer/llama.cpp-prismml: direct link, hf CLI and curl.
- Browser
- Download file 573 Bytes
-
https://huggingface.co/OpenTransformer/llama.cpp-prismml/resolve/main/tools/server/webui/src/lib/utils/api-headers.ts
- Command line
-
hf download hf://OpenTransformer/llama.cpp-prismml/tools/server/webui/src/lib/utils/api-headers.ts
-
curl -L -o api-headers.ts https://huggingface.co/OpenTransformer/llama.cpp-prismml/resolve/main/tools/server/webui/src/lib/utils/api-headers.ts
573 Bytes
| import { config } from '$lib/stores/settings.svelte'; | |
| /** | |
| * Get authorization headers for API requests | |
| * Includes Bearer token if API key is configured | |
| */ | |
| export function getAuthHeaders(): Record<string, string> { | |
| const currentConfig = config(); | |
| const apiKey = currentConfig.apiKey?.toString().trim(); | |
| return apiKey ? { Authorization: `Bearer ${apiKey}` } : {}; | |
| } | |
| /** | |
| * Get standard JSON headers with optional authorization | |
| */ | |
| export function getJsonHeaders(): Record<string, string> { | |
| return { | |
| 'Content-Type': 'application/json', | |
| ...getAuthHeaders() | |
| }; | |
| } | |