WeKnora/internal/handler
ochan.kwon 8b7d00b260 feat: expose KB ↔ vector store binding in list, editor, and detail UI
Backend
-------
ListKnowledgeBases now enriches each row with the resolved vector_store
metadata (name / source / engine_type / status) via a new
buildKBListResponse helper. Store views are batch-resolved once per
request through BatchResolveStoreView so an N-KB list costs one
vector-store service call rather than N — closing the N+1 limitation
flagged in #1372's known-limitations section. Cross-tenant shared KBs
continue to render via SharedStoreDisplay so the owning tenant's store
inventory cannot be correlated across rows; the underlying vector_store_id
UUID is stripped from those responses.

Resolver failures degrade gracefully: bound KBs render as unavailable
instead of breaking the list. Test coverage pins the env / bound /
shared distinction, the batch-call-count invariant, and the
graceful-failure path.

Frontend
--------
KB editor modal gains a new "Vector Store" section. Create mode shows a
dropdown that combines the system default (env store) and the tenant's
configured user stores, fetched once at mount via the existing
listVectorStores API. Edit mode shows the bound store read-only via a
new VectorStoreBadge component with an explicit immutability hint —
matching the backend's `<-:create` GORM tag and the service-layer
UpdateKnowledgeBaseRequest DTO that already omit the field.

KB list cards surface a small engine-type badge for own-tenant bound
KBs, and a warning badge when the bound store is unavailable. Env-bound
and shared KBs render no badge (visual noise control). KB detail header
shows the bound store via the same VectorStoreBadge component; shared
KBs fall through to the badge's internal "shared" branch with no name /
engine / id rendered.

The KB editor's create-time error handler translates the typed
ErrVectorStoreBindingInvalid (2200) and ErrVectorStoreUnavailable
(2201) into localized messages and jumps the user back to the
VectorStore section so they can pick a different store or fall back to
the system default.

The KB row type gains five optional fields (vector_store_id / name /
engine_type / source / status). i18n: 18 new keys added to en-US,
ko-KR, zh-CN; ru-RU receives English placeholders pending translation
(consistent with prior PRs in this locale).

