screenshot-to-code icon indicating copy to clipboard operation
screenshot-to-code copied to clipboard

RUN ERROR OF MAC OS ?????

Open pullghjunkkk opened this issue 1 year ago • 28 comments

VITE v4.5.0 ready in 1254 ms

➜ Local: http://localhost:5173/ 14:06:21 ➜ Network: use --host to expose 14:06:21 ➜ press h to show help 14:06:21

ERROR 14:06:25 [TypeScript] Found 0 errors. Watching for file changes.

pullghjunkkk avatar Dec 02 '23 06:12 pullghjunkkk

That error message is harmless afaik. Is everything working for you?

abi avatar Dec 02 '23 06:12 abi

WhatsApp Image 2023-12-02 at 2 45 16 PM (1) WhatsApp Image 2023-12-02 at 2 45 16 PM (1)

pullghjunkkk avatar Dec 02 '23 06:12 pullghjunkkk

Can you share your backend logs?

abi avatar Dec 02 '23 13:12 abi

paulchikkkk@PauldeMBP backend % poetry shell Spawning shell within /Users/paulchikkkk/Library/Caches/pypoetry/virtualenvs/backend-3vX3etNk-py3.11 paulchikkkk@PauldeMBP backend % emulate bash -c '. /Users/paulchikkkk/Library/Caches/pypoetry/virtualenvs/backend-3vX3etNk-py3.11/bin/activate' (backend-py3.11) paulchikkkk@PauldeMBP backend % (backend-py3.11) paulchikkkk@PauldeMBP backend % poetry run uvicorn main:app --reload --port 7000 INFO: Will watch for changes in these directories: ['/Users/paulchikkkk/screenshot-to-code/backend'] INFO: Uvicorn running on http://127.0.0.1:7000 (Press CTRL+C to quit) INFO: Started reloader process [48803] using StatReload INFO: Started server process [48812] INFO: Waiting for application startup. INFO: Application startup complete.

pullghjunkkk avatar Dec 02 '23 13:12 pullghjunkkk

paulchikkkk@PauldeMBP ~ % cd screenshot-to-code paulchikkkk@PauldeMBP screenshot-to-code % cd backend paulchikkkk@PauldeMBP backend % pip install poetry DEPRECATION: Loading egg at /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/wifi_password-1.1.1-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330 DEPRECATION: Loading egg at /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/Afuzz-0.1.12-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330 Requirement already satisfied: poetry in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (1.6.1) Requirement already satisfied: build<0.11.0,>=0.10.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from poetry) (0.10.0) Requirement already satisfied: cachecontrol<0.14.0,>=0.13.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from cachecontrol[filecache]<0.14.0,>=0.13.0->poetry) (0.13.1) Requirement already satisfied: cleo<3.0.0,>=2.0.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from poetry) (2.0.1) Requirement already satisfied: crashtest<0.5.0,>=0.4.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from poetry) (0.4.1) Requirement already satisfied: dulwich<0.22.0,>=0.21.2 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from poetry) (0.21.6) Requirement already satisfied: installer<0.8.0,>=0.7.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from poetry) (0.7.0) Requirement already satisfied: jsonschema<4.18.0,>=4.10.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from poetry) (4.17.3) Requirement already satisfied: keyring<25.0.0,>=24.0.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from poetry) (24.2.0) Requirement already satisfied: packaging>=20.4 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from poetry) (23.2) Requirement already satisfied: pexpect<5.0.0,>=4.7.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from poetry) (4.8.0) Requirement already satisfied: pkginfo<2.0.0,>=1.9.4 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from poetry) (1.9.6) Requirement already satisfied: platformdirs<4.0.0,>=3.0.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from poetry) (3.10.0) Requirement already satisfied: poetry-core==1.7.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from poetry) (1.7.0) Requirement already satisfied: poetry-plugin-export<2.0.0,>=1.5.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from poetry) (1.5.0) Requirement already satisfied: pyproject-hooks<2.0.0,>=1.0.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from poetry) (1.0.0) Requirement already satisfied: requests<3.0,>=2.26 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from poetry) (2.31.0) Requirement already satisfied: requests-toolbelt<2,>=0.9.1 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from poetry) (1.0.0) Requirement already satisfied: shellingham<2.0,>=1.5 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from poetry) (1.5.3) Requirement already satisfied: tomlkit<1.0.0,>=0.11.4 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from poetry) (0.12.1) Requirement already satisfied: trove-classifiers>=2022.5.19 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from poetry) (2023.8.7) Requirement already satisfied: virtualenv<21.0.0,>=20.22.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from poetry) (20.24.5) Requirement already satisfied: xattr<0.11.0,>=0.10.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from poetry) (0.10.1) Requirement already satisfied: msgpack>=0.5.2 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from cachecontrol<0.14.0,>=0.13.0->cachecontrol[filecache]<0.14.0,>=0.13.0->poetry) (1.0.5) Requirement already satisfied: filelock>=3.8.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from cachecontrol[filecache]<0.14.0,>=0.13.0->poetry) (3.12.3) Requirement already satisfied: rapidfuzz<3.0.0,>=2.2.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from cleo<3.0.0,>=2.0.0->poetry) (2.15.1) Requirement already satisfied: urllib3>=1.25 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from dulwich<0.22.0,>=0.21.2->poetry) (2.1.0) Requirement already satisfied: attrs>=17.4.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jsonschema<4.18.0,>=4.10.0->poetry) (23.1.0) Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jsonschema<4.18.0,>=4.10.0->poetry) (0.19.3) Requirement already satisfied: jaraco.classes in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from keyring<25.0.0,>=24.0.0->poetry) (3.3.0) Requirement already satisfied: importlib-metadata>=4.11.4 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from keyring<25.0.0,>=24.0.0->poetry) (6.8.0) Requirement already satisfied: ptyprocess>=0.5 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from pexpect<5.0.0,>=4.7.0->poetry) (0.7.0) Requirement already satisfied: charset-normalizer<4,>=2 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from requests<3.0,>=2.26->poetry) (3.2.0) Requirement already satisfied: idna<4,>=2.5 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from requests<3.0,>=2.26->poetry) (2.8) Requirement already satisfied: certifi>=2017.4.17 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from requests<3.0,>=2.26->poetry) (2023.7.22) Requirement already satisfied: distlib<1,>=0.3.7 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from virtualenv<21.0.0,>=20.22.0->poetry) (0.3.7) Requirement already satisfied: cffi>=1.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from xattr<0.11.0,>=0.10.0->poetry) (1.15.1) Requirement already satisfied: pycparser in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from cffi>=1.0->xattr<0.11.0,>=0.10.0->poetry) (2.21) Requirement already satisfied: zipp>=0.5 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from importlib-metadata>=4.11.4->keyring<25.0.0,>=24.0.0->poetry) (3.16.2) Requirement already satisfied: more-itertools in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from jaraco.classes->keyring<25.0.0,>=24.0.0->poetry) (10.1.0) paulchikkkk@PauldeMBP backend % poetry install Installing dependencies from lock file

