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

27 lines
1.7 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.

from pathlib import Path
p = Path('/root/.openclaw/workspace/AGENTS.md')
text = p.read_text(encoding='utf-8')
text = text.replace(
'Trigger keywords: 销售 / 业绩 / 售后 / 退款 / 费比 / 店铺周报 / SKU结构 / 发货 / 工单 / 客诉 / 客服体验 / 用户反馈 / 话术分析 / 产品信息 / 商品ID / SKU编码 / 成本 / 材质 / 预览图',
'Trigger keywords: 销售 / 业绩 / 售后 / 退款 / 费比 / 店铺周报 / SKU结构 / 发货 / 工单 / 客诉 / 客服体验 / 用户反馈 / 话术分析 / 产品信息 / 商品ID / SKU编码 / 成本 / 材质 / 预览图 / 库存 / 缺货 / 补货 / 安全库存'
)
text = text.replace(
'- 产品信息(SKU/成本/材质/预览图) -> `exec: product-info "<sku或关键词>" --days 30 --limit 20`',
'- 产品信息/库存预警(SKU/成本/材质/预览图/库存/发货件数/缺货天数) -> `exec: product-info "<sku或关键词>" --days 30 --limit 20`'
)
text = text.replace(
'- SKU编码, SKU名称, 成本价, 材质, 预览图地址',
'- SKU编码, SKU名称, 成本价, 材质, 预览图地址, 当前库存, 日均发货件数, 预计缺货天数, 补货建议'
)
extra = '''- 库存预警(强制):
- 必须输出 `estimated_stockout_days` 与 `replenishment_lead_days(=10)`
- 当 `estimated_stockout_days <= 10` 时,结论必须标记 `补货紧急`
'''
if '库存预警(强制)' not in text:
insert_after = '- 若存在售后数据,追加 售后总览 + 售后类型矩阵 + 售后原因TOP(近30天)\n'
if insert_after in text:
text = text.replace(insert_after, insert_after + extra)
p.write_text(text, encoding='utf-8')
print('updated', p)