fix: auto-fix code issues (cron)

- 修复重复导入/字段
- 修复异常处理
- 修复PEP8格式问题
- 添加类型注解
This commit is contained in:
OpenClaw Bot
2026-02-28 09:15:51 +08:00
parent 74c2daa5ef
commit 1a9b5391f7
37 changed files with 1112 additions and 19 deletions

View File

@@ -33,6 +33,7 @@ try:
except ImportError:
PYTESSERACT_AVAILABLE = False
@dataclass
class ImageEntity:
"""图片中检测到的实体"""
@@ -42,6 +43,7 @@ class ImageEntity:
confidence: float
bbox: tuple[int, int, int, int] | None = None # (x, y, width, height)
@dataclass
class ImageRelation:
"""图片中检测到的关系"""
@@ -51,6 +53,7 @@ class ImageRelation:
relation_type: str
confidence: float
@dataclass
class ImageProcessingResult:
"""图片处理结果"""
@@ -66,6 +69,7 @@ class ImageProcessingResult:
success: bool
error_message: str = ""
@dataclass
class BatchProcessingResult:
"""批量图片处理结果"""
@@ -75,6 +79,7 @@ class BatchProcessingResult:
success_count: int
failed_count: int
class ImageProcessor:
"""图片处理器 - 处理各种类型图片"""
@@ -548,9 +553,11 @@ class ImageProcessor:
print(f"Thumbnail generation error: {e}")
return image_data
# Singleton instance
_image_processor = None
def get_image_processor(temp_dir: str = None) -> ImageProcessor:
"""获取图片处理器单例"""
global _image_processor