Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch to ml_configuration in agent response as backend changed #239

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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))
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
Loading