FerrellSyntheticIntelligence commited on
Commit ·
95e7935
1
Parent(s): c5a5976
feat: finalize app.py integrity guard and retrieval logic
Browse files
app.py
CHANGED
|
@@ -10,14 +10,25 @@ app = Flask(__name__)
|
|
| 10 |
@app.before_request
|
| 11 |
def guard():
|
| 12 |
if not verify_vault():
|
| 13 |
-
return jsonify({"error": "Integrity violation"}), 403
|
| 14 |
|
| 15 |
retriever = LocalRetrievalEngine()
|
| 16 |
|
| 17 |
@app.route('/ripple', methods=['POST'])
|
| 18 |
def ripple():
|
| 19 |
-
data = request.get_json(force=True)
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
if __name__ == '__main__':
|
| 23 |
app.run(host='0.0.0.0', port=5000)
|
|
|
|
| 10 |
@app.before_request
|
| 11 |
def guard():
|
| 12 |
if not verify_vault():
|
| 13 |
+
return jsonify({"error": "Integrity violation: Knowledge vault tampered."}), 403
|
| 14 |
|
| 15 |
retriever = LocalRetrievalEngine()
|
| 16 |
|
| 17 |
@app.route('/ripple', methods=['POST'])
|
| 18 |
def ripple():
|
| 19 |
+
data = request.get_json(force=True) or {}
|
| 20 |
+
text = data.get("text", "").strip()
|
| 21 |
+
if not text: return jsonify({"error": "Null parameters"}), 400
|
| 22 |
+
try:
|
| 23 |
+
return jsonify(get_ripple_payload(text))
|
| 24 |
+
except Exception as e:
|
| 25 |
+
return jsonify({"error": str(e)}), 500
|
| 26 |
+
|
| 27 |
+
@app.route('/', methods=['GET'])
|
| 28 |
+
def index():
|
| 29 |
+
template_path = os.path.join(os.getcwd(), "templates", "ripple.html")
|
| 30 |
+
with open(template_path, 'r', encoding='utf-8') as f:
|
| 31 |
+
return render_template_string(f.read())
|
| 32 |
|
| 33 |
if __name__ == '__main__':
|
| 34 |
app.run(host='0.0.0.0', port=5000)
|