fix(web): display document_name instead of file_id in retrieval results

The getTitle fallback order was reversed, always showing the UUID
(file_id) since it's always truthy. Swap priority to document_name
first.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
youhuanghe
2026-03-08 04:24:41 +00:00
parent cadcf10047
commit 40c7b0f731
@@ -51,10 +51,10 @@ export default function KBRetrieveGeneric({
if (getResultTitle) { if (getResultTitle) {
return getResultTitle(result); return getResultTitle(result);
} }
// Default: use file_id or document_name from metadata // Default: use document_name from metadata, fallback to file_id or id
return ( return (
(result.metadata.file_id as string) ||
(result.metadata.document_name as string) || (result.metadata.document_name as string) ||
(result.metadata.file_id as string) ||
result.id result.id
); );
}; };