Spaces:
Sleeping
Sleeping
Komalpreet Kaur commited on
Evolution Complete: Soma is now an Autonomous Cognitive Architecture.
Browse files- app/services/vitals.py +14 -1
- frontend/src/App.jsx +4 -4
- frontend/src/index.css +27 -0
app/services/vitals.py
CHANGED
|
@@ -36,8 +36,21 @@ def get_brain_vitals(user_id: str = "default_user"):
|
|
| 36 |
|
| 37 |
# 3. Working Memory (SQLite)
|
| 38 |
try:
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
except Exception as e:
|
| 41 |
print(f"Vitals: Working fetch failed: {e}")
|
|
|
|
| 42 |
|
| 43 |
return vitals
|
|
|
|
| 36 |
|
| 37 |
# 3. Working Memory (SQLite)
|
| 38 |
try:
|
| 39 |
+
count = get_message_count(user_id)
|
| 40 |
+
vitals["working"] = count
|
| 41 |
+
|
| 42 |
+
# 4. Cognitive State (Mood)
|
| 43 |
+
if count > 12:
|
| 44 |
+
vitals["state"] = "OVERLOADED"
|
| 45 |
+
elif count > 7:
|
| 46 |
+
vitals["state"] = "FOCUSED"
|
| 47 |
+
elif count > 0:
|
| 48 |
+
vitals["state"] = "ACTIVE"
|
| 49 |
+
else:
|
| 50 |
+
vitals["state"] = "IDLE"
|
| 51 |
+
|
| 52 |
except Exception as e:
|
| 53 |
print(f"Vitals: Working fetch failed: {e}")
|
| 54 |
+
vitals["state"] = "UNKNOWN"
|
| 55 |
|
| 56 |
return vitals
|
frontend/src/App.jsx
CHANGED
|
@@ -15,6 +15,7 @@ function App() {
|
|
| 15 |
reflection: "",
|
| 16 |
highlightedNodes: [],
|
| 17 |
sparks: [],
|
|
|
|
| 18 |
traces: []
|
| 19 |
})
|
| 20 |
const [currentView, setCurrentView] = useState('chat') // 'chat' or 'graph'
|
|
@@ -30,6 +31,7 @@ function App() {
|
|
| 30 |
sensoryDocuments: data.sensory,
|
| 31 |
graphRelations: data.semantic.nodes + data.semantic.edges,
|
| 32 |
workingMemory: data.working,
|
|
|
|
| 33 |
}));
|
| 34 |
} catch (err) {
|
| 35 |
console.error("Failed to fetch brain vitals:", err);
|
|
@@ -59,17 +61,15 @@ function App() {
|
|
| 59 |
}, []);
|
| 60 |
|
| 61 |
return (
|
| 62 |
-
<div className=
|
| 63 |
<header className="app-header">
|
| 64 |
<div className="logo-section">
|
| 65 |
<h1 style={{ fontSize: '1.2rem' }}>SOMA AI CORE</h1>
|
| 66 |
</div>
|
| 67 |
|
| 68 |
-
|
| 69 |
-
|
| 70 |
<div className="status-indicator">
|
| 71 |
<span className={`dot ${brainState.isLoading ? 'thinking' : 'idle'}`}></span>
|
| 72 |
-
<span className="label-mono">System
|
| 73 |
<span className="label-mono ephemeral-pill">Ephemeral Mode</span>
|
| 74 |
</div>
|
| 75 |
</header>
|
|
|
|
| 15 |
reflection: "",
|
| 16 |
highlightedNodes: [],
|
| 17 |
sparks: [],
|
| 18 |
+
cognitiveState: "IDLE",
|
| 19 |
traces: []
|
| 20 |
})
|
| 21 |
const [currentView, setCurrentView] = useState('chat') // 'chat' or 'graph'
|
|
|
|
| 31 |
sensoryDocuments: data.sensory,
|
| 32 |
graphRelations: data.semantic.nodes + data.semantic.edges,
|
| 33 |
workingMemory: data.working,
|
| 34 |
+
cognitiveState: data.state || 'IDLE'
|
| 35 |
}));
|
| 36 |
} catch (err) {
|
| 37 |
console.error("Failed to fetch brain vitals:", err);
|
|
|
|
| 61 |
}, []);
|
| 62 |
|
| 63 |
return (
|
| 64 |
+
<div className={`app-container state-${brainState.cognitiveState.toLowerCase()}`}>
|
| 65 |
<header className="app-header">
|
| 66 |
<div className="logo-section">
|
| 67 |
<h1 style={{ fontSize: '1.2rem' }}>SOMA AI CORE</h1>
|
| 68 |
</div>
|
| 69 |
|
|
|
|
|
|
|
| 70 |
<div className="status-indicator">
|
| 71 |
<span className={`dot ${brainState.isLoading ? 'thinking' : 'idle'}`}></span>
|
| 72 |
+
<span className="label-mono">System {brainState.cognitiveState}</span>
|
| 73 |
<span className="label-mono ephemeral-pill">Ephemeral Mode</span>
|
| 74 |
</div>
|
| 75 |
</header>
|
frontend/src/index.css
CHANGED
|
@@ -277,3 +277,30 @@ button:disabled {
|
|
| 277 |
from { top: 0%; }
|
| 278 |
to { top: 100%; }
|
| 279 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 277 |
from { top: 0%; }
|
| 278 |
to { top: 100%; }
|
| 279 |
}
|
| 280 |
+
|
| 281 |
+
/* ── Cognitive State Themes ── */
|
| 282 |
+
.state-overloaded {
|
| 283 |
+
--accent-primary: #ff3e3e;
|
| 284 |
+
--accent-secondary: #ff8e3e;
|
| 285 |
+
--accent-glow: rgba(255, 62, 62, 0.3);
|
| 286 |
+
--border-active: rgba(255, 62, 62, 0.5);
|
| 287 |
+
}
|
| 288 |
+
|
| 289 |
+
.state-overloaded .pulse-active {
|
| 290 |
+
animation: overloaded-glow 0.8s infinite alternate;
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
@keyframes overloaded-glow {
|
| 294 |
+
from { border-color: #ff3e3e; box-shadow: 0 0 5px rgba(255, 62, 62, 0.2); }
|
| 295 |
+
to { border-color: #ff8e3e; box-shadow: 0 0 20px rgba(255, 62, 62, 0.5); }
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
.state-focused {
|
| 299 |
+
--accent-primary: #7effa8;
|
| 300 |
+
--accent-secondary: #3d7a46;
|
| 301 |
+
--accent-glow: rgba(126, 255, 168, 0.3);
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
.state-idle {
|
| 305 |
+
--accent-secondary: #1a2e20;
|
| 306 |
+
}
|