final draft

This commit is contained in:
chris
2025-08-28 13:58:47 +00:00
parent fb20ee3f7e
commit 8bc12b4a89
7 changed files with 55 additions and 1 deletions

View File

@@ -0,0 +1,30 @@
# api
from flask import Flask, request, jsonify
from llm import call_llm
from flask_cors import CORS
app = Flask(__name__)
CORS(app) # * example.com
@app.route("/", methods=["GET"])
def index():
return "Welcome to this lesson"
@app.route("/test", methods=["GET"])
def test():
return "Test"
@app.route("/hello", methods=["POST"])
def hello():
# get message from request body { "message": "do this taks for me" }
data = request.get_json()
message = data.get("message", "")
response = call_llm(message, "You are a helpful assistant.")
return jsonify({
"response": response
})
if __name__ == "__main__":
app.run(host="0.0.0.0", port=5000)