langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
51.82k stars 7.51k forks source link

unable to use sys.files in nodes of a workflow #8881

Closed delvin-sparkle closed 1 month ago

delvin-sparkle commented 1 month ago

Self Checks

Dify version

0.8.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

the same issue with

https://github.com/langgenius/dify/discussions/3370

I selected the vision model gpt-4-turbo,and turned the vision switch at the bottom of LLM node on,but I still cannot use sys.files

image

✔️ Expected Behavior

be able to use sys.files in a node

❌ Actual Behavior

unable to use sys.files in nodes of a workflow

dosubot[bot] commented 1 month ago

I found a similar discussion and a closed issue that might help address your problem.

  1. How to pass sys.files uploaded by the user in the starting node to the LLM in the workflow? - This discussion addresses the issue of using sys.files in a workflow node after selecting the vision model gpt-4-turbo and enabling the vision switch. It suggests that additional configurations might be required to pass user-uploaded files to the LLM in the workflow [1].

  2. The variable "sys.files" cannot be obtained in other nodes of the workflow. - This closed issue provides a workaround for accessing sys.files in intermediate nodes. It involves using the getNodeOutputVars function to ensure that sys.files is included in the output variables of intermediate nodes [2].

To address your issue, ensure that the isShowVisionConfig condition is true for the vision configuration, including sys.files, to be available. This is controlled by the following code:

const isShowVisionConfig = !!currModel?.features?.includes(ModelFeatureEnum.vision);

Make sure isShowVisionConfig is set to true in your configuration to enable the vision-related settings [3][4].

Additionally, ensure that the image upload function is enabled in the 'Features' section in the upper right corner of the application orchestration page. The workflow should be configured to handle file variables properly by fetching files from the variable pool using the _fetch_files method and converting tool messages to include files using the _convert_tool_messages method [5][6].

By following these steps, you should be able to use sys.files in your workflow nodes.

To continue talking to Dosu, mention @dosu.

crazywoola commented 1 month ago

See pinned issue, we are working on it