Skip to content
Open
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
6 changes: 6 additions & 0 deletions .changeset/web-usage-slash-command.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@moonshot-ai/kimi-web": patch
"@moonshot-ai/kimi-code": patch
---

Register the /usage slash command in kimi web so it appears in the command menu and opens the session status panel with context and cost.
3 changes: 3 additions & 0 deletions apps/kimi-web/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,9 @@ function handleCommand(cmd: string): void {
client.setThinking(nextThinkingLevel(client.thinking.value));
break;
case '/status':
case '/usage':
// /usage shares the status panel: it already surfaces context tokens and
// session cost, which is the web equivalent of the TUI /usage report.
showStatusPanel.value = true;
break;
case '/login':
Expand Down
1 change: 1 addition & 0 deletions apps/kimi-web/src/i18n/locales/en/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ export default {
noSession: 'Open a session before exporting it.',
},
status: { desc: 'View session status' },
usage: { desc: 'Show session tokens, context window, and cost' },
undo: { desc: 'Undo the last message' },
} as const;
1 change: 1 addition & 0 deletions apps/kimi-web/src/i18n/locales/zh/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ export default {
noSession: '请先打开一个会话再导出。',
},
status: { desc: '查看会话状态' },
usage: { desc: '查看会话 token、上下文窗口与费用' },
undo: { desc: '撤销上一条消息' },
};
1 change: 1 addition & 0 deletions apps/kimi-web/src/lib/slashCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const SLASH_COMMANDS: SlashCommand[] = [
{ name: '/fork', desc: 'commands.fork.desc' },
{ name: '/export', desc: 'commands.export.desc' },
{ name: '/status', desc: 'commands.status.desc' },
{ name: '/usage', desc: 'commands.usage.desc' },
];

/**
Expand Down
6 changes: 6 additions & 0 deletions apps/kimi-web/test/slash-menu.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ describe('useSlashMenu — update', () => {
expect(slash.active.value).toBe(0);
});

it('lists /usage among built-in commands', () => {
const { slash } = setup('/');
slash.update();
expect(slash.items.value.map((i) => i.name)).toContain('/usage');
});

it('filters to matching commands', () => {
const { slash } = setup('/com');
slash.update();
Expand Down