Severity-ordered psychbench sections, streamlined run metadata card with server config YAML

This commit is contained in:
PeterChrz 2026-09-20 23:32:43 -04:00
parent 6f6f43c5ec
commit 8ec5c28623
Signed by untrusted user who does not match committer: pch
GPG key ID: 8F0826ECF7302C63
2 changed files with 26 additions and 15 deletions

View file

@ -130,9 +130,24 @@ public function suiteResults(?string $level = null, ?string $sortBy = null, ?str
$orderCol = $sortBy ?? $defaultOrder; $orderCol = $sortBy ?? $defaultOrder;
$direction = $sortDir === 'asc' ? 'asc' : 'desc'; $direction = $sortDir === 'asc' ? 'asc' : 'desc';
// psychbench sections are severity labels (mild → severe). Sort them
// by clinical severity, not alphabetically, when sorting by section.
$severitySort = $this->suite === 'psychbench' && $orderCol === 'section';
return $this->{$relation}() return $this->{$relation}()
->when($level !== null && $level !== '', fn ($q) => $q->where('level', $level)) ->when($level !== null && $level !== '', fn ($q) => $q->where('level', $level))
->orderBy($orderCol, $direction) ->when($severitySort, function ($q) use ($direction) {
$q->orderByRaw("CASE section
WHEN 'mild' THEN 1
WHEN 'moderate' THEN 2
WHEN 'difficult' THEN 3
WHEN 'severe' THEN 4
WHEN 'documentation' THEN 5
ELSE 6
END {$direction}");
}, function ($q) use ($orderCol, $direction) {
$q->orderBy($orderCol, $direction);
})
->orderBy('id') ->orderBy('id')
->get(); ->get();
} }

View file

@ -131,24 +131,20 @@ private function sortDir(): string
</div> </div>
<flux:card> <flux:card>
<flux:heading size="md">{{ __('Run metadata') }}</flux:heading> <div class="flex flex-wrap items-center gap-x-8 gap-y-2 text-sm">
<div class="mt-4 grid grid-cols-2 gap-x-8 gap-y-2 text-sm md:grid-cols-4">
<div><span class="text-zinc-500">{{ __('Engine build') }}</span><div class="font-mono">{{ $this->run->engine_build ?? '—' }}</div></div>
<div><span class="text-zinc-500">{{ __('Context') }}</span><div class="font-mono">{{ number_format($this->run->n_ctx ?? 0) }}</div></div>
<div><span class="text-zinc-500">{{ __('Slots') }}</span><div class="font-mono">{{ $this->run->slots ?? '—' }}</div></div>
<div><span class="text-zinc-500">{{ __('GPU') }}</span><div>{{ ($this->run->gpu_count ? $this->run->gpu_count.'x ' : '').($this->run->gpu ?? 'unknown') }}</div></div> <div><span class="text-zinc-500">{{ __('GPU') }}</span><div>{{ ($this->run->gpu_count ? $this->run->gpu_count.'x ' : '').($this->run->gpu ?? 'unknown') }}</div></div>
<div><span class="text-zinc-500">{{ __('Context') }}</span><div class="font-mono">{{ number_format($this->run->n_ctx ?? 0) }}</div></div>
<div><span class="text-zinc-500">{{ __('Inference host') }}</span><div><flux:badge size="xs" color="sky">{{ $this->run->engine ?? 'unknown' }}</flux:badge></div></div> <div><span class="text-zinc-500">{{ __('Inference host') }}</span><div><flux:badge size="xs" color="sky">{{ $this->run->engine ?? 'unknown' }}</flux:badge></div></div>
<div class="col-span-2"><span class="text-zinc-500">{{ __('Image digest') }}</span><div class="break-all font-mono text-xs">{{ $this->run->image_digest ?? '—' }}</div></div> @if ($this->run->label)
@if ($this->run->serverConfig) <div><span class="text-zinc-500">{{ __('Run name') }}</span><div><flux:badge size="xs" color="amber">{{ $this->run->label }}</flux:badge></div></div>
<div class="col-span-2"><span class="text-zinc-500">{{ __('Server config') }}</span><div><flux:badge size="xs" color="amber">{{ $this->run->serverConfig->name }}</flux:badge></div></div>
@endif
@if ($this->run->suite_versions)
<div class="col-span-2"><span class="text-zinc-500">{{ __('Suite versions') }}</span><div class="break-all font-mono text-xs">{{ json_encode($this->run->suite_versions) }}</div></div>
@endif
@if ($this->run->validators)
<div class="col-span-2"><span class="text-zinc-500">{{ __('Validators') }}</span><div class="break-all font-mono text-xs">{{ json_encode($this->run->validators) }}</div></div>
@endif @endif
</div> </div>
@if ($this->run->serverConfig)
<div class="mt-4">
<flux:heading size="sm">{{ __('Server config') }} — {{ $this->run->serverConfig->name }}</flux:heading>
<pre class="mt-2 overflow-x-auto rounded-lg bg-zinc-900 p-4 text-xs leading-relaxed text-zinc-100">{{ $this->run->serverConfig->config_yaml }}</pre>
</div>
@endif
</flux:card> </flux:card>
@if ($this->run->isOwnedBy(auth()->user())) @if ($this->run->isOwnedBy(auth()->user()))