Commit Graph

8070 Commits

Author SHA1 Message Date
Stephen Zhou
876aab708e
fix(knowledge-fs): track workflow retrieval outcomes 2026-09-04 16:50:09 +08:00
Stephen Zhou
7fba0afc91
fix(knowledge-fs): refresh contract lock 2026-09-04 12:50:27 +08:00
FFXN
0361ee6a8b fix: expose active import workflows as source sync status 2026-09-04 11:53:35 +08:00
FFXN
7262dc51be Merge remote-tracking branch 'origin/deploy/konwledge' into deploy/konwledge 2026-09-04 11:52:57 +08:00
FFXN
448fd92f6d fix: expose active import workflows as source sync status 2026-09-04 11:52:41 +08:00
Jyong
8150a8fca7 feat(knowledge-fs): rate limit console writes and every service API route
The legacy dataset console rate limits every mutating, download, and
retrieval route and the dataset service API limits every request, while
KnowledgeFS only covered uploads and query admission. Apply the knowledge
rate limit to all space-scoped POST/PUT/PATCH/DELETE console routes, the
document downloads, and research/query entrypoints (workspace-level source
previews, staged-upload discards, the deprecated buffered query route, and
the internal stream transport stay exempt). Extract the service API check
into `check_knowledge_rate_limit` and call it from the KnowledgeFS profile
helper so all service routes share the legacy per-workspace limit.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015zw5G5SX3HmVfnZof6YWAc
2026-09-03 11:10:04 -04:00
Jyong
cce0d818cf feat(knowledge-fs): authorize spaces with the legacy dataset RBAC points
KnowledgeFS spaces used their own `knowledge_space_*` RBAC vocabulary, so
workspace roles configured for knowledge bases did not apply to them. Reuse
the legacy `dataset_*` permission points instead, following the mapping the
dataset console already applies:

- read      -> dataset_readonly
- create    -> dataset_create_and_management
- edit / document write -> dataset_edit
- delete    -> dataset_delete
- access config -> dataset_access_config
- query / research / trace detail -> dataset_retrieval_recall

The enterprise `/knowledge-fs/permission-keys/batch` lookup now answers in
that vocabulary and is translated back into the product capabilities the
console exposes as `permission_keys`, so the web stays unchanged; the
historical `knowledge_space_*` keys remain accepted during the transition.
Workspace-level checks send the mapped dataset scene with
`resource_type=dataset`, and the RBAC-disabled fallback grants every dataset
point KnowledgeFS consults.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015zw5G5SX3HmVfnZof6YWAc
2026-09-03 11:10:04 -04:00
FFXN
7ca5eaab97 fix(llm-semantic-chunker): revert default max output tokens from 8000 to 6000 2026-09-03 22:57:44 +08:00
FFXN
8c0f8e7113 fix(llm-semantic-chunker): increase default max output tokens from 6000 to 8000 2026-09-03 22:18:16 +08:00
FFXN
85ac5a79c7 fix(knowledge-fs): handle unknown unit ID errors with LlmSemanticChunkingOutputError 2026-09-03 22:11:26 +08:00
FFXN
bbde5fab52 fix(knowledge-fs): update content handling to use KnowledgeFSCrawlImportPagePayload and add cleanup tests 2026-09-03 21:31:00 +08:00
FFXN
31b2b4d500 feat(knowledge-fs): add content handling for initial source preview and cleanup tasks 2026-09-03 21:16:54 +08:00
FFXN
06cd47807c feat(knowledge-fs): add content handling for initial source preview and cleanup tasks 2026-09-03 21:01:21 +08:00
FFXN
43d50ce021 feat(knowledge-fs): enhance capability grant admission middleware with deletion handling options 2026-09-03 18:55:37 +08:00
Jyong
8569c6be53 test(api): track the typed key binding migration as the alembic head
Migration 9a4e7d1c2b60 (dataset API key binding resource type) is the new
single head after c3f1a9b2e6d4; update the merge-head guard accordingly.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015zw5G5SX3HmVfnZof6YWAc
2026-09-03 06:07:22 -04:00
Jyong
79116d8c4b feat(knowledge-fs): scope dataset API keys by knowledge base type
Legacy knowledge bases (`datasets`) and KnowledgeFS spaces
(`knowledge_fs_control_spaces`) live in different tables, so a dataset API
key binding could only ever name a legacy dataset and the KnowledgeFS service
API never consulted bindings at all: a key scoped to specific knowledge bases
still reached every KnowledgeFS space in the workspace.

