diff --git a/CHANGELOG.md b/CHANGELOG.md index 6afe64fd..1ba91e5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Optimize the response of AI agent APIs ([#373](https://github.com/opensearch-project/dashboards-assistant/pull/373), [#380](https://github.com/opensearch-project/dashboards-assistant/pull/380)) - fixed incorrect message id field used ([#378](https://github.com/opensearch-project/dashboards-assistant/pull/378)) - fix: return 404 instead of 500 for missing agent config name ([#384](https://github.com/opensearch-project/dashboards-assistant/pull/384)) +- Improve alert summary with backend log pattern experience ([#389](https://github.com/opensearch-project/dashboards-assistant/pull/389)) ### Infrastructure diff --git a/server/routes/summary_routes.ts b/server/routes/summary_routes.ts index dd23ff3b..962e8e1a 100644 --- a/server/routes/summary_routes.ts +++ b/server/routes/summary_routes.ts @@ -46,7 +46,7 @@ export function registerSummaryAssistantRoutes( }); const assistantClient = assistantService.getScopedClient(req, context); const agentConfigId = - req.body.index && req.body.dsl && req.body.topNLogPatternData + req.body.index && req.body.dsl ? LOG_PATTERN_SUMMARY_AGENT_CONFIG_ID : SUMMARY_AGENT_CONFIG_ID; try { @@ -135,7 +135,7 @@ export function registerSummaryAssistantRoutes( ); } -function detectInsightAgentId( +async function detectInsightAgentId( insightType: string, summaryType: string, client: OpenSearchClient['transport'] @@ -144,9 +144,9 @@ function detectInsightAgentId( // only get it by searching on name since it is not stored in agent config. try { if (insightType === 'os_insight') { - return getAgentIdByConfigName(OS_INSIGHT_AGENT_CONFIG_ID, client); + return await getAgentIdByConfigName(OS_INSIGHT_AGENT_CONFIG_ID, client); } else if (insightType === 'user_insight' && summaryType === 'alerts') { - return searchAgent({ name: 'KB_For_Alert_Insight' }, client); + return await searchAgent({ name: 'KB_For_Alert_Insight' }, client); } } catch (e) { // It only detects if the agent exists, we don't want to throw the error when not found the agent