Elffuss BraidHub

kikocis/utopia public

A candidate should earn its place by resembling the thing, not by its ancestry (#119)

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Changesetf9f23e10e2c26713fbbec77f863a576bbb84fbd9aa1b00f21498f5864dd3843d
AuthorWaylandYang <145302500+WaylandYang@users.noreply.github.com> · 2026-08-31 01:57 +08:00
CommitterGitHub <noreply@github.com> · 2026-08-31 01:57 +08:00
Parents3db7c421a6a8

Browse the files at this changeset

1 file changed

modified crates/utopia-server/src/type_resolution.rs +15 −2
@@ -212,8 +212,21 @@
212212 ranked.push(c.clone());
213213 }
214214 }
215- // 稳定排序:后代提前,同一档内保持距离序
216- ranked.sort_by_key(|c| !descendants.contains(&c.id));
215+ // **不再把后代无条件提前。**
216+ //
217+ // 从前这里是 `ranked.sort_by_key(|c| !descendants.contains(&c.id))`:key 是
218+ // 布尔,于是候选被切成"后代"与"非后代"两堆,前者整堆压过后者,**距离完全
219+ // 不参与**。实测「深蓝向量数据库」(现类 product,specific = vector database
220+ // software):正确答案 `software_application` 在检索里排**第 1**,却被
221+ // product_collection(0.437)、some_products(0.440) 这五个不相关的 product
222+ // 后代挤出候选——它们上来只因为出身,不因为像。
223+ //
224+ // 这个偏好本来就表达了三遍:这行排序、提示词里 narrowing/correcting 的分辨、
225+ // 以及 `crosses_axis` 分档。删掉最不讲证据的那一遍,另外两遍照旧——换轴的
226+ // 改动仍然不自动落库,仍然进人工,风险面没有变。
227+ //
228+ // 剩下的顺序就是两路交替的检索序:检索决定端什么上去,裁决决定它是什么,
229+ // `crosses_axis` 决定要不要人看。一层一件事。
217230 let candidates: Vec<_> = ranked.into_iter().take(CANDIDATES as usize).collect();
218231 // 第二路:语境相似的已定类实体,按类投票
219232 let raw =