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

Error generating code. Please contact support.

Open TCSlX opened this issue 1 year ago • 8 comments

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

I have this setup in gear:

Image

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

TCSlX avatar Feb 02 '25 13:02 TCSlX

which model are you using on ollama and does it support multi modal imports?

abi avatar Feb 02 '25 14:02 abi

llama3.2-vision:11b

TCSlX avatar Feb 04 '25 05:02 TCSlX

" httpcore.ConnectError: All connection attempts"

I think it's not able to connect to Llama? We don't directly support ollama but I think if you use the OpenAI compatible endpoint, it should work.

abi avatar Feb 04 '25 16:02 abi

What is the name of the model requested for this project?

TCSlX avatar Feb 08 '25 12:02 TCSlX

Use OpenAI, Claude or Gemini.

abi avatar Feb 08 '25 14:02 abi

I have the same problem, how to solve it?

weslleykawan avatar Feb 11 '25 20:02 weslleykawan

Use OpenAI, Claude or Gemini.

I mean the model name of the post request, such as “GPT4-turbo” or “llama3”

TCSlX avatar Feb 12 '25 08:02 TCSlX

me,too. how to solve it?

Image

geeklx avatar Mar 26 '25 10:03 geeklx