Browse Source

clean_agent

丁云鹏 5 days ago
parent
commit
544b18203e
2 changed files with 3 additions and 3 deletions
  1. 0 1
      agent.py
  2. 3 2
      agents/clean_agent/tools.py

+ 0 - 1
agent.py

@@ -472,7 +472,6 @@ async def extract(request: ExtractRequest):
             # 无论成功失败,都从运行集合中移除
             async with RUNNING_LOCK:
                 extraction_requests.discard(requestId)
-        logger.info(f"extract result={result}")
         return {"status": "success", "result": result}
     except Exception as e:
         # 发生异常,更新状态为处理失败

+ 3 - 2
agents/clean_agent/tools.py

@@ -17,7 +17,7 @@ from gemini import GeminiProcessor
 
 # 配置日志
 logging.basicConfig(level=logging.INFO)
-logger = logging.getLogger(__name__)
+logger = logging.getLogger("CleanTools")
 
 # 配置常量
 BATCH_SIZE = 5  # 分批处理大小
@@ -238,7 +238,8 @@ def batch_call_llm_for_evaluation(contents: list, query_word: str) -> list:
         # 处理返回结果
         evaluation_results = []
         for i, result in enumerate(results):
-            result = re.sub(r'^\s*```json|\s*```\s*$', '', result, flags=re.MULTILINE).strip()
+            # 只处理大括号外面的内容,保留JSON内部格式
+            result = re.sub(r'(^\s*```json)|(\s*```\s*$)', '', result, flags=re.MULTILINE).strip()
             result = json.loads(result)
             parsing_id = contents[i].id
             parsing_data = contents[i].parsing_data