victor HF staff commited on
Commit
190b5f6
1 Parent(s): 47215b1

add reset token

Browse files
src/lib/components/InferencePlayground/InferencePlayground.svelte CHANGED
@@ -79,6 +79,12 @@
79
  waitForNonStreaming = false;
80
  }
81
 
 
 
 
 
 
 
82
  async function submit() {
83
  if (!hfToken) {
84
  showTokenModal = true;
@@ -332,6 +338,22 @@
332
  </div>
333
 
334
  <GenerationConfig bind:conversation />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
335
  <div class="mt-auto hidden">
336
  <div class="mb-3 flex items-center justify-between gap-2">
337
  <label for="default-range" class="block text-sm font-medium text-gray-900 dark:text-white">API Quota</label>
 
79
  waitForNonStreaming = false;
80
  }
81
 
82
+ function resetToken() {
83
+ hfToken = "";
84
+ localStorage.removeItem(hfTokenLocalStorageKey);
85
+ showTokenModal = true;
86
+ }
87
+
88
  async function submit() {
89
  if (!hfToken) {
90
  showTokenModal = true;
 
338
  </div>
339
 
340
  <GenerationConfig bind:conversation />
341
+ {#if hfToken}
342
+ <button
343
+ on:click={resetToken}
344
+ class="mt-auto flex items-center gap-1 self-end text-sm text-gray-500 underline decoration-gray-300 hover:text-gray-800 dark:text-gray-400 dark:decoration-gray-600 dark:hover:text-gray-200"
345
+ ><svg xmlns="http://www.w3.org/2000/svg" class="text-xs" width="1em" height="1em" viewBox="0 0 32 32"
346
+ ><path
347
+ fill="currentColor"
348
+ d="M23.216 4H26V2h-7v6h2V5.096A11.96 11.96 0 0 1 28 16c0 6.617-5.383 12-12 12v2c7.72 0 14-6.28 14-14c0-5.009-2.632-9.512-6.784-12"
349
+ /><path fill="currentColor" d="M16 20a1.5 1.5 0 1 0 0 3a1.5 1.5 0 0 0 0-3M15 9h2v9h-2z" /><path
350
+ fill="currentColor"
351
+ d="M16 4V2C8.28 2 2 8.28 2 16c0 4.977 2.607 9.494 6.784 12H6v2h7v-6h-2v2.903A11.97 11.97 0 0 1 4 16C4 9.383 9.383 4 16 4"
352
+ /></svg
353
+ >
354
+ Reset token</button
355
+ >
356
+ {/if}
357
  <div class="mt-auto hidden">
358
  <div class="mb-3 flex items-center justify-between gap-2">
359
  <label for="default-range" class="block text-sm font-medium text-gray-900 dark:text-white">API Quota</label>