Fix chat UI to show helpful message when text-router logs don't contain chat data

This commit is contained in:
Reditus committed 2026-05-15 18:47:00 +01:00
1 parent 79d9abef34
commit 341e9a3213
2 files changed
+17 -4

No files matched your search

+12 -3
View File
@@ -60,14 +60,23 @@ function formatTimestamp(ts) {
return ts;
}
function renderMessages(messages) {
function renderMessages(messages, note) {
const container = document.getElementById('chat-messages');
const filter = document.getElementById('filter-channel').value;
const filtered = filter === 'all' ? messages : messages.filter(m => m.channel === filter);
if (filtered.length === 0) {
container.innerHTML = '<div style="text-align:center;padding:40px;color:var(--text-muted);">No chat messages found</div>';
let msg = 'No chat messages found.';
if (note) {
msg = `<div style="text-align:center;padding:40px;color:var(--text-muted);max-width:500px;margin:0 auto;">
<p style="font-size:14px;margin-bottom:8px;">${note}</p>
<p style="font-size:12px;color:var(--text-muted);">Chat parsing relies on text-router pod logs, which may not include chat in all server versions.</p>
</div>`;
} else {
msg = '<div style="text-align:center;padding:40px;color:var(--text-muted);">No chat messages found</div>';
}
container.innerHTML = msg;
container.style.display = 'block';
return;
}
@@ -107,7 +116,7 @@ async function loadChat() {
const resp = await fetch('/api/chat_logs');
const data = await resp.json();
if (data.success) {
renderMessages(data.messages);
renderMessages(data.messages, data.note);
document.getElementById('last-updated').textContent = `Updated ${new Date().toLocaleTimeString()}`;
} else {
loading.textContent = 'Error: ' + (data.error || 'Failed to load chat logs');