新会话默认连接agent列表里面的第一个agent,不再固定使用codex
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -19,6 +19,7 @@ import type {
|
||||
ConversationStatus,
|
||||
OpenedConversation,
|
||||
} from "@/lib/types"
|
||||
import { AGENT_DISPLAY_ORDER } from "@/lib/types"
|
||||
|
||||
interface TabItemInternal {
|
||||
id: string
|
||||
@@ -54,7 +55,7 @@ interface TabContextValue {
|
||||
switchTab: (tabId: string) => void
|
||||
pinTab: (tabId: string) => void
|
||||
toggleTileMode: () => void
|
||||
openNewConversationTab: (agentType: AgentType, workingDir: string) => void
|
||||
openNewConversationTab: (workingDir: string) => void
|
||||
bindConversationTab: (
|
||||
tabId: string,
|
||||
conversationId: number,
|
||||
@@ -419,7 +420,7 @@ export function TabProvider({ children }: TabProviderProps) {
|
||||
id: makeNewConversationTabId(),
|
||||
kind: "conversation",
|
||||
conversationId: null,
|
||||
agentType: preferred?.agentType ?? "codex",
|
||||
agentType: AGENT_DISPLAY_ORDER[0],
|
||||
title: t("newConversation"),
|
||||
isPinned: true,
|
||||
workingDir: preferred?.workingDir ?? folder?.path,
|
||||
@@ -553,18 +554,27 @@ export function TabProvider({ children }: TabProviderProps) {
|
||||
)
|
||||
|
||||
const openNewConversationTab = useCallback(
|
||||
(agentType: AgentType, workingDir: string) => {
|
||||
(workingDir: string) => {
|
||||
const existingTab = rawTabsRef.current.find(
|
||||
(t) => t.conversationId == null && t.agentType === agentType
|
||||
(t) => t.conversationId == null
|
||||
)
|
||||
|
||||
if (existingTab) {
|
||||
// Update workingDir if it differs from the request
|
||||
if (existingTab.workingDir !== workingDir) {
|
||||
setTabs((prev) =>
|
||||
prev.map((t) =>
|
||||
t.id === existingTab.id ? { ...t, workingDir } : t
|
||||
)
|
||||
)
|
||||
}
|
||||
setActiveTabId(existingTab.id)
|
||||
syncFolderContext(existingTab)
|
||||
activateConversationPane()
|
||||
return
|
||||
}
|
||||
|
||||
const agentType = AGENT_DISPLAY_ORDER[0]
|
||||
const tabId = makeNewConversationTabId()
|
||||
const newTab: TabItemInternal = {
|
||||
id: tabId,
|
||||
|
||||
Reference in New Issue
Block a user