-
Notifications
You must be signed in to change notification settings - Fork 39
feat: implement PaddleOCR adapter with Baidu Qianfan protocol support for PDF OCR #459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
feat: implement PaddleOCR adapter with Baidu Qianfan protocol support for PDF OCR #459
Conversation
|
@claude 检查提交的代码,使用中文回复 |
|
Claude finished @szl97's task —— View job 代码审查任务清单
代码审查结果✅ 总体评价这是一个高质量的PaddleOCR PDF OCR功能实现,代码结构清晰,遵循了现有的架构模式。整体实现符合项目的编码规范和设计原则。 🔍 详细审查反馈1. 架构设计 (优秀)
2. 请求处理逻辑 (良好,有改进空间)优点:
建议改进: // api/server/src/main/java/com/ke/bella/openapi/protocol/ocr/general/PaddleOCRAdaptor.java:84-89
if (extraBody == null || !extraBody.containsKey("fileType")) {
throw new IllegalArgumentException(
"fileType is required when using file_id. " +
"Please specify fileType in request body: 0 for PDF, 1 for image"
);
}问题: 异常信息使用英文,建议本地化为中文以保持一致性 3. 输入验证 (优秀)
4. 内存管理 (优秀)
// api/server/src/main/java/com/ke/bella/openapi/protocol/ocr/general/PaddleOCRRequest.java:99-105
@Override
public void clearLargeData() {
if (!isCleared()) {
this.file = null;
super.clearLargeData();
}
}
5. 错误处理 (良好)响应转换逻辑: // api/server/src/main/java/com/ke/bella/openapi/protocol/ocr/general/PaddleOCRAdaptor.java:171-182
private OcrGeneralResponse responseConvert(PaddleOCRResponse response) {
if (response.getError() != null) {
return buildErrorResponse(response);
}
return OcrGeneralResponse.builder()
.requestId(response.getId())
.data(response.getResult())
.build();
}
6. 代码规范 (优秀)
|
| // 2. file (URL) → 直接使用 | ||
| // 3. file (Base64) → 需要 fileType | ||
|
|
||
| if (StringUtils.hasText(request.getFileId())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不太清楚ocr其他渠道对file的要求,感觉这个多种file的转换适合往外部放一放?(如果有别的渠道也需要的话) 可以先不动
No description provided.