feat: enhance follow-up feature handling and improve async processing

- Implemented asynchronous follow-up work in AutoModeService to allow immediate API response, enabling smoother user experience.
- Updated BoardView to handle follow-up prompts more efficiently, including state management and success notifications.
- Adjusted mock AutoMode API to simulate background processing for follow-up tasks, aligning with real implementation behavior.

These changes streamline the workflow for sending follow-up prompts and improve the responsiveness of the UI.
This commit is contained in:
Kacper
2025-12-09 22:43:33 +01:00
parent bfc0934ce9
commit 835d1ed021
3 changed files with 57 additions and 44 deletions

View File

@@ -557,6 +557,21 @@ class AutoModeService {
execution.sendToRenderer = sendToRenderer;
this.runningFeatures.set(featureId, execution);
// Start the async work in the background (don't await)
// This allows the API to return immediately so the modal can close
this.runFollowUpWork({ projectPath, featureId, prompt, imagePaths, sendToRenderer, execution }).catch((error) => {
console.error("[AutoMode] Follow-up work error:", error);
this.runningFeatures.delete(featureId);
});
// Return immediately so the frontend can close the modal
return { success: true };
}
/**
* Internal method to run follow-up work asynchronously
*/
async runFollowUpWork({ projectPath, featureId, prompt, imagePaths, sendToRenderer, execution }) {
try {
// Load features
const features = await featureLoader.loadFeatures(projectPath);
@@ -611,8 +626,6 @@ class AutoModeService {
passes: result.passes,
message: result.message,
});
return { success: true, passes: result.passes };
} catch (error) {
console.error("[AutoMode] Error in follow-up:", error);
sendToRenderer({
@@ -620,7 +633,6 @@ class AutoModeService {
error: error.message,
featureId: featureId,
});
throw error;
} finally {
this.runningFeatures.delete(featureId);
}