dify - ✅(Solved) Fix [Bug]: Uploaded documents are not passed to Agent context (unlike Vision feature) [1 pull requests, 2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langgenius/dify#35175Fetched 2026-04-15 06:45:34
View on GitHub
Comments
2
Participants
2
Timeline
7
Reactions
2
Author
Participants
Timeline (top)
commented ×2labeled ×2cross-referenced ×1mentioned ×1

Fix Action

Fixed

PR fix notes

PR #35188: fix: agent file context gating to support document-capable models

Description (problem / solution / changelog)

Fixes #35175

Problem

Agent runtime was incorrectly tying file context strictly to vision capability, causing document uploads to be ignored even when the model supported documents. This change aligns file forwarding with actual model file capabilities while preserving existing safeguards for unsupported models.

Summary

This PR fixes a bug where uploaded files were not passed to Agent context unless the selected model had vision support. Agent file forwarding now correctly works for models that support either vision or document, which resolves the behavior reported in #35175.

Changed files

  • api/core/agent/base_agent_runner.py (modified, +4/-2)
  • api/core/agent/cot_chat_agent_runner.py (modified, +2/-1)
  • api/core/agent/fc_agent_runner.py (modified, +2/-1)
  • api/core/memory/token_buffer_memory.py (modified, +2/-1)
  • api/core/prompt/advanced_prompt_transform.py (modified, +21/-5)
  • api/core/prompt/simple_prompt_transform.py (modified, +9/-2)
  • api/core/prompt/utils/image_detail_config.py (added, +11/-0)
  • api/tests/unit_tests/core/agent/test_base_agent_runner.py (modified, +76/-0)
  • api/tests/unit_tests/core/prompt/utils/test_image_detail_config.py (added, +18/-0)
  • web/app/components/app/configuration/debug/debug-with-multiple-model/chat-item.tsx (modified, +2/-1)
  • web/app/components/app/configuration/debug/debug-with-single-model/index.tsx (modified, +2/-1)
  • web/app/components/app/configuration/debug/index.tsx (modified, +5/-3)
RAW_BUFFERClick to expand / collapse

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.3.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Create a new Agent application.
  2. Select a model that natively supports documents (e.g., gemini-3-flash-preview).
  3. In the features/settings panel, toggle the Document feature to ON (alongside Vision/Audio if desired).
  4. Go to the chat interface, upload a document file (e.g., PDF, TXT), and ask the Agent a question about the document's content.

✔️ Expected Behavior

The Agent should be able to read, parse, and utilize the content of the uploaded document to answer the user's prompt, just as it successfully does with images when the "Vision" feature is enabled.

❌ Actual Behavior

The Agent completely ignores the uploaded document or claims it cannot see any document context. While image uploads work perfectly when "Vision" is toggled on, document uploads do not seem to be passed to the agent's context despite the model supporting it and the UI indicating that the document feature is active.

<img width="1920" height="889" alt="Image" src="https://github.com/user-attachments/assets/89da5afb-8c3a-4955-8c9d-cfaa3dfa3eed" />

extent analysis

TL;DR

The issue may be resolved by verifying the document feature configuration and ensuring that the model is correctly processing the uploaded document.

Guidance

  • Check the model's documentation to confirm that it supports document processing and the required configuration.
  • Verify that the document feature is correctly enabled in the features/settings panel and that the UI is updated to reflect the change.
  • Investigate the Agent's context to determine if the uploaded document is being passed correctly, and if the model is able to access the document's content.
  • Review the Docker configuration to ensure that the document processing dependencies are correctly installed and configured.

Example

No code snippet is provided as the issue does not contain sufficient information to create a specific example.

Notes

The issue may be related to a configuration or dependency issue, and further investigation is required to determine the root cause. The provided image does not contain any relevant information to aid in debugging.

Recommendation

Apply workaround: Verify the document feature configuration and model dependencies to ensure correct processing of uploaded documents. This is recommended as the issue seems to be related to a configuration or dependency issue, and verifying these settings may resolve the problem.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING