Files
email_alerts_v2/templates/thread_detail.html
T
bolade 1fd3a95093 Refactor AI analysis and email fetching functionality
- Removed AI analysis guide and related documentation files.
- Updated email fetching logic to intelligently determine start date based on the latest email date in the database.
- Enhanced the app module to include a button for re-analyzing threads with AI.
- Improved database interactions to trigger AI analysis after ingesting sent emails.
- Adjusted the UI to display additional information about threads, including formatted latest message dates.
- Removed outdated test scripts for AI analysis and email fetching.
- Updated styles for better responsiveness and layout in the frontend.
2025-08-12 09:54:10 +01:00

65 lines
2.5 KiB
HTML

{% extends "base.html" %}
{% block content %}
<div class="row mb-2">
<div class="col">
<h2>Thread #{{ thread.id }}</h2>
<p class="muted">Subject: <strong>{{ thread.subject }}</strong></p>
<p class="muted">Account: <span class="badge">{{ thread.account_email }}</span></p>
<p>
{% if thread.requires_reply %}
<span class="badge warn">Needs reply</span>
{% else %}
<span class="badge success">Up to date</span>
{% endif %}
</p>
<div class="mt-2">
<a href="/thread/{{ thread.id }}?force_analyze=true" class="btn btn-sm">🔄 Re-analyze with AI</a>
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="card">
<h3>AI Analysis</h3>
{% if ai %}
<p>
<strong>Actionable:</strong>
{% if ai.actionable %}<span class="badge warn">Yes</span>{% else %}<span class="badge success">No</span>{% endif %}
</p>
<p><strong>Summary:</strong> {{ ai.summary or "No summary available" }}</p>
<p class="muted">Confidence: {{ ai.confidence or "N/A" }}{% if ai.model %} • Model: {{ ai.model }}{% endif %}</p>
{% if ai.analyzed_at %}
<p class="muted">Analysis cached from: {{ ai.analyzed_at }}</p>
{% elif thread.last_analyzed_at %}
<p class="muted">Last analyzed: {{ thread.last_analyzed_at }}</p>
{% endif %}
{% else %}
<p class="muted">No AI analysis available</p>
{% endif %}
<p class="muted">Last alert level sent: {{ thread.last_alert_level_sent }}{% if thread.last_alert_sent_at %} at {{ thread.last_alert_sent_at }}{% endif %}</p>
</div>
</div>
</div>
<div class="row mt-2">
<div class="col">
<h3>Messages</h3>
<div class="messages">
{% for m in messages %}
<div class="msg-item {% if m.is_incoming %}incoming{% else %}outgoing{% endif %}">
<div class="msg-bubble">
<div class="msg-meta">{{ m.date_sent }} • {% if m.is_incoming %}Incoming{% else %}Outgoing{% endif %} • {{ m.folder }}</div>
<div class="msg-meta">From: <span class="pill">{{ m.from_email }}</span> → To: <span class="pill">{{ m.to_email }}</span></div>
<div class="msg-subject">{{ m.subject }}</div>
<div class="msg-body"><pre>{{ m.body }}</pre></div>
</div>
</div>
{% else %}
<p class="muted">No messages.</p>
{% endfor %}
</div>
</div>
</div>
{% endblock %}