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.72k stars 713 forks source link

Uncaught Error: error sending request for url #249

Open knightmarehs opened 3 months ago

knightmarehs commented 3 months ago

The agents can't generate conversations, the traceback is as follows:

8/12/2024, 5:33:59 PM [CONVEX A(aiTown/agentOperations:agentGenerateMessage)] Uncaught Error: error sending request for url (http://127.0.0.1:11434/api/embeddings): error trying to connect: tcp connect error: Connection refused (os error 61)

ianmacartney commented 3 months ago

check that you have something running on http://127.0.0.1:11434/api/embeddings - e.g. ollama - and that it's accessible from where you're running the backend

On Mon, Aug 12, 2024 at 6:44 AM knightmarehs @.***> wrote:

The agents can't generate conversations, the traceback is as follows:

8/12/2024, 5:33:59 PM [CONVEX A(aiTown/agentOperations:agentGenerateMessage)] Uncaught Error: error sending request for url (http://127.0.0.1:11434/api/embeddings): error trying to connect: tcp connect error: Connection refused (os error 61)

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

uannyao commented 1 month ago

Hi there, I'm facing a similar issue, the agents can't generate conversations, but in the traceback, it's saying the request was forbidden:

9/29/2024, 2:53:34 PM [CONVEX A(aiTown/agentOperations:agentGenerateMessage)] Uncaught Error: Request to http://localhost:11434/api/embeddings forbidden

likeUMR commented 1 month ago

I have the same problem too!!!

Uncaught Error: Request to http://127.0.0.1:11434/api/embeddings forbidden

When i change the embeddings to embed(base on a post about the ollama new api doc, so it is http://127.0.0.1:11434/api/embed) the problem still exist!

I have tested the api in terminal and it seems correctly working! (curl -X POST http://127.0.0.1:11434/api/embed \:11434/api/embed \ -H "Content-Type: application/json" \ -d '{"model":"mxbai-embed-large","input":"Stella is talking to Lucky"}')

I don't know how to set the convex to fix that problem?

quanchentg commented 1 month ago

@likeUMR did you resolve this issue or figure something out? Thanks.

quanchentg commented 1 month ago

@ianmacartney is there any clue for this issue? Thanks.

ianmacartney commented 1 month ago

Sorry I haven't seen this issue before. I suggest dropping in logs, reproducing simple requests, verifying some assumptions (is ai-town running on your machine or in the cloud environment? is it running in a container? is ollama running somewhere accessible? You might also try 127.0.0.1 instead of localhost since some Windows users have seen odd behavior there. Best of luck with the debugging

On Sat, Oct 19, 2024 at 10:34 PM quanchentg @.***> wrote:

@ianmacartney https://github.com/ianmacartney is there any clue for this issue? Thanks.

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

leol15 commented 1 month ago

For me this happened when the frontend is pointing to Convex backend managed by Convex in the cloud (dashboard.convex.dev).

Check your .env.local file and make sure VITE_CONVEX_URL=http://127.0.0.1:3210 is there. If not you can re-generate it with npm run dev:backend after clearing the contents of .env.local.

Then you might need to restart the frontend app - npm run dev:frontend to pick up the change.

quanchentg commented 4 weeks ago

@leol15 Thanks for your nice suggestions. Let me give it a try!

Tsailj commented 3 days ago

@leol15 您好,想问您是使用本地的convex后端,不使用云端的convex就能成功跟Ollama通信是吗,我现在遇到的问题就是跟Ollama的连接被拒绝,我现在的convex使用的是云端的dashboard.convex.dev,.env.local也是设置的云端的没有用http://127.0.0.1:3210,您是使用http://127.0.0.1:3210就能避免通信被拒这个问题是吗

Tsailj commented 3 days ago

Uncaught Error: Request to http://127.0.0.1:11434/api/embeddings forbidden

When i change the embeddings to embed(base on a post about the ollama new api doc, so it is http://127.0.0.1:11434/api/embed) the problem still exist!

Hello, I’m facing the same issue as you. I also changed ‘embedding’ to ‘embed’, but I’m still getting an error(Uncaught Error: Request to http://localhost:11434/api/embed forbidden ). Have you found a solution? Thank you.

leol15 commented 2 days ago

@Tsailj Yes, local backend worked for me. This is the relevant command to start the backend https://github.com/a16z-infra/ai-town/blob/main/Justfile#L31

I'm unsure how the cloud backend was able to communicate with Ollama running locally, appreciate if others could explain!