Ruby/dashboard.py
2025-05-04 17:32:25 -04:00

37 lines
794 B
Python

from flask import Flask, render_template, jsonify
import brain_map
app = Flask(
__name__,
template_folder='templates',
static_folder='static',
)
# Register the brain_map blueprint
app.register_blueprint(brain_map.bp)
# Will be injected from body.py
system = None
@app.route('/')
def dashboard():
return render_template('dashboard.html')
@app.route('/progress')
def progress():
if system is None:
return jsonify({'processed': 0, 'total': 0})
return jsonify({
'processed': getattr(system, 'processed_lines', 0),
'total': getattr(system, 'total_lines', 0)
})
@app.route('/interactions')
def interactions():
if system is None or not hasattr(system, 'history'):
return jsonify([])
return jsonify(list(system.history))