diff --git a/release-notes/dashboards-assistant.release-notes-2.16.0.0.md b/release-notes/dashboards-assistant.release-notes-2.16.0.0.md index c9804b9f..4c7315db 100644 --- a/release-notes/dashboards-assistant.release-notes-2.16.0.0.md +++ b/release-notes/dashboards-assistant.release-notes-2.16.0.0.md @@ -4,4 +4,8 @@ Compatible with OpenSearch and OpenSearch Dashboards Version 2.16.0 ### Features -- Add feature to support text to visualization. ([#218](https://github.com/opensearch-project/dashboards-assistant/pull/218)) \ No newline at end of file +- Add feature to support text to visualization. ([#218](https://github.com/opensearch-project/dashboards-assistant/pull/218)) + +### Maintenance + +- Make ML Configuration Index Mapping be compatible with ml-commons plugin. ([#239](https://github.com/opensearch-project/dashboards-assistant/pull/239)) diff --git a/server/routes/get_agent.ts b/server/routes/get_agent.ts index a8d285a6..76cdd467 100644 --- a/server/routes/get_agent.ts +++ b/server/routes/get_agent.ts @@ -14,10 +14,13 @@ export const getAgent = async (id: string, client: OpenSearchClient['transport'] path, }); - if (!response || !response.body.configuration?.agent_id) { + if ( + !response || + !(response.body.ml_configuration?.agent_id || response.body.configuration?.agent_id) + ) { throw new Error(`cannot get agent ${id} by calling the api: ${path}`); } - return response.body.configuration.agent_id; + return response.body.ml_configuration?.agent_id || response.body.configuration.agent_id; } catch (error) { const errorMessage = JSON.stringify(error.meta?.body) || error; throw new Error(`get agent ${id} failed, reason: ${errorMessage}`);