Initial commit: snapAna 截图智能整理工具
包含 FastAPI 后端、React 前端、队列/OCR/标签/待办等完整功能。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
"""通用 Schema:状态、统计、设置。"""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class StatsResp(BaseModel):
|
||||
total: int
|
||||
pending_ocr: int
|
||||
pending_ai: int
|
||||
failed: int
|
||||
by_category: list[dict[str, Any]]
|
||||
by_date: list[dict[str, Any]]
|
||||
|
||||
|
||||
class WatchFolderIn(BaseModel):
|
||||
path: str
|
||||
enabled: bool = True
|
||||
recursive: bool = True
|
||||
is_sensitive: bool = False
|
||||
|
||||
|
||||
class WatchFolderOut(WatchFolderIn):
|
||||
id: int
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class CategoryIn(BaseModel):
|
||||
name: str
|
||||
color: Optional[str] = None
|
||||
prompt_hint: Optional[str] = None
|
||||
|
||||
|
||||
class ProviderConfig(BaseModel):
|
||||
"""OCR/VLM Provider 配置。
|
||||
|
||||
type: openai_compat / tesseract / anthropic / none
|
||||
base_url、api_key、model 等都是可选的,按 provider 类型决定。
|
||||
"""
|
||||
|
||||
type: str
|
||||
base_url: Optional[str] = None
|
||||
api_key: Optional[str] = None
|
||||
model: Optional[str] = None
|
||||
extra: dict[str, Any] = {}
|
||||
|
||||
|
||||
class ProviderConfigOut(ProviderConfig):
|
||||
"""读取用:api_key 永远为空,只通过 api_key_mask 暴露提示。"""
|
||||
|
||||
api_key_mask: Optional[str] = None
|
||||
|
||||
|
||||
class RecognitionModeIn(BaseModel):
|
||||
"""文字识别策略:传统 OCR / 视觉 AI / 混合。"""
|
||||
|
||||
mode: str # ocr | vision | hybrid
|
||||
|
||||
|
||||
class ProviderTestResult(BaseModel):
|
||||
"""Provider 连通性测试结果。"""
|
||||
|
||||
ok: bool
|
||||
message: str
|
||||
detail: Optional[str] = None
|
||||
latency_ms: Optional[int] = None
|
||||
|
||||
|
||||
class TodoUpdate(BaseModel):
|
||||
status: Optional[str] = None
|
||||
title: Optional[str] = None
|
||||
note: Optional[str] = None
|
||||
Reference in New Issue
Block a user