diff --git a/dashboard/dashboard.py b/dashboard/dashboard.py index c233b87..8884fe0 100644 --- a/dashboard/dashboard.py +++ b/dashboard/dashboard.py @@ -4,6 +4,7 @@ from model.journal import read_journal_entries from model.memory import load_dreams from model.tokenizer import Tokenizer from model.abstraction import cluster_vocab +from model.memory import load_dreams from context.context import load_context import json import os @@ -45,21 +46,39 @@ def index(): 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") def brainmap(): map_data = get_brainmap() nodes = [] links = [] + MIN_LINK_WEIGHT = 2 # only show links seen at least 2 times + seen_words = set() for word, connections in map_data.items(): - nodes.append({"id": word}) for linked_word, weight in connections.items(): - links.append({ - "source": word, - "target": linked_word, - "value": weight - }) + if weight >= MIN_LINK_WEIGHT: + links.append({ + "source": word, + "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)) @@ -76,5 +95,12 @@ def concepts(): 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(): app.run(host="0.0.0.0", port=5000, debug=False, use_reloader=False) diff --git a/dashboard/templates/brainmap.html b/dashboard/templates/brainmap.html index 0e201e1..5c6fba7 100644 --- a/dashboard/templates/brainmap.html +++ b/dashboard/templates/brainmap.html @@ -38,6 +38,8 @@ π Journal π§ Concepts πΈοΈ Brain Map + π Growth + π Dreams
diff --git a/dashboard/templates/concepts.html b/dashboard/templates/concepts.html index 419a9a4..0698de5 100644 --- a/dashboard/templates/concepts.html +++ b/dashboard/templates/concepts.html @@ -46,6 +46,8 @@ π Journal π§ Concepts πΈοΈ Brain Map + π Growth + π Dreams