Repository navigation
🧰 refactor: Move useChatHelpers and ChatProvider into the Chat Package - #17446
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review Please review the current PR head 381ffea. State the exact reviewed commit and ignore findings that apply only to earlier heads. Purpose supplied by the requester: Codex code review on 381ffea stuck running since 09:08Z (resolved failed); security review on the same head was clean. Rerun approved by the owner. |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…eact useChatHelpers now builds the pane contract from a ChatHost the app supplies: its pane store, message query cache, turn builder, thread selection, abort transport and settings. The stop path lives in its own module, its spec runs in the package against a host with no app behind it, and the app mounts its host in Root beside the steer host.
381ffea to
c550fbe
Compare
Pull Request
Summary
Stacked on #17445.
useChatHelpersandChatProviderstill lived inclient/src/hooks/Chat, wired straight to the app's query cache, pane store, router-backed conversation hooks and abort mutation, so the chat package could not build a pane's contract on its own. This movesuseChatHelpers,ChatProvider, the abort cleanup and the message cache id helpers into@librechat/chat/react, with the stop path in its own module.Everything the hook reached for in the app now arrives through a
ChatHostthe app supplies withChatHostProvider, the way the steer hooks take aSteerHost: the pane conversation, new conversation, turn builder (useChatFunctions), latest message, sibling selection, abort transport, message cache (read, write, subscribe, revision and the post-abort refetches) and feedback setting. The app's host lives inclient/src/Providers/ChatHostContext.tsxand is mounted inRootbeside the steer host.ChatSessionProvider, which also runs the SSE hooks, stays in the client for the next link. The abort and cache specs move into the package and run against a host with no app behind it.Type of change
Testing
Tested environments/configuration:
Automated tests:
npx jest src/hooks src/Providers src/routes src/utils src/componentsinclient: 763 suites, 12157 tests pass.npx jestinpackages/chat: 457 tests pass, including the stop spec against a substitute host.npx tsc --noEmitforclientandpackages/chat; ESLint on every touched file.useChathost-transport and live-attachment scenarios.Screenshots / recordings
No user-facing change.
Risk / compatibility
A tree that renders
ChatProviderorChatSessionProvidernow needs aChatHostProviderabove it, whichRootsupplies for every route that renders a chat.Checklist