fix: auto-fix code issues - duplicate imports and unused imports
- 移除函数内部的重复 import re - 移除函数内部的重复 import csv - 移除函数内部的重复 import random - 移除未使用的 urllib.request 导入 - 添加缺失的 time 导入到 ai_manager.py
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -275,8 +275,6 @@ class ExportManager:
|
||||
Returns:
|
||||
CSV 字符串
|
||||
"""
|
||||
import csv
|
||||
|
||||
output = io.StringIO()
|
||||
|
||||
# 收集所有可能的属性列
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -13,7 +13,6 @@ import asyncio
|
||||
import base64
|
||||
import hashlib
|
||||
import hmac
|
||||
import urllib.request
|
||||
import json
|
||||
import logging
|
||||
import uuid
|
||||
|
||||
Reference in New Issue
Block a user