everydaycats commited on
Commit
154b82e
·
verified ·
1 Parent(s): 3f722da

Update app.js

Browse files
Files changed (1) hide show
  1. app.js +9 -6
app.js CHANGED
@@ -58,18 +58,21 @@ async function startBackgroundInit(projectId, description) {
58
 
59
  // A. PM Generates GDD
60
  console.log(`[${projectId}] Generating GDD...`);
61
- const gdd = await AIEngine.callPM(pmHist, `New Project: ${description}. Generate GDD.`);
62
  pmHist.push({ role: 'user', parts: [{ text: description }] });
63
  pmHist.push({ role: 'model', parts: [{ text: gdd }] });
64
 
65
- // B. PM Generates First Task
66
  console.log(`[${projectId}] Generating Tasks...`);
67
- const tasks = await AIEngine.callPM(pmHist, "Create a JSON list of the first 3 technical tasks.");
68
 
69
- // C. Worker Starts Task 1
70
  console.log(`[${projectId}] Worker executing Task 1...`);
71
  const workerHist = [];
72
- const firstPrompt = `GDD: ${gdd}\nTasks: ${tasks}\n\nStart Task 1.`;
 
 
 
73
  const code = await AIEngine.callWorker(workerHist, firstPrompt);
74
 
75
  workerHist.push({ role: 'user', parts: [{ text: firstPrompt }] });
@@ -83,7 +86,7 @@ async function startBackgroundInit(projectId, description) {
83
  status: "ACTIVE"
84
  });
85
 
86
- // Queue the code for the plugin
87
  await StateManager.queueCommand(projectId, code);
88
  console.log(`[${projectId}] Init Complete. First command queued.`);
89
  }
 
58
 
59
  // A. PM Generates GDD
60
  console.log(`[${projectId}] Generating GDD...`);
61
+ const gdd = await AIEngine.callPM(pmHist, `New Project: ${description}. Generate a concise GDD.`);
62
  pmHist.push({ role: 'user', parts: [{ text: description }] });
63
  pmHist.push({ role: 'model', parts: [{ text: gdd }] });
64
 
65
+ // B. PM Generates Tasks
66
  console.log(`[${projectId}] Generating Tasks...`);
67
+ const tasks = await AIEngine.callPM(pmHist, "Create a list of the first 3 technical tasks.");
68
 
69
+ // C. Worker Starts Task 1 (FORCE CODE GENERATION)
70
  console.log(`[${projectId}] Worker executing Task 1...`);
71
  const workerHist = [];
72
+
73
+ // We add a system instruction suffix to ensure it creates code
74
+ const firstPrompt = `CONTEXT:\n${gdd}\n\nTASKS:\n${tasks}\n\nINSTRUCTION:\nCreate the Script for Task 1 immediately. Output the Lua code block now. Do not talk.`;
75
+
76
  const code = await AIEngine.callWorker(workerHist, firstPrompt);
77
 
78
  workerHist.push({ role: 'user', parts: [{ text: firstPrompt }] });
 
86
  status: "ACTIVE"
87
  });
88
 
89
+ // Queue the code
90
  await StateManager.queueCommand(projectId, code);
91
  console.log(`[${projectId}] Init Complete. First command queued.`);
92
  }