dify/api/controllers/service_api
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
..
app refactor(service-api): inject file upload service (#41585) 2026-09-03 03:41:45 +00:00
dataset refactor(service_api): dep-inject the dataset create payload with @model_validate (#41651) 2026-09-03 03:52:41 +00:00
end_user fix: add service api openapi descriptions (#37595) 2026-06-17 16:02:43 +00:00
knowledge_fs feat(knowledge-fs): record and count every knowledge space query 2026-09-04 05:48:17 -04:00
workspace docs: enrich generated service API descriptions (#37615) 2026-06-18 08:43:39 +00:00
__init__.py Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-08-27 10:06:48 +08:00
index.py fix(api): align Service API OpenAPI contract (#41248) 2026-08-25 10:54:14 +00:00
schema.py fix(api): restore Service API OpenAPI semantics (#41274) 2026-08-26 05:05:36 +00:00
wraps.py feat(knowledge-fs): rate limit console writes and every service API route 2026-09-03 11:10:04 -04:00