a16z-infra / ai-town

A MIT-licensed, deployable starter kit for building and customizing your own version of AI town - a virtual town where AI characters live, chat and socialize.
https://convex.dev/ai-town
MIT License
7.58k stars 698 forks source link

"No default world found" error when trying to run AI Town locally #256

Open MrCsabaToth opened 3 days ago

MrCsabaToth commented 3 days ago

This is on an M3 MacBook Pro.

  1. I'm following the guide, I had Ollama set up and running already, I'm serving a llama3 variant which I tested. Listening on the 1st terminal window.
  2. I configured the llm.ts to reflect the locally hosted LLM and embedding
  3. I downloaded the precompiled ARM architecture binary for the convex back-end and successfully started it (listening in a 2nd terminal window)
  4. I also executed just convex env set OLLAMA_HOST http://localhost:11434 which is not in the top local run guide, but mentioned later when the guide is fiddling with containers. This command resulted in ✔ Successfully set OLLAMA_HOST to http://localhost:11434 (on dev deployment oceanic-kudu-143) and I can see the env variable set in the convex cloud dev environment.
  5. Started the back-end separately in the 3rd temrinal window ai-town % npm run dev:backend
  6. Started the front-end separately in the 4th temrinal window ai-town % npm run dev:fontend
  7. After that GUI displays at http://localhost:5173/ai-town, however it's at the main menu and nothing happens when I click on the Interact button.
  8. When I click on the Freeze button also seemingly nothing happens, however the back-end terminal displays an error (the last three lines, in red):

ai-town@0.0.0 dev:backend just convex dev --tail-logs

✔ 22:01:26 Convex functions ready! (8.5s) 10/22/2024, 10:03:24 PM [CONVEX M(testing:stop)] Uncaught Error: No default world found at getDefaultWorld (../convex/testing.ts:120:2) at async handler (../convex/testing.ts:71:31)

I'm new to AI town. The guide doesn't tell anything about setting a default world or anything. DO I need ot configure something on the convex web UI? Does that even come into picture when running AI Town locally? I see all of the log messages there too. I'm stuck.

MrCsabaToth commented 3 days ago

Looks like others have the same problem:

Also note when I peek at the logs in my convex account online, I see a world:restartDeadWorlds event every single minute.

MrCsabaToth commented 3 days ago

In the .env file the VITE was pointing to the convex cloud. I modified that to point to my local convex server URL. Now it seems that the ai town backend kinda-sorta sees the convex server, however I still get the no default world error and not much happening when clicking on the interact button. Any help is appreciated.

Oh, I also moved the local convex server binary into the source root, looks like the gitignore even expects that. I was hoping for a miracle.

ianmacartney commented 3 days ago

There’s a seed script that creates a world. It’s probably called “predev” in package scripts and is probably something like just convex run init

On Tue, Oct 22, 2024 at 9:02 PM Csaba Toth @.***> wrote:

In the .env file the VITE was pointing to the convex cloud. I modified that to point to my local convex server URL. Now it seems that the ai town backend kinda-sorta sees the convex server, however I still get the no default world error and not much happening when clicking on the interact button. Any help is appreciated.

Oh, I also moved the local convex server binary into the source root, looks like the gitignore even expects that. I was hoping for a miracle.

— Reply to this email directly, view it on GitHub https://github.com/a16z-infra/ai-town/issues/256#issuecomment-2430831969, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACZQWZN5E6KYNWHMDKF4STZ44NWPAVCNFSM6AAAAABQNX6S6GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMZQHAZTCOJWHE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

MrCsabaToth commented 3 days ago

There’s a seed script that creates a world. It’s probably called “predev” in package scripts and is probably something like just convex run init

So that should scaffold all the objects? I saw it in the package.json, theoretically it should be called, but I'll check it!

MrCsabaToth commented 2 days ago

While trying to execute npm run predev I got

No CONVEX_DEPLOYMENT set, run npx convex dev to configure a Convex project

So that's something to start with.

