diff --git a/.changeset/fix-session-search-shortcut.md b/.changeset/fix-session-search-shortcut.md new file mode 100644 index 000000000..75c9649de --- /dev/null +++ b/.changeset/fix-session-search-shortcut.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +web: Show the correct session search shortcut on Windows. diff --git a/apps/kimi-web/src/components/Sidebar.vue b/apps/kimi-web/src/components/Sidebar.vue index 0a31ae5fc..06ea24d45 100644 --- a/apps/kimi-web/src/components/Sidebar.vue +++ b/apps/kimi-web/src/components/Sidebar.vue @@ -83,6 +83,7 @@ const emit = defineEmits<{ // Session search dialog (Spotlight-style; filters title + last prompt) // --------------------------------------------------------------------------- const showSearch = ref(false); +const sessionSearchShortcut = isAppleShortcutPlatform() ? '⌘K' : 'Ctrl K'; function openSearch(): void { // Sessions are loaded per-workspace (first page only); lazily drain the rest @@ -101,6 +102,14 @@ function onSearchKeydown(e: KeyboardEvent): void { onMounted(() => window.addEventListener('keydown', onSearchKeydown)); onBeforeUnmount(() => window.removeEventListener('keydown', onSearchKeydown)); +function isAppleShortcutPlatform(): boolean { + if (typeof navigator === 'undefined') return false; + if (/Mac|iPod|iPhone|iPad/.test(navigator.platform)) return true; + + const userAgentData = (navigator as Navigator & { userAgentData?: { platform?: string } }).userAgentData; + return userAgentData?.platform === 'macOS' || userAgentData?.platform === 'iOS'; +} + // Scroll-linked header seam: the .btn-wrap bottom border/shadow only appears // once the session list has actually scrolled, so an unscrolled list shows no // abrupt boundary. @@ -590,7 +599,7 @@ onBeforeUnmount(() => { diff --git a/apps/kimi-web/src/i18n/locales/en/sidebar.ts b/apps/kimi-web/src/i18n/locales/en/sidebar.ts index bb53bc6c0..cda064d44 100644 --- a/apps/kimi-web/src/i18n/locales/en/sidebar.ts +++ b/apps/kimi-web/src/i18n/locales/en/sidebar.ts @@ -38,7 +38,7 @@ export default { collapseSidebar: 'Collapse sidebar', expandSidebar: 'Expand sidebar', searchPlaceholder: 'Search sessions', - searchShortcut: 'Search sessions (⌘K)', + searchShortcut: 'Search sessions ({shortcut})', searchHint: '↑↓ navigate · ↵ open · Esc close', searchNoResults: 'No matching sessions', } as const; diff --git a/apps/kimi-web/src/i18n/locales/zh/sidebar.ts b/apps/kimi-web/src/i18n/locales/zh/sidebar.ts index 95698ae77..473f3eeca 100644 --- a/apps/kimi-web/src/i18n/locales/zh/sidebar.ts +++ b/apps/kimi-web/src/i18n/locales/zh/sidebar.ts @@ -38,7 +38,7 @@ export default { collapseSidebar: '收起侧边栏', expandSidebar: '展开侧边栏', searchPlaceholder: '搜索会话', - searchShortcut: '搜索会话 (⌘K)', + searchShortcut: '搜索会话 ({shortcut})', searchHint: '↑↓ 选择 · ↵ 打开 · Esc 关闭', searchNoResults: '没有匹配的会话', };