external knowledge base metadata_condition support
- Dominant language
- TypeScript
- Stars
- 156k
- Forks
- 24.6k
- Avg merge
- 22h 9m
- Merged PRs (30d)
- 610
Description
### Self Checks
- [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542).
- [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 submit this report, otherwise it will be closed.
- [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.
I'm using Dify v1.15.0 with external custom knowledge base API, and there are critical limitations on metadata_condition in both Workflow and Chatflow's Knowledge Retrieval nodes:
1. Standard Workflow Node Issue
- Metadata filter only supports static hardcode text, cannot bind workflow input variables like {{industry}} / {{device}}. Variable placeholders will not be parsed during runtime, which breaks dynamic filtering for external vector database.
- If multiple external knowledge bases are selected in one retrieval node, the whole metadata filter panel disappears and becomes unusable.
2. Chatflow Node Issue
- Though the Automatic metadata extract mode works, there is no entry to inject pre-defined global metadata variables passed from upstream gateway (Hermes) into metadata_condition.
3. General Defect for both
We cannot fully customize the complete metadata_condition structure, including AND/OR logical operators and multi-layer filter groups to match business external retrieval API schema.
My business scenario is a security expert assistant connected with Hermes and WeCom. We rely on metadata tags like industry, device_type, rule_priority to filter SIEM security docs dynamically. Current restrictions force us to discard the native Knowledge Retrieval node and use raw HTTP nodes to implement retrieval manually, which raises maintenance cost and loses Dify's built-in RAG ability.
### 2. Additional context or comments
Dify Version: v1.15.0
Expected improvements:
1. Support dynamic workflow/chatflow variables binding in metadata filter for external knowledge base retrieval nodes.
2. Keep metadata filter panel visible when selecting multiple external knowledge bases.
3. Allow full custom editing of metadata_condition structure (logical operator, multi-condition groups) for external knowledge API.
4. Add manual metadata input area in Chatflow retrieval node to receive custom metadata passed from API request params.
Related duplicate ticket: #38497 Support variable assignment in the metadata filter
### 3. Can you help us with this feature?
- [x] I am interested in contributing to this feature.
Contributor guide
Research direction
No files, tests, or entry points are named; first compare the Workflow and Chatflow Knowledge Retrieval implementations and review duplicate issue #38497. Done means the agreed scope supports variable-bound metadata, multiple external knowledge bases, and the required metadata_condition structure, with coverage for the affected retrieval flows.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, typescript
- Domain
- ai, backend-api-design, full-stack
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100