forked from kent/consciousness
amygdala: F8 screen for live concept-readout projections
Per-token residual-stream projections from the vLLM server's readout pipeline surfaced as a TUI bar chart. Flow: * agent/readout.rs — SharedReadoutBuffer (manifest + ring of last ~200 token entries). Lives on Agent and is shared across forks (single stream, one landing pad). * agent/mod.rs — Agent::new now probes /v1/readout/manifest at startup (non-fatal; 404 leaves manifest None, which disables the screen). * agent/context.rs — the streaming token handler pushes every token with attached readout onto the shared buffer. * user/amygdala.rs — F8 screen. Top-K concepts by |value| as horizontal bars (green positive, red negative), plus a 4-line recent-tokens panel showing each token's top concept at the selected layer. Keys: 1..9 select layer, t toggles current/mean-over-recent. Disabled state renders a hint pointing at VLLM_READOUT_MANIFEST / VLLM_READOUT_VECTORS so users can tell the feature apart from "server up but no tokens yet". Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
0f1c4cf1de
commit
c8976660f4
5 changed files with 410 additions and 2 deletions
|
|
@ -682,7 +682,12 @@ impl ResponseParser {
|
|||
let mut full_text = String::new();
|
||||
while let Some(event) = stream.recv().await {
|
||||
match event {
|
||||
super::api::StreamToken::Token { id, readout: _ } => {
|
||||
super::api::StreamToken::Token { id, readout } => {
|
||||
if let Some(r) = readout {
|
||||
if let Ok(mut buf) = agent.readout.lock() {
|
||||
buf.push(id, r);
|
||||
}
|
||||
}
|
||||
let text = super::tokenizer::decode(&[id]);
|
||||
full_text.push_str(&text);
|
||||
let mut ctx = agent.context.lock().await;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue