Spaces:
Sleeping
Sleeping
typo
Browse filesFiles changed (3)
8 unmodified lines91011121213141514 unmodified lines30313233333435368 unmodified lines handleStreamingResponse, handleNonStreamingResponse, isSystemPromptSupported, FEATUED_MODELS_IDS, FEATURED_MODELS_IDS, } from "./inferencePlaygroundUtils";
import { onDestroy, onMount } from "svelte";14 unmodified lines const modelFromQueryParam = models.find(model => model.id === modelIdFromQueryParam);
let conversation: Conversation = { model: modelFromQueryParam ?? models.find(m => FEATUED_MODELS_IDS.includes(m.id)) ?? models[0], model: modelFromQueryParam ?? models.find(m => FEATURED_MODELS_IDS.includes(m.id)) ?? models[0], config: defaultGenerationConfig, messages: [{ ...startMessageUser }], systemMessage: startMessageSystem,2 unmodified lines345667897 unmodified lines1718192021202122232458 unmodified lines83848586878687888990919293929394959622 unmodified lines1191201211221231221231251261271281291301311321331341351361371381391401411241251261271281291301311321331341351361371381391401411421431431441441451461471461471481481491501501511521531541551561571581591601611621631641651661511521531541551561571581591601611621631641651661671681691701681691711721731741711751761771782 unmodified lines
import { createEventDispatcher, tick } from "svelte";
import { FEATUED_MODELS_IDS } from "./inferencePlaygroundUtils"; import { FEATURED_MODELS_IDS } from "./inferencePlaygroundUtils"; import IconSearch from "../Icons/IconSearch.svelte"; import IconStar from "../Icons/IconStar.svelte";
7 unmodified lines
const dispatch = createEventDispatcher<{ modelSelected: string; close: void }>();
let featuredModels = models.filter(m => FEATUED_MODELS_IDS.includes(m.id)); let otherModels = models.filter(m => !FEATUED_MODELS_IDS.includes(m.id)); let featuredModels = models.filter(m => FEATURED_MODELS_IDS.includes(m.id)); let otherModels = models.filter(m => !FEATURED_MODELS_IDS.includes(m.id));
if (featuredModels.findIndex(model => model.id === conversation.model.id) !== -1) { highlightIdx = featuredModels.findIndex(model => model.id === conversation.model.id);58 unmodified lines function filterModels(query: string) { featuredModels = models.filter(m => query ? FEATUED_MODELS_IDS.includes(m.id) && m.id.toLocaleLowerCase().includes(query.toLocaleLowerCase().trim()) : FEATUED_MODELS_IDS.includes(m.id) ? FEATURED_MODELS_IDS.includes(m.id) && m.id.toLocaleLowerCase().includes(query.toLocaleLowerCase().trim()) : FEATURED_MODELS_IDS.includes(m.id) );
otherModels = models.filter(m => query ? !FEATUED_MODELS_IDS.includes(m.id) && m.id.toLocaleLowerCase().includes(query.toLocaleLowerCase().trim()) : !FEATUED_MODELS_IDS.includes(m.id) ? !FEATURED_MODELS_IDS.includes(m.id) && m.id.toLocaleLowerCase().includes(query.toLocaleLowerCase().trim()) : !FEATURED_MODELS_IDS.includes(m.id) ); }</script>22 unmodified lines /> </div> <div class="max-h-[300px] overflow-y-auto overflow-x-hidden"> <div> <div class="px-2 py-1.5 text-xs font-medium text-gray-500">Trending</div> {#if featuredModels.length} <div> {#each featuredModels as model, idx} {@const [nameSpace, modelName] = model.id.split("/")} <button class="flex w-full cursor-pointer items-center px-2 py-1.5 text-sm {highlightIdx === idx ? 'highlighted bg-gray-100 dark:bg-gray-800' : ''}" on:mouseenter={() => highlightRow(idx)} on:click={() => { dispatch("modelSelected", model.id); dispatch("close"); }} > <IconStar classNames="lucide lucide-star mr-2 h-4 w-4 text-yellow-400" /> <span class="inline-flex items-center" ><span class="text-gray-500 dark:text-gray-400">{nameSpace}</span><span class="mx-1 text-gray-300 dark:text-gray-700">/</span ><span class="text-black dark:text-white">{modelName}</span></span <div class="px-2 py-1.5 text-xs font-medium text-gray-500">Trending</div> <div> {#each featuredModels as model, idx} {@const [nameSpace, modelName] = model.id.split("/")} <button class="flex w-full cursor-pointer items-center px-2 py-1.5 text-sm {highlightIdx === idx ? 'highlighted bg-gray-100 dark:bg-gray-800' : ''}" on:mouseenter={() => highlightRow(idx)} on:click={() => { dispatch("modelSelected", model.id); dispatch("close"); }} > <IconStar classNames="lucide lucide-star mr-1.5 size-4 text-yellow-400" /> <span class="inline-flex items-center" ><span class="text-gray-500 dark:text-gray-400">{nameSpace}</span><span class="mx-1 text-gray-300 dark:text-gray-700">/</span ><span class="text-black dark:text-white">{modelName}</span></span > </button> {/each} </button> {/each} </div> </div> </div> <div> <div class="px-2 py-1.5 text-xs font-medium text-gray-500">Other Models</div> {/if} {#if otherModels.length} <div> {#each otherModels as model, _idx} {@const [nameSpace, modelName] = model.id.split("/")} {@const idx = featuredModels.length + _idx} <button class="flex w-full cursor-pointer items-center px-2 py-1.5 text-sm {highlightIdx === idx ? 'highlighted bg-gray-100 dark:bg-gray-800' : ''}" on:mouseenter={() => highlightRow(idx)} on:click={() => { dispatch("modelSelected", model.id); dispatch("close"); }} > <span class="inline-flex items-center" ><span class="text-gray-500 dark:text-gray-400">{nameSpace}</span><span class="mx-1 text-gray-300 dark:text-gray-700">/</span ><span class="text-black dark:text-white">{modelName}</span></span <div class="px-2 py-1.5 text-xs font-medium text-gray-500">Other Models</div> <div> {#each otherModels as model, _idx} {@const [nameSpace, modelName] = model.id.split("/")} {@const idx = featuredModels.length + _idx} <button class="flex w-full cursor-pointer items-center px-2 py-1.5 text-sm {highlightIdx === idx ? 'highlighted bg-gray-100 dark:bg-gray-800' : ''}" on:mouseenter={() => highlightRow(idx)} on:click={() => { dispatch("modelSelected", model.id); dispatch("close"); }} > <span class="inline-flex items-center" ><span class="text-gray-500 dark:text-gray-400">{nameSpace}</span><span class="mx-1 text-gray-300 dark:text-gray-700">/</span ><span class="text-black dark:text-white">{modelName}</span></span > </button> {/each} </button> {/each} </div> </div> </div> {/if} </div> </div> </div>64 unmodified lines6566676868697071727364 unmodified lines return model.tokenizerConfig?.chat_template?.includes("system");}
export const FEATUED_MODELS_IDS = [export const FEATURED_MODELS_IDS = [ "Qwen/Qwen2.5-72B-Instruct", "meta-llama/Meta-Llama-3.1-70B-Instruct", "meta-llama/Meta-Llama-3.1-70B-Instruct", "meta-llama/Meta-Llama-3.1-8B-Instruct", "google/gemma-2-9b-it",src/lib/components/InferencePlayground/InferencePlayground.svelte+2-2
src/lib/components/InferencePlayground/InferencePlaygroundModelSelectorModal.svelte+55-51
src/lib/components/InferencePlayground/inferencePlaygroundUtils.ts+3-1