File size: 686 Bytes
494c9e4 17037b0 28147a1 494c9e4 28147a1 494c9e4 28147a1 494c9e4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /** 语义匹配度阈值:用户可配置,持久化到 localStorage,与 Semantic analysis 同方式 */
import { SEMANTIC_MATCH_THRESHOLD } from '../core/constants';
import { lsGet, lsSet } from '../storage/localStorageHelpers';
const KEY = 'info_radar_semantic_match_threshold';
export function getSemanticMatchThreshold(): number {
const v = lsGet(KEY);
if (v == null) return SEMANTIC_MATCH_THRESHOLD;
const n = parseFloat(v);
return Number.isFinite(n) && n >= 0 && n <= 1 ? n : SEMANTIC_MATCH_THRESHOLD;
}
export function setSemanticMatchThreshold(value: number): void {
const clamped = Math.max(0, Math.min(1, value));
lsSet(KEY, String(clamped));
}
|