cannot add file to chat/app in extension plugin #24

Closed
opened 2026-02-15 21:15:20 -05:00 by yindo · 2 comments
Owner

Originally created by @jifanyangclare on GitHub (Apr 1, 2025).

I notices in dify plugin docs it says:

Image

but I didn't see the files field in my installed sdk code.
And I found this commit several months ago which removed all files field

Image

Can you guys help update docs and indicate where developers can add files to chat/app in current version??

Originally created by @jifanyangclare on GitHub (Apr 1, 2025). I notices in dify plugin docs it says: <img width="667" alt="Image" src="https://github.com/user-attachments/assets/245432a6-a3bb-4dd1-bb42-02aba306b914" /> but I didn't see the `files` field in my installed sdk code. And I found this commit several months ago which removed all `files` field <img width="943" alt="Image" src="https://github.com/user-attachments/assets/e72b104b-23fb-4c79-92ab-2df7f00f840a" /> Can you guys help update docs and indicate where developers can add files to chat/app in current version??
yindo closed this issue 2026-02-15 21:15:20 -05:00
Author
Owner

@jifanyangclare commented on GitHub (Apr 1, 2025):

cc author @Yeuoly

@jifanyangclare commented on GitHub (Apr 1, 2025): cc author @Yeuoly
Author
Owner

@Mairuis commented on GitHub (Dec 9, 2025):

Hi @jifanyangclare,

Thanks for raising this issue. The files parameter was intentionally removed from the SDK's app invocation methods. Here's the correct way to pass files when invoking an app from a plugin:

Correct Usage

1. Upload the file first

# Upload file using session.file.upload()
file_response = self.session.file.upload(
    filename="image.jpg",
    content=image_bytes,  # bytes
    mimetype="image/jpeg"
)

2. Convert to app parameter format

# Use the built-in helper method
file_param = file_response.to_app_parameter()
# Returns:
# {
#     "upload_file_id": "uuid-xxx",
#     "transfer_method": "local_file",
#     "type": "image"
# }

3. Pass as an input variable

# Pass the file as an input variable (the variable must be defined as a file type in your app)
response = self.session.app.chat.invoke(
    app_id="your-app-id",
    query="Analyze this image",
    inputs={
        "my_file_variable": file_param  # File passed as input variable
    },
    response_mode="streaming"
)

Important Note

The sys.files and userinput.files system variables are being deprecated. Please use custom file-type input variables instead of relying on these system variables.

Summary

  • Don't use a files parameter (it was removed)
  • Upload files via session.file.upload()
  • Pass files through inputs as file-type variables
  • ⚠️ sys.files and userinput.files are being deprecated

We'll update the documentation to clarify this. Closing this issue as the current design is intentional.

@Mairuis commented on GitHub (Dec 9, 2025): Hi @jifanyangclare, Thanks for raising this issue. The `files` parameter was intentionally removed from the SDK's app invocation methods. Here's the correct way to pass files when invoking an app from a plugin: ## Correct Usage ### 1. Upload the file first ```python # Upload file using session.file.upload() file_response = self.session.file.upload( filename="image.jpg", content=image_bytes, # bytes mimetype="image/jpeg" ) ``` ### 2. Convert to app parameter format ```python # Use the built-in helper method file_param = file_response.to_app_parameter() # Returns: # { # "upload_file_id": "uuid-xxx", # "transfer_method": "local_file", # "type": "image" # } ``` ### 3. Pass as an input variable ```python # Pass the file as an input variable (the variable must be defined as a file type in your app) response = self.session.app.chat.invoke( app_id="your-app-id", query="Analyze this image", inputs={ "my_file_variable": file_param # File passed as input variable }, response_mode="streaming" ) ``` ## Important Note The `sys.files` and `userinput.files` system variables are being deprecated. Please use custom file-type input variables instead of relying on these system variables. ## Summary - ❌ Don't use a `files` parameter (it was removed) - ✅ Upload files via `session.file.upload()` - ✅ Pass files through `inputs` as file-type variables - ⚠️ `sys.files` and `userinput.files` are being deprecated We'll update the documentation to clarify this. Closing this issue as the current design is intentional.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-plugin-sdks#24