Skip to content

Comments

[ADE-30] - Implement Amazon Bedrock Integration#33

Merged
jkestering-modus merged 3 commits intomainfrom
ADE-30-bedrock
Mar 27, 2025
Merged

[ADE-30] - Implement Amazon Bedrock Integration#33
jkestering-modus merged 3 commits intomainfrom
ADE-30-bedrock

Conversation

@jkestering-modus
Copy link
Collaborator

@jkestering-modus jkestering-modus commented Mar 26, 2025

Implement Amazon Bedrock Integration and UI Improvements

Changes

Bedrock AI Integration

  • Integrated Amazon Bedrock for AI chat responses using the Titan Text G1 Lite model
  • Implemented chat context management to maintain conversation history
  • Created session-based conversation handling with automatic cleanup
  • Added test environment detection for smooth CI/CD process

Chat UI Improvements

  • Fixed content text visibility issue where messages were being cut off under the input area
  • Converted fixed pixel measurements to relative units (rem) for better responsiveness
  • Implemented proper padding and scroll behavior throughout chat interfaces
  • Added bottom spacing gradient for better visual transition

Internationalization

  • Added missing translation keys for AI Assistant components
  • Added chat page title translations in English, Spanish and French
  • Added input placeholder translations in all supported languages

Testing Improvements

  • Created comprehensive mocks for AWS services
  • Implemented test-friendly version of the Bedrock service
  • Updated test files to properly mock chat functionality

Does this PR introduce a breaking change?

No. This implementation maintains backward compatibility with existing components while adding new functionality.

What needs to be documented?

  • AWS Cognito Identity Pool setup required for Bedrock access
  • IAM permissions required for Bedrock model access
  • Environment variables for AWS configuration

Technical Details

AWS Configuration Required

To use this feature, you'll need:

  1. Cognito Identity Pool (not just User Pool)
  2. IAM role with permissions for bedrock:InvokeModel
  3. Configuration of the Identity Pool to use the IAM role
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "bedrock:InvokeModel"
      ],
      "Resource": [
        "arn:aws:bedrock:us-east-1::foundation-model/amazon.titan-text-lite-v1"
      ]
    }
  ]
}

Additional Comments

The chat functionality now maintains conversation history within a session and automatically resets when:

  • The AI assistant modal is closed
  • The user navigates away from the chat page

- Added @aws-sdk/client-bedrock-runtime dependency to package.json and package-lock.json.
- Implemented useChat hook for managing chat sessions and messages.
- Created bedrock.service.ts for interacting with the Bedrock API, including methods for creating sessions and sending messages.
- Updated Android Gradle files to include capacitor-filesystem for enhanced functionality.
- Introduced setup-tests.ts for mocking AWS Amplify and Bedrock services in tests.
- Updated AIAssistantModal to reset chat session and clear messages on close and dismiss.
- Enhanced ChatContainer and ChatInput for improved user experience with updated placeholders.
- Added resetSession method in ChatService for managing chat sessions.
- Updated BedrockService to handle test environments and improved error handling.
- Added internationalization support for AI Assistant strings in English, Spanish, and French.
- Improved ChatPage to reset session on component mount and unmount.
@jkestering-modus jkestering-modus self-assigned this Mar 26, 2025
@jkestering-modus jkestering-modus changed the title Ade 30 bedrock [ADE-30] - Implement Amazon Bedrock Integration Mar 26, 2025
@jkestering-modus jkestering-modus marked this pull request as ready for review March 26, 2025 21:15
- Added error message display in UploadModal for better user feedback.
- Introduced faCircleXmark icon for error indication.
- Updated UploadModal.scss for new error message styling.
- Adjusted UploadModal.tsx to render error state correctly.
- Added new error messages in English, Spanish, and French for file size and type validation.
- Included a new image asset for upload error representation.
@sonarqubecloud
Copy link

@jkestering-modus jkestering-modus merged commit a877e9c into main Mar 27, 2025
3 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.

2 participants