- Bindings carry a `resource_type` (`dataset` | `knowledge_fs_space`) and a
  nullable `control_space_id` (migration 9a4e7d1c2b60, existing rows stay
  `dataset`), with a CHECK that exactly one id column matches the type.
- `dataset_api_key_service` exposes the key scope by kind, validates and
  binds KnowledgeFS spaces (tenant-owned, not deleting/deleted), and cleans up
  keys scoped only to a space when its deletion is requested. The orphan-key
  cleanup is now NULL-safe so a space binding keeps a key alive.
- Legacy dataset routes only honour `dataset` bindings; the KnowledgeFS
  authorization service only honours `knowledge_fs_space` bindings and raises
  a scope error that the service API maps to 403 (unknown keys stay 401).
- Console key creation accepts `knowledge_space_ids`; list/create responses
  return them next to `dataset_ids`.
- The web scope picker lists KnowledgeFS spaces alongside legacy datasets
  when KnowledgeFS is enabled and submits the ids by kind; the scope column
  counts both.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015zw5G5SX3HmVfnZof6YWAc
2026-09-03 05:59:39 -04:00
Jyong
180ac5ad4d refactor(knowledge-fs): remove deprecated buffered service API routes
Drop the deprecated `POST /knowledge-fs/spaces/<id>/queries` route and the
deprecated buffered `POST .../documents` upload from the service API. Both
only ever failed closed; queries go through admission + the query stream,
documents through the durable source import flow. Regenerate the service
contracts and markdown docs accordingly.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015zw5G5SX3HmVfnZof6YWAc
2026-09-03 05:59:39 -04:00
FFXN
5b7f15f2b1 test(knowledge-fs): add tests for dataset upgrade API with disabled knowledge FS 2026-09-03 17:20:56 +08:00
Stephen Zhou
45d89701c3
Merge remote-tracking branch 'origin/deploy/konwledge' into deploy/konwledge 2026-09-03 17:03:32 +08:00
FFXN
25277f66d6 fix(knowledge-fs): harden semantic chunking and deletion cleanup
- retry semantic chunking when the LLM returns an invalid schema
- add corrective schema instructions to retry prompts
- remove capability grant foreign keys from durable deletion records
- preserve capability grant IDs as immutable audit provenance
- add migration and regression coverage
2026-09-03 17:00:17 +08:00
FFXN
de8e91fec2 Merge remote-tracking branch 'origin/deploy/konwledge' into deploy/konwledge 2026-09-03 17:00:08 +08:00
FFXN
644a9b96a6 fix(knowledge-fs): harden semantic chunking and deletion cleanup
- retry semantic chunking when the LLM returns an invalid schema
- add corrective schema instructions to retry prompts
- remove capability grant foreign keys from durable deletion records
- preserve capability grant IDs as immutable audit provenance
- add migration and regression coverage
2026-09-03 16:59:57 +08:00
Stephen Zhou
3611a93a3a
Merge remote-tracking branch 'origin/deploy/konwledge' into deploy/konwledge
# Conflicts:
#	api/tests/unit_tests/services/test_knowledge_fs_initial_source_reliability.py
2026-09-03 16:57:14 +08:00
Stephen Zhou
ade154b878
Merge remote-tracking branch 'origin/deploy/konwledge' into deploy/konwledge 2026-09-03 16:50:05 +08:00
Stephen Zhou
611e7f6d17
test(knowledge-fs): allow canonical crawl duplicates 2026-09-03 16:49:44 +08:00
Stephen Zhou
42cb6519ea
Merge remote-tracking branch 'origin/main' into deploy/konwledge 2026-09-03 16:32:30 +08:00
FFXN
239dedba48 fix(knowledge-fs): enhance website crawl handling with support for exact page fetching 2026-09-03 16:20:42 +08:00
FFXN
f51a759e0c Merge remote-tracking branch 'origin/deploy/konwledge' into deploy/konwledge
# Conflicts:
#	api/knowledge-fs-contract.lock.json
2026-09-03 16:20:24 +08:00
FFXN
54335db161 fix(knowledge-fs): enhance website crawl handling with support for exact page fetching 2026-09-03 16:20:01 +08:00
FFXN
6d9d388c73 fix(knowledge-fs): enhance website crawl handling with support for exact page fetching 2026-09-03 16:19:47 +08:00
Jyong
c8aa2d4f59 feat(knowledge-fs): report specific, actionable background task failures
Every document-processing failure surfaced as "the document could not be
processed", and every data-source failure as "the source could not be read",
because the root cause was erased at three points: the compilation classifier
collapsed any coded-but-non-retryable error into DOCUMENT_COMPILATION_FAILED,
datasource runtime errors were reduced to per-operation constants, and the
console mapped dozens of codes onto a handful of generic sentences without the
stage or a support reference.

