|
@@ -22,7 +22,8 @@ from pqai_agent.utils.db_utils import create_ai_agent_db_engine
|
|
|
from pqai_agent.utils.prompt_utils import format_agent_profile, format_user_profile
|
|
|
from pqai_agent_server.const import AgentApiConst
|
|
|
from pqai_agent_server.models import MySQLSessionManager
|
|
|
-from pqai_agent_server.utils import wrap_response, quit_human_intervention_status
|
|
|
+import pqai_agent_server.utils
|
|
|
+from pqai_agent_server.utils import wrap_response
|
|
|
from pqai_agent_server.utils import (
|
|
|
run_extractor_prompt,
|
|
|
run_chat_prompt,
|
|
@@ -297,8 +298,8 @@ def send_message():
|
|
|
return wrap_response(200, msg="暂不实现功能")
|
|
|
|
|
|
|
|
|
-@app.route("/api/quitHumanInterventionStatus", methods=["POST"])
|
|
|
-def quit_human_interventions_status():
|
|
|
+@app.route("/api/quitHumanIntervention", methods=["POST"])
|
|
|
+def quit_human_intervention():
|
|
|
"""
|
|
|
退出人工介入状态
|
|
|
:return:
|
|
@@ -308,9 +309,27 @@ def quit_human_interventions_status():
|
|
|
user_id = req_data["user_id"]
|
|
|
if not user_id or not staff_id:
|
|
|
return wrap_response(404, msg="user_id and staff_id are required")
|
|
|
- response = quit_human_intervention_status(user_id, staff_id)
|
|
|
+ if pqai_agent_server.utils.common.quit_human_intervention(user_id, staff_id):
|
|
|
+ return wrap_response(200, msg="success")
|
|
|
+ else:
|
|
|
+ return wrap_response(500, msg="error")
|
|
|
|
|
|
- return wrap_response(200, data=response)
|
|
|
+
|
|
|
+@app.route("/api/enterHumanIntervention", methods=["POST"])
|
|
|
+def enter_human_intervention():
|
|
|
+ """
|
|
|
+ 进入人工介入状态
|
|
|
+ :return:
|
|
|
+ """
|
|
|
+ req_data = request.json
|
|
|
+ staff_id = req_data["staff_id"]
|
|
|
+ user_id = req_data["user_id"]
|
|
|
+ if not user_id or not staff_id:
|
|
|
+ return wrap_response(404, msg="user_id and staff_id are required")
|
|
|
+ if pqai_agent_server.utils.common.enter_human_intervention(user_id, staff_id):
|
|
|
+ return wrap_response(200, msg="success")
|
|
|
+ else:
|
|
|
+ return wrap_response(500, msg="error")
|
|
|
|
|
|
## Agent管理接口
|
|
|
@app.route("/api/getNativeAgentList", methods=["GET"])
|