dify
dify copied to clipboard
Use API to call dify workflow, error 500 since v0.10.1
Self Checks
- [X] This is only for bug report, if you would like to ask a question, please head to Discussions.
- [X] I have searched for existing issues search for existing issues, including closed ones.
- [X] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
- [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
- [X] Please do not modify this template :) and fill in all the required fields.
Dify version
v0.10.1
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
- use API:data = {
"query": query,
"inputs": {}, # 如果有其他输入变量,可以在这里添加
"response_mode": "blocking",
"user": user_id, "conversation_id": conversation_id } headers = { 'Authorization': f'Bearer {self.api_key}', 'Content-Type': 'application/json' } url = f"{self.api_base}/chat-messages" response = requests.post(url, headers=headers, data=json.dumps(data), proxies=self.proxy) - return: Error: {"code": "internal_server_error", "message": "The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.", "status": 500}
- check api log:
2024-10-25 08:56:13,673.673 WARNING [Thread-24 (_process_future)] [app_generator_tts_publisher.py:42] - Failed to speech the text, detail: [address=0.0.0.0:40239, pid=1708] Parallel generation is not supported by llama-cpp-python.
2024-10-25 08:56:13,713.713 ERROR [Dummy-22] [completion.py:139] - internal server error.
Traceback (most recent call last):
File "/app/api/controllers/service_api/app/completion.py", line 116, in post
response = AppGenerateService.generate(
File "/app/api/services/app_generate_service.py", line 68, in generate
AdvancedChatAppGenerator().generate(
File "/app/api/core/app/apps/advanced_chat/app_generator.py", line 146, in generate
return self._generate(
File "/app/api/core/app/apps/advanced_chat/app_generator.py", line 263, in _generate
response = self._handle_advanced_chat_response(
File "/app/api/core/app/apps/advanced_chat/app_generator.py", line 363, in _handle_advanced_chat_response
return generate_task_pipeline.process()
File "/app/api/core/app/apps/advanced_chat/generate_task_pipeline.py", line 147, in process
return self._to_blocking_response(generator)
File "/app/api/core/app/apps/advanced_chat/generate_task_pipeline.py", line 154, in _to_blocking_response
for stream_response in generator:
File "/app/api/core/app/apps/advanced_chat/generate_task_pipeline.py", line 219, in _wrapper_process_stream_response
audio_response = self._listen_audio_msg(tts_publisher, task_id=task_id)
File "/app/api/core/app/apps/advanced_chat/generate_task_pipeline.py", line 198, in _listen_audio_msg
if audio_msg and audio_msg.status != "finish":
File "/app/api/.venv/lib/python3.10/site-packages/pydantic/main.py", line 856, in __getattr__
raise AttributeError(f'{type(self).__name__!r} object has no attribute {item!r}')
AttributeError: 'MessageQueueMessage' object has no attribute 'status'
2024-10-25 08:56:13,717.717 ERROR [Dummy-22] [app.py:838] - Exception on /v1/chat-messages [POST]
Traceback (most recent call last):
File "/app/api/controllers/service_api/app/completion.py", line 116, in post
response = AppGenerateService.generate(
File "/app/api/services/app_generate_service.py", line 68, in generate
AdvancedChatAppGenerator().generate(
File "/app/api/core/app/apps/advanced_chat/app_generator.py", line 146, in generate
return self._generate(
File "/app/api/core/app/apps/advanced_chat/app_generator.py", line 263, in _generate
response = self._handle_advanced_chat_response(
File "/app/api/core/app/apps/advanced_chat/app_generator.py", line 363, in _handle_advanced_chat_response
return generate_task_pipeline.process()
File "/app/api/core/app/apps/advanced_chat/generate_task_pipeline.py", line 147, in process
return self._to_blocking_response(generator)
File "/app/api/core/app/apps/advanced_chat/generate_task_pipeline.py", line 154, in _to_blocking_response
for stream_response in generator:
File "/app/api/core/app/apps/advanced_chat/generate_task_pipeline.py", line 219, in _wrapper_process_stream_response
audio_response = self._listen_audio_msg(tts_publisher, task_id=task_id)
File "/app/api/core/app/apps/advanced_chat/generate_task_pipeline.py", line 198, in _listen_audio_msg
if audio_msg and audio_msg.status != "finish":
File "/app/api/.venv/lib/python3.10/site-packages/pydantic/main.py", line 856, in __getattr__
raise AttributeError(f'{type(self).__name__!r} object has no attribute {item!r}')
AttributeError: 'MessageQueueMessage' object has no attribute 'status'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request
rv = self.dispatch_request()
File "/app/api/.venv/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 489, in wrapper
resp = resource(*args, **kwargs)
File "/app/api/.venv/lib/python3.10/site-packages/flask/views.py", line 110, in view
return current_app.ensure_sync(self.dispatch_request)(**kwargs) # type: ignore[no-any-return]
File "/app/api/.venv/lib/python3.10/site-packages/flask_restful/__init__.py", line 604, in dispatch_request
resp = meth(*args, **kwargs)
File "/app/api/controllers/service_api/wraps.py", line 76, in decorated_view
return view_func(*args, **kwargs)
File "/app/api/controllers/service_api/app/completion.py", line 140, in post
raise InternalServerError()
werkzeug.exceptions.InternalServerError: 500 Internal Server Error: The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
✔️ Expected Behavior
Use API to call dify workflow can normally run
❌ Actual Behavior
Error: {"code": "internal_server_error", "message": "The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.", "status": 500}