接入 LiveKit 与 TurnSense 评分并改进模型曲线选择
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
// @ts-expect-error Node's native TypeScript runner requires explicit extensions.
|
||||
import { readScorePreferences } from "../lib/score-models.ts";
|
||||
|
||||
test("first visit starts with three comparison curves and each model's reference threshold", () => {
|
||||
const defaults = readScorePreferences(null);
|
||||
assert.deepEqual(Object.entries(defaults.visibility).filter(([, value]) => value).map(([id]) => id), ["maai", "smart_turn", "turnsense"]);
|
||||
assert.equal(defaults.thresholds.livekit_mini, .355);
|
||||
});
|
||||
|
||||
test("saved choices preserve clear-all and accept only supported reference thresholds", () => {
|
||||
const saved = readScorePreferences({ version: 1, visibility: { maai: false, smart_turn: false, silero_vad: false, livekit_mini: false, turnsense: false },
|
||||
thresholds: { maai: .11, livekit_mini: .355, smart_turn: 99, turnsense: "0.8" } });
|
||||
assert.equal(Object.values(saved.visibility).some(Boolean), false);
|
||||
assert.equal(saved.thresholds.maai, .11);
|
||||
assert.equal(saved.thresholds.smart_turn, .5);
|
||||
assert.equal(saved.thresholds.turnsense, .5);
|
||||
});
|
||||
|
||||
test("partial and invalid preferences leave future models on their defaults", () => {
|
||||
const saved = readScorePreferences({ version: 1, visibility: { maai: true, smart_turn: "false", unknown: true }, thresholds: { turnsense: .8 } });
|
||||
assert.equal(saved.visibility.smart_turn, true);
|
||||
assert.equal(saved.visibility.turnsense, true);
|
||||
assert.equal(saved.thresholds.turnsense, .8);
|
||||
assert.equal("unknown" in saved.visibility, false);
|
||||
assert.deepEqual(readScorePreferences({ version: 999, visibility: { maai: false } }), readScorePreferences(null));
|
||||
});
|
||||
Reference in New Issue
Block a user