working checkpoint before major feedback UI changes
This commit is contained in:
64
AGENTS.md
64
AGENTS.md
@@ -987,3 +987,67 @@ const [drawButtonDisabled, setDrawButtonDisabled] = useState(false);
|
||||
- ✅ Prompts should now display correctly on the main page
|
||||
|
||||
The regression has been fixed. The prompts display should now work correctly, showing the most recent prompt from history (position 0) on the main page.
|
||||
|
||||
## API Call Sequence Optimization ✓ COMPLETED
|
||||
|
||||
### User Request
|
||||
The API calls to the AI provider should happen in a different sequence:
|
||||
1. Pool refill should start immediately when user clicks "Fill Prompt Pool" (uses active words 6-11)
|
||||
2. Feedback weighting UI should show for queued words (0-5)
|
||||
3. After user rates queued words, generate new feedback words
|
||||
4. Refresh UI elements after both operations complete
|
||||
|
||||
### Solution Implemented
|
||||
|
||||
#### Backend Analysis
|
||||
- **Pool refill** (`fill_pool_to_target`): Already uses active words (6-11) via `get_feedback_active_words()`
|
||||
- **Feedback rating** (`update_feedback_words`): Already generates new feedback words via `_generate_and_insert_new_feedback_words()`
|
||||
- **No backend changes needed** - The separation already exists
|
||||
|
||||
#### Frontend Modifications
|
||||
Updated `PromptDisplay.jsx` to implement the new sequence:
|
||||
|
||||
1. **Immediate pool refill** when user clicks "Fill Prompt Pool":
|
||||
```javascript
|
||||
const handleFillPool = async () => {
|
||||
// Start pool refill immediately (uses active words 6-11)
|
||||
setFillPoolLoading(true);
|
||||
const response = await fetch('/api/v1/prompts/fill-pool', { method: 'POST' });
|
||||
if (response.ok) {
|
||||
// Pool refill started successfully, now show feedback weighting UI
|
||||
setShowFeedbackWeighting(true);
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
2. **Feedback UI** shows after pool refill starts
|
||||
3. **User rates queued words** (0-5) via `FeedbackWeighting` component
|
||||
4. **UI refresh** after feedback submission:
|
||||
```javascript
|
||||
const handleFeedbackComplete = async (feedbackData) => {
|
||||
// After feedback is submitted, refresh the UI
|
||||
setShowFeedbackWeighting(false);
|
||||
fetchMostRecentPrompt();
|
||||
fetchPoolStats();
|
||||
};
|
||||
```
|
||||
|
||||
### Verification
|
||||
- ✅ Pool refill starts immediately when clicking "Fill Prompt Pool"
|
||||
- ✅ Feedback UI shows for queued words (0-5) after pool refill starts
|
||||
- ✅ User can rate queued words while pool refill runs in background
|
||||
- ✅ New feedback words generated after rating submission
|
||||
- ✅ UI refreshes to show updated state
|
||||
- ✅ All existing functionality preserved
|
||||
|
||||
### Test Results
|
||||
- Backend endpoints respond correctly
|
||||
- Pool refill uses active words (6-11) as intended
|
||||
- Feedback rating generates new words and inserts at position 0
|
||||
- Frontend flow follows the optimized sequence
|
||||
|
||||
The API call sequence has been successfully optimized to:
|
||||
1. Start pool refill immediately (parallel operation)
|
||||
2. Show feedback UI concurrently
|
||||
3. Generate new feedback words after user rating
|
||||
4. Refresh all UI elements
|
||||
|
||||
Reference in New Issue
Block a user