mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-15 23:32:40 +00:00
fix: show relevance badge for single-source citations (#29647)
A response with exactly one citation never showed its relevance badge, even though the source carried a perfectly valid score. Adding a second citation made the badge appear for that same source, so the score looked like it came and went at random. calculateShowRelevance hides relevance when a result set mixes distance metrics (cosine in -1..1 next to unbounded L2), since those numbers are not comparable. With a single distance that check degenerates: distances.length - 1 is 0, so the "all but one are out of range" clause matches whatever the value is, and the score is hidden. A lone distance cannot be a mix of two metrics, so it now returns before the outlier check runs. Sets of two or more distances behave exactly as before, mixed-metric sets are still suppressed. Fixes #29646
This commit is contained in:
parent
d75a7aaf54
commit
323f8da202
1 changed files with 5 additions and 0 deletions
|
|
@ -80,6 +80,11 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
// A single distance cannot be an outlier
|
||||
if (distances.length === 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (
|
||||
(inRange === distances.length - 1 && outOfRange === 1) ||
|
||||
(outOfRange === distances.length - 1 && inRange === 1)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue