kofdai's picture
Create templates/index.html
70c2ab8 verified
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>Cyborg Interface: System Dominance</title>
<style>
:root { --neon: #00f3ff; --pink: #ff0055; --bg: #02050a; }
body { background: var(--bg); color: #c0d0d0; font-family: 'Consolas', monospace; margin: 0; display: flex; height: 100vh; overflow: hidden; }
#sidebar { width: 300px; background: rgba(5,10,20,0.95); border-right: 1px solid #1a3a4a; padding: 25px; }
#main { flex: 1; display: flex; flex-direction: column; }
#chat-history { flex: 1; padding: 30px; overflow-y: auto; background: linear-gradient(180deg, #02050a 0%, #05101a 100%); }
.msg-ai { border-left: 3px solid var(--neon); background: rgba(0,243,255,0.03); padding: 20px; margin-bottom: 20px; line-height: 1.6; }
.msg-user { border-right: 2px solid #444; background: rgba(255,255,255,0.02); align-self: flex-end; padding: 10px 20px; margin-bottom: 20px; }
#log-panel { height: 140px; background: #000; border-top: 2px solid #1a3a4a; padding: 15px; font-size: 0.8em; color: var(--neon); overflow-y: auto; }
.status-tag { display: inline-block; padding: 2px 8px; border-radius: 3px; font-weight: bold; margin-bottom: 10px; }
.tag-active { background: var(--pink); color: #fff; animation: pulse 1s infinite; }
.tag-idle { background: #1a3a4a; color: #555; }
@keyframes pulse { 0% { opacity: 0.7; } 50% { opacity: 1; } 100% { opacity: 0.7; } }
</style>
</head>
<body>
<div id="sidebar">
<h2 style="color:var(--neon); letter-spacing: 3px;">SYSTEM CONTROL</h2>
<div style="margin-bottom:30px;">
AI UNIT STATUS:<br>
<span id="ai-status" class="status-tag tag-idle">REJECTED</span>
</div>
<div style="border:1px solid #1a3a4a; padding:10px; font-size:0.7em;">
COMMANDER: Project-System<br>
AGENT: Gemma-2 (Dynamic Load)<br>
VRAM_POLICY: Aggressive Reject
</div>
</div>
<div id="main">
<div id="chat-history"></div>
<div id="log-panel" id="logs">READY. AWAITING COMMAND...</div>
<div style="padding:20px; display:flex; gap:10px; background:rgba(5,10,20,0.95);">
<input type="text" id="user-input" style="flex:1; background:#000; color:var(--neon); border:1px solid #1a3a4a; padding:12px;" placeholder="INPUT PHYSICS QUERY...">
<button onclick="sendMessage()" style="background:#1a3a4a; border:none; color:var(--neon); padding:0 30px; cursor:pointer;">EXEC</button>
</div>
</div>
<script>
async function sendMessage() {
const input = document.getElementById('user-input');
const chat = document.getElementById('chat-history');
const logs = document.getElementById('log-panel');
const aiStatus = document.getElementById('ai-status');
const val = input.value; if(!val) return;
chat.innerHTML += `<div class="msg-user">${val}</div>`;
input.value = ""; logs.innerHTML = "";
// フェーズ1: 演算開始
logs.innerHTML += `<div>⚙️ [SYSTEM] 物理演算開始... AIはメモリ上に存在しません。</div>`;
const res = await fetch('/api/chat', {method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({message:val})});
// フェーズ2: AIロード演出(サーバーからのログ受信に合わせて)
aiStatus.innerText = "LOADING..."; aiStatus.className = "status-tag tag-active";
const data = await res.json();
for(const log of data.process_logs) {
logs.innerHTML += `<div>${log}</div>`;
if(log.includes("リジェクト")) {
aiStatus.innerText = "REJECTED"; aiStatus.className = "status-tag tag-idle";
}
await new Promise(r => setTimeout(r, 600));
}
chat.innerHTML += `<div class="msg-ai">${data.response.replace(/\n/g,'<br>')}</div>`;
chat.scrollTop = chat.scrollHeight;
}
</script>
</body>
</html>