WeKnora/internal/handler
Anky c007a897cf
feat: support multi-tag for document knowledge (#1790)
* feat: support multi-tag for document knowledge

- Add knowledge_tag_relations join table for many-to-many tag-knowledge mapping
- Migrate existing single tag_id data to the new table
- Update Knowledge struct, filter, payload types (TagID -> Tags/TagIDs)
- Rewrite repository layer: SetKnowledgeTags, GetKnowledgeTags, ListIDsByTagIDs
- Update tag count references to query knowledge_tag_relations
- Update service/handler layers for multi-tag create/list/batch-update
- Frontend: multi-select tag sidebar, multi-tag chip display, tag toggle in popup
- FAQ tags remain single-tag model (unchanged)

* feat(knowledge): tag edit dialog with dynamic overflow and inline creation

- Add TagEditDialog component with search, multi-select, and confirm
- Replace inline t-popup tag selector with dialog-based editing
- Tags overflow with +N badge, visible count adapts to container width via ResizeObserver
- Date/card layout: fixed date width, tags flex to fill remaining space
- Add persistent new-tag input bar in dialog (Enter to create, auto-select)
- Tag creation emits callback to refresh parent tag list immediately
- Apply same overflow + dialog trigger to both card view and list view
- Add i18n keys: tagEditDialogTitle, tagEditSearch, tagSelectedCount, tagOverflowTip, tagNewPlaceholder

* fix: exclude soft-deleted knowledge from tag reference counts

CountReferences, BatchCountReferences, and DeleteUnusedTags now
JOIN with knowledges table to filter out soft-deleted records
when counting knowledge_tag_relations. Previously they queried
knowledge_tag_relations directly without the deleted_at check,
causing stale tag counts after knowledge deletion.

* fix: refresh tag counts after async knowledge deletion completes

Add a second delayed tag list refresh (2.5s) after tag deletion to capture
updated reference counts for remaining tags. The original immediate refresh
handles removing the deleted tag from the list, while this delayed refresh
ensures other tags' counts are correct after the async deletion finishes.

---------

Co-authored-by: lyingbug <xiayula2014@gmail.com>
2026-06-26 00:18:48 +08:00
..
dto fix(datasource): harden RSS connector and editor UX after review 2026-06-23 17:30:38 +08:00
session fix(agent): remove unused RunnableByViewer gate blocking viewer chat 2026-06-23 18:21:23 +08:00
audit_log.go feat(system): expose platform audit log + polish audit drawers 2026-05-26 21:13:56 +08:00
audit_log_test.go test(system): cover ListSystemAuditLog handler contract 2026-05-26 21:13:56 +08:00
auth.go feat(rbac): add multi-use share-link invitations for invite_only mode (#1504) 2026-05-27 19:42:01 +08:00
auth_register_by_invite.go feat: release v0.6.1 with new document parsing trace timeline, OpenSearch vector store driver, YAML-based built-in model configuration, and system admin settings. Includes UI redesigns, new-user onboarding guide, and various improvements and bug fixes. See CHANGELOG.md for details. 2026-06-05 16:36:13 +08:00
auth_register_invite_only_test.go feat(rbac): add multi-use share-link invitations for invite_only mode (#1504) 2026-05-27 19:42:01 +08:00
chunk.go feat: Support filtering chunks by multiple chunk_type params 2026-05-25 19:14:46 +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(im): integrate IM service for custom agent deletion 2026-06-22 17:16:07 +08:00
datasource.go feat(datasource): reveal pre-existing selections in lazily-loaded picker 2026-06-22 19:24:08 +08:00
datasource_credentials.go fix(datasource): harden RSS connector and editor UX after review 2026-06-23 17:30:38 +08:00
datasource_test.go Validate sync log limit parameter 2026-06-12 22:52:25 +08:00
embed_channel.go feat(integrations): polish embed/IM channel editors and agent rebind 2026-06-24 20:09:19 +08:00
embed_channel_exchange_test.go feat(embed): add backend embed channels with auth and rate limiting (#1657) 2026-06-12 23:10:39 +08:00
embed_flow_test.go feat(embed): add backend embed channels with auth and rate limiting (#1657) 2026-06-12 23:10:39 +08:00
embed_session_test.go feat(embed): add backend embed channels with auth and rate limiting (#1657) 2026-06-12 23:10:39 +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 feat(integrations): polish embed/IM channel editors and agent rebind 2026-06-24 20:09:19 +08:00
initialization.go Add embedding dimension override support 2026-06-15 19:18:19 +08:00
knowledge.go feat: support multi-tag for document knowledge (#1790) 2026-06-26 00:18:48 +08:00
knowledge_move_gate_test.go fix: reject cross-store reuse_vectors knowledge move 2026-06-05 15:00:41 +08:00
knowledge_spans_test.go fix(knowledge): infer synthesized stage status from parse_status 2026-05-28 15:14:45 +08:00
knowledgebase.go fix(api): add POST for hybrid-search while keeping GET compatibility (#1727) 2026-06-22 17:22:35 +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_oauth.go feat(mcp): add OAuth2 authorization for MCP services 2026-06-22 20:19:31 +08:00
mcp_service.go feat(mcp): add OAuth2 authorization for MCP services 2026-06-22 20:19:31 +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 feat(models): add model test debugger for saved model configs 2026-06-25 17:05:33 +08:00
model_credentials.go refactor(credentials): introduce /credentials subresource pattern 2026-05-17 15:27:52 +08:00
model_test.go feat(models): add model test debugger for saved model configs 2026-06-25 17:05:33 +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(system): add server startup time and uptime tracking 2026-06-04 15:48:04 +08:00
system_admin_audit_test.go test(system): cover system.* audit constants + emitAdminAudit contract 2026-05-26 21:13:56 +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(system): consolidate system admin and settings into one Settings panel 2026-05-26 21:13:56 +08:00
tenant_invitation.go feat(rbac): add multi-use share-link invitations for invite_only mode (#1504) 2026-05-27 19:42:01 +08:00
tenant_invite_link.go feat(rbac): add multi-use share-link invitations for invite_only mode (#1504) 2026-05-27 19:42:01 +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 fix: validate vector store connection addresses against SSRF policy 2026-06-04 15:26:56 +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 fix(web-search): improve SearXNG test connection error messages 2026-06-24 14:28:49 +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 feat(wiki): implement folder management features in wiki API 2026-06-16 23:51:29 +08:00