Added new growth and dreams trackers
This commit is contained in:
parent
6ab7b7586a
commit
f21e9b433e
@ -4,6 +4,7 @@ from model.journal import read_journal_entries
|
|||||||
from model.memory import load_dreams
|
from model.memory import load_dreams
|
||||||
from model.tokenizer import Tokenizer
|
from model.tokenizer import Tokenizer
|
||||||
from model.abstraction import cluster_vocab
|
from model.abstraction import cluster_vocab
|
||||||
|
from model.memory import load_dreams
|
||||||
from context.context import load_context
|
from context.context import load_context
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
@ -45,21 +46,39 @@ def index():
|
|||||||
next_cycle=remaining)
|
next_cycle=remaining)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/growth")
|
||||||
|
def growth():
|
||||||
|
vocab_size = len(tokenizer.vocab)
|
||||||
|
brainmap_size = len(get_brainmap())
|
||||||
|
memory_size = len(load_context())
|
||||||
|
return render_template("growth.html",
|
||||||
|
vocab_size=vocab_size,
|
||||||
|
brainmap_size=brainmap_size,
|
||||||
|
memory_size=memory_size)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/brainmap")
|
@app.route("/brainmap")
|
||||||
def brainmap():
|
def brainmap():
|
||||||
map_data = get_brainmap()
|
map_data = get_brainmap()
|
||||||
|
|
||||||
nodes = []
|
nodes = []
|
||||||
links = []
|
links = []
|
||||||
|
MIN_LINK_WEIGHT = 2 # only show links seen at least 2 times
|
||||||
|
seen_words = set()
|
||||||
|
|
||||||
for word, connections in map_data.items():
|
for word, connections in map_data.items():
|
||||||
nodes.append({"id": word})
|
|
||||||
for linked_word, weight in connections.items():
|
for linked_word, weight in connections.items():
|
||||||
links.append({
|
if weight >= MIN_LINK_WEIGHT:
|
||||||
"source": word,
|
links.append({
|
||||||
"target": linked_word,
|
"source": word,
|
||||||
"value": weight
|
"target": linked_word,
|
||||||
})
|
"value": weight
|
||||||
|
})
|
||||||
|
seen_words.add(word)
|
||||||
|
seen_words.add(linked_word)
|
||||||
|
|
||||||
|
for word in seen_words:
|
||||||
|
nodes.append({"id": word})
|
||||||
|
|
||||||
return render_template("brainmap.html", nodes=json.dumps(nodes), links=json.dumps(links))
|
return render_template("brainmap.html", nodes=json.dumps(nodes), links=json.dumps(links))
|
||||||
|
|
||||||
@ -76,5 +95,12 @@ def concepts():
|
|||||||
return render_template("concepts.html", clusters=clusters)
|
return render_template("concepts.html", clusters=clusters)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/dreams")
|
||||||
|
def dreams():
|
||||||
|
dreams = load_dreams()
|
||||||
|
recent = dreams[-20:][::-1] # Last 20 dreams, newest first
|
||||||
|
return render_template("dreams.html", dreams=recent)
|
||||||
|
|
||||||
|
|
||||||
def run_dashboard():
|
def run_dashboard():
|
||||||
app.run(host="0.0.0.0", port=5000, debug=False, use_reloader=False)
|
app.run(host="0.0.0.0", port=5000, debug=False, use_reloader=False)
|
||||||
|
@ -38,6 +38,8 @@
|
|||||||
<a href="/journal">📓 Journal</a>
|
<a href="/journal">📓 Journal</a>
|
||||||
<a href="/concepts">🧠 Concepts</a>
|
<a href="/concepts">🧠 Concepts</a>
|
||||||
<a href="/brainmap">🕸️ Brain Map</a>
|
<a href="/brainmap">🕸️ Brain Map</a>
|
||||||
|
<a href="/growth">📈 Growth</a>
|
||||||
|
<a href="/dreams">🌃 Dreams</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="graph"></div>
|
<div id="graph"></div>
|
||||||
|
@ -46,6 +46,8 @@
|
|||||||
<a href="/journal">📓 Journal</a>
|
<a href="/journal">📓 Journal</a>
|
||||||
<a href="/concepts">🧠 Concepts</a>
|
<a href="/concepts">🧠 Concepts</a>
|
||||||
<a href="/brainmap">🕸️ Brain Map</a>
|
<a href="/brainmap">🕸️ Brain Map</a>
|
||||||
|
<a href="/growth">📈 Growth</a>
|
||||||
|
<a href="/dreams">🌃 Dreams</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1>🧠 Ruby's Concept Clusters</h1>
|
<h1>🧠 Ruby's Concept Clusters</h1>
|
||||||
|
55
dashboard/templates/dreams.html
Normal file
55
dashboard/templates/dreams.html
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Ruby's Dream Stream</title>
|
||||||
|
<meta http-equiv="refresh" content="10">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #121212;
|
||||||
|
color: #e0e0e0;
|
||||||
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
.dream {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
border-bottom: 1px solid #333;
|
||||||
|
}
|
||||||
|
.nav {
|
||||||
|
background-color: #1e1e1e;
|
||||||
|
padding: 10px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
.nav a {
|
||||||
|
color: #e0e0e0;
|
||||||
|
margin-right: 20px;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="nav">
|
||||||
|
<a href="/">🏠 Home</a>
|
||||||
|
<a href="/journal">📓 Journal</a>
|
||||||
|
<a href="/concepts">🧠 Concepts</a>
|
||||||
|
<a href="/brainmap">🕸️ Brain Map</a>
|
||||||
|
<a href="/growth">📈 Growth</a>
|
||||||
|
<a href="/dreams">💬 Dreams</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h1>💬 Ruby's Dream Stream</h1>
|
||||||
|
|
||||||
|
{% for dream in dreams %}
|
||||||
|
<div class="dream">
|
||||||
|
<strong>Score:</strong> {{ dream.score }}<br>
|
||||||
|
{{ dream.sentence }}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
50
dashboard/templates/growth.html
Normal file
50
dashboard/templates/growth.html
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Ruby's Brain Growth</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #121212;
|
||||||
|
color: #e0e0e0;
|
||||||
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
.stat {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
font-size: 1.5em;
|
||||||
|
}
|
||||||
|
.nav {
|
||||||
|
background-color: #1e1e1e;
|
||||||
|
padding: 10px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
.nav a {
|
||||||
|
color: #e0e0e0;
|
||||||
|
margin-right: 20px;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="nav">
|
||||||
|
<a href="/">🏠 Home</a>
|
||||||
|
<a href="/journal">📓 Journal</a>
|
||||||
|
<a href="/concepts">🧠 Concepts</a>
|
||||||
|
<a href="/brainmap">🕸️ Brain Map</a>
|
||||||
|
<a href="/growth">📈 Growth</a>
|
||||||
|
<a href="/dreams">💬 Dreams</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h1>📈 Ruby's Brain Growth</h1>
|
||||||
|
|
||||||
|
<div class="stat">Vocabulary Size: {{ vocab_size }}</div>
|
||||||
|
<div class="stat">Brain Map Size: {{ brainmap_size }}</div>
|
||||||
|
<div class="stat">Memory Entries: {{ memory_size }}</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -30,12 +30,17 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div style="background-color: #1e1e1e; padding: 10px; margin-bottom: 20px;">
|
<body>
|
||||||
<a href="/" style="color: #e0e0e0; margin-right: 20px;">🏠 Home</a>
|
|
||||||
<a href="/journal" style="color: #e0e0e0; margin-right: 20px;">📓 Journal</a>
|
<div class="nav">
|
||||||
<a href="/concepts" style="color: #e0e0e0; margin-right: 20px;">🧠 Concepts</a>
|
<a href="/">🏠 Home</a>
|
||||||
<a href="/brainmap" style="color: #e0e0e0;">🕸️ Brain Map</a>
|
<a href="/journal">📓 Journal</a>
|
||||||
|
<a href="/concepts">🧠 Concepts</a>
|
||||||
|
<a href="/brainmap">🕸️ Brain Map</a>
|
||||||
|
<a href="/growth">📈 Growth</a>
|
||||||
|
<a href="/dreams">💬 Dreams</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1>Ruby is Running 🧠</h1>
|
<h1>Ruby is Running 🧠</h1>
|
||||||
|
|
||||||
<div class="section">
|
<div class="section">
|
||||||
|
@ -38,6 +38,8 @@
|
|||||||
<a href="/journal">📓 Journal</a>
|
<a href="/journal">📓 Journal</a>
|
||||||
<a href="/concepts">🧠 Concepts</a>
|
<a href="/concepts">🧠 Concepts</a>
|
||||||
<a href="/brainmap">🕸️ Brain Map</a>
|
<a href="/brainmap">🕸️ Brain Map</a>
|
||||||
|
<a href="/growth">📈 Growth</a>
|
||||||
|
<a href="/dreams">🌃 Dreams</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1>📓 Ruby's Journal</h1>
|
<h1>📓 Ruby's Journal</h1>
|
||||||
|
@ -16,6 +16,7 @@ def generate_response():
|
|||||||
seed_tokens = tokenizer.tokenize(start)
|
seed_tokens = tokenizer.tokenize(start)
|
||||||
if seed_tokens:
|
if seed_tokens:
|
||||||
seed = torch.tensor([seed_tokens[-1]], device=DEVICE).unsqueeze(0)
|
seed = torch.tensor([seed_tokens[-1]], device=DEVICE).unsqueeze(0)
|
||||||
|
seed = seed[:, -128:]
|
||||||
else:
|
else:
|
||||||
seed = torch.tensor([random.randint(0, tokenizer.next_id - 1)], device=DEVICE).unsqueeze(0)
|
seed = torch.tensor([random.randint(0, tokenizer.next_id - 1)], device=DEVICE).unsqueeze(0)
|
||||||
else:
|
else:
|
||||||
|
@ -23,6 +23,7 @@ def train_on_message(text: str):
|
|||||||
if len(tokens) < 2:
|
if len(tokens) < 2:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
tokens = tokens[:128]
|
||||||
words = tokenizer.detokenize(tokens).split()
|
words = tokenizer.detokenize(tokens).split()
|
||||||
update_brainmap(words)
|
update_brainmap(words)
|
||||||
input_tensor = torch.tensor(tokens[:-1], dtype=torch.long, device=DEVICE).unsqueeze(0)
|
input_tensor = torch.tensor(tokens[:-1], dtype=torch.long, device=DEVICE).unsqueeze(0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user