diff --git a/docs/cabinet.html b/docs/cabinet.html
index f7abd21..e62c976 100644
--- a/docs/cabinet.html
+++ b/docs/cabinet.html
@@ -316,10 +316,15 @@ body{font-family:'Inter',sans-serif;background:var(--bg);color:var(--text);displ
-
+
-
🔍
Этап 2 из 5
Диагностика
Елена уточняет детали — продолжайте разговор
-
+
🔍
Этап 2 из 5 · Диагностика
Углубляемся
Елена задаёт уточняющие вопросы — отвечайте. Это продолжение разговора с Этапа 1.
+
+
@@ -405,7 +410,8 @@ function go(n){
document.querySelectorAll('.si').forEach(s=>s.classList.remove('active'));
document.getElementById('si'+n).classList.add('active');
if(PCTS[n]!=null){document.getElementById('pbPct').textContent=PCTS[n]+'%';document.getElementById('pbFill').style.width=PCTS[n]+'%';}
- if(n===1)requestAnimationFrame(scrollChatBottom); // sv1 уже видим — высота посчитана, прыгаем вниз без «пролёта»
+ if(n===1){renderChat1();requestAnimationFrame(scrollChatBottom);} // ре-рендер из общей беседы
+ if(n===2)renderChat2(); // продолжение того же диалога
if(n===6){renderOpChat();startOpPoll();}else{stopOpPoll();}
if(n===3)renderDocs();
if(n===4)renderAnalysis();
@@ -582,11 +588,20 @@ async function handleFiles(files){
}
function renderAll(){
if(state.client_name)document.getElementById("hdrClient").textContent="· "+state.client_name;
- chat.innerHTML="";
- state.messages.forEach(m=>addMsg(m.role==="user"?"user":"elena",m.content));
+ renderChat1();
unlockStages();
checkPayment();
}
+function renderChat1(){const c=document.getElementById("chat");if(!c)return;c.innerHTML="";(state.messages||[]).forEach(m=>addMsg(m.role==="user"?"user":"elena",m.content));}
+/* ── Этап 2 — продолжение диалога (тот же state.messages) ── */
+function addMsg2(role,text){const c=document.getElementById("chat2");if(!c)return;const m=document.createElement("div");m.className="msg "+(role==="user"?"user":"");m.innerHTML=`${role==='user'?'Я':'Е'}
${fmt(text)}
`;c.appendChild(m);const sc=c.parentElement;if(sc)sc.scrollTop=sc.scrollHeight;}
+function renderChat2(){const c=document.getElementById("chat2");if(!c)return;c.innerHTML="";const m=state.messages||[];if(!m.length){c.innerHTML='Начните разговор на Этапе 1 — здесь Елена продолжит уточнять детали.
';return;}m.forEach(x=>addMsg2(x.role==="user"?"user":"elena",x.content));requestAnimationFrame(()=>{const sc=c.parentElement;if(sc)sc.scrollTop=sc.scrollHeight;});}
+async function sendMsg2(){const i=document.getElementById("inp2");const t=i.value.trim();if(!t)return;if(recording)stopMic();i.value="";i.style.height="auto";addMsg2("user",t);state.messages.push({role:"user",content:t});
+ const btn=document.getElementById("send2");btn.disabled=true;
+ const tp=document.createElement("div");tp.className="msg";tp.id="typing2";tp.innerHTML='Е
';document.getElementById("chat2").appendChild(tp);const sc=document.getElementById("chat2").parentElement;if(sc)sc.scrollTop=sc.scrollHeight;
+ try{const r=await fetch(`${API}/api/chat`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token,message:t})});const d=await r.json();const x=document.getElementById("typing2");if(x)x.remove();addMsg2("elena",d.reply||("Ошибка: "+(d.error||"?")));state.messages.push({role:"assistant",content:d.reply||""});unlockStages();}catch(e){const x=document.getElementById("typing2");if(x)x.remove();addMsg2("elena","Ошибка связи: "+e.message);}
+ btn.disabled=false;
+}
function money(n){return (n||0).toLocaleString("ru-RU")+" ₽"}
function checkPayment(){
const crm=state.crm||{};const deal=crm.deal_amount||0;