Skip to content

feat(chat): render reasoning parts - #7139

Merged
anjola-adeuyi merged 2 commits into
masterfrom
feat/fx-3831-chat-reasoning-rendering
Jul 28, 2026
Merged

feat(chat): render reasoning parts#7139
anjola-adeuyi merged 2 commits into
masterfrom
feat/fx-3831-chat-reasoning-rendering

Conversation

@anjola-adeuyi

@anjola-adeuyi anjola-adeuyi commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds opt-in rendering for Chat reasoning parts.

showReasoning defaults to false. When enabled, reasoning keeps its original position among tool calls and answer text, collapsed by default. Only the active reasoning part shows progress.

This PR does not change reconnect or reducer behavior.

Result

Enable reasoning in React:

<Chat showReasoning />

Or InstantSearch.js:

chat({ showReasoning: true });

Covered behavior:

  • hidden by default, opt-in in InstantSearch.js and React
  • reasoning order around tools and answers
  • Markdown body with a translated label
  • parseMarkdown applies consistently to text and reasoning parts
  • keyboard access for long reasoning
  • one progress indicator while reasoning is active
  • reasoning text excluded from Copy

Reasoning parts

Each reasoning part is rendered as an independent, uncontrolled <details> disclosure. It is collapsed by default, including while that part is still streaming; activity is signaled by aria-busy and the pulsing label. Nothing opens or closes it automatically, so a reader's choice survives reasoning ending, the answer starting and the response completing. This matches the shipped Agent Studio accordion, which is uncontrolled for the same reason.

Additional behavior changes

  • Copy excludes reasoning text. getTextContent previously matched any part with a top-level text field, including reasoning. Copy could therefore include reasoning text even when showReasoning was false. It now includes text parts only and reasoning-only messages no longer show Copy.
  • Nested message props now merge with dedicated props. Providing messagesProps.assistantMessageProps or messagesProps.userMessageProps previously replaced the values assembled from the dedicated top-level leading and footer component props. They now merge key by key, so nested values override only matching keys while omitted dedicated components remain in effect.

Scope

This narrows #7105 to the rendering required by FX-3831. It does not add summaries, PII heuristics, loading captions, additional visibility modes or a custom chat implementation.

vue-instantsearch has no Chat component, so the cross-flavor suite runs JavaScript and React and skips Vue as it does for the rest of Chat.

Known limit

  • Collapsed reasoning Markdown is still compiled on each streaming update. Lazy compilation is deferred to follow-up work.

Demo

Real Agent Studio stream using reasoning → Algolia Search tool → reasoning → final response.

reasoning.pr.mov

@codacy-production

codacy-production Bot commented Jul 27, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 42 complexity

Metric Results
Complexity 42

View in Codacy

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

@pkg-pr-new

pkg-pr-new Bot commented Jul 27, 2026

Copy link
Copy Markdown
More templates

algoliasearch-helper

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

instantsearch-ui-components

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

instantsearch.css

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

instantsearch.js

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

react-instantsearch

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

react-instantsearch-core

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

react-instantsearch-nextjs

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

react-instantsearch-router-nextjs

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

vue-instantsearch

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

commit: 0afd269

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown

Size Change: +6.29 kB (+0.53%)

Total Size: 1.2 MB

📦 View Changed
Filename Size Change
packages/instantsearch.css/components/chat-min.css 6.16 kB +401 B (+6.97%) 🔍
packages/instantsearch.css/components/chat.css 6.59 kB +427 B (+6.93%) 🔍
packages/instantsearch.css/themes/algolia-min.css 10.6 kB +380 B (+3.72%)
packages/instantsearch.css/themes/algolia.css 11.3 kB +442 B (+4.08%)
packages/instantsearch.css/themes/nova-min.css 10.7 kB +392 B (+3.8%)
packages/instantsearch.css/themes/nova.css 11.4 kB +420 B (+3.82%)
packages/instantsearch.css/themes/satellite-min.css 11.5 kB +369 B (+3.33%)
packages/instantsearch.css/themes/satellite.css 12.3 kB +436 B (+3.66%)
packages/instantsearch.js/dist/instantsearch.development.js 287 kB +1.82 kB (+0.64%)
packages/instantsearch.js/dist/instantsearch.production.min.js 136 kB +567 B (+0.42%)
packages/react-instantsearch/dist/umd/ReactInstantSearch.min.js 108 kB +641 B (+0.6%)
ℹ️ View Unchanged
Filename Size Change
packages/algolia-experiences/dist/algolia-experiences.development.js 178 kB +1 B (0%)
packages/algolia-experiences/dist/algolia-experiences.production.min.js 81 kB +1 B (0%)
packages/algoliasearch-helper/dist/algoliasearch.helper.js 44.3 kB 0 B
packages/algoliasearch-helper/dist/algoliasearch.helper.min.js 13.9 kB -1 B (-0.01%)
packages/instantsearch.css/components/ai-mode-button.css 1.75 kB 0 B
packages/instantsearch.css/components/autocomplete-min.css 4.31 kB 0 B
packages/instantsearch.css/components/autocomplete.css 4.66 kB 0 B
packages/instantsearch.css/components/button.css 1.96 kB 0 B
packages/instantsearch.css/components/filter-suggestions.css 1.88 kB 0 B
packages/instantsearch.css/themes/reset-min.css 1.3 kB 0 B
packages/instantsearch.css/themes/reset.css 1.38 kB 0 B
packages/react-instantsearch-core/dist/umd/ReactInstantSearchCore.min.js 64.6 kB +1 B (0%)
packages/vue-instantsearch/vue2/cjs/index.js 19.9 kB 0 B
packages/vue-instantsearch/vue2/umd/index.js 73 kB -6 B (-0.01%)
packages/vue-instantsearch/vue3/cjs/index.js 20.6 kB 0 B
packages/vue-instantsearch/vue3/umd/index.js 73.4 kB -6 B (-0.01%)

compressed-size-action

@anjola-adeuyi
anjola-adeuyi marked this pull request as ready for review July 27, 2026 09:26
@anjola-adeuyi
anjola-adeuyi requested review from a team, FabienMotte, Haroenv and afrencalg and removed request for a team July 27, 2026 09:26
@anjola-adeuyi
anjola-adeuyi force-pushed the feat/fx-3831-chat-reasoning-rendering branch from b39f438 to 6423637 Compare July 27, 2026 17:19

@afrencalg afrencalg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@anjola-adeuyi
anjola-adeuyi merged commit 415313c into master Jul 28, 2026
15 checks passed
@anjola-adeuyi
anjola-adeuyi deleted the feat/fx-3831-chat-reasoning-rendering branch July 28, 2026 12:30
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.

2 participants