mirror of
https://github.com/langgenius/dify.git
synced 2026-09-05 08:48:10 +08:00
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 |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| app_admission_service.py | ||
| app_binding_management.py | ||
| app_execution_capability.py | ||
| batch_capability.py | ||
| buffered_upload_admission.py | ||
| capability_broker.py | ||
| cleanup.py | ||
| control_plane_service.py | ||
| control_space_commands.py | ||
| control_space_lifecycle.py | ||
| control_space_management.py | ||
| cutover_runtime_gate.py | ||
| cutover.py | ||
| data_facade.py | ||
| download_service.py | ||
| greenfield_initializer.py | ||
| initial_source_preview_job.py | ||
| initial_source_preview.py | ||
| lifecycle_port.py | ||
| lifecycle_readiness.py | ||
| lifecycle_remote_http.py | ||
| lifecycle_saga.py | ||
| membership_changes.py | ||
| object_storage.py | ||
| observability.py | ||
| orphan_reconciler.py | ||
| product_application_service.py | ||
| product_authorization.py | ||
| product_dto.py | ||
| product_operations.py | ||
| product_remote_http.py | ||
| product_remote.py | ||
| product_service.py | ||
| query_images.py | ||
| remote_images.py | ||
| remote_registry.py | ||
| revocation_commands.py | ||
| revocation_reconciler.py | ||
| runtime.py | ||
| service_api_authorization.py | ||
| source_import_commit_service.py | ||
| space_tag_service.py | ||
| staged_upload_service.py | ||