Files
memoryweave/scripts/zhiyi-feishu-alarm.py
T
xiaowei 2a350cf781 fix(distill): max_tokens 800→1200 — Agnes推理token预算不足
Agnes 2.0-flash是推理模型,推理token占大量预算。
800仍不够→JSON截断(parse error: unexpected end of JSON input)。
1200确保推理+正文都够用。
2026-08-20 01:13:06 +08:00

44 lines
1.7 KiB
Python
Executable File
Raw 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.
#!/usr/bin/env python3
"""织忆监控报警发送脚本 - 发飞书 Home 频道
前置条件:requests 库 (pip install requests)
用法:python3 /path/to/this/script.py"""
import json, requests, datetime
APP_ID = 'cli_a95d7ff06b789bb4'
APP_SECRET = 'Gm7eo0aD9Luka8mHxApRufYIDwmpGsGf'
CHAT_ID = 'oc_81f6df701c872a1122f32080e366543f' # Home 频道(AI创业核心群)
now = datetime.datetime.now().strftime('%Y-%m-%d %H:%M')
resp = requests.post(
'https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal',
json={'app_id': APP_ID, 'app_secret': APP_SECRET},
timeout=10
)
resp.raise_for_status()
token = resp.json()['tenant_access_token']
msg = f"""**织忆异常报警** [{now}]
| 指标 | 当前值 | 阈值 | 状态 |
|------|--------|------|------|
| 召回命中率 | 99% | >= 70% | OK |
| 召回有用率 | 99% | >= 60% | OK |
| 知识缺口 | 0 | <= 5 | OK |
| 冲突数 | 0 | <= 3 | OK |
| distill 队列 | 1 | <= 20 | OK |
| **蒸馏损失** | **0.61** | **< 0.4** | **异常** |
**异常项**:avg_distill_loss = 0.61(正常应 < 0.4),近期记忆蒸馏信息损失偏高。
**建议操作**:检查近24小时蒸馏样本,排查噪声数据或高峰期模型响应不稳定原因。如持续偏高,考虑降低蒸馏batch size或暂缓非紧急蒸馏任务。"""
resp = requests.post(
'https://open.feishu.cn/open-apis/im/v1/messages',
params={'receive_id_type': 'chat_id'},
headers={'Authorization': f'Bearer {token}', 'Content-Type': 'application/json'},
json={'receive_id': CHAT_ID, 'msg_type': 'text', 'content': json.dumps({'text': msg})},
timeout=10
)
resp.raise_for_status()
print('Sent:', resp.json())