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

tips:Error generating code. Please contact support.

Open XiaoNode opened this issue 1 year ago • 7 comments

i add anthropic key in dialog,Chrome console massage is: Connection closed 4332 ,what wrong with it?

XiaoNode avatar Nov 20 '24 08:11 XiaoNode

Please share your front end and back end logs.

abi avatar Nov 20 '24 15:11 abi

the frontend project console in Chrome is: Known server error CloseEvent : {isTrusted: true, bubbles: false, cancelBubble: false, cancelable: false, code: 4332, composed: false, currentTarget: WebSocket {url: 'ws: //127.0.0.1:7001/generate-code', readyState: 3, bufferedAmount: 0, onopen: null, onerror: null, …}, defaultPrevented: false, eventPhase: 0, reason: "", returnValue: true, srcElement: WebSocket {url: 'ws: //127.0.0.1:7001/generate-code', readyState: 3, bufferedAmount: 0, onopen: null, onerror: null, …}, target: WebSocket {url: 'ws: //127.0.0.1:7001/generate-code', readyState: 3, bufferedAmount: 0, onopen: null, onerror: null, …}, timeStamp: 207469.09999990463, type: "close", wasClean:true}

XiaoNode avatar Nov 25 '24 10:11 XiaoNode

the frontend project console in Chrome is: Known server error CloseEvent : {isTrusted: true, bubbles: false, cancelBubble: false, cancelable: false, code: 4332, composed: false, currentTarget: WebSocket {url: 'ws: //127.0.0.1:7001/generate-code', readyState: 3, bufferedAmount: 0, onopen: null, onerror: null, …}, defaultPrevented: false, eventPhase: 0, reason: "", returnValue: true, srcElement: WebSocket {url: 'ws: //127.0.0.1:7001/generate-code', readyState: 3, bufferedAmount: 0, onopen: null, onerror: null, …}, target: WebSocket {url: 'ws: //127.0.0.1:7001/generate-code', readyState: 3, bufferedAmount: 0, onopen: null, onerror: null, …}, timeStamp: 207469.09999990463, type: "close", wasClean:true}

I have the same problems.Have you splves it?

nsjSxue avatar Dec 19 '24 07:12 nsjSxue

@nsjSxue please share your backend logs

abi avatar Dec 19 '24 10:12 abi

D:\work\thunder.com.cn\github\screenshot-to-code>cd backend && echo "OPENAI_API_KEY=sk-your-key" > .env && echo "ANTHROPIC_API_KEY=your-key" > .env && poetry install && poetry shell && poetry run uvicorn main:app --reload --port 7001 Installing dependencies from lock file

No dependencies to install or update

Installing the current project: backend (0.1.0) Error: The current project could not be installed: No file/folder found for package backend If you do not want to install the current project use --no-root. If you want to use Poetry only for dependency management but not for packaging, you can disable package mode by setting package-mode = false in your pyproject.toml file. If you did intend to install the current project, you may need to set packages in your pyproject.toml file.

D:\work\thunder.com.cn\github\screenshot-to-code\backend>poetry install Installing dependencies from lock file

No dependencies to install or update

Installing the current project: backend (0.1.0) Error: The current project could not be installed: No file/folder found for package backend If you do not want to install the current project use --no-root. If you want to use Poetry only for dependency management but not for packaging, you can disable package mode by setting package-mode = false in your pyproject.toml file. If you did intend to install the current project, you may need to set packages in your pyproject.toml file.

D:\work\thunder.com.cn\github\screenshot-to-code\backend>poetry install --no-root Installing dependencies from lock file

No dependencies to install or update

D:\work\thunder.com.cn\github\screenshot-to-code\backend> poetry shell

Looks like you're trying to use a Poetry command that is not available.

Since Poetry (2.0.0), the shell command is not installed by default. You can use,

  • the new env activate command (recommended); or
  • the shell plugin to install the shell command

Documentation: https://python-poetry.org/docs/managing-environments/#activating-the-environment

Note that the env activate command is not a direct replacement for shell command.

D:\work\thunder.com.cn\github\screenshot-to-code\backend>poetry run uvicorn main:app --reload --port 7001 INFO: Will watch for changes in these directories: ['D:\work\thunder.com.cn\github\screenshot-to-code\backend'] INFO: Uvicorn running on http://127.0.0.1:7001 (Press CTRL+C to quit) INFO: Started reloader process [26028] using StatReload C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\moviepy\config_defaults.py:1: SyntaxWarning: invalid escape sequence '\P' """ C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packago\ffmpeg_reader.py:367: SyntaxWarning: invalid escape sequence '\d' rotation_lines = [l for l in lines if 'rotate :' in l and re.search('\d+$', l)] C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\moviepy\video\io\ffmpeg_reader.py:370: SyntaxWarning: invalid escape sequence '\d' match = re.search('\d+$', rotation_line) INFO: Started server process [268] INFO: Waiting for application startup. INFO: Application startup complete. INFO: ('127.0.0.1', 4150) - "WebSocket /generate-code" [accepted] Incoming websocket connection... INFO: connection open Received params Using official OpenAI URL Generating vue_tailwind code in image mode Status (variant 0): Generating code... Status (variant 1): Generating code... No OpenAI or Anthropic API key found. Please add the environment variable OPENAI_API_KEY or ANTHROPIC_API_KEY to backend/.env or in the settings dialog. If you add it to .env, make sure to restart the backend server. ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\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\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().call(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\applications.py", line 113, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\errors.py", line 152, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\cors.py", line 77, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 715, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 735, in app await route.handle(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 362, in handle await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 95, in app await wrap_app_handling_exceptions(app, session)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 93, in app await func(session) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\routing.py", line 383, in app await dependant.call(**solved_result.values) File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\routes\generate_code.py", line 284, in stream_code raise Exception("No OpenAI or Anthropic key") Exception: No OpenAI or Anthropic key INFO: connection closed INFO: Shutting down INFO: connection closed INFO: Shutting down INFO: Waiting for application shutdown. INFO: Application shutdown complete. INFO: Finished server process [268] INFO: Stopping reloader process [26028]

