view docs + close from top
Browse files
src/lib/components/InferencePlayground/InferencePlayground.svelte
CHANGED
@@ -344,6 +344,7 @@
|
|
344 |
{compareActive}
|
345 |
on:addMessage={() => addMessage(conversationIdx)}
|
346 |
on:deleteMessage={e => deleteMessage(conversationIdx, e.detail)}
|
|
|
347 |
/>
|
348 |
</div>
|
349 |
{/each}
|
@@ -490,14 +491,25 @@
|
|
490 |
{/if}
|
491 |
</div>
|
492 |
|
493 |
-
<
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
501 |
{#if selectCompareModelOpen}
|
502 |
<ModelSelectorModal
|
503 |
{models}
|
|
|
344 |
{compareActive}
|
345 |
on:addMessage={() => addMessage(conversationIdx)}
|
346 |
on:deleteMessage={e => deleteMessage(conversationIdx, e.detail)}
|
347 |
+
on:closeCode={() => (viewCode = false)}
|
348 |
/>
|
349 |
</div>
|
350 |
{/each}
|
|
|
491 |
{/if}
|
492 |
</div>
|
493 |
|
494 |
+
<div class="absolute bottom-6 left-4 flex items-center gap-2 max-md:hidden">
|
495 |
+
<a
|
496 |
+
target="_blank"
|
497 |
+
href="https://huggingface.co/docs/api-inference/tasks/chat-completion"
|
498 |
+
class="flex items-center gap-1 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"
|
499 |
+
>
|
500 |
+
<IconInfo classNames="text-xs" />
|
501 |
+
View Docs
|
502 |
+
</a>
|
503 |
+
<span class="dark:text-gray-500">·</span>
|
504 |
+
<a
|
505 |
+
target="_blank"
|
506 |
+
href="https://huggingface.co/spaces/huggingface/inference-playground/discussions/1"
|
507 |
+
class="flex items-center gap-1 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"
|
508 |
+
>
|
509 |
+
Give feedback
|
510 |
+
</a>
|
511 |
+
</div>
|
512 |
+
|
513 |
{#if selectCompareModelOpen}
|
514 |
<ModelSelectorModal
|
515 |
{models}
|
src/lib/components/InferencePlayground/InferencePlaygroundCodeSnippets.svelte
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<script lang="ts">
|
2 |
import type { Conversation } from "./types";
|
3 |
|
4 |
-
import { onDestroy } from "svelte";
|
5 |
import hljs from "highlight.js/lib/core";
|
6 |
import javascript from "highlight.js/lib/languages/javascript";
|
7 |
import python from "highlight.js/lib/languages/python";
|
@@ -17,6 +17,8 @@
|
|
17 |
export let conversation: Conversation;
|
18 |
export let hfToken: string;
|
19 |
|
|
|
|
|
20 |
const lanuages = ["javascript", "python", "http"];
|
21 |
type Language = (typeof lanuages)[number];
|
22 |
const labelsByLanguage: Record<Language, string> = {
|
@@ -452,6 +454,16 @@ print(completion.choices[0].message)`,
|
|
452 |
>
|
453 |
</li>
|
454 |
{/each}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
455 |
</ul>
|
456 |
</div>
|
457 |
|
|
|
1 |
<script lang="ts">
|
2 |
import type { Conversation } from "./types";
|
3 |
|
4 |
+
import { createEventDispatcher, onDestroy } from "svelte";
|
5 |
import hljs from "highlight.js/lib/core";
|
6 |
import javascript from "highlight.js/lib/languages/javascript";
|
7 |
import python from "highlight.js/lib/languages/python";
|
|
|
17 |
export let conversation: Conversation;
|
18 |
export let hfToken: string;
|
19 |
|
20 |
+
const dispatch = createEventDispatcher<{ closeCode: void }>();
|
21 |
+
|
22 |
const lanuages = ["javascript", "python", "http"];
|
23 |
type Language = (typeof lanuages)[number];
|
24 |
const labelsByLanguage: Record<Language, string> = {
|
|
|
454 |
>
|
455 |
</li>
|
456 |
{/each}
|
457 |
+
<li class="ml-auto self-center max-sm:hidden">
|
458 |
+
<button
|
459 |
+
on:click={() => {
|
460 |
+
dispatch("closeCode");
|
461 |
+
}}
|
462 |
+
class="flex size-7 items-center justify-center rounded-lg px-3 py-2.5 text-xs font-medium text-gray-900 focus:outline-none focus:ring-4 focus:ring-gray-100 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white dark:focus:ring-gray-700"
|
463 |
+
>
|
464 |
+
✕
|
465 |
+
</button>
|
466 |
+
</li>
|
467 |
</ul>
|
468 |
</div>
|
469 |
|
src/lib/components/InferencePlayground/InferencePlaygroundConversation.svelte
CHANGED
@@ -101,6 +101,6 @@
|
|
101 |
</div>
|
102 |
</button>
|
103 |
{:else}
|
104 |
-
<CodeSnippets {conversation} {hfToken} />
|
105 |
{/if}
|
106 |
</div>
|
|
|
101 |
</div>
|
102 |
</button>
|
103 |
{:else}
|
104 |
+
<CodeSnippets {conversation} {hfToken} on:closeCode />
|
105 |
{/if}
|
106 |
</div>
|