-
Notifications
You must be signed in to change notification settings - Fork 21
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
feat: implement related-prompts multi-query #1685
base: main
Are you sure you want to change the base?
Conversation
endpoint: | ||
'https://api.empathy.co/relatedprompts/mymotivemarketplace?store=Labstore+London&lang=en', | ||
requestMapper: ({ query }) => ({ query }), |
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 guess those changes are not intended, are they?
@@ -66,23 +69,48 @@ | |||
showOnlyAfterOffset: { | |||
type: Boolean, | |||
default: false | |||
} | |||
}, | |||
customQuery: 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.
I'd like to avoid custom prefix everything. I think we could just use query for the prop
() => props.customQuery, | ||
() => { | ||
if (props.customQuery || props.customQuery !== '') { | ||
x.emit('RelatedPromptsCustomQueryProvider', props.customQuery); |
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.
Following the comment above, I'd like to skip the custom prefix. Besides, we should stick to our convention of using past tense. What about RelatedPromptsQueryProvided
?
const { query, status } = useState('relatedPrompts', ['query', 'status']); | ||
|
||
/** | ||
* The state related prompts. | ||
*/ | ||
const relatedPrompts: ComputedRef<RelatedPrompt[]> = useState('relatedPrompts', [ | ||
'relatedPrompts' | ||
]).relatedPrompts; | ||
const relatedPrompts: ComputedRef<Dictionary<RelatedPromptsItems>> = useState( | ||
'relatedPrompts', | ||
['relatedPrompts'] | ||
).relatedPrompts; |
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 could call just once to useState here, right?
* The current location of the related prompts. | ||
* Payload: The query to request prompts and the location of the related-prompts. | ||
*/ | ||
RelatedPromptsLocation: { location: FeatureLocation | undefined; query: 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.
Pull request template
The idea is to display related prompts from different queries in the same view. For that reason, we have changed the related-prompt structure, now, we are setting the prompts in the state as a dictionary of the queries requested with their corresponding prompts.
We also have to manage the selected prompt view in different locations. For that, we obtain the location of the related prompts from the metadata of the event
UserSelectedARelatedPrompt
, which also provides the related prompt query.Motivation and context
Display related-prompts in the toolbar (under the searchbox), and embbed into the results grid.
Type of change
What is the destination branch of this PR?
Main
How has this been tested?
Try with query
trousers
in the X demoChecklist: