本次提交将woc-bridge项目重构为模块化包结构,按职责拆分多个子域: 1. 新增models层定义所有Pydantic数据模型与统一错误体系 2. 拆分db/ui/messaging/routes等业务域模块 3. 实现基础API路由:状态查询、截图、登录、媒体获取等 4. 重构tools脚本的模块导入路径 5. 补充版本号与能力清单定义 6. 完善全局配置与依赖管理 整体完成项目从单文件脚本到可维护的包结构迁移,为后续功能开发打下基础。
40 lines
983 B
Python
40 lines
983 B
Python
"""诊断域模型:连通性 / 诊断项 / 诊断执行结果。"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Optional
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# 诊断接口
|
|
# ---------------------------------------------------------------------------
|
|
class ConnectivityResponse(BaseModel):
|
|
"""连通性检查响应。"""
|
|
|
|
reachable: bool = False
|
|
latency_ms: int = 0
|
|
error: Optional[str] = None
|
|
|
|
|
|
class DiagnosticItem(BaseModel):
|
|
"""诊断项定义。"""
|
|
|
|
check_id: str
|
|
name: str
|
|
severity: str = Field(default="info", description="info / warning / critical")
|
|
description: str = ""
|
|
auto_repairable: bool = False
|
|
|
|
|
|
class DiagnosticRunResult(BaseModel):
|
|
"""诊断执行结果。"""
|
|
|
|
check_id: str
|
|
passed: bool = False
|
|
severity: str = "info"
|
|
message: str = ""
|
|
auto_repairable: bool = False
|
|
repair_plan: Optional[str] = None
|