{% extends "base.html" %} {% from "_macros.html" import icon %} {% from "_macros_ui.html" import empty_state %} {% block title %}Аналитика — TG Agent{% endblock %} {% block content %} {% macro msg_text(text, max_len=100) %}{{ (text or '')[:max_len] }}{{ '…' if text and text|length > max_len else '' }}{% endmacro %}

Аналитика сообщений

Сообщения Каналы Тренды Контент
Топ сообщений по реакциям
{% if top_messages %}
{% for msg in top_messages %} {% endfor %}
# Дата Канал Тип Текст Реакции
{{ loop.index }} {{ msg.date|local_dt }} {{ msg.channel_title or msg.channel_username or msg.channel_id }} {{ msg.media_type or 'text' }} {{ msg_text(msg.text) }} {{ msg.total_reactions }} {% if msg.channel_username %} {{ icon("link") }} {% else %} {{ icon("link") }} {% endif %}
{% for msg in top_messages %}
{{ msg.channel_title or msg.channel_username or msg.channel_id }} {{ msg.total_reactions }} 👍
{{ msg.date|local_dt }} · {{ msg.media_type or 'text' }}

{{ msg_text(msg.text) }}

{% if msg.channel_username %} Открыть {{ icon("link") }} {% else %} Открыть {{ icon("link") }} {% endif %}
{% endfor %}
{% else %} {{ empty_state("Нет данных. Реакции собираются при сборе сообщений.", class="card-body mb-0") }} {% endif %}
Вовлечённость по типу контента
{% if by_media_type %}
{% for row in by_media_type %} {% endfor %}
ТипСообщенийСр. реакций
{{ row.content_type }} {{ row.message_count }} {{ "%.1f"|format(row.avg_reactions) }}
{% else %} {{ empty_state("Нет данных.", class="card-body mb-0") }} {% endif %}
Активность по часам (UTC)
{% if hourly %}
{% for row in hourly %} {% endfor %}
ЧасСообщенийСр. реакций
{{ '%02d:00'|format(row.hour) }} {{ row.message_count }} {{ "%.1f"|format(row.avg_reactions) }}
{% else %} {{ empty_state("Нет данных.", class="card-body mb-0") }} {% endif %}
{% endblock %}