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: support feedback on frontend and store in dynamodb #461

Merged
merged 6 commits into from
Dec 3, 2024
Merged

Conversation

IcyKallen
Copy link
Contributor

@IcyKallen IcyKallen commented Dec 2, 2024

Fixes #

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

Description

This pull request introduces a new feature for managing chat history and removes the existing functionality for listing messages, sessions, and ratings from the DynamoDB database. The key changes are:

  • Added a new Lambda function chat_history_management.py to handle chat history operations.
  • Removed the Lambda functions list_messages.py, list_sessions.py, and rating.py as they are no longer needed.
  • Modified the api-stack.ts file to integrate the new chat history management functionality into the API Gateway.
  • Updated the ChatBot.tsx and SessionHistory.tsx components in the portal to use the new chat history management API.
  • Modified the index.ts file to include the necessary type definitions for the chat history feature.

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/ddb/list_messages.py 0 added, 100 removed This file is removed in this PR
source/lambda/ddb/list_sessions.py 0 added, 113 removed This file is removed in this PR
source/lambda/ddb/rating.py 0 added, 207 removed This file is removed in this PR
source/portal/src/pages/history/SessionHistory.tsx 2 added, 3 removed The code changes include: modifying the URL path for fetching session data, and simplifying the allItemsSelectionLabel expression by removing unnecessary string interpolation.
source/portal/src/pages/chatbot/ChatBot.tsx 147 added, 62 removed The code changes add a new field messageId to the MessageType interface and the messages array. It also adds functionality to send feedback (thumbs up or thumbs down) for each AI message to the backend. The feedback state is managed using the feedbackGiven state object, which maps message indices to the feedback type ('thumb_up', 'thumb_down', or null). Feedback buttons are rendered below each AI message, allowing the user to provide feedback.
source/portal/src/types/index.ts 3 added, 2 removed The code changes include adding a messageId field to the SessionMessage type, and changing the model field in the ChatbotDetailResponse type to an object with model_endpoint and model_name properties.
source/lambda/chat_history/chat_history_management.py 300 added, 0 removed This code change introduces a Lambda function for managing chat history operations. It provides REST API endpoints for listing chat sessions, messages, and managing message ratings. The code includes functionality for retrieving session and message details, listing sessions and messages with pagination, and adding feedback to messages. It also includes helper classes for handling API responses, pagination configuration, and AWS resource management.
source/infrastructure/lib/api/api-stack.ts 186 added, 197 removed The code changes involve modifications to the API Gateway and Lambda functions for knowledge base execution management, chat history management, chatbot management, prompt management, and intention management. The key changes are:
  • Added Lambda function for chat history management
  • Simplified API routes for chat sessions and messages
  • Added API routes for feedback on chat messages
  • Consolidated Lambda functions for chatbot CRUD operations
  • Refactored API routes and Lambda integrations for prompt and intention management |

@NingLu NingLu merged commit 71ee4ee into dev Dec 3, 2024
6 checks passed
@IcyKallen IcyKallen deleted the xuhan-dev branch December 4, 2024 06: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