18 lines
768 B
Plaintext
18 lines
768 B
Plaintext
# kb_ingest_decide.dspy - owner 批准/驳回「知识库入库建议」(待办内完成)
|
|
|
|
user_id = await get_user()
|
|
if not user_id:
|
|
return json.dumps({"success": False, "error": "未登录"}, ensure_ascii=False)
|
|
|
|
suggestion_id = params_kw.get('suggestion_id', '').strip()
|
|
approve = params_kw.get('approve', '').strip().lower() in ('1', 'true', 'yes', '批准')
|
|
comment = params_kw.get('comment', '')
|
|
|
|
if not suggestion_id:
|
|
return json.dumps({"success": False, "error": "缺少 suggestion_id"}, ensure_ascii=False)
|
|
|
|
ok, msg = await decide_kb_ingest(suggestion_id, approve, user_id, comment=comment)
|
|
if ok:
|
|
return json.dumps({"success": True, "message": msg}, ensure_ascii=False)
|
|
return json.dumps({"success": False, "error": msg}, ensure_ascii=False)
|