mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-03 08:53:36 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user