No dependencies to install or update paulchikkkk@PauldeMBP backend % poetry shell Spawning shell within /Users/paulchikkkk/Library/Caches/pypoetry/virtualenvs/backend-3vX3etNk-py3.11 paulchikkkk@PauldeMBP backend % emulate bash -c '. /Users/paulchikkkk/Library/Caches/pypoetry/virtualenvs/backend-3vX3etNk-py3.11/bin/activate' (backend-py3.11) paulchikkkk@PauldeMBP backend % poetry run uvicorn main:app --reload --port 7000 INFO: Will watch for changes in these directories: ['/Users/paulchikkkk/screenshot-to-code/backend'] INFO: Uvicorn running on http://127.0.0.1:7000 (Press CTRL+C to quit) INFO: Started reloader process [48803] using StatReload INFO: Started server process [48812] INFO: Waiting for application startup. INFO: Application startup complete.

pullghjunkkk avatar Dec 02 '23 13:12 pullghjunkkk

My guess is your front end is not able to connect to your backend at all. Are the two running on the same local machine? If so, might help to tweak the ip in .env in front end so the front end can find the backend.

abi avatar Dec 02 '23 15:12 abi

I run same local machine

pullghjunkkk avatar Dec 02 '23 15:12 pullghjunkkk

When you go to the backend url in the browser, what do you see?

abi avatar Dec 02 '23 15:12 abi

{"detail":"Not Found"}

pullghjunkkk avatar Dec 02 '23 15:12 pullghjunkkk

