Skip to content

Fix #263: 使用阿里的ocr服务,是否需要在配置里面加入OCR_ACCESS_KEY_ID和OCR_ACCESS_KEY_SECRET#277

Closed
JiwaniZakir wants to merge 1 commit intoX-PLUG:mainfrom
JiwaniZakir:fix/263-ocr-ocr-access-key-id-ocr-access-key-se
Closed

Fix #263: 使用阿里的ocr服务,是否需要在配置里面加入OCR_ACCESS_KEY_ID和OCR_ACCESS_KEY_SECRET#277
JiwaniZakir wants to merge 1 commit intoX-PLUG:mainfrom
JiwaniZakir:fix/263-ocr-ocr-access-key-id-ocr-access-key-se

Conversation

@JiwaniZakir
Copy link
Copy Markdown

Closes #263

Adds OCR_ACCESS_KEY_ID and OCR_ACCESS_KEY_SECRET as explicit fields in PC-Agent/config.json, and replaces direct dict access in run.py (lines ~122-123) with token_data.get(...) calls that raise a descriptive ValueError when either key is missing or empty, rather than silently producing a KeyError or passing empty strings to the Alibaba Cloud OCR client. This prevents the confusing timeout/connection error users encountered when the credentials were absent.

  • PC-Agent/config.json: added OCR_ACCESS_KEY_ID and OCR_ACCESS_KEY_SECRET placeholder fields
  • PC-Agent/run.py: replaced token_data['OCR_ACCESS_KEY_ID'] / token_data['OCR_ACCESS_KEY_SECRET'] with .get() calls and an explicit validation guard in the args.ocr_api == 1 branch

Verified by running with a missing OCR_ACCESS_KEY_ID in config.json to confirm the ValueError is raised immediately with a clear message, and by running with valid credentials to confirm the OCR path proceeds without regression.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@JiwaniZakir
Copy link
Copy Markdown
Author

Closing this PR as it hasn't received maintainer review. Happy to resubmit if there's interest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

使用阿里的ocr服务,是否需要在配置里面加入OCR_ACCESS_KEY_ID和OCR_ACCESS_KEY_SECRET

1 participant