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.
This commit is contained in:
@@ -12,6 +12,9 @@
|
||||
<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>
|
||||
|
||||
@@ -19,14 +22,22 @@
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
<h3>AI Analysis</h3>
|
||||
<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 thread.ai_summary }}</p>
|
||||
<p class="muted">Confidence: {{ ai.confidence }} • Model: {{ ai.model }}</p>
|
||||
<p class="muted">Last stored: {{ thread.last_analyzed_at }}</p>
|
||||
<p class="muted">Last alert level sent: {{ thread.last_alert_level_sent }} at {{ thread.last_alert_sent_at }}</p>
|
||||
{% 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>
|
||||
|
||||
+17
-17
@@ -30,38 +30,38 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card table-wrap">
|
||||
<table>
|
||||
<div class="card table-wrap" style="width: 100%; max-width: none;">
|
||||
<table style="width: 100%; table-layout: auto;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Subject</th>
|
||||
<th>AI Summary</th>
|
||||
<th>Account</th>
|
||||
<th>Msgs</th>
|
||||
<th>Requires Reply</th>
|
||||
<th>Updated</th>
|
||||
<th style="width: 5%;">ID</th>
|
||||
<th style="width: 25%;">Subject</th>
|
||||
<th style="width: 25%;">AI Summary</th>
|
||||
<th style="width: 10%;">Account</th>
|
||||
<th style="width: 5%;">Msgs</th>
|
||||
<th style="width: 15%;">Requires Reply</th>
|
||||
<th style="width: 15%;">Last Message</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for t in threads %}
|
||||
<tr>
|
||||
<td><a href="/thread/{{ t.id }}">{{ t.id }}</a></td>
|
||||
<td>{{ t.subject }}</td>
|
||||
<td class="muted">{{ t.ai_summary or '' }}</td>
|
||||
<td><span class="badge">{{ t.account_email }}</span></td>
|
||||
<td><span class="badge brand">{{ t.messages|length }}</span></td>
|
||||
<td><a href="/thread/{{ t.thread.id }}">{{ t.frontend_id }}</a></td>
|
||||
<td>{{ t.thread.subject }}</td>
|
||||
<td class="muted">{{ t.thread.ai_summary or '' }}</td>
|
||||
<td><span class="badge">{{ t.thread.account_email }}</span></td>
|
||||
<td><span class="badge brand">{{ t.thread.messages|length }}</span></td>
|
||||
<td>
|
||||
{% if t.requires_reply %}
|
||||
{% if t.thread.requires_reply %}
|
||||
<span class="badge warn">Needs reply</span>
|
||||
{% else %}
|
||||
<span class="badge success">Up to date</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="muted">{{ t.updated_at }}</td>
|
||||
<td class="muted">{{ t.formatted_date }}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr><td colspan="6">No threads yet</td></tr>
|
||||
<tr><td colspan="7">No threads yet</td></tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user