Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-session-search-shortcut.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@moonshot-ai/kimi-code": patch
---

web: Show the correct session search shortcut on Windows.
11 changes: 10 additions & 1 deletion apps/kimi-web/src/components/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -590,7 +599,7 @@ onBeforeUnmount(() => {
<!-- Session search — opens the Spotlight-style search dialog -->
<button class="search" type="button" @click="openSearch">
<Icon class="search-icon" name="search" />
<span class="search-input">{{ t('sidebar.searchShortcut') }}</span>
<span class="search-input">{{ t('sidebar.searchShortcut', { shortcut: sessionSearchShortcut }) }}</span>
</button>

<!-- New chat + new workspace buttons -->
Expand Down
2 changes: 1 addition & 1 deletion apps/kimi-web/src/i18n/locales/en/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 1 addition & 1 deletion apps/kimi-web/src/i18n/locales/zh/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default {
collapseSidebar: '收起侧边栏',
expandSidebar: '展开侧边栏',
searchPlaceholder: '搜索会话',
searchShortcut: '搜索会话 (⌘K)',
searchShortcut: '搜索会话 ({shortcut})',
searchHint: '↑↓ 选择 · ↵ 打开 · Esc 关闭',
searchNoResults: '没有匹配的会话',
};
Loading