|
@@ -152,26 +152,6 @@ def qiwei_post(username: str, answer: str,agentid:str):
|
|
|
logger.info(res.json())
|
|
|
#return res.json()
|
|
|
|
|
|
-def qiwei_post_loading(username: str, answer: str,agentid:str):
|
|
|
- req_data = {
|
|
|
- "touser": username,
|
|
|
- "toparty": "",
|
|
|
- "totag": "",
|
|
|
- "msgtype": "text",
|
|
|
- "agentid": agentid,
|
|
|
- "text": {"content": answer},
|
|
|
- "image": {
|
|
|
- "media_id": "MEDIA_ID"
|
|
|
- },
|
|
|
- "safe": 0,
|
|
|
- "enable_id_trans": 0,
|
|
|
- "enable_duplicate_check": 0,
|
|
|
- "duplicate_check_interval": 1800
|
|
|
- }
|
|
|
- res = requests.post(f"https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token={qiwei_get()}", json=req_data)
|
|
|
- # print(res.json())
|
|
|
- logger.info(res.json())
|
|
|
- #return res.json()
|
|
|
|
|
|
#问题传入字节服务器进行回答后发送给企业微信,行内服务器只进行接收然后发给字节,防止网络延迟
|
|
|
def post_consumer_api(user_query, decrypt_data, request_id):
|
|
@@ -180,9 +160,9 @@ def post_consumer_api(user_query, decrypt_data, request_id):
|
|
|
"decrypt_data": decrypt_data,
|
|
|
"request_id": request_id,
|
|
|
}
|
|
|
+ request_id_context.set(request_id)
|
|
|
url = "https://101.126.81.2:18088/consumer"
|
|
|
try:
|
|
|
- request_id_context.set(request_id)
|
|
|
response = requests.post(url, json=data, verify=False) # 忽略SSL证书验证
|
|
|
response.raise_for_status() # 检查响应状态码是否为200
|
|
|
logger.info(f"post_consumer_api 请求成功: {response.json()}")
|
|
@@ -279,6 +259,8 @@ if __name__ == "__main__":
|
|
|
port = sys.argv[1]
|
|
|
int(port)
|
|
|
except:
|
|
|
- port = 18088
|
|
|
+ port = 18066
|
|
|
+ request_id_context.set("app start")
|
|
|
logger.info(f'{port=}')
|
|
|
+ print(f'{port=}')
|
|
|
uvicorn.run("coze_bot_api:app", port=port, host='0.0.0.0', reload=False,ssl_keyfile="./key.pem", ssl_certfile="./cert.pem")
|