Spaces:
Sleeping
Sleeping
minor changes
Browse files- src/app/api/text/question/route.ts +36 -33
- src/app/api/text/story/route.ts +18 -10
- src/app/page.tsx +4 -6
- src/components/accusation/Accusation.tsx +2 -15
- src/components/intro/Intro.tsx +0 -1
src/app/api/text/question/route.ts
CHANGED
|
@@ -20,49 +20,52 @@ export async function POST(request: Request) {
|
|
| 20 |
.join('\n');
|
| 21 |
|
| 22 |
const prompts = {
|
| 23 |
-
fr: `
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
|
|
|
| 34 |
{
|
| 35 |
-
"question": "
|
| 36 |
-
"words": ["expression1", "expression2", "expression3"]
|
| 37 |
}`,
|
| 38 |
-
en: `
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
${chat.messages.length > 0 ? `
|
| 44 |
-
|
| 45 |
-
Also generate a list of 3 absurd words or expressions that the lawyer must use in their response.
|
| 46 |
-
These expressions should be quirky and put the lawyer in an awkward position but be relatively realistic to the case.
|
| 47 |
|
| 48 |
Answer in JSON with this format:
|
| 49 |
{
|
| 50 |
"question": "Your incisive judge question here",
|
| 51 |
"words": ["expression1", "expression2", "expression3"]
|
| 52 |
}`,
|
| 53 |
-
es:
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
|
|
|
| 64 |
{
|
| 65 |
-
"question": "Tu pregunta
|
| 66 |
"words": ["expresión1", "expresión2", "expresión3"]
|
| 67 |
}`
|
| 68 |
};
|
|
|
|
| 20 |
.join('\n');
|
| 21 |
|
| 22 |
const prompts = {
|
| 23 |
+
fr: `Pouvez-vous trouver 1 question amusante pour réfuter les alibis que le juge pourrait poser à l'avocat de l'accusé dans cette affaire ?
|
| 24 |
+
(ne demandez pas de dessiner ou de faire des gestes, seulement des réponses textuelles)
|
| 25 |
+
Pouvez-vous aussi donner 3 mots aléatoires *mais réels* que l'avocat devra ajouter à son discours.
|
| 26 |
+
RÉPONDEZ UNIQUEMENT AVEC LE JSON
|
| 27 |
+
N'AJOUTEZ PAS DE MOTS QUI ONT DÉJÀ ÉTÉ ENVOYÉS
|
| 28 |
+
Voici le contexte de l'affaire :
|
| 29 |
+
|
| 30 |
+
description de l'histoire : ${story.description}
|
| 31 |
+
alibis : ${story.alibi.join(', ')}
|
| 32 |
+
${chat.messages.length > 0 ? `historique de la discussion : ${chatHistory}` : ''}
|
| 33 |
+
|
| 34 |
+
Réponse en JSON avec ce format :
|
| 35 |
{
|
| 36 |
+
"question" : " Votre question incisive de juge ici ",
|
| 37 |
+
"words" : [" expression1 ", " expression2 ", " expression3 "].
|
| 38 |
}`,
|
| 39 |
+
en: `can you find 1 fun questions to refute the alibis the judge could ask the lawyer of the accused about this case ?
|
| 40 |
+
(do not ask to draw or to gesture, only text answers)
|
| 41 |
+
Can you also give 3 random *but real* words that the lawyer will have to add to his speech.
|
| 42 |
+
ANSWER WITH ONLY THE JSON
|
| 43 |
+
DO NOT ADD WORDS THAT HAVE ALREADY BEEN SENT
|
| 44 |
+
Here is the context of the case :
|
| 45 |
|
| 46 |
+
story description: ${story.description}
|
| 47 |
+
alibis: ${story.alibi.join(', ')}
|
| 48 |
+
${chat.messages.length > 0 ? `discussion history: ${chatHistory}` : ''}
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
Answer in JSON with this format:
|
| 51 |
{
|
| 52 |
"question": "Your incisive judge question here",
|
| 53 |
"words": ["expression1", "expression2", "expression3"]
|
| 54 |
}`,
|
| 55 |
+
es: `¿puedes encontrar 1 preguntas divertidas para refutar las coartadas que el juez podría hacer al abogado del acusado sobre este caso?
|
| 56 |
+
(no pidas dibujar o gesticular, sólo respuestas de texto)
|
| 57 |
+
¿Puedes también dar 3 palabras aleatorias *pero reales* que el abogado tendrá que añadir a su discurso?
|
| 58 |
+
RESPONDA SÓLO CON EL JSON
|
| 59 |
+
NO AÑADAS PALABRAS QUE YA HAYAN SIDO ENVIADAS
|
| 60 |
+
Aquí está el contexto del caso :
|
| 61 |
+
|
| 62 |
+
descripción de la historia: ${story.description}
|
| 63 |
+
coartadas: ${story.alibi.join(', ')}
|
| 64 |
+
${chat.messages.length > 0 ? `historia de la discusión: ${chatHistory}` : ''}
|
| 65 |
+
|
| 66 |
+
Respuesta en JSON con este formato:
|
| 67 |
{
|
| 68 |
+
"question": "Tu incisiva pregunta de juez aquí",
|
| 69 |
"words": ["expresión1", "expresión2", "expresión3"]
|
| 70 |
}`
|
| 71 |
};
|
src/app/api/text/story/route.ts
CHANGED
|
@@ -18,22 +18,30 @@ export async function POST(request: Request) {
|
|
| 18 |
console.log('language:', language)
|
| 19 |
|
| 20 |
const prompts = {
|
| 21 |
-
fr: `
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
};
|
| 31 |
|
| 32 |
const chatPrompt = `${prompts[language as keyof typeof prompts] || prompts.fr}
|
| 33 |
accusation: {
|
| 34 |
description: String,
|
| 35 |
alibi: [<String>],
|
| 36 |
-
problematic: [<String>],
|
| 37 |
}`;
|
| 38 |
|
| 39 |
console.log('chatPrompt:', chatPrompt)
|
|
|
|
| 18 |
console.log('language:', language)
|
| 19 |
|
| 20 |
const prompts = {
|
| 21 |
+
fr: `Vous êtes passé maître dans l'art de générer de fausses histoires de procès.
|
| 22 |
+
Choisissez un mot réel totalement aléatoire et générez une fausse histoire, intégrant ce mot, d'un homme nommé Daniel accusé dans un procès.
|
| 23 |
+
L'histoire doit être cohérente et tenir en 1 ou 2 phrases.
|
| 24 |
+
Pouvez-vous donner la réponse dans un format json ?
|
| 25 |
+
Trouvez 3 alibis. Ils doivent être crédibles et concis.
|
| 26 |
+
RÉPONDRE UNIQUEMENT AVEC LE JSON`,
|
| 27 |
+
en: `You're a master in generating fake trial stories.
|
| 28 |
+
Choose a completly random real word and generate a fake story, integrating this word, of a guy named Daniel accused in trail.
|
| 29 |
+
The story must be coherent and must fit into 1 or 2 sentences.
|
| 30 |
+
Can you give the answer in a json format?
|
| 31 |
+
Find 3 alibis. They must be credible and concise.
|
| 32 |
+
ANSWER WITH ONLY THE JSON`,
|
| 33 |
+
es: `Eres un maestro en generar historias falsas de juicios.
|
| 34 |
+
Elige una palabra real completamente aleatoria y genera una historia falsa, integrando esta palabra, de un tipo llamado Daniel acusado en juicio.
|
| 35 |
+
La historia debe ser coherente y debe caber en 1 o 2 frases.
|
| 36 |
+
¿Puedes dar la respuesta en formato json?
|
| 37 |
+
Encuentra 3 coartadas. Deben ser creíbles y concisas.
|
| 38 |
+
RESPONDER SÓLO CON EL JSON`
|
| 39 |
};
|
| 40 |
|
| 41 |
const chatPrompt = `${prompts[language as keyof typeof prompts] || prompts.fr}
|
| 42 |
accusation: {
|
| 43 |
description: String,
|
| 44 |
alibi: [<String>],
|
|
|
|
| 45 |
}`;
|
| 46 |
|
| 47 |
console.log('chatPrompt:', chatPrompt)
|
src/app/page.tsx
CHANGED
|
@@ -17,7 +17,6 @@ interface Story {
|
|
| 17 |
accusation: {
|
| 18 |
description: string;
|
| 19 |
alibi: string[];
|
| 20 |
-
problematic: string[];
|
| 21 |
};
|
| 22 |
}
|
| 23 |
|
|
@@ -34,17 +33,17 @@ interface Chat {
|
|
| 34 |
const intro = {
|
| 35 |
fr: {
|
| 36 |
title: "L'Avocat de l'IA",
|
| 37 |
-
description:
|
| 38 |
start: "Commencer"
|
| 39 |
},
|
| 40 |
en: {
|
| 41 |
-
title: "The AI Lawyer",
|
| 42 |
-
description:
|
| 43 |
start: "Start"
|
| 44 |
},
|
| 45 |
es: {
|
| 46 |
title: "El Abogado de la IA",
|
| 47 |
-
description:
|
| 48 |
start: "Empezar"
|
| 49 |
}
|
| 50 |
}
|
|
@@ -132,7 +131,6 @@ export default function Home() {
|
|
| 132 |
accusation: {
|
| 133 |
description: data.story.description,
|
| 134 |
alibi: data.story.alibi,
|
| 135 |
-
problematic: data.story.problematic,
|
| 136 |
}
|
| 137 |
});
|
| 138 |
}
|
|
|
|
| 17 |
accusation: {
|
| 18 |
description: string;
|
| 19 |
alibi: string[];
|
|
|
|
| 20 |
};
|
| 21 |
}
|
| 22 |
|
|
|
|
| 33 |
const intro = {
|
| 34 |
fr: {
|
| 35 |
title: "L'Avocat de l'IA",
|
| 36 |
+
description: `Daniel est un homme ordinaire. Il n'a rien fait de mal.\nPourtant, il est convoqué au tribunal aujourd'hui. Pauvre Daniel...`,
|
| 37 |
start: "Commencer"
|
| 38 |
},
|
| 39 |
en: {
|
| 40 |
+
title: "The AI Lawyer",
|
| 41 |
+
description: `Daniel is an ordinary guy. He hasn't done anything wrong.\nYet he's been summoned to court today. Poor Daniel...`,
|
| 42 |
start: "Start"
|
| 43 |
},
|
| 44 |
es: {
|
| 45 |
title: "El Abogado de la IA",
|
| 46 |
+
description: `Daniel es un tipo corriente. No ha hecho nada malo.\nSin embargo, ha sido convocado a la corte hoy. Pobre Daniel...`,
|
| 47 |
start: "Empezar"
|
| 48 |
}
|
| 49 |
}
|
|
|
|
| 131 |
accusation: {
|
| 132 |
description: data.story.description,
|
| 133 |
alibi: data.story.alibi,
|
|
|
|
| 134 |
}
|
| 135 |
});
|
| 136 |
}
|
src/components/accusation/Accusation.tsx
CHANGED
|
@@ -6,7 +6,6 @@ interface Story {
|
|
| 6 |
accusation: {
|
| 7 |
description: string;
|
| 8 |
alibi: string[];
|
| 9 |
-
problematic: string[];
|
| 10 |
};
|
| 11 |
}
|
| 12 |
|
|
@@ -39,7 +38,7 @@ const AccusationScene: FC<AccusationSceneProps> = ({
|
|
| 39 |
<div className="max-w-3xl w-full space-y-8">
|
| 40 |
{/* Description */}
|
| 41 |
<div>
|
| 42 |
-
<h2 className="text-
|
| 43 |
{language === 'fr' ? "Chef d'accusation" : language === 'en' ? 'Accusation' : 'Acusación'}
|
| 44 |
</h2>
|
| 45 |
<p className="text-xl text-white roboto-slab">
|
|
@@ -49,7 +48,7 @@ const AccusationScene: FC<AccusationSceneProps> = ({
|
|
| 49 |
|
| 50 |
{/* Alibis */}
|
| 51 |
<div>
|
| 52 |
-
<h2 className="text-
|
| 53 |
{language === 'fr' ? 'Alibis' : language === 'en' ? 'Alibis' : 'Coartadas'}
|
| 54 |
</h2>
|
| 55 |
<ul className="list-disc list-inside text-white space-y-2 roboto-slab">
|
|
@@ -58,18 +57,6 @@ const AccusationScene: FC<AccusationSceneProps> = ({
|
|
| 58 |
))}
|
| 59 |
</ul>
|
| 60 |
</div>
|
| 61 |
-
|
| 62 |
-
{/* Points problématiques */}
|
| 63 |
-
<div>
|
| 64 |
-
<h2 className="text-2xl font-bold text-white mb-4 roboto-slab">
|
| 65 |
-
{language === 'fr' ? 'Points problématiques' : language === 'en' ? 'Problematic points' : 'Puntos problemáticos'}
|
| 66 |
-
</h2>
|
| 67 |
-
<ul className="list-disc list-inside text-white space-y-2 roboto-slab">
|
| 68 |
-
{story?.accusation.problematic.map((point, index) => (
|
| 69 |
-
<li key={index} className="text-xl">{point}</li>
|
| 70 |
-
))}
|
| 71 |
-
</ul>
|
| 72 |
-
</div>
|
| 73 |
</div>
|
| 74 |
|
| 75 |
<button
|
|
|
|
| 6 |
accusation: {
|
| 7 |
description: string;
|
| 8 |
alibi: string[];
|
|
|
|
| 9 |
};
|
| 10 |
}
|
| 11 |
|
|
|
|
| 38 |
<div className="max-w-3xl w-full space-y-8">
|
| 39 |
{/* Description */}
|
| 40 |
<div>
|
| 41 |
+
<h2 className="text-4xl font-bold text-white mb-4 roboto-slab">
|
| 42 |
{language === 'fr' ? "Chef d'accusation" : language === 'en' ? 'Accusation' : 'Acusación'}
|
| 43 |
</h2>
|
| 44 |
<p className="text-xl text-white roboto-slab">
|
|
|
|
| 48 |
|
| 49 |
{/* Alibis */}
|
| 50 |
<div>
|
| 51 |
+
<h2 className="text-4xl font-bold text-white mb-4 roboto-slab">
|
| 52 |
{language === 'fr' ? 'Alibis' : language === 'en' ? 'Alibis' : 'Coartadas'}
|
| 53 |
</h2>
|
| 54 |
<ul className="list-disc list-inside text-white space-y-2 roboto-slab">
|
|
|
|
| 57 |
))}
|
| 58 |
</ul>
|
| 59 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
</div>
|
| 61 |
|
| 62 |
<button
|
src/components/intro/Intro.tsx
CHANGED
|
@@ -7,7 +7,6 @@ interface Story {
|
|
| 7 |
accusation: {
|
| 8 |
description: string;
|
| 9 |
alibi: string[];
|
| 10 |
-
problematic: string[];
|
| 11 |
};
|
| 12 |
}
|
| 13 |
|
|
|
|
| 7 |
accusation: {
|
| 8 |
description: string;
|
| 9 |
alibi: string[];
|
|
|
|
| 10 |
};
|
| 11 |
}
|
| 12 |
|