Spaces:
Sleeping
Sleeping
typo
Browse filesFiles changed (3)
8 unmodified lines910111213141514 unmodified lines303132333435368 unmodified lineshandleStreamingResponse,handleNonStreamingResponse,isSystemPromptSupported,FEATUED_MODELS_IDS,} from "./inferencePlaygroundUtils";import { onDestroy, onMount } from "svelte";14 unmodified linesconst modelFromQueryParam = models.find(model => model.id === modelIdFromQueryParam);let conversation: Conversation = {model: modelFromQueryParam ?? models.find(m => FEATUED_MODELS_IDS.includes(m.id)) ?? models[0],config: defaultGenerationConfig,messages: [{ ...startMessageUser }],systemMessage: startMessageSystem,8 unmodified lines910111213141514 unmodified lines303132333435368 unmodified lineshandleStreamingResponse,handleNonStreamingResponse,isSystemPromptSupported,FEATURED_MODELS_IDS,} from "./inferencePlaygroundUtils";import { onDestroy, onMount } from "svelte";14 unmodified linesconst modelFromQueryParam = models.find(model => model.id === modelIdFromQueryParam);let conversation: Conversation = {model: modelFromQueryParam ?? models.find(m => FEATURED_MODELS_IDS.includes(m.id)) ?? models[0],config: defaultGenerationConfig,messages: [{ ...startMessageUser }],systemMessage: startMessageSystem,
2 unmodified lines34567897 unmodified lines171819202122232458 unmodified lines838485868788899091929394959622 unmodified lines1191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731742 unmodified linesimport { createEventDispatcher, tick } from "svelte";import { FEATUED_MODELS_IDS } from "./inferencePlaygroundUtils";import IconSearch from "../Icons/IconSearch.svelte";import IconStar from "../Icons/IconStar.svelte";7 unmodified linesconst 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));if (featuredModels.findIndex(model => model.id === conversation.model.id) !== -1) {highlightIdx = featuredModels.findIndex(model => model.id === conversation.model.id);58 unmodified linesfunction 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));otherModels = models.filter(m =>query? !FEATUED_MODELS_IDS.includes(m.id) && m.id.toLocaleLowerCase().includes(query.toLocaleLowerCase().trim()): !FEATUED_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><div>{#each featuredModels as model, idx}{@const [nameSpace, modelName] = model.id.split("/")}<buttonclass="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><spanclass="mx-1 text-gray-300 dark:text-gray-700">/</span><span class="text-black dark:text-white">{modelName}</span></span></button>{/each}</div></div><div><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}<buttonclass="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><spanclass="mx-1 text-gray-300 dark:text-gray-700">/</span><span class="text-black dark:text-white">{modelName}</span></span></button>{/each}</div></div></div></div></div>2 unmodified lines34567897 unmodified lines171819202122232458 unmodified lines838485868788899091929394959622 unmodified lines1191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771782 unmodified linesimport { createEventDispatcher, tick } from "svelte";import { FEATURED_MODELS_IDS } from "./inferencePlaygroundUtils";import IconSearch from "../Icons/IconSearch.svelte";import IconStar from "../Icons/IconStar.svelte";7 unmodified linesconst dispatch = createEventDispatcher<{ modelSelected: string; close: void }>();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 linesfunction filterModels(query: string) {featuredModels = models.filter(m =>query? FEATURED_MODELS_IDS.includes(m.id) && m.id.toLocaleLowerCase().includes(query.toLocaleLowerCase().trim()): FEATURED_MODELS_IDS.includes(m.id));otherModels = models.filter(m =>query? !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">{#if featuredModels.length}<div><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("/")}<buttonclass="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><spanclass="mx-1 text-gray-300 dark:text-gray-700">/</span><span class="text-black dark:text-white">{modelName}</span></span></button>{/each}</div></div>{/if}{#if otherModels.length}<div><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}<buttonclass="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><spanclass="mx-1 text-gray-300 dark:text-gray-700">/</span><span class="text-black dark:text-white">{modelName}</span></span></button>{/each}</div></div>{/if}</div></div></div>
64 unmodified lines6566676869707164 unmodified linesreturn model.tokenizerConfig?.chat_template?.includes("system");}export const FEATUED_MODELS_IDS = ["meta-llama/Meta-Llama-3.1-70B-Instruct","meta-llama/Meta-Llama-3.1-8B-Instruct","google/gemma-2-9b-it",64 unmodified lines65666768697071727364 unmodified linesreturn model.tokenizerConfig?.chat_template?.includes("system");}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