File size: 648 Bytes
494c9e4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | /** 语义匹配度阈值:用户可配置,持久化到 localStorage,与 Semantic analysis 同方式 */
import { SEMANTIC_MATCH_THRESHOLD } from '../constants';
const KEY = 'info_radar_semantic_match_threshold';
export function getSemanticMatchThreshold(): number {
const v = localStorage.getItem(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));
localStorage.setItem(KEY, String(clamped));
}
|