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
+12 -1
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
@@ -1,3 +1,11 @@
<div>{{entity.name}}</div>
<div>{{entity.description}}</div>
<div>{{entity.updated_at|datetimeformat(format="short", tz=user.timezone)}} </div>
{% if text_chunk %}
<div class="font-semibold">Chunk Reference</div>
<div class="text-sm whitespace-pre-wrap">{{text_chunk.chunk}}</div>
<div class="text-xs opacity-70">{{text_chunk_updated_at}}</div>
{% elif entity %}
<div class="font-semibold">{{entity.name}}</div>
<div class="text-sm">{{entity.description}}</div>
<div class="text-xs opacity-70">{{entity_updated_at}}</div>
{% else %}
<div class="text-xs opacity-70">Reference unavailable.</div>
{% endif %}