Spaces:
Runtime error
Runtime error
Added latency tracking and display to the Playground component.
Browse files25 unmodified lines2627282930313228 unmodified lines6162636465666741 unmodified lines10911011111211311411511659 unmodified lines17617717817517918018118225 unmodified lines
let loading = false; let streamingMessage: Message | null = null; let latency = 0;
function addMessage() { messages = [28 unmodified lines } (document.activeElement as HTMLElement).blur(); loading = true; const startTime = performance.now();
try { const hf = new HfInference(hfToken);41 unmodified lines } catch (error) { alert('error: ' + error.message); } finally { const endTime = performance.now(); latency = Math.round(endTime - startTime); loading = false; streamingMessage = null; scrollToBottom();59 unmodified lines >Reset</button > <div class="flex-1 items-center justify-center text-center text-sm text-gray-500"> 23 tokens 路 Latency 750ms 23 tokens 路 Latency {latency}ms </div> <button type="button"src/lib/components/Playground/Playground.svelte+5-1