From b2610cac39a25d5f291e1d7e124099e5add3abfc Mon Sep 17 00:00:00 2001 From: Heng Qian Date: Wed, 24 Jul 2024 16:52:29 +0800 Subject: [PATCH 1/4] switch to ml_configuration in agent response as backend changed Signed-off-by: Heng Qian --- server/routes/get_agent.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/routes/get_agent.ts b/server/routes/get_agent.ts index a8d285a6..91264e92 100644 --- a/server/routes/get_agent.ts +++ b/server/routes/get_agent.ts @@ -14,10 +14,10 @@ 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) { 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; } catch (error) { const errorMessage = JSON.stringify(error.meta?.body) || error; throw new Error(`get agent ${id} failed, reason: ${errorMessage}`); From c8a6cba3ee2e67f75452a5d9884f5b0a954eb815 Mon Sep 17 00:00:00 2001 From: Heng Qian Date: Wed, 24 Jul 2024 17:27:22 +0800 Subject: [PATCH 2/4] Address comments and add changelog Signed-off-by: Heng Qian --- CHANGELOG.md | 3 ++- server/routes/get_agent.ts | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4322c0a2..f182b294 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,4 +19,5 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Refactor default data source retriever ([#197](https://github.com/opensearch-project/dashboards-assistant/pull/197)) - Add patch style for fixed components ([#203](https://github.com/opensearch-project/dashboards-assistant/pull/203)) - Reset chat and reload history after data source change ([#194](https://github.com/opensearch-project/dashboards-assistant/pull/194)) -- Add experimental feature to support text to visualization ([#218](https://github.com/opensearch-project/dashboards-assistant/pull/218)) \ No newline at end of file +- Add experimental feature to support text to visualization ([#218](https://github.com/opensearch-project/dashboards-assistant/pull/218)) +- Be compatible with ML configuration index mapping change ([#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 91264e92..b83905e5 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.ml_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.ml_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}`); From fd5e834fd873daa10a2691f03ae00af813e0c524 Mon Sep 17 00:00:00 2001 From: Heng Qian Date: Wed, 24 Jul 2024 17:38:13 +0800 Subject: [PATCH 3/4] Address comments Signed-off-by: Heng Qian --- server/routes/get_agent.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/routes/get_agent.ts b/server/routes/get_agent.ts index b83905e5..76cdd467 100644 --- a/server/routes/get_agent.ts +++ b/server/routes/get_agent.ts @@ -20,7 +20,7 @@ export const getAgent = async (id: string, client: OpenSearchClient['transport'] ) { throw new Error(`cannot get agent ${id} by calling the api: ${path}`); } - return response.body.ml_configuration.agent_id || 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}`); From 3cc347cbc91f5d4304046f68f859a772348c535d Mon Sep 17 00:00:00 2001 From: Heng Qian Date: Wed, 24 Jul 2024 17:59:54 +0800 Subject: [PATCH 4/4] Add change in release notes Signed-off-by: Heng Qian --- .../dashboards-assistant.release-notes-2.16.0.0.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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))