Replies: 20 comments 39 replies
-
the I think the |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
Are there any workarounds? |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
I need to provide an explanation regarding this issue: currently, File.url refers to the |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
Now, the question is how we should handle these URLs that will expire soon. They might appear in the current chat, show up in logs, and users could even notice that these addresses quickly become inaccessible within the same conversation (if the chat lasts long enough). I don’t think opening temporary signed URLs is a very elegant solution. We need to find a more practical way to allow users to access the files. |
Beta Was this translation helpful? Give feedback.
-
I discovered that the Of course, if there's no intention to use the temporary URLs anymore, then my approach would indeed no longer be applicable. However, if we plan to continue using temporary URLs, I believe that no node should process a file for longer than the file URL's expiration time. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
In a real application, this function is important. For example, although Dify has word parsing capabilities, it does not sufficiently support some applications, such as splitting chapters using Python-doc tools. Therefore, at least one method should be provided to help users customize the process for their files. Alternatively, there could be a way for users to obtain the file path, which seems more reasonable for processing their uploaded files. |
Beta Was this translation helpful? Give feedback.
-
Currently, files can be used in DocumentExtractor and Built-in Tools, but they are not supported in OpenAPI-based Custom Tools. For Custom Tools, an alternative is to use the HTTP Request Node in Workflow or Chatflow to send files to your own service. However, this approach cannot be used within an Agent. It’s not necessary for every node to support file inputs, as not all nodes are designed to handle files. |
Beta Was this translation helpful? Give feedback.
-
The Custom Tool now supports file handling, thanks to @hjlarry in #10796. Give it a try! (in the main branch) |
Beta Was this translation helpful? Give feedback.
-
Is it possible to mount the |
Beta Was this translation helpful? Give feedback.
-
In my humble opinion, the current issue lies in the inability of the "url" field in the file type to be correctly output. Regardless of how the file is utilized within nodes—for instance, whether it bypasses url transmission in the future or a new node is introduced to handle it—this does not justify the current failure to properly recognize the "url" field. Moreover, if the "url" field is indeed necessary, there are, in my view, only two viable options: either use dynamic urls (which could involve temporary URLs or other methods of generation) or use static urls. To put it simply, if there is no intention to provide a urls externally, this field should not exist to confuse users. Otherwise, it should hold meaningful data rather than remaining empty or null as it does now. In fact, this opinion was previously expressed by @hjlarry , but it seems to have been overlooked. The team's focus has remained on finding ways to retrieve the file itself, rather than examining whether the fields provided in the file type are functioning as expected. We should not continue offering a malfunctioning field. If it remains broken, we should either fix it immediately or remove it altogether. |
Beta Was this translation helpful? Give feedback.
-
so we how to get file content? |
Beta Was this translation helpful? Give feedback.
-
Actually, after I receive pictures or documents, I need to call a third-party API through Dify, and when I transmit these files to the third-party API, I actually have no way to operate:
|
Beta Was this translation helpful? Give feedback.
-
Another solution would be invoking Dify upload API directly. You would need to void validation methods like For docker users, change the file You can import the example DSL file here: app:
description: ''
icon: 🤖
icon_background: '#FFEAD5'
mode: workflow
name: upload-file-and-get-url
use_icon_as_answer_icon: false
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: start
targetType: http-request
id: 1735544988709-source-1735549983067-target
source: '1735544988709'
sourceHandle: source
target: '1735549983067'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: http-request
targetType: code
id: 1735549983067-source-1735550852066-target
source: '1735549983067'
sourceHandle: source
target: '1735550852066'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: code
targetType: end
id: 1735550852066-source-1735550069899-target
source: '1735550852066'
sourceHandle: source
target: '1735550069899'
targetHandle: target
type: custom
zIndex: 0
nodes:
- data:
desc: ''
selected: false
title: Start
type: start
variables:
- allowed_file_extensions: []
allowed_file_types:
- image
- document
allowed_file_upload_methods:
- local_file
label: pdf
max_length: 48
options: []
required: true
type: file
variable: pdf
height: 89
id: '1735544988709'
position:
x: 109
y: 282
positionAbsolute:
x: 109
y: 282
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 243
- data:
authorization:
config: null
type: no-auth
body:
data:
- file:
- '1735544988709'
- pdf
id: key-value-1
key: file
type: file
value: ''
- id: key-value-2
key: ''
type: text
value: ''
type: form-data
desc: ''
headers: Authorization:Bearer <your_dify_api_key>
method: post
params: ''
retry_config:
max_retries: 3
retry_enabled: true
retry_interval: 100
selected: false
timeout:
max_connect_timeout: 0
max_read_timeout: 0
max_write_timeout: 0
title: HTTP request
type: http-request
url: http://<your_dify_host_ip>/api/files/upload
variables: []
height: 134
id: '1735549983067'
position:
x: 411
y: 282
positionAbsolute:
x: 411
y: 282
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 243
- data:
desc: ''
outputs:
- value_selector:
- '1735550852066'
- result
variable: body
selected: false
title: End
type: end
height: 89
id: '1735550069899'
position:
x: 1052
y: 282
positionAbsolute:
x: 1052
y: 282
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 243
- data:
code: "import json\n\ndef main(arg1: str) -> dict:\n data= json.loads(arg1)\n\
\ _id = data['id']\n ret= f'http://<your_dify_host_ip>/files/{_id}/file-preview?timestamp=1&nonce=1&sign=1'\n\
\ return {\n \"result\": ret\n }\n"
code_language: python3
desc: ''
outputs:
result:
children: null
type: string
selected: false
title: Code execution
type: code
variables:
- value_selector:
- '1735549983067'
- body
variable: arg1
height: 53
id: '1735550852066'
position:
x: 714
y: 282
positionAbsolute:
x: 714
y: 282
selected: true
sourcePosition: right
targetPosition: left
type: custom
width: 243
viewport:
x: -740.5
y: 18.5
zoom: 1 |
Beta Was this translation helpful? Give feedback.
-
Steps to reproduce
✔️ Expected Behavior
get the correct file url
❌ Actual Behavior
not get the correct value
Beta Was this translation helpful? Give feedback.
All reactions