/chat-messages (service api) `files` parameter transfer_method to add `tool file` type
Self Checks
- [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.
1. Is this request related to a challenge you're experiencing? Tell me about your story.
In chatworkflow, I use advanced-tool-integration to return images. I hope to pass these images to another chatflow through api /chat-messages.So,I hope support /chat-messages (service api) files parameter transfer_method to tool file type.
2. Additional context or comments
No response
3. Can you help us with this feature?
- [X] I am interested in contributing to this feature.
Hi, @wow-ww. I'm Dosu, and I'm helping the Dify team manage their backlog. I'm marking this issue as stale.
Issue Summary:
- Enhancement request for
/chat-messagesAPI to include afilesparameter. - Proposed
transfer_methodfor handlingtool filetypes. - Aimed at enabling image transfer in chat workflows.
- You expressed interest in contributing to this feature.
- No further comments or activity since the initial request.
Next Steps:
- Please confirm if this issue is still relevant to the latest version of Dify by commenting here.
- If there is no response, the issue will be automatically closed in 15 days.
Thank you for your understanding and contribution!
Hi, @wow-ww. I'm Dosu, and I'm helping the Dify team manage their backlog. I'm marking this issue as stale.嗨,。我是 Dosu,我在帮助 Dify 团队管理他们的待办事项。我将这个问题标记为过时。
Issue Summary: 问题摘要:
- Enhancement request for
/chat-messagesAPI to include afilesparameter.增强请求,为/chat-messagesAPI 添加files参数。- Proposed
transfer_methodfor handlingtool filetypes.建议为处理tool file类型使用transfer_method。- Aimed at enabling image transfer in chat workflows.旨在实现聊天流程中的图像传输。
- You expressed interest in contributing to this feature.您表示有兴趣为此功能做出贡献。
- No further comments or activity since the initial request.自初始请求以来,无进一步评论或活动。
Next Steps: 下一步:
- Please confirm if this issue is still relevant to the latest version of Dify by commenting here.请在此处评论确认此问题是否仍适用于 Dify 的最新版本。
- If there is no response, the issue will be automatically closed in 15 days.如果没有响应,问题将在 15 天后自动关闭。
Thank you for your understanding and contribution!感谢您的理解与贡献!
@dosubot this issue is still relevant to the latest version of Dify.
@takatost, the user @wow-ww has confirmed that this issue regarding the enhancement request for the /chat-messages API to include a files parameter is still relevant to the latest version of Dify. Could you please assist them with this?
@takatost, the user @wow-ww has confirmed that this issue regarding the enhancement request for the
/chat-messagesAPI to include afilesparameter is still relevant to the latest version of Dify. Could you please assist them with this?
my solution
api\core\app\apps\advanced_chat\app_generator.py
def generate():
……
# parse files
files = args["files"] if args.get("files") else []
file_extra_config = FileUploadConfigManager.convert(
workflow.features_dict, is_vision=False)
# modify config,add tool_file transfermethod
if file_extra_config and file_extra_config.image_config:
if file_factory.FileTransferMethod.TOOL_FILE not in file_extra_config.image_config.transfer_methods:
file_extra_config.image_config.transfer_methods.append(
file_factory.FileTransferMethod.TOOL_FILE)
if file_extra_config:
file_objs = file_factory.build_from_mappings(
mappings=files,
tenant_id=app_model.tenant_id,
config=file_extra_config,
)
else:
file_objs = []
And api\factories\file_factory.py
def build_from_message_file(
*,
message_file: "MessageFile",
tenant_id: str,
config: FileUploadConfig,
):
# memory mode add tool file transfer_method
if message_file.transfer_method == FileTransferMethod.TOOL_FILE:
mapping = {
"transfer_method": message_file.transfer_method,
"tool_file_id": message_file.upload_file_id,
"type": message_file.type,
}
if FileTransferMethod.TOOL_FILE not in config.image_config.transfer_methods:
config.image_config.transfer_methods.append(
FileTransferMethod.TOOL_FILE)
else:
mapping = {
"transfer_method": message_file.transfer_method,
"url": message_file.url,
"id": message_file.id,
"type": message_file.type,
"upload_file_id": message_file.upload_file_id,
}
return build_from_mapping(
mapping=mapping,
tenant_id=tenant_id,
config=config,
)
Hey @wow-ww! It looks like you're diving into some feature requests and enhancements for the Dify API. While I can help with bugs, technical questions, and engineering knowledge, I'm not equipped to handle feature requests or manage backlog issues. If you think I should be able to help with this, feel free to reach out to the Dosu Team. They'll be happy to hear your thoughts! 😊
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