-
Notifications
You must be signed in to change notification settings - Fork 963
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
Add data2summary check in data summary panel in discover #8716
Add data2summary check in data summary panel in discover #8716
Conversation
f28a766
to
1edd20d
Compare
bfdd348
to
f48615a
Compare
Signed-off-by: Qxisylolo <[email protected]>
042044a
to
38e53bd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with a minor comment
@@ -7,6 +7,7 @@ export const PLUGIN_ID = 'queryEnhancements'; | |||
export const PLUGIN_NAME = 'queryEnhancements'; | |||
|
|||
export const BASE_API = '/api/enhancements'; | |||
export const BASE_API_AGENT = '/api/assistant'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit
export const BASE_API_AGENT = '/api/assistant'; | |
export const BASE_API_ASSISTANT = '/api/assistant'; |
}); | ||
return response; | ||
} catch (error) { | ||
throw error; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, I don't see the purpose of this catch
because it throws it immediately which is the same as not having the try-catch block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I see. thank you
Signed-off-by: Qxisylolo <[email protected]>
788f842
to
4fcec84
Compare
export async function checkAgentsExist( | ||
http: HttpSetup, | ||
agentConfigName: string | string[], | ||
dataSourceId: string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: dataSourceId should be optional
if (selectedDataset.current?.dataSource?.id) { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should support datasource not enabled case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the comments, updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may not need to have if (selectedDataset.current?.dataSource?.id)
, call await checkAgentsExist()
with selectedDataset.current?.dataSource?.id
directly should be good. because:
- when data source is not enabled, the selectedDataset.dataSource is undefined, in such case, we passed
undefined
tocheckAgentsExist
, this will make it to check local cluster - when data source is enabled, but the selected dataset is a local cluster, the selectedDataset.dataSource is undefined as well, in this case, we passed
undefined
tocheckAgentsExist
which makes it to call local cluster.
Signed-off-by: Qxisylolo <[email protected]>
queryParams.append('dataSourceId', dataSourceId); | ||
|
||
const response = await http.get(API.AGENT_API.CONFIG_EXISTS, { | ||
query: Object.fromEntries(queryParams), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There might be problem to call Object.fromEntries(queryParams)
, for example:
// if calling append two times
queryParams.append('agentConfigName', 'name1')
queryParams.append('agentConfigName', 'name2')
// this returns {agentConfigName: 'name2'}, which name1 is missing
Object.fromEntries(queryParams),
I think you can simply call in this way
const response = await http.get(API.AGENT_API.CONFIG_EXISTS, {
query: { agentConfigName, dataSourceId },
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the advice,already updated~
Signed-off-by: Qxisylolo <[email protected]>
console.error(error); | ||
} | ||
}; | ||
fetchSummaryAgent(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we call this method only when isEnabledByCapability
is true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the reminder, added it
Signed-off-by: Qxisylolo <[email protected]>
* basiclly work Signed-off-by: Qxisylolo <[email protected]> * remove comments Signed-off-by: Qxisylolo <[email protected]> * add tests Signed-off-by: Qxisylolo <[email protected]> * call api Signed-off-by: Qxisylolo <[email protected]> * resolve comments Signed-off-by: Qxisylolo <[email protected]> * add new tests Signed-off-by: Qxisylolo <[email protected]> * update name Signed-off-by: Qxisylolo <[email protected]> * Changeset file for PR #8716 created/updated * resolve new comments Signed-off-by: Qxisylolo <[email protected]> * new resolve comments Signed-off-by: Qxisylolo <[email protected]> * add isEnabledByCapability Signed-off-by: Qxisylolo <[email protected]> --------- Signed-off-by: Qxisylolo <[email protected]> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> (cherry picked from commit d159d75) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…project#8716) * basiclly work Signed-off-by: Qxisylolo <[email protected]> * remove comments Signed-off-by: Qxisylolo <[email protected]> * add tests Signed-off-by: Qxisylolo <[email protected]> * call api Signed-off-by: Qxisylolo <[email protected]> * resolve comments Signed-off-by: Qxisylolo <[email protected]> * add new tests Signed-off-by: Qxisylolo <[email protected]> * update name Signed-off-by: Qxisylolo <[email protected]> * Changeset file for PR opensearch-project#8716 created/updated * resolve new comments Signed-off-by: Qxisylolo <[email protected]> * new resolve comments Signed-off-by: Qxisylolo <[email protected]> * add isEnabledByCapability Signed-off-by: Qxisylolo <[email protected]> --------- Signed-off-by: Qxisylolo <[email protected]> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
* basiclly work * remove comments * add tests * call api * resolve comments * add new tests * update name * Changeset file for PR #8716 created/updated * resolve new comments * new resolve comments * add isEnabledByCapability --------- (cherry picked from commit d159d75) Signed-off-by: Qxisylolo <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Description
This pr adds data2summary agent check in data summary panel in discover.
if there is a query assistant agent but not to summary agent then the summary also won’t be displayed
Screenshot
no agent:

local:

data2summary agent

2024-10-28.14.51.26.1.mov
Changelog
Check List
yarn test:jest
yarn test:jest_integration