@@ -168,6 +168,7 @@ import { getProviderModelCapabilities, resolveSelectableProvider } from "../prov
168168import { NO_PROVIDER_MODEL_SELECTION } from "../providerInstances" ;
169169import { useClientSettings , useEnvironmentSettings } from "../hooks/useSettings" ;
170170import { useNowMinute } from "../hooks/useNowMinute" ;
171+ import { useNewThreadHandler } from "../hooks/useHandleNewThread" ;
171172import { resolveAppModelSelectionForInstance } from "../modelSelection" ;
172173import { getTerminalFocusOwner } from "../lib/terminalFocus" ;
173174import { resolveNewDraftStartFromOrigin } from "../lib/chatThreadActions" ;
@@ -271,6 +272,7 @@ import {
271272 resolveSendEnvMode ,
272273 revokeBlobPreviewUrl ,
273274 revokeUserMessagePreviewUrls ,
275+ startNewThreadForProject ,
274276 waitForStartedServerThread ,
275277} from "./ChatView.logic" ;
276278import { useLocalStorage } from "~/hooks/useLocalStorage" ;
@@ -1130,6 +1132,7 @@ function ChatViewContent(props: ChatViewProps) {
11301132 forceExpandedMobileComposer = false ,
11311133 } = props ;
11321134 const draftId = routeKind === "draft" ? props . draftId : null ;
1135+ const handleNewThread = useNewThreadHandler ( ) ;
11331136 const routeThreadRef = useMemo (
11341137 ( ) => scopeThreadRef ( environmentId , threadId ) ,
11351138 [ environmentId , threadId ] ,
@@ -1583,6 +1586,9 @@ function ChatViewContent(props: ChatViewProps) {
15831586 ? scopeProjectRef ( activeThread . environmentId , activeThread . projectId )
15841587 : null ;
15851588 const activeProject = useProject ( activeProjectRef ) ;
1589+ const handleNewThreadInActiveProject = useCallback ( ( ) => {
1590+ startNewThreadForProject ( activeProjectRef , handleNewThread ) ;
1591+ } , [ activeProjectRef , handleNewThread ] ) ;
15861592 const activeEnvironmentShell = useEnvironmentQuery (
15871593 activeThread ? environmentShell . stateAtom ( activeThread . environmentId ) : null ,
15881594 ) ;
@@ -5674,6 +5680,7 @@ function ChatViewContent(props: ChatViewProps) {
56745680 availableEditors = { availableEditors }
56755681 rightPanelOpen = { rightPanelOpen }
56765682 gitCwd = { gitCwd }
5683+ onNewThreadInProject = { handleNewThreadInActiveProject }
56775684 onRunProjectScript = { runProjectScript }
56785685 onAddProjectScript = { saveProjectScript }
56795686 onUpdateProjectScript = { updateProjectScript }
0 commit comments