abi / screenshot-to-code

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Home Page:https://screenshottocode.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cant generate code

fluixcodm opened this issue · comments

Error generating code. Check the Developer Console AND the backend logs for details. Feel free to open a Github issue.

Need your backend logs.

That's your front end logs.

I have the same question.My backend log like this(蹩脚英语) :

Generating html_tailwind code for uploaded image using Llm.GPT_4O_2024_05_13 model...
Using OpenAI API key from client-side settings dialog
Using OpenAI Base URL from client-side settings dialog
generating code...
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\httpx\_transports\default.py", line 66, in map_httpcore_exceptions
    yield
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\httpx\_transports\default.py", line 366, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\httpcore\_async\connection_pool.py", line 216, in handle_async_request
    raise exc from None
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\httpcore\_async\connection_pool.py", line 196, in handle_async_request
    response = await connection.handle_async_request(
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\httpcore\_async\http_proxy.py", line 289, in handle_async_request
    connect_response = await self._connection.handle_async_request(
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\httpcore\_async\connection.py", line 99, in handle_async_request
    raise exc
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\httpcore\_async\connection.py", line 76, in handle_async_request
    stream = await self._connect(request)
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\httpcore\_async\connection.py", line 154, in _connect
    stream = await stream.start_tls(**kwargs)
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\httpcore\_backends\anyio.py", line 66, in start_tls
    with map_exceptions(exc_map):
  File "C:\Users\lxc\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\httpcore\_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.ConnectError

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

Traceback (most recent call last):
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\openai\_base_client.py", line 1470, in _request
    response = await self._client.send(
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\httpx\_client.py", line 1617, in send
    response = await self._send_handling_auth(
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\httpx\_client.py", line 1645, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\httpx\_client.py", line 1682, in _send_handling_redirects
    response = await self._send_single_request(request)
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\httpx\_client.py", line 1719, in _send_single_request
    response = await transport.handle_async_request(request)
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\httpx\_transports\default.py", line 365, in handle_async_request
    with map_httpcore_exceptions():
  File "C:\Users\lxc\AppData\Local\Programs\Python\Python310\lib\contextlib.py", line 153, in __exit__
    self.gen.throw(typ, value, traceback)
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\httpx\_transports\default.py", line 83, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectError

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

Traceback (most recent call last):
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\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\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in __call__
    return await self.app(scope, receive, send)
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\fastapi\applications.py", line 276, in __call__
    await super().__call__(scope, receive, send)
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\starlette\applications.py", line 122, in __call__
    await self.middleware_stack(scope, receive, send)
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\starlette\middleware\errors.py", line 149, in __call__
    await self.app(scope, receive, send)
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\starlette\middleware\cors.py", line 75, in __call__
    await self.app(scope, receive, send)
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\starlette\middleware\exceptions.py", line 79, in __call__
    raise exc
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\starlette\middleware\exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in __call__
    raise e
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\starlette\routing.py", line 718, in __call__
    await route.handle(scope, receive, send)
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\starlette\routing.py", line 341, in handle
    await self.app(scope, receive, send)
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\starlette\routing.py", line 82, in app
    await func(session)
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\fastapi\routing.py", line 289, in app
    await dependant.call(**values)
  File "D:\github-app\screenshot-to-code\backend\routes\generate_code.py", line 251, in stream_code
    completion = await stream_openai_response(
  File "D:\github-app\screenshot-to-code\backend\backend\llm.py", line 58, in stream_openai_response
    stream = await client.chat.completions.create(**params)  # type: ignore
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\openai\resources\chat\completions.py", line 1334, in create
    return await self._post(
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\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\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\openai\_base_client.py", line 1441, in request
    return await self._request(
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\openai\_base_client.py", line 1494, in _request
    return await self._retry_request(
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\openai\_base_client.py", line 1563, in _retry_request
    return await self._request(
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\openai\_base_client.py", line 1494, in _request
    return await self._retry_request(
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\openai\_base_client.py", line 1563, in _retry_request
    return await self._request(
  File "C:\Users\lxc\AppData\Local\pypoetry\Cache\virtualenvs\backend-Z_nPOWF--py3.10\lib\site-packages\openai\_base_client.py", line 1504, in _request
    raise APIConnectionError(request=request) from err
openai.APIConnectionError: Connection error.
INFO:     connection closed

这是我代理的问题吗?在之前的项目中,我配置的代理可以正常运行。现在我没有对我的代理做修改,但是却爆出了这个错误。

openai.APIConnectionError: Connection error. <- see README for proxy instructions. You're not able to connect to OpenAI

That's your front end logs.

I cant see any backend errors in github.dev, I am hosting it there, or cant i use it there?

I'm not sure if Github.dev can run Python backends?

Closing due to inactivity. Feel free to re-open