From 172fb8d6e7f82774e73c55828084ae35b2a8c9cd Mon Sep 17 00:00:00 2001 From: qer Date: Sun, 28 Jun 2026 02:35:08 +0800 Subject: [PATCH] refactor(web): unify new-session creation behind the first message Remove the NewSessionDialog path so every new-session entry in the web UI enters the onboarding composer, creating the session only when the first message is sent. This removes the last web flow that produced an empty session. --- .changeset/web-delayed-new-session.md | 5 + apps/kimi-web/src/App.vue | 19 +- .../components/dialogs/NewSessionDialog.vue | 393 ------------------ .../components/settings/SettingsDialog.vue | 2 +- .../composables/client/useWorkspaceState.ts | 52 --- .../src/composables/useKimiWebClient.ts | 19 +- .../src/i18n/locales/en/newSession.ts | 12 - apps/kimi-web/src/i18n/locales/en/settings.ts | 1 + apps/kimi-web/src/i18n/locales/index.ts | 4 - .../src/i18n/locales/zh/newSession.ts | 12 - apps/kimi-web/src/i18n/locales/zh/settings.ts | 1 + apps/kimi-web/src/style.css | 2 +- 12 files changed, 14 insertions(+), 508 deletions(-) create mode 100644 .changeset/web-delayed-new-session.md delete mode 100644 apps/kimi-web/src/components/dialogs/NewSessionDialog.vue delete mode 100644 apps/kimi-web/src/i18n/locales/en/newSession.ts delete mode 100644 apps/kimi-web/src/i18n/locales/zh/newSession.ts diff --git a/.changeset/web-delayed-new-session.md b/.changeset/web-delayed-new-session.md new file mode 100644 index 0000000000..f527c946ac --- /dev/null +++ b/.changeset/web-delayed-new-session.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +In the bundled web UI, a new session is now created only when the first message is sent, so + New without a workspace opens the composer instead of making an empty session. diff --git a/apps/kimi-web/src/App.vue b/apps/kimi-web/src/App.vue index 4a610657e8..bec2ce4db6 100644 --- a/apps/kimi-web/src/App.vue +++ b/apps/kimi-web/src/App.vue @@ -14,7 +14,6 @@ import DiffView from './components/chat/DiffView.vue'; import ModelPicker from './components/settings/ModelPicker.vue'; import ProviderManager from './components/settings/ProviderManager.vue'; import LoginDialog from './components/dialogs/LoginDialog.vue'; -import NewSessionDialog from './components/dialogs/NewSessionDialog.vue'; import SettingsDialog from './components/settings/SettingsDialog.vue'; import AddWorkspaceDialog from './components/dialogs/AddWorkspaceDialog.vue'; import StatusPanel from './components/chat/StatusPanel.vue'; @@ -227,7 +226,6 @@ function handleSelectWorkspaces(ids: string[]): void { const showModelPicker = ref(false); const showProviders = ref(false); const showLogin = ref(false); -const showNewSession = ref(false); const showAddWorkspace = ref(false); const showStatusPanel = ref(false); const showSettings = ref(false); @@ -246,7 +244,6 @@ const anyOverlayOpen = computed(() => showModelPicker.value || showProviders.value || showLogin.value || - showNewSession.value || showAddWorkspace.value || showStatusPanel.value || showSettings.value || @@ -391,8 +388,8 @@ function handleCommand(cmd: string): void { return; } switch (cmd) { - // `/new` and `/clear` are aliases: both open the onboarding composer (or - // the new-session dialog when no workspace is active). + // `/new` and `/clear` are aliases: both open the onboarding composer. The + // session is only created when the user sends the first message. case '/new': case '/clear': handleCreateSession(); @@ -505,10 +502,10 @@ function handleCreateSession(): void { const wsId = client.activeWorkspaceId.value; if (wsId) { client.openWorkspaceDraft(wsId); - focusComposerAfterDraft(); } else { - showNewSession.value = true; + client.clearActiveSession(); } + focusComposerAfterDraft(); } // Workspace-level "+ New" (sidebar group or mobile switcher): enter the draft @@ -854,14 +851,6 @@ function openPr(url: string): void { @close="showProviders = false" /> - - - - - - - - - - diff --git a/apps/kimi-web/src/components/settings/SettingsDialog.vue b/apps/kimi-web/src/components/settings/SettingsDialog.vue index c54207b859..61167e2767 100644 --- a/apps/kimi-web/src/components/settings/SettingsDialog.vue +++ b/apps/kimi-web/src/components/settings/SettingsDialog.vue @@ -174,7 +174,7 @@ function setTab(tab: SettingsTab): void {