Skip to content

Conversation

@drernie
Copy link
Member

@drernie drernie commented Sep 25, 2025

Summary

  • 🎯 Replaced hardcoded DEFAULT_MODEL_ID with a configurable JSON file containing available Bedrock models
  • 🚀 Added real-time AWS Bedrock model validation - Tests ALL models (preset + custom) for actual availability in user's AWS account
  • ✨ Enhanced DevTools UI with dropdown selector, manual testing, and rich feedback
  • 🛠️ Fixed all PR review issues including accessibility, state management, and code quality

Key Features Added

Real Model Validation

  • Tests actual AWS Bedrock API availability (not just string validation)
  • Handles all AWS error types: ValidationException, AccessDeniedException, ThrottlingException
  • Works for both preset models and custom model IDs
  • Prevents users from selecting unavailable models

Better User Experience

  • Press Enter or click test button to validate (no more onBlur)
  • Loading spinners and disabled fields during testing
  • Rich modal dialogs with success/error/warning icons
  • Clear error messages with actionable guidance

DevTools Improvements

  • Dropdown with preset models + descriptions
  • Custom model ID mode with real-time testing
  • Manual test button for immediate validation
  • Smart fallbacks and error recovery

Technical Changes

  • Added models.json configuration file with available Bedrock models
  • Updated Assistant.tsx to load models from JSON and export validation functions
  • Enhanced DevTools.tsx with real AWS testing, better events, accessibility fixes
  • Fixed state management logic error in custom mode toggle
  • Replaced Link component with proper Button for accessibility
  • Improved runtime safety with explicit array bounds checking

PR Review Issues Fixed ✅

  • ✅ Logic error in state management causing inconsistency when toggling custom mode
  • ✅ Accessibility concerns with Link component used as button
  • ✅ Runtime safety with better array access patterns
  • ✅ All linting errors resolved
  • ✅ TypeScript compilation passes

Test Plan

  • Verified code compiles without TypeScript errors
  • All linting passes (npm run lint)
  • Build succeeds (npm run build)
  • Real AWS Bedrock model testing works
  • User experience flows (Enter key, test button, dropdown selection)
  • Error handling for invalid/unavailable models
  • Loading states and modal feedback
  • Manual testing of model selection in production environment
  • Verify Nova Lite model works correctly as default

🤖 Generated with Claude Code

- Add models.json with list of available Bedrock models (Nova Lite as default)
- Update Assistant.tsx to load models from JSON configuration
- Enhance DevTools with dropdown selector for preset models
- Add option to enter custom model IDs when needed

This makes it easier to manage and update available models without code changes.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@codecov
Copy link

codecov bot commented Sep 25, 2025

Codecov Report

❌ Patch coverage is 6.03448% with 109 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.34%. Comparing base (e70ccb2) to head (6af7aa6).

Files with missing lines Patch % Lines
...alog/app/components/Assistant/UI/Chat/DevTools.tsx 1.14% 80 Missing and 6 partials ⚠️
...talog/app/components/Assistant/Model/Assistant.tsx 20.68% 18 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4562      +/-   ##
==========================================
- Coverage   39.44%   39.34%   -0.11%     
==========================================
  Files         852      852              
  Lines       36847    36957     +110     
  Branches     6013     6055      +42     
==========================================
+ Hits        14536    14542       +6     
- Misses      21087    21180      +93     
- Partials     1224     1235      +11     
Flag Coverage Δ
api-python 91.67% <ø> (ø)
catalog 20.12% <6.03%> (-0.06%) ⬇️
lambda 92.60% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Overview

Summary

This PR successfully replaces the hardcoded Bedrock model ID with a configurable JSON-based system. The changes enhance the DevTools UI with a user-friendly dropdown for model selection while maintaining backward compatibility through custom model input.

Key Improvements:

  • New models.json configuration file with structured model metadata
  • Enhanced DevTools UI with dropdown selector showing model names and descriptions
  • Seamless switching between preset and custom model modes
  • Improved default model selection (Amazon Nova Lite for better cost efficiency)

Issues Found:

  • Logic error in state management causing potential inconsistency when toggling custom mode
  • Accessibility concerns with Link component used as button
  • Runtime safety could be improved with better array access patterns

Impact: Low-risk enhancement that modernizes the model selection interface while maintaining existing functionality.

Confidence Score: 4/5

  • This PR is generally safe to merge with minor issues that should be addressed
  • Score reflects well-structured changes with good error handling, but reduced due to state management inconsistency in DevTools and accessibility concerns that could cause user experience issues
  • DevTools.tsx requires attention for state management fix and accessibility improvements

Important Files Changed

File Analysis

Filename        Score        Overview
catalog/app/components/Assistant/Model/models.json 5/5 New JSON configuration file defining available Bedrock models with metadata - well-structured and safe
catalog/app/components/Assistant/Model/Assistant.tsx 4/5 Updated to use configurable models from JSON, includes fallback handling but has potential runtime issue with array access
catalog/app/components/Assistant/UI/Chat/DevTools.tsx 3/5 Enhanced UI with dropdown and custom mode switching, but has state management issues and accessibility concerns

Sequence Diagram

sequenceDiagram
    participant User as User
    participant DevTools as DevTools Component  
    participant Assistant as Assistant.tsx
    participant JSON as models.json
    participant LocalStorage as LocalStorage
    
    User->>DevTools: Opens DevTools UI
    DevTools->>Assistant: Import MODELS constant
    Assistant->>JSON: Import modelsConfig
    JSON-->>Assistant: Return models array
    Assistant-->>DevTools: Provide MODELS for dropdown
    
    User->>DevTools: Select model from dropdown
    DevTools->>Assistant: setValue(modelId)
    Assistant->>LocalStorage: Store model override
    
    User->>DevTools: Click "enter custom model ID"
    DevTools->>DevTools: setCustomMode(true)
    DevTools->>User: Show custom text input
    
    User->>DevTools: Enter custom model ID
    DevTools->>Assistant: setValue(customModelId)
    Assistant->>LocalStorage: Store custom model override
    
    User->>DevTools: Clear/Reset model
    DevTools->>Assistant: setValue('')
    DevTools->>DevTools: setCustomMode(false)
    Assistant->>LocalStorage: Remove model override
    Assistant-->>Assistant: Use DEFAULT_MODEL_ID
Loading

3 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

drernie and others added 5 commits September 29, 2025 14:17
## Features Added:
- **Real AWS Bedrock API testing**: Tests ALL models (preset + custom) for actual availability
- **Better event handling**: Press Enter or click test button instead of onBlur
- **Rich visual feedback**: Loading spinners, success/error modals with icons
- **Smart error handling**: Parses AWS error codes (ValidationException, AccessDeniedException, etc.)
- **Manual test button**: Explicit checkmark button for immediate testing

## PR Review Issues Fixed:
- Fixed state management logic error in custom mode toggle
- Replaced Link component with proper Button for accessibility
- Improved runtime safety with explicit array length checks
- All linting and TypeScript compilation passes

## User Experience:
- Type freely without validation interruption
- Press Enter or click test button to validate
- Clear modal dialogs show availability status
- Tests work for both preset and custom models
- Handles throttling, access denied, and model not found errors

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
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