-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Closed
Description
Self Checks
- I have read the Contributing Guide and Language Policy.
- This is only for bug report, if you would like to ask a question, please head to Discussions.
- I have searched for existing issues search for existing issues, including closed ones.
- I confirm that I am using English to submit this report, otherwise it will be closed.
- 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
- Please do not modify this template :) and fill in all the required fields.
Dify version
1.6.0
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
def run_workflow(file_id, user, response_mode="streaming"):
workflow_url = WORKFLOW_URL
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
data = {
"inputs": {
"video": {
"transfer_method": "local_file",
"upload_file_id": file_id,
"type": "video"
}
},
"response_mode": response_mode,
"user": user
}
try:
print("运行工作流...")
response = requests.post(workflow_url, headers=headers, json=data)
response.encoding = 'utf-8'
# print("响应内容:", response.text)
if response.status_code == 200:
print("完成运行工作流")
try:
return response.json()
except Exception as e:
return {"status": "error", "message": f"返回内容不是合法JSON: {str(e)}"}
return response
print("返回内容不是合法JSON,原始内容:", response.text)
else:
return {"status": "error", "message": f"{response.text}, status code: {response.status_code}"}
except Exception as e:
print(f"发生错误: {str(e)}")
return {"status": "error", "message": str(e)}
return response.json() error:
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
✔️ Expected Behavior
I checked that the formatting in the text of the response is a bit problematic, and I want to parse the response normally.
❌ Actual Behavior
I called the API of the workflow and everything was fine, but an error was reported in parsing the response, I checked the text format in the response and found that there was a formatting problem in it, and it couldn't be j'son properly.
dosubot
Metadata
Metadata
Assignees
Labels
No labels