fix: references bug

fix
This commit is contained in:
Per Stark
2026-02-11 21:45:20 +01:00
parent 96846ad664
commit bbad91d55b
8 changed files with 699 additions and 58 deletions

View File

@@ -111,12 +111,23 @@
// Load content if needed
if (!tooltipContent) {
fetch(`/chat/reference/${encodeURIComponent(reference)}`)
.then(response => response.text())
.then(response => {
if (!response.ok) {
throw new Error(`reference lookup failed with status ${response.status}`);
}
return response.text();
})
.then(html => {
tooltipContent = html;
if (document.getElementById(tooltipId)) {
document.getElementById(tooltipId).innerHTML = html;
}
})
.catch(() => {
tooltipContent = '<div class="text-xs opacity-70">Reference unavailable.</div>';
if (document.getElementById(tooltipId)) {
document.getElementById(tooltipId).innerHTML = tooltipContent;
}
});
} else if (tooltip) {
// Set content if already loaded