type handleTokenSubmit
Browse files
src/lib/components/InferencePlayground/InferencePlayground.svelte
CHANGED
@@ -32,9 +32,9 @@
|
|
32 |
streaming: true,
|
33 |
};
|
34 |
|
35 |
-
let hfToken
|
36 |
let viewCode = false;
|
37 |
-
let showTokenModal =
|
38 |
let loading = false;
|
39 |
let latency = 0;
|
40 |
let abortController: AbortController | undefined = undefined;
|
@@ -124,21 +124,21 @@
|
|
124 |
}
|
125 |
}
|
126 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
onDestroy(() => {
|
128 |
abortController?.abort();
|
129 |
});
|
130 |
</script>
|
131 |
|
132 |
{#if showTokenModal}
|
133 |
-
<HFTokenModal
|
134 |
-
on:close={() => (showTokenModal = false)}
|
135 |
-
on:submit={e => {
|
136 |
-
const formData = new FormData(e.target);
|
137 |
-
hfToken = formData.get("hf-token");
|
138 |
-
submit();
|
139 |
-
showTokenModal = false;
|
140 |
-
}}
|
141 |
-
/>
|
142 |
{/if}
|
143 |
|
144 |
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
|
32 |
streaming: true,
|
33 |
};
|
34 |
|
35 |
+
let hfToken = "";
|
36 |
let viewCode = false;
|
37 |
+
let showTokenModal = true;
|
38 |
let loading = false;
|
39 |
let latency = 0;
|
40 |
let abortController: AbortController | undefined = undefined;
|
|
|
124 |
}
|
125 |
}
|
126 |
|
127 |
+
function handleTokenSubmit(e: Event) {
|
128 |
+
const form = e.target as HTMLFormElement;
|
129 |
+
const formData = new FormData(form);
|
130 |
+
hfToken = (formData.get("hf-token") as string) ?? "";
|
131 |
+
submit();
|
132 |
+
showTokenModal = false;
|
133 |
+
}
|
134 |
+
|
135 |
onDestroy(() => {
|
136 |
abortController?.abort();
|
137 |
});
|
138 |
</script>
|
139 |
|
140 |
{#if showTokenModal}
|
141 |
+
<HFTokenModal on:close={() => (showTokenModal = false)} on:submit={handleTokenSubmit} />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
{/if}
|
143 |
|
144 |
<!-- svelte-ignore a11y-no-static-element-interactions -->
|