Update 2025-04-13_16:26:04
This commit is contained in:
30
main.py
Normal file
30
main.py
Normal file
@ -0,0 +1,30 @@
|
||||
# main.py
|
||||
# FastAPI backend for Emoji Evolution – placeholder logic for LLM override
|
||||
|
||||
from fastapi import FastAPI
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from pathlib import Path
|
||||
from fastapi.responses import JSONResponse, HTMLResponse
|
||||
from pydantic import BaseModel
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
# Mount the 'static' directory to serve frontend files
|
||||
app.mount("/static", StaticFiles(directory="static"), name="static")
|
||||
|
||||
# Pydantic model for puzzle submission
|
||||
class PuzzleSubmission(BaseModel):
|
||||
sequence: list[str]
|
||||
|
||||
@app.get("/", response_class=HTMLResponse)
|
||||
async def root_html():
|
||||
return Path("static/index.html").read_text(encoding="utf-8")
|
||||
|
||||
@app.post("/api/check-puzzle")
|
||||
async def check_puzzle(submission: PuzzleSubmission):
|
||||
# Server-side logic is now obsolete (replaced by LLM check in frontend)
|
||||
# Keeping this route for local fallback/testing if needed
|
||||
if submission.sequence == ["😂", "😊", "🥳"]:
|
||||
return JSONResponse({"result": "✅ Success!"})
|
||||
return JSONResponse({"result": "❌ Try Again (LLM not used)"})
|
||||
|
Reference in New Issue
Block a user