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

feat: add tour guide #460

Merged
merged 5 commits into from
Dec 3, 2024
Merged

feat: add tour guide #460

merged 5 commits into from
Dec 3, 2024

Conversation

NingLu
Copy link
Collaborator

@NingLu NingLu commented Dec 2, 2024

Fixes #

🤖 AI-Generated PR Description (Powered by Amazon Bedrock)

Description

This pull request introduces a new feature that integrates the LangChain library into our project. Specifically, it adds a Retrieval Augmented Generation (RAG) tool to the common_tools module, which can be used for question-answering tasks by retrieving relevant information from a knowledge base and generating a final answer.

The changes in the portal directory are related to the front-end implementation of the RAG tool. The Home.tsx file has been updated to include a new component that allows users to interact with the RAG tool. The CommonLayout.tsx file has been modified to include the necessary imports and styling for the new component. Additionally, the types/index.ts file has been updated to include any new type definitions required for the RAG tool.

The package.json and package-lock.json files have been updated to include the LangChain library as a dependency.

Type of change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

File Stats Summary

File number involved in this PR: 6, unfold to see the details:

The file changes summary is as follows:

Files
Changes
Change Summary
source/lambda/online/common_logic/langchain_integration/tools/common_tools/rag.py 2 added, 1 removed The code change modifies the formatting of the context_md assignment by splitting it across multiple lines, likely to improve code readability and maintainability.
source/portal/package.json 2 added, 1 removed The code changes include adding the 'react-joyride' library as a dependency, which is likely used for creating interactive walkthroughs or guided tours within a React application.
source/portal/src/types/index.ts 20 added, 1 removed This code change introduces two new TypeScript interfaces, CustomLink and CustomSection, which extend the existing Link and Section interfaces from the @cloudscape-design/components library, adding optional id, itemID, className, and data-testid properties. It also creates a union type, CustomNavigationItem, to represent all navigation items.
source/portal/src/layout/CommonLayout.tsx 16 added, 20 removed The code changes introduce the following:
  1. Import CustomNavigationItem type from src/types.
  2. Add a className prop to the SideNavigation component.
  3. Add id and itemID props to navigation items for better accessibility and styling.
  4. Map layoutItems to include itemID and className based on item text.
  5. Add itemID for documentation link.
  6. Type cast navigation items as CustomNavigationItem[]. |
    | source/portal/package-lock.json | 130 added, 0 removed | The code changes add the "react-joyride" library as a dependency and install the "@gilbarbara/deep-equal", "deep-diff", "deepmerge", "is-lite", "popper.js", "react-floater", "react-innertext", "scroll", "scrollparent", and "tree-changes" packages as dependencies. |
    | source/portal/src/pages/home/Home.tsx | 269 added, 54 removed | The code changes introduce a new guided tour functionality to the Home component using the react-joyride library. It includes steps to highlight various sections of the application and provide explanations. The tour can be reset, and its completion status is stored in local storage. Additionally, some styling and layout adjustments are made. |
🤖 AI-Generated PR Description (Powered by Amazon Bedrock)

Description

This pull request introduces a new feature that integrates the LangChain library into our application. The primary change is in the rag.py file, which implements the Retrieval Augmented Generation (RAG) model from LangChain. This model combines a retrieval component with a language model to provide more accurate and relevant responses.

Additionally, there are changes to the frontend codebase to support the new RAG functionality. The Home.tsx file has been updated to include a new component for interacting with the RAG model. Corresponding changes have been made to the locale files (en.json and zh.json) to provide translations for the new UI elements.

The package.json and package-lock.json files have been updated to include the required LangChain dependencies.

Type of change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

File Stats Summary

File number involved in this PR: 8, unfold to see the details:

The file changes summary is as follows:

