#!/usr/bin/env python3 """Regenerate G column for all components from Row 152 onwards — strict skill formats.""" import subprocess, json APP_SECRET = json.load(open('/root/.openclaw/credentials/xiaoyan/config.json'))['apps'][0]['appSecret'] r = subprocess.run(['curl', '-s', '-X', 'POST', 'https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal', '-H', 'Content-Type: application/json', '-d', json.dumps({"app_id": "cli_a931175d41799cc7", "app_secret": APP_SECRET})], capture_output=True, text=True) TOKEN = json.loads(r.stdout)['tenant_access_token'] SST = 'DCcKsLbrmhfXgrtB7N2c9GA4ntf' SID = 'wMQVyV' configs = [ # === Row 161: 对话挖空 (1217511) === (161, """【任务标题】你明白了什么? 【资源配置】无 【情境引入】Ben : Speedy Monkey? School? Gift? 【互动内容】Ben! I think I ___!(音频) 选项1:understand(正确) 选项2:talk 【互动反馈】 正确 Ben : What do you understand? 错误 Ben : Think about the marks on the blackboard again. 【后置对话】无"""), # === Row 168: 对话挖空 (1217512) === (168, """【任务标题】和 Ben 单独聊聊 【资源配置】无 【情境引入】Ben : What do you think it means? 【互动内容】We need to ___! You and me!(音频) 选项1:talk(正确) 选项2:point 【互动反馈】 正确 Ben : Okay. Let's figure this out together. 错误 Ben : We need to do more than just point. Let's talk. 【后置对话】无"""), # === Row 181: 对话选读 (1217513) === (181, """【任务标题】向镇长求助 【资源配置】无 【情境引入】Ben : What should we do now? 【互动内容】 要求:选择一个你想表达的观点 选项: 选项1:We need to call Mayor Tom! Let's talk about it! - 反馈 Ben : Good idea. Let's call him now! 选项2:We need to go find more proof first. - 反馈 Ben : Hmm, we already have enough proof. Let's take action. 选项3:Let's keep watching the robot for now. - 反馈 Ben : No, we need to do something fast! 【后置对话】无"""), # === Row 194: 对话挖空 (1217514) === (194, """【任务标题】指给镇长看 【资源配置】无 【情境引入】Tom : Where is the spy? 【互动内容】Look! I ___ at it.(音频) 选项1:point(正确) 选项2:talk 【互动反馈】 正确 Tom : The robot? You think it is a spy? 错误 Tom : What are you doing? Show me. 【后置对话】无"""), # === Row 207: 对话组句 (1217515) === (207, """【任务标题】给镇长看黑板上的证据 【资源配置】无 【情境引入】Tom : I don't understand. Anything else? 【互动内容】 题目:告诉镇长:你看,黑板上有很多奇怪的记号! Look! Here are a lot of strange marks!(音频) 选项1:Look 选项2:Here 选项3:are 选项4:a lot of 选项5:strange 选项6:marks 答案:Look! Here are a lot of strange marks! 辅助信息:用 a lot of 表示"很多";Look 引导祈使句 【互动反馈】 正确 Tom : Hmm, I see. Let me take a closer look. 错误 Tom : Try again. Use all the words to make a full sentence. 【后置对话】无"""), # === Row 224: 对话选读 (1217516) === (224, """【任务标题】到底怎么回事? 【资源配置】无 【情境引入】Tom : The school isn't a gift to Speedy Monkey! 【互动内容】 要求:选择一个你想表达的观点 选项: 选项1:Wait. I don't understand. - 反馈 Tom : Let these two workers explain everything. 选项2:Then what is the robot doing here? - 反馈 Tom : Good question. Let the workers tell you. 选项3:I knew it was all wrong! - 反馈 Tom : Yes, you were wrong. Now listen carefully. 【后置对话】无"""), # === Row 245: 看图说话 (1217517) === (245, """【任务标题】向 Jay 和 Lin 道歉 【任务背景】 你之前误会了 Jay 和 Lin 是坏人,现在你需要向他们真诚道歉,表达你的歉意。 【任务描述】 你需要对 Jay 和 Lin 说出你的歉意和反思。 【知识】 I should talk to you. 我应该和你谈谈。 I should understand you. 我应该理解你。 I can understand you now. 我现在能理解你了。 【对话角色】 Lin, Jay 【角色背景】 你是 Lin 和 Jay,你们因为长相凶恶经常被误会。现在有两个孩子来向你们道歉了。 【互动问题】 #图片编号:00 Q: What do you want to say to us? A: I should talk to you. Q: What else? A: I should understand you. Q: And now? A: I can understand you now. 【通过规则】 用户说出: 1. 我应该和你谈谈 2. 我应该理解你 3. 我现在能理解你了 【示例对话】 Lin: What do you want to say to us? User: I should talk to you. Jay: What else? User: I should understand you. Lin: And now? User: I can understand you now. Jay: Thank you. We feel much better. Lin: I understand. We all make mistakes.""") ] success = fail = 0 for row, text in configs: cell = f"{SID}!G{row}:G{row}" body = json.dumps({"valueRange": {"range": cell, "values": [[text]]}}, ensure_ascii=False) r = subprocess.run(['curl', '-s', '-X', 'PUT', f'https://open.feishu.cn/open-apis/sheets/v2/spreadsheets/{SST}/values', '-H', f'Authorization: Bearer {TOKEN}', '-H', 'Content-Type: application/json; charset=utf-8', '-d', body], capture_output=True, text=True, timeout=10) resp = json.loads(r.stdout) title = text.split('\n')[0].replace('【任务标题】', '') if resp.get('code') == 0: success += 1 print(f' ✅ Row {row:3d} | {title}') else: fail += 1 print(f' ❌ Row {row:3d} | {resp.get("msg","?")}') print(f'\n写入结果:{success}成功 / {fail}失败') if fail == 0: print('\n=== 回读验证 ===') import re for row, _ in configs: cell = f"{SID}!G{row}:G{row}" r = subprocess.run(['curl', '-s', '-X', 'GET', f'https://open.feishu.cn/open-apis/sheets/v2/spreadsheets/{SST}/values/{cell}?valueRenderOption=ToString', '-H', f'Authorization: Bearer {TOKEN}'], capture_output=True, text=True, timeout=10) resp = json.loads(r.stdout) vals = resp.get('data',{}).get('valueRange',{}).get('values',[[]]) content = vals[0][0] if vals and vals[0] else '' m = re.search(r'【任务标题】([^\n]*)', content) title = m.group(1) if m else '(empty)' print(f' ✅ Row{row}: {title}')