import json import os from typing import List from fastapi import FastAPI, HTTPException from fastapi.responses import HTMLResponse from pydantic import BaseModel from model import generate_structure app = FastAPI() STRUCTURE_FILE = "structures.json" structure_store = [] class Prompt(BaseModel): text: str class Structure(BaseModel): name: str description: str required_blocks: List[str] tags: List[str] @app.post("/prompt") async def prompt(prompt: Prompt): result = generate_structure(prompt.text) return {"response": result}