370 lines
13 KiB
Python
370 lines
13 KiB
Python
#!/usr/bin/env python3
|
||
"""Generate G列 component configs for L1-S2-U17-L5 笨蛋坏蛋? (English)"""
|
||
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'
|
||
|
||
# (row, config)
|
||
configs = [
|
||
# Row14: 互动 — point — 机器人指着黑板
|
||
(14, """【任务标题】What does it do?
|
||
【资源配置】无
|
||
【情境引入】Ben : See? I point at it.
|
||
【互动内容】
|
||
(听力挖空 / 看图回答)
|
||
User : It ___ at the blackboard.
|
||
答案词:points
|
||
KP:point — v. 指向
|
||
【互动反馈】
|
||
points 正确 → Ben : Yes. It points at the blackboard.
|
||
points 错误 → Ben : Look again. What does it do?
|
||
【后置对话】Ben : It talks a lot."""),
|
||
|
||
# Row28: 互动 — points — 补充描述机器人行为
|
||
(28, """【任务标题】Talk about the robot
|
||
【资源配置】无
|
||
【情境引入】Robot : Bip bop! Bip bop bip!
|
||
【互动内容】
|
||
(朗读台词)
|
||
User : It points at the blackboard.
|
||
KP:point — v. 指向
|
||
【互动反馈】
|
||
正确 → Ben : That's right. And what else?
|
||
错误 → Ben : Look at the robot. What is it pointing at?
|
||
【后置对话】Ben : And it talks to itself!"""),
|
||
|
||
# Row29: 互动 — talks to — 继续描述机器人
|
||
(29, """【任务标题】What else does it do?
|
||
【资源配置】无
|
||
【情境引入】Robot : Bip bop! Bip bop bip!
|
||
【互动内容】
|
||
(朗读台词)
|
||
User : It talks to itself...
|
||
KP:talk to... — 和...说话
|
||
【互动反馈】
|
||
正确 → Ben : It talks to itself!
|
||
错误 → Ben : Listen. Is the robot talking to someone?
|
||
【后置对话】Ben : ...in a language we can't understand!"""),
|
||
|
||
# Row36: 互动 — a lot of — 课桌挡路
|
||
(36, """【任务标题】What is blocking it?
|
||
【资源配置】无
|
||
【情境引入】Ben : What is it doing now?
|
||
【互动内容】
|
||
(听力挖空)
|
||
User : But ___ ___ ___ our desks block it.
|
||
答案词:a lot of
|
||
KP:a lot of — det. 大量的
|
||
【互动反馈】
|
||
a lot of 正确 → Ben : Yes! The desks are in its way.
|
||
a lot of 错误 → Ben : Many desks are blocking it.
|
||
【后置对话】场景:机器人推开桌椅"""),
|
||
|
||
# Row54: 互动 — a lot of — 需要证据
|
||
(54, """【任务标题】What do we need?
|
||
【资源配置】无
|
||
【情境引入】Ben : Fine. What should we do now?
|
||
【互动内容】
|
||
(听力挖空 / 朗读)
|
||
User : We need ___ ___ ___ proof!
|
||
答案词:a lot of
|
||
KP:a lot of — det. 大量的
|
||
【互动反馈】
|
||
正确 → Ben : Okay. We'll find more.
|
||
错误 → Ben : We need more than just a guess.
|
||
【后置对话】无"""),
|
||
|
||
# Row55: 互动 — talk to — 建议和机器人谈谈
|
||
(55, """【任务标题】What should we do?
|
||
【资源配置】无
|
||
【情境引入】User : We need a lot of proof!
|
||
【互动内容】
|
||
(朗读台词)
|
||
User : Let's talk to it!
|
||
KP:talk to... — 和...说话
|
||
【互动反馈】
|
||
正确 → Ben : Talk to it? But it's a robot!
|
||
错误 → Ben : How else can we find out?
|
||
【后置对话】Ben 从藏身处跳出来"""),
|
||
|
||
# Row61: 互动 — can't understand — 不懂机器人语言
|
||
(61, """【任务标题】Can you understand it?
|
||
【资源配置】无
|
||
【情境引入】Robot : Bip bop!
|
||
【互动内容】
|
||
(朗读台词)
|
||
User : We can't understand it.
|
||
KP:I can/can't understand...
|
||
【互动反馈】
|
||
正确 → Ben : Right. Let's try asking with pictures.
|
||
错误 → Ben : Can we understand robot language?
|
||
【后置对话】Ben : What's your name?"""),
|
||
|
||
# Row67: 互动 — understand — 理解了11的名字
|
||
(67, """【任务标题】What do you think?
|
||
【资源配置】无
|
||
【情境引入】Ben : What's your name?
|
||
Robot points at itself — it shows "11"
|
||
【互动内容】
|
||
(朗读台词)
|
||
User : Oh, I understand!
|
||
KP:understand — v. 理解
|
||
【互动反馈】
|
||
正确 → Ben : You understand? Tell me!
|
||
错误 → Ben : Do you know what it means?
|
||
【后置对话】User points out the number 11"""),
|
||
|
||
# Row68: 互动 — points to — 指出名字
|
||
(68, """【任务标题】What is it showing?
|
||
【资源配置】无
|
||
【情境引入】User : Oh, I understand!
|
||
【互动内容】
|
||
(朗读台词)
|
||
User : It points to its name.
|
||
KP:point — v. 指向
|
||
【互动反馈】
|
||
正确 → Ben : Its name is 11!
|
||
错误 → Ben : What is the robot showing us?
|
||
【后置对话】User : Its name is 11!"""),
|
||
|
||
# Row80: 互动 — talk — 建议慢慢说
|
||
(80, """【任务标题】How should we talk?
|
||
【资源配置】无
|
||
【情境引入】Ben is asking too many questions at once.
|
||
【互动内容】
|
||
(朗读台词)
|
||
User : Just talk slowly.
|
||
KP:talk — v. 说话
|
||
【互动反馈】
|
||
正确 → Ben : Okay. One question at a time.
|
||
错误 → Ben : Should I ask slower?
|
||
【后置对话】Ben : Alright. Where are you from?"""),
|
||
|
||
# Row85: 互动 — talk to — 尝试用画沟通
|
||
(85, """【任务标题】What is it doing?
|
||
【资源配置】无
|
||
【情境引入】Robot starts drawing on the blackboard.
|
||
【互动内容】
|
||
(朗读台词)
|
||
User : Oh! It tries to talk to us with drawing.
|
||
KP:talk to... — 和...说话
|
||
【互动反馈】
|
||
正确 → Ben : A picture! What is it?
|
||
错误 → Ben : What is it drawing? Is it a message?
|
||
【后置对话】Ben : That is the Speedy Monkey logo!"""),
|
||
|
||
# Row88: 互动 — understand — 理解来源
|
||
(88, """【任务标题】Where is it from?
|
||
【资源配置】无
|
||
【情境引入】Robot draws the Speedy Monkey logo.
|
||
【互动内容】
|
||
(朗读台词)
|
||
User : Oh! I understand! It is from Speedy Monkey!
|
||
KP:understand — v. 理解
|
||
【互动反馈】
|
||
正确 → Ben : Speedy Monkey! I knew it!
|
||
错误 → Ben : Who is that logo from?
|
||
【后置对话】Ben : Speedy monkey sent a spy here!"""),
|
||
|
||
# Row94: 互动 — talk — 要求继续
|
||
(94, """【任务标题】What next?
|
||
【资源配置】无
|
||
【情境引入】Ben thinks Speedy Monkey people are bad.
|
||
【互动内容】
|
||
(朗读台词)
|
||
User : Talk more to it!
|
||
KP:talk — v. 说话
|
||
【互动反馈】
|
||
正确 → Ben : Fine. What do you want?
|
||
错误 → Ben : Should we ask more questions?
|
||
【后置对话】Ben : Okay, what do you want?"""),
|
||
|
||
# Row98: 互动 — points at — 指另一个标记
|
||
(98, """【任务标题】What is it showing now?
|
||
【资源配置】无
|
||
【情境引入】Robot draws another mark on the blackboard.
|
||
【互动内容】
|
||
(朗读台词)
|
||
User : It points at another mark.
|
||
KP:point — v. 指向
|
||
【互动反馈】
|
||
正确 → Ben : What is that mark?
|
||
错误 → Ben : Look at what it is pointing at.
|
||
【后置对话】Ben : Is that... a school?"""),
|
||
|
||
# Row104: 互动 — points at — 又指一个标记
|
||
(104, """【任务标题】What is it now?
|
||
【资源配置】无
|
||
【情境引入】Ben : Why are you here?
|
||
Robot draws another mark.
|
||
【互动内容】
|
||
(朗读台词)
|
||
User : It points at another mark.
|
||
KP:point — v. 指向
|
||
【互动反馈】
|
||
正确 → Ben : A gift mark!
|
||
错误 → Ben : What does the drawing show?
|
||
【后置对话】Ben : It is a gift!"""),
|
||
|
||
# Row109: 互动 — understand — 我终于懂了
|
||
(109, """【任务标题】What do you think?
|
||
【资源配置】无
|
||
【情境引入】Robot drew Speedy Monkey, school, and gift marks.
|
||
【互动内容】
|
||
(朗读台词)
|
||
User : Ben! I think I understand!
|
||
KP:understand — v. 理解
|
||
【互动反馈】
|
||
正确 → Ben : What do you understand?
|
||
错误 → Ben : Think about the pictures again.
|
||
【后置对话】User explains the spy theory"""),
|
||
|
||
# Row110: 互动 — talk — 需要谈话
|
||
(110, """【任务标题】What should we do?
|
||
【资源配置】无
|
||
【情境引入】User thinks they've found a spy.
|
||
【互动内容】
|
||
(朗读台词)
|
||
User : We need to talk! You and me!
|
||
KP:talk — v. 说话
|
||
【互动反馈】
|
||
正确 → Ben : Okay! Let's figure this out.
|
||
错误 → Ben : We need to discuss what we found!
|
||
【后置对话】Ben : Okay!"""),
|
||
|
||
# Row116: 互动 — a lot of — 很多信息
|
||
(116, """【任务标题】What did it tell us?
|
||
【资源配置】无
|
||
【情境引入】User pieces together the clues.
|
||
【互动内容】
|
||
(朗读台词 / 听力挖空)
|
||
User : It tells ___ ___ ___ things!
|
||
答案词:a lot of
|
||
KP:a lot of — det. 大量的
|
||
【互动反馈】
|
||
正确 → Ben : Yes. Speedy Monkey, school, gift...
|
||
错误 → Ben : Remember all the drawings?
|
||
【后置对话】User : Vala School is a gift to Speedy Monkey!"""),
|
||
|
||
# Row123: 互动 — a lot of — 很多信息
|
||
(123, """【任务标题】What should we do?
|
||
【资源配置】无
|
||
【情境引入】Ben : What should we do now?
|
||
【互动内容】
|
||
(朗读台词)
|
||
User : It is a lot of information.
|
||
KP:a lot of — det. 大量的
|
||
【互动反馈】
|
||
正确 → Ben : Yes. We have enough to tell the mayor!
|
||
错误 → Ben : Is it enough to act on?
|
||
【后置对话】无"""),
|
||
|
||
# Row124: 互动 — talk about — 给镇长打电话
|
||
(124, """【任务标题】Who should we tell?
|
||
【资源配置】无
|
||
【情境引入】Ben agrees they have enough proof.
|
||
【互动内容】
|
||
(朗读台词)
|
||
User : We need to call Mayor Tom and talk about it!
|
||
KP:talk to/talk about...
|
||
【互动反馈】
|
||
正确 → Ben : Good idea. Let's call him now!
|
||
错误 → Ben : Who should we call for help?
|
||
【后置对话】Calling Mayor Tom..."""),
|
||
|
||
# Row131: 互动 — point at — 指给镇长看
|
||
(131, """【任务标题】Show the mayor
|
||
【资源配置】无
|
||
【情境引入】Tom arrives. Ben explains.
|
||
【互动内容】
|
||
(朗读台词)
|
||
User : Look! I point at it.
|
||
KP:point — v. 指向
|
||
【互动反馈】
|
||
正确 → Tom : The robot?
|
||
错误 → Tom : What are you pointing at?
|
||
【后置对话】Tom : Oh? A spy? In the classroom?"""),
|
||
|
||
# Row137: 互动 — a lot of — 描述异常行为
|
||
(137, """【任务标题】What did it do?
|
||
【资源配置】无
|
||
【情境引入】Ben lists the spy evidence.
|
||
【互动内容】
|
||
(听力挖空 / 朗读)
|
||
User : And it said ___ ___ ___ strange things!
|
||
答案词:a lot of
|
||
KP:a lot of — det. 大量的
|
||
【互动反馈】
|
||
正确 → Tom : Hmm, I see.
|
||
错误 → Tom : Did it say many strange things?
|
||
【后置对话】User shows the blackboard evidence"""),
|
||
|
||
# Row148: 互动 — don't understand — 感到困惑
|
||
(148, """【任务标题】What is the truth?
|
||
【资源配置】无
|
||
【情境引入】Tom says robot doesn't want to give school to Speedy Monkey.
|
||
【互动内容】
|
||
(朗读台词)
|
||
User : Wait. I don't understand.
|
||
KP:I can/can't understand...
|
||
【互动反馈】
|
||
正确 → Lin : Why not let it tell you itself?
|
||
错误 → Lin : Let me help you understand.
|
||
【后置对话】Robot explains itself"""),
|
||
|
||
# Row163: 核心互动-口语 — talk to — 道歉
|
||
(163, """【任务标题】Apologise to Jay and Lin
|
||
【资源配置】无
|
||
【情境引入】Tom asks the kids if they have something to say.
|
||
【互动内容】
|
||
(口语表达)
|
||
User : I should talk to you.
|
||
KP:talk — v. 说话
|
||
【互动反馈】
|
||
正确 → Jay : It's okay.
|
||
错误 → Jay : Go on. Say what you need to say.
|
||
【后置对话】User and Ben apologise"""),
|
||
]
|
||
|
||
# Write and verify
|
||
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)
|
||
resp = json.loads(r.stdout)
|
||
if resp.get('code') == 0:
|
||
success += 1
|
||
title = text.split('\n')[0].replace('【任务标题】', '')
|
||
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=== 回读验证 ===')
|
||
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}',
|
||
'-H', f'Authorization: Bearer {TOKEN}'], capture_output=True, text=True)
|
||
resp = json.loads(r.stdout)
|
||
vals = resp.get('data',{}).get('valueRange',{}).get('values',[[]])
|
||
content = vals[0][0] if vals and vals[0] else None
|
||
title = content.split('\n')[0].replace('【任务标题】', '') if content else 'EMPTY'
|
||
print(f' ✅ Row{row}: {title}')
|