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

@@ -13,7 +13,6 @@ from ai_manager import ModelType, PredictionType, get_ai_manager
# Add backend directory to path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
def test_custom_model():
"""测试自定义模型功能"""
print("\n=== 测试自定义模型 ===")
@@ -88,7 +87,6 @@ def test_custom_model():
return model.id
async def test_train_and_predict(model_id: str):
"""测试训练和预测"""
print("\n=== 测试模型训练和预测 ===")
@@ -115,7 +113,6 @@ async def test_train_and_predict(model_id: str):
except Exception as e:
print(f" 预测失败: {e}")
def test_prediction_models():
"""测试预测模型"""
print("\n=== 测试预测模型 ===")
@@ -157,7 +154,6 @@ def test_prediction_models():
return trend_model.id, anomaly_model.id
async def test_predictions(trend_model_id: str, anomaly_model_id: str):
"""测试预测功能"""
print("\n=== 测试预测功能 ===")
@@ -192,7 +188,6 @@ async def test_predictions(trend_model_id: str, anomaly_model_id: str):
)
print(f" 检测结果: {anomaly_result.prediction_data}")
def test_kg_rag():
"""测试知识图谱 RAG"""
print("\n=== 测试知识图谱 RAG ===")
@@ -222,7 +217,6 @@ def test_kg_rag():
return rag.id
async def test_kg_rag_query(rag_id: str):
"""测试 RAG 查询"""
print("\n=== 测试知识图谱 RAG 查询 ===")
@@ -293,7 +287,6 @@ async def test_kg_rag_query(rag_id: str):
except Exception as e:
print(f" 查询失败: {e}")
async def test_smart_summary():
"""测试智能摘要"""
print("\n=== 测试智能摘要 ===")
@@ -341,7 +334,6 @@ async def test_smart_summary():
except Exception as e:
print(f" 生成失败: {e}")
async def main():
"""主测试函数"""
print("=" * 60)
@@ -380,6 +372,5 @@ async def main():
traceback.print_exc()
if __name__ == "__main__":
asyncio.run(main())