From aa799760fcd8a17f48dcf3c81e84cc071301d374 Mon Sep 17 00:00:00 2001 From: xintaofei Date: Sun, 29 Mar 2026 00:15:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BC=9A=E8=AF=9D=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=BC=93=E5=AD=98=E7=9A=84=E6=A8=A1=E5=BC=8F=E5=92=8C?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E6=B2=A1=E6=9C=89=E5=AE=9E=E9=99=85=E7=94=9F?= =?UTF-8?q?=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/contexts/acp-connections-context.tsx | 37 ++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/contexts/acp-connections-context.tsx b/src/contexts/acp-connections-context.tsx index 9311fa7..50afb9a 100644 --- a/src/contexts/acp-connections-context.tsx +++ b/src/contexts/acp-connections-context.tsx @@ -1545,6 +1545,21 @@ export function AcpConnectionsProvider({ children }: { children: ReactNode }) { } entry.modes = resolvedModes selectorsCache.set(modeConn.agentType, entry) + // Sync cached mode to backend if it differs from server default + if ( + resolvedModes.current_mode_id && + resolvedModes.current_mode_id !== e.modes.current_mode_id + ) { + acpSetMode( + modeConn.connectionId, + resolvedModes.current_mode_id + ).catch((err: unknown) => + console.error( + "[ACP] Failed to sync saved mode to backend:", + err + ) + ) + } } break } @@ -1566,6 +1581,28 @@ export function AcpConnectionsProvider({ children }: { children: ReactNode }) { } entry.configOptions = resolvedConfigOptions selectorsCache.set(cfgConn.agentType, entry) + // Sync cached config options to backend if they differ + for (let i = 0; i < resolvedConfigOptions.length; i++) { + const resolved = resolvedConfigOptions[i] + const original = e.config_options[i] + if ( + resolved.kind.type === "select" && + original.kind.type === "select" && + resolved.kind.current_value !== original.kind.current_value && + resolved.kind.current_value + ) { + acpSetConfigOption( + cfgConn.connectionId, + resolved.id, + resolved.kind.current_value + ).catch((err: unknown) => + console.error( + "[ACP] Failed to sync saved config option to backend:", + err + ) + ) + } + } } break }