dify/api/core
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
..
agent Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-08-27 10:06:48 +08:00
app Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-09-01 09:45:49 +08:00
base fix(api): align Service API OpenAPI contract (#41248) 2026-08-25 10:54:14 +00:00
callback_handler
datasource Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-08-07 09:55:10 +08:00
db
entities fix(api): restore Service API OpenAPI semantics (#41274) 2026-08-26 05:05:36 +00:00
errors
extension fix(extension): chain original exception in APIBasedExtensionRequestor per PEP 3134 (#40810) 2026-08-15 08:48:28 +00:00
external_data_tool
file
helper refactor(api): decouple system features and web adapters (#40772) 2026-09-01 11:50:52 +00:00
llm_generator refactor: pass db.session explicitly in instruction_modify_workflow (#37403) (#40827) 2026-08-30 00:48:00 +00:00
logging fix(api): restore deadlock-safe identity logging 2026-08-14 11:21:46 +08:00
mcp fix(workflow): block manual runs for trigger workflows (#41519) 2026-08-31 09:30:52 +00:00
memory
moderation feat(api): track credit usage contexts (#41181) 2026-08-25 10:21:32 +00:00
ops fix(api): preserve tracing configuration boundaries (#41403) 2026-08-27 22:11:32 +08:00
plugin Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-09-02 10:31:10 +08:00
prompt feat(workflow): support human input in loop and iteration (#39243) 2026-08-03 02:24:18 +00:00
rag feat(knowledge-fs): add automatic metadata filtering to retrieval node 2026-09-02 02:55:12 -04:00
rbac Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-08-27 10:06:48 +08:00
repositories feat(workflow): support human input in loop and iteration (#39243) 2026-08-03 02:24:18 +00:00
schemas
telemetry fix: add missing metrics back and enhance typing (#40935) 2026-08-21 09:46:45 +00:00
tools Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-08-27 10:06:48 +08:00
trigger
workflow feat(knowledge-fs): add automatic metadata filtering to retrieval node 2026-09-02 02:55:12 -04:00
__init__.py
credit_usage.py fix(api): attribute Skill Builder credit usage (#41290) 2026-08-26 07:02:45 +00:00
hosting_configuration.py refactor(api): consolidate deployment edition handling (#40142) 2026-08-11 07:39:01 +00:00
indexing_runner.py feat(api): track credit usage contexts (#41181) 2026-08-25 10:21:32 +00:00
model_context.py feat(api): track credit usage contexts (#41181) 2026-08-25 10:21:32 +00:00
model_manager.py feat(api): track credit usage contexts (#41181) 2026-08-25 10:21:32 +00:00
provider_manager.py fix(api): migrate legacy model types during upgrade (#41326) 2026-08-27 02:00:33 +00:00