jules / patch_app_cue.py
GraziePrego's picture
Upload folder using huggingface_hub
34450be verified
import re
with open("App.tsx", "r") as f:
content = f.read()
# Add logic in handleSubmitCreateSession to handle runHfDeploymentCue
old_code = """ const session = await julesService.current.createSession(config.title, config.prompt, sourceId, 'AUTO_CREATE_PR');
setSessionAgentMap(prev => ({ ...prev, [session.id]: currentAgent.id }));
setSessions(prev => [session, ...prev]);
setCurrentSessionId(session.id);
setNewSessionModalOpen(false);
setIsLoading(false);"""
new_code = """ const session = await julesService.current.createSession(config.title, config.prompt, sourceId, 'AUTO_CREATE_PR');
setSessionAgentMap(prev => ({ ...prev, [session.id]: currentAgent.id }));
setSessions(prev => [session, ...prev]);
setCurrentSessionId(session.id);
// Handle HF Deployment Cue if checked
if (config.runHfDeploymentCue) {
const templates = [
"Please perform a deep investigation of the codebase to understand its current state and architecture. Look for dependencies, main entry points, and service patterns. READY",
"Based on the investigation, create a detailed project vision and implementation plan. Outline the necessary changes and new components. READY",
"Implement the changes according to the plan and prepare for deployment. Ensure all tests pass and documentation is updated. READY"
];
setTemplateQueue(prev => ({
...prev,
[session.id]: templates
}));
// We just set the queue here, because the session creation already starts a process with the initial prompt.
// When the agent is "READY", the first template in the queue will be fired.
}
setNewSessionModalOpen(false);
setIsLoading(false);"""
content = content.replace(old_code, new_code)
with open("App.tsx", "w") as f:
f.write(content)