Skip to content
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

(EAI-926) UI supports clientContext #666

Merged
merged 4 commits into from
Apr 3, 2025
Merged

(EAI-926) UI supports clientContext #666

merged 4 commits into from
Apr 3, 2025

Conversation

nlarew
Copy link
Collaborator

@nlarew nlarew commented Mar 28, 2025

Jira: (EAI-926) UI supports clientContext

Changes

  • Adds a getClientContext prop to Chatbot that allows clients to send arbitrary data to the server
  • Updates the conversations service to accept & pass clientContext

@nlarew nlarew requested a review from Copilot March 28, 2025 15:12
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enables the UI to support client context data by adding an optional getClientContext prop and updating the conversation service and tests to handle the additional data.

  • Added a getClientContext prop to the Chatbot component and useConversation hook.
  • Updated the conversation service methods (addMessage and addMessageStreaming) to accept and include clientContext in the request payload.
  • Extended tests to verify that clientContext is correctly forwarded during message and streaming operations.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/mongodb-chatbot-ui/src/useConversation.tsx Introduces the getClientContext parameter and passes it to service methods.
packages/mongodb-chatbot-ui/src/services/conversations.ts Updates request payloads in addMessage and addMessageStreaming to include clientContext.
packages/mongodb-chatbot-ui/src/services/conversations.test.ts Adds tests to ensure clientContext is handled properly for messages and streaming events.
packages/mongodb-chatbot-ui/src/Chatbot.tsx Propagates getClientContext from Chatbot to InnerChatbot.
packages/mongodb-chatbot-ui/src/App.tsx Demonstrates usage of getClientContext in the example App.

@nlarew nlarew requested a review from mongodben March 28, 2025 16:54
Copy link
Collaborator

@mongodben mongodben left a comment

Choose a reason for hiding this comment

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

lgtm, docs update too pls

@nlarew nlarew merged commit c6abd99 into main Apr 3, 2025
@nlarew nlarew deleted the client-context branch April 3, 2025 22:45
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