diff --git a/endpoints/leran.post.py b/endpoints/leran.post.py index e69de29..0b1d810 100644 --- a/endpoints/leran.post.py +++ b/endpoints/leran.post.py @@ -0,0 +1,35 @@ +from fastapi import APIRouter, HTTPException +import uuid + +books = [] # In-memory storage + +router = APIRouter() + +@router.post("/learn") +async def generate_book( + title: str = "Sample Book", + author: str = "Default Author", + genre: str = "Fiction" +): + """Demo book generation endpoint""" + if any(b["title"] == title for b in books): + raise HTTPException(status_code=400, detail="Book already exists") + + book_id = str(uuid.uuid4()) + books.append({ + "id": book_id, + "title": title, + "author": author, + "genre": genre, + "disabled": False + }) + + return { + "message": "Book created successfully", + "book_id": book_id, + "title": title, + "next_steps": [ + "Add chapters (demo)", + "Complete book details" + ] + } \ No newline at end of file