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

+9 -2
View File
@@ -1126,8 +1126,15 @@ body.no-motion *, body.no-motion *::before, body.no-motion *::after, body.no-mot
.ai-form .ai-sub { margin:10px 0 0; font-size:15px; }
/* Настройки: the models, a card each. */
.ai-models { display:grid; gap:10px; }
.ai-model { display:grid; gap:10px; min-width:0; margin:0; padding:12px; border:1px solid var(--border); border-radius:10px; }
.ai-model-head { display:flex; align-items:flex-end; gap:8px; margin:12px 0 4px; }
.ai-model, .ai-search { min-width:0; margin:0; border:1px solid var(--border); border-radius:10px; }
/* Folded to a line: its name, and its kind and model quieter. */
.ai-model > summary.ai-model-sum, .ai-search > summary.ai-model-sum { min-width:0; padding:11px 12px; border-radius:10px; }
.ai-model > summary.ai-model-sum:hover, .ai-search > summary.ai-model-sum:hover { background:#151a21; }
.ai-model-title { flex:none; color:var(--text); font-size:14px; font-weight:550; }
.ai-model-sub { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--muted); font-size:12.5px; }
.ai-model-sub:not(:empty)::before { content:'· '; }
.ai-model-body { display:grid; gap:10px; min-width:0; padding:0 12px 12px; }
.ai-model-head { display:flex; align-items:flex-end; gap:8px; margin:2px 0 4px; }
.ai-model-head .ai-model-name { flex:1; min-width:0; margin:0; }
.ai-model-head .ai-model-short { flex:none; width:96px; margin:0; }
.ai-model-del { flex:none; height:38px; }
+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);
}
}
});