diff --git a/src/api/blackboard_routes.py b/src/api/blackboard_routes.py index 0974dc0..64038f3 100644 --- a/src/api/blackboard_routes.py +++ b/src/api/blackboard_routes.py @@ -261,9 +261,24 @@ async def get_comments(project_id: str, task_id: str, @router.post("/tasks/{task_id}/comments") async def add_comment(project_id: str, task_id: str, body: Dict[str, Any]): bb = _bb(project_id) + mentions_raw = body.get("mentions") cid = bb.add_comment(task_id, body["author"], body["body"], comment_type=body.get("comment_type", "general"), - mentions=body.get("mentions")) + mentions=mentions_raw) + # v2.9 #01: 写入 mention_queue + if mentions_raw: + if isinstance(mentions_raw, str): + import json as _json + try: + mentions_list = _json.loads(mentions_raw) + except Exception: + mentions_list = [] + elif isinstance(mentions_raw, list): + mentions_list = mentions_raw + else: + mentions_list = [] + if mentions_list: + bb.record_mentions(cid, task_id, mentions_list) return {"ok": True, "comment_id": cid}