Implement version 3 of AI table request handling and update related components#1528
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request implements version 3 of the AI table request handling endpoint, which introduces AWS Bedrock as an AI provider alongside the existing OpenAI-based v2 endpoint. The PR also refactors the Bedrock provider's tool call argument handling to fix partial JSON accumulation issues.
Changes:
- Added v3 AI request endpoint (
/ai/v3/request/:connectionId) that explicitly uses AWS Bedrock as the AI provider - Refactored Bedrock provider's tool call handling to accumulate arguments as strings before parsing, preventing partial JSON parsing errors
- Updated timeout interceptor to support the new v3 endpoint with the same extended timeout as v2
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| backend/src/interceptors/timeout.interceptor.ts | Updated to include v3 endpoint in AI endpoint list; improved from url.includes to path.startsWith for more precise matching |
| backend/src/entities/ai/user-ai-requests-v2.controller.ts | Added new v3 endpoint handler that uses the V6 use case implementation with Bedrock provider |
| backend/src/entities/ai/use-cases/request-info-from-table-with-ai-v6.use.case.ts | New use case implementation that explicitly uses Bedrock provider and builds full conversation history (vs. OpenAI Responses API pattern in V5) |
| backend/src/entities/ai/ai.module.ts | Registered V6 use case as provider for V3 token and added v3 endpoint to authentication middleware |
| backend/src/common/data-injection.tokens.ts | Added REQUEST_INFO_FROM_TABLE_WITH_AI_V3 token for dependency injection |
| backend/src/ai-core/providers/langchain-bedrock.provider.ts | Fixed tool call argument handling by accumulating as string before parsing, preventing partial JSON merge issues |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @Inject(UseCaseType.REQUEST_INFO_FROM_TABLE_WITH_AI_V3) | ||
| private readonly requestInfoFromTableWithAIUseCaseV3: IRequestInfoFromTableV2, |
There was a problem hiding this comment.
The injected use case V3 is typed as IRequestInfoFromTableV2, which suggests a naming inconsistency. Since this is version 3 of the endpoint using version 6 of the use case, consider either creating a new interface IRequestInfoFromTableV3 or renaming the existing interface to be more generic (e.g., IRequestInfoFromTable). This would make the codebase more maintainable and less confusing.
No description provided.