A simple image understanding workflow runs out of time
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
1.1.3
Cloud or Self Hosted
Cloud
Steps to reproduce
Bug Description
I wrote a workflow to get image info, when I upload a 2.9 MB image file, it runs more then 2 hours and hasn't finished now.
but if I upload a 240 KB image file, it's fast to get the result, only 32s.
and I tried this workflow in dify v0.15.x, upload the same 2.9 MB image file, it's fast to get the result too.
Reproduce
1. Import this DSL
cat Vision.yml
app:
description: ''
icon: 🤖
icon_background: '#FFEAD5'
mode: workflow
name: Vision
use_icon_as_answer_icon: false
dependencies:
- current_identifier: null
type: marketplace
value:
marketplace_plugin_unique_identifier: langgenius/volcengine_maas:0.0.10@ba0a7fc3151e89bf8645cd3abb3ccff971ee59e5b1127efca50b092dbb93bf80
kind: app
version: 0.1.5
workflow:
conversation_variables: []
environment_variables: []
features:
file_upload:
allowed_file_extensions:
- .JPG
- .JPEG
- .PNG
- .GIF
- .WEBP
- .SVG
allowed_file_types:
- image
allowed_file_upload_methods:
- local_file
- remote_url
enabled: false
fileUploadConfig:
audio_file_size_limit: 50
batch_count_limit: 5
file_size_limit: 15
image_file_size_limit: 10
video_file_size_limit: 100
workflow_file_upload_limit: 10
image:
enabled: false
number_limits: 3
transfer_methods:
- local_file
- remote_url
number_limits: 3
opening_statement: ''
retriever_resource:
enabled: true
sensitive_word_avoidance:
enabled: false
speech_to_text:
enabled: false
suggested_questions: []
suggested_questions_after_answer:
enabled: false
text_to_speech:
enabled: false
language: ''
voice: ''
graph:
edges:
- data:
isInIteration: false
sourceType: llm
targetType: end
id: 1732269851607-source-1732248953168-target
source: '1732269851607'
sourceHandle: source
target: '1732248953168'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: start
targetType: llm
id: 1732095090452-source-1732269851607-target
source: '1732095090452'
sourceHandle: source
target: '1732269851607'
targetHandle: target
type: custom
zIndex: 0
nodes:
- data:
desc: ''
selected: false
title: 开始
type: start
variables:
- allowed_file_extensions: []
allowed_file_types:
- image
allowed_file_upload_methods:
- local_file
- remote_url
label: image
max_length: 48
options: []
required: false
type: file
variable: image
height: 90
id: '1732095090452'
position:
x: 262.5686389829273
y: 561.5650822501483
positionAbsolute:
x: 262.5686389829273
y: 561.5650822501483
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
desc: ''
outputs:
- value_selector:
- '1732269851607'
- text
variable: result
selected: false
title: 结束
type: end
height: 90
id: '1732248953168'
position:
x: 881.1955611797839
y: 561.5650822501483
positionAbsolute:
x: 881.1955611797839
y: 561.5650822501483
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
context:
enabled: false
variable_selector: []
desc: ''
model:
completion_params: {}
mode: chat
name: Doubao-1-5-Vision-Pro-32k
provider: langgenius/volcengine_maas/volcengine_maas
prompt_template:
- id: 98954070-0fbd-4835-a9fd-49f27af5f07f
role: system
text: 描述图片信息
- id: 351aaac1-9e48-45ce-a371-01a7dc6add75
role: user
text: ''
selected: true
title: LLM
type: llm
variables: []
vision:
configs:
detail: low
variable_selector:
- '1732095090452'
- image
enabled: true
height: 90
id: '1732269851607'
position:
x: 571.8986719047097
y: 561.5650822501483
positionAbsolute:
x: 571.8986719047097
y: 561.5650822501483
selected: true
sourcePosition: right
targetPosition: left
type: custom
width: 244
viewport:
x: 170.55657787011023
y: -89.59598942773005
zoom: 1.1467788202501001
you can use other vision llm model
2. Upload a image file
image file size >= 2.5 MB
✔️ Expected Behavior
output the llm result as fast as API response, not only fast when upload a small image file.
❌ Actual Behavior
When uploading a large image file, the system freezes
I found a similar unsolved discussion regarding slow image processing in Dify: dift workflow with picture very slow help help [1]. This might provide some insights or additional context to your issue.
For your specific problem, you might want to check the default timeout settings for workflows in Dify. These settings can be adjusted in the dify_config configuration and the .env file to prevent timeouts during processing. The relevant settings include HTTP_REQUEST_MAX_CONNECT_TIMEOUT, HTTP_REQUEST_MAX_READ_TIMEOUT, and HTTP_REQUEST_MAX_WRITE_TIMEOUT, as well as the TEXT_GENERATION_TIMEOUT_MS variable [2][3]. Adjusting these settings might help with the processing time for larger image files.
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other
similar with https://github.com/langgenius/dify-official-plugins/issues/648
it's still running, over 5 hours, Dify Cloud workflow info:
{
"image": {
"dify_model_identity": "__dify__file__",
"id": null,
"tenant_id": "5dc9b061-b522-4640-af25-a464287909f7",
"type": "image",
"transfer_method": "local_file",
"remote_url": "",
"related_id": "218056ee-79f6-4dbf-9c20-62b1e4116de6",
"filename": "DSC09949.jpg",
"extension": ".jpg",
"mime_type": "image/jpeg",
"size": 2891897,
"url": "https://upload.dify.ai/files/218056ee-79f6-4dbf-9c20-62b1e4116de6/file-preview?timestamp=1744171248&nonce=6cf0cfd0fc1ba9e648444d640ab3fa85&sign=ZrJe2vgsfCBvsrRYkGTR8Y5OwVIJt-_cMcln6vTn4dI="
},
"sys.files": [],
"sys.user_id": "23ca85bb-a44c-4138-8e80-c269f8c3ef1f",
"sys.app_id": "88134142-eeab-41dc-b30d-17c10dd783e0",
"sys.workflow_id": "efab7df1-979c-4247-a82e-f7364bf6fe86",
"sys.workflow_run_id": "248f28c6-b3ff-4993-98b8-b4c578b0b00b"
}
the latest error info (dify cloud v1.2.0):
I'm interested in this issue.
I am 1.2.0 version,where I can find the Doubao API, I can't see it in the Marketplace.
@Jimmy-L99 you can try any other vision llm model
@Jimmy-L99你可以尝试任何其他视觉法学硕士模型 @crazywoola I use v1.2.0, and vision can use in chatflow with "发布", I also use the doubao1.5-vision-pro model, but I found the API method still run out of time. This problem has existed since I used 0.15.3, but 0.15.3 can response with
blocking, 1.2.0 Neither streaming nor blocking is available:
import requests
import os
import time
base_url = 'http://host:port/v1'
up_load_url = f'{base_url}/files/upload'
chat_url = f'{base_url}/chat-messages'
api_key = 'apikey'
file_path = 'image.jpeg'
user_id = 'test'
filename = os.path.basename(file_path)
file_extension = file_path.split('.')[-1].lower()
mime_type = f'image/{file_extension}' if file_extension in ['jpeg', 'jpg', 'png', 'webp', 'gif'] else 'application/octet-stream'
upload_headers = {
'Authorization': f'Bearer {api_key}'
}
files = {
'file': (filename, open(file_path, 'rb'), mime_type)
}
upload_data = {
'user': user_id
}
# 上传文件
upload_response = requests.post(up_load_url, headers=upload_headers, files=files, data=upload_data)
print(upload_response.json())
file_id = upload_response.json().get('id')
print("文件 ID:", file_id)
print("上传完成,等待 3 秒...")
time.sleep(3)
# 发送聊天请求
chat_headers = {
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
}
chat_data = {
"inputs": {
"image": {
"type": "image",
"transfer_method": "local_file",
"upload_file_id": file_id
}
},
"query": "图中有什么?",
"response_mode": "blocking",
"conversation_id": "",
"user": user_id,
"files": []
}
response = requests.post(chat_url, headers=chat_headers, json=chat_data, stream=False)
if response.status_code == 200:
print("流式响应开始:")
for line in response.iter_lines():
if line:
decoded_line = line.decode('utf-8')
if decoded_line.startswith('data:'):
data = decoded_line[5:].strip()
print(data)
else:
print(f"Error: {response.status_code}")
print(response.text)
In dify "发布" is work successfully.
But with http post, I have been waiting for the vision node over 10 minutes
{'id': 'b62965d9-c741-4bcf-bf2b-c13aa8d6917f', 'name': 'DJI_20240701140738_0005_Z_Area02-57degrees-sampling20x-J66-H6-W.jpeg', 'size': 4653056, 'extension': 'jpeg', 'mime_type': 'image/jpeg', 'created_by': '3daf1624-bb45-445a-8d8a-73abc4a4610d', 'created_at': 1744272021}
文件 ID: b62965d9-c741-4bcf-bf2b-c13aa8d6917f
上传完成,等待 3 秒...
Error: 400
{"code": "invalid_param", "message": "Run failed: [volcengine_maas] Error: PluginDaemonInternalServerError: killed by timeout", "status": 400}
good job 👍🏻
This should be fixed in next version with the new plugin daemon.