Spaces:
Runtime error
Runtime error
Andrew
commited on
Commit
·
911a9cb
1
Parent(s):
abdf303
feat(ui): add HF token status card to settings page
Browse files
src/routes/settings/(nav)/application/+page.svelte
CHANGED
|
@@ -20,6 +20,8 @@
|
|
| 20 |
const client = useAPIClient();
|
| 21 |
|
| 22 |
let OPENAI_BASE_URL: string | null = null;
|
|
|
|
|
|
|
| 23 |
onMount(async () => {
|
| 24 |
try {
|
| 25 |
const cfg = await client.debug.config.get().then(handleResponse);
|
|
@@ -27,6 +29,13 @@
|
|
| 27 |
} catch (e) {
|
| 28 |
// ignore if debug endpoint is unavailable
|
| 29 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
});
|
| 31 |
|
| 32 |
let themePref: ThemePreference = browser ? getThemePreference() : "system";
|
|
@@ -174,6 +183,17 @@
|
|
| 174 |
>
|
| 175 |
</div>
|
| 176 |
{/if}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
{#if !!publicConfig.PUBLIC_COMMIT_SHA}
|
| 178 |
<div
|
| 179 |
class="flex flex-col items-start justify-between text-xl font-semibold text-gray-800 dark:text-gray-200"
|
|
|
|
| 20 |
const client = useAPIClient();
|
| 21 |
|
| 22 |
let OPENAI_BASE_URL: string | null = null;
|
| 23 |
+
let hasHFToken: boolean = false;
|
| 24 |
+
|
| 25 |
onMount(async () => {
|
| 26 |
try {
|
| 27 |
const cfg = await client.debug.config.get().then(handleResponse);
|
|
|
|
| 29 |
} catch (e) {
|
| 30 |
// ignore if debug endpoint is unavailable
|
| 31 |
}
|
| 32 |
+
|
| 33 |
+
try {
|
| 34 |
+
const userData = await client.user.get().then(handleResponse);
|
| 35 |
+
hasHFToken = (userData as { hasHFToken?: boolean }).hasHFToken || false;
|
| 36 |
+
} catch (e) {
|
| 37 |
+
// ignore if user endpoint is unavailable
|
| 38 |
+
}
|
| 39 |
});
|
| 40 |
|
| 41 |
let themePref: ThemePreference = browser ? getThemePreference() : "system";
|
|
|
|
| 183 |
>
|
| 184 |
</div>
|
| 185 |
{/if}
|
| 186 |
+
|
| 187 |
+
{#if hasHFToken}
|
| 188 |
+
<div
|
| 189 |
+
class="mt-1 rounded-lg border border-blue-200 bg-blue-50 px-3 py-2 text-[12px] text-blue-700 dark:border-blue-700 dark:bg-blue-900/20 dark:text-blue-300"
|
| 190 |
+
>
|
| 191 |
+
<span class="font-medium">Using your Hugging Face token</span>
|
| 192 |
+
<p class="mt-1 text-[11px] text-blue-600 dark:text-blue-400">
|
| 193 |
+
Your Hugging Face access token is being used for inference requests.
|
| 194 |
+
</p>
|
| 195 |
+
</div>
|
| 196 |
+
{/if}
|
| 197 |
{#if !!publicConfig.PUBLIC_COMMIT_SHA}
|
| 198 |
<div
|
| 199 |
class="flex flex-col items-start justify-between text-xl font-semibold text-gray-800 dark:text-gray-200"
|