dify/api/controllers/console
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
..
agent fix(rbac): let agent.manage operate every agent page (#41583) 2026-09-02 01:45:42 +00:00
app Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-09-03 16:32:30 +08:00
auth refactor(api): extract account login service and consolidate adapters (#41184) 2026-09-03 06:20:21 +00:00
billing refactor(api): standardize compliance downloads (#41057) 2026-08-26 06:32:13 +00:00
datasets feat(knowledge-fs): scope dataset API keys by knowledge base type 2026-09-03 05:59:39 -04:00
explore refactor(api): centralize remote file handling (#41627) 2026-09-03 06:00:13 +00:00
knowledge_fs feat(knowledge-fs): record and count every knowledge space query 2026-09-04 05:48:17 -04:00
snippets refactor(models): pass session into Workflow accessors (#41464) 2026-08-29 14:28:15 +00:00
socketio fix: prevent hidden-tab collaboration leader from saving stale drafts (#38997) 2026-07-20 06:58:01 +00:00
tag refactor(api): require active workspace in request context (#41280) 2026-09-02 06:54:47 +00:00
workspace Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-09-03 16:32:30 +08:00
__init__.py Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-08-27 10:06:48 +08:00
admin.py chore: remove obsolete admin console routes (#35637) 2026-05-13 08:08:50 +00:00
apikey.py feat(knowledge-fs): scope dataset API keys by knowledge base type 2026-09-03 05:59:39 -04:00
error.py refactor(api): extract account login service and consolidate adapters (#41184) 2026-09-03 06:20:21 +00:00
extension.py refactor(console,web): dep-inject query params with @model_validate (#41646) 2026-09-03 01:50:22 +00:00
feature.py refactor(api): decouple system features and web adapters (#40772) 2026-09-01 11:50:52 +00:00
files.py refactor(console): inject file service (#41603) 2026-09-03 04:42:30 +00:00
flask_admission.py fix(rbac): let agent.manage operate every agent page (#41583) 2026-09-02 01:45:42 +00:00
human_input_form.py feat(workflow): support human input in loop and iteration (#39243) 2026-08-03 02:24:18 +00:00
init_validate.py refactor(api): extract init validation into layered application service (#40046) 2026-08-12 08:42:09 +00:00
notification.py refactor(api): decouple onboarding and notification services (#40759) 2026-08-31 04:37:07 +00:00
onboarding.py refactor(api): decouple onboarding and notification services (#40759) 2026-08-31 04:37:07 +00:00
remote_files.py refactor(api): centralize remote file handling (#41627) 2026-09-03 06:00:13 +00:00
setup.py refactor(api): extract init validation into layered application service (#40046) 2026-08-12 08:42:09 +00:00
spec.py refactor(api): decouple setup and spec endpoints (#40104) 2026-08-08 11:52:15 +00:00
system.py refactor(api): merge ping and version endpoints into system (#40058) 2026-08-10 08:50:40 +00:00
workflow_run_archive.py refactor(api): extract workflow run archive application service (#41253) 2026-08-27 02:41:43 +00:00
wraps.py refactor(api): decouple system features and web adapters (#40772) 2026-09-01 11:50:52 +00:00