新会话默认连接agent列表里面的第一个agent,不再固定使用codex

This commit is contained in:
xintaofei
2026-03-22 22:35:01 +08:00
parent b5b7073584
commit 49760ccb58
5 changed files with 26 additions and 19 deletions

View File

@@ -694,6 +694,12 @@ const ConversationTabView = memo(function ConversationTabView({
setDraftAgentType(nextAgentType)
setModeId(null)
setAgentConnectError(null)
// If not yet connected, just update state — auto-connect will use the
// new agentType once canAutoConnect is satisfied.
const s = connStatusRef.current
if (!s || s === "disconnected" || s === "error") return
connDisconnect()
.catch((e) =>
console.error("[ConversationTabView] disconnect old agent:", e)
@@ -1090,7 +1096,7 @@ export function ConversationDetailPanel() {
const handleNewConversation = useCallback(() => {
if (!folder) return
openNewConversationTab("codex", folder.path)
openNewConversationTab(folder.path)
}, [folder, openNewConversationTab])
const handleCloseActiveTab = useCallback(() => {
@@ -1103,18 +1109,9 @@ export function ConversationDetailPanel() {
if (!folder) return
if (hasNoTabs) {
openNewConversationTab(
newConversation?.agentType ?? "codex",
newConversation?.workingDir ?? folder.path
)
openNewConversationTab(newConversation?.workingDir ?? folder.path)
}
}, [
folder,
hasNoTabs,
newConversation?.agentType,
newConversation?.workingDir,
openNewConversationTab,
])
}, [folder, hasNoTabs, newConversation?.workingDir, openNewConversationTab])
const canTile = isTileMode && tabs.length > 1

View File

@@ -373,7 +373,7 @@ export function SidebarConversationList({
const handleNewConversation = useCallback(() => {
if (!folder) return
openNewConversationTab("codex", folder.path)
openNewConversationTab(folder.path)
}, [folder, openNewConversationTab])
const handleImport = useCallback(async () => {

View File

@@ -151,7 +151,7 @@ export function FolderTitleBar() {
if (matchShortcutEvent(e, shortcuts.new_conversation)) {
if (!folderPath) return
e.preventDefault()
openNewConversationTab("codex", folderPath)
openNewConversationTab(folderPath)
return
}
if (matchShortcutEvent(e, shortcuts.open_folder)) {

View File

@@ -21,7 +21,7 @@ export function Sidebar() {
const handleNewConversation = useCallback(() => {
if (!folder) return
openNewConversationTab("codex", folder.path)
openNewConversationTab(folder.path)
}, [folder, openNewConversationTab])
if (!isOpen) return null