receiving this error when uploading an image in local mode
- Vorherrschende Sprache
- Python
- Sterne
- 78.7k
- Forks
- 9.6k
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
**Describe the bug**
receiveing this error when uploading an image in local mode
poetry run uvicorn main:app --reload --port 7001
INFO: Will watch for changes in these directories: [/Documents/personal_projects/screenshot-to-code/backend']
INFO: Uvicorn running on http://127.0.0.1:7001 (Press CTRL+C to quit)
INFO: Started reloader process [40040] using StatReload
INFO: Started server process [40044]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: ('127.0.0.1', 57565) - "WebSocket /generate-code" [accepted]
Incoming websocket connection...
INFO: connection open
Received params
Using anthropicApiKey from environment variable
Using official OpenAI URL
Generating html_css code in image mode
Status (variant 0): Generating code...
Status (variant 1): Generating code...
[CLAUDE IMAGE PROCESSING] no processing needed
[CLAUDE IMAGE PROCESSING] no processing needed
Error generating code. Please contact support.
Traceback (most recent call last):
File "/Documents/personal_projects/screenshot-to-code/backend/llm.py", line 128, in stream_claude_response
async with client.messages.stream(
~~~~~~~~~~~~~~~~~~~~~~^
model=model.value,
^^^^^^^^^^^^^^^^^^
...<4 lines>...
extra_headers={"anthropic-beta": "max-tokens-3-5-sonnet-2024-07-15"},
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
) as stream:
^
File "/Library/Caches/pypoetry/virtualenvs/backend-0eH0r054-py3.13/lib/python3.13/site-packages/anthropic/lib/streaming/_messages.py", line 305, in __aenter__
raw_stream = await self.__api_request
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Caches/pypoetry/virtualenvs/backend-0eH0r054-py3.13/lib/python3.13/site-packages/anthropic/_base_client.py", line 1838, in post
return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Caches/pypoetry/virtualenvs/backend-0eH0r054-py3.13/lib/python3.13/site-packages/anthropic/_base_client.py", line 1532, in request
return await self._request(
^^^^^^^^^^^^^^^^^^^^
...<5 lines>...
)
^
File "/Library/Caches/pypoetry/virtualenvs/backend-0eH0r054-py3.13/lib/python3.13/site-packages/anthropic/_base_client.py", line 1633, in _request
raise self._make_status_error_from_response(err.response) from None
anthropic.AuthenticationError: Error code: 401 - {'type': 'error', 'error': {'type': 'authentication_error', 'message': 'invalid x-api-key'}}
Traceback (most recent call last):
File "/Documents/personal_projects/screenshot-to-code/backend/llm.py", line 128, in stream_claude_response
async with client.messages.stream(
~~~~~~~~~~~~~~~~~~~~~~^
model=model.value,
^^^^^^^^^^^^^^^^^^
...<4 lines>...
extra_headers={"anthropic-beta": "max-tokens-3-5-sonnet-2024-07-15"},
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
) as stream:
^
File "/Library/Caches/pypoetry/virtualenvs/backend-0eH0r054-py3.13/lib/python3.13/site-packages/anthropic/lib/streaming/_messages.py", line 305, in __aenter__
raw_stream = await self.__api_request
^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Caches/pypoetry/virtualenvs/backend-0eH0r054-py3.13/lib/python3.13/site-packages/anthropic/_base_client.py", line 1838, in post
return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Caches/pypoetry/virtualenvs/backend-0eH0r054-py3.13/lib/python3.13/site-packages/anthropic/_base_client.py", line 1532, in request
return await self._request(
^^^^^^^^^^^^^^^^^^^^
...<5 lines>...
)
^
File "/Library/Caches/pypoetry/virtualenvs/backend-0eH0r054-py3.13/lib/python3.13/site-packages/anthropic/_base_client.py", line 1633, in _request
raise self._make_status_error_from_response(err.response) from None
anthropic.AuthenticationError: Error code: 401 - {'type': 'error', 'error': {'type': 'authentication_error', 'message': 'invalid x-api-key'}}
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/Library/Caches/pypoetry/virtualenvs/backend-0eH0r054-py3.13/lib/python3.13/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 "/Library/Caches/pypoetry/virtualenvs/backend-0eH0r054-py3.13/lib/python3.13/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Caches/pypoetry/virtualenvs/backend-0eH0r054-py3.13/lib/python3.13/site-packages/fastapi/applications.py", line 276, in __call__
await super().__call__(scope, receive, send)
File "/Library/Caches/pypoetry/virtualenvs/backend-0eH0r054-py3.13/lib/python3.13/site-packages/starlette/applications.py", line 122, in __call__
await self.middleware_stack(scope, receive, send)
File "/Library/Caches/pypoetry/virtualenvs/backend-0eH0r054-py3.13/lib/python3.13/site-packages/starlette/middleware/errors.py", line 149, in __call__
await self.app(scope, receive, send)
File "/Library/Caches/pypoetry/virtualenvs/backend-0eH0r054-py3.13/lib/python3.13/site-packages/starlette/middleware/cors.py", line 75, in __call__
await self.app(scope, receive, send)
File "/Library/Caches/pypoetry/virtualenvs/backend-0eH0r054-py3.13/lib/python3.13/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
raise exc
File "/Library/Caches/pypoetry/virtualenvs/backend-0eH0r054-py3.13/lib/python3.13/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
await self.app(scope, receive, sender)
File "/Library/Caches/pypoetry/virtualenvs/backend-0eH0r054-py3.13/lib/python3.13/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
raise e
File "/Library/Caches/pypoetry/virtualenvs/backend-0eH0r054-py3.13/lib/python3.13/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
await self.app(scope, receive, send)
File "/Library/Caches/pypoetry/virtualenvs/backend-0eH0r054-py3.13/lib/python3.13/site-packages/starlette/routing.py", line 718, in __call__
await route.handle(scope, receive, send)
File "/Library/Caches/pypoetry/virtualenvs/backend-0eH0r054-py3.13/lib/python3.13/site-packages/starlette/routing.py", line 341, in handle
await self.app(scope, receive, send)
File "/Library/Caches/pypoetry/virtualenvs/backend-0eH0r054-py3.13/lib/python3.13/site-packages/starlette/routing.py", line 82, in app
await func(session)
File "/Library/Caches/pypoetry/virtualenvs/backend-0eH0r054-py3.13/lib/python3.13/site-packages/fastapi/routing.py", line 289, in app
await dependant.call(**values)
File "/Documents/personal_projects/screenshot-to-code/backend/routes/generate_code.py", line 329, in stream_code
raise Exception("All generations failed")
Exception: All generations failed
INFO: connection closed
**Screenshots of backend AND frontend terminal logs**
If applicable, add screenshots to help explain your problem.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.