修复新会话页面连接到未安装的agent时,后续连接其它agent没有反应了
This commit is contained in:
@@ -717,16 +717,8 @@ const ConversationTabView = memo(function ConversationTabView({
|
|||||||
setModeId(null)
|
setModeId(null)
|
||||||
setAgentConnectError(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
|
const s = connStatusRef.current
|
||||||
if (!s || s === "disconnected" || s === "error") return
|
const doConnect = () => {
|
||||||
|
|
||||||
connDisconnect()
|
|
||||||
.catch((e) =>
|
|
||||||
console.error("[ConversationTabView] disconnect old agent:", e)
|
|
||||||
)
|
|
||||||
.finally(() => {
|
|
||||||
if (!workingDirForConnection) return
|
if (!workingDirForConnection) return
|
||||||
connConnect(nextAgentType, workingDirForConnection, undefined, {
|
connConnect(nextAgentType, workingDirForConnection, undefined, {
|
||||||
source: "auto_link",
|
source: "auto_link",
|
||||||
@@ -740,7 +732,19 @@ const ConversationTabView = memo(function ConversationTabView({
|
|||||||
console.error("[ConversationTabView] switch agent:", e)
|
console.error("[ConversationTabView] switch agent:", e)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
|
|
||||||
|
// If not yet connected, directly attempt to connect with the new agent.
|
||||||
|
if (!s || s === "disconnected" || s === "error") {
|
||||||
|
doConnect()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
connDisconnect()
|
||||||
|
.catch((e) =>
|
||||||
|
console.error("[ConversationTabView] disconnect old agent:", e)
|
||||||
|
)
|
||||||
|
.finally(doConnect)
|
||||||
},
|
},
|
||||||
[connConnect, connDisconnect, workingDirForConnection]
|
[connConnect, connDisconnect, workingDirForConnection]
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user