fix: дизайн как Личный Кабинет — карточки, светлый фон, как в lang

This commit is contained in:
2026-06-01 23:20:16 +03:00
parent 7f10b95650
commit 91c42a1d3e
2 changed files with 61 additions and 57 deletions
+6 -4
View File
@@ -36,8 +36,10 @@
<div id="status"></div> <div id="status"></div>
<div class="card">
<div id="chat"></div> <div id="chat"></div>
</div> </div>
</div>
<div id="sidebar"> <div id="sidebar">
<div id="history-title">История</div> <div id="history-title">История</div>
@@ -75,8 +77,8 @@
document.querySelectorAll('.hitem').forEach(el => { document.querySelectorAll('.hitem').forEach(el => {
el.onclick = () => { el.onclick = () => {
const h = history[+el.dataset.idx]; const h = history[+el.dataset.idx];
chat.innerHTML += '<div class="user">📋 ' + fmt(h.q) + '</div>'; chat.innerHTML += '<div class="msg user">📋 ' + fmt(h.q) + '</div>';
chat.innerHTML += '<div class="bot">🤖 ' + fmt(h.a) + '</div>'; chat.innerHTML += '<div class="msg bot">🤖 ' + fmt(h.a) + '</div>';
chat.scrollTop = chat.scrollHeight; chat.scrollTop = chat.scrollHeight;
}; };
}); });
@@ -191,7 +193,7 @@
clearTimeout(to); clearTimeout(to);
const tData = await tRes.json(); const tData = await tRes.json();
const text = tData.text || '(не распознано)'; const text = tData.text || '(не распознано)';
chat.innerHTML += '<div class="user">🗣 ' + fmt(text) + '</div>'; chat.innerHTML += '<div class="msg user">🗣 ' + fmt(text) + '</div>';
chat.scrollTop = chat.scrollHeight; chat.scrollTop = chat.scrollHeight;
startThinkTimer(); startThinkTimer();
@@ -207,7 +209,7 @@
chatHistory.push({ role: 'user', content: text }); chatHistory.push({ role: 'user', content: text });
chatHistory.push({ role: 'assistant', content: resp }); chatHistory.push({ role: 'assistant', content: resp });
if (chatHistory.length > 40) chatHistory = chatHistory.slice(-40); if (chatHistory.length > 40) chatHistory = chatHistory.slice(-40);
chat.innerHTML += '<div class="bot">🤖 ' + fmt(resp) + '</div>'; chat.innerHTML += '<div class="msg bot">🤖 ' + fmt(resp) + '</div>';
chat.scrollTop = chat.scrollHeight; chat.scrollTop = chat.scrollHeight;
setStatus('✅ Готово — ' + ((Date.now() - thinkStart) / 1000).toFixed(1) + 'с'); setStatus('✅ Готово — ' + ((Date.now() - thinkStart) / 1000).toFixed(1) + 'с');
+54 -52
View File
@@ -1,7 +1,14 @@
:root { :root {
--bg: #f5f5f5; --card: #ffffff; --text: #1a1a1a; --muted: #6b7280; --bg: #f4f4f8;
--border: #d1d5db; --grey-light: #f3f4f6; --card: #ffffff;
--blue: #2563eb; --pink: #e84393; --purple: #7c6ff7; --text: #1a1a1a;
--muted: #6b7280;
--border: #e5e7eb;
--grey-light: #f9fafb;
--blue: #2563eb;
--blue-h: #1d4ed8;
--green: #10b981;
--pink: #e84393;
} }
* { box-sizing: border-box; margin: 0; padding: 0; } * { box-sizing: border-box; margin: 0; padding: 0; }
@@ -12,20 +19,26 @@ body {
} }
#app { display: flex; height: 100vh; } #app { display: flex; height: 100vh; }
#main { flex: 1; padding: 16px; max-width: 740px; margin: 0 auto; overflow-y: auto; } #main { flex: 1; padding: 20px; max-width: 780px; margin: 0 auto; overflow-y: auto; }
/* Topbar как в ipwhitelist */ .card {
.topbar { background: var(--card); border: 1px solid var(--border);
display: flex; align-items: center; gap: 8px; border-radius: 10px; padding: 16px; margin-bottom: 14px;
padding: 10px 14px; background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.04);
border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px;
} }
.topbar {
display: flex; align-items: center; gap: 10px;
padding: 12px 16px; background: var(--card);
border: 1px solid var(--border); border-radius: 10px; margin-bottom: 14px;
}
.topbar-logo img { display: block; }
.topbar-sep { color: var(--border); font-size: 18px; } .topbar-sep { color: var(--border); font-size: 18px; }
.topbar-title { font-weight: 600; font-size: 15px; } .topbar-title { font-weight: 600; font-size: 16px; }
.topbar-title #ver { font-weight: 400; color: var(--muted); font-size: 12px; } #ver { font-weight: 400; color: var(--muted); font-size: 12px; }
.topbar-right { margin-left: auto; color: var(--muted); font-size: 13px; } .topbar-right { margin-left: auto; color: var(--muted); font-size: 13px; }
#models { display: flex; gap: 8px; justify-content: center; margin-bottom: 10px; } #models { display: flex; gap: 8px; margin-bottom: 4px; }
.model-tag { .model-tag {
padding: 3px 10px; background: var(--grey-light); padding: 3px 10px; background: var(--grey-light);
border: 1px solid var(--border); border-radius: 12px; border: 1px solid var(--border); border-radius: 12px;
@@ -33,60 +46,49 @@ body {
} }
#visualizer { margin: 8px 0; text-align: center; } #visualizer { margin: 8px 0; text-align: center; }
#meter { border-radius: 6px; background: var(--grey-light); display: block; margin: 0 auto; } #meter { border-radius: 6px; background: var(--grey-light); }
#controls { display: flex; gap: 8px; justify-content: center; margin: 10px 0; } #controls { display: flex; gap: 8px; justify-content: center; margin: 10px 0; }
#controls button { #controls button {
padding: 8px 18px; border-radius: 8px; font-size: 14px; padding: 8px 18px; border-radius: 7px; font-size: 13px;
cursor: pointer; border: 1px solid var(--border); font-family: inherit; cursor: pointer; border: 1px solid transparent; font-family: inherit;
font-weight: 500;
} }
#btnRecord { background: var(--pink); color: #fff; border-color: var(--pink); } #btnRecord { background: var(--pink); color: #fff; }
#btnRecord:disabled { opacity: 0.5; } #btnRecord:disabled { opacity: 0.5; }
#btnPlay { background: #10b981; color: #fff; border-color: #10b981; } #btnPlay { background: var(--green); color: #fff; }
#btnPlay:disabled { opacity: 0.4; } #btnPlay:disabled { opacity: 0.4; }
#btnReset, #btnTheme { background: var(--grey-light); color: var(--text); } #btnReset, #btnTheme { background: var(--card); color: var(--text); border-color: var(--border); }
#status { text-align: center; color: var(--muted); font-size: 13px; min-height: 18px; margin: 4px 0; } #status { text-align: center; color: var(--muted); font-size: 13px; min-height: 18px; margin: 4px 0; }
#chat { #chat { min-height: 200px; max-height: 360px; overflow-y: auto; line-height: 1.6; }
border: 1px solid var(--border); border-radius: 10px; .msg { padding: 10px 14px; margin: 6px 0; border-radius: 8px; font-size: 14px; }
padding: 12px; min-height: 200px; max-height: 340px; .msg.user { background: #eff6ff; border: 1px solid #dbeafe; color: #1e40af; }
overflow-y: auto; background: var(--card); line-height: 1.6; .msg.bot { background: var(--grey-light); border: 1px solid var(--border); color: var(--text); }
} .msg p { margin: 4px 0; }
.user { .msg h1, .msg h2, .msg h3 { font-size: 15px; margin: 8px 0 4px; color: var(--text); }
background: #ecfdf5; border-left: 3px solid #10b981; .msg b { color: #111; }
padding: 8px 12px; margin: 6px 0; border-radius: 0 6px 6px 0; .msg code { background: #e5e7eb; padding: 1px 5px; border-radius: 3px; font-size: 13px; color: #b91c1c; }
color: #065f46; font-size: 14px; .msg ul, .msg ol { margin: 4px 0; padding-left: 20px; }
} .msg li { margin: 2px 0; }
.user p { margin: 0; } .msg hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }
.bot {
background: #f5f3ff; border-left: 3px solid var(--purple);
padding: 10px 14px; margin: 6px 0 14px; border-radius: 0 6px 6px 0;
color: var(--text); font-size: 14px;
}
.bot p { margin: 4px 0; }
.bot h1, .bot h2, .bot h3 { color: var(--purple); margin: 8px 0 4px; font-size: 14px; }
.bot b { color: #111; }
.bot code { background: #e8e5f4; padding: 1px 5px; border-radius: 3px; font-size: 13px; color: #c62828; }
.bot ul, .bot ol { margin: 4px 0; padding-left: 20px; }
.bot li { margin: 2px 0; }
.bot hr { border: none; border-top: 1px solid #ddd; margin: 10px 0; }
#sidebar { #sidebar {
width: 280px; background: var(--card); width: 272px; background: var(--card);
border-left: 1px solid var(--border); padding: 14px; overflow-y: auto; border-left: 1px solid var(--border); padding: 16px; overflow-y: auto;
} }
#history-title { font-weight: 600; color: var(--text); margin-bottom: 10px; font-size: 14px; } #history-title { font-weight: 600; color: var(--text); margin-bottom: 10px; font-size: 14px; }
.hitem { padding: 6px 8px; border-radius: 4px; cursor: pointer; margin-bottom: 3px; font-size: 12px; color: var(--muted); } .hitem { padding: 6px 8px; border-radius: 4px; cursor: pointer; margin-bottom: 3px; font-size: 12px; color: var(--muted); border: 1px solid transparent; }
.hitem:hover { background: var(--grey-light); } .hitem:hover { background: var(--grey-light); border-color: var(--border); }
.hq { display: block; }
/* Тёмная тема */ /* Тёмная тема */
body.dark { body.dark {
--bg: #0d0d1a; --card: #13132a; --text: #e0e0e0; --muted: #888; --bg: #0f0f1a; --card: #18182a; --text: #e0e0e0; --muted: #888;
--border: #2a2a3e; --grey-light: #1a1a2e; --border: #2a2a40; --grey-light: #1e1e30;
} }
body.dark .user { background: #0d2d2d; color: #00cec9; } body.dark .msg.user { background: #0a1e2e; border-color: #1e3a5f; color: #93c5fd; }
body.dark .bot { background: #1a1a3e; color: #d0d0f0; } body.dark .msg.bot { background: var(--grey-light); border-color: var(--border); color: #d0d0f0; }
body.dark .bot b { color: #fff; } body.dark .msg b { color: #fff; }
body.dark .bot code { background: #2a2a4e; color: #f8c291; } body.dark .msg code { background: #2a2a44; color: #f8c291; }
body.dark .bot hr { border-color: #2a2a3e; }