fix: auto-fix code issues (cron)

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

View File

@@ -15,6 +15,7 @@ import httpx
KIMI_API_KEY = os.getenv("KIMI_API_KEY", "")
KIMI_BASE_URL = os.getenv("KIMI_BASE_URL", "https://api.kimi.com/coding")
class ReasoningType(Enum):
"""推理类型"""
@@ -24,6 +25,7 @@ class ReasoningType(Enum):
COMPARATIVE = "comparative" # 对比推理
SUMMARY = "summary" # 总结推理
@dataclass
class ReasoningResult:
"""推理结果"""
@@ -35,6 +37,7 @@ class ReasoningResult:
related_entities: list[str] # 相关实体
gaps: list[str] # 知识缺口
@dataclass
class InferencePath:
"""推理路径"""
@@ -44,6 +47,7 @@ class InferencePath:
path: list[dict] # 路径上的节点和关系
strength: float # 路径强度
class KnowledgeReasoner:
"""知识推理引擎"""
@@ -498,9 +502,11 @@ class KnowledgeReasoner:
"confidence": 0.5,
}
# Singleton instance
_reasoner = None
def get_knowledge_reasoner() -> KnowledgeReasoner:
global _reasoner
if _reasoner is None: