mishig HF staff commited on
Commit
b6d0c8a
1 Parent(s): da972f7
src/lib/components/InferencePlayground/InferencePlayground.svelte CHANGED
@@ -154,7 +154,7 @@
154
  const RE_HF_TOKEN = /\bhf_[a-zA-Z0-9]{34}\b/;
155
  if (RE_HF_TOKEN.test(submittedHfToken)) {
156
  hfToken = submittedHfToken;
157
- if(storeLocallyHfToken){
158
  localStorage.setItem(hfTokenLocalStorageKey, JSON.stringify(hfToken));
159
  }
160
  submit();
 
154
  const RE_HF_TOKEN = /\bhf_[a-zA-Z0-9]{34}\b/;
155
  if (RE_HF_TOKEN.test(submittedHfToken)) {
156
  hfToken = submittedHfToken;
157
+ if (storeLocallyHfToken) {
158
  localStorage.setItem(hfTokenLocalStorageKey, JSON.stringify(hfToken));
159
  }
160
  submit();
src/lib/components/InferencePlayground/InferencePlaygroundCodeSnippets.svelte CHANGED
@@ -50,8 +50,8 @@
50
  http: getHttpSnippets(conversation, tokenStr),
51
  };
52
 
53
- function getTokenStr(showToken: boolean){
54
- if(hfToken && showToken){
55
  return hfToken;
56
  }
57
  return "YOUR_HF_TOKEN";
@@ -214,7 +214,7 @@ print(output.choices[0].message)`,
214
  }
215
 
216
  function getHttpSnippets(conversation: Conversation, tokenStr: string) {
217
- if(tokenStr === "YOUR_HF_TOKEN"){
218
  tokenStr = "{YOUR_HF_TOKEN}";
219
  }
220
  const formattedMessages = ({ sep, start, end }: MessagesJoiner) =>
@@ -297,10 +297,10 @@ print(output.choices[0].message)`,
297
  <h2 class="font-semibold">{label}</h2>
298
  <div class="flex items-center gap-x-4">
299
  {#if needsToken && hfToken}
300
- <label class="flex items-center gap-x-1.5">
301
- <input type="checkbox" bind:checked={showToken}>
302
- <p class="leading-none">show token</p>
303
- </label>
304
  {/if}
305
  <button
306
  class="flex items-center gap-x-1.5 rounded-md bg-gray-200 px-1.5 py-0.5 text-sm transition dark:bg-gray-950/80"
 
50
  http: getHttpSnippets(conversation, tokenStr),
51
  };
52
 
53
+ function getTokenStr(showToken: boolean) {
54
+ if (hfToken && showToken) {
55
  return hfToken;
56
  }
57
  return "YOUR_HF_TOKEN";
 
214
  }
215
 
216
  function getHttpSnippets(conversation: Conversation, tokenStr: string) {
217
+ if (tokenStr === "YOUR_HF_TOKEN") {
218
  tokenStr = "{YOUR_HF_TOKEN}";
219
  }
220
  const formattedMessages = ({ sep, start, end }: MessagesJoiner) =>
 
297
  <h2 class="font-semibold">{label}</h2>
298
  <div class="flex items-center gap-x-4">
299
  {#if needsToken && hfToken}
300
+ <label class="flex items-center gap-x-1.5">
301
+ <input type="checkbox" bind:checked={showToken} />
302
+ <p class="leading-none">show token</p>
303
+ </label>
304
  {/if}
305
  <button
306
  class="flex items-center gap-x-1.5 rounded-md bg-gray-200 px-1.5 py-0.5 text-sm transition dark:bg-gray-950/80"
src/lib/components/InferencePlayground/InferencePlaygroundHFTokenModal.svelte CHANGED
@@ -97,14 +97,18 @@
97
  />
98
  </div>
99
  <label class="flex items-center gap-x-1 text-gray-900 dark:text-gray-200">
100
- <input type="checkbox" bind:checked={storeLocallyHfToken}>
101
- <p class="leading-none">store locally <span class="text-gray-800 dark:text-gray-300">(using <a
102
- href="https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage"
103
- target="_blank"
104
- class="underline"
105
- >
106
- localStorage
107
- </a> for the next use)</span></p>
 
 
 
 
108
  </label>
109
  </div>
110
 
 
97
  />
98
  </div>
99
  <label class="flex items-center gap-x-1 text-gray-900 dark:text-gray-200">
100
+ <input type="checkbox" bind:checked={storeLocallyHfToken} />
101
+ <p class="leading-none">
102
+ store locally <span class="text-gray-800 dark:text-gray-300"
103
+ >(using <a
104
+ href="https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage"
105
+ target="_blank"
106
+ class="underline"
107
+ >
108
+ localStorage
109
+ </a> for the next use)</span
110
+ >
111
+ </p>
112
  </label>
113
  </div>
114
 
src/lib/components/InferencePlayground/InferencePlaygroundModelSelectorModal.svelte CHANGED
@@ -68,7 +68,7 @@
68
  {#each featuredModels as model}
69
  {@const [nameSpace, modelName] = model.id.split("/")}
70
  <button
71
- class="flex cursor-pointer items-center px-2 py-1.5 text-sm hover:bg-gray-100 w-full"
72
  on:click={() => {
73
  dispatch("modelSelected", model.id);
74
  dispatch("close");
@@ -91,7 +91,7 @@
91
  {#each otherModels as model}
92
  {@const [nameSpace, modelName] = model.id.split("/")}
93
  <button
94
- class="flex cursor-pointer items-center px-2 py-1.5 text-sm hover:bg-gray-100 w-full"
95
  on:click={() => {
96
  dispatch("modelSelected", model.id);
97
  dispatch("close");
 
68
  {#each featuredModels as model}
69
  {@const [nameSpace, modelName] = model.id.split("/")}
70
  <button
71
+ class="flex w-full cursor-pointer items-center px-2 py-1.5 text-sm hover:bg-gray-100"
72
  on:click={() => {
73
  dispatch("modelSelected", model.id);
74
  dispatch("close");
 
91
  {#each otherModels as model}
92
  {@const [nameSpace, modelName] = model.id.split("/")}
93
  <button
94
+ class="flex w-full cursor-pointer items-center px-2 py-1.5 text-sm hover:bg-gray-100"
95
  on:click={() => {
96
  dispatch("modelSelected", model.id);
97
  dispatch("close");