Spaces:
Sleeping
Sleeping
| """Git Narrator routes.""" | |
| from flask import Blueprint, render_template, request, jsonify | |
| from .narrator import narrate | |
| bp = Blueprint("git_narrator", __name__, template_folder="templates") | |
| def index(): | |
| return render_template("git_narrator/index.html") | |
| def api_narrate(): | |
| body = request.get_json(silent=True) or {} | |
| raw = (body.get("content") or "").strip() | |
| if not raw: | |
| return jsonify({"error": "content is required (GitHub URL or git log text)"}), 400 | |
| if len(raw) < 10: | |
| return jsonify({"error": "Input too short — paste a URL or git log"}), 400 | |
| result = narrate(raw) | |
| return jsonify(result) | |