Another question is when I start the convex backend server binary, I see that it listens on 3210 port, but it also starts a proxy right away on the 3211 port. When I configure the VITE_CONVEX_URL in .env.local should I point to the 3210, or the proxy 3211 port, or ... I shouldn't fiddle with that file at all?

MrCsabaToth commented 2 days ago

Well, I ran npx convex dev, and since I know I already have the empty project in the convex cloud I selected "existing project" and picked that one. This modified the .env.local, adding back:

# Deployment used by `npx convex dev`
CONVEX_DEPLOYMENT=dev:blabla-foobar-123 # team: csaba-toth, project: ai-town-123456

matching my online convex dev project. What I don't understand is where do we inidicate anywhere at all that we have that local convex server? The cloud project only knows about the local ollama via an environment variable. I feel like the AI Town backend should communicate with that local convex server, but it actually doesn't? If I simply stop the local convex server in the 2nd terminal and start the AI Town server in the 3rd terminal, it sitll indicates everything is honky and dory (10:17:50 Convex functions ready! (2.65s)). I expected it to fail since the local convex server is not running. Some configuration step is missing for sure.

Should I indicate in another unkown environment variable for the convex project that I have that local convex server? BTW the convex cloud project is still bare ass empty (even after re-executing the just convex dev --run init --until-success).

ianmacartney commented 2 days ago

Ah npx goes straight to cloud dev. This repo uses just convex to talk to local/dev based on setup. 3120 is right. 3211 is for http endpoints

On Wed, Oct 23, 2024 at 9:37 AM Csaba Toth @.***> wrote:

While trying to execute npm run predev I got

No CONVEX_DEPLOYMENT set, run npx convex dev to configure a Convex project

So that's something to start with.

Another question is when I start the convex backend server binary, I see that it listens on 3210 port, but it also starts a proxy right away on the 3211 port. When I configure the VITE_CONVEX_URL in .env.local should I point to the 3210, or the proxy 3211 port, or ... I shouldn't fiddle with that file at all?

— Reply to this email directly, view it on GitHub https://github.com/a16z-infra/ai-town/issues/256#issuecomment-2432815506, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACZQW6UVY2K4GPTTOOYXI3Z47GDBAVCNFSM6AAAAABQNX6S6GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMZSHAYTKNJQGY . You are receiving this because you commented.Message ID: @.***>

MrCsabaToth commented 2 days ago

Ah npx goes straight to cloud dev. This repo uses just convex to talk to local/dev based on setup. 3120 is right. 3211 is for http endpoints

Thanks for the fast reply. I'm definitely mixing up stuff then. Wherever I see npx I should just use just convex. Three questions then:

  1. Does the convex cloud project play any role during a local setup?
  2. Related to the first: should that project ID or cloud URL appear anywhere in the config files?
  3. What should be the approximate shape of the value of VITE_CONVEX_URL and CONVEX_DEPLOYMENT in the .env.local file?
ianmacartney commented 2 days ago

I'd check out the README and files. you might also check out the convex tour / a simple repo example to see the cloud version working. For local the CONVEX_URL should be something on localhost or 127.0.0.1. If it's set to the cloud and you want to run locally you can clear the values and run the dev command again and it'll re-configure.

On Wed, Oct 23, 2024 at 10:36 AM Csaba Toth @.***> wrote:

Ah npx goes straight to cloud dev. This repo uses just convex to talk to local/dev based on setup. 3120 is right. 3211 is for http endpoints

Thanks for the fast reply. I'm definitely mixing up stuff then. Wherever I see npx I should just use just convex. Three questions then:

  1. Does the convex cloud project plays any role during a local setup?
  2. Related to the first: should that project ID or cloud URL appear anywhere in the config files?
  3. What should be the approximate shape of the value of VITE_CONVEX_URL and CONVEX_DEPLOYMENT in the .env.local file?

— Reply to this email directly, view it on GitHub https://github.com/a16z-infra/ai-town/issues/256#issuecomment-2432965125, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACZQW4NTJ3CDWQIWBZDR2DZ47NAXAVCNFSM6AAAAABQNX6S6GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMZSHE3DKMJSGU . You are receiving this because you commented.Message ID: @.***>