wangyang 4 дней назад
Родитель
Сommit
e7701422ef
1 измененных файлов с 17 добавлено и 11 удалено
  1. 17 11
      llmops/batch_runner_all.py

+ 17 - 11
llmops/batch_runner_all.py

@@ -167,17 +167,7 @@ async def run_batch(runs: int, question: str, industry: str, data_file: str):
         print("❌ 未找到API密钥,请检查config.py")
         return
 
-    try:
-        # 执行数据标准化
-        standard_file_path = await data_standardize()
-        print(f"标准化后文件:{standard_file_path}")
-        data_file = standard_file_path
-        # 标准化数据加载
-        data = DataManager.load_data_from_csv_file(data_file)
-        print(f"📊 数据加载成功: {len(data)} 条记录")
-    except Exception as e:
-        print(f"❌ 数据加载失败: {e}")
-        return
+
 
     # 运行结果统计
     successful_runs = 0
@@ -190,7 +180,23 @@ async def run_batch(runs: int, question: str, industry: str, data_file: str):
     # 逐个运行
     for i in range(1, runs + 1):
         run_id = str(i)
+
+        # 设置环境变量,让所有agent使用正确的文件夹
+        os.environ['FLOW_RUN_ID'] = run_id
+
         start_time = time.perf_counter()
+        try:
+            # 执行数据标准化
+            standard_file_path = await data_standardize()
+            print(f"标准化后文件:{standard_file_path}")
+            data_file = standard_file_path
+            # 标准化数据加载
+            data = DataManager.load_data_from_csv_file(data_file)
+            print(f"📊 数据加载成功: {len(data)} 条记录")
+        except Exception as e:
+            print(f"❌ 数据加载失败: {e}")
+            return
+
         # 单次执行
         result = await run_single_flow(run_id, question, industry, data, os.path.basename(data_file))
         end_time = time.perf_counter()