feat(maria-dashboard): reset pentru firele de discutie active
Nu exista nicio cale sa resetezi manual un fir blocat pe o discutie veche (nici comanda de chat, nici buton) — un test in grupul "Maria Test" a ramas ancorat pe un subiect vechi fara sa poata fi curatat fara interventie directa pe server. Sectiune noua in dashboard, intre "Trimise la suport" si "Clienti cunoscuti": listeaza firele active din ~/.maria-bridge/conversations/ si le sterge la cerere (rutele GET/POST /api/maria/fire), cu aceeasi sanitizare de nume de fisier ca rag/fir.py (oglinda, nu import — coliziune de modul intre proiecte). 11/11 teste (6 noi + cele de clienti), fara regresii. Co-Authored-By: Claude Agent <noreply@anthropic.com>
This commit is contained in:
@@ -120,6 +120,16 @@
|
||||
<div id="mEsc" class="empty">se încarcă…</div>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2>Fire de discuție active <span class="count" id="mFirCount"></span></h2>
|
||||
<div class="table-scroll">
|
||||
<table class="stack-mobil">
|
||||
<thead><tr><th>JID</th><th>Subiect</th><th>Ultima activitate</th><th></th></tr></thead>
|
||||
<tbody id="mFire"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h2>Clienți cunoscuți <span class="count" id="mClientCount"></span></h2>
|
||||
<div class="table-scroll">
|
||||
@@ -596,6 +606,24 @@ async function mDelClient(id) {
|
||||
await mLoadClients();
|
||||
}
|
||||
|
||||
async function mLoadFire() {
|
||||
var res = await api('api/maria/fire');
|
||||
var fire = res.ok ? (res.data.fire || []) : [];
|
||||
document.getElementById('mFirCount').textContent = fire.length ? fire.length : '';
|
||||
document.getElementById('mFire').innerHTML = fire.length ? fire.map(function (f) {
|
||||
return '<tr><td data-label="JID" class="mono">' + esc(f.jid) + '</td>'
|
||||
+ '<td data-label="Subiect">' + esc(f.ancora) + '</td>'
|
||||
+ '<td data-label="Ultima activitate">' + (f.at ? new Date(f.at * 1000).toLocaleString('ro-RO') : '—') + '</td>'
|
||||
+ '<td><button class="small danger" onclick="mDelFir(\'' + esc(f.jid) + '\')">Resetează</button></td></tr>';
|
||||
}).join('') : '<tr><td colspan="4" class="empty" data-label="">niciun fir activ</td></tr>';
|
||||
}
|
||||
|
||||
async function mDelFir(jid) {
|
||||
if (!confirm('Resetezi firul cu ' + jid + '? Maria va porni o discutie noua la urmatorul mesaj.')) return;
|
||||
await post('api/maria/fire/delete', { jid: jid });
|
||||
await mLoadFire();
|
||||
}
|
||||
|
||||
var mLogFile = 'bridge';
|
||||
function mSetLog(which) { mLogFile = which; mRefreshLogs(); }
|
||||
async function mRefreshLogs() {
|
||||
@@ -610,7 +638,7 @@ async function mRefreshLogs() {
|
||||
|
||||
// ── pornire ───────────────────────────────────────────────────
|
||||
refresh(); refreshDoctor(); refreshLogs();
|
||||
mRefresh(); mRefreshLogs(); mLoadClients();
|
||||
mRefresh(); mRefreshLogs(); mLoadClients(); mLoadFire();
|
||||
setInterval(refresh, 5000);
|
||||
setInterval(refreshDoctor, 30000);
|
||||
setInterval(mRefresh, 4000);
|
||||
|
||||
Reference in New Issue
Block a user