From 1fa52b62aa3f121fc4f7ea906f799e693a03e292 Mon Sep 17 00:00:00 2001 From: Greg Schwartz Date: Sat, 19 Oct 2024 16:18:43 -0700 Subject: [PATCH] Put start agent/call at localhost root. Before you had to read in the docs to go to /start, or /start_call or /start_bot. Which isn't mentioned in the console output, and is inconsistent, adding friction to learning the codebase --- examples/canonical-metrics/README.md | 2 +- examples/canonical-metrics/server.py | 2 +- examples/chatbot-audio-recording/README.md | 2 +- examples/chatbot-audio-recording/server.py | 2 +- examples/deployment/flyio-example/README.md | 2 +- examples/deployment/flyio-example/bot_runner.py | 2 +- examples/moondream-chatbot/README.md | 4 ++-- examples/moondream-chatbot/server.py | 2 +- examples/patient-intake/README.md | 2 +- examples/patient-intake/server.py | 4 ++-- examples/simple-chatbot/README.md | 2 +- examples/simple-chatbot/server.py | 2 +- examples/storytelling-chatbot/frontend/components/App.tsx | 2 +- examples/storytelling-chatbot/src/bot_runner.py | 2 +- examples/translation-chatbot/README.md | 2 +- examples/translation-chatbot/server.py | 2 +- examples/twilio-chatbot/README.md | 2 +- examples/twilio-chatbot/server.py | 2 +- 18 files changed, 20 insertions(+), 20 deletions(-) diff --git a/examples/canonical-metrics/README.md b/examples/canonical-metrics/README.md index 13c0b31e0..23730e977 100644 --- a/examples/canonical-metrics/README.md +++ b/examples/canonical-metrics/README.md @@ -27,7 +27,7 @@ cp env.example .env # and add your credentials python server.py ``` -Then, visit `http://localhost:7860/start` in your browser to start a chatbot session. +Then, visit `http://localhost:7860/` in your browser to start a chatbot session. ## Build and test the Docker image diff --git a/examples/canonical-metrics/server.py b/examples/canonical-metrics/server.py index 62ce899be..2ed6c8239 100644 --- a/examples/canonical-metrics/server.py +++ b/examples/canonical-metrics/server.py @@ -59,7 +59,7 @@ app.add_middleware( ) -@app.get("/start") +@app.get("/") async def start_agent(request: Request): print(f"!!! Creating room") room = await daily_helpers["rest"].create_room(DailyRoomParams()) diff --git a/examples/chatbot-audio-recording/README.md b/examples/chatbot-audio-recording/README.md index 13c0b31e0..23730e977 100644 --- a/examples/chatbot-audio-recording/README.md +++ b/examples/chatbot-audio-recording/README.md @@ -27,7 +27,7 @@ cp env.example .env # and add your credentials python server.py ``` -Then, visit `http://localhost:7860/start` in your browser to start a chatbot session. +Then, visit `http://localhost:7860/` in your browser to start a chatbot session. ## Build and test the Docker image diff --git a/examples/chatbot-audio-recording/server.py b/examples/chatbot-audio-recording/server.py index 62ce899be..2ed6c8239 100644 --- a/examples/chatbot-audio-recording/server.py +++ b/examples/chatbot-audio-recording/server.py @@ -59,7 +59,7 @@ app.add_middleware( ) -@app.get("/start") +@app.get("/") async def start_agent(request: Request): print(f"!!! Creating room") room = await daily_helpers["rest"].create_room(DailyRoomParams()) diff --git a/examples/deployment/flyio-example/README.md b/examples/deployment/flyio-example/README.md index 689ef11fc..379e75b47 100644 --- a/examples/deployment/flyio-example/README.md +++ b/examples/deployment/flyio-example/README.md @@ -34,6 +34,6 @@ Note: you can do this manually via the fly.io dashboard under the "secrets" sub- Send a post request to your running fly.io instance: -`curl --location --request POST 'https://YOUR_FLY_APP_NAME/start_bot'` +`curl --location --request POST 'https://YOUR_FLY_APP_NAME/'` This request will wait until the machine enters into a `starting` state, before returning the a room URL and token to join. diff --git a/examples/deployment/flyio-example/bot_runner.py b/examples/deployment/flyio-example/bot_runner.py index 7c76d26f4..3795847e4 100644 --- a/examples/deployment/flyio-example/bot_runner.py +++ b/examples/deployment/flyio-example/bot_runner.py @@ -124,7 +124,7 @@ async def spawn_fly_machine(room_url: str, token: str): print(f"Machine joined room: {room_url}") -@app.post("/start_bot") +@app.post("/") async def start_bot(request: Request) -> JSONResponse: try: data = await request.json() diff --git a/examples/moondream-chatbot/README.md b/examples/moondream-chatbot/README.md index 53f7f84dd..bf8c7661a 100644 --- a/examples/moondream-chatbot/README.md +++ b/examples/moondream-chatbot/README.md @@ -24,7 +24,7 @@ cp env.example .env # and add your credentials python server.py ``` -Then, visit `http://localhost:7860/start` in your browser to start a chatbot +Then, visit `http://localhost:7860/` in your browser to start a chatbot session. ## Build and test the Docker image @@ -41,4 +41,4 @@ docker build -t moonbot -f Dockerfile.intel . docker run --env-file .env -p 7860:7860 --device /dev/dri moonbot ``` -You can try to visit `http://localhost:7860/start` again. +You can try to visit `http://localhost:7860/` again. diff --git a/examples/moondream-chatbot/server.py b/examples/moondream-chatbot/server.py index e3523851e..aa4e82c90 100644 --- a/examples/moondream-chatbot/server.py +++ b/examples/moondream-chatbot/server.py @@ -57,7 +57,7 @@ app.add_middleware( ) -@app.get("/start") +@app.get("/") async def start_agent(request: Request): print(f"!!! Creating room") room = await daily_helpers["rest"].create_room(DailyRoomParams()) diff --git a/examples/patient-intake/README.md b/examples/patient-intake/README.md index 1820a61df..a92a76b97 100644 --- a/examples/patient-intake/README.md +++ b/examples/patient-intake/README.md @@ -54,7 +54,7 @@ cp env.example .env # and add your credentials python server.py ``` -Then, visit `http://localhost:7860/start` in your browser to start a chatbot session. +Then, visit `http://localhost:7860/` in your browser to start a chatbot session. ## Build and test the Docker image diff --git a/examples/patient-intake/server.py b/examples/patient-intake/server.py index d376ce3b9..20894b019 100644 --- a/examples/patient-intake/server.py +++ b/examples/patient-intake/server.py @@ -57,7 +57,7 @@ app.add_middleware( ) -@app.get("/start") +@app.get("/") async def start_agent(request: Request): print(f"!!! Creating room") room = await daily_helpers["rest"].create_room(DailyRoomParams()) @@ -128,7 +128,7 @@ if __name__ == "__main__": parser.add_argument("--reload", action="store_true", help="Reload code on change") config = parser.parse_args() - print(f"to join a test room, visit http://localhost:{config.port}/start") + print(f"to join a test room, visit http://localhost:{config.port}/") uvicorn.run( "server:app", host=config.host, diff --git a/examples/simple-chatbot/README.md b/examples/simple-chatbot/README.md index 13c0b31e0..23730e977 100644 --- a/examples/simple-chatbot/README.md +++ b/examples/simple-chatbot/README.md @@ -27,7 +27,7 @@ cp env.example .env # and add your credentials python server.py ``` -Then, visit `http://localhost:7860/start` in your browser to start a chatbot session. +Then, visit `http://localhost:7860/` in your browser to start a chatbot session. ## Build and test the Docker image diff --git a/examples/simple-chatbot/server.py b/examples/simple-chatbot/server.py index 5240c254f..9063e28b1 100644 --- a/examples/simple-chatbot/server.py +++ b/examples/simple-chatbot/server.py @@ -57,7 +57,7 @@ app.add_middleware( ) -@app.get("/start") +@app.get("/") async def start_agent(request: Request): print(f"!!! Creating room") room = await daily_helpers["rest"].create_room(DailyRoomParams()) diff --git a/examples/storytelling-chatbot/frontend/components/App.tsx b/examples/storytelling-chatbot/frontend/components/App.tsx index 73ad50a97..553a21836 100644 --- a/examples/storytelling-chatbot/frontend/components/App.tsx +++ b/examples/storytelling-chatbot/frontend/components/App.tsx @@ -27,7 +27,7 @@ export default function Call() { // Create a new room for the story session try { - const response = await fetch("/start_bot", { + const response = await fetch("/", { method: "POST", headers: { "Content-Type": "application/json", diff --git a/examples/storytelling-chatbot/src/bot_runner.py b/examples/storytelling-chatbot/src/bot_runner.py index 13ce49834..25a1bca37 100644 --- a/examples/storytelling-chatbot/src/bot_runner.py +++ b/examples/storytelling-chatbot/src/bot_runner.py @@ -69,7 +69,7 @@ STATIC_DIR = "frontend/out" app.mount("/static", StaticFiles(directory=STATIC_DIR, html=True), name="static") -@app.post("/start_bot") +@app.post("/") async def start_bot(request: Request) -> JSONResponse: if os.getenv("ENV", "dev") == "production": # Only allow requests from the specified domain diff --git a/examples/translation-chatbot/README.md b/examples/translation-chatbot/README.md index ff25117ea..98be68fc0 100644 --- a/examples/translation-chatbot/README.md +++ b/examples/translation-chatbot/README.md @@ -23,7 +23,7 @@ cp env.example .env # and add your credentials python server.py ``` -Then, visit `http://localhost:7860/start` in your browser to start a translatorbot session. +Then, visit `http://localhost:7860/` in your browser to start a translatorbot session. ## Build and test the Docker image diff --git a/examples/translation-chatbot/server.py b/examples/translation-chatbot/server.py index 5240c254f..9063e28b1 100644 --- a/examples/translation-chatbot/server.py +++ b/examples/translation-chatbot/server.py @@ -57,7 +57,7 @@ app.add_middleware( ) -@app.get("/start") +@app.get("/") async def start_agent(request: Request): print(f"!!! Creating room") room = await daily_helpers["rest"].create_room(DailyRoomParams()) diff --git a/examples/twilio-chatbot/README.md b/examples/twilio-chatbot/README.md index fdea359f9..ef1b280a5 100644 --- a/examples/twilio-chatbot/README.md +++ b/examples/twilio-chatbot/README.md @@ -53,7 +53,7 @@ This project is a FastAPI-based chatbot that integrates with Twilio to handle We ``` 2. **Update the Twilio Webhook**: - Copy the ngrok URL and update your Twilio phone number webhook URL to `http:///start_call`. + Copy the ngrok URL and update your Twilio phone number webhook URL to `http:///`. 3. **Update streams.xml**: Copy the ngrok URL and update templates/streams.xml with `wss:///ws`. diff --git a/examples/twilio-chatbot/server.py b/examples/twilio-chatbot/server.py index 9656875ec..31e98e25f 100644 --- a/examples/twilio-chatbot/server.py +++ b/examples/twilio-chatbot/server.py @@ -19,7 +19,7 @@ app.add_middleware( ) -@app.post("/start_call") +@app.post("/") async def start_call(): print("POST TwiML") return HTMLResponse(content=open("templates/streams.xml").read(), media_type="application/xml")