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

@@ -14,6 +14,7 @@ from datetime import datetime
DB_PATH = os.getenv("DB_PATH", "/app/data/insightflow.db")
@dataclass
class Project:
id: str
@@ -22,6 +23,7 @@ class Project:
created_at: str = ""
updated_at: str = ""
@dataclass
class Entity:
id: str
@@ -42,6 +44,7 @@ class Entity:
if self.attributes is None:
self.attributes = {}
@dataclass
class AttributeTemplate:
"""属性模板定义"""
@@ -62,6 +65,7 @@ class AttributeTemplate:
if self.options is None:
self.options = []
@dataclass
class EntityAttribute:
"""实体属性值"""
@@ -82,6 +86,7 @@ class EntityAttribute:
if self.options is None:
self.options = []
@dataclass
class AttributeHistory:
"""属性变更历史"""
@@ -95,6 +100,7 @@ class AttributeHistory:
changed_at: str = ""
change_reason: str = ""
@dataclass
class EntityMention:
id: str
@@ -105,6 +111,7 @@ class EntityMention:
text_snippet: str
confidence: float = 1.0
class DatabaseManager:
def __init__(self, db_path: str = DB_PATH):
self.db_path = db_path
@@ -1385,9 +1392,11 @@ class DatabaseManager:
conn.close()
return stats
# Singleton instance
_db_manager = None
def get_db_manager() -> DatabaseManager:
global _db_manager
if _db_manager is None: