Spaces:
Sleeping
Sleeping
wip
Browse files- pnpm-lock.yaml +0 -0
- src/app/api/text/question/route.ts +3 -3
- src/components/defense/Defense.tsx +10 -9
pnpm-lock.yaml
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
src/app/api/text/question/route.ts
CHANGED
|
@@ -22,7 +22,7 @@ export async function POST(request: Request) {
|
|
| 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 :
|
|
@@ -38,7 +38,7 @@ export async function POST(request: Request) {
|
|
| 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
|
| 42 |
ANSWER WITH ONLY THE JSON
|
| 43 |
DO NOT ADD WORDS THAT HAVE ALREADY BEEN SENT
|
| 44 |
Here is the context of the case :
|
|
@@ -54,7 +54,7 @@ export async function POST(request: Request) {
|
|
| 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 |
-
|
| 58 |
RESPONDA SÓLO CON EL JSON
|
| 59 |
NO AÑADAS PALABRAS QUE YA HAYAN SIDO ENVIADAS
|
| 60 |
Aquí está el contexto del caso :
|
|
|
|
| 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. Ces mots doivent être simple, drole, reliés a l'affaire ou des mots ou expressions embarassantes pour un statut d'avocat (ex: "euuuh, et voila quoi..").
|
| 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 :
|
|
|
|
| 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 for the lawyer to add to his speech. These words should be simple, funny, related to the case or embarrassing words or phrases for a lawyer (e.g. “uh huh, here goes nothing”).
|
| 42 |
ANSWER WITH ONLY THE JSON
|
| 43 |
DO NOT ADD WORDS THAT HAVE ALREADY BEEN SENT
|
| 44 |
Here is the context of the case :
|
|
|
|
| 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 |
+
También puedes dar 3 palabras aleatorias *pero reales* para que el abogado las añada a su discurso. Estas palabras deben ser sencillas, divertidas, relacionadas con el caso o palabras o frases embarazosas para un abogado (por ejemplo, «uh huh, aquí vamos..»).
|
| 58 |
RESPONDA SÓLO CON EL JSON
|
| 59 |
NO AÑADAS PALABRAS QUE YA HAYAN SIDO ENVIADAS
|
| 60 |
Aquí está el contexto del caso :
|
src/components/defense/Defense.tsx
CHANGED
|
@@ -86,19 +86,20 @@ const DefenseScene: FC<DefenseSceneProps> = ({
|
|
| 86 |
// eslint-disable-next-line react-hooks/exhaustive-deps
|
| 87 |
}, []); // Suppression de la dépendance answer
|
| 88 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 89 |
// Génère les positions pour les mots requis
|
| 90 |
const generateWordPositions = (words: string[]) => {
|
| 91 |
-
let currentPosition =
|
| 92 |
-
return words.map(
|
| 93 |
-
const
|
| 94 |
-
currentPosition +=
|
| 95 |
-
// Pour le dernier mot, assurons-nous qu'il n'est pas trop loin
|
| 96 |
-
if (index === words.length - 1) {
|
| 97 |
-
currentPosition = Math.min(currentPosition, 20); // Maximum 20 mots
|
| 98 |
-
}
|
| 99 |
return {
|
| 100 |
word,
|
| 101 |
-
position
|
| 102 |
};
|
| 103 |
});
|
| 104 |
};
|
|
|
|
| 86 |
// eslint-disable-next-line react-hooks/exhaustive-deps
|
| 87 |
}, []); // Suppression de la dépendance answer
|
| 88 |
|
| 89 |
+
// Génère un nombre aléatoire entre 9 et 15
|
| 90 |
+
const generateRandomNumber = () => {
|
| 91 |
+
return Math.floor(Math.random() * (15 - 9 + 1)) + 9;
|
| 92 |
+
};
|
| 93 |
+
|
| 94 |
// Génère les positions pour les mots requis
|
| 95 |
const generateWordPositions = (words: string[]) => {
|
| 96 |
+
let currentPosition = generateRandomNumber(); // On commence à une position aléatoire
|
| 97 |
+
return words.map(word => {
|
| 98 |
+
const position = currentPosition;
|
| 99 |
+
currentPosition += generateRandomNumber(); // Ajoute un nombre aléatoire de mots pour le prochain mot requis
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
return {
|
| 101 |
word,
|
| 102 |
+
position
|
| 103 |
};
|
| 104 |
});
|
| 105 |
};
|