feat(examples): prompt suggestions on PDP (PoC)#7059
Draft
aymeric-giraudet wants to merge 1 commit into
Draft
Conversation
Add a self-contained PromptSuggestions React component to the query-suggestions example. On the PDP it sends the product hit to an Algolia Agent Studio agent, renders the returned 3 strings as chips, and on click opens the Chat widget with the prompt prefilled via the existing `openChat` utility (`referer: 'prompt-suggestions'`). System and agent prompts for the suggestions agent are documented in `examples/react/query-suggestions/prompt-suggestions-agent.md`.
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Security | 1 critical |
🟢 Metrics 16 complexity
Metric Results Complexity 16
TIP This summary will be updated as you push new changes.
More templates
algoliasearch-helper
instantsearch-ui-components
instantsearch.css
instantsearch.js
react-instantsearch
react-instantsearch-core
react-instantsearch-nextjs
react-instantsearch-router-nextjs
vue-instantsearch
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
examples/react/query-suggestions/(no package source changes). New self-contained<PromptSuggestions>React component plus minimal edits toProduct.tsxto mount<Chat>on the PDP and render the suggestions under the product title.openChat()utility frominstantsearch.js/lib/chat(withreferer: 'prompt-suggestions') and mirrors the request/response shape ofconnectFilterSuggestions(POST /agent-studio/1/agents/{agentId}/completions?...&stream=false, parsesdata.parts[1].textas a JSON array of strings).46520bcb-1f38-4ceb-9511-af5648089e4b. Recommended system + agent prompts to paste into the dashboard live atexamples/react/query-suggestions/prompt-suggestions-agent.md.Test plan
prompt-suggestions-agent.mdinto agent46520bcb-1f38-4ceb-9511-af5648089e4b(Agent Studio) and save.yarn workspace example-react-instantsearch-query-suggestions dev, click any product on the search page to land on/products.html?pid=….agent-studio/1/agents/46520bcb…/completions?...&stream=falseper PDP load; chat completions carry thex-algolia-referer: prompt-suggestionsheader.Out of scope
No InstantSearch widget registration, no caching, no telemetry beyond the existing
refererheader, no i18n on the fallback strings. If we promote this past PoC the natural next step is mirroring theconnectFilterSuggestions/FilterSuggestions/ UI-component split and exporting fromreact-instantsearch.