Skip to content

Commit

Permalink
Encode playground url
Browse files Browse the repository at this point in the history
  • Loading branch information
ashpreetbedi committed Oct 22, 2024
1 parent a659655 commit 3842422
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cookbook/playground/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export EXA_API_KEY=***
### Install libraries

```shell
pip install -U openai exa_py duckduckgo-search yfinance pypdf sqlalchemy 'fastapi[standard]' phidata youtube-transcript-api
pip install -U openai exa_py duckduckgo-search yfinance pypdf sqlalchemy 'fastapi[standard]' youtube-transcript-api phidata
```

### Authenticate with phidata.app
Expand Down
5 changes: 4 additions & 1 deletion phi/playground/serve.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Union
from urllib.parse import quote

from fastapi import FastAPI
from rich import box
Expand Down Expand Up @@ -34,9 +35,11 @@ def serve_playground_app(
return

logger.info(f"Starting playground on {scheme}://{host}:{port}")
# Encode the full endpoint (host:port)
encoded_endpoint = quote(f"{host}:{port}")

# Create a panel with the playground URL
url = f"{phi_cli_settings.playground_url}?endpoint={host}&port={port}"
url = f"{phi_cli_settings.playground_url}?endpoint={encoded_endpoint}"
panel = Panel(
f"[bold green]URL:[/bold green] [link={url}]{url}[/link]",
title="Agent Playground",
Expand Down

0 comments on commit 3842422

Please sign in to comment.