everydaycats commited on
Commit
77053f7
·
verified ·
1 Parent(s): 3443915

Update aiEngine.js

Browse files
Files changed (1) hide show
  1. aiEngine.js +12 -9
aiEngine.js CHANGED
@@ -95,12 +95,14 @@ export const AIEngine = {
95
  },
96
 
97
  /**
98
- * 3. ONBOARDING ANALYST (Question Generation)
99
- * Returns STRICT JSON for the Frontend
 
100
  */
101
  generateEntryQuestions: async (description) => {
102
- const modelId = 'gemini-2.5-flash';
103
- const input = `[MODE 1: QUESTIONS]\nAnalyze this game idea: "${description}".\nGenerate 3 crucial technical questions to clarify scope. Output ONLY raw JSON array.`;
 
104
 
105
  try {
106
  const response = await genAI.models.generateContent({
@@ -117,17 +119,18 @@ export const AIEngine = {
117
  } catch (e) {
118
  console.error("Analyst Error:", e);
119
  // Fallback to prevent frontend crash
120
- return [{ id: "fallback", label: "Please describe the core gameplay loop in detail.", type: "textarea" }];
121
  }
122
  },
123
 
124
  /**
125
- * 4. PROJECT GRADER (Feasibility Check)
126
  * Returns STRICT JSON
127
  */
128
  gradeProject: async (description, answers) => {
129
- const modelId = 'gemini-2.5-flash';
130
- const input = `[MODE 2: GRADING]\nIdea: "${description}"\nUser Answers: ${JSON.stringify(answers)}\n\nAssess feasibility for an AI Builder. Output ONLY raw JSON.`;
 
131
 
132
  try {
133
  const response = await genAI.models.generateContent({
@@ -141,7 +144,7 @@ export const AIEngine = {
141
  return JSON.parse(response.text);
142
  } catch (e) {
143
  console.error("Grading Error:", e);
144
- return { feasibility: 80, rating: "B", summary: "Standard project structure detected." };
145
  }
146
  },
147
 
 
95
  },
96
 
97
  /**
98
+ * 3. ONBOARDING ANALYST (Question Generation + Gatekeeping)
99
+ * Returns STRICT JSON for the Frontend.
100
+ * Can return { status: "REJECTED", ... } or { status: "ACCEPTED", questions: ... }
101
  */
102
  generateEntryQuestions: async (description) => {
103
+ const modelId = 'gemini-2.5-pro';
104
+ // Updated prompt to enforce Gatekeeping (TOS/Nonsense check)
105
+ const input = `[MODE 1: QUESTIONS]\nAnalyze this game idea: "${description}". Check for TOS violations or nonsense. If good, ask 3 questions. Output ONLY raw JSON.`;
106
 
107
  try {
108
  const response = await genAI.models.generateContent({
 
119
  } catch (e) {
120
  console.error("Analyst Error:", e);
121
  // Fallback to prevent frontend crash
122
+ return { status: "ACCEPTED", questions: [{ id: "fallback", label: "Please describe the core gameplay loop in detail.", type: "textarea" }] };
123
  }
124
  },
125
 
126
  /**
127
+ * 4. PROJECT GRADER (Feasibility Check + Title)
128
  * Returns STRICT JSON
129
  */
130
  gradeProject: async (description, answers) => {
131
+ const modelId = 'gemini-2.5-pro';
132
+ // Updated prompt to ask for Title and Rating
133
+ const input = `[MODE 2: GRADING]\nIdea: "${description}"\nUser Answers: ${JSON.stringify(answers)}\n\nAssess feasibility. Output JSON with title and rating.`;
134
 
135
  try {
136
  const response = await genAI.models.generateContent({
 
144
  return JSON.parse(response.text);
145
  } catch (e) {
146
  console.error("Grading Error:", e);
147
+ return { feasibility: 80, rating: "B", title: "Untitled Project", summary: "Standard project structure detected." };
148
  }
149
  },
150