Skip to content

Commit

Permalink
switch to ml_configuration in agent response as backend changed (open…
Browse files Browse the repository at this point in the history
…search-project#239)

* switch to ml_configuration in agent response as backend changed

Signed-off-by: Heng Qian <[email protected]>

* Address comments and add changelog

Signed-off-by: Heng Qian <[email protected]>

* Address comments

Signed-off-by: Heng Qian <[email protected]>

* Add change in release notes

Signed-off-by: Heng Qian <[email protected]>

---------

Signed-off-by: Heng Qian <[email protected]>
  • Loading branch information
qianheng-aws authored and raintygao committed Jan 22, 2025
1 parent 42136bc commit 1892983
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
- 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))
6 changes: 5 additions & 1 deletion release-notes/dashboards-assistant.release-notes-2.16.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
- 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))
7 changes: 5 additions & 2 deletions server/routes/get_agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down

0 comments on commit 1892983

Please sign in to comment.