everydaytok commited on
Commit
c5b8264
·
verified ·
1 Parent(s): 85504c2

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +43 -87
index.html CHANGED
@@ -3,12 +3,12 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Topological Logic Lab</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <script src="https://cdn.plot.ly/plotly-2.24.1.min.js"></script>
9
  <style>
10
  body { background: #06090e; color: #cbd5e1; font-family: monospace; }
11
- .glass { background: rgba(15,23,42,0.98); border: 1px solid #334155; }
12
  #drawer { transition: transform 0.3s ease-in-out; z-index: 100; }
13
  .drawer-hidden { transform: translateY(100%); }
14
  </style>
@@ -16,143 +16,99 @@
16
  <body class="flex flex-col h-screen overflow-hidden">
17
 
18
  <header class="glass p-3 flex justify-between items-center z-10">
19
- <h1 id="logic-label" class="text-blue-400 font-bold text-xs uppercase">LOGIC: ADDITION</h1>
20
- <button onclick="toggleDrawer()" class="bg-blue-600 px-4 py-1 rounded text-white text-xs font-bold">⚙️ SETTINGS & DATA</button>
21
  </header>
22
 
23
- <!-- SETTINGS DRAWER -->
24
- <aside id="drawer" class="fixed inset-x-0 bottom-0 drawer-hidden glass p-5 flex flex-col gap-5 max-h-[90vh] overflow-y-auto">
25
  <div class="flex justify-between items-center border-b border-slate-700 pb-2">
26
- <span class="text-orange-400 font-bold">SYSTEM CONFIGURATION</span>
27
- <button onclick="toggleDrawer()" class="text-slate-400 text-2xl">✕</button>
28
  </div>
29
 
30
  <div class="space-y-4">
31
  <section>
32
- <label class="text-slate-500 text-[10px]">EXECUTION MODE</label>
33
- <select id="mode" onchange="sendConfig()" class="w-full bg-slate-900 border border-slate-700 p-3 text-white rounded">
34
- <option value="training">TRAINING (Learn K factor)</option>
35
- <option value="inference">INFERENCE (Predict Output C)</option>
36
- </select>
37
  </section>
38
 
39
  <section>
40
- <label class="text-slate-500 text-[10px]">CONSTRAINT LOGIC TYPE</label>
41
- <select id="logicType" onchange="sendConfig()" class="w-full bg-slate-900 border border-slate-700 p-3 text-white rounded">
42
- <option value="add">ADDITION (A + B = C)</option>
43
- <option value="mult">MULTIPLICATION (A * B = C)</option>
 
44
  </select>
45
  </section>
46
 
47
- <section class="bg-purple-900/20 p-4 rounded border border-purple-800">
48
- <label class="text-purple-400 font-bold text-xs">BATCH DATASET GENERATOR</label>
49
- <p class="text-[10px] text-slate-500 mb-2">Generates random problems based on Logic Type.</p>
50
- <div class="flex gap-2">
51
- <input type="number" id="batch_count" value="15" class="w-1/2 bg-black text-center p-2 border border-slate-700">
52
- <button onclick="genBatch()" class="w-1/2 bg-purple-700 font-bold text-xs rounded">START BATCH</button>
53
- </div>
54
- </section>
55
-
56
- <section class="bg-blue-900/20 p-4 rounded border border-blue-800">
57
- <label class="text-blue-400 font-bold text-xs">CUSTOM INPUT TEST (A & B)</label>
58
- <div class="grid grid-cols-2 gap-2 mt-2">
59
- <input type="number" id="custom_a" value="7" class="bg-black text-center p-2 border border-slate-700">
60
- <input type="number" id="custom_b" value="8" class="bg-black text-center p-2 border border-slate-700">
61
- </div>
62
- <button onclick="testCustom()" class="w-full bg-blue-700 mt-2 py-3 font-bold text-xs rounded uppercase">Run Prediction</button>
63
  </section>
64
 
65
- <button onclick="triggerHalt()" class="w-full border border-red-500 text-red-500 py-3 rounded font-bold">RESET / HALT</button>
 
 
66
  </div>
67
  </aside>
68
 
69
  <main class="flex-grow flex flex-col min-h-0">
70
  <div id="plot" class="flex-grow"></div>
71
-
72
- <div class="h-64 glass border-t border-slate-700 p-4 flex flex-col">
73
- <div class="flex justify-between items-center mb-2">
74
- <h4 class="text-blue-300 text-[10px] font-bold">LIVE TOPOLOGY</h4>
75
- <div id="error-val" class="text-xs font-bold text-red-400">ERR: 0.000</div>
76
- </div>
77
- <div id="nodes-ui" class="space-y-1 text-[11px] font-mono"></div>
78
- <div id="logs" class="mt-auto pt-2 border-t border-slate-800 text-[9px] text-slate-500 h-20 overflow-y-auto"></div>
79
  </div>
80
  </main>
81
 
82
  <script>
83
- let drawer = document.getElementById('drawer');
84
- function toggleDrawer() { drawer.classList.toggle('drawer-hidden'); }
85
 
86
- async function sendConfig() {
87
- const type = document.getElementById('logicType').value;
88
- document.getElementById('logic-label').innerText = "LOGIC: " + type.toUpperCase();
89
  await fetch('/config', {
90
  method: 'POST', headers: {'Content-Type': 'application/json'},
91
  body: JSON.stringify({
92
  mode: document.getElementById('mode').value,
93
- type: type
 
94
  })
95
  });
96
- }
97
-
98
- async function genBatch() {
99
  toggleDrawer();
100
- await fetch('/generate_batch', {
101
- method: 'POST', headers: {'Content-Type':'application/json'},
102
- body: JSON.stringify({ count: document.getElementById('batch_count').value })
103
- });
104
  }
105
 
106
- async function testCustom() {
 
107
  toggleDrawer();
108
- await fetch('/test_custom', {
109
- method: 'POST', headers: {'Content-Type':'application/json'},
110
- body: JSON.stringify({ a: document.getElementById('custom_a').value, b: document.getElementById('custom_b').value })
111
- });
112
  }
113
 
114
- async function triggerHalt() { toggleDrawer(); await fetch('/halt', {method: 'POST'}); }
115
 
116
  setInterval(async () => {
117
  try {
118
  const res = await fetch('/state');
119
  const d = await res.json();
120
- document.getElementById('error-val').innerText = "ERR: " + d.error.toFixed(4);
121
- document.getElementById('error-val').className = Math.abs(d.error) < 0.05 ? "text-green-400 font-bold" : "text-red-400 font-bold";
122
 
123
  let ui = "";
124
  let px=[], py=[], pz=[], ids=[];
125
- Object.keys(d.nodes).forEach(id => {
126
  const n = d.nodes[id];
127
- ui += `<div class="flex justify-between border-b border-slate-800 pb-1">
128
- <span>NODE ${id}: <b class="text-white">${n.x.toFixed(2)}</b></span>
129
- <span class="text-slate-500 italic">K=${n.k.toFixed(4)} | F=${n.f.toFixed(3)}</span>
130
- </div>`;
131
- px.push(n.x); py.push(id==='A'?1:id==='B'?-1:0); pz.push(0); ids.push(id);
132
  });
133
  document.getElementById('nodes-ui').innerHTML = ui;
134
- document.getElementById('logs').innerHTML = d.logs.map(l => `<div>${l}</div>`).join('');
135
 
136
  const trace = {
137
- type: 'scatter3d', mode: 'lines+markers+text',
138
- x: px.concat([px[0]]), y: py.concat([py[0]]), z: pz.concat([pz[0]]),
139
- text: ids.concat(['']),
140
- marker: {size: 10, color:['#fb923c','#c084fc','#38bdf8']},
141
- line: {color:'#334155', width:2}
142
- };
143
- const layout = {
144
- margin:{l:0,r:0,t:0,b:0}, paper_bgcolor:'transparent',
145
- scene:{
146
- xaxis:{color:'#475569', title:'COORD'},
147
- yaxis:{range:[-2,2], visible:false},
148
- zaxis:{range:[-2,2], visible:false},
149
- camera: {eye:{x:0, y:-1.8, z:0.8}}
150
- }
151
  };
152
- if(!window.plotted){ Plotly.newPlot('plot', [trace], layout, {displayModeBar:false}); window.plotted=true; }
153
- else { Plotly.react('plot', [trace], layout); }
154
  } catch(e){}
155
- }, 200);
156
  </script>
157
  </body>
158
  </html>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Multicellular Mesh Engine</title>
7
  <script src="https://cdn.tailwindcss.com"></script>
8
  <script src="https://cdn.plot.ly/plotly-2.24.1.min.js"></script>
9
  <style>
10
  body { background: #06090e; color: #cbd5e1; font-family: monospace; }
11
+ .glass { background: rgba(15,23,42,0.95); border: 1px solid #334155; }
12
  #drawer { transition: transform 0.3s ease-in-out; z-index: 100; }
13
  .drawer-hidden { transform: translateY(100%); }
14
  </style>
 
16
  <body class="flex flex-col h-screen overflow-hidden">
17
 
18
  <header class="glass p-3 flex justify-between items-center z-10">
19
+ <h1 class="text-blue-400 font-bold text-xs uppercase">Multicellular Mesh</h1>
20
+ <button onclick="toggleDrawer()" class="bg-blue-600 px-4 py-1 rounded text-white text-xs font-bold font-sans">MESH CONFIG</button>
21
  </header>
22
 
23
+ <aside id="drawer" class="fixed inset-x-0 bottom-0 drawer-hidden glass p-6 flex flex-col gap-4 z-50 max-h-[90vh] overflow-y-auto">
 
24
  <div class="flex justify-between items-center border-b border-slate-700 pb-2">
25
+ <span class="text-orange-400 font-bold">MESH ARCHITECTURE</span>
26
+ <button onclick="toggleDrawer()" class="text-slate-400 text-xl">✕</button>
27
  </div>
28
 
29
  <div class="space-y-4">
30
  <section>
31
+ <label class="text-slate-500 text-[10px]">MESH DEPTH (Hidden Cells between A-C / B-C)</label>
32
+ <input type="number" id="meshDepth" value="3" class="w-full bg-black border border-slate-700 p-3 text-blue-400 font-bold">
 
 
 
33
  </section>
34
 
35
  <section>
36
+ <label class="text-slate-500 text-[10px]">PROBLEM DOMAIN</label>
37
+ <select id="probType" class="w-full bg-slate-900 border border-slate-700 p-3 text-white rounded">
38
+ <option value="housing">Housing (Loc ID + Size -> Price)</option>
39
+ <option value="sub">Subtraction (A - B = C)</option>
40
+ <option value="div">Division (A / B = C)</option>
41
  </select>
42
  </section>
43
 
44
+ <section>
45
+ <label class="text-slate-500 text-[10px]">PHASE</label>
46
+ <select id="mode" class="w-full bg-slate-900 border border-slate-700 p-3 text-white rounded">
47
+ <option value="training">TRAINING (Learn Relationships)</option>
48
+ <option value="inference">INFERENCE (Predict Output)</option>
49
+ </select>
 
 
 
 
 
 
 
 
 
 
50
  </section>
51
 
52
+ <button onclick="applyConfig()" class="w-full bg-blue-700 py-3 font-bold rounded">APPLY & RESET MESH</button>
53
+ <button onclick="genData()" class="w-full bg-purple-700 py-3 font-bold rounded">START DATASET RUN</button>
54
+ <button onclick="halt()" class="w-full border border-red-500 text-red-500 py-3 rounded">HALT</button>
55
  </div>
56
  </aside>
57
 
58
  <main class="flex-grow flex flex-col min-h-0">
59
  <div id="plot" class="flex-grow"></div>
60
+ <div class="h-48 glass border-t border-slate-700 p-4 font-mono text-[10px]">
61
+ <div id="error-val" class="text-lg font-bold text-red-400 mb-2">ERR: 0.000</div>
62
+ <div id="nodes-ui" class="grid grid-cols-2 gap-2 h-24 overflow-y-auto"></div>
 
 
 
 
 
63
  </div>
64
  </main>
65
 
66
  <script>
67
+ function toggleDrawer() { document.getElementById('drawer').classList.toggle('drawer-hidden'); }
 
68
 
69
+ async function applyConfig() {
 
 
70
  await fetch('/config', {
71
  method: 'POST', headers: {'Content-Type': 'application/json'},
72
  body: JSON.stringify({
73
  mode: document.getElementById('mode').value,
74
+ depth: document.getElementById('meshDepth').value,
75
+ type: document.getElementById('probType').value
76
  })
77
  });
 
 
 
78
  toggleDrawer();
 
 
 
 
79
  }
80
 
81
+ async function genData() {
82
+ await fetch('/generate', { method: 'POST', headers: {'Content-Type':'application/json'}, body: JSON.stringify({}) });
83
  toggleDrawer();
 
 
 
 
84
  }
85
 
86
+ async function halt() { await fetch('/halt', {method: 'POST'}); toggleDrawer(); }
87
 
88
  setInterval(async () => {
89
  try {
90
  const res = await fetch('/state');
91
  const d = await res.json();
92
+ document.getElementById('error-val').innerText = "SYSTEM TENSION: " + d.error.toFixed(4);
 
93
 
94
  let ui = "";
95
  let px=[], py=[], pz=[], ids=[];
96
+ Object.keys(d.nodes).sort().forEach(id => {
97
  const n = d.nodes[id];
98
+ ui += `<div>${id}: <b>${n.x.toFixed(2)}</b> <span class="text-slate-600">K:${n.k.toFixed(2)}</span></div>`;
99
+ px.push(n.x); py.push(n.y); pz.push(0); ids.push(id);
 
 
 
100
  });
101
  document.getElementById('nodes-ui').innerHTML = ui;
 
102
 
103
  const trace = {
104
+ type: 'scatter3d', mode: 'markers+text',
105
+ x: px, y: py, z: pz,
106
+ text: ids, marker: {size: 8, color:'#38bdf8'}
 
 
 
 
 
 
 
 
 
 
 
107
  };
108
+ if(!window.plotted){ Plotly.newPlot('plot', [trace], {margin:{l:0,r:0,t:0,b:0}, paper_bgcolor:'transparent', scene:{camera:{eye:{x:1.5,y:1.5,z:1.5}}}}, {displayModeBar:false}); window.plotted=true; }
109
+ else { Plotly.react('plot', [trace]); }
110
  } catch(e){}
111
+ }, 300);
112
  </script>
113
  </body>
114
  </html>