diff --git a/app/routes/api.py b/app/routes/api.py index 91f030b..f520f68 100644 --- a/app/routes/api.py +++ b/app/routes/api.py @@ -302,7 +302,11 @@ def register_api_routes(app, services, settings): 'is_admin': row.get('is_admin', False), }) - return jsonify({'success': True, 'messages': messages, 'count': len(messages)}) + note = None + if not messages: + note = "Chat messages are not available in this server version. The text-router pod does not expose chat logs via kubectl." + + return jsonify({'success': True, 'messages': messages, 'count': len(messages), 'note': note}) except Exception as e: return jsonify({'success': False, 'error': str(e)}) diff --git a/templates/chat.html b/templates/chat.html index 03f69d2..793c80c 100644 --- a/templates/chat.html +++ b/templates/chat.html @@ -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 = '
No chat messages found
'; + let msg = 'No chat messages found.'; + if (note) { + msg = `
+

${note}

+

Chat parsing relies on text-router pod logs, which may not include chat in all server versions.

+
`; + } else { + msg = '
No chat messages found
'; + } + 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');