Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generateCode.ts:23 WebSocket connection to 'ws://127.0.0.1:7001/generate-code' failed: #298

Open
DaihuaWei opened this issue Apr 8, 2024 · 11 comments

Comments

@DaihuaWei
Copy link

1、Already configurate the VITE_WS_BACKEND_URL:
image
2、curl http://192.168.1.52:7001 is OK, like this:Your backend is running correctly. Please open the front-end URL (default is http://localhost:5173) to use screenshot-to-code.
3、http://192.168.1.52:5173/,
image
4、when I upload one video or image,the process interface is 127.0.0.1:7001,like this:
image
5、I don't know what's wrong? hope your help

@abi
Copy link
Owner

abi commented Apr 8, 2024

Hi, thanks for the clear walkthrough of your steps. All you need to do is update the frontend .env. See https://github.com/abi/screenshot-to-code?tab=readme-ov-file#%EF%B8%8F-faqs "How can I update the backend host that my front-end connects to?"

@abi
Copy link
Owner

abi commented Apr 8, 2024

Please close the ticket once you confirm that it works for you.

@DaihuaWei
Copy link
Author

Hi, thanks for the clear walkthrough of your steps. All you need to do is update the frontend .env. See https://github.com/abi/screenshot-to-code?tab=readme-ov-file#%EF%B8%8F-faqs "How can I update the backend host that my front-end connects to?"

According to your guidance, I do like this:
1、In front docker container, change the VITE_WS_BACKEND_URL=ws://192.168.1.152:7001 to VITE_HTTP_BACKEND_URL=http://192.168.1.52:7001
2、then restart the front and backend container
3、But the result is same as bellow, like this:
image

I missing something or doing something wrong, hope your help, thank you

@DaihuaWei
Copy link
Author

I found in the front , no .env.local file
image

only can configurate the .env.example
image

according the guidance , Do I need to create this file .env.local

@abi
Copy link
Owner

abi commented Apr 9, 2024

Yes, you have to create it.

Alternatively you can update directly in code here:

export const WS_BACKEND_URL =

@abi
Copy link
Owner

abi commented Apr 9, 2024

Let me know if that solves your problem!

@DaihuaWei
Copy link
Author

The address is ok,but use OPENAI_API_KEY cann't process the video ,prompt me configurate the ANTHROPIC_API_KEY,like this:
image

@DaihuaWei
Copy link
Author

when I upload one photo .png,seems ok,but An error was reported after a while, like this:
image

@abi
Copy link
Owner

abi commented Apr 11, 2024

Yes, for videos, you need a ANTHROPIC_API_KEY that you'll add to backend/.env

When you upload a PNG like that, what do the backend logs look like?

@DaihuaWei
Copy link
Author

When upload PNG, The backend logs like this:
image
image

@abi
Copy link
Owner

abi commented Apr 12, 2024

@DaihuaWei You're not able to connect to the OpenAI API. Is OpenAI banned in your country? Please see FAQs "How can I configure an OpenAI proxy?" https://github.com/abi/screenshot-to-code?tab=readme-ov-file#%EF%B8%8F-faqs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants