dalongxia/fix_agents_feishu_section.py
2026-03-04 13:25:48 +08:00

27 lines
1.1 KiB
Python

from pathlib import Path
p = Path('/root/.openclaw/workspace/AGENTS.md')
text = p.read_text(encoding='utf-8')
start = text.find('## 5) Feishu Delivery Rules\n')
ws = text.find('## 5) Workspace Paths\n')
if start == -1 or ws == -1 or ws < start:
raise SystemExit('section markers not found')
new_section = '''## 5) Feishu Delivery Rules
Trigger keywords: 推到飞书表格 / 写入飞书 / 同步飞书 / 发送飞书表格链接
Required behavior:
- When user asks to push result to Feishu Bitable, run write action first (feishu_bitable_create_record or feishu_bitable_update_record).
- In final reply, always include:
1) push status (success/failed)
2) target sheet link (the user-provided wiki/base URL)
3) written record_id (or updated count)
- If write partially fails, return succeeded records and failed reason list separately.
- If user explicitly asks for "只要结果", keep reasoning short but still include the sheet link and write status line.
'''
text = text[:start] + new_section + text[ws:]
text = text.replace('## 5) Workspace Paths\n', '## 6) Workspace Paths\n', 1)
p.write_text(text, encoding='utf-8')
print('fixed', p)