mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 10:07:41 +00:00
fix: MMR default disabled, tie-break null guard, correct docs URL
- DEFAULT_MMR_CONFIG.enabled = false (opt-in, was incorrectly true) - Tie-break: handle bestItem === null so first candidate always wins - CHANGELOG URL: docs.clawd.bot → docs.openclaw.ai - Tests updated to pass enabled: true explicitly where needed
This commit is contained in:
committed by
Peter Steinberger
parent
6b3e0710f4
commit
33cf27a52a
@@ -14,14 +14,14 @@ export type MMRItem = {
|
||||
};
|
||||
|
||||
export type MMRConfig = {
|
||||
/** Enable/disable MMR re-ranking. Default: true */
|
||||
/** Enable/disable MMR re-ranking. Default: false (opt-in) */
|
||||
enabled: boolean;
|
||||
/** Lambda parameter: 0 = max diversity, 1 = max relevance. Default: 0.7 */
|
||||
lambda: number;
|
||||
};
|
||||
|
||||
export const DEFAULT_MMR_CONFIG: MMRConfig = {
|
||||
enabled: true,
|
||||
enabled: false,
|
||||
lambda: 0.7,
|
||||
};
|
||||
|
||||
@@ -163,7 +163,7 @@ export function mmrRerank<T extends MMRItem>(items: T[], config: Partial<MMRConf
|
||||
// Use original score as tiebreaker (higher is better)
|
||||
if (
|
||||
mmrScore > bestMMRScore ||
|
||||
(mmrScore === bestMMRScore && bestItem && candidate.score > bestItem.score)
|
||||
(mmrScore === bestMMRScore && (bestItem === null || candidate.score > bestItem.score))
|
||||
) {
|
||||
bestMMRScore = mmrScore;
|
||||
bestItem = candidate;
|
||||
|
||||
Reference in New Issue
Block a user