Added a new health page

This commit is contained in:
Dani 2025-04-27 18:57:30 -04:00
parent daf381561e
commit 34385c8bf8
8 changed files with 121 additions and 0 deletions

View File

@ -141,6 +141,47 @@ def dreams():
return render_template("dreams.html", dreams=recent) return render_template("dreams.html", dreams=recent)
@app.route("/health")
def health():
# Load vocab size
vocab_size = get_vocab_size()
# Load brainmap size
brainmap_size = len(get_brainmap())
# Load dreams
dreams = load_dreams()
dream_count = len(dreams)
last_dream = dreams[-1]["sentence"] if dreams else "No dreams yet."
# Load journal
try:
with open("data/memory/journal.json", "r", encoding="utf-8") as f:
journal_entries = json.load(f)
except Exception:
journal_entries = []
journal_count = len(journal_entries)
last_journal = journal_entries[-1] if journal_entries else "No journal entries yet."
# Load books
books = get_books()
book_count = len(books)
progress = load_progress()
books_finished = sum(1 for b in books if progress.get(b, 0) > 0)
return render_template("health.html",
vocab_size=vocab_size,
brainmap_size=brainmap_size,
book_count=book_count,
books_finished=books_finished,
dream_count=dream_count,
journal_count=journal_count,
last_dream=last_dream,
last_journal=last_journal)
def run_dashboard(): def run_dashboard():
log = logging.getLogger('werkzeug') log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR) log.setLevel(logging.ERROR)

View File

@ -41,6 +41,7 @@
<a href="/brainmap">🕸️ Brain Map</a> <a href="/brainmap">🕸️ Brain Map</a>
<a href="/growth">📈 Growth</a> <a href="/growth">📈 Growth</a>
<a href="/dreams">🌃 Dreams</a> <a href="/dreams">🌃 Dreams</a>
<a href="/health">❤️ Health</a>
</div> </div>
<div id="graph"></div> <div id="graph"></div>

View File

@ -48,6 +48,7 @@
<a href="/brainmap">🕸️ Brain Map</a> <a href="/brainmap">🕸️ Brain Map</a>
<a href="/growth">📈 Growth</a> <a href="/growth">📈 Growth</a>
<a href="/dreams">🌃 Dreams</a> <a href="/dreams">🌃 Dreams</a>
<a href="/health">❤️ Health</a>
</div> </div>
<h1>🧠 Ruby's Concept Clusters</h1> <h1>🧠 Ruby's Concept Clusters</h1>

View File

@ -40,6 +40,7 @@
<a href="/brainmap">🕸️ Brain Map</a> <a href="/brainmap">🕸️ Brain Map</a>
<a href="/growth">📈 Growth</a> <a href="/growth">📈 Growth</a>
<a href="/dreams">💬 Dreams</a> <a href="/dreams">💬 Dreams</a>
<a href="/health">❤️ Health</a>
</div> </div>
<h1>💬 Ruby's Dream Stream</h1> <h1>💬 Ruby's Dream Stream</h1>

View File

@ -39,6 +39,7 @@
<a href="/brainmap">🕸️ Brain Map</a> <a href="/brainmap">🕸️ Brain Map</a>
<a href="/growth">📈 Growth</a> <a href="/growth">📈 Growth</a>
<a href="/dreams">💬 Dreams</a> <a href="/dreams">💬 Dreams</a>
<a href="/health">❤️ Health</a>
</div> </div>
<h1>📈 Ruby's Brain Growth</h1> <h1>📈 Ruby's Brain Growth</h1>

View File

@ -0,0 +1,74 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="60">
<title>Ruby's Health Monitor</title>
<style>
body {
background-color: #121212;
color: #e0e0e0;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
padding: 20px;
}
h1 {
color: #ffd700;
}
.stat {
margin-bottom: 20px;
font-size: 1.2em;
}
.nav {
background-color: #1e1e1e;
padding: 10px;
margin-bottom: 20px;
}
.nav a {
color: #e0e0e0;
margin-right: 20px;
text-decoration: none;
}
.box {
background-color: #1a1a1a;
padding: 15px;
border-radius: 10px;
margin-bottom: 20px;
}
</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>
<a href="/health">❤️ Health</a>
</div>
<h1>❤️ Ruby's Health Monitor</h1>
<div class="box">
<div class="stat"><strong>Vocabulary Size:</strong> {{ vocab_size }}</div>
<div class="stat"><strong>Brain Map Size:</strong> {{ brainmap_size }}</div>
</div>
<div class="box">
<div class="stat"><strong>Books Available:</strong> {{ book_count }}</div>
<div class="stat"><strong>Books Finished:</strong> {{ books_finished }}</div>
</div>
<div class="box">
<div class="stat"><strong>Dreams Generated:</strong> {{ dream_count }}</div>
<div class="stat"><strong>Latest Dream:</strong> {{ last_dream }}</div>
</div>
<div class="box">
<div class="stat"><strong>Journal Entries:</strong> {{ journal_count }}</div>
<div class="stat"><strong>Latest Journal Entry:</strong> {{ last_journal }}</div>
</div>
</body>
</html>

View File

@ -73,6 +73,7 @@
<a href="/brainmap">🕸️ Brain Map</a> <a href="/brainmap">🕸️ Brain Map</a>
<a href="/growth">📈 Growth</a> <a href="/growth">📈 Growth</a>
<a href="/dreams">💬 Dreams</a> <a href="/dreams">💬 Dreams</a>
<a href="/health">❤️ Health</a>
</div> </div>
<div class="container"> <div class="container">

View File

@ -40,6 +40,7 @@
<a href="/brainmap">🕸️ Brain Map</a> <a href="/brainmap">🕸️ Brain Map</a>
<a href="/growth">📈 Growth</a> <a href="/growth">📈 Growth</a>
<a href="/dreams">🌃 Dreams</a> <a href="/dreams">🌃 Dreams</a>
<a href="/health">❤️ Health</a>
</div> </div>
<h1>📓 Ruby's Journal</h1> <h1>📓 Ruby's Journal</h1>