diff --git a/examples/social_network/main.py b/examples/social_network/main.py index 5746133..c892f44 100644 --- a/examples/social_network/main.py +++ b/examples/social_network/main.py @@ -15,7 +15,19 @@ app = NaturalFrontend( app, openai_api_key=creds["key"], - options=NaturalFrontendOptions(frontend_endpoint=""), + options=NaturalFrontendOptions( + frontend_endpoint="frontend", + personas=[ + { + "persona": "Twitter Lover Reader", + "description": "User that loves reading posts on a Twitter-like platform", + }, + { + "persona": "Administrator", + "description": "User that can see and change all posts and users", + }, + ], + ), ) @@ -35,13 +47,17 @@ class Post(BaseModel): # Initial data users = [ - User(id=1, email="user1@example.com", name="User One"), - User(id=2, email="user2@example.com", name="User Two"), + User(id=1, email="axel@mail.com", name="Axel Peytavin"), + User(id=2, email="pierrot@great-ai-startup.com", name="Pierre"), + User(id=3, email="michelle@aol.com", name="Michelle"), ] posts = [ - Post(id=1, title="Post 1", content="Content of post 1", owner_id=1), - Post(id=2, title="Post 2", content="Content of post 2", owner_id=1), - Post(id=3, title="Post 3", content="Content of post 3", owner_id=2), + Post(id=1, title="I love my dog", content="I love my dog a lot", owner_id=1), + Post(id=2, title="I love my cat", content="He's so cute", owner_id=1), + Post( + id=3, title="Who left the door open?", content="I'm freezing here", owner_id=2 + ), + Post(id=4, title="I'm so happy", content="I just got a new job", owner_id=3), ] diff --git a/natural_frontend/__init__.py b/natural_frontend/__init__.py index da1ddd2..5418f82 100644 --- a/natural_frontend/__init__.py +++ b/natural_frontend/__init__.py @@ -1 +1 @@ -from natural_frontend.natural_frontend import NaturalFrontend # noqa +from natural_frontend.natural_frontend import NaturalFrontend # noqa diff --git a/natural_frontend/natural_frontend.py b/natural_frontend/natural_frontend.py index 9d663fd..0953390 100644 --- a/natural_frontend/natural_frontend.py +++ b/natural_frontend/natural_frontend.py @@ -206,14 +206,14 @@ def parse_potential_personas(personas: str, retries=5): "pink", "lightblue", ], # Replace with your actual colors - "frontend_endpoint": f"gen_{frontend_endpoint}" + "frontend_endpoint": f"{frontend_endpoint}", }, ) @app.post(f"/gen_{frontend_endpoint}", response_class=HTMLResponse) async def handle_form(request: Request, persona: str = Form(...)): scheme = request.url.scheme - server_host = request.headers.get('host') + server_host = request.headers.get("host") full_url = f"{scheme}://{server_host}" logging.info(f"Generating frontend for url: {full_url}") diff --git a/pyproject.toml b/pyproject.toml index e15f577..9fcd5bc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "natural-frontend" -version = "0.0.4" +version = "0.0.5" authors = [ { name="Axel Peytavin", email="peytavin@stanford.edu" }, { name="Pierre Collignon", email="collignonpie@gmail.com" },