diff --git a/public/pages/workflow_detail/agentic_search/configure_flow/agent_configuration.tsx b/public/pages/workflow_detail/agentic_search/configure_flow/agent_configuration.tsx index 1bc73dc4..31e0f077 100644 --- a/public/pages/workflow_detail/agentic_search/configure_flow/agent_configuration.tsx +++ b/public/pages/workflow_detail/agentic_search/configure_flow/agent_configuration.tsx @@ -106,7 +106,7 @@ export function AgentConfiguration(props: AgentConfigurationProps) { // listen to agent ID changes. update the agent config form values appropriately useEffect(() => { const selectedAgentIdForm = getIn(values, AGENT_ID_PATH, '') as string; - const agent = agents[selectedAgentIdForm]; + const agent = getIn(agents, selectedAgentIdForm, {}); if (!isEmpty(selectedAgentIdForm) && !isEmpty(agent)) { props.setAgentForm(agent); } else if (selectedAgentIdForm === NEW_AGENT_PLACEHOLDER) { diff --git a/public/pages/workflow_detail/agentic_search/test_flow/test_flow.tsx b/public/pages/workflow_detail/agentic_search/test_flow/test_flow.tsx index b1e72353..35554003 100644 --- a/public/pages/workflow_detail/agentic_search/test_flow/test_flow.tsx +++ b/public/pages/workflow_detail/agentic_search/test_flow/test_flow.tsx @@ -61,7 +61,7 @@ export function TestFlow(props: TestFlowProps) { const selectedAgentId = getIn(values, AGENT_ID_PATH, '') as string; const [agent, setAgent] = useState>({}); useEffect(() => { - const agentRedux = agents[selectedAgentId]; + const agentRedux = getIn(agents, selectedAgentId, {}); if (!isEmpty(selectedAgentId) && !isEmpty(agentRedux)) { setAgent(agentRedux); } diff --git a/server/routes/ml_routes_service.ts b/server/routes/ml_routes_service.ts index 46629920..5c5f1278 100644 --- a/server/routes/ml_routes_service.ts +++ b/server/routes/ml_routes_service.ts @@ -21,11 +21,15 @@ import { GET_AGENT_NODE_API_PATH, UPDATE_AGENT_NODE_API_PATH, Agent, + AgentDict, + ModelDict, + ConnectorDict, } from '../../common'; import { generateCustomError, getConnectorsFromResponses, getModelsFromResponses, + isIgnorableError, } from './helpers'; import { getClientBasedOnDataSource } from '../utils/helpers'; @@ -212,6 +216,9 @@ export class MLRoutesService { return res.ok({ body: { models: modelDict } }); } catch (err: any) { + if (isIgnorableError(err)) { + return res.ok({ body: { models: {} as ModelDict } }); + } return generateCustomError(res, err); } }; @@ -243,6 +250,9 @@ export class MLRoutesService { return res.ok({ body: { connectors: connectorDict } }); } catch (err: any) { + if (isIgnorableError(err)) { + return res.ok({ body: { connectors: {} as ConnectorDict } }); + } return generateCustomError(res, err); } }; @@ -317,6 +327,9 @@ export class MLRoutesService { return res.ok({ body: { agents } }); } catch (err: any) { + if (isIgnorableError(err)) { + return res.ok({ body: { agents: {} as AgentDict } }); + } return generateCustomError(res, err); } };