Skip to content

feat(chat): identify component and referer in agent requests#7002

Open
afrencalg wants to merge 5 commits into
masterfrom
feat(chat)-identify-component-and-referer-in-agent-requests
Open

feat(chat): identify component and referer in agent requests#7002
afrencalg wants to merge 5 commits into
masterfrom
feat(chat)-identify-component-and-referer-in-agent-requests

Conversation

@afrencalg
Copy link
Copy Markdown
Contributor

Summary

Send x-algolia-component: ais-chat on every chat completions request, and forward an algolia-referer header (prompt-suggestions or ai-mode) when the message originates from the autocomplete prompt suggestions or the autocomplete/search-box AI Mode button. This lets the agent attribute traffic without parsing the user agent.

Also clean up the request body: previously every parameter received by prepareSendMessagesRequest (headers, api, body, credentials, requestMetadata, …) was spread back into the body, duplicating values already sent in the headers and HTTP metadata. The body now contains only { id, messageId, messages } for the agent path, and the equivalent minimal payload for the default custom-transport path.

@afrencalg afrencalg requested review from FabienMotte, Haroenv and shaejaz and removed request for FabienMotte and shaejaz April 29, 2026 15:50
@afrencalg afrencalg self-assigned this Apr 29, 2026
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented Apr 29, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 19 complexity

Metric Results
Complexity 19

View in Codacy

TIP This summary will be updated as you push new changes.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 29, 2026

More templates

algoliasearch-helper

npm i https://pkg.pr.new/algolia/instantsearch/algoliasearch-helper@7002

instantsearch-ui-components

npm i https://pkg.pr.new/algolia/instantsearch/instantsearch-ui-components@7002

instantsearch.css

npm i https://pkg.pr.new/algolia/instantsearch/instantsearch.css@7002

instantsearch.js

npm i https://pkg.pr.new/algolia/instantsearch/instantsearch.js@7002

react-instantsearch

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch@7002

react-instantsearch-core

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch-core@7002

react-instantsearch-nextjs

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch-nextjs@7002

react-instantsearch-router-nextjs

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch-router-nextjs@7002

vue-instantsearch

npm i https://pkg.pr.new/algolia/instantsearch/vue-instantsearch@7002

commit: a6b32f9

Comment thread packages/instantsearch.js/src/widgets/autocomplete/autocomplete.tsx Outdated
Comment thread packages/instantsearch.js/src/connectors/chat/__tests__/connectChat-test.ts Outdated
Comment thread packages/instantsearch.js/src/connectors/chat/connectChat.ts Outdated
Copy link
Copy Markdown
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good. Can you also check with Agent Studio team to ensure they will process these headers? cc @leonardocuco

Comment thread packages/instantsearch.js/src/connectors/chat/connectChat.ts Outdated
Comment thread packages/instantsearch.js/src/widgets/autocomplete/autocomplete.tsx Outdated
Comment thread packages/instantsearch.js/src/widgets/autocomplete/autocomplete.tsx Outdated
Comment thread packages/instantsearch.js/src/connectors/chat/connectChat.ts Outdated
Comment thread packages/instantsearch.js/src/connectors/chat/connectChat.ts Outdated
Comment thread packages/instantsearch.js/src/connectors/chat/connectChat.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants