Files
2025-04-13 16:26:06 +02:00

31 lines
1.0 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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)"})