fix: auto-fix code issues (cron)

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

View File

@@ -27,7 +27,6 @@ import httpx
# Database path
DB_PATH = os.path.join(os.path.dirname(__file__), "insightflow.db")
class ModelType(StrEnum):
"""模型类型"""
@@ -36,7 +35,6 @@ class ModelType(StrEnum):
SUMMARIZATION = "summarization" # 摘要
PREDICTION = "prediction" # 预测
class ModelStatus(StrEnum):
"""模型状态"""
@@ -46,7 +44,6 @@ class ModelStatus(StrEnum):
FAILED = "failed"
ARCHIVED = "archived"
class MultimodalProvider(StrEnum):
"""多模态模型提供商"""
@@ -55,7 +52,6 @@ class MultimodalProvider(StrEnum):
GEMINI = "gemini-pro-vision"
KIMI_VL = "kimi-vl"
class PredictionType(StrEnum):
"""预测类型"""
@@ -64,7 +60,6 @@ class PredictionType(StrEnum):
ENTITY_GROWTH = "entity_growth" # 实体增长预测
RELATION_EVOLUTION = "relation_evolution" # 关系演变预测
@dataclass
class CustomModel:
"""自定义模型"""
@@ -84,7 +79,6 @@ class CustomModel:
trained_at: str | None
created_by: str
@dataclass
class TrainingSample:
"""训练样本"""
@@ -96,7 +90,6 @@ class TrainingSample:
metadata: dict
created_at: str
@dataclass
class MultimodalAnalysis:
"""多模态分析结果"""
@@ -113,7 +106,6 @@ class MultimodalAnalysis:
cost: float
created_at: str
@dataclass
class KnowledgeGraphRAG:
"""基于知识图谱的 RAG 配置"""
@@ -130,7 +122,6 @@ class KnowledgeGraphRAG:
created_at: str
updated_at: str
@dataclass
class RAGQuery:
"""RAG 查询记录"""
@@ -146,7 +137,6 @@ class RAGQuery:
latency_ms: int
created_at: str
@dataclass
class PredictionModel:
"""预测模型"""
@@ -166,7 +156,6 @@ class PredictionModel:
created_at: str
updated_at: str
@dataclass
class PredictionResult:
"""预测结果"""
@@ -182,7 +171,6 @@ class PredictionResult:
is_correct: bool | None
created_at: str
@dataclass
class SmartSummary:
"""智能摘要"""
@@ -200,7 +188,6 @@ class SmartSummary:
tokens_used: int
created_at: str
class AIManager:
"""AI 能力管理主类"""
@@ -1500,11 +1487,9 @@ class AIManager:
created_at=row["created_at"],
)
# Singleton instance
_ai_manager = None
def get_ai_manager() -> AIManager:
global _ai_manager
if _ai_manager is None: