mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-17 13:13:35 +08:00
feat: new session creation automatically opens as tab
Add useTabStore.openTab call after session creation so new sessions are registered as tabs, and update sendMessage to pass sessionId as first arg. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8f0bbf0817
commit
5daf49da9b
@ -3,6 +3,7 @@ import { useTranslation } from '../i18n'
|
||||
import { useSessionStore } from '../stores/sessionStore'
|
||||
import { useChatStore } from '../stores/chatStore'
|
||||
import { useUIStore } from '../stores/uiStore'
|
||||
import { useTabStore } from '../stores/tabStore'
|
||||
import { DirectoryPicker } from '../components/shared/DirectoryPicker'
|
||||
import { PermissionModeSelector } from '../components/controls/PermissionModeSelector'
|
||||
import { ModelSelector } from '../components/controls/ModelSelector'
|
||||
@ -122,6 +123,7 @@ export function EmptySession() {
|
||||
try {
|
||||
const sessionId = await createSession(workDir || undefined)
|
||||
setActiveView('code')
|
||||
useTabStore.getState().openTab(sessionId, 'New Session')
|
||||
connectToSession(sessionId)
|
||||
const attachmentPayload: AttachmentRef[] = attachments.map((attachment) => ({
|
||||
type: attachment.type,
|
||||
@ -129,7 +131,7 @@ export function EmptySession() {
|
||||
data: attachment.data,
|
||||
mimeType: attachment.mimeType,
|
||||
}))
|
||||
sendMessage(text, attachmentPayload)
|
||||
sendMessage(sessionId, text, attachmentPayload)
|
||||
setInput('')
|
||||
setAttachments([])
|
||||
} catch (error) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user