We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent aec0fc7 commit 351c4aeCopy full SHA for 351c4ae
1 file changed
app/api/chat/route.js
@@ -634,6 +634,16 @@ function replaceTermsWithLinks(text) {
634
})
635
}
636
637
+ // Link raw VFB/FBbt IDs using their preferred short label when available.
638
+ // This makes e.g. "VFB_00102107" render as "%label%" but still link to the report.
639
+ result = result.replace(/\b(FBbt_\d{8}|VFB_\d{8})\b/g, (match) => {
640
+ const label = reverseLookupCache?.[match]
641
+ const display = label || match
642
+ const link = `[${display}](${REPORT_BASE + encodeURIComponent(match)})`
643
+ allLinks.push(link)
644
+ return `\x00LINK${allLinks.length - 1}\x00`
645
+ })
646
+
647
result = result.replace(/\x00LINK(\d+)\x00/g, (_, idx) => allLinks[parseInt(idx)])
648
649
return result
0 commit comments