|
|
@@ -120,17 +120,18 @@ async def update_dialog_status_service(db, dialog_id, status, user_id):
|
|
|
chat = ChatBaseApply()
|
|
|
token = await get_chat_token(db, dialog_id)
|
|
|
if not token:
|
|
|
- workflow = await get_app_token(db, workflow_server)
|
|
|
- if workflow:
|
|
|
+ access_token = await get_app_token(db, workflow_server)
|
|
|
+ # print(workflow)
|
|
|
+ if access_token:
|
|
|
url = settings.dify_base_url + DF_CHAT_API_KEY.format(dialog_id)
|
|
|
- param = await chat.chat_get(url, {}, await chat.get_headers(workflow.access_token))
|
|
|
+ param = await chat.chat_get(url, {}, await chat.get_headers(access_token))
|
|
|
if param and param.get("data"):
|
|
|
token = param.get("data", [{}])[0].get("token")
|
|
|
token_id = param.get("data", [{}])[0].get("id")
|
|
|
await add_chat_token(db, {"id":token_id, "app_id": dialog_id, "type":"app", "token": token})
|
|
|
# dialog.parameters = json.dumps(param)
|
|
|
else:
|
|
|
- param = await chat.chat_post(url, {}, await chat.get_headers(workflow.access_token))
|
|
|
+ param = await chat.chat_post(url, {}, await chat.get_headers(access_token))
|
|
|
if param:
|
|
|
token = param.get("token")
|
|
|
token_id = param.get("id")
|