feat: фаза 3 (часть 1) — disclaimer, очередь, initiator + IP

3.6 UI: убрать stat-minibar и heatmap с дашборда
3.2 AI disclaimer под каждым LLM-вердиктом
3.4 LLM_MAX_CONCURRENT_ANALYSES + Semaphore в llm.py
3.1 Scan.initiator + source_ip, webhook захватывает, UI показывает
This commit is contained in:
Marker689
2026-05-10 07:32:14 +03:00
parent 0069331119
commit 4ae893a025
13 changed files with 69 additions and 52 deletions

View File

@@ -7,4 +7,5 @@
</div>
<p class="llm-summary">{{ report.summary }}</p>
<p class="llm-analysis">{{ report.analysis }}</p>
<p class="llm-disclaimer">⚠ AI-generated analysis — may contain inaccuracies. Always verify findings before taking action.</p>
</div>

View File

@@ -1,47 +1,21 @@
<div class="stat-minibar">
<span><strong>{{ total_scans }}</strong> scans</span>
<span><strong class="flagged">{{ flagged_scans }}</strong> flagged</span>
<span><strong>{{ total_findings }}</strong> findings</span>
<span class="severity-ERROR"><strong>{{ errors_count }}</strong> errors</span>
<span class="severity-WARNING"><strong>{{ warnings_count }}</strong> warnings</span>
</div>
<div class="dashboard-grid">
{% if days %}
<article class="dash-block">
<h3>Scan activity (14 days)</h3>
<div class="heatmap">
{% set max_cnt = days | map(attribute=1) | max %}
{% for day, cnt, fl in days %}
<div class="heatmap-day" title="{{ day }}: {{ cnt }} scans, {{ fl }} flagged">
{% set h = (cnt / max_cnt * 38) | int if max_cnt > 0 else 0 %}
<div class="bar" style="height: {{ h }}px; background: {% if fl > 0 %}var(--pico-color-red-500){% else %}var(--pico-color-zinc-500){% endif %};"></div>
<div class="tooltip">{{ day }}: {{ cnt }} scans, {{ fl }} flagged</div>
</div>
{% endfor %}
</div>
</article>
{% endif %}
{% if latest_flagged %}
<article class="dash-block dash-block-warn">
<h3>Latest Flagged</h3>
<table class="compact">
<thead><tr><th>Package</th><th>Version</th><th>Findings</th><th>Time</th></tr></thead>
<tbody>
{% for s in latest_flagged %}
<tr>
<td><a href="/scans/{{ s.id }}"><strong class="flagged">{{ s.package_name }}</strong></a></td>
<td>{{ s.package_version }}</td>
<td><span class="flagged">{{ s.total_findings }}</span></td>
<td>{{ s.started_at.strftime('%m-%d %H:%M') if s.started_at }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</article>
{% endif %}
</div>
{% if latest_flagged %}
<article class="dash-block dash-block-warn">
<h3>Latest Flagged</h3>
<table class="compact">
<thead><tr><th>Package</th><th>Version</th><th>Findings</th><th>Time</th></tr></thead>
<tbody>
{% for s in latest_flagged %}
<tr>
<td><a href="/scans/{{ s.id }}"><strong class="flagged">{{ s.package_name }}</strong></a></td>
<td>{{ s.package_version }}</td>
<td><span class="flagged">{{ s.total_findings }}</span></td>
<td>{{ s.started_at.strftime('%m-%d %H:%M') if s.started_at }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</article>
{% endif %}
<article class="dash-block" style="margin-top: 0;">
<h3>Latest Scans</h3>

View File

@@ -64,6 +64,7 @@
</div>
<p class="llm-summary">{{ f.report.summary }}</p>
<p class="llm-analysis">{{ f.report.analysis }}</p>
<p class="llm-disclaimer">⚠ AI-generated analysis — may contain inaccuracies.</p>
</div>
{% else %}
<div class="llm-actions" id="llm-{{ f.id }}">

View File

@@ -24,6 +24,8 @@
<div><strong>SHA256</strong><br><code class="sha256">{{ scan.sha256 or '-' }}</code></div>
<div><strong>Started</strong><br>{{ scan.started_at.strftime('%Y-%m-%d %H:%M') if scan.started_at }}</div>
<div><strong>Finished</strong><br>{{ scan.finished_at.strftime('%Y-%m-%d %H:%M') if scan.finished_at }}</div>
{% if scan.initiator %}<div><strong>Initiated by</strong><br>{{ scan.initiator }}</div>{% endif %}
{% if scan.source_ip %}<div><strong>Source IP</strong><br>{{ scan.source_ip }}</div>{% endif %}
</div>
{% if scan.error_message %}<div class="scan-error"><strong>Error:</strong> {{ scan.error_message }}</div>{% endif %}
</article>
@@ -58,6 +60,7 @@
</div>
<p class="llm-summary">{{ f.report.summary }}</p>
<p class="llm-analysis">{{ f.report.analysis }}</p>
<p class="llm-disclaimer">⚠ AI-generated analysis — may contain inaccuracies.</p>
</div>
{% else %}
<div class="llm-actions" id="llm-{{ f.id }}">