feat(ui): срез 5.x — быстрые действия (проверить смету / КА / перед экспертизой)

ряд чипов над вводом: клик подставляет заготовку в поле (не отправляет — можно дополнить,
курсор в конце). Скрываются при вводе текста, возвращаются при очистке. Делает новые
инструменты (verify/КА/precheck) видимыми пользователю. APP_VERSION 2026-07-17l. Браузер-verified.
This commit is contained in:
anor
2026-07-17 23:12:54 +10:00
parent bd3996c6df
commit dbdb6db0fa
2 changed files with 24 additions and 2 deletions
+1 -1
View File
@@ -138,7 +138,7 @@ MAX_MESSAGE_LEN = 10_000
# ⚠️ Версия UI — единый источник. БАМПАТЬ ПРИ КАЖДОМ ДЕПЛОЕ (формат: YYYY-MM-DD + буква).
# Фронт берёт её через GET /api/version (chat.html + admin.html, элемент .app-version).
APP_VERSION = "2026-07-17k"
APP_VERSION = "2026-07-17l"
# Audit: path → action name mapping
_AUDIT_MAP = [
+23 -1
View File
@@ -104,6 +104,10 @@ button { font-family: inherit; }
.ob-chips { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.ob-chip { font-size: .88rem; padding: .5rem .85rem; border: 1.5px solid var(--border); border-radius: 999px; background: var(--bg-sunken); color: var(--text); cursor: pointer; transition: border-color .15s, background .15s; }
.ob-chip:hover { border-color: var(--accent); background: var(--bg-card); }
#quick-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; justify-content: center; }
#quick-actions.hide { display: none; }
.qa-chip { font-size: .8rem; padding: .35rem .7rem; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-sunken); color: var(--text-muted); cursor: pointer; transition: border-color .15s, color .15s; }
.qa-chip:hover { border-color: var(--accent); color: var(--accent); }
.msg-system { align-self: center; background: var(--system-bg); border: none; font-size: .8rem; color: var(--system-text); box-shadow: none; padding: .4rem .8rem; }
.typing { align-self: flex-start; color: var(--text-light); font-style: italic; font-size: .85rem; padding: .4rem 0; }
@@ -310,6 +314,11 @@ html { color-scheme: light; }
<button id="send-btn" onclick="onSendClick()">Отправить</button>
</div>
</div>
<div id="quick-actions" aria-label="Быстрые действия">
<button type="button" class="qa-chip" data-q="Проверь загруженную смету на ошибки">Проверить смету</button>
<button type="button" class="qa-chip" data-q="Сделай конъюнктурный анализ (форму) по материалу: ">Конъюнктурный анализ</button>
<button type="button" class="qa-chip" data-q="Проверь смету перед экспертизой — к чему придерётся ГГЭ">Перед экспертизой</button>
</div>
<input type="file" id="file-input" multiple hidden onchange="handleFiles(this.files)">
<div style="text-align:center;margin-top:4px"><a href="/static/security.html" target="_blank" style="font-size:.65rem;color:var(--text-muted);opacity:.4;text-decoration:none">О безопасности сервиса</a><span class="app-version" style="font-size:.65rem;color:var(--text-muted);opacity:.4;margin-left:.6rem"></span><span class="data-version" title="Период, на который актуальны цены корпусной базы" style="font-size:.65rem;color:var(--text-muted);opacity:.4;margin-left:.6rem"></span></div>
</div>
@@ -1400,10 +1409,23 @@ async function switchChat(id) {
renderSessions();
}
// Auto-resize textarea
// Auto-resize textarea + скрыть быстрые действия, когда пользователь начал печатать
document.getElementById('msg-input').addEventListener('input', function() {
this.style.height = 'auto';
this.style.height = Math.min(this.scrollHeight, 150) + 'px';
const qa = document.getElementById('quick-actions');
if (qa) qa.classList.toggle('hide', this.value.trim().length > 0);
});
// Быстрые действия: клик подставляет заготовку в поле (не отправляет — можно дополнить)
document.querySelectorAll('#quick-actions .qa-chip').forEach(c => {
c.onclick = () => {
const inp = document.getElementById('msg-input');
inp.value = c.dataset.q;
inp.focus();
inp.dispatchEvent(new Event('input'));
// курсор в конец (для «КА по материалу: » — дописать название)
inp.setSelectionRange(inp.value.length, inp.value.length);
};
});
</script>
</body>