[PR #5253] fix: visioin model always with low quality #24846

Closed
opened 2026-02-21 20:23:47 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/5253

State: closed
Merged: Yes


Description

Fixes #5117

The resolution parameter is stored in the LLM node's node_data.vision.configs.detail, but currently it's not used during prompt message generation.
The FileVar of the image is generated using the file_extra_config created from workflow.features_dict in the WorkflowAppGenerator. I do not understand how the detail is set in this file_extra_config (perhaps it can be specified via the API?), but by default, the file_extra_config does not have a detail parameter, so the default LOW is set and always used.

In this PR, I have modified it to override with the detail of each node’s vision config during LLM Node execution. I wonder if this behavior is acceptable since the 'detail' in file_extra_config will never be used in the LLM node.
Please let me know if any adjustments are needed, or feel free to close if this doesn't make sense.

Screenshot for verification:
CleanShot 2024-06-15 at 18 06 17

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update, included: Dify Document
  • Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement
  • Dependency upgrade

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • TODO

Suggested Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
  • optional I have made corresponding changes to the documentation
  • optional I have added tests that prove my fix is effective or that my feature works
  • optional New and existing unit tests pass locally with my changes
**Original Pull Request:** https://github.com/langgenius/dify/pull/5253 **State:** closed **Merged:** Yes --- # Description Fixes #5117 The resolution parameter is stored in the LLM node's `node_data.vision.configs.detail`, but currently it's not used during prompt message generation. The FileVar of the image is [generated using the `file_extra_config` ](https://github.com/langgenius/dify/blob/4f0488abb538944e8f7d317ff78d3dae34e5ad2f/api/core/file/message_file_parser.py#L145)created from [`workflow.features_dict` in the WorkflowAppGenerator](https://github.com/langgenius/dify/blob/4f0488abb538944e8f7d317ff78d3dae34e5ad2f/api/core/app/apps/workflow/app_generator.py#L55). I do not understand how the `detail` is set in this file_extra_config (perhaps it can be specified via the API?), but by default, the file_extra_config does not have a `detail` parameter, so[ the default LOW is set and always used](https://github.com/langgenius/dify/blob/4f0488abb538944e8f7d317ff78d3dae34e5ad2f/api/core/file/file_obj.py#L112). In this PR, I have modified it to override with the detail of each node’s vision config during LLM Node execution. I wonder if this behavior is acceptable since the 'detail' in `file_extra_config` will never be used in the LLM node. Please let me know if any adjustments are needed, or feel free to close if this doesn't make sense. Screenshot for verification: ![CleanShot 2024-06-15 at 18 06 17](https://github.com/langgenius/dify/assets/8503062/3d25a4a0-db01-4e19-b556-32d8bd2f8b17) ## Type of Change Please delete options that are not relevant. - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [ ] Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement - [ ] Dependency upgrade # How Has This Been Tested? Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration - [ ] TODO # Suggested Checklist: - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] My changes generate no new warnings - [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods - [ ] `optional` I have made corresponding changes to the documentation - [ ] `optional` I have added tests that prove my fix is effective or that my feature works - [ ] `optional` New and existing unit tests pass locally with my changes
yindo added the pull-request label 2026-02-21 20:23:47 -05:00
yindo closed this issue 2026-02-21 20:23:47 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#24846