fix(ai): adaptive max_tokens per backend (reasoning profiles get 1024+, native llama.cpp stays compact; per-profile max_tokens override); include entry texts in ai_status SSE notify so journal updates live without reload; audit log action filter; links pagination; settings validation & UI improvements
This commit is contained in:
@@ -41,6 +41,11 @@ const ACTION_LABELS = {
|
||||
'ai.wake': 'Воркер ИИ разбужен вручную',
|
||||
'ai.enabled': 'Переключена автопроверка ИИ',
|
||||
'ai.requeue-failed': 'Ошибочные записи возвращены в очередь ИИ',
|
||||
'ai.profile.create': 'Создан профиль ИИ',
|
||||
'ai.profile.update': 'Изменён профиль ИИ',
|
||||
'ai.profile.delete': 'Удалён профиль ИИ',
|
||||
'ai.profile.activate': 'Выбран активный профиль ИИ',
|
||||
'export.student': 'Экспорт данных ученика',
|
||||
};
|
||||
|
||||
const AUDIT_PAGE_SIZE = 50;
|
||||
@@ -95,6 +100,8 @@ async function loadAudit() {
|
||||
const p = new URLSearchParams();
|
||||
p.set('limit', AUDIT_PAGE_SIZE);
|
||||
p.set('offset', (auditPage - 1) * AUDIT_PAGE_SIZE);
|
||||
const action = document.getElementById('auditActionFilter').value;
|
||||
if (action) p.set('action', action);
|
||||
const res = await fetch(`${API}/api/audit?${p}`, { headers: hdr() });
|
||||
if (!res.ok) { el.innerHTML = '<tr><td colspan="4" style="color:var(--muted)">Ошибка загрузки</td></tr>'; return; }
|
||||
const rows = await res.json();
|
||||
@@ -126,6 +133,18 @@ function goAuditPage(p) {
|
||||
loadAudit();
|
||||
}
|
||||
|
||||
function fillActionFilter() {
|
||||
const sel = document.getElementById('auditActionFilter');
|
||||
const current = sel.value;
|
||||
const opts = Object.entries(ACTION_LABELS)
|
||||
.sort((a, b) => a[1].localeCompare(b[1], 'ru'))
|
||||
.map(([k, v]) => `<option value="${esc(k)}">${esc(v)}</option>`)
|
||||
.join('');
|
||||
sel.innerHTML = '<option value="">Все действия</option>' + opts;
|
||||
sel.value = current;
|
||||
}
|
||||
|
||||
document.getElementById('auditActionFilter').addEventListener('change', () => { auditPage = 1; loadAudit(); });
|
||||
document.getElementById('auditFilter').addEventListener('input', () => { auditPage = 1; loadAudit(); });
|
||||
document.getElementById('auditRefreshBtn').addEventListener('click', loadAudit);
|
||||
|
||||
@@ -148,6 +167,7 @@ document.getElementById('auditDetailsModal').addEventListener('click', e => {
|
||||
(async () => {
|
||||
if (await requireAdminPage()) {
|
||||
buildSidebar(document.body.dataset.page);
|
||||
fillActionFilter();
|
||||
loadAudit();
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user