abi / abi/screenshot-to-code

Error generating code. Please contact support.

Đang mở
#484 8 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
78.7k
Fork
9.6k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

**Describe the bug**
When I upload the image and run it, the webpage prompts: Error generating code. Please contact support.

ollama can receive this request but prompts 404:

![Image](https://github.com/user-attachments/assets/08f602fd-a884-4076-907f-a8c745294cb2)

I have this setup in gear:

![Image](https://github.com/user-attachments/assets/f392fe1a-c7f7-4a36-9793-80d4a7d14421)

The backend server prompts as follows:

`2025-02-02 21:10:50 INFO: ('172.18.0.1', 48374) - "WebSocket /generate-code" [accepted]
2025-02-02 21:10:50 INFO: connection open
2025-02-02 21:10:52 Traceback (most recent call last):
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 66, in map_httpcore_exceptions
2025-02-02 21:10:52 yield
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 366, in handle_async_request
2025-02-02 21:10:52 resp = await self._pool.handle_async_request(req)
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 256, in handle_async_request
2025-02-02 21:10:52 raise exc from None
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 236, in handle_async_request
2025-02-02 21:10:52 response = await connection.handle_async_request(
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection.py", line 101, in handle_async_request
2025-02-02 21:10:52 raise exc
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection.py", line 78, in handle_async_request
2025-02-02 21:10:52 stream = await self._connect(request)
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection.py", line 124, in _connect
2025-02-02 21:10:52 stream = await self._network_backend.connect_tcp(**kwargs)
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpcore/_backends/auto.py", line 31, in connect_tcp
2025-02-02 21:10:52 return await self._backend.connect_tcp(
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpcore/_backends/anyio.py", line 113, in connect_tcp
2025-02-02 21:10:52 with map_exceptions(exc_map):
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/contextlib.py", line 158, in __exit__
2025-02-02 21:10:52 self.gen.throw(value)
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
2025-02-02 21:10:52 raise to_exc(exc) from exc
2025-02-02 21:10:52 httpcore.ConnectError: All connection attempts failed
2025-02-02 21:10:52
2025-02-02 21:10:52 The above exception was the direct cause of the following exception:
2025-02-02 21:10:52
2025-02-02 21:10:52 Traceback (most recent call last):
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/openai/_base_client.py", line 1576, in _request
2025-02-02 21:10:52 response = await self._client.send(
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1617, in send
2025-02-02 21:10:52 response = await self._send_handling_auth(
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1645, in _send_handling_auth
2025-02-02 21:10:52 response = await self._send_handling_redirects(
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1682, in _send_handling_redirects
2025-02-02 21:10:52 response = await self._send_single_request(request)
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1719, in _send_single_request
2025-02-02 21:10:52 response = await transport.handle_async_request(request)
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 365, in handle_async_request
2025-02-02 21:10:52 with map_httpcore_exceptions():
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/contextlib.py", line 158, in __exit__
2025-02-02 21:10:52 self.gen.throw(value)
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 83, in map_httpcore_exceptions
2025-02-02 21:10:52 raise mapped_exc(message) from exc
2025-02-02 21:10:52 httpx.ConnectError: All connection attempts failed
2025-02-02 21:10:52
2025-02-02 21:10:52 The above exception was the direct cause of the following exception:
2025-02-02 21:10:52
2025-02-02 21:10:52 Traceback (most recent call last):
2025-02-02 21:10:52 File "/app/llm.py", line 76, in stream_openai_response
2025-02-02 21:10:52 stream = await client.chat.completions.create(**params) # type: ignore
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/openai/resources/chat/completions.py", line 1720, in create
2025-02-02 21:10:52 return await self._post(
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/openai/_base_client.py", line 1843, in post
2025-02-02 21:10:52 return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/openai/_base_client.py", line 1537, in request
2025-02-02 21:10:52 return await self._request(
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/openai/_base_client.py", line 1600, in _request
2025-02-02 21:10:52 return await self._retry_request(
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/openai/_base_client.py", line 1670, in _retry_request
2025-02-02 21:10:52 return await self._request(
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/openai/_base_client.py", line 1600, in _request
2025-02-02 21:10:52 return await self._retry_request(
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/openai/_base_client.py", line 1670, in _retry_request
2025-02-02 21:10:52 return await self._request(
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/openai/_base_client.py", line 1610, in _request
2025-02-02 21:10:52 raise APIConnectionError(request=request) from err
2025-02-02 21:10:52 openai.APIConnectionError: Connection error.
2025-02-02 21:10:52 Traceback (most recent call last):
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 66, in map_httpcore_exceptions
2025-02-02 21:10:52 yield
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 366, in handle_async_request
2025-02-02 21:10:52 resp = await self._pool.handle_async_request(req)
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 256, in handle_async_request
2025-02-02 21:10:52 raise exc from None
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 236, in handle_async_request
2025-02-02 21:10:52 response = await connection.handle_async_request(
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection.py", line 101, in handle_async_request
2025-02-02 21:10:52 raise exc
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection.py", line 78, in handle_async_request
2025-02-02 21:10:52 stream = await self._connect(request)
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection.py", line 124, in _connect
2025-02-02 21:10:52 stream = await self._network_backend.connect_tcp(**kwargs)
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpcore/_backends/auto.py", line 31, in connect_tcp
2025-02-02 21:10:52 return await self._backend.connect_tcp(
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpcore/_backends/anyio.py", line 113, in connect_tcp
2025-02-02 21:10:52 with map_exceptions(exc_map):
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/contextlib.py", line 158, in __exit__
2025-02-02 21:10:52 self.gen.throw(value)
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
2025-02-02 21:10:52 raise to_exc(exc) from exc
2025-02-02 21:10:52 httpcore.ConnectError: All connection attempts failed
2025-02-02 21:10:52
2025-02-02 21:10:52 The above exception was the direct cause of the following exception:
2025-02-02 21:10:52
2025-02-02 21:10:52 Traceback (most recent call last):
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/openai/_base_client.py", line 1576, in _request
2025-02-02 21:10:52 response = await self._client.send(
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1617, in send
2025-02-02 21:10:52 response = await self._send_handling_auth(
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1645, in _send_handling_auth
2025-02-02 21:10:52 response = await self._send_handling_redirects(
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1682, in _send_handling_redirects
2025-02-02 21:10:52 response = await self._send_single_request(request)
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1719, in _send_single_request
2025-02-02 21:10:52 response = await transport.handle_async_request(request)
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 365, in handle_async_request
2025-02-02 21:10:52 with map_httpcore_exceptions():
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/contextlib.py", line 158, in __exit__
2025-02-02 21:10:52 self.gen.throw(value)
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 83, in map_httpcore_exceptions
2025-02-02 21:10:52 raise mapped_exc(message) from exc
2025-02-02 21:10:52 httpx.ConnectError: All connection attempts failed
2025-02-02 21:10:52
2025-02-02 21:10:52 The above exception was the direct cause of the following exception:
2025-02-02 21:10:52
2025-02-02 21:10:52 Traceback (most recent call last):
2025-02-02 21:10:52 File "/app/llm.py", line 76, in stream_openai_response
2025-02-02 21:10:52 stream = await client.chat.completions.create(**params) # type: ignore
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/openai/resources/chat/completions.py", line 1720, in create
2025-02-02 21:10:52 return await self._post(
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/openai/_base_client.py", line 1843, in post
2025-02-02 21:10:52 return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/openai/_base_client.py", line 1537, in request
2025-02-02 21:10:52 return await self._request(
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/openai/_base_client.py", line 1600, in _request
2025-02-02 21:10:52 return await self._retry_request(
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/openai/_base_client.py", line 1670, in _retry_request
2025-02-02 21:10:52 return await self._request(
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/openai/_base_client.py", line 1600, in _request
2025-02-02 21:10:52 return await self._retry_request(
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/openai/_base_client.py", line 1670, in _retry_request
2025-02-02 21:10:52 return await self._request(
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/openai/_base_client.py", line 1610, in _request
2025-02-02 21:10:52 raise APIConnectionError(request=request) from err
2025-02-02 21:10:52 openai.APIConnectionError: Connection error.
2025-02-02 21:10:52 ERROR: Exception in ASGI application
2025-02-02 21:10:52 Traceback (most recent call last):
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 250, in run_asgi
2025-02-02 21:10:52 result = await self.app(self.scope, self.asgi_receive, self.asgi_send)
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
2025-02-02 21:10:52 return await self.app(scope, receive, send)
2025-02-02 21:10:52 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__
2025-02-02 21:10:52 await super().__call__(scope, receive, send)
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/starlette/applications.py", line 113, in __call__
2025-02-02 21:10:52 await self.middleware_stack(scope, receive, send)
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/starlette/middleware/errors.py", line 152, in __call__
2025-02-02 21:10:52 await self.app(scope, receive, send)
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/starlette/middleware/cors.py", line 77, in __call__
2025-02-02 21:10:52 await self.app(scope, receive, send)
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
2025-02-02 21:10:52 await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2025-02-02 21:10:52 raise exc
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
2025-02-02 21:10:52 await app(scope, receive, sender)
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line 715, in __call__
2025-02-02 21:10:52 await self.middleware_stack(scope, receive, send)
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line 735, in app
2025-02-02 21:10:52 await route.handle(scope, receive, send)
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line 362, in handle
2025-02-02 21:10:52 await self.app(scope, receive, send)
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line 95, in app
2025-02-02 21:10:52 await wrap_app_handling_exceptions(app, session)(scope, receive, send)
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2025-02-02 21:10:52 raise exc
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
2025-02-02 21:10:52 await app(scope, receive, sender)
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/starlette/routing.py", line 93, in app
2025-02-02 21:10:52 await func(session)
2025-02-02 21:10:52 File "/usr/local/lib/python3.12/site-packages/fastapi/routing.py", line 383, in app
2025-02-02 21:10:52 await dependant.call(**solved_result.values)
2025-02-02 21:10:52 File "/app/routes/generate_code.py", line 349, in stream_code
2025-02-02 21:10:52 raise Exception("All generations failed")
2025-02-02 21:10:52 Exception: All generations failed
2025-02-02 21:10:52 INFO: connection closed`

I'm running in windows docker and I couldn't solve this problem independently

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.