fix: skip content check when bank questions available, early generator return
This commit is contained in:
@@ -22,6 +22,14 @@ export const questionGeneratorNode = async (
|
||||
targetCount: limitCount,
|
||||
});
|
||||
|
||||
const existingQuestions = state.questions || [];
|
||||
|
||||
// Early return if enough questions from bank (no LLM call needed)
|
||||
if (existingQuestions.length >= limitCount) {
|
||||
console.log('[GeneratorNode] Skipping generation - enough questions from bank:', existingQuestions.length);
|
||||
return { questions: existingQuestions };
|
||||
}
|
||||
|
||||
if (!model || !knowledgeBaseContent) {
|
||||
console.error('[GeneratorNode] Missing model or knowledgeBaseContent');
|
||||
throw new Error(
|
||||
@@ -78,13 +86,6 @@ export const questionGeneratorNode = async (
|
||||
.map((r, i) => `${i + 1}. ${r}`)
|
||||
.join('\n');
|
||||
|
||||
const existingQuestions = state.questions || [];
|
||||
|
||||
if (existingQuestions.length >= limitCount) {
|
||||
console.log('[GeneratorNode] Skipping generation - enough questions from bank:', existingQuestions.length);
|
||||
return { questions: existingQuestions };
|
||||
}
|
||||
|
||||
const existingQuestionsText = existingQuestions
|
||||
.map((q, i) => `Q${i + 1}: ${q.questionText}`)
|
||||
.join('\n');
|
||||
|
||||
Reference in New Issue
Block a user