This commit is contained in:
Jamie Brunton committed 2025-12-30 18:52:10 +00:00
1 parent 25ab750c7d
commit 5dec79838e
4 files changed
+14 -5

No files matched your search

@@ -26,6 +26,7 @@ interface AiGeneratorDialogProps {
packDescription?: string | null;
existingCategories?: string[];
existingPacks?: string[];
existingQuestions?: string[];
isExplicit?: boolean;
};
onGenerated: (result: any) => void;
@@ -71,7 +72,7 @@ export function AiGeneratorDialog({
toast.error('Pack name is required');
return;
}
const result = await generateQuestions(context.packName, count, undefined, tone, context.packDescription || undefined);
const result = await generateQuestions(context.packName, count, undefined, tone, context.packDescription || undefined, context.existingQuestions);
setGeneratedQuestions(result);
// Select all questions by default
setSelectedQuestionIndices(new Set(result.map((_, i) => i)));
@@ -1,5 +1,5 @@
import { useState, useRef, useEffect } from 'react';
import data from '@emoji-mart/data';
import * as data from '@emoji-mart/data';
import Picker from '@emoji-mart/react';
import { Button } from './button';
+10 -2
View File
@@ -194,7 +194,8 @@ export async function generateQuestions(
count: number = 10,
intensity?: number,
tone: ToneLevel = 3,
packDescription?: string
packDescription?: string,
existingQuestions?: string[]
): Promise<GeneratedQuestion[]> {
const openai = getOpenAI();
const isClean = tone === 0;
@@ -246,7 +247,14 @@ export async function generateQuestions(
? `\nPack Description: "${packDescription}"\nUse this description to guide the theme and style of questions.`
: '';
const prompt = `Generate ${count} unique questions for a couples' intimacy question pack called "${packName}".${descriptionContext}
const existingQuestionsContext = existingQuestions && existingQuestions.length > 0
? `\n\nEXISTING QUESTIONS IN THIS PACK (DO NOT DUPLICATE OR CREATE SIMILAR VARIATIONS):
${existingQuestions.map((q, i) => `${i + 1}. ${q}`).join('\n')}
CRITICAL: Generate completely NEW and DIFFERENT questions. Do not repeat any of the above questions or create minor variations of them. Each new question must offer a genuinely distinct activity or experience.`
: '';
const prompt = `Generate ${count} unique questions for a couples' intimacy question pack called "${packName}".${descriptionContext}${existingQuestionsContext}
${INTENSITY_GUIDE_SHORT}
@@ -440,7 +440,7 @@ export function QuestionsPage() {
open={aiDialogOpen}
onOpenChange={setAiDialogOpen}
type="questions"
context={{ packName: pack?.name, packDescription: pack?.description, isExplicit: pack?.is_explicit }}
context={{ packName: pack?.name, packDescription: pack?.description, isExplicit: pack?.is_explicit, existingQuestions: questions.map(q => q.text) }}
onGenerated={handleAiGenerated}
/>