Skip to content

Feat: Optimize database performance and fix dataset regeneration UI #93

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

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

Khauneesh-AI
Copy link
Collaborator

@Khauneesh-AI Khauneesh-AI commented Jul 9, 2025

Backend Performance Improvements:

  • Added completed_rows column to track generation progress
  • Optimized database queries for faster UI loading
  • Enhanced use_case column population from backend API

Frontend new components added/modified

  • Added column completed_rows on UI home page for generation table.
  • Now all values for templates get rendered in the template column | Earlier it used to be only text2sql and code generation.
  • The newly added templates are also available in dropdown on the configure page.

Frontend Regeneration Fixes:

  • Fixed Examples component to render immediately during regeneration
  • Eliminated unnecessary API calls during dataset regeneration (performance boost)
  • Resolved Form.useWatch timing issues by using form.getFieldsValue(true) pattern
  • Added regeneration detection across all DataGenerator components
  • Prevented API calls for topics, examples, prompts, and model params during regeneration

Key Technical Changes:

  • Examples.tsx: Fixed data source logic using same pattern as Summary.tsx
  • Configure.tsx: Added regeneration detection to prevent inference_type override
  • Prompt.tsx: Conditional API fetching based on regeneration state
  • Parameters.tsx: Skip model params API during regeneration
  • UseCaseSelector.tsx: Prevent use cases API call during regeneration
  • API hooks: Enhanced with conditional URL generation and loading states

Successfully tested:
✅ Examples render immediately during regeneration (no loading spinner) ✅ All form fields populate correctly from existing dataset data ✅ No unnecessary API calls during regeneration
✅ Original dataset creation functionality preserved ✅ Database performance improvements for swift UI loading.
✅ Backend testing and integration testing.

Maintains backward compatibility while significantly improving user experience.

Backend Performance Improvements:
- Added completed_rows column to track generation progress
- Optimized database queries for faster UI loading
- Enhanced use_case column population from backend API

Frontend Regeneration Fixes:
- Fixed Examples component to render immediately during regeneration
- Eliminated unnecessary API calls during dataset regeneration (performance boost)
- Resolved Form.useWatch timing issues by using form.getFieldsValue(true) pattern
- Added regeneration detection across all DataGenerator components
- Prevented API calls for topics, examples, prompts, and model params during regeneration

Key Technical Changes:
- Examples.tsx: Fixed data source logic using same pattern as Summary.tsx
- Configure.tsx: Added regeneration detection to prevent inference_type override
- Prompt.tsx: Conditional API fetching based on regeneration state
- Parameters.tsx: Skip model params API during regeneration
- UseCaseSelector.tsx: Prevent use cases API call during regeneration
- API hooks: Enhanced with conditional URL generation and loading states

Successfully tested:
✅ Examples render immediately during regeneration (no loading spinner)
✅ All form fields populate correctly from existing dataset data
✅ No unnecessary API calls during regeneration
✅ Original dataset creation functionality preserved
✅ Database performance improvements for swift UI loading

Maintains backward compatibility while significantly improving user experience.
@Khauneesh-AI Khauneesh-AI requested review from vkeivan and Copilot July 9, 2025 17:03
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR optimizes backend database performance and fixes frontend dataset regeneration issues. The key focus is improving the user experience during dataset regeneration by eliminating unnecessary API calls and ensuring proper data rendering.

  • Added completed_rows column to track dataset generation progress and created a lightweight query for better performance
  • Fixed dataset regeneration UI by using existing form data instead of triggering API calls for topics, examples, prompts, and model parameters
  • Enhanced use case handling by replacing hardcoded translations with dynamic API-based lookup system

Reviewed Changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
app/main.py Switched to lightweight database query for generation history
app/core/database.py Added optimized query method with completed_rows tracking
app/client/src/pages/DataGenerator/* Fixed regeneration detection and conditional API fetching across all components
app/client/src/pages/Home/* Added completed_rows column display and migrated to dynamic use case mapping
app/client/src/api/* Enhanced hooks with conditional fetching and added use case mapping functionality
Comments suppressed due to low confidence (1)

app/client/src/pages/DataGenerator/Prompt.tsx:252

  • Fixed the typo from 'JSAON' to 'JSON' correctly.
                            label={

Khauneesh-AI and others added 3 commits July 9, 2025 22:36
- Fixed test_generation_history to mock get_paginated_generate_metadata_light instead of get_paginated_generate_metadata
- The API endpoint uses get_paginated_generate_metadata_light for better performance
- All integration tests now pass successfully
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.

1 participant