Spaces:
Runtime error
Runtime error
"stop" btn for streaming messages
Browse filesFiles changed (2)
84 unmodified lines858687888889902 unmodified lines9394959796979824 unmodified lines12312412512812913012612712875 unmodified lines20420520621220720820921021121272 unmodified lines28528628729128828929029129229329429529629784 unmodified lines } (document.activeElement as HTMLElement).blur(); loading = true; let streamingMsgAdded = false;
try { const startTime = performance.now();2 unmodified lines if (conversation.streaming) { const streamingMessage = { role: "assistant", content: "" }; conversation.messages = [...conversation.messages, streamingMessage]; streamingMsgAdded = true; abortController = new AbortController();
await handleStreamingResponse(24 unmodified lines const endTime = performance.now(); latency = Math.round(endTime - startTime); } catch (error) { if (streamingMsgAdded) { conversation.messages = conversation.messages.slice(0, -1); } if (error instanceof Error) { if (error.message.includes("token seems invalid")) { hfToken = "";75 unmodified lines </div> </div> <div class="relative divide-y divide-gray-200 dark:divide-gray-800" on:keydown={onKeydown}> <div class="flex h-[calc(100dvh-5rem-120px)] md:h-[calc(100dvh-5rem)] divide-x divide-gray-200 *:w-full dark:divide-gray-800 pt-3"> <div class="flex h-[calc(100dvh-5rem-120px)] divide-x divide-gray-200 pt-3 *:w-full md:h-[calc(100dvh-5rem)] dark:divide-gray-800" > <Conversation {loading} {conversation}72 unmodified lines > {#if loading} <div class="flex flex-none items-center gap-[3px]"> <span class="mr-2">Cancel</span> <span class="mr-2"> {#if conversation.streaming} Stop {:else} Cancel {/if} </span> <div class="h-1 w-1 flex-none animate-bounce rounded-full bg-gray-500 dark:bg-gray-100" style="animation-delay: 0.25s;"26 unmodified lines272829303031323326 unmodified lines dispatch("delete"); }} type="button" class="mt-1.5 sm:hidden size-8 rounded-lg border border-gray-200 bg-white text-xs font-medium text-gray-900 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:outline-none focus:ring-4 focus:ring-gray-100 group-hover/message:block 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" class="mt-1.5 size-8 rounded-lg border border-gray-200 bg-white text-xs font-medium text-gray-900 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:outline-none focus:ring-4 focus:ring-gray-100 group-hover/message:block sm:hidden 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" >✕</button ></div>src/lib/components/InferencePlayground/InferencePlayground.svelte+10-7
src/lib/components/InferencePlayground/InferencePlaygroundMessage.svelte+1-1