D:\work\thunder.com.cn\github\screenshot-to-code\backend>

D:\work\thunder.com.cn\github\screenshot-to-code\backend>

D:\work\thunder.com.cn\github\screenshot-to-code\backend> poetry run uvicorn main:app --reload --port 7001 INFO: Will watch for changes in these directories: ['D:\work\thunder.com.cn\github\screenshot-to-code\backend'] INFO: Uvicorn running on http://127.0.0.1:7001 (Press CTRL+C to quit) INFO: Started reloader process [25108] using StatReload INFO: Started server process [26584] INFO: Waiting for application startup. INFO: Application startup complete. INFO: ('127.0.0.1', 3481) - "WebSocket /generate-code" [accepted] Incoming websocket connection... INFO: connection open Received params Using anthropicApiKey from environment variable Using openAiBaseURL from environment variable Generating vue_tailwind 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 "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response
async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request
raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} Traceback (most recent call last): File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response
async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request
raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\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\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().call(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\applications.py", line 113, in call await self.middleware_stack(scope, receive, send)
File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\errors.py", line 152, in call
await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\cors.py", line 77, in call
await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 715, in call await self.middleware_stack(scope, receive, send)
File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 735, in app await route.handle(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 362, in handle await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 95, in app await wrap_app_handling_exceptions(app, session)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app tarlette\routing.py", line 93, in app await func(session) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\routing.py", line 383, in app await dependant.call(**solved_result.values) File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\routes\generate_code.py", line 354, in stream_code raise Exception("All generations failed") Exception: All generations failed INFO: connection closed WARNING: StatReload detected changes in 'config.py'. Reloading... INFO: ('127.0.0.1', 12326) - "WebSocket /generate-code" [accepted] Incoming websocket connection... INFO: connection open INFO: Shutting down ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\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\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().call(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\applications.py", line 113, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\errors.py", line 152, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\cors.py", line 77, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 715, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 735, in app await route.handle(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 362, in handle await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 95, in app await wrap_app_handling_exceptions(app, session)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 93, in app await func(session) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\routing.py", line 383, in app await dependant.call(**solved_result.values) File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\routes\generate_code.py", line 190, in stream_code params: dict[str, str] = await websocket.receive_json() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\websockets.py", line 135, in receive_json self._raise_on_disconnect(message) ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\websockets.py", line 113, in _raise_on_disconnect raise WebSocketDisconnect(message["code"], message.get("reason")) starlette.websockets.WebSocketDisconnect: (1012, None) INFO: connection closed INFO: Waiting for application shutdown. INFO: Application shutdown complete. INFO: Finished server process [26584] INFO: Started server process [24308] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Shutting down INFO: Waiting for application shutdown. INFO: Application shutdown complete. INFO: Finished server process [24308] INFO: Stopping reloader process [25108]

D:\work\thunder.com.cn\github\screenshot-to-code\backend> D:\work\thunder.com.cn\github\screenshot-to-code\backend> D:\work\thunder.com.cn\github\screenshot-to-code\backend> D:\work\thunder.com.cn\github\screenshot-to-code\backend> D:\work\thunder.com.cn\github\screenshot-to-code\backend>poetry run uvicorn main:app --reload --port 7001 INFO: Will watch for changes in these directories: ['D:\work\thunder.com.cn\github\screenshot-to-code\backend'] INFO: Uvicorn running on http://127.0.0.1:7001 (Press CTRL+C to quit) INFO: Started reloader process [11248] using StatReload INFO: Started server process [10500] INFO: Waiting for application startup. INFO: Application startup complete. INFO: ('127.0.0.1', 12381) - "WebSocket /generate-code" [accepted] Incoming websocket connection... INFO: connection open Received params Using anthropicApiKey from environment variable Using openAiBaseURL from environment variable Generating vue_tailwind 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 "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} Traceback (most recent call last): File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\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\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().call(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\applications.py", line 113, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\errors.py", line 152, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\cors.py", line 77, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 715, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 735, in app await route.handle(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 362, in handle await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 95, in app await wrap_app_handling_exceptions(app, session)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 93, in app await func(session) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\routing.py", line 383, in app await dependant.call(**solved_result.values) File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\routes\generate_code.py", line 354, in stream_code raise Exception("All generations failed") Exception: All generations failed INFO: connection closed INFO: ('127.0.0.1', 3755) - "WebSocket /generate-code" [accepted] Incoming websocket connection... INFO: connection open Received params Using anthropicApiKey from environment variable Using openAiBaseURL from environment variable Generating vue_tailwind 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 "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} Traceback (most recent call last): File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\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\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().call(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\applications.py", line 113, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\errors.py", line 152, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\cors.py", line 77, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 715, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 735, in app await route.handle(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 362, in handle await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 95, in app await wrap_app_handling_exceptions(app, session)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 93, in app await func(session) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\routing.py", line 383, in app await dependant.call(**solved_result.values) File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\routes\generate_code.py", line 354, in stream_code raise Exception("All generations failed") Exception: All generations failed INFO: connection closed INFO: Shutting down INFO: Waiting for application shutdown. INFO: Application shutdown complete. INFO: Finished server process [10500] INFO: Stopping reloader process [11248]

D:\work\thunder.com.cn\github\screenshot-to-code\backend>

D:\work\thunder.com.cn\github\screenshot-to-code\backend>

D:\work\thunder.com.cn\github\screenshot-to-code\backend>poetry install --no-root
Installing dependencies from lock file

No dependencies to install or update

D:\work\thunder.com.cn\github\screenshot-to-code\backend>poetry shell

Looks like you're trying to use a Poetry command that is not available.

Since Poetry (2.0.0), the shell command is not installed by default. You can use,

  • the new env activate command (recommended); or
  • the shell plugin to install the shell command

Documentation: https://python-poetry.org/docs/managing-environments/#activating-the-environment

Note that the env activate command is not a direct replacement for shell command.

D:\work\thunder.com.cn\github\screenshot-to-code\backend>env activate 'env' 不是内部或外部命令,也不是可运行的程序 或批处理文件。

D:\work\thunder.com.cn\github\screenshot-to-code\backend>poetry install --no-root Installing dependencies from lock file

No dependencies to install or update

D:\work\thunder.com.cn\github\screenshot-to-code\backend> poetry shell

Looks like you're trying to use a Poetry command that is not available.

Since Poetry (2.0.0), the shell command is not installed by default. You can use,

  • the new env activate command (recommended); or
  • the shell plugin to install the shell command

Documentation: https://python-poetry.org/docs/managing-environments/#activating-the-environment

Note that the env activate command is not a direct replacement for shell command.

D:\work\thunder.com.cn\github\screenshot-to-code\backend>poetry run uvicorn main:app --reload --port 7001 INFO: Will watch for changes in these directories: ['D:\work\thunder.com.cn\github\screenshot-to-code\backend'] INFO: Uvicorn running on http://127.0.0.1:7001 (Press CTRL+C to quit) INFO: Started reloader process [21508] using StatReload INFO: Started server process [14500] INFO: Waiting for application startup. INFO: Application startup complete. INFO: ('127.0.0.1', 6808) - "WebSocket /generate-code" [accepted] Incoming websocket connection... INFO: connection open Received params Using anthropicApiKey from environment variable Using openAiBaseURL from environment variable Generating vue_tailwind 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 "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} Traceback (most recent call last): File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\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\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().call(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\applications.py", line 113, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\errors.py", line 152, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\cors.py", line 77, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 715, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 735, in app await route.handle(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 362, in handle await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 95, in app await wrap_app_handling_exceptions(app, session)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 93, in app await func(session) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\routing.py", line 383, in app await dependant.call(**solved_result.values) File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\routes\generate_code.py", line 354, in stream_code raise Exception("All generations failed") Exception: All generations failed INFO: connection closed INFO: ('127.0.0.1', 5156) - "WebSocket /generate-code" [accepted] Incoming websocket connection... INFO: connection open Received params Using anthropicApiKey from environment variable Using openAiBaseURL from environment variable Generating vue_tailwind 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 "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} Traceback (most recent call last): File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\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\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().call(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\applications.py", line 113, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\errors.py", line 152, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\cors.py", line 77, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 715, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 735, in app await route.handle(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 362, in handle await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 95, in app await wrap_app_handling_exceptions(app, session)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 93, in app await func(session) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\routing.py", line 383, in app await dependant.call(**solved_result.values) File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\routes\generate_code.py", line 354, in stream_code raise Exception("All generations failed") Exception: All generations failed INFO: connection closed

henan01 avatar Mar 21 '25 03:03 henan01

D:\work\thunder.com.cn\github\screenshot-to-code>cd backend && echo "OPENAI_API_KEY=sk-your-key" > .env && echo "ANTHROPIC_API_KEY=your-key" > .env && poetry install && poetry shell && poetry run uvicorn main:app --reload --port 7001 Installing dependencies from lock file

No dependencies to install or update

Installing the current project: backend (0.1.0) Error: The current project could not be installed: No file/folder found for package backend If you do not want to install the current project use --no-root. If you want to use Poetry only for dependency management but not for packaging, you can disable package mode by setting package-mode = false in your pyproject.toml file. If you did intend to install the current project, you may need to set packages in your pyproject.toml file.

D:\work\thunder.com.cn\github\screenshot-to-code\backend>poetry install Installing dependencies from lock file

No dependencies to install or update

Installing the current project: backend (0.1.0) Error: The current project could not be installed: No file/folder found for package backend If you do not want to install the current project use --no-root. If you want to use Poetry only for dependency management but not for packaging, you can disable package mode by setting package-mode = false in your pyproject.toml file. If you did intend to install the current project, you may need to set packages in your pyproject.toml file.

D:\work\thunder.com.cn\github\screenshot-to-code\backend>poetry install --no-root Installing dependencies from lock file

No dependencies to install or update

D:\work\thunder.com.cn\github\screenshot-to-code\backend> poetry shell

Looks like you're trying to use a Poetry command that is not available.

Since Poetry (2.0.0), the shell command is not installed by default. You can use,

  • the new env activate command (recommended); or
  • the shell plugin to install the shell command

Documentation: https://python-poetry.org/docs/managing-environments/#activating-the-environment

Note that the env activate command is not a direct replacement for shell command.

D:\work\thunder.com.cn\github\screenshot-to-code\backend>poetry run uvicorn main:app --reload --port 7001 INFO: Will watch for changes in these directories: ['D:\work\thunder.com.cn\github\screenshot-to-code\backend'] INFO: Uvicorn running on http://127.0.0.1:7001 (Press CTRL+C to quit) INFO: Started reloader process [26028] using StatReload C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\moviepy\config_defaults.py:1: SyntaxWarning: invalid escape sequence '\P' """ C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packago\ffmpeg_reader.py:367: SyntaxWarning: invalid escape sequence '\d' rotation_lines = [l for l in lines if 'rotate :' in l and re.search('\d+$', l)] C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\moviepy\video\io\ffmpeg_reader.py:370: SyntaxWarning: invalid escape sequence '\d' match = re.search('\d+$', rotation_line) INFO: Started server process [268] INFO: Waiting for application startup. INFO: Application startup complete. INFO: ('127.0.0.1', 4150) - "WebSocket /generate-code" [accepted] Incoming websocket connection... INFO: connection open Received params Using official OpenAI URL Generating vue_tailwind code in image mode Status (variant 0): Generating code... Status (variant 1): Generating code... No OpenAI or Anthropic API key found. Please add the environment variable OPENAI_API_KEY or ANTHROPIC_API_KEY to backend/.env or in the settings dialog. If you add it to .env, make sure to restart the backend server. ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\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\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().call(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\applications.py", line 113, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\errors.py", line 152, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\cors.py", line 77, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 715, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 735, in app await route.handle(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 362, in handle await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 95, in app await wrap_app_handling_exceptions(app, session)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 93, in app await func(session) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\routing.py", line 383, in app await dependant.call(**solved_result.values) File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\routes\generate_code.py", line 284, in stream_code raise Exception("No OpenAI or Anthropic key") Exception: No OpenAI or Anthropic key INFO: connection closed INFO: Shutting down INFO: connection closed INFO: Shutting down INFO: Waiting for application shutdown. INFO: Application shutdown complete. INFO: Finished server process [268] INFO: Stopping reloader process [26028]

D:\work\thunder.com.cn\github\screenshot-to-code\backend>

D:\work\thunder.com.cn\github\screenshot-to-code\backend>

D:\work\thunder.com.cn\github\screenshot-to-code\backend> poetry run uvicorn main:app --reload --port 7001 INFO: Will watch for changes in these directories: ['D:\work\thunder.com.cn\github\screenshot-to-code\backend'] INFO: Uvicorn running on http://127.0.0.1:7001 (Press CTRL+C to quit) INFO: Started reloader process [25108] using StatReload INFO: Started server process [26584] INFO: Waiting for application startup. INFO: Application startup complete. INFO: ('127.0.0.1', 3481) - "WebSocket /generate-code" [accepted] Incoming websocket connection... INFO: connection open Received params Using anthropicApiKey from environment variable Using openAiBaseURL from environment variable Generating vue_tailwind 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 "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response
async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request
raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} Traceback (most recent call last): File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response
async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request
raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\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\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().call(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\applications.py", line 113, in call await self.middleware_stack(scope, receive, send)
File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\errors.py", line 152, in call
await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\cors.py", line 77, in call
await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 715, in call await self.middleware_stack(scope, receive, send)
File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 735, in app await route.handle(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 362, in handle await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 95, in app await wrap_app_handling_exceptions(app, session)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app tarlette\routing.py", line 93, in app await func(session) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\routing.py", line 383, in app await dependant.call(**solved_result.values) File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\routes\generate_code.py", line 354, in stream_code raise Exception("All generations failed") Exception: All generations failed INFO: connection closed WARNING: StatReload detected changes in 'config.py'. Reloading... INFO: ('127.0.0.1', 12326) - "WebSocket /generate-code" [accepted] Incoming websocket connection... INFO: connection open INFO: Shutting down ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\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\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().call(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\applications.py", line 113, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\errors.py", line 152, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\cors.py", line 77, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 715, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 735, in app await route.handle(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 362, in handle await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 95, in app await wrap_app_handling_exceptions(app, session)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 93, in app await func(session) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\routing.py", line 383, in app await dependant.call(**solved_result.values) File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\routes\generate_code.py", line 190, in stream_code params: dict[str, str] = await websocket.receive_json() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\websockets.py", line 135, in receive_json self._raise_on_disconnect(message) ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\websockets.py", line 113, in _raise_on_disconnect raise WebSocketDisconnect(message["code"], message.get("reason")) starlette.websockets.WebSocketDisconnect: (1012, None) INFO: connection closed INFO: Waiting for application shutdown. INFO: Application shutdown complete. INFO: Finished server process [26584] INFO: Started server process [24308] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Shutting down INFO: Waiting for application shutdown. INFO: Application shutdown complete. INFO: Finished server process [24308] INFO: Stopping reloader process [25108]

D:\work\thunder.com.cn\github\screenshot-to-code\backend> D:\work\thunder.com.cn\github\screenshot-to-code\backend> D:\work\thunder.com.cn\github\screenshot-to-code\backend> D:\work\thunder.com.cn\github\screenshot-to-code\backend> D:\work\thunder.com.cn\github\screenshot-to-code\backend>poetry run uvicorn main:app --reload --port 7001 INFO: Will watch for changes in these directories: ['D:\work\thunder.com.cn\github\screenshot-to-code\backend'] INFO: Uvicorn running on http://127.0.0.1:7001 (Press CTRL+C to quit) INFO: Started reloader process [11248] using StatReload INFO: Started server process [10500] INFO: Waiting for application startup. INFO: Application startup complete. INFO: ('127.0.0.1', 12381) - "WebSocket /generate-code" [accepted] Incoming websocket connection... INFO: connection open Received params Using anthropicApiKey from environment variable Using openAiBaseURL from environment variable Generating vue_tailwind 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 "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} Traceback (most recent call last): File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\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\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().call(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\applications.py", line 113, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\errors.py", line 152, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\cors.py", line 77, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 715, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 735, in app await route.handle(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 362, in handle await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 95, in app await wrap_app_handling_exceptions(app, session)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 93, in app await func(session) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\routing.py", line 383, in app await dependant.call(**solved_result.values) File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\routes\generate_code.py", line 354, in stream_code raise Exception("All generations failed") Exception: All generations failed INFO: connection closed INFO: ('127.0.0.1', 3755) - "WebSocket /generate-code" [accepted] Incoming websocket connection... INFO: connection open Received params Using anthropicApiKey from environment variable Using openAiBaseURL from environment variable Generating vue_tailwind 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 "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} Traceback (most recent call last): File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\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\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().call(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\applications.py", line 113, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\errors.py", line 152, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\cors.py", line 77, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 715, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 735, in app await route.handle(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 362, in handle await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 95, in app await wrap_app_handling_exceptions(app, session)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 93, in app await func(session) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\routing.py", line 383, in app await dependant.call(**solved_result.values) File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\routes\generate_code.py", line 354, in stream_code raise Exception("All generations failed") Exception: All generations failed INFO: connection closed INFO: Shutting down INFO: Waiting for application shutdown. INFO: Application shutdown complete. INFO: Finished server process [10500] INFO: Stopping reloader process [11248]

D:\work\thunder.com.cn\github\screenshot-to-code\backend>

D:\work\thunder.com.cn\github\screenshot-to-code\backend>

D:\work\thunder.com.cn\github\screenshot-to-code\backend>poetry install --no-root
Installing dependencies from lock file

No dependencies to install or update

D:\work\thunder.com.cn\github\screenshot-to-code\backend>poetry shell

Looks like you're trying to use a Poetry command that is not available.

Since Poetry (2.0.0), the shell command is not installed by default. You can use,

  • the new env activate command (recommended); or
  • the shell plugin to install the shell command

Documentation: https://python-poetry.org/docs/managing-environments/#activating-the-environment

Note that the env activate command is not a direct replacement for shell command.

D:\work\thunder.com.cn\github\screenshot-to-code\backend>env activate 'env' 不是内部或外部命令,也不是可运行的程序 或批处理文件。

D:\work\thunder.com.cn\github\screenshot-to-code\backend>poetry install --no-root Installing dependencies from lock file

No dependencies to install or update

D:\work\thunder.com.cn\github\screenshot-to-code\backend> poetry shell

Looks like you're trying to use a Poetry command that is not available.

Since Poetry (2.0.0), the shell command is not installed by default. You can use,

  • the new env activate command (recommended); or
  • the shell plugin to install the shell command

Documentation: https://python-poetry.org/docs/managing-environments/#activating-the-environment

Note that the env activate command is not a direct replacement for shell command.

D:\work\thunder.com.cn\github\screenshot-to-code\backend>poetry run uvicorn main:app --reload --port 7001 INFO: Will watch for changes in these directories: ['D:\work\thunder.com.cn\github\screenshot-to-code\backend'] INFO: Uvicorn running on http://127.0.0.1:7001 (Press CTRL+C to quit) INFO: Started reloader process [21508] using StatReload INFO: Started server process [14500] INFO: Waiting for application startup. INFO: Application startup complete. INFO: ('127.0.0.1', 6808) - "WebSocket /generate-code" [accepted] Incoming websocket connection... INFO: connection open Received params Using anthropicApiKey from environment variable Using openAiBaseURL from environment variable Generating vue_tailwind 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 "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} Traceback (most recent call last): File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\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\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().call(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\applications.py", line 113, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\errors.py", line 152, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\cors.py", line 77, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 715, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 735, in app await route.handle(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 362, in handle await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 95, in app await wrap_app_handling_exceptions(app, session)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 93, in app await func(session) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\routing.py", line 383, in app await dependant.call(**solved_result.values) File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\routes\generate_code.py", line 354, in stream_code raise Exception("All generations failed") Exception: All generations failed INFO: connection closed INFO: ('127.0.0.1', 5156) - "WebSocket /generate-code" [accepted] Incoming websocket connection... INFO: connection open Received params Using anthropicApiKey from environment variable Using openAiBaseURL from environment variable Generating vue_tailwind 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 "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} Traceback (most recent call last): File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\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\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().call(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\applications.py", line 113, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\errors.py", line 152, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\cors.py", line 77, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 715, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 735, in app await route.handle(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 362, in handle await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 95, in app await wrap_app_handling_exceptions(app, session)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 93, in app await func(session) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\routing.py", line 383, in app await dependant.call(**solved_result.values) File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\routes\generate_code.py", line 354, in stream_code raise Exception("All generations failed") Exception: All generations failed INFO: connection closed

henan01 avatar Mar 21 '25 03:03 henan01

`D:\work\thunder.com.cn\github\screenshot-to-code>cd backend && echo "OPENAI_API_KEY=sk-your-key" > .env && echo "ANTHROPIC_API_KEY=your-key" > .env && poetry install && poetry shell && poetry run uvicorn main:app --reload --port 7001 Installing dependencies from lock file

No dependencies to install or update

Installing the current project: backend (0.1.0) Error: The current project could not be installed: No file/folder found for package backend If you do not want to install the current project use --no-root. If you want to use Poetry only for dependency management but not for packaging, you can disable package mode by setting package-mode = false in your pyproject.toml file. If you did intend to install the current project, you may need to set packages in your pyproject.toml file.

D:\work\thunder.com.cn\github\screenshot-to-code\backend>poetry install Installing dependencies from lock file

No dependencies to install or update

Installing the current project: backend (0.1.0) Error: The current project could not be installed: No file/folder found for package backend If you do not want to install the current project use --no-root. If you want to use Poetry only for dependency management but not for packaging, you can disable package mode by setting package-mode = false in your pyproject.toml file. If you did intend to install the current project, you may need to set packages in your pyproject.toml file.

D:\work\thunder.com.cn\github\screenshot-to-code\backend>poetry install --no-root Installing dependencies from lock file

No dependencies to install or update

D:\work\thunder.com.cn\github\screenshot-to-code\backend> poetry shell

Looks like you're trying to use a Poetry command that is not available.

Since Poetry (2.0.0), the shell command is not installed by default. You can use,

  • the new env activate command (recommended); or
  • the shell plugin to install the shell command

Documentation: https://python-poetry.org/docs/managing-environments/#activating-the-environment

Note that the env activate command is not a direct replacement for shell command.

D:\work\thunder.com.cn\github\screenshot-to-code\backend>poetry run uvicorn main:app --reload --port 7001 INFO: Will watch for changes in these directories: ['D:\work\thunder.com.cn\github\screenshot-to-code\backend'] INFO: Uvicorn running on http://127.0.0.1:7001 (Press CTRL+C to quit) INFO: Started reloader process [26028] using StatReload C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\moviepy\config_defaults.py:1: SyntaxWarning: invalid escape sequence '\P' """ C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packago\ffmpeg_reader.py:367: SyntaxWarning: invalid escape sequence '\d' rotation_lines = [l for l in lines if 'rotate :' in l and re.search('\d+$', l)] C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\moviepy\video\io\ffmpeg_reader.py:370: SyntaxWarning: invalid escape sequence '\d' match = re.search('\d+$', rotation_line) INFO: Started server process [268] INFO: Waiting for application startup. INFO: Application startup complete. INFO: ('127.0.0.1', 4150) - "WebSocket /generate-code" [accepted] Incoming websocket connection... INFO: connection open Received params Using official OpenAI URL Generating vue_tailwind code in image mode Status (variant 0): Generating code... Status (variant 1): Generating code... No OpenAI or Anthropic API key found. Please add the environment variable OPENAI_API_KEY or ANTHROPIC_API_KEY to backend/.env or in the settings dialog. If you add it to .env, make sure to restart the backend server. ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\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\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().call(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\applications.py", line 113, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\errors.py", line 152, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\cors.py", line 77, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 715, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 735, in app await route.handle(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 362, in handle await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 95, in app await wrap_app_handling_exceptions(app, session)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 93, in app await func(session) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\routing.py", line 383, in app await dependant.call(**solved_result.values) File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\routes\generate_code.py", line 284, in stream_code raise Exception("No OpenAI or Anthropic key") Exception: No OpenAI or Anthropic key INFO: connection closed INFO: Shutting down INFO: connection closed INFO: Shutting down INFO: Waiting for application shutdown. INFO: Application shutdown complete. INFO: Finished server process [268] INFO: Stopping reloader process [26028]

D:\work\thunder.com.cn\github\screenshot-to-code\backend>

D:\work\thunder.com.cn\github\screenshot-to-code\backend>

D:\work\thunder.com.cn\github\screenshot-to-code\backend> poetry run uvicorn main:app --reload --port 7001 INFO: Will watch for changes in these directories: ['D:\work\thunder.com.cn\github\screenshot-to-code\backend'] INFO: Uvicorn running on http://127.0.0.1:7001 (Press CTRL+C to quit) INFO: Started reloader process [25108] using StatReload INFO: Started server process [26584] INFO: Waiting for application startup. INFO: Application startup complete. INFO: ('127.0.0.1', 3481) - "WebSocket /generate-code" [accepted] Incoming websocket connection... INFO: connection open Received params Using anthropicApiKey from environment variable Using openAiBaseURL from environment variable Generating vue_tailwind 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 "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response
async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request
raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} Traceback (most recent call last): File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response
async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request
raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\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\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().call(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\applications.py", line 113, in call await self.middleware_stack(scope, receive, send)
File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\errors.py", line 152, in call
await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\cors.py", line 77, in call
await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 715, in call await self.middleware_stack(scope, receive, send)
File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 735, in app await route.handle(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 362, in handle await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 95, in app await wrap_app_handling_exceptions(app, session)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app tarlette\routing.py", line 93, in app await func(session) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\routing.py", line 383, in app await dependant.call(**solved_result.values) File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\routes\generate_code.py", line 354, in stream_code raise Exception("All generations failed") Exception: All generations failed INFO: connection closed WARNING: StatReload detected changes in 'config.py'. Reloading... INFO: ('127.0.0.1', 12326) - "WebSocket /generate-code" [accepted] Incoming websocket connection... INFO: connection open INFO: Shutting down ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\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\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().call(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\applications.py", line 113, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\errors.py", line 152, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\cors.py", line 77, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 715, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 735, in app await route.handle(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 362, in handle await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 95, in app await wrap_app_handling_exceptions(app, session)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 93, in app await func(session) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\routing.py", line 383, in app await dependant.call(**solved_result.values) File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\routes\generate_code.py", line 190, in stream_code params: dict[str, str] = await websocket.receive_json() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\websockets.py", line 135, in receive_json self._raise_on_disconnect(message) ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\websockets.py", line 113, in _raise_on_disconnect raise WebSocketDisconnect(message["code"], message.get("reason")) starlette.websockets.WebSocketDisconnect: (1012, None) INFO: connection closed INFO: Waiting for application shutdown. INFO: Application shutdown complete. INFO: Finished server process [26584] INFO: Started server process [24308] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Shutting down INFO: Waiting for application shutdown. INFO: Application shutdown complete. INFO: Finished server process [24308] INFO: Stopping reloader process [25108]

D:\work\thunder.com.cn\github\screenshot-to-code\backend> D:\work\thunder.com.cn\github\screenshot-to-code\backend> D:\work\thunder.com.cn\github\screenshot-to-code\backend> D:\work\thunder.com.cn\github\screenshot-to-code\backend> D:\work\thunder.com.cn\github\screenshot-to-code\backend>poetry run uvicorn main:app --reload --port 7001 INFO: Will watch for changes in these directories: ['D:\work\thunder.com.cn\github\screenshot-to-code\backend'] INFO: Uvicorn running on http://127.0.0.1:7001 (Press CTRL+C to quit) INFO: Started reloader process [11248] using StatReload INFO: Started server process [10500] INFO: Waiting for application startup. INFO: Application startup complete. INFO: ('127.0.0.1', 12381) - "WebSocket /generate-code" [accepted] Incoming websocket connection... INFO: connection open Received params Using anthropicApiKey from environment variable Using openAiBaseURL from environment variable Generating vue_tailwind 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 "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} Traceback (most recent call last): File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\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\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().call(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\applications.py", line 113, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\errors.py", line 152, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\cors.py", line 77, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 715, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 735, in app await route.handle(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 362, in handle await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 95, in app await wrap_app_handling_exceptions(app, session)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 93, in app await func(session) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\routing.py", line 383, in app await dependant.call(**solved_result.values) File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\routes\generate_code.py", line 354, in stream_code raise Exception("All generations failed") Exception: All generations failed INFO: connection closed INFO: ('127.0.0.1', 3755) - "WebSocket /generate-code" [accepted] Incoming websocket connection... INFO: connection open Received params Using anthropicApiKey from environment variable Using openAiBaseURL from environment variable Generating vue_tailwind 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 "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} Traceback (most recent call last): File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\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\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().call(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\applications.py", line 113, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\errors.py", line 152, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\cors.py", line 77, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 715, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 735, in app await route.handle(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 362, in handle await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 95, in app await wrap_app_handling_exceptions(app, session)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 93, in app await func(session) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\routing.py", line 383, in app await dependant.call(**solved_result.values) File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\routes\generate_code.py", line 354, in stream_code raise Exception("All generations failed") Exception: All generations failed INFO: connection closed INFO: Shutting down INFO: Waiting for application shutdown. INFO: Application shutdown complete. INFO: Finished server process [10500] INFO: Stopping reloader process [11248]

D:\work\thunder.com.cn\github\screenshot-to-code\backend>

D:\work\thunder.com.cn\github\screenshot-to-code\backend>

D:\work\thunder.com.cn\github\screenshot-to-code\backend>poetry install --no-root
Installing dependencies from lock file

No dependencies to install or update

D:\work\thunder.com.cn\github\screenshot-to-code\backend>poetry shell

Looks like you're trying to use a Poetry command that is not available.

Since Poetry (2.0.0), the shell command is not installed by default. You can use,

  • the new env activate command (recommended); or
  • the shell plugin to install the shell command

Documentation: https://python-poetry.org/docs/managing-environments/#activating-the-environment

Note that the env activate command is not a direct replacement for shell command.

D:\work\thunder.com.cn\github\screenshot-to-code\backend>env activate 'env' 不是内部或外部命令,也不是可运行的程序 或批处理文件。

D:\work\thunder.com.cn\github\screenshot-to-code\backend>poetry install --no-root Installing dependencies from lock file

No dependencies to install or update

D:\work\thunder.com.cn\github\screenshot-to-code\backend> poetry shell

Looks like you're trying to use a Poetry command that is not available.

Since Poetry (2.0.0), the shell command is not installed by default. You can use,

  • the new env activate command (recommended); or
  • the shell plugin to install the shell command

Documentation: https://python-poetry.org/docs/managing-environments/#activating-the-environment

Note that the env activate command is not a direct replacement for shell command.

D:\work\thunder.com.cn\github\screenshot-to-code\backend>poetry run uvicorn main:app --reload --port 7001 INFO: Will watch for changes in these directories: ['D:\work\thunder.com.cn\github\screenshot-to-code\backend'] INFO: Uvicorn running on http://127.0.0.1:7001 (Press CTRL+C to quit) INFO: Started reloader process [21508] using StatReload INFO: Started server process [14500] INFO: Waiting for application startup. INFO: Application startup complete. INFO: ('127.0.0.1', 6808) - "WebSocket /generate-code" [accepted] Incoming websocket connection... INFO: connection open Received params Using anthropicApiKey from environment variable Using openAiBaseURL from environment variable Generating vue_tailwind 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 "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} Traceback (most recent call last): File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\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\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().call(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\applications.py", line 113, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\errors.py", line 152, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\cors.py", line 77, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 715, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 735, in app await route.handle(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 362, in handle await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 95, in app await wrap_app_handling_exceptions(app, session)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 93, in app await func(session) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\routing.py", line 383, in app await dependant.call(**solved_result.values) File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\routes\generate_code.py", line 354, in stream_code raise Exception("All generations failed") Exception: All generations failed INFO: connection closed INFO: ('127.0.0.1', 5156) - "WebSocket /generate-code" [accepted] Incoming websocket connection... INFO: connection open Received params Using anthropicApiKey from environment variable Using openAiBaseURL from environment variable Generating vue_tailwind 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 "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} Traceback (most recent call last): File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\llm.py", line 150, in stream_claude_response async with client.beta.messages.stream( ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ model=model.value, ^^^^^^^^^^^^^^^^^^ ...<4 lines>... betas=["output-128k-2025-02-19"], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as stream: ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic\lib\streaming_beta_messages.py", line 288, in aenter raw_stream = await self.__api_request ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1920, in post return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1614, in request return await self._request( ^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\anthropic_base_client.py", line 1715, in _request raise self._make_status_error_from_response(err.response) from None anthropic.PermissionDeniedError: Error code: 403 - {'error': {'type': 'forbidden', 'message': 'Request not allowed'}} ERROR: Exception in ASGI application Traceback (most recent call last): File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\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\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\applications.py", line 1054, in call await super().call(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\applications.py", line 113, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\errors.py", line 152, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\cors.py", line 77, in call await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 715, in call await self.middleware_stack(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 735, in app await route.handle(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 362, in handle await self.app(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 95, in app await wrap_app_handling_exceptions(app, session)(scope, receive, send) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app raise exc File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette_exception_handler.py", line 42, in wrapped_app await app(scope, receive, sender) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\starlette\routing.py", line 93, in app await func(session) File "C:\Users\zhangpanfeng\AppData\Local\pypoetry\Cache\virtualenvs\backend-6N9em1eU-py3.13\Lib\site-packages\fastapi\routing.py", line 383, in app await dependant.call(**solved_result.values) File "D:\work\thunder.com.cn\github\screenshot-to-code\backend\routes\generate_code.py", line 354, in stream_code raise Exception("All generations failed") Exception: All generations failed INFO: connection closed `

henan01 avatar Mar 21 '25 03:03 henan01