feat: v1.2.0 - 图片去重与管理、微信机器人优化、搜索设置可配置
主要功能: - 图片上传时 OCR 内容去重(3个上传端点统一使用公共函数 _check_ocr_duplicate) - 图片管理 Tab:展示所有图片、手动删除、一键去重 - 搜索结果详情弹窗增加删除按钮(带确认弹窗) - 图片管理卡片点击查看详情(复用 showOcrDetailModal) - 搜索限制和 LLM 批量判断数量可通过网站设置 - MiniMax API 调用添加 reasoning_split=True - 企业微信机器人:WebSocket 长连接、图片搜索、配置化搜索数量 - 版本号升级至 1.2.0
This commit is contained in:
47
app/schemas/ocr.py
Normal file
47
app/schemas/ocr.py
Normal file
@@ -0,0 +1,47 @@
|
||||
"""
|
||||
OCR 相关的 Pydantic Schema
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class OCRBlockSchema(BaseModel):
|
||||
"""OCR 识别的文本块"""
|
||||
text: str = Field(..., description="文本块内容")
|
||||
bbox: Optional[list[float]] = Field(None, description="边界框 [x1, y1, x2, y2]")
|
||||
confidence: float = Field(..., description="置信度 (0-1)")
|
||||
|
||||
|
||||
class OCRResultSchema(BaseModel):
|
||||
"""OCR 识别结果"""
|
||||
text: str = Field(..., description="识别全文")
|
||||
blocks: list[OCRBlockSchema] = Field(default_factory=list, description="文本块列表")
|
||||
confidence: float = Field(..., description="平均置信度 (0-1)")
|
||||
provider: str = Field(..., description="使用的 OCR 提供商")
|
||||
|
||||
|
||||
class ImageUploadResponse(BaseModel):
|
||||
"""图片上传响应"""
|
||||
id: int
|
||||
file_path: str
|
||||
status: str
|
||||
created_at: datetime
|
||||
model_config = {"from_attributes": True}
|
||||
|
||||
|
||||
class ImageOCRResponse(BaseModel):
|
||||
"""图片 OCR 结果响应"""
|
||||
id: int
|
||||
file_path: str
|
||||
ocr_text: Optional[str] = None
|
||||
confidence: Optional[float] = None
|
||||
provider: Optional[str] = None
|
||||
status: str
|
||||
error_message: Optional[str] = None
|
||||
created_at: datetime
|
||||
model_config = {"from_attributes": True}
|
||||
Reference in New Issue
Block a user