diff --git a/.vala_skill_hashes b/.vala_skill_hashes index 59ab1f8..3c555a7 100644 --- a/.vala_skill_hashes +++ b/.vala_skill_hashes @@ -14,4 +14,4 @@ user-feedback-data-source a95eb9142f3019fd193c46f89147dc7e0bf01dfe250202565a86f8 user-feedback-processor 61783a8e9f03a973c187b359a87749ad1993dc71f8364b0a853d8b3ff64c75e8 feishu-group-msg-sync 953534cc3d1cf4489060afe1cf10cad75faedd3f2d699ffa7478d178d528dc51 tencent-cos-upload 2505dbc8c7acdaf95f2228598ae12010e09599a25df4319587c4a3109d828053 -feishu-feedback-sync 066a9fd4da5ddb9dd2d4dc27412e593787747d87a6b4183e39354fd3f6443b4b +feishu-feedback-sync fa183bd91d2b8d1c6fae7647aa4b3536791e729a1cc8146dfa5b29d4120a8467 diff --git a/data/last_wechat_sync_id b/data/last_wechat_sync_id index 2bfb0ae..d71bdf5 100644 --- a/data/last_wechat_sync_id +++ b/data/last_wechat_sync_id @@ -1 +1 @@ -1930 +1933 diff --git a/memory/.dreams/events.jsonl b/memory/.dreams/events.jsonl index 4f22037..3869001 100644 --- a/memory/.dreams/events.jsonl +++ b/memory/.dreams/events.jsonl @@ -32,3 +32,4 @@ {"type":"memory.recall.recorded","timestamp":"2026-06-01T14:02:36.057Z","query":"毋益飞 user_id","resultCount":1,"results":[{"path":"memory/2026-05-07.md","startLine":109,"endLine":148,"score":1}]} {"type":"memory.recall.recorded","timestamp":"2026-06-02T06:49:10.085Z","query":"小编 飞书 user_id 身份","resultCount":4,"results":[{"path":"memory/2026-05-25.md","startLine":21,"endLine":42,"score":1},{"path":"memory/2026-05-26.md","startLine":1,"endLine":24,"score":1},{"path":"memory/2026-05-25.md","startLine":38,"endLine":44,"score":1},{"path":"memory/2026-05-22.md","startLine":129,"endLine":158,"score":1}]} {"type":"memory.recall.recorded","timestamp":"2026-06-02T06:49:17.685Z","query":"小编 群聊 身份 open_id","resultCount":1,"results":[{"path":"memory/2026-04-18.md","startLine":1,"endLine":5,"score":1}]} +{"type":"memory.recall.recorded","timestamp":"2026-06-03T02:09:30.724Z","query":"小葵小葵群 chat_id 用户反馈发送","resultCount":1,"results":[{"path":"memory/2026-04-18.md","startLine":1,"endLine":5,"score":1}]} diff --git a/memory/.dreams/short-term-recall.json b/memory/.dreams/short-term-recall.json index 48efd6c..d409f7b 100644 --- a/memory/.dreams/short-term-recall.json +++ b/memory/.dreams/short-term-recall.json @@ -1,6 +1,6 @@ { "version": 1, - "updatedAt": "2026-06-02T06:49:17.685Z", + "updatedAt": "2026-06-03T02:09:30.724Z", "entries": { "memory:memory/2026-04-18.md:1:5": { "key": "memory:memory/2026-04-18.md:1:5", @@ -9,13 +9,13 @@ "endLine": 5, "source": "memory", "snippet": "# 2026-04-18 工作日志 ## 术语共识 [李若松确认] 术语「飞书反馈消息数据库」默认指代用户反馈收集技能中的飞书内部测试反馈MySQL数据表 `vala_test.lark_group_message`,存储「内容测试问题反馈」群(oc_fabff7672e62a9ced7b326ee4a286c26)的同步消息数据。", - "recallCount": 10, + "recallCount": 11, "dailyCount": 0, "groundedCount": 0, - "totalScore": 10, + "totalScore": 11, "maxScore": 1, "firstRecalledAt": "2026-04-30T03:47:21.989Z", - "lastRecalledAt": "2026-06-02T06:49:17.685Z", + "lastRecalledAt": "2026-06-03T02:09:30.724Z", "queryHashes": [ "353f9765c086", "a6b740c99377", @@ -26,7 +26,8 @@ "261597c52d5b", "3fe44d618bf6", "06538386c796", - "ce7929958572" + "ce7929958572", + "ffaa95d422fd" ], "recallDays": [ "2026-04-30", @@ -36,7 +37,8 @@ "2026-05-26", "2026-05-27", "2026-05-28", - "2026-06-02" + "2026-06-02", + "2026-06-03" ], "conceptTags": [ "vala-test.lark-group-message", diff --git a/output/daily_feedback/ai_descriptions_feishu_2026-06-02.json b/output/daily_feedback/ai_descriptions_feishu_2026-06-02.json new file mode 100644 index 0000000..b32f205 --- /dev/null +++ b/output/daily_feedback/ai_descriptions_feishu_2026-06-02.json @@ -0,0 +1,25 @@ +{ + "date": "2026-06-02", + "descriptions": [ + { + "index": 1, + "description": "关卡中题目的相关人员解析功能缺失" + }, + { + "index": 2, + "description": "端上测试包的Test中缺少新上线的“看图拼词”组件" + }, + { + "index": 3, + "description": "相关功能尚未合并至发版分支,导致无法在发版版本中进行测试。" + }, + { + "index": 4, + "description": "无明确问题" + }, + { + "index": 5, + "description": "无明确问题" + } + ] +} \ No newline at end of file diff --git a/output/daily_feedback/ai_descriptions_wechat_2026-06-02.json b/output/daily_feedback/ai_descriptions_wechat_2026-06-02.json new file mode 100644 index 0000000..eb056b8 --- /dev/null +++ b/output/daily_feedback/ai_descriptions_wechat_2026-06-02.json @@ -0,0 +1,21 @@ +{ + "date": "2026-06-02", + "descriptions": [ + { + "index": 1, + "description": "无明确问题" + }, + { + "index": 2, + "description": "京东相关人员课屏的磨耳朵功能出现相关人员" + }, + { + "index": 3, + "description": "无明确问题" + }, + { + "index": 4, + "description": "希沃学习机上查看题目解析和进入Season1第三关时频繁闪退。" + } + ] +} \ No newline at end of file diff --git a/output/daily_feedback/cluster_context_2026-06-02.json b/output/daily_feedback/cluster_context_2026-06-02.json new file mode 100644 index 0000000..6314ead --- /dev/null +++ b/output/daily_feedback/cluster_context_2026-06-02.json @@ -0,0 +1,100 @@ +{ + "date": "2026-06-02", + "total_clusters": 1, + "clusters": [ + { + "index": 1, + "_idx": 1, + "cluster_id": "7302252117666642816", + "location": { + "端": "未知", + "环节": "未知", + "课程": "", + "角色/组件": "" + }, + "priority": "P0", + "priority_detail": "", + "category": "启动/运行异常", + "conclusion": "**当前问题排查结论:** 暂无结论排查中", + "messages": [ + { + "sender": "瓦拉英语-茉茉老师(早10晚7)", + "content": "[图片] 78d95a2b44601479633367bebabeab5d", + "msg_type": "image", + "media_url": "https://static.valavala.com/vala_llm/user_feedback/wechat/image/2026-06/675ebc29ab5013c7312dc774d34511b3.jpg", + "time": "2026-06-02 19:58:29" + }, + { + "sender": "瓦拉英语-茉茉老师(早10晚7)", + "content": "又有家长反映这个不能用鼠标写", + "msg_type": "text", + "media_url": "", + "time": "2026-06-02 19:58:47" + }, + { + "sender": "瓦拉英语-茉茉老师(早10晚7)", + "content": "这个问题后面怎么解决呀,增加跳过的按钮吗", + "msg_type": "text", + "media_url": "", + "time": "2026-06-02 19:59:08" + }, + { + "sender": ".oO(王_计)Oo.", + "content": "已经解决,随下次热更新", + "msg_type": "text", + "media_url": "", + "time": "2026-06-02 19:59:54" + }, + { + "sender": "瓦拉英语-茉茉老师(早10晚7)", + "content": "好的👌", + "msg_type": "text", + "media_url": "", + "time": "2026-06-02 20:00:54" + }, + { + "sender": "瓦拉英语-花花班班(早10晚7-周末休息)", + "content": "[聊天记录] 綦小綦和瓦拉英语-花花班主任(早10晚7)\n綦小綦: [视频]\n綦小綦: 做题或者查看做题情况 都这样一会就闪退\n綦小綦: 你们这系统技术能改进一下吗\n綦小綦: 老卡呢\n綦小綦: 要不就卡顿\n瓦拉英语-花花班主任(早10晚7): 咱们是用的什么设备学习呢\n綦小綦: [图片]\n綦小綦: 我这没有上传日志啊\n綦小綦: 我用的希沃学习机\n綦小綦: 一天闪退好几次", + "msg_type": "link", + "media_url": "", + "time": "2026-06-02 20:04:20" + }, + { + "sender": "瓦拉英语-花花班班(早10晚7-周末休息)", + "content": "13464008928用户用的希沃学习机经常闪退,辛苦老师看下", + "msg_type": "text", + "media_url": "", + "time": "2026-06-02 20:04:46" + }, + { + "sender": "嘿哈", + "content": "让他进入角色后再进入设置页面点击上传日志,不要在选择角色页面进设置页\n ↳ 回复 瓦拉英语-花花班主任(早10晚7): 13464008928用户用的希沃学习机经常闪退,辛苦老师看下", + "msg_type": "link", + "media_url": "", + "time": "2026-06-02 20:06:00" + }, + { + "sender": "嘿哈", + "content": "确认一下闪退的地点,是只有查看题目解析的时候闪退么?还是说有其他路径\n ↳ 回复 瓦拉英语-花花班主任(早10晚7): 13464008928用户用的希沃学习机经常闪退,辛苦老师看下", + "msg_type": "link", + "media_url": "", + "time": "2026-06-02 20:06:23" + }, + { + "sender": "瓦拉英语-花花班班(早10晚7-周末休息)", + "content": "好的", + "msg_type": "text", + "media_url": "", + "time": "2026-06-02 20:09:58" + }, + { + "sender": "瓦拉英语-花花班班(早10晚7-周末休息)", + "content": "家长说查看题目解析,它也闪退。然后今天做的是Season1里的第三关点进去也闪退。", + "msg_type": "text", + "media_url": "", + "time": "2026-06-02 20:29:32" + } + ] + } + ] +} \ No newline at end of file diff --git a/output/daily_feedback/wechat_cluster_context_2026-06-02.json b/output/daily_feedback/wechat_cluster_context_2026-06-02.json new file mode 100644 index 0000000..828e3e7 --- /dev/null +++ b/output/daily_feedback/wechat_cluster_context_2026-06-02.json @@ -0,0 +1,157 @@ +{ + "date": "2026-06-02", + "clusters": [ + { + "index": 1, + "_idx": 1, + "cluster_id": "4437274725416708727", + "message_count": 1, + "priority": "P2", + "priority_detail": "基础优先级: P2(无法精确匹配,默认归为P2)", + "messages": [ + { + "sender": "瓦拉英语-露露班班(早10晚7)", + "content": "[图片] f76c7d140dc870f5ae2b42a6c27621c7", + "msg_type": "image", + "time": "2026-06-02 09:44:34", + "message_id": "4437274725416708727", + "quote_message_id": "" + } + ] + }, + { + "index": 2, + "_idx": 2, + "cluster_id": "8085984444640105314", + "message_count": 1, + "priority": "P0", + "priority_detail": "基础优先级: P0(匹配P0规则:crash)", + "messages": [ + { + "sender": "瓦拉英语-露露班班(早10晚7)", + "content": "京东方小课屏的磨耳朵又出现了白屏,已经引导用户在小程序上听", + "msg_type": "text", + "time": "2026-06-02 09:45:08", + "message_id": "8085984444640105314", + "quote_message_id": "" + } + ] + }, + { + "index": 3, + "_idx": 3, + "cluster_id": "6374990160361275847", + "message_count": 1, + "priority": "P2", + "priority_detail": "基础优先级: P2(无法精确匹配,默认归为P2)", + "messages": [ + { + "sender": ".oO(王_计)Oo.", + "content": "磨耳朵已经在用unity原生重新开发了。让用户再稍微等一下", + "msg_type": "text", + "time": "2026-06-02 09:46:34", + "message_id": "6374990160361275847", + "quote_message_id": "" + } + ] + }, + { + "index": 4, + "_idx": 4, + "cluster_id": "7302252117666642816", + "message_count": 11, + "priority": "P0", + "priority_detail": "基础优先级: P0(匹配P0规则:crash);出现频率: 高概率", + "messages": [ + { + "sender": "瓦拉英语-花花班班(早10晚7-周末休息)", + "content": "13464008928用户用的希沃学习机经常闪退,辛苦老师看下", + "msg_type": "text", + "time": "2026-06-02 20:04:46", + "message_id": "7302252117666642816", + "quote_message_id": "" + }, + { + "sender": "嘿哈", + "content": "让他进入角色后再进入设置页面点击上传日志,不要在选择角色页面进设置页\n ↳ 回复 瓦拉英语-花花班主任(早10晚7): 13464008928用户用的希沃学习机经常闪退,辛苦老师看下", + "msg_type": "link", + "time": "2026-06-02 20:06:00", + "message_id": "3680519818246863462", + "quote_message_id": "7302252117666642816" + }, + { + "sender": "嘿哈", + "content": "确认一下闪退的地点,是只有查看题目解析的时候闪退么?还是说有其他路径\n ↳ 回复 瓦拉英语-花花班主任(早10晚7): 13464008928用户用的希沃学习机经常闪退,辛苦老师看下", + "msg_type": "link", + "time": "2026-06-02 20:06:23", + "message_id": "5476954047159243877", + "quote_message_id": "7302252117666642816" + }, + { + "sender": "瓦拉英语-茉茉老师(早10晚7)", + "content": "[图片] 78d95a2b44601479633367bebabeab5d", + "msg_type": "image", + "time": "2026-06-02 19:58:29", + "message_id": "8392416847465848425", + "quote_message_id": "" + }, + { + "sender": "瓦拉英语-茉茉老师(早10晚7)", + "content": "又有家长反映这个不能用鼠标写", + "msg_type": "text", + "time": "2026-06-02 19:58:47", + "message_id": "6149726619633505263", + "quote_message_id": "" + }, + { + "sender": "瓦拉英语-茉茉老师(早10晚7)", + "content": "这个问题后面怎么解决呀,增加跳过的按钮吗", + "msg_type": "text", + "time": "2026-06-02 19:59:08", + "message_id": "533759990164518435", + "quote_message_id": "" + }, + { + "sender": ".oO(王_计)Oo.", + "content": "已经解决,随下次热更新", + "msg_type": "text", + "time": "2026-06-02 19:59:54", + "message_id": "9092556441259768782", + "quote_message_id": "" + }, + { + "sender": "瓦拉英语-茉茉老师(早10晚7)", + "content": "好的👌", + "msg_type": "text", + "time": "2026-06-02 20:00:54", + "message_id": "6634484585577794512", + "quote_message_id": "" + }, + { + "sender": "瓦拉英语-花花班班(早10晚7-周末休息)", + "content": "[聊天记录] 綦小綦和瓦拉英语-花花班主任(早10晚7)\n綦小綦: [视频]\n綦小綦: 做题或者查看做题情况 都这样一会就闪退\n綦小綦: 你们这系统技术能改进一下吗\n綦小綦: 老卡呢\n綦小綦: 要不就卡顿\n瓦拉英语-花花班主任(早10晚7): 咱们是用的什么设备学习呢\n綦小綦: [图片]\n綦小綦: 我这没有上传日志啊\n綦小綦: 我用的希沃学习机\n綦小綦: 一天闪退好几次", + "msg_type": "link", + "time": "2026-06-02 20:04:20", + "message_id": "5406706268715174985", + "quote_message_id": "" + }, + { + "sender": "瓦拉英语-花花班班(早10晚7-周末休息)", + "content": "好的", + "msg_type": "text", + "time": "2026-06-02 20:09:58", + "message_id": "2006689369710136562", + "quote_message_id": "" + }, + { + "sender": "瓦拉英语-花花班班(早10晚7-周末休息)", + "content": "家长说查看题目解析,它也闪退。然后今天做的是Season1里的第三关点进去也闪退。", + "msg_type": "text", + "time": "2026-06-02 20:29:32", + "message_id": "1516319709508113867", + "quote_message_id": "" + } + ] + } + ] +} \ No newline at end of file diff --git a/scripts/ai_summarize_feedback.py b/scripts/ai_summarize_feedback.py index 3ed5902..3e20147 100644 --- a/scripts/ai_summarize_feedback.py +++ b/scripts/ai_summarize_feedback.py @@ -230,6 +230,7 @@ def generate_descriptions(context_data, dry_run=False): def apply_descriptions(date_str, descriptions, channel="feishu"): """调用 sync_*_feedback.py --apply-ai 回写文档 channel: "feishu" 或 "wechat" + 返回 (doc_update_ok, summary_md) 元组。 """ sys.path.insert(0, SKILL_SCRIPT_DIR) @@ -260,6 +261,8 @@ def apply_descriptions(date_str, descriptions, channel="feishu"): capture_output=True, text=True, timeout=60, env=env ) + # 从 stdout 提取替换后的 summary_md(用于后续分发) + summary_md = "" if "AI 描述已应用" in result.stdout or "✅" in result.stdout: print(f" ✅ AI 描述已回写到知识库文档") # 回写成功后清理上下文文件,避免心跳重复处理 @@ -268,11 +271,134 @@ def apply_descriptions(date_str, descriptions, channel="feishu"): if os.path.exists(context_path): os.remove(context_path) print(f" 🗑️ 已清理上下文文件: {context_path}") - return True + return True, summary_md else: print(f" ❌ 回写失败: {result.stdout[:300]}") if result.stderr: print(f" stderr: {result.stderr[:300]}") + # 回写失败时,用 context + AI 描述自行构建 summary_md 用于分发 + summary_md = build_summary_from_context(date_str, descriptions, channel) + return False, summary_md + + +def build_summary_from_context(date_str, descriptions, channel="feishu"): + """从 cluster_context + AI 描述构建 summary markdown(用于分发到群聊)。""" + ctx_prefix = "wechat_cluster_context" if channel == "wechat" else "cluster_context" + context_path = os.path.join(CONTEXT_DIR, f"{ctx_prefix}_{date_str}.json") + if not os.path.exists(context_path): + return "" + + with open(context_path, "r", encoding="utf-8") as f: + ctx = json.load(f) + + desc_map = {d["index"]: d["description"] for d in descriptions} + + lines = ["## 今日问题归纳", ""] + + # 按优先级分组 + grouped = {"P0": [], "P1": [], "P2": [], "P3": []} + for c in ctx["clusters"]: + idx = c.get("_idx") or c.get("index", 0) + desc = desc_map.get(idx, f"[问题{idx}]") + priority = c.get("priority", "P2") + grouped[priority].append(desc) + + headers = { + "P0": "⚠️ P0级核心问题(需优先处理)", + "P1": "⚡ P1级重要问题", + "P2": "📌 P2级一般问题", + "P3": "📝 P3级低优先级", + } + + for p_level in ["P0", "P1", "P2", "P3"]: + items = grouped[p_level] + if not items: + continue + lines.append(f"**{headers[p_level]}**") + for item in items: + lines.append(f"- {item}") + lines.append("") + + return "\n".join(lines) + + +def dispatch_summary_to_group(date_str, summary_md, channel="feishu"): + """将归纳摘要发送到「小葵小葵」群聊。使用 Python 直接调飞书 API。""" + DISPATCH_CHAT_ID = "oc_4171a2188f2554522a4309f2d7c27753" + SUMMARY_PARENT_NODE = "MpBNdkCxOobSNQxeJJDcWg9ZnRI" + + if not summary_md: + print(" ⚠️ 无归纳内容可分发") + return False + + # 提取「今日问题归纳」部分 + if "## 今日问题归纳" in summary_md: + 归纳_content = summary_md.split("## 今日问题归纳\n", 1)[1] + else: + 归纳_content = summary_md + + # 过滤"无明确问题"条目 + filtered_lines = [] + for line in 归纳_content.strip().split("\n"): + stripped = line.strip() + if stripped in ("- 无明确问题", "* 无明确问题"): + continue + filtered_lines.append(line) + 归纳_content = "\n".join(filtered_lines).strip() + + has_items = any(line.strip().startswith("- ") for line in filtered_lines) + if not 归纳_content or not has_items: + print(" ⚠️ 无归纳内容可分发(已过滤无明确问题条目)") + return False + + # 获取 token + config = json.load(open("/root/.openclaw/credentials/xiaokui/config.json")) + app_id = config["apps"][0]["appId"] + app_secret = config["apps"][0]["appSecret"] + req = urllib.request.Request( + "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal", + data=json.dumps({"app_id": app_id, "app_secret": app_secret}).encode(), + headers={"Content-Type": "application/json"}, method="POST" + ) + token = json.loads(urllib.request.urlopen(req, timeout=10).read())["tenant_access_token"] + + # 构建 post 消息 + label_prefix = "" if date_str.startswith(("微信-", "飞书-")) else "飞书-" + title = f"📋 {label_prefix}{date_str} 用户反馈问题归纳" + + content_parts = [] + for line in 归纳_content.split("\n"): + content_parts.append([{"tag": "text", "text": line + "\n"}]) + + doc_url = f"https://makee-interactive.feishu.cn/wiki/{SUMMARY_PARENT_NODE}" + content_parts.append([ + {"tag": "text", "text": "\n📄 详细文档:"}, + {"tag": "a", "text": f"{label_prefix}{date_str} 用户反馈问题归纳", "href": doc_url} + ]) + + post_content = json.dumps({ + "zh_cn": {"title": title, "content": content_parts} + }, ensure_ascii=False) + + body = json.dumps({ + "receive_id": DISPATCH_CHAT_ID, + "msg_type": "post", + "content": post_content + }, ensure_ascii=False).encode() + + req2 = urllib.request.Request( + "https://open.feishu.cn/open-apis/im/v1/messages?receive_id_type=chat_id", + data=body, + headers={"Authorization": f"Bearer {token}", "Content-Type": "application/json"}, + method="POST" + ) + resp = urllib.request.urlopen(req2, timeout=10) + result = json.loads(resp.read()) + if result.get("code") == 0: + print(f" ✅ 问题归纳已分发到群聊") + return True + else: + print(f" ⚠️ 分发失败: {result.get('msg', '')[:100]}") return False @@ -311,7 +437,14 @@ def main(): print(f"[DRY-RUN] 描述已保存到 {desc_path},未回写文档") return - apply_descriptions(date_str, descriptions, channel=channel) + ok, summary_md = apply_descriptions(date_str, descriptions, channel=channel) + + # AI 归纳完成后分发到群聊(飞书和微信都发) + if summary_md: + print(f"📨 分发 AI 归纳到群聊...") + dispatch_summary_to_group(date_str, summary_md, channel=channel) + else: + print(f" ⚠️ 无归纳内容,跳过分发") if __name__ == "__main__": diff --git a/scripts/sync_feishu_feedback_wrapper.sh b/scripts/sync_feishu_feedback_wrapper.sh index 8e70f91..67fa2d8 100755 --- a/scripts/sync_feishu_feedback_wrapper.sh +++ b/scripts/sync_feishu_feedback_wrapper.sh @@ -18,7 +18,7 @@ log "=== 每日全量分发开始 ===" YESTERDAY=$(date -d "yesterday" +%Y-%m-%d) cd /root/.openclaw/workspace-xiaokui -python3 skills/feishu-feedback-sync/scripts/sync_feishu_feedback.py --date "$YESTERDAY" --steps 7 --ai-placeholders --dispatch-mode all >> "$LOG_FILE" 2>&1 +python3 skills/feishu-feedback-sync/scripts/sync_feishu_feedback.py --date "$YESTERDAY" --steps 1-6 --ai-placeholders --skip-dispatch >> "$LOG_FILE" 2>&1 log "=== 每日全量分发结束 ===" exit 0 diff --git a/scripts/sync_wechat_feedback.py b/scripts/sync_wechat_feedback.py index 2e14c12..3677a0a 100755 --- a/scripts/sync_wechat_feedback.py +++ b/scripts/sync_wechat_feedback.py @@ -79,15 +79,20 @@ def fetch_wechat_data(date_str): def gen_context_json(date_str, clusters, cluster_order): - """保存簇上下文 JSON 供 AI 使用""" + """保存簇上下文 JSON 供 AI 使用,包含 _idx 和优先级信息""" os.makedirs(CONTEXT_DIR, exist_ok=True) ctx = {"date": date_str, "clusters": []} for idx, cid in enumerate(cluster_order): cmsgs = clusters[cid] + # 计算优先级 + priority_info = fsf.compute_final_priority(cmsgs) ctx["clusters"].append({ "index": idx + 1, + "_idx": idx + 1, # 占位符编号 "cluster_id": cid, "message_count": len(cmsgs), + "priority": priority_info.get("priority", "P2"), + "priority_detail": priority_info.get("reasoning", ""), "messages": [ {"sender": m[1], "content": m[3], "msg_type": m[2], "time": m[6], "message_id": m[0], "quote_message_id": m[5]} @@ -203,16 +208,19 @@ def main(): print("❌ 无法创建/找到文档") sys.exit(1) + workspace_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) tmp_md = "tmp/wechat_ai_summary.md" - with open(tmp_md, "w", encoding="utf-8") as f: + tmp_md_abs = os.path.join(workspace_root, tmp_md) + os.makedirs(os.path.dirname(tmp_md_abs), exist_ok=True) + with open(tmp_md_abs, "w", encoding="utf-8") as f: f.write(summary_md) env = os.environ.copy() env["LARKSUITE_CLI_CONFIG_DIR"] = CRED_DIR result = subprocess.run( [CLI, "docs", "+update", "--doc", obj_token, "--as", "bot", "--mode", "overwrite", "--markdown", f"@{tmp_md}"], - env=env, capture_output=True, text=True, timeout=15) - os.unlink(tmp_md) + env=env, capture_output=True, text=True, timeout=15, cwd=workspace_root) + os.unlink(tmp_md_abs) try: resp = json.loads(result.stdout) diff --git a/skills/feishu-feedback-sync/scripts/__pycache__/priority_classifier.cpython-312.pyc b/skills/feishu-feedback-sync/scripts/__pycache__/priority_classifier.cpython-312.pyc index ed9fe96..1802ac6 100644 Binary files a/skills/feishu-feedback-sync/scripts/__pycache__/priority_classifier.cpython-312.pyc and b/skills/feishu-feedback-sync/scripts/__pycache__/priority_classifier.cpython-312.pyc differ diff --git a/skills/feishu-feedback-sync/scripts/__pycache__/sync_feishu_feedback.cpython-312.pyc b/skills/feishu-feedback-sync/scripts/__pycache__/sync_feishu_feedback.cpython-312.pyc index db819fd..5b9c8c4 100644 Binary files a/skills/feishu-feedback-sync/scripts/__pycache__/sync_feishu_feedback.cpython-312.pyc and b/skills/feishu-feedback-sync/scripts/__pycache__/sync_feishu_feedback.cpython-312.pyc differ diff --git a/skills/feishu-feedback-sync/scripts/priority_classifier.py b/skills/feishu-feedback-sync/scripts/priority_classifier.py index 813e94c..7565316 100644 --- a/skills/feishu-feedback-sync/scripts/priority_classifier.py +++ b/skills/feishu-feedback-sync/scripts/priority_classifier.py @@ -17,7 +17,7 @@ from typing import List, Dict, Tuple, Optional # P0 关键词:完全阻断使用、核心功能崩溃 P0_KEYWORDS = { - "crash": r'闪退|崩溃|卡死|无法启动|打不开|进不去|登不上|完全.*进|完全.*打|完全.*不能|无法.*进入', + "crash": r'闪退|崩溃|卡死|白屏|黑屏|花屏|无法启动|打不开|进不去|登不上|完全.*进|完全.*打|完全.*不能|无法.*进入', "core": r'(知识巩固|跟读|录音).*(进不去|没反应|无法|不工作|崩溃)|(核心功能|主线).*(崩溃|卡死|无法推进|完全.*卡)', "payment": r'(付费|购买|充值).*(无法|不到账|失败|不能用)|(钱|金额).*(不对|错误|问题)', "server": r'(服务器|全国|所有.*用户|全体).*(挂了|宕机|无法连接|登不上)', diff --git a/skills/feishu-feedback-sync/scripts/sync_feishu_feedback.py b/skills/feishu-feedback-sync/scripts/sync_feishu_feedback.py index d85fef4..fa1d694 100755 --- a/skills/feishu-feedback-sync/scripts/sync_feishu_feedback.py +++ b/skills/feishu-feedback-sync/scripts/sync_feishu_feedback.py @@ -1049,6 +1049,7 @@ def generate_summary(clusters, cluster_order, skip_priority=False, ai_placeholde loc = extract_location_elements(vc["msgs"]) context_data.append({ "index": idx, + "_idx": vc.get("_idx", idx), # 占位符编号,与 generate_summary 中的 placeholder_idx 一致 "cluster_id": vc["cluster_id"], "location": loc, "priority": vc.get("priority_info", {}).get("priority", "P2"), @@ -1329,16 +1330,19 @@ def update_summary_doc_as_children(day_summaries, title_prefix="飞书-"): # 写入内容(锁内已保证obj_token唯一,不会并发写入) # 通过临时文件传递 markdown,避免 shell 转义问题 + workspace_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) tmp_md_path = "tmp/_summary_md.txt" - with open(tmp_md_path, "w", encoding="utf-8") as f: + tmp_md_abs = os.path.join(workspace_root, tmp_md_path) + os.makedirs(os.path.dirname(tmp_md_abs), exist_ok=True) + with open(tmp_md_abs, "w", encoding="utf-8") as f: f.write(content) result = subprocess.run( [CLI, "docs", "+update", "--doc", obj_token, "--as", "bot", "--mode", "overwrite", "--markdown", f"@{tmp_md_path}"], - env=env, capture_output=True, text=True, timeout=15 + env=env, capture_output=True, text=True, timeout=15, cwd=workspace_root ) - os.unlink(tmp_md_path) + os.unlink(tmp_md_abs) try: d = json.loads(result.stdout) @@ -1616,9 +1620,12 @@ def main(): obj_token = nodes[title]["obj_token"] print(f"📄 目标文档: {obj_token}") - # 写入临时文件(lark-cli @file 要求相对路径) + # 写入临时文件(lark-cli @file 要求相对路径,通过 cwd 确保在 workspace 根目录) + workspace_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) tmp_md = "tmp/ai_summary_md.txt" - with open(tmp_md, "w", encoding="utf-8") as f: + tmp_md_abs = os.path.join(workspace_root, tmp_md) + os.makedirs(os.path.dirname(tmp_md_abs), exist_ok=True) + with open(tmp_md_abs, "w", encoding="utf-8") as f: f.write(summary_md) env = os.environ.copy() @@ -1626,8 +1633,8 @@ def main(): result = subprocess.run( [CLI, "docs", "+update", "--doc", obj_token, "--as", "bot", "--mode", "overwrite", "--markdown", f"@{tmp_md}"], - env=env, capture_output=True, text=True, timeout=15) - os.unlink(tmp_md) # 清理临时文件 + env=env, capture_output=True, text=True, timeout=15, cwd=workspace_root) + os.unlink(tmp_md_abs) # 清理临时文件 try: resp = json.loads(result.stdout) if resp.get("ok"):