dify/api/services/knowledge_fs
Jyong b79b8a879b feat(knowledge-fs): record and count every knowledge space query
Workflow KnowledgeFS retrieval nodes ran through `retrieval-tests`, which
never wrote an AnswerTrace or an overview event, so their queries were
missing from the retrieval history and from the space overview; the history
also only ever showed each member their own traces.

- AnswerTrace gains a `source` (retrieval_test | workflow | service_api |
  agent | mcp; migration 0051_answer_trace_source) derived from the
  Capability v2 caller kind. The retrieval-tests route records one trace per
  run (stages, evidence bundle, profile metadata), returns its id as
  `answerTraceId`, and the workflow node's failed-retrieval capture attaches
  to that trace instead of creating a second record.
- The quality trace list exposes and filters by `source`; traces from other
  caller kinds are visible to any current reader of the space, and counts and
  scores fall back to the evidence embedded in the trace when no bundle row
  exists.
- Overview accounting: retrieval-tests and Research tasks now emit
  `query.requested`, and the Research job state machine emits
  `query.completed` / `query.failed` on terminal stages (wired for both the
  in-process gateway and the durable runtime), so query volume, answer rate
  and outcomes include every caller. Activity details keep `source` and
  `taskKind`.
- Console and service trace routes accept a `source` filter; the retrieval
  test page shows a source badge and an all / retrieval tests / workflow
  filter, with translations for every locale.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015zw5G5SX3HmVfnZof6YWAc
2026-09-04 05:48:17 -04:00
..
__init__.py
app_admission_service.py fix(workflow): stabilize KnowledgeFS retrieval access 2026-08-11 11:51:17 -04:00
app_binding_management.py Fix workflow binding sync session handling 2026-08-09 22:50:44 -04:00
app_execution_capability.py feat(knowledge-fs): add automatic metadata filtering to retrieval node 2026-09-02 02:55:12 -04:00
batch_capability.py
buffered_upload_admission.py perf(knowledge-fs): harden cross-format document ingestion 2026-08-31 07:48:35 -04:00
capability_broker.py feat(knowledge-fs): add namespace preview for initial website sources 2026-09-04 15:52:36 +08:00
cleanup.py
control_plane_service.py fix(knowledge-fs): persist icon style selection (WTA-2068) 2026-08-17 17:31:25 +08:00
control_space_commands.py feat(knowledge-fs): scope dataset API keys by knowledge base type 2026-09-03 05:59:39 -04:00
control_space_lifecycle.py
control_space_management.py
cutover_runtime_gate.py feat(knowledge-fs): automate greenfield workspace cutover 2026-07-28 09:12:50 -04:00
cutover.py feat(knowledge-fs): automate greenfield workspace cutover 2026-07-28 09:12:50 -04:00
data_facade.py feat(knowledge-fs): record and count every knowledge space query 2026-09-04 05:48:17 -04:00
download_service.py fix(knowledge-fs): align document download contracts 2026-08-12 11:43:32 +08:00
greenfield_initializer.py feat(knowledge-fs): automate greenfield workspace cutover 2026-07-28 09:12:50 -04:00
initial_source_preview_job.py fix(knowledge-fs): update content handling to use KnowledgeFSCrawlImportPagePayload and add cleanup tests 2026-09-03 21:31:00 +08:00
initial_source_preview.py feat(knowledge-fs): add content handling for initial source preview and cleanup tasks 2026-09-03 21:01:21 +08:00
lifecycle_port.py feat(dataset): support deferred New RAG model setup 2026-07-28 23:19:25 +08:00
lifecycle_readiness.py
lifecycle_remote_http.py feat(dataset): support deferred New RAG model setup 2026-07-28 23:19:25 +08:00
lifecycle_saga.py feat(dataset): support deferred New RAG model setup 2026-07-28 23:19:25 +08:00
membership_changes.py
object_storage.py feat(knowledge): stage document uploads before admission 2026-08-10 10:58:17 -04:00
observability.py Refactor frontend architecture and simplify implementation 2026-07-29 02:30:27 -04:00
orphan_reconciler.py
product_application_service.py fix(knowledge-fs): persist icon style selection (WTA-2068) 2026-08-17 17:31:25 +08:00
product_authorization.py feat(knowledge-fs): authorize spaces with the legacy dataset RBAC points 2026-09-03 11:10:04 -04:00
product_dto.py feat(knowledge-fs): record and count every knowledge space query 2026-09-04 05:48:17 -04:00
product_operations.py feat(knowledge-fs): add namespace preview for initial website sources 2026-09-04 15:52:36 +08:00
product_remote_http.py feat(knowledge-fs): add profile-driven multimodal retrieval 2026-09-02 01:01:57 -04:00
product_remote.py feat(knowledge-fs): add profile-driven multimodal retrieval 2026-09-02 01:01:57 -04:00
product_service.py fix(knowledge-fs): persist icon style selection (WTA-2068) 2026-08-17 17:31:25 +08:00
query_images.py feat(knowledge-fs): keep query images with retrieval test history 2026-09-02 09:17:36 -04:00
remote_images.py fix(knowledge-fs): persist document images across formats 2026-08-26 03:58:04 -04:00
remote_registry.py
revocation_commands.py
revocation_reconciler.py
runtime.py fix(knowledge-fs): align retrieval test timeout 2026-09-01 13:51:15 -04:00
service_api_authorization.py feat(knowledge-fs): scope dataset API keys by knowledge base type 2026-09-03 05:59:39 -04:00
source_import_commit_service.py fix(knowledge-fs): enhance source import handling and error recovery for remote updates 2026-09-02 18:38:38 +08:00
space_tag_service.py feat(knowledge-fs): update space tag management and improve type annotations 2026-08-13 11:14:52 +08:00
staged_upload_service.py feat(knowledge_fs): expand supported document upload formats 2026-08-25 19:58:15 +08:00