feat(export-user-data): 补充组件维度导出快速查c_type方法和看图说话实际用例

This commit is contained in:
xiaoban 2026-06-04 19:09:23 +08:00
parent d32cccab38
commit 3588e5bb93

View File

@ -161,6 +161,42 @@ cd /root/.openclaw/workspace-xiaoban
---
## 快速查组件类型
如果只知道 `c_id` 不知道 `c_type`,先查 MySQL
```bash
cd /root/.openclaw/workspace-xiaoban
source scripts/export_component_records.sh --help # 仅加载环境变量
python3 -c "
import pymysql, os
conn = pymysql.connect(
host=os.getenv('MYSQL_HOST'), user=os.getenv('MYSQL_USERNAME'),
password=os.getenv('MYSQL_PASSWORD'), database='vala_test',
port=int(os.getenv('MYSQL_PORT',3306)), charset='utf8mb4')
for t in ['middle_interaction_component','core_interaction_component']:
cur = conn.cursor()
cur.execute(f'SELECT c_id,c_type,title FROM {t} WHERE c_id=%s', ('<c_id>',))
for r in cur.fetchall():
print(f'{t}: c_id={r[0]} c_type={r[1]} title={r[2]}')
cur.close()
conn.close()
"
```
## 实际用例
### 导出"看图说话"组件 1000516 的所有学习记录
```bash
cd /root/.openclaw/workspace-xiaoban
./scripts/export_component_records.sh --c-type core_speaking_image --c-id 1000516
```
输出:`output/组件_口语图片_1000516_导出时间_YYYYMMDD.xlsx`
包含字段user_id、session_id、play_result判定结果、音频URL、朗读内容ASR文本识别、发音评分、user_behavior_info完整行为数据按 updated_at 倒序排列。
## 完成后
如果是从飞书对话触发的导出,导出完成后通过 `lark-send-message-as-bot` 技能将文件发送给请求用户。