Skip to content

Commit dfcfdfd

Browse files
authored
feat(web): hide empty sessions from the session list (#1166)
* chore(web): remove the /sessions slash command * feat(web): hide empty sessions from the session list Add an optional exclude_empty parameter to the session list API; the web client passes it so unused "New Session" entries are hidden by default, with pagination and has_more computed on the filtered set. * fix(protocol): add exclude_empty to the session list query schema Keep the shared protocol schema in sync with the server route so clients using the protocol type see the new parameter. * fix(protocol): keep exclude_empty off the child session list schema listSessionChildrenQuerySchema aliased the main list schema, so it inherited exclude_empty even though the /sessions/{id}/children route does not filter by it. Split it so generated clients are not misled.
1 parent cf558cd commit dfcfdfd

19 files changed

Lines changed: 115 additions & 439 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@moonshot-ai/kimi-code": patch
3+
---
4+
5+
Add an optional exclude_empty parameter to the session list API to omit sessions that have no messages.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@moonshot-ai/kimi-code": patch
3+
---
4+
5+
Hide unused "New Session" entries from the web session list by default.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@moonshot-ai/kimi-code": patch
3+
---
4+
5+
Remove the /sessions slash command from the web UI; the sidebar already covers session browsing.

apps/kimi-web/src/App.vue

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import ProviderManager from './components/settings/ProviderManager.vue';
1616
import LoginDialog from './components/dialogs/LoginDialog.vue';
1717
import NewSessionDialog from './components/dialogs/NewSessionDialog.vue';
1818
import SettingsDialog from './components/settings/SettingsDialog.vue';
19-
import SessionsDialog from './components/dialogs/SessionsDialog.vue';
2019
import AddWorkspaceDialog from './components/dialogs/AddWorkspaceDialog.vue';
2120
import StatusPanel from './components/chat/StatusPanel.vue';
2221
import WarningToasts from './components/WarningToasts.vue';
@@ -229,7 +228,6 @@ const showModelPicker = ref(false);
229228
const showProviders = ref(false);
230229
const showLogin = ref(false);
231230
const showNewSession = ref(false);
232-
const showSessions = ref(false);
233231
const showAddWorkspace = ref(false);
234232
const showStatusPanel = ref(false);
235233
const showSettings = ref(false);
@@ -249,7 +247,6 @@ const anyOverlayOpen = computed<boolean>(() =>
249247
showProviders.value ||
250248
showLogin.value ||
251249
showNewSession.value ||
252-
showSessions.value ||
253250
showAddWorkspace.value ||
254251
showStatusPanel.value ||
255252
showSettings.value ||
@@ -400,9 +397,6 @@ function handleCommand(cmd: string): void {
400397
case '/clear':
401398
handleCreateSession();
402399
break;
403-
case '/sessions':
404-
showSessions.value = true;
405-
break;
406400
case '/fork':
407401
void client.forkSession();
408402
break;
@@ -868,17 +862,6 @@ function openPr(url: string): void {
868862
@close="showNewSession = false"
869863
/>
870864

871-
<!-- Sessions browser overlay (/sessions) — client-side list, click to switch -->
872-
<SessionsDialog
873-
v-if="showSessions"
874-
:sessions="client.sessions.value"
875-
:workspace-groups="client.workspaceGroups.value"
876-
:attention-by-session="client.attentionBySession.value"
877-
:active-id="client.activeSessionId.value"
878-
@select="(id) => { void client.selectSession(id); showSessions = false; }"
879-
@close="showSessions = false"
880-
/>
881-
882865
<!-- Status panel overlay (/status) — renders current client state, no daemon call -->
883866
<StatusPanel
884867
v-if="showStatusPanel"

apps/kimi-web/src/api/daemon/client.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,14 +286,20 @@ export class DaemonKimiWebApi implements KimiWebApi {
286286
// -------------------------------------------------------------------------
287287

288288
async listSessions(
289-
input?: PageRequest & { status?: AppSessionStatus; workspaceId?: string; includeArchive?: boolean },
289+
input?: PageRequest & {
290+
status?: AppSessionStatus;
291+
workspaceId?: string;
292+
includeArchive?: boolean;
293+
excludeEmpty?: boolean;
294+
},
290295
): Promise<Page<AppSession>> {
291296
const query: Record<string, string | number | boolean | undefined> = {
292297
before_id: input?.beforeId,
293298
after_id: input?.afterId,
294299
page_size: input?.pageSize,
295300
status: input?.status ? toWireSessionStatus(input.status) : undefined,
296301
include_archive: input?.includeArchive,
302+
exclude_empty: input?.excludeEmpty,
297303
// PRESUMED — daemon supports ?workspace_id= once the registry ships; it
298304
// ignores unknown query params until then, so this is safe to always send.
299305
workspace_id: input?.workspaceId,

apps/kimi-web/src/api/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ export interface AppSessionWarning {
605605
export interface KimiWebApi {
606606
getHealth(): Promise<{ status: 'ok'; uptimeSec: number }>;
607607
getMeta(): Promise<{ serverVersion: string; serverId: string; startedAt: string; capabilities: Record<string, boolean>; openInApps: string[] }>;
608-
listSessions(input?: PageRequest & { status?: AppSessionStatus; workspaceId?: string; includeArchive?: boolean }): Promise<Page<AppSession>>;
608+
listSessions(input?: PageRequest & { status?: AppSessionStatus; workspaceId?: string; includeArchive?: boolean; excludeEmpty?: boolean }): Promise<Page<AppSession>>;
609609
createSession(input: { title?: string; cwd?: string; model?: string; workspaceId?: string }): Promise<AppSession>;
610610
/** Fetch one session by id (deep links beyond the first listSessions page). */
611611
getSession(sessionId: string): Promise<AppSession>;

0 commit comments

Comments
 (0)