okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221merge f-split-ui2 baeb4533b (approved UI designs, context fix, workspace default with rename, autotune progress) into f-split-intc5755ed83

main
1.2 KiB23 linesraw
1import type { TuneProgress } from './native-tune';
2
3/**
4 * Which of the five steps the tuner is in, from the stage its status file names (strata_control/autotune.py):
5 * start and waiting are the PC check, base the first measurement, plan / rounds / drift / per_request the settings tried,
6 * confirm the repeat test, and done the last moment before the result is saved and shown.
7 */
8export function tunePhase(stage: string | undefined | null): number {
9  switch (stage) {
10    case 'base': return 1;
11    case 'plan': case 'rounds': case 'drift': case 'per_request': return 2;
12    case 'confirm': return 3;
13    case 'done': return 4;
14    default: return 0;
15  }
16}
17
18/** Every measurement so far: "base" first, then each setting tried, as decode tokens per second. */
19export function tuneSpeeds(progress: TuneProgress | undefined | null): { label: string; tok_s: number }[] {
20  const list = (progress as (TuneProgress & { speeds?: { label?: unknown; tok_s?: unknown }[] }) | undefined | null)?.speeds;
21  if (!Array.isArray(list)) return [];
22  return list.filter(x => typeof x?.tok_s === 'number' && Number.isFinite(x.tok_s) && x.tok_s > 0).map(x => ({ label: String(x.label ?? ''), tok_s: x.tok_s as number }));
23}