fix: auto-fix code issues (cron)
- 修复重复导入/字段 - 修复异常处理 - 修复PEP8格式问题 - 添加类型注解
This commit is contained in:
@@ -209,7 +209,7 @@ class AIManager:
|
||||
self.openai_api_key = os.getenv("OPENAI_API_KEY", "")
|
||||
self.anthropic_api_key = os.getenv("ANTHROPIC_API_KEY", "")
|
||||
|
||||
def _get_db(self):
|
||||
def _get_db(self) -> None:
|
||||
"""获取数据库连接"""
|
||||
conn = sqlite3.connect(self.db_path)
|
||||
conn.row_factory = sqlite3.Row
|
||||
@@ -921,7 +921,6 @@ class AIManager:
|
||||
|
||||
# 解析关键要点
|
||||
key_points = []
|
||||
import re
|
||||
|
||||
# 尝试从 JSON 中提取
|
||||
json_match = re.search(r"\{.*?\}", content, re.DOTALL)
|
||||
@@ -1312,7 +1311,7 @@ class AIManager:
|
||||
|
||||
return [self._row_to_prediction_result(row) for row in rows]
|
||||
|
||||
def update_prediction_feedback(self, prediction_id: str, actual_value: str, is_correct: bool):
|
||||
def update_prediction_feedback(self, prediction_id: str, actual_value: str, is_correct: bool) -> None:
|
||||
"""更新预测反馈(用于模型改进)"""
|
||||
with self._get_db() as conn:
|
||||
conn.execute(
|
||||
|
||||
Reference in New Issue
Block a user