diff --git a/web/pages/Assistants.tsx b/web/pages/Assistants.tsx index b5baaf3..dbc818e 100644 --- a/web/pages/Assistants.tsx +++ b/web/pages/Assistants.tsx @@ -2089,7 +2089,9 @@ export const DebugDrawer: React.FC<{ const userDraftIndexRef = useRef(null); const lastUserFinalRef = useRef(''); const debugVolumePercentRef = useRef(50); + const clientToolEnabledMapRef = useRef>(clientToolEnabledMap); const isClientToolEnabled = (toolId: string) => clientToolEnabledMap[toolId] !== false; + const isClientToolEnabledLive = (toolId: string) => clientToolEnabledMapRef.current[toolId] !== false; const selectedToolSchemas = useMemo(() => { const ids = Array.from(new Set([...(assistant.tools || []), ...DEBUG_CLIENT_TOOLS.map((item) => item.id)])); const byId = new Map(tools.map((t) => [t.id, t])); @@ -2215,6 +2217,10 @@ export const DebugDrawer: React.FC<{ } }, [clientToolEnabledMap]); + useEffect(() => { + clientToolEnabledMapRef.current = clientToolEnabledMap; + }, [clientToolEnabledMap]); + // Auto-scroll logic useEffect(() => { if (scrollRef.current) { @@ -3102,7 +3108,7 @@ export const DebugDrawer: React.FC<{ output: { message: `Unhandled client tool '${toolName}'` }, status: { code: 501, message: 'not_implemented' }, }; - if (DEBUG_CLIENT_TOOL_ID_SET.has(toolName) && !isClientToolEnabled(toolName)) { + if (DEBUG_CLIENT_TOOL_ID_SET.has(toolName) && !isClientToolEnabledLive(toolName)) { resultPayload.output = { message: `Client tool '${toolName}' is disabled in debug settings` }; resultPayload.status = { code: 503, message: 'tool_disabled' }; }