I am also encountering the same error; the backend error log is as follows: INFO: ('127.0.0.1', 60213) - "WebSocket /generate-code" [accepted] Incoming websocket connection... INFO: connection open Received params Generating html_tailwind code Using OpenAI API key from client-side settings dialog Using official OpenAI URL generating code... ERROR: Exception in ASGI application Traceback (most recent call last): File "/Users/cay/Library/Caches/pypoetry/virtualenvs/backend-dQP4fn41-py3.11/lib/python3.11/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 247, in run_asgi result = await self.app(self.scope, self.asgi_receive, self.asgi_send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/cay/Library/Caches/pypoetry/virtualenvs/backend-dQP4fn41-py3.11/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/cay/Library/Caches/pypoetry/virtualenvs/backend-dQP4fn41-py3.11/lib/python3.11/site-packages/fastapi/applications.py", line 276, in call await super().call(scope, receive, send) File "/Users/cay/Library/Caches/pypoetry/virtualenvs/backend-dQP4fn41-py3.11/lib/python3.11/site-packages/starlette/applications.py", line 122, in call await self.middleware_stack(scope, receive, send) File "/Users/cay/Library/Caches/pypoetry/virtualenvs/backend-dQP4fn41-py3.11/lib/python3.11/site-packages/starlette/middleware/errors.py", line 149, in call await self.app(scope, receive, send) File "/Users/cay/Library/Caches/pypoetry/virtualenvs/backend-dQP4fn41-py3.11/lib/python3.11/site-packages/starlette/middleware/cors.py", line 75, in call await self.app(scope, receive, send) File "/Users/cay/Library/Caches/pypoetry/virtualenvs/backend-dQP4fn41-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 79, in call raise exc File "/Users/cay/Library/Caches/pypoetry/virtualenvs/backend-dQP4fn41-py3.11/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 68, in call await self.app(scope, receive, sender) File "/Users/cay/Library/Caches/pypoetry/virtualenvs/backend-dQP4fn41-py3.11/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in call raise e File "/Users/cay/Library/Caches/pypoetry/virtualenvs/backend-dQP4fn41-py3.11/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in call await self.app(scope, receive, send) File "/Users/cay/Library/Caches/pypoetry/virtualenvs/backend-dQP4fn41-py3.11/lib/python3.11/site-packages/starlette/routing.py", line 718, in call await route.handle(scope, receive, send) File "/Users/cay/Library/Caches/pypoetry/virtualenvs/backend-dQP4fn41-py3.11/lib/python3.11/site-packages/starlette/routing.py", line 341, in handle await self.app(scope, receive, send) File "/Users/cay/Library/Caches/pypoetry/virtualenvs/backend-dQP4fn41-py3.11/lib/python3.11/site-packages/starlette/routing.py", line 82, in app await func(session) File "/Users/cay/Library/Caches/pypoetry/virtualenvs/backend-dQP4fn41-py3.11/lib/python3.11/site-packages/fastapi/routing.py", line 289, in app await dependant.call(**values) File "/Users/cay/Downloads/screenshot-to-code-main/backend/main.py", line 174, in stream_code completion = await stream_openai_response( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/cay/Downloads/screenshot-to-code-main/backend/llm.py", line 26, in stream_openai_response completion = await client.chat.completions.create(**params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/cay/Library/Caches/pypoetry/virtualenvs/backend-dQP4fn41-py3.11/lib/python3.11/site-packages/openai/resources/chat/completions.py", line 1191, in create return await self._post( ^^^^^^^^^^^^^^^^^ File "/Users/cay/Library/Caches/pypoetry/virtualenvs/backend-dQP4fn41-py3.11/lib/python3.11/site-packages/openai/_base_client.py", line 1474, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/cay/Library/Caches/pypoetry/virtualenvs/backend-dQP4fn41-py3.11/lib/python3.11/site-packages/openai/_base_client.py", line 1275, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ File "/Users/cay/Library/Caches/pypoetry/virtualenvs/backend-dQP4fn41-py3.11/lib/python3.11/site-packages/openai/_base_client.py", line 1318, in _request raise self._make_status_error_from_response(err.response) from None openai.NotFoundError: Error code: 404 - {'error': {'message': 'The model gpt-4-vision-preview does not exist or you do not have access to it. Learn more: https://help.openai.com/en/articles/7102672-how-can-i-access-gpt-4.', 'type': 'invalid_request_error', 'param': None, 'code': 'model_not_found'}} INFO: connection closed

Cay-chen avatar Dec 02 '23 15:12 Cay-chen

@Cay-chen your issue is different. You don't have access to gpt 4 vision. Please follow the instructions https://github.com/abi/screenshot-to-code/blob/main/Troubleshooting.md

abi avatar Dec 02 '23 15:12 abi

WhatsApp Image 2023-12-02 at 11 27 46 PM

pullghjunkkk avatar Dec 02 '23 15:12 pullghjunkkk

@pullghjunkkk take that url and configure .env in Frontend correctly. It should match what the browser console logs show.

abi avatar Dec 02 '23 15:12 abi

(backend-py3.11) paulchikkkk@PauldeMBP backend % poetry run uvicorn main:app --reload --port 7000 INFO: Will watch for changes in these directories: ['/Users/paulchikkkk/screenshot-to-code/backend'] INFO: Uvicorn running on http://127.0.0.1:7000 (Press CTRL+C to quit) INFO: Started reloader process [50718] using StatReload INFO: Started server process [50722] INFO: Waiting for application startup. INFO: Application startup complete. INFO: 127.0.0.1:62170 - "GET / HTTP/1.1" 404 Not Found

pullghjunkkk avatar Dec 02 '23 15:12 pullghjunkkk

paulchikkkk@PauldeMBP ~ % cd screenshot-to-code paulchikkkk@PauldeMBP screenshot-to-code % cd frontend yarn yarn dev yarn install v1.22.21 warning ../../package.json: No license field [1/5] 🔍 Validating package.json... [2/5] 🔍 Resolving packages... success Already up-to-date. ✨ Done in 0.29s. yarn run v1.22.21 warning ../../package.json: No license field $ vite 23:33:38 VITE v4.5.0 ready in 1215 ms

➜ Local: http://localhost:5173/ 23:33:38 ➜ Network: use --host to expose 23:33:38 ➜ press h to show help 23:33:38

ERROR 23:33:42 [TypeScript] Found 0 errors. Watching for file changes.

pullghjunkkk avatar Dec 02 '23 15:12 pullghjunkkk

@Cay-chenyour issue is different. You don't have access to gpt 4 vision. Please follow the instructions https://github.com/abi/screenshot-to-code/blob/main/Troubleshooting.md The issue has been resolved, thank you very much!

Cay-chen avatar Dec 03 '23 02:12 Cay-chen

(backend-py3.11) paulchikkkk@PauldeMBP backend % poetry run uvicorn main:app --reload --port 7000 INFO: Will watch for changes in these directories: ['/Users/paulchikkkk/screenshot-to-code/backend'] INFO: Uvicorn running on http://127.0.0.1:7000 (Press CTRL+C to quit) INFO: Started reloader process [50718] using StatReload INFO: Started server process [50722] INFO: Waiting for application startup. INFO: Application startup complete. INFO: 127.0.0.1:62170 - "GET / HTTP/1.1" 404 Not Found

You can fix that following @abi suggestion. Inside the frontend there is a file called .env.example. Duplicate it and rename to .env only. Should work.

jacquesmats avatar Dec 03 '23 13:12 jacquesmats

same issue here, the .env file would only take ws or wss url. the backend log shows http://127.0.0.1:7000/ url, what's the fix here or what should put inside .env file?

victor2005 avatar Dec 04 '23 01:12 victor2005

it needs just a WS URL: VITE_WS_BACKEND_URL=ws://your address

abi avatar Dec 04 '23 03:12 abi

When you go to the backend url in the browser, what do you see?

Your backend is running correctly. Please open the front-end URL (default is http://localhost:5173) to use screenshot-to-code.

hesoso avatar Dec 06 '23 07:12 hesoso

@hesoso can you open a ticket and share what's happening plus your logs? Hard to debug if everyone just adds to an existing ticket with different root causes

abi avatar Dec 06 '23 17:12 abi

Installing the current project: backend (0.1.0) Virtual environment already activated: /Users/mac/Library/Caches/pypoetry/virtualenvs/backend-3ENtCk2A-py3.10 INFO: Will watch for changes in these directories: ['/Users/mac/IdeaProjects/screenshot-to-code/backend'] INFO: Uvicorn running on http://127.0.0.1:7001 (Press CTRL+C to quit) INFO: Started reloader process [52876] using StatReload ERROR: Error loading ASGI app. Could not import module "main".

same issue

Drew19980118 avatar Dec 10 '23 15:12 Drew19980118

Uploading image.png…

Drew19980118 avatar Dec 10 '23 15:12 Drew19980118

cd frontend yarn yarn dev (base) mac@DREW-vGsG-2 screenshot-to-code % cd frontend (base) mac@DREW-vGsG-2 frontend % yarn yarn dev yarn install v1.22.21 [1/5] 🔍 Validating package.json... [2/5] 🔍 Resolving packages... success Already up-to-date. ✨ Done in 0.23s. (base) mac@DREW-vGsG-2 frontend % yarn dev yarn run v1.22.21 $ vite 23:51:28 VITE v4.5.0 ready in 807 ms

➜ Local: http://localhost:5173/ 23:51:28 ➜ Network: use --host to expose 23:51:28 ➜ press h to show help 23:51:28

ERROR 23:51:31 [TypeScript] Found 0 errors. Watching for file changes.

Drew19980118 avatar Dec 10 '23 15:12 Drew19980118

how to fix it?

Drew19980118 avatar Dec 10 '23 15:12 Drew19980118

Uploading image.png…

Drew19980118 avatar Dec 10 '23 16:12 Drew19980118

@Drew19980118 try https://github.com/abi/screenshot-to-code/issues/3#issuecomment-1814777959

abi avatar Dec 10 '23 22:12 abi

I'm a mac os. When I initilize backend service, the log is 'ERROR: Error loading ASGI app. Could not import module "main"'. How to fix? Uploading error.png…

Drew19980118 avatar Dec 11 '23 01:12 Drew19980118

How can I fix these errors to run the project correctly?

Here are the logs ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\openai_base_client.py", line 1470, in _request response = await self._client.send( ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\httpx_client.py", line 1617, in send response = await self._send_handling_auth( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\httpx_client.py", line 1645, in _send_handling_auth response = await self._send_handling_redirects( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\httpx_client.py", line 1682, in _send_handling_redirects response = await self._send_single_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\httpx_client.py", line 1719, in _send_single_request response = await transport.handle_async_request(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\httpx_transports\default.py", line 366, in handle_async_request resp = await self._pool.handle_async_request(req) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\httpcore_async\connection_pool.py", line 216, in handle_async_request raise exc from None File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\httpcore_async\connection_pool.py", line 196, in handle_async_request response = await connection.handle_async_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\httpcore_async\http_proxy.py", line 317, in handle_async_request stream = await stream.start_tls(**kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\httpcore_async\http11.py", line 383, in start_tls return await self._stream.start_tls(ssl_context, server_hostname, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\httpcore_backends\anyio.py", line 78, in start_tls raise exc File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\httpcore_backends\anyio.py", line 69, in start_tls ssl_stream = await anyio.streams.tls.TLSStream.wrap( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\anyio\streams\tls.py", line 132, in wrap await wrapper._call_sslobject_method(ssl_object.do_handshake) File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\anyio\streams\tls.py", line 172, in _call_sslobject_method raise EndOfStream from None anyio.EndOfStream

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\uvicorn\protocols\websockets\websockets_impl.py", line 250, in run_asgi result = await self.app(self.scope, self.asgi_receive, self.asgi_send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\fastapi\applications.py", line 276, in call await super().call(scope, receive, send) File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\starlette\applications.py", line 122, in call await self.middleware_stack(scope, receive, send) File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\starlette\middleware\errors.py", line 149, in call await self.app(scope, receive, send) File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\starlette\middleware\cors.py", line 75, in call await self.app(scope, receive, send) File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\starlette\middleware\exceptions.py", line 79, in call raise exc File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\starlette\middleware\exceptions.py", line 68, in call await self.app(scope, receive, sender) File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in call raise e File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in call await self.app(scope, receive, send) File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\starlette\routing.py", line 718, in call await route.handle(scope, receive, send) File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\starlette\routing.py", line 341, in handle await self.app(scope, receive, send) File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\starlette\routing.py", line 82, in app await func(session) File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\fastapi\routing.py", line 289, in app await dependant.call(**values) File "C:\Users\20240\Downloads\screenshot-to-code-main\screenshot-to-code-main\backend\routes\generate_code.py", line 260, in stream_code completion = await stream_openai_response( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\20240\Downloads\screenshot-to-code-main\screenshot-to-code-main\backend\llm.py", line 50, in stream_openai_response stream = await client.chat.completions.create(**params) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\openai\resources\chat\completions.py", line 1334, in create return await self._post( ^^^^^^^^^^^^^^^^^ File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\openai_base_client.py", line 1738, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\openai_base_client.py", line 1441, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\openai_base_client.py", line 1494, in _request return await self._retry_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\openai_base_client.py", line 1563, in _retry_request return await self._request( ^^^^^^^^^^^^^^^^^^^^ File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\openai_base_client.py", line 1494, in _request return await self._retry_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\openai_base_client.py", line 1563, in _retry_request return await self._request( ^^^^^^^^^^^^^^^^^^^^ File "C:\Users\20240\AppData\Local\pypoetry\Cache\virtualenvs\backend-9bZ-na9W-py3.12\Lib\site-packages\openai_base_client.py", line 1504, in _request raise APIConnectionError(request=request) from err openai.APIConnectionError: Connection error. INFO: connection closed

QWQ-QWQ-QWQ avatar Mar 23 '24 13:03 QWQ-QWQ-QWQ

You probably have an issue connecting to OpenAI. Maybe try a proxy or vpn.

Closing issue since it's old.

abi avatar Mar 24 '24 01:03 abi