feat(frontend): replace standalone search page with global command palette
Reworks search from a siloed /platform/knowledge-search page into a universal ⌘K palette plus natural, in-context entry points. Why the old page felt out of place: - "Search" was an action pinned next to entity routes (knowledge base, agent, organization), mixing noun- and verb-level navigation items. - Its two tabs (knowledge vs. chat messages) forced users to pick a mental model before they knew what they wanted. - It was also the only way to search at all — no global shortcut, no context-aware entry. What this replaces it with: - A new ⌘K/Ctrl+K command palette (GlobalCommandPalette.vue) mounted once in views/platform/index.vue. Results are grouped by type (files, messages, knowledge bases, agents, chat titles, commands) so users never need to pre-filter. Debounced, identity-keyed selection survives async arrivals (slow KB results no longer yank the highlight off the user's current row). ⌘1-9 jump shortcuts are rendered inline on each row for discoverability. - Sidebar gets a visible "Search" entry at the top — clicking it opens the palette (no route change), with a platform-aware kbd hint (⌘K on Mac, Ctrl K elsewhere). - KB detail page: opening ⌘K there auto-scopes the search to the current KB via a removable chip (Backspace in empty input also clears it); no separate embedded search bar needed. - The legacy route /platform/knowledge-search now redirects to the KB list with ?cmdk= set, so existing bookmarks still work. - KnowledgeBase.vue now handles both route-query changes and a window event (weknora:open-knowledge) for intra-KB navigation, fixing the silent-no-op when the palette jumps to a chunk in the already-open KB. Dropped: - frontend/src/views/knowledge/KnowledgeSearch.vue (1163 lines). - The exploratory SessionSearchBar mode-switching widget in the chat submenu; ⌘K covers its use cases without a two-mode UI. i18n: zh-CN / en-US / ko-KR / ru-RU updated together — new commandPalette.*, kb.*, and menu.search keys; obsolete session.search.* and menu.knowledgeSearch removed.
This commit is contained in:
@@ -101,9 +101,14 @@ const router = createRouter({
|
||||
},
|
||||
{
|
||||
path: "knowledge-search",
|
||||
name: "knowledgeSearch",
|
||||
component: () => import("../views/knowledge/KnowledgeSearch.vue"),
|
||||
meta: { requiresInit: true, requiresAuth: true }
|
||||
// 旧路径保留为重定向,打开全局命令面板(⌘K),带上可选的 q 参数
|
||||
redirect: (to) => {
|
||||
const q = to.query.q
|
||||
return {
|
||||
path: '/platform/knowledge-bases',
|
||||
query: typeof q === 'string' ? { cmdk: q } : { cmdk: '' },
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "agents",
|
||||
|
||||
Reference in New Issue
Block a user