Spaces:
Runtime error
Runtime error
Added latency tracking and display to the Playground component.
Browse files25 unmodified lines26272829303128 unmodified lines60616263646541 unmodified lines10710810911011111259 unmodified lines17217317417517617717825 unmodified lineslet loading = false;let streamingMessage: Message | null = null;function addMessage() {messages = [28 unmodified lines}(document.activeElement as HTMLElement).blur();loading = true;try {const hf = new HfInference(hfToken);41 unmodified lines} catch (error) {alert('error: ' + error.message);} finally {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</div><buttontype="button"25 unmodified lines2627282930313228 unmodified lines6162636465666741 unmodified lines10911011111211311411511659 unmodified lines17617717817918018118225 unmodified lineslet 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 {latency}ms</div><buttontype="button"
src/lib/components/Playground/Playground.svelte+5-1