mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-15 12:55:51 +00:00
fix: searchSkills 使用缓存 IDF 前校验 index 引用一致性,修复测试间歇性失败
This commit is contained in:
@@ -397,7 +397,7 @@ export function searchSkills(
|
|||||||
for (const v of freq.values()) if (v > max) max = v
|
for (const v of freq.values()) if (v > max) max = v
|
||||||
for (const [term, count] of freq) queryTf.set(term, count / max)
|
for (const [term, count] of freq) queryTf.set(term, count / max)
|
||||||
|
|
||||||
const idf = cachedIdf ?? computeIdf(index)
|
const idf = cachedIndex === index && cachedIdf ? cachedIdf : computeIdf(index)
|
||||||
const queryTfIdf = new Map<string, number>()
|
const queryTfIdf = new Map<string, number>()
|
||||||
for (const [term, tf] of queryTf) {
|
for (const [term, tf] of queryTf) {
|
||||||
queryTfIdf.set(term, tf * (idf.get(term) ?? 0))
|
queryTfIdf.set(term, tf * (idf.get(term) ?? 0))
|
||||||
|
|||||||
Reference in New Issue
Block a user