Files
Changes
Change Summary
source/lambda/online/common_logic/langchain_integration/tools/common_tools/rag.py 2 added, 1 removed The code change formats the context_md variable by splitting the line into two lines for better readability and sends a trace with the formatted context data.
source/portal/package.json 2 added, 1 removed The code changes add the "react-joyride" library as a dependency, which is likely used for creating guided tours or walkthroughs within a React application.
source/portal/src/types/index.ts 20 added, 1 removed This code change introduces new TypeScript interfaces, CustomLink and CustomSection, extending existing interfaces from the AWS CloudScape Design System, and a union type CustomNavigationItem to handle different types of navigation items.
source/portal/src/locale/zh.json 15 added, 0 removed This code change adds a new "tour" object to the existing code, which contains various key-value pairs representing text labels or descriptions for different components of a user interface or application tour/walkthrough.
source/portal/src/locale/en.json 15 added, 0 removed The code changes add a new "tour" object to the existing object, containing key-value pairs with descriptions for various components of the AI Customer Service solution, such as the home page, chat, session history, chatbots, intentions, knowledge base, and prompts, along with text for tour navigation.
source/portal/src/layout/CommonLayout.tsx 16 added, 20 removed The code changes involve updating the SideNavigation component in the CommonLayout component. The changes include adding a className prop, mapping over the layoutItems array to add additional properties like itemID and className for each navigation item, and adding id and itemID props to various navigation items. Additionally, it imports the CustomNavigationItem type from src/types.
source/portal/package-lock.json 130 added, 0 removed The code changes involve adding the following dependencies: [email protected], @gilbarbara/[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], and [email protected].
source/portal/src/pages/home/Home.tsx 269 added, 54 removed The code changes introduce a guided tour functionality to the Home component using the react-joyride library. It includes steps highlighting different sections of the application, controlled by state and context. The tour can be restarted, and its completion is stored in localStorage. Additionally, some styling and localization options are set for the tour.
🤖 AI-Generated PR Description (Powered by Amazon Bedrock)

Description

This pull request includes changes to integrate the LangChain library for natural language processing tasks, specifically the Retrieval Augmented Generation (RAG) model. The RAG model is a powerful tool that combines a retrieval system with a language model to generate high-quality text based on relevant information retrieved from a knowledge base.

The main changes are:

  1. rag.py: Modified to include the RAG model implementation and related utilities.
  2. package-lock.json and package.json: Updated to include the required dependencies for the LangChain library.
  3. CommonLayout.tsx, en.json, zh.json, Home.tsx, and index.ts: Modified to integrate the RAG model into the user interface and handle user interactions.

The motivation behind this change is to enhance the application's natural language processing capabilities by leveraging the power of the RAG model. This will enable more accurate and relevant text generation based on the available knowledge base, leading to an improved user experience.

No additional dependencies are required for this change beyond the updated package.json.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

File Stats Summary

File number involved in this PR: 8, unfold to see the details:

The file changes summary is as follows:

Files
Changes
Change Summary
source/lambda/online/common_logic/langchain_integration/tools/common_tools/rag.py 2 added, 1 removed The code changes involve formatting the context_md variable assignment for better readability by splitting it across multiple lines and indenting it properly.
source/portal/src/types/index.ts 20 added, 1 removed The code adds new interfaces CustomLink and CustomSection extending SideNavigationProps components, allowing additional properties like id, itemID, className, and data-testid. It also creates a union type CustomNavigationItem for navigation items.
source/portal/package.json 2 added, 1 removed The code changes involve adding the 'react-joyride' library as a dependency, which is likely used for creating guided tours or walkthroughs within a React application.
source/portal/src/locale/en.json 15 added, 0 removed The code changes introduce a new "tour" object with various keys and values related to providing a guided tour or walkthrough of the application, including descriptions for different sections like home, chat, session history, chatbots, intentions, knowledge base, and prompts, as well as navigation buttons.
source/portal/src/layout/CommonLayout.tsx 16 added, 20 removed This code change updates the SideNavigation component in a React application. It adds a className prop, unique IDs for navigation items, maps layout items with additional properties like className and itemID, and defines the navigation items as a CustomNavigationItem type array.
source/portal/src/locale/zh.json 15 added, 0 removed The code changes introduce a new "tour" object in the translation file, which contains concise descriptions or instructions for various components of the AI Customer Service solution, such as deploying the solution, chatting with the AI assistant, managing chat history, chatbots, intents, knowledge bases, and prompts.
source/portal/package-lock.json 130 added, 0 removed The code changes involve adding the following dependencies: [email protected], @gilbarbara/[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], and [email protected].
source/portal/src/pages/home/Home.tsx 269 added, 54 removed The code changes introduce a guided tour feature to the Home component. It imports necessary dependencies, defines tour steps, handles tour callbacks, and renders a Joyride component with customized styles. The tour highlights key sections of the application and can be restarted. Additionally, it conditionally renders steps based on configuration settings.

@530051970 530051970 merged commit d7bd07f into dev Dec 3, 2024
6 checks passed
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