ai_member_xiaoban/batch_analysis.py
2026-04-22 08:00:01 +08:00

57 lines
1.5 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import os
import subprocess
import json
# 用户ID列表
user_ids = [
10781,
20712,
20854,
25286,
26386,
26851,
27090,
27628,
28724,
28924,
28935,
28991,
29038,
29368,
29559
]
# 生成每个用户对应的Level
def get_level(user_id):
user_id_str = str(user_id)
if user_id_str.startswith('1'):
return 1
elif user_id_str.startswith('2'):
return 2
else:
return 1 # 默认Level1
# 尝试生成Unit1到Unit12的报告
max_unit = 12
script_path = "/root/.openclaw/workspace-xiaoban/skills/study-analysis/scripts/analysis.py"
for user_id in user_ids:
level = get_level(user_id)
print(f"\n=== 开始处理用户 {user_id} Level {level} ===")
for unit in range(1, max_unit + 1):
print(f"处理Unit {unit}...")
cmd = f"cd /root/.openclaw/workspace-xiaoban && python3 {script_path} {user_id} {level} {unit}"
try:
result = subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=30)
if result.returncode == 0:
print(f"✅ 用户{user_id} L{level} U{unit} 分析成功")
print(result.stdout.strip())
else:
print(f"❌ 用户{user_id} L{level} U{unit} 分析失败,跳过")
break # 如果当前Unit失败说明没有更多单元了跳出循环
except Exception as e:
print(f"❌ 用户{user_id} L{level} U{unit} 执行出错: {e}")
break
print("\n=== 所有用户处理完成 ===")