feat: Настройки › ИИ-ассистент - each model and the web search folded to a line (name, kind and model), opened when wanted; a new model opens, its line follows its fields

This commit is contained in:
redtea committed 2026-10-18 11:16:08 +03:00
1 parent fcf032042b
commit dcbc602d88
3 files changed
+31 -8

No files matched your search

+13
View File
@@ -36,6 +36,19 @@
const del = ev.target.closest('.ai-model-del');
if (del && list.children.length > 1) del.closest('.ai-model').remove();
});
// A folded card's line follows its fields: the name, the kind and model.
list.addEventListener('input', ev => {
const card = ev.target.closest('.ai-model');
if (!card) return;
const v = n => card.querySelector('[name=' + n + ']').value.trim();
card.querySelector('.ai-model-title').textContent = v('m_name') || 'Модель';
card.querySelector('.ai-model-sub').textContent = v('m_type') + (v('m_model') ? ' · ' + v('m_model') : '');
});
// A field to fix in a folded card: the card opens to show it.
list.closest('form').addEventListener('invalid', ev => {
const d = ev.target.closest('details');
if (d) d.open = true;
}, true);
}
}
});