dify/api/core/workflow
Jyong 0340784d57 feat(knowledge-fs): add automatic metadata filtering to retrieval node
Bring the LLM-driven "automatic" metadata filtering mode from the legacy
Knowledge Retrieval node to the KnowledgeFS retrieval node
(knowledge-retrieval-v2).

Backend:
- Accept `automatic` in `metadata_filtering_mode` and add
  `metadata_model_config` to the node entity.
- Add `automatic_metadata_filter.py`, which reuses the legacy metadata
  filter prompt templates, invokes the configured model, parses the JSON
  answer and normalises operators/values against the KnowledgeFS
  metadata catalog before building custom metadata conditions.
- Resolve the shared metadata catalog across the selected spaces through
  the new `list_metadata_fields` app execution capability (paginated),
  fail closed on missing/unavailable models and catalog admission errors,
  fail open on extraction errors, and expose the outcome via
  `metrics.metadata_filtering` and `llm_usage`.
- Inject the default extractor from the node factory.
- Fix an unescaped brace in the legacy completion prompt template that
  broke `.format()`.

Frontend:
- Offer disabled/automatic/manual modes, normalise unknown persisted
  modes to disabled, store the automatic model and completion params,
  render the model selector through the shared MetadataFilter, and
  require a model when saving in automatic mode.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WnUM1CdV5LpcxZEQ2vu9Xc
2026-09-02 02:55:12 -04:00
..
generator chore: remove unnecessary type conversions (#41454) 2026-08-29 07:04:18 +00:00
nodes feat(knowledge-fs): add automatic metadata filtering to retrieval node 2026-09-02 02:55:12 -04:00
__init__.py
file_reference.py
graph_topology.py
human_input_adapter.py feat(workflow): support human input in loop and iteration (#39243) 2026-08-03 02:24:18 +00:00
human_input_forms.py
human_input_policy.py
llm_environment_variable.py feat(workflow): support LLM environment variables (#39125) 2026-08-04 06:17:13 +00:00
llm_node.py fix: meter hosted LLM invocations (#40589) 2026-08-12 12:33:21 +00:00
node_execution_process_data.py refactor: introduce agent working environment architecture (#39480) 2026-07-28 13:16:05 +00:00
node_factory.py feat(knowledge-fs): add automatic metadata filtering to retrieval node 2026-09-02 02:55:12 -04:00
node_runtime.py Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-08-27 10:06:48 +08:00
snippet_start.py
system_variables.py
template_rendering.py
variable_pool_initializer.py
variable_prefixes.py
workflow_entry.py feat(api): track credit usage contexts (#41181) 2026-08-25 10:21:32 +00:00
workflow_run_outputs.py