Add load testing tool to the UI (#805)

Wouldn't it be nice to test the performance, swapping and concurrency
from the UI? Now we can! This is a port of `cmd/test-concurrency` into the UI

Here's a demo of it working with a swap matrix: 

https://github.com/user-attachments/assets/b6bb12ec-0381-46f1-a6b8-27d1c3c0ddb3
This commit is contained in:
Benson Wong
2026-05-30 17:04:30 -07:00
committed by GitHub
parent c790d0ee03
commit 03d58e53fa
2 changed files with 646 additions and 4 deletions
+14 -4
View File
@@ -5,8 +5,9 @@
import AudioInterface from "../components/playground/AudioInterface.svelte";
import SpeechInterface from "../components/playground/SpeechInterface.svelte";
import RerankInterface from "../components/playground/RerankInterface.svelte";
import ConcurrencyInterface from "../components/playground/ConcurrencyInterface.svelte";
type Tab = "chat" | "images" | "speech" | "audio" | "rerank";
type Tab = "chat" | "images" | "speech" | "audio" | "rerank" | "concurrency";
const selectedTabStore = persistentStore<Tab>("playground-selected-tab", "chat");
let mobileMenuOpen = $state(false);
@@ -17,6 +18,7 @@
{ id: "speech", label: "Speech" },
{ id: "audio", label: "Transcription" },
{ id: "rerank", label: "Rerank" },
{ id: "concurrency", label: "Load Test" },
];
function selectTab(tab: Tab) {
@@ -25,7 +27,7 @@
}
function getTabLabel(tabId: Tab): string {
return tabs.find(t => t.id === tabId)?.label || "";
return tabs.find((t) => t.id === tabId)?.label || "";
}
</script>
@@ -49,10 +51,15 @@
</svg>
</button>
{#if mobileMenuOpen}
<div class="absolute top-full left-0 right-0 mt-1 bg-surface border border-gray-200 dark:border-white/10 rounded shadow-lg z-10">
<div
class="absolute top-full left-0 right-0 mt-1 bg-surface border border-gray-200 dark:border-white/10 rounded shadow-lg z-10"
>
{#each tabs as tab (tab.id)}
<button
class="w-full px-4 py-2 text-left hover:bg-secondary-hover transition-colors first:rounded-t last:rounded-b {$selectedTabStore === tab.id ? 'bg-primary/10 font-medium' : ''}"
class="w-full px-4 py-2 text-left hover:bg-secondary-hover transition-colors first:rounded-t last:rounded-b {$selectedTabStore ===
tab.id
? 'bg-primary/10 font-medium'
: ''}"
onclick={() => selectTab(tab.id)}
>
{tab.label}
@@ -94,6 +101,9 @@
<div class="h-full" class:tab-hidden={$selectedTabStore !== "rerank"}>
<RerankInterface />
</div>
<div class="h-full" class:tab-hidden={$selectedTabStore !== "concurrency"}>
<ConcurrencyInterface />
</div>
</div>
</div>