- knowledge-fs: keep the specific public code for any coded error in the
  compilation classifier (retry follows the error or the catalog policy), tag
  previously uncoded failures (semantic chunking output, embedding dimension,
  PDF rendering, lease loss, generation model, unsupported file type) with
  public codes, give embedding provider errors their own codes instead of the
  parser's, alias datasource runtime codes, and register 17 catalog entries
  (model response invalid, parser unsupported type, PDF render, crawl page
  not found, provider timeout/unavailable/rejected, content too large, ...).
- api: extend the public error-code enum (including the missing
  DOCUMENT_PARSER_TIMEOUT) and regenerate the contracts.
- web: per-code copy that says what happened and what to do, in all 24
  locales, plus a "failed while <stage> · reference <id>" line under each
  failed task in the background-task drawer and the document task list.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015zw5G5SX3HmVfnZof6YWAc
2026-09-03 03:09:29 -04:00
Byron.wang
b015aa416f
refactor(api): extract account login service and consolidate adapters (#41184) 2026-09-03 06:20:21 +00:00
非法操作
ba1d5ba172
refactor(api): centralize remote file handling (#41627) 2026-09-03 06:00:13 +00:00
Jyong
57d03faa98 fix(workflow): let the KnowledgeFS retrieval node run on text or image alone
The KnowledgeFS retrieval node treated the query text as mandatory even though
a query image is a complete input on its own. Text and image are now
alternatives: the node needs at least one of them, never both.

- web: drop the required mark from the query text field; the checklist fails
  only when neither variable is bound (new i18n message in every locale).
- api: make `query_variable_selector` optional with a model-level rule that
  one of the two selectors must be set, and only map the query variable when
  it is bound. At runtime an empty text without images is a configuration
  error; an image-only query retrieves with an empty text, merges spaces on
  their own scores instead of a text reranker, skips automatic metadata
  extraction, and skips the text-based failed-query capture.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015zw5G5SX3HmVfnZof6YWAc
2026-09-03 01:52:19 -04:00
Jyong
4d71c4a83a fix(knowledge-fs): allow one unresolved bad case per retrieval trace
A retrieval test record could be flagged as a bad case any number of times,
piling duplicate open cases onto the quality page. Refuse to file another bad
case while the trace already has one that is open or replaying, and let the
retrieval test page know about it.

- knowledge-fs: `createBadCase` looks up an unresolved case for the trace
  inside its transaction and throws `QualityBadCaseAlreadyOpenError`; the
  create route answers 409 with `QUALITY_BAD_CASE_ALREADY_OPEN`. Quality trace
  list items expose `openBadCaseId`.
- api: pass `open_bad_case_id` through the console trace response;
  regenerate the contracts.
- web: show the saved-as-bad-case state instead of the flag action when the
  selected trace already has an unresolved case, treat a 409 on flagging the
  same way, and refresh the history so the state follows the server.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015zw5G5SX3HmVfnZof6YWAc
2026-09-03 01:40:11 -04:00
zyssyz123
688107c3e5
fix(api): bound suggested question generation latency (#41705) 2026-09-03 05:02:09 +00:00
非法操作
d8c3f7c5ee
refactor(openapi): inject file upload service (#41606) 2026-09-03 04:42:31 +00:00
非法操作
69484a07e1
refactor(console): inject file service (#41603) 2026-09-03 04:42:30 +00:00
非法操作
5f4b1f867d
refactor(web): inject file upload service (#41586) 2026-09-03 04:42:30 +00:00
Stephen Zhou
af7f2b75b3
fix(knowledge-fs): refresh contract subtree lock 2026-09-03 12:03:14 +08:00
Eddy ZHANG
fc7193cf04
refactor(service_api): dep-inject the dataset create payload with @model_validate (#41651) 2026-09-03 03:52:41 +00:00
非法操作
ab0e92b893
refactor(service-api): inject file upload service (#41585) 2026-09-03 03:41:45 +00:00
dependabot[bot]
907bc2558b
chore(deps): bump transformers from 5.5.0 to 5.10.1 in /api (#41609)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-09-03 01:50:39 +00:00
Eddy ZHANG
95a6a14ed5
refactor(console,web): dep-inject query params with @model_validate (#41646) 2026-09-03 01:50:22 +00:00
Byron.wang
be7d11ca1d
refactor(api): extract forgot password application service (#41111)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-09-03 01:38:59 +00:00
Asuka Minato
8129555642
chore: Site to typebase (#35632) 2026-09-02 14:44:08 +00:00
Stephen Zhou
299cf4f45a
fix(knowledge-fs): refresh contract subtree lock 2026-09-02 22:28:11 +08:00
Stephen Zhou
abe15df3c3
test(knowledge-fs): track latest database migration 2026-09-02 22:15:18 +08:00
Stephen Zhou
45bee40955
Merge remote-tracking branch 'origin/main' into deploy/konwledge
# Conflicts:
#	api/controllers/console/datasets/datasets.py
#	api/tests/unit_tests/controllers/console/datasets/test_datasets.py
2026-09-02 21:56:53 +08:00
Jyong
afa771dcac feat(knowledge-fs): keep query images with retrieval test history
Query images attached to a retrieval test vanished as soon as the run's
history record was selected, and were never shown again after a reload,
because nothing persisted them: the gateway dropped `queryImages` when writing
`answer_traces`, the console trace/research responses had no image field, and
the composer cleared its images on every record selection.

- knowledge-fs: add a nullable JSON `query_images` column to `answer_traces`
  (migration 0049 for postgres and tidb), persist and read it in the answer
  trace repository, and expose `queryImages` on quality trace list items.
- api: enrich trace and research task responses with
  `KnowledgeFSQueryImageResponse`, resolving file names and short-lived signed
  preview URLs only for files the acting account still owns; regenerate the
  console and service contracts.
- web: keep composer images scoped to the selected record like the query
  text, remember images per run in this session, fall back to persisted
  previews (with a labelled placeholder when the file is gone), show them in
  the result panel and as a count on history records, and carry them into
  retests.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015zw5G5SX3HmVfnZof6YWAc
2026-09-02 09:17:36 -04:00