Skip to content
Closed
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
23 changes: 23 additions & 0 deletions apps/web/src/hooks/useHandleNewThread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,14 @@ export function useNewThreadHandler() {
setModelSelection(emptyStoredDraftThread.draftId, carryModelSelection, {
replaceOptions: true,
});
} else if (project?.defaultModelSelection) {
// Reusing an empty draft with nothing to carry a selection
// from: the project's configured default is a deliberate
// per-project choice and takes priority over whatever model
// this draft happened to be left on.
setModelSelection(emptyStoredDraftThread.draftId, project.defaultModelSelection, {
replaceOptions: true,
});
}
}
// The workspace context must also ride along here: when projectRef
Expand Down Expand Up @@ -345,6 +353,15 @@ export function useNewThreadHandler() {
interactionMode: latestActiveDraftThread.interactionMode,
...pickExplicitWorkspaceOptions(options),
});
if (!carryModelSelection && project?.defaultModelSelection) {
// This empty draft (the one already open) has no model selection
// of its own yet: the project's configured default is a
// deliberate per-project choice and takes priority over whatever
// model this draft happened to be left on.
setModelSelection(currentRouteTarget.draftId, project.defaultModelSelection, {
replaceOptions: true,
});
}
return Promise.resolve({
draftId: currentRouteTarget.draftId,
threadId: latestActiveDraftThread.threadId,
Expand Down Expand Up @@ -416,6 +433,12 @@ export function useNewThreadHandler() {
// complete snapshot — absent options mean "no options", not "keep
// whatever sticky state just wrote".
setModelSelection(draftId, carryModelSelection, { replaceOptions: true });
} else if (project?.defaultModelSelection) {
Comment thread
macroscopeapp[bot] marked this conversation as resolved.
// A brand new thread with nothing to carry a selection from: the
// project's configured default is a deliberate per-project choice
// and takes priority over the sticky map's cross-project "last
// used model".
setModelSelection(draftId, project.defaultModelSelection, { replaceOptions: true });
Comment thread
cursor[bot] marked this conversation as resolved.
}
carryComposerContentTo(draftId);

Expand Down
Loading