ai: перевод абузных постов и саммари подборки (bot buttons, /sum, /tr, /api/summary, cache)
This commit is contained in:
@@ -332,6 +332,11 @@ select:focus,input:focus{border-color:rgba(124,108,244,.6)}
|
||||
<section id="view-abuse" style="display:none">
|
||||
<div class="strip" id="abuse-strip"></div>
|
||||
<div class="filters" id="abuse-tags"></div>
|
||||
<div class="filters" id="abuse-ai">
|
||||
<button class="chip" id="btn-ai-sum">ИИ-саммари</button>
|
||||
<span class="kv" id="ai-note">сводка по свежим находкам</span>
|
||||
</div>
|
||||
<div id="ai-sum" style="display:none;white-space:pre-wrap;border:1px solid rgba(255,255,255,.12);border-radius:10px;padding:14px 16px;margin:10px 0 16px;line-height:1.5"></div>
|
||||
<div class="cards" id="abuse-cards"></div>
|
||||
</section>
|
||||
|
||||
@@ -738,6 +743,25 @@ async function loadAbuse(tag) {
|
||||
</div>`).join('');
|
||||
}
|
||||
|
||||
$('#btn-ai-sum') && ($('#btn-ai-sum').onclick = async (e) => {
|
||||
const b = e.currentTarget; const t0 = b.textContent;
|
||||
const box = $('#ai-sum'); const note = $('#ai-note');
|
||||
b.disabled = true; b.textContent = 'думаю…';
|
||||
if (note) note.textContent = '';
|
||||
try {
|
||||
const q = new URLSearchParams({limit: 14});
|
||||
if (S.abuseTag) q.set('tag', S.abuseTag);
|
||||
const r = await api('/api/summary?' + q);
|
||||
if (!r.ok) throw new Error(r.error === 'ai_not_configured' ? 'ИИ не настроен: OMNI_AI_KEY' : 'ошибка ИИ');
|
||||
box.style.display = '';
|
||||
box.textContent = r.summary || 'саммари пустое';
|
||||
if (note) note.textContent = 'записей ' + r.n;
|
||||
} catch (err) {
|
||||
box.style.display = ''; box.textContent = 'не вышло: ' + err.message;
|
||||
}
|
||||
b.disabled = false; b.textContent = t0;
|
||||
});
|
||||
|
||||
$('#btn-discover') && ($('#btn-discover').onclick = async (e) => {
|
||||
const b = e.currentTarget; const t0 = b.textContent;
|
||||
b.disabled = true; b.textContent = 'ищу фиды…';
|
||||
|
||||
Reference in New Issue
Block a user