WeKnora/internal/im
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
..
dingtalk feat(im): align agent stream display with web thinking and tool progress 2026-06-24 10:33:55 +08:00
feishu feat(im): align agent stream display with web thinking and tool progress 2026-06-24 10:33:55 +08:00
mattermost feat(im): align agent stream display with web thinking and tool progress 2026-06-24 10:33:55 +08:00
slack feat(im): align agent stream display with web thinking and tool progress 2026-06-24 10:33:55 +08:00
telegram fix(im): harden stream finalize and drop collapsed think header 2026-06-24 10:33:55 +08:00
wechat fix(im): clamp reconnect backoff to avoid int64 overflow → busy loop 2026-05-05 00:36:18 +08:00
wecom fix(im): address stream display review feedback 2026-06-24 10:33:55 +08:00
adapter.go feat(im): align agent stream display with web thinking and tool progress 2026-06-24 10:33:55 +08:00
cmd_clear.go feat(im): add slash-command system with /help, /info, /search, /stop, /clear 2026-03-20 15:49:59 +08:00
cmd_help.go feat(im): add slash-command system with /help, /info, /search, /stop, /clear 2026-03-20 15:49:59 +08:00
cmd_info.go feat(im): add slash-command system with /help, /info, /search, /stop, /clear 2026-03-20 15:49:59 +08:00
cmd_search.go fix(agent): exclude wiki-only KBs from quick-answer (RAG) mode 2026-05-12 16:27:28 +08:00
cmd_stop.go feat(im): add slash-command system with /help, /info, /search, /stop, /clear 2026-03-20 15:49:59 +08:00
command.go feat(im): add slash-command system with /help, /info, /search, /stop, /clear 2026-03-20 15:49:59 +08:00
command_registry.go feat(im): add slash-command system with /help, /info, /search, /stop, /clear 2026-03-20 15:49:59 +08:00
content_rewrite_test.go feat: enhance IM file service tests and refactor storage URL handling 2026-05-29 13:47:32 +08:00
credentials.go refactor(im): move adapter factories into per-platform subpackages 2026-04-29 20:08:22 +08:00
identity_test.go fix(im): inject synthetic identity so IM channels can use shared KBs 2026-06-04 16:43:54 +08:00
im_file_service_test.go fix: deep-copy stored files and images when cloning a knowledge base 2026-06-03 14:45:59 +08:00
mode.go refactor(im): move adapter factories into per-platform subpackages 2026-04-29 20:08:22 +08:00
qaqueue.go feat: add unit tests for COS object name parsing and enhance error handling 2026-05-29 13:47:32 +08:00
service.go feat: support multi-tag for document knowledge (#1790) 2026-06-26 00:18:48 +08:00
service_agent_test.go fix(integrations): polish agent filter UX and embed session rebind 2026-06-24 20:09:19 +08:00
service_quote_test.go fix(im): anti-hallucination for non-text quotes and unprocessable media messages 2026-04-03 11:34:22 +08:00
session_not_found_test.go fix(im): recover from deleted session when GetSession returns app sentinel (#1499) 2026-05-27 11:51:11 +08:00
session_test.go fix(im): harden stream finalize and drop collapsed think header 2026-06-24 10:33:55 +08:00
session_title_test.go feat(im): IM session improvements — titles, in-flight recovery, classification 2026-06-12 17:01:28 +08:00
stream_display_test.go fix(im): harden stream finalize and drop collapsed think header 2026-06-24 10:33:55 +08:00
stream_lifecycle_test.go fix(im): address stream display review feedback 2026-06-24 10:33:55 +08:00
stream_section.go fix(im): address stream display review feedback 2026-06-24 10:33:55 +08:00
stream_test.go feat(im): align agent stream display with web thinking and tool progress 2026-06-24 10:33:55 +08:00
supervisor.go fix(im): prevent DingTalk stream connection from going stale 2026-06-22 15:04:23 +08:00
think.go fix(im): harden stream finalize and drop collapsed think header 2026-06-24 10:33:55 +08:00
think_test.go fix(im): harden stream finalize and drop collapsed think header 2026-06-24 10:33:55 +08:00
tool_display.go feat(im): align agent stream display with web thinking and tool progress 2026-06-24 10:33:55 +08:00
tool_display_test.go feat(im): align agent stream display with web thinking and tool progress 2026-06-24 10:33:55 +08:00
types.go feat(im): add WeChat integration with QR code login and long-polling support 2026-04-13 14:17:57 +08:00
types_test.go [NELO-1102] feat(im): add thread-based session mode for IM channels 2026-03-30 10:43:14 +08:00