Adjust story summary recall thresholds
This commit is contained in:
@@ -59,7 +59,7 @@ export async function searchStateAtoms(queryVector, vectorConfig) {
|
||||
const atoms = getStateAtoms();
|
||||
const atomMap = new Map(atoms.map(a => [a.atomId, a]));
|
||||
|
||||
// 计算匹配度
|
||||
// 计算相似度
|
||||
const scored = stateVectors
|
||||
.map(sv => {
|
||||
const atom = atomMap.get(sv.atomId);
|
||||
@@ -92,8 +92,8 @@ export function buildL0FloorBonus(l0Results, bonusFactor = 0.10) {
|
||||
const floorBonus = new Map();
|
||||
|
||||
for (const r of l0Results || []) {
|
||||
// 每个楼层只加一次,取最高匹配度对应的 bonus
|
||||
// 简化处理:统一加 bonusFactor,不区分匹配度高低
|
||||
// 每个楼层只加一次,取最高相似度对应的 bonus
|
||||
// 简化处理:统一加 bonusFactor,不区分相似度高低
|
||||
if (!floorBonus.has(r.floor)) {
|
||||
floorBonus.set(r.floor, bonusFactor);
|
||||
}
|
||||
@@ -132,13 +132,13 @@ export function stateToVirtualChunks(l0Results) {
|
||||
|
||||
/**
|
||||
* 合并 L0 和 L1 chunks,每楼层最多保留 limit 条
|
||||
* @param {Array} l0Chunks - 虚拟 chunks(已按匹配度排序)
|
||||
* @param {Array} l1Chunks - 真实 chunks(已按匹配度排序)
|
||||
* @param {Array} l0Chunks - 虚拟 chunks(已按相似度排序)
|
||||
* @param {Array} l1Chunks - 真实 chunks(已按相似度排序)
|
||||
* @param {number} limit - 每楼层上限
|
||||
* @returns {Array} 合并后的 chunks
|
||||
*/
|
||||
export function mergeAndSparsify(l0Chunks, l1Chunks, limit = 2) {
|
||||
// 合并并按匹配度排序
|
||||
// 合并并按相似度排序
|
||||
const all = [...(l0Chunks || []), ...(l1Chunks || [])]
|
||||
.sort((a, b) => b.similarity - a.similarity);
|
||||
|
||||
@@ -153,7 +153,7 @@ export function mergeAndSparsify(l0Chunks, l1Chunks, limit = 2) {
|
||||
}
|
||||
}
|
||||
|
||||
// 扁平化并保持匹配度排序
|
||||
// 扁平化并保持相似度排序
|
||||
return Array.from(byFloor.values())
|
||||
.flat()
|
||||
.sort((a, b) => b.similarity - a.similarity);
|
||||
|
||||
Reference in New Issue
Block a user