Can the user upload attachments on the front end? #1009

Closed
opened 2026-02-21 17:29:28 -05:00 by yindo · 2 comments
Owner

Originally created by @hponiang on GitHub (Jan 31, 2024).

Self Checks

Provide a description of the help you need

Can the user upload attachments on the front end?such as when I want to upload an audio recording file. It should then invoke the audio-to-text function and, following the prompted keywords, organize the content accordingly.

Originally created by @hponiang on GitHub (Jan 31, 2024). ### Self Checks - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to file this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). ### Provide a description of the help you need Can the user upload attachments on the front end?such as when I want to upload an audio recording file. It should then invoke the audio-to-text function and, following the prompted keywords, organize the content accordingly.
yindo added the 💪 enhancement label 2026-02-21 17:29:28 -05:00
yindo closed this issue 2026-02-21 17:29:28 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jan 31, 2024):

🤖

Yes, the dify front end does support user uploads of attachments like audio recording files. This is evident from the post method in the AudioApi class where it retrieves the file from the request with file = request.files['file']. The uploaded audio file is then passed to the AudioService.transcript_asr method, which presumably performs the audio-to-text transcription. Here is the relevant code:

class AudioApi(AppApiResource):
    def post(self, app_model: App, end_user):
        app_model_config: AppModelConfig = app_model.app_model_config

        if not app_model_config.speech_to_text_dict['enabled']:
            raise AppUnavailableError()

        file = request.files['file']

        try:
            response = AudioService.transcript_asr(
                tenant_id=app_model.tenant_id,
                file=file,
                end_user=end_user
            )

            return response
        ...

You can find this in the api/controllers/service_api/app/audio.py file.

As for the organization of content based on prompted keywords after the audio-to-text transcription, the dify platform organizes content through a series of steps in the AssistantCotApplicationRunner class. The run method is the main entry point for the process. It organizes the prompt messages using the _organize_cot_prompt_messages method. This method checks the prompt messages, converts the agent scratchpad list to a string, and organizes the prompt messages based on the mode (either "completion" or "chat"). It replaces placeholders in the system message with the appropriate values (like instruction, tools, tool names, etc.) and organizes the prompt messages accordingly. You can find more details in the api/core/features/assistant_cot_runner.py file.

However, I wasn't able to find any specific UI component for uploading audio files in the dify repository. It's possible that this functionality is handled by a separate front-end application that interacts with the dify API. If you have more specific questions about the front-end implementation or if there's anything else you'd like to know, please let me know!

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@dosubot[bot] commented on GitHub (Jan 31, 2024): _🤖_ <!-- Answer --> Yes, the dify front end does support user uploads of attachments like audio recording files. This is evident from the `post` method in the `AudioApi` class where it retrieves the file from the request with `file = request.files['file']`. The uploaded audio file is then passed to the `AudioService.transcript_asr` method, which presumably performs the audio-to-text transcription. Here is the relevant code: ```py class AudioApi(AppApiResource): def post(self, app_model: App, end_user): app_model_config: AppModelConfig = app_model.app_model_config if not app_model_config.speech_to_text_dict['enabled']: raise AppUnavailableError() file = request.files['file'] try: response = AudioService.transcript_asr( tenant_id=app_model.tenant_id, file=file, end_user=end_user ) return response ... ``` You can find this in the [api/controllers/service_api/app/audio.py](https://github.com/langgenius/dify/blob/main/api/controllers/service_api/app/audio.py) file. As for the organization of content based on prompted keywords after the audio-to-text transcription, the dify platform organizes content through a series of steps in the `AssistantCotApplicationRunner` class. The `run` method is the main entry point for the process. It organizes the prompt messages using the `_organize_cot_prompt_messages` method. This method checks the prompt messages, converts the agent scratchpad list to a string, and organizes the prompt messages based on the mode (either "completion" or "chat"). It replaces placeholders in the system message with the appropriate values (like instruction, tools, tool names, etc.) and organizes the prompt messages accordingly. You can find more details in the [api/core/features/assistant_cot_runner.py](https://github.com/langgenius/dify/blob/main/api/core/features/assistant_cot_runner.py) file. However, I wasn't able to find any specific UI component for uploading audio files in the dify repository. It's possible that this functionality is handled by a separate front-end application that interacts with the dify API. If you have more specific questions about the front-end implementation or if there's anything else you'd like to know, please let me know! ## Sources - [api/controllers/web/audio.py](https://github.com/langgenius/dify/blob/main/api/controllers/web/audio.py) - [api/controllers/service_api/app/audio.py](https://github.com/langgenius/dify/blob/main/api/controllers/service_api/app/audio.py) - [api/core/features/assistant_cot_runner.py](https://github.com/langgenius/dify/blob/main/api/core/features/assistant_cot_runner.py) --- This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot.
Author
Owner

@crazywoola commented on GitHub (Jan 31, 2024):

Duplicate https://github.com/langgenius/dify/issues/1842

@crazywoola commented on GitHub (Jan 31, 2024): Duplicate https://github.com/langgenius/dify/issues/1842
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#1009