Files
subcast/eval/lib/apiStub.mjs
向阳乔木 fe76185596 feat(eval): subtitle evaluation harness and six fixtures
scripts/eval-translate.mjs scores segmentation (token coverage, cue length,
<1s, >1s silence) and translation (half sentences, >16/>32 chars, >9 chars/s,
term consistency, chrF) per fixture, optionally MQM via an LLM judge
(EVAL_*) and fresh translations with the app's own ai.ts (TRANSLATE_*).
scripts/eval-fixture.mjs exports 10-minute slices from the local database.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 07:26:56 -08:00

13 lines
655 B
JavaScript

/**
* [INPUT]: depends on globalThis.__EVAL_LLM__, set by appTranslate.mjs before the app modules load.
* [OUTPUT]: exports llmChat, the one runtime value src/lib/ai.ts takes from src/lib/api.ts.
* [POS]: stands in for src/lib/api.ts (Tauri IPC) when the harness runs the app's translation code under node;
* appTranslate.mjs's resolve hook routes "./api" imports from src/lib here.
* [PROTOCOL]: Update this header on change, then check CLAUDE.md
*/
export function llmChat(opts) {
const impl = globalThis.__EVAL_LLM__;
if (!impl) throw new Error("eval: no LLM configured (TRANSLATE_BASE_URL / TRANSLATE_MODEL)");
return impl(opts);
}