From 6c5af31aae91019a4982735870cce5b74986dcdc Mon Sep 17 00:00:00 2001 From: wasrusgen Date: Sat, 30 May 2026 12:54:58 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20company=20profile=20tab=20=E2=80=94=20c?= =?UTF-8?q?ontext-first=20onboarding=20before=20interview?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/cabinet.html | 56 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 5 deletions(-) diff --git a/docs/cabinet.html b/docs/cabinet.html index a4007c7..1163c7e 100644 --- a/docs/cabinet.html +++ b/docs/cabinet.html @@ -139,6 +139,11 @@ body{font-family:'Inter',sans-serif;background:var(--bg);color:var(--text);displ .fld{font-size:11px;background:var(--bg);border-radius:6px;padding:4px 8px}.fld em{font-style:normal;color:#6366F1;font-size:10px} .ent-ex{font-size:10.5px;color:#6b7280;font-family:monospace;background:var(--bg);border-radius:6px;padding:6px 9px;line-height:1.4} /* Docs */ +.pf-l{display:block;font-size:13px;font-weight:600;color:var(--text);margin-bottom:7px} +.pf-i{width:100%;border:1.5px solid var(--border);border-radius:10px;padding:11px 14px;font-size:14px;font-family:'Inter';outline:none} +.pf-i:focus{border-color:var(--mid);box-shadow:0 0 0 3px rgba(16,185,129,.1)} +.pf-t{width:100%;min-height:120px;border:1.5px solid var(--border);border-radius:10px;padding:11px 14px;font-size:14px;font-family:'Inter';outline:none;resize:vertical;line-height:1.5} +.pf-t:focus{border-color:var(--mid);box-shadow:0 0 0 3px rgba(16,185,129,.1)} .drop{border:2px dashed #CBD5E1;border-radius:14px;padding:32px;text-align:center;background:var(--subtle);max-width:520px;margin:8px auto} .drop-ic{font-size:30px;margin-bottom:8px} .spin{display:inline-block;animation:sp 1s linear infinite}@keyframes sp{to{transform:rotate(360deg)}} @@ -155,6 +160,8 @@ body{font-family:'Inter',sans-serif;background:var(--bg);color:var(--text);displ
+ +
+
👤
Профиль компании
Расскажите о вашей деятельности
Базовая информация — Елена начнёт разговор уже зная контекст
+
+
+
+
+
+ +
+
+
+
💬
Этап 1 из 5 · В процессе
Знакомство
Расскажите Елене о вашем бизнесе — текстом или голосом
@@ -217,13 +237,29 @@ function go(n){ cur=n; document.querySelectorAll('.sv').forEach(s=>s.classList.remove('active')); document.getElementById('sv'+n).classList.add('active'); - document.querySelectorAll('.si').forEach((s,i)=>{s.classList.toggle('active',i+1===n)}); - document.getElementById('pbPct').textContent=PCTS[n]+'%'; - document.getElementById('pbFill').style.width=PCTS[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===4)renderAnalysis(); if(n===5)renderSpecPane(); } +async function saveProfile(){ + const name=document.getElementById("pfName").value.trim(); + const niche=document.getElementById("pfNiche").value.trim(); + const desc=document.getElementById("pfDesc").value.trim(); + if(!name&&!desc){alert("Заполните хотя бы имя и описание");return} + const btn=document.getElementById("pfSave");btn.disabled=true;btn.innerHTML=' Елена знакомится...'; + try{ + const r=await fetch(`${API}/api/project/profile`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token,client_name:name,niche,description:desc})}); + const d=await r.json(); + if(d.error){alert("Ошибка: "+d.error);btn.disabled=false;btn.textContent="Сохранить и начать →";return} + // Обновляем состояние и чат + const r2=await fetch(`${API}/api/project/${token}`);state=await r2.json(); + renderAll();go(1); + }catch(e){alert("Ошибка: "+e.message);btn.disabled=false} +} + /* ── Voice ── */ let recog=null,recording=false; const SR=window.SpeechRecognition||window.webkitSpeechRecognition; @@ -243,10 +279,20 @@ function showTyping(){const t=document.createElement("div");t.className="msg";t. function hideTyping(){const t=document.getElementById("typing");if(t)t.remove()} async function init(){ - if(token){const r=await fetch(`${API}/api/project/${token}`);if(r.ok){state=await r.json();renderAll();return}} + if(token){const r=await fetch(`${API}/api/project/${token}`);if(r.ok){state=await r.json();renderAll(); + fillProfile(); + // Если профиль не заполнен — открыть вкладку Профиль + if(!state.description && !state.client_name) go(0); else go(1); + return;}} const r=await fetch(`${API}/api/project/new`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}); const d=await r.json();token=d.token;localStorage.setItem("cab_token",token); - state={messages:[],client_name:"",niche:""};addMsg("elena",d.greeting); + state={messages:[],client_name:"",niche:"",description:""}; + go(0); // новый клиент → сразу профиль +} +function fillProfile(){ + if(state.client_name)document.getElementById("pfName").value=state.client_name; + if(state.niche)document.getElementById("pfNiche").value=state.niche; + if(state.description)document.getElementById("pfDesc").value=state.description; } function renderAll(){ if(state.client_name)document.getElementById("hdrClient").textContent="· "+state.client_name;