Part of #993 (Phase 2: Per-KB VectorStore Binding).
Phase 2 roadmap item: PR 5 (KB binding UI + list-response enrichment).
Depends on #994, #1310, #1372, #1386 (all backend in the Phase 2 series).
2026-05-22 17:40:10 +08:00
..
dto refactor(credentials): introduce /credentials subresource pattern 2026-05-17 15:27:52 +08:00
session fix (chat history): #1431 user's multilines query formatting was lost 2026-05-22 17:26:05 +08:00
audit_log.go chore(release): v0.6.0 2026-05-21 16:56:19 +08:00
audit_log_test.go feat(rbac): per-tenant audit log for RBAC events (PR 6, #1303) 2026-05-18 17:28:58 +08:00
auth.go fix(auth): make DISABLE_REGISTRATION drive registration_mode too 2026-05-18 21:15:01 +08:00
auth_register_invite_only_test.go feat(rbac): tenant member management + invite_only gate (PR 3 of 3, #1303) 2026-05-18 17:28:58 +08:00
chunk.go refactor(rbac): extend KB-access guard to chunk / knowledge / knowledgebase routes 2026-05-18 17:28:58 +08:00
chunker_debug.go docs(api): add and fix swag annotations on handlers 2026-05-12 13:16:58 +08:00
chunker_debug_test.go fix(chunker): post-review fixes for preview endpoint robustness 2026-05-06 17:17:07 +08:00
custom_agent.go feat(creator_name): add creator_name field to agents and knowledge bases for enhanced visibility 2026-05-18 17:28:58 +08:00
datasource.go fix(swagger): Fix some Swagger API endpoints returning 404 errors and regenerate the Swagger documentation 2026-05-21 21:13:40 +08:00
datasource_credentials.go refactor(credentials): introduce /credentials subresource pattern 2026-05-17 15:27:52 +08:00
evaluation.go feat: 新增API Key认证支持,优化Swagger文档安全配置 2025-12-22 15:01:09 +08:00
faq.go refactor(rbac): KB-access guard at the route layer (no helper in handlers) 2026-05-18 17:28:58 +08:00
im.go docs(api): add and fix swag annotations on handlers 2026-05-12 13:16:58 +08:00
initialization.go fix(initialization): surface upstream and SSRF errors verbatim in test-connection responses 2026-05-17 15:27:52 +08:00
knowledge.go feat(rbac): lift org membership from per-user to per-tenant (Plan 3, #1303) 2026-05-18 17:28:58 +08:00
knowledgebase.go feat: expose KB ↔ vector store binding in list, editor, and detail UI 2026-05-22 17:40:10 +08:00
knowledgebase_copy_preflight_test.go feat(knowledge-base): validate vector store bindings on create, copy, and delete 2026-05-18 15:58:46 +08:00
knowledgebase_not_found_test.go fix(kb): map ErrKnowledgeBaseNotFound to 404 across handler helpers 2026-05-14 20:12:41 +08:00
knowledgebase_pr3_response_test.go feat(knowledge-base): validate vector store bindings on create, copy, and delete 2026-05-18 15:58:46 +08:00
knowledgebase_pr5_list_test.go feat: expose KB ↔ vector store binding in list, editor, and detail UI 2026-05-22 17:40:10 +08:00
knowledgebase_request_test.go feat(knowledge-base): validate vector store bindings on create, copy, and delete 2026-05-18 15:58:46 +08:00
list_pagination.go feat(invitations): implement pending invitations feature with polling and dialog 2026-05-18 17:28:58 +08:00
mcp_credentials.go refactor(credentials): introduce /credentials subresource pattern 2026-05-17 15:27:52 +08:00
mcp_service.go fix(initialization): surface upstream and SSRF errors verbatim in test-connection responses 2026-05-17 15:27:52 +08:00
message.go fix(chat): stabilize history pagination and keep message order 2026-05-20 21:03:39 +08:00
message_session_not_found_test.go fix(chat): stabilize history pagination and keep message order 2026-05-20 21:03:39 +08:00
model.go fix(initialization): surface upstream and SSRF errors verbatim in test-connection responses 2026-05-17 15:27:52 +08:00
model_credentials.go refactor(credentials): introduce /credentials subresource pattern 2026-05-17 15:27:52 +08:00
organization.go feat: expose KB ↔ vector store binding in list, editor, and detail UI 2026-05-22 17:40:10 +08:00
rbac_lookups.go fix(rbac): wire chunk-id ownership chain for generated-question delete 2026-05-18 17:28:58 +08:00
rbac_lookups_test.go fix(rbac): wire chunk-id ownership chain for generated-question delete 2026-05-18 17:28:58 +08:00
skill_handler.go feat: update sandbox service configuration in Docker Compose files 2026-02-04 21:34:07 +08:00
storage_allowlist.go feat(obs): 支持华为云obs存储 2026-05-18 19:38:23 +08:00
system.go feat(obs): 支持华为云obs存储 2026-05-18 19:38:23 +08:00
tag.go refactor(rbac): KB-access guard at the route layer (no helper in handlers) 2026-05-18 17:28:58 +08:00
tenant.go feat(organization): implement tenant-based access control for organization visibility 2026-05-18 17:28:58 +08:00
tenant_invitation.go feat(invitations): implement pending invitations feature with polling and dialog 2026-05-18 17:28:58 +08:00
tenant_member.go feat(invitations): implement pending invitations feature with polling and dialog 2026-05-18 17:28:58 +08:00
tenant_member_test.go feat(invitations): implement pending invitations feature with polling and dialog 2026-05-18 17:28:58 +08:00
user_resource_favorite.go feat(favorites): implement user favorites and recents functionality 2026-05-18 17:28:58 +08:00
vectorstore.go feat: add VectorStore CRUD API endpoints and documentation 2026-04-14 17:34:57 +08:00
web_search.go docs(api): add and fix swag annotations on handlers 2026-05-12 13:16:58 +08:00
web_search_provider.go refactor(credentials): introduce /credentials subresource pattern 2026-05-17 15:27:52 +08:00
web_search_provider_credentials.go refactor(credentials): introduce /credentials subresource pattern 2026-05-17 15:27:52 +08:00
wechat_qrcode.go docs(api): add and fix swag annotations on handlers 2026-05-12 13:16:58 +08:00
weknoracloud.go docs(api): add and fix swag annotations on handlers 2026-05-12 13:16:58 +08:00
wiki_page.go fix(swagger): Fix some Swagger API endpoints returning 404 errors and regenerate the Swagger documentation 2026-05-21 21:13:40 +08:00