-
Notifications
You must be signed in to change notification settings - Fork 1k
[Explore] Add AI summary component in explore plugin #9975
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
[Explore] Add AI summary component in explore plugin #9975
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## query_explore #9975 +/- ##
================================================
Coverage ? 60.08%
================================================
Files ? 4065
Lines ? 103587
Branches ? 16456
================================================
Hits ? 62244
Misses ? 37212
Partials ? 4131
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
modifying global styles
705abd4
to
79599ae
Compare
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/* stylelint-disable @osd/stylelint/no_modifying_global_selectors */ |
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.
please avoid doing this if possible. this is so we don't accidentally modify styles globally
if any plugin uses the class resultSummary
then we would be modifying them which might be likely.
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.
Hi, I personally think this would be intentional as we want to custom the accordion component (i.e. add buttons to the header). Could you please suggest a better approach without modifying the global style if possible? Thanks!
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.
hey. thanks for the quick response.
for some context the stylelinter was added to prevent visual regression bugs. and resultsSummary seems like it has a high likelihood to change the styling of a component unrelated to this component without the plugin owners knowledge.
we could potentially make this component class name more specific but my rule of thumb has been if its failing the stylelinter then we should revisit the actual ux design.
oui component supports the button in the header if im not mistaken but do you mean the styling? looking at the oui props https://oui.opensearch.org/1.19/#/layout/accordion there should be ability to pass in classNames to the component to style without using global selectors
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.
I’ve updated some of the CSS class names to be more distinctive and to use custom className passing. There are still a few global styles that we can’t work around, but I hope these changes help reduce the risk of future style collisions.
|
||
const ACCORDION_STATE_LOCAL_STORAGE_KEY = 'resultsSummary.summaryAccordionState'; | ||
|
||
export const convertResult = (body: IDataFrame) => { |
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.
how come we don't use the proper search functionality?
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.
This is not the search but convert the result data frame to proper JSON object, I think this is only relevant to t2ppl API.
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.
for more context, PPL search essentially does the same. and it's structured like search via
hits
.
so to me it looks like we generally treat this feature as search where we could just leverage existing code rather no copy and pasting.
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.
For discover, we retrieve the raw data from an subscribed observable, we actually not doing a search again as all results are relevant, no result will be filter out in this function and it is just simply a utils function to convert result from one format to another.
import React from 'react'; | ||
import { i18n } from '@osd/i18n'; | ||
|
||
export enum FeedbackStatus { |
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.
ive seen this defined multiple times in this project we shouldn't redefine it if i t can be available at a different place
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.
Could we leave this to a later PR for refactoring? Since this one is only add the component to the page, there would be another PR for fully integrate with t2ppl feature by @ruchidh, add unit test, remove mocks, clean up the code, etc.
|
||
const renderExploreFlavor = (flavor: ExploreFlavor, props: ExploreComponentProps) => { | ||
switch (flavor) { | ||
case ExploreFlavor.Logs: | ||
return <LogsPage setHeaderActionMenu={props.setHeaderActionMenu} />; | ||
return ( | ||
<LogsPage setHeaderActionMenu={props.setHeaderActionMenu} dataSetup={props.dataSetup} /> |
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.
eventually if any access to services and plugins. it would make more sense to use the OpenSearch Dashboards react context
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.
Would it be appropriate to put a setup dependency in the context of explore service?
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.
@FriedhelmWS I think you can use data
from the context which is DataPublicPluginStart
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.
Done, sorry for didn't noticed that QueryStart and SearchStart are also valid to be used.
loading: boolean; | ||
onGenerateSummary: () => void; | ||
brandingLabel?: string; | ||
sampleSize: number; |
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.
are we not respecting the advanced settings sample size
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.
This is the sample size for AI agent so I think it should not be the same sample size we defined in advanced settings. In the future, we can add another setting option for AI-related sample size.
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.
apologies. do you mind explaining more. i assumed the results summary should be the summary on the results provided to the user. the summary utilizes the query from the user right? if so then that should be the sample size from advanced settings
if not regardless of the returned results we are just generating a summary of a static number? if the user gets 10 results, wouldn't it be confusing to display a summary on 100 results because we statically defined it for 100 results.
398af81
to
ba667e9
Compare
&.resultsSummary_accordion { | ||
.euiAccordion__triggerWrapper { | ||
/* stylelint-disable @osd/stylelint/no_restricted_values */ | ||
background: lightOrDarkTheme(linear-gradient(to left, #edf7ff, #f9f4ff), $euiColorEmptyShade); |
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.
iif this is absolutely required and there is no SASS variable already then we should define them. as this shouldn't be the only place this is used
b6f604b
to
6ba3d6a
Compare
Signed-off-by: Owen Wang <owenwyk@amazon.com>
Signed-off-by: Owen Wang <owenwyk@amazon.com>
Signed-off-by: Owen Wang <owenwyk@amazon.com>
Signed-off-by: Owen Wang <owenwyk@amazon.com>
Signed-off-by: Owen Wang <owenwyk@amazon.com>
6ba3d6a
to
8a51782
Compare
Description
Issues Resolved
Screenshot
Testing the changes
Changelog
Check List
yarn test:jest
yarn test:jest_integration