From 50c46281f55abdc860ef607432681b2567d8b248 Mon Sep 17 00:00:00 2001 From: gaobinlong Date: Tue, 3 Sep 2024 15:46:48 +0800 Subject: [PATCH] Adjust to the change of Get config API Signed-off-by: gaobinlong --- server/routes/assistant.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/server/routes/assistant.ts b/server/routes/assistant.ts index 6669b9c3..5c1a0cd0 100644 --- a/server/routes/assistant.ts +++ b/server/routes/assistant.ts @@ -56,16 +56,14 @@ export default class AssistantService { }); if ( - !getAgentResponse || - !getAgentResponse['configuration'] || - !getAgentResponse['configuration']['agent_id'] + !getAgentResponse || !(getAgentResponse.ml_configuration?.agent_id || getAgentResponse.configuration?.agent_id) ) { throw new Error( 'Cannot get flow agent id for generating anomaly detector' ); } - const agentId = getAgentResponse['configuration']['agent_id']; + const agentId = getAgentResponse.ml_configuration?.agent_id || getAgentResponse.configuration?.agent_id; const executeAgentResponse = await callWithRequest('ml.executeAgent', { agentId: agentId,