Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function TestFlow(props: TestFlowProps) {
const selectedAgentId = getIn(values, AGENT_ID_PATH, '') as string;
const [agent, setAgent] = useState<Partial<Agent>>({});
useEffect(() => {
const agentRedux = agents[selectedAgentId];
const agentRedux = getIn(agents, selectedAgentId, {});
if (!isEmpty(selectedAgentId) && !isEmpty(agentRedux)) {
setAgent(agentRedux);
}
Expand Down
13 changes: 13 additions & 0 deletions server/routes/ml_routes_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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);
}
};
Expand Down Expand Up @@ -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);
}
};
Expand Down Expand Up @@ -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);
}
};
Expand Down
Loading