diff --git a/backend/ai_manager.py b/backend/ai_manager.py index 1a6bdef..87e6196 100644 --- a/backend/ai_manager.py +++ b/backend/ai_manager.py @@ -8,14 +8,14 @@ AI 能力增强模块 - 预测性分析(趋势预测、异常检测) """ -import re - import asyncio import json import os import random +import re import sqlite3 import statistics +import time import uuid from collections import defaultdict from dataclasses import dataclass @@ -430,8 +430,6 @@ class AIManager: content = result["choices"][0]["message"]["content"] # 解析 JSON - import re - json_match = re.search(r"\[.*?\]", content, re.DOTALL) if json_match: try: @@ -689,8 +687,6 @@ class AIManager: self, rag_id: str, query: str, project_entities: list[dict], project_relations: list[dict] ) -> RAGQuery: """基于知识图谱的 RAG 查询""" - import time - start_time = time.time() rag = self.get_kg_rag(rag_id) diff --git a/backend/export_manager.py b/backend/export_manager.py index 3f379cf..e8142ab 100644 --- a/backend/export_manager.py +++ b/backend/export_manager.py @@ -275,8 +275,6 @@ class ExportManager: Returns: CSV 字符串 """ - import csv - output = io.StringIO() # 收集所有可能的属性列 diff --git a/backend/knowledge_reasoner.py b/backend/knowledge_reasoner.py index ec4985c..47b9989 100644 --- a/backend/knowledge_reasoner.py +++ b/backend/knowledge_reasoner.py @@ -115,8 +115,6 @@ class KnowledgeReasoner: content = await self._call_llm(prompt, temperature=0.1) - import re - json_match = re.search(r"\{{.*?\}}", content, re.DOTALL) if json_match: try: diff --git a/backend/plugin_manager.py b/backend/plugin_manager.py index 7e9e141..d4b72f9 100644 --- a/backend/plugin_manager.py +++ b/backend/plugin_manager.py @@ -11,7 +11,6 @@ import json import os import sqlite3 import time -import urllib.request import uuid from dataclasses import dataclass, field from datetime import datetime diff --git a/backend/test_phase8_task8.py b/backend/test_phase8_task8.py index 323b057..3cb9bff 100644 --- a/backend/test_phase8_task8.py +++ b/backend/test_phase8_task8.py @@ -321,7 +321,6 @@ class TestOpsManager: try: # 记录历史指标数据 - import random base_time = datetime.now() - timedelta(days=30) for i in range(30): timestamp = (base_time + timedelta(days=i)).isoformat() diff --git a/backend/workflow_manager.py b/backend/workflow_manager.py index 6ce1cad..7837024 100644 --- a/backend/workflow_manager.py +++ b/backend/workflow_manager.py @@ -13,7 +13,6 @@ import asyncio import base64 import hashlib import hmac -import urllib.request import json import logging import uuid