fix: auto-fix code issues (cron)
- 修复重复导入/字段 - 修复异常处理 - 修复PEP8格式问题 - 添加类型注解
This commit is contained in:
@@ -27,6 +27,7 @@ import httpx
|
||||
# Database path
|
||||
DB_PATH = os.path.join(os.path.dirname(__file__), "insightflow.db")
|
||||
|
||||
|
||||
class ModelType(StrEnum):
|
||||
"""模型类型"""
|
||||
|
||||
@@ -35,6 +36,7 @@ class ModelType(StrEnum):
|
||||
SUMMARIZATION = "summarization" # 摘要
|
||||
PREDICTION = "prediction" # 预测
|
||||
|
||||
|
||||
class ModelStatus(StrEnum):
|
||||
"""模型状态"""
|
||||
|
||||
@@ -44,6 +46,7 @@ class ModelStatus(StrEnum):
|
||||
FAILED = "failed"
|
||||
ARCHIVED = "archived"
|
||||
|
||||
|
||||
class MultimodalProvider(StrEnum):
|
||||
"""多模态模型提供商"""
|
||||
|
||||
@@ -52,6 +55,7 @@ class MultimodalProvider(StrEnum):
|
||||
GEMINI = "gemini-pro-vision"
|
||||
KIMI_VL = "kimi-vl"
|
||||
|
||||
|
||||
class PredictionType(StrEnum):
|
||||
"""预测类型"""
|
||||
|
||||
@@ -60,6 +64,7 @@ class PredictionType(StrEnum):
|
||||
ENTITY_GROWTH = "entity_growth" # 实体增长预测
|
||||
RELATION_EVOLUTION = "relation_evolution" # 关系演变预测
|
||||
|
||||
|
||||
@dataclass
|
||||
class CustomModel:
|
||||
"""自定义模型"""
|
||||
@@ -79,6 +84,7 @@ class CustomModel:
|
||||
trained_at: str | None
|
||||
created_by: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class TrainingSample:
|
||||
"""训练样本"""
|
||||
@@ -90,6 +96,7 @@ class TrainingSample:
|
||||
metadata: dict
|
||||
created_at: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class MultimodalAnalysis:
|
||||
"""多模态分析结果"""
|
||||
@@ -106,6 +113,7 @@ class MultimodalAnalysis:
|
||||
cost: float
|
||||
created_at: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class KnowledgeGraphRAG:
|
||||
"""基于知识图谱的 RAG 配置"""
|
||||
@@ -122,6 +130,7 @@ class KnowledgeGraphRAG:
|
||||
created_at: str
|
||||
updated_at: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class RAGQuery:
|
||||
"""RAG 查询记录"""
|
||||
@@ -137,6 +146,7 @@ class RAGQuery:
|
||||
latency_ms: int
|
||||
created_at: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class PredictionModel:
|
||||
"""预测模型"""
|
||||
@@ -156,6 +166,7 @@ class PredictionModel:
|
||||
created_at: str
|
||||
updated_at: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class PredictionResult:
|
||||
"""预测结果"""
|
||||
@@ -171,6 +182,7 @@ class PredictionResult:
|
||||
is_correct: bool | None
|
||||
created_at: str
|
||||
|
||||
|
||||
@dataclass
|
||||
class SmartSummary:
|
||||
"""智能摘要"""
|
||||
@@ -188,6 +200,7 @@ class SmartSummary:
|
||||
tokens_used: int
|
||||
created_at: str
|
||||
|
||||
|
||||
class AIManager:
|
||||
"""AI 能力管理主类"""
|
||||
|
||||
@@ -1487,9 +1500,11 @@ 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:
|
||||
|
||||
Reference in New Issue
Block a user