enzostvs HF staff commited on
Commit
1e9a0af
·
1 Parent(s): d7b1e3e

rework generations + db

Browse files
app/api/[questId]/score/route.ts CHANGED
@@ -7,12 +7,6 @@ export async function POST(request: NextRequest, { params }: { params: { questId
7
  const { questId } = params;
8
  const { promptId } = await request.json()
9
 
10
- if (!promptId) {
11
- return Response.json({
12
- message: "promptId is required",
13
- }, { statusText: "Missing body fields", status: 404 });
14
- }
15
-
16
  const quest = await prisma.quest.findUnique({
17
  where: {
18
  id: questId
@@ -32,7 +26,7 @@ export async function POST(request: NextRequest, { params }: { params: { questId
32
  }
33
  })
34
 
35
- if (quest.prompt_id_correct !== promptId) {
36
  return Response.json({
37
  ok: false,
38
  resultId: quest.prompt_id_correct,
 
7
  const { questId } = params;
8
  const { promptId } = await request.json()
9
 
 
 
 
 
 
 
10
  const quest = await prisma.quest.findUnique({
11
  where: {
12
  id: questId
 
26
  }
27
  })
28
 
29
+ if (quest?.prompt_id_correct !== promptId) {
30
  return Response.json({
31
  ok: false,
32
  resultId: quest.prompt_id_correct,
app/api/bulk-create/data.json CHANGED
@@ -1,50 +1,282 @@
1
  [
2
- "Design a space exploration concept with futuristic spacecraft, alien planets, and breathtaking cosmic landscapes.",
3
- "2d animation, Show a medium shot of the wolf, with a mischievous glint in his eyes. His mouth is slightly open, revealing his sharp teeth. He is standing among the tall grass, scanning the area for potential prey.]unreal engine, hyper real --q 2 --v 5.2 --ar 16:9",
4
- "Design an otherworldly alien creature with bioluminescent features, multiple appendages, and intricate patterns that evoke a sense of wonder and curiosity.",
5
- "Design a futuristic cityscape with towering skyscrapers, flying cars, and advanced technology integrated into the urban environment.",
6
- "Design a steampunk-inspired setting with intricate machinery, Victorian architecture, and airships soaring through the sky.",
7
- "a mecha robot, pixel pfp, random collor, cyberpunk, synthwave, ornate, intricate, digital painting, concept art, smooth, sharp focus, illustration, black background, art by artgerm and greg rutkowski and alphonse mucha, 8 k",
8
- "a cyberpunk ice cream truck, black velvet painting, artwork by Greg Rutkowski, John Berkey, Alexander Jansson, Kuvshinov, WLOP, Artgerm, trending on ArtStationHD. octane render, greg rutkowski, hyper realism, high detail, octane render, vervia, 8k",
9
- "a beautiful painting of in the silent, starlit nights, beautiful flower, girl, by greg rutkowski, trending on artstation",
10
- "a masterpiece ultrarealistic ultradetailed portrait of a incredibly beautiful 0 0 s blonde bimbo in pink clothes. baroque renaissance. medium shot, intricate, elegant, highly detailed. trending on artstation, digital art, by stanley artgerm lau, wlop, rossdraws, james jean, andrei riabovitchev, marc simonetti, yoshitaka amano. background by james jean and gustav klimt, light by julie bell, 4 k, porcelain skin.",
11
- "Masculine face made of multicolored bubbles, motion blur, blur, bokeh, Affinity Photo, trending on Artstation, award-winning, art by Studio Ghibli, by Lisa Frank",
12
- "rubik's cube transformer, tristan eaton, victo ngai, artgerm, rhads, ross draws",
13
- "a fat ugly man, in the style of artgerm, gerald brom, atey ghailan and mike mignola, vibrant colors and hard shadows and strong rim light, plain background, comic cover art, trending on artstation",
14
- "half joe biden half reptiloid, ultra realistic, concept art, intricate details, eerie, highly detailed, photorealistic, octane render, 8 k, unreal engine. art by artgerm and greg rutkowski and alphonse mucha",
15
- "an illustration of a house with large barn with many cute flower pots and beautiful blue sky scenery. earth golem standing in yard, cinematic view, epic sky, detailed, concept art, low angle, high detail, warm lighting, volumetric, godrays, vivid, beautiful, trending on artstation, by jordan grimmer, huge scene, grass, art greg rutkowski",
16
- "A beautiful digital painting of a sexy female anubis, holding a sword, the moon behind her, intricate, cinematic lighting, highly detailed, digital painting, Artstation, concept art, smooth, sharp focus, illustration, art by Tom Bagshaw, Artgerm and Greg Rutkowski",
17
- "worm's eye view of overwatch headquarters carved inside a mountain surrounding a lush well kept garden, magical, natural light, fantasy, sharp focus, concept art, by greg rutkowski and craig mullins, cozy atmospheric",
18
- "a portrait of a beautiful willa holland as a 1 9 5 0 s rockabilly greaser, art by lois van baarle and loish and ross tran and rossdraws and sam yang and samdoesarts and artgerm, digital art, highly detailed, intricate, sharp focus, trending on artstation hq, deviantart, unreal engine 5, 4 k uhd image",
19
- "mariano rajoy with cyberpunk implants, deep focus, d & d, fantasy, intricate, elegant, highly detailed, digital painting, artstation, concept art, matte, sharp focus, illustration, hearthstone, art by artgerm and greg rutkowski and alphonse mucha",
20
- "dwayne johnson holding a purple lightsaber wearing brown jedi robes, concept art, ultra realistic",
21
- "panoramic view, a pilot girl, soldier clothing, battlefield in background, anime style, hair down, symmetrical facial features, realistic hands, from arknights, hyper realistic, 4 k, extreme detail, 1 0 1 st airborne, trending artstation, safebooru, realistic lighting, by alphonse mucha, greg rutkowski, sharp focus",
22
- "danny devito riding a large harley davidson, hyperrealism, lens glare, trending on artstation, intricate, 8 k",
23
- "a girl with short blue hair and blue eyes is sitting on a cloud, anime style, light effect, anime style hyper detailed, illustration, bloody, intricate, elegant, digital painting, artstation, smooth, sharp focus, art by artgerm and greg rutkowski and alphonse mucha.",
24
- "totem aztek tribal deepdream intricate, elegant, sharp focus, illustration, highly detailed, digital painting, concept art, matte, art by WLOP and Artgerm and Greg Rutkowski and Alphonse Mucha, masterpiece",
25
- "painting of dark muscular oiled indian woman back, ultra realistic, concept art, intricate details, eerie, highly detailed, photorealistic, octane render, 8 k, unreal engine. art by artgerm and greg rutkowski and alphonse mucha",
26
- "ultra realistic illustration of taco cat, intricate, elegant, highly detailed, digital painting, artstation, concept art, smooth, sharp focus, illustration, art by artgerm and greg rutkowski and alphonse mucha",
27
- "kyoto animation girl wearing cyberpunk intricate streetwear riding dirt bike, respirator, detailed portrait, cell shaded, 4 k, concept art, by wlop, ilya kuvshinov, artgerm, krenz cushart, greg rutkowski, pixiv. cinematic dramatic atmosphere, sharp focus, volumetric lighting, cinematic lighting, studio quality",
28
- "office secretary anime, d & d, fantasy, portrait, highly detailed, headshot, digital painting, trending on artstation, concept art, sharp focus, illustration, art by artgerm and greg rutkowski and magali villeneuve",
29
- "beautiful, young woman, cybernetic, cyberpunk, detailed gorgeous face, flowing hair, vaporwave aesthetic, synthwave , digital painting, artstation, concept art, smooth, sharp focus, illustration, art by artgerm and greg rutkowski and alphonse mucha",
30
- "isometric chubby 3 d game cannon, with detailed, clean, cartoon, octane render, unreal engine, artgerm, artstation",
31
- "kylie minogue making pancakes, animation pixar style, by pendleton ward, magali villeneuve, artgerm, rob rey and kentaro miura style, golden ratio, trending on art station",
32
- "portrait knights of zodiac girl, golden and copper shining armor, karate pose, in ruined agora of athens sunrise, ssci - fi and fantasy, intricate and very very beautiful and elegant, highly detailed, digital painting, artstation, concept art, smooth and sharp focus, illustration, art by tian zi and wlop and alphonse mucha and z - - ed",
33
- "a gladiator in roman times, intricate, elegant, volumetric lighting, scenery, digital painting, highly detailed, artstation, sharp focus, illustration, concept art,ruan jia, steve mccurry",
34
- "Short, elf, grey skin with a green undertone, orange/red hair, ears are 3 inches long ending at a point, their eyes are like a pale yellow light all iris (no black or white), uhhh they have deer like legs that bend backwards to allow for faster movement, and they are both masc and femme equally so I don�t have to choose a gender dramatic lighting, illustration by Greg rutkowski, yoji shinkawa, 4k, digital art, concept art, trending on artstation",
35
- "young glitchy woman, beautiful girl, vaporwave aesthetic, realistic, serov, surikov, vasnetsov, repin, kramskoi, uplight, insanely detailed, charlie bowater, tom bagshaw, octane rendered, 8 k, unreal engine, illustration, trending on artstation, masterpiece",
36
- "painting of the figure of a pin up girl posing, high contrast, poster, clothes in the fashion of 6 0's, concept art, black and white, dramatic lighting, digital art, 8 k, drawn by arnold armitage",
37
- "hyperdetailed portrait of kristen schaal as delirium of the endless, colourful make up, the sandman, made by caravaggio stanley artgerm lau wlop rossdraws artstation cgsociety concept art cgsociety octane render",
38
- "a melting Roman numeral clock in the style of the painting the persistence of memory by Salvador Dali, dynamic lighting, photorealistic fantasy concept art, trending on art station, stunning visuals, creative, cinematic, ultra detailed",
39
- "portrait of 1 2 yo emma watson at hogwarts, olive skin, long dark hair, beautiful bone structure, shiny gold background, intricate, elegant, highly detailed, digital painting, artstation, concept art, smooth, sharp focus, illustration, artgerm, rutkowski, mucha",
40
- "this human has no soul, cinematic shot, 8 k, art by artgerm and greg rutkowski and alphonse muchav",
41
- "a high contrast painting of a flooded ancient tower at night by ralph mcquarrie simon stalenhag carl spitzweg rene magritte roger dean, full-length view, highly detailed, vibrant colors, extremely high contrast!, symmetry, great composition, high detail, cinematic lighting, award winning masterpiece, trending on artstation",
42
- "3 d goddess of death close - up profile portrait with ram skull. beautiful intricately detailed japanese crow kitsune mask and clasical japanese kimono. betta fish, jellyfish phoenix, bio luminescent, plasma, ice, water, wind, creature, artwork by tooth wu and wlop and beeple and greg rutkowski",
43
- "painting of hybrid between butterfly!!!!!!!! & dragon, intercrossed animal, mixture animal, by tiffany bozic, by zdzislaw beksinski, biomorphic, cold hue's, warm tone gradient background, concept art, beautiful composition, digital painting",
44
- "the beautiful scene render that a beautiful girl lies in the arms of a huge white dragon in the fairyland surrounded by white clouds, in the style of makoto shinkai victo ngai and peter mohrbacher studio ghibli artgerm karol bak beeple, animation style, 8 k hd, dream, trending on cgsociety, trending on artstation, ultra wide angle, animation style, hyperrealism, 3 d render, hyper detailed",
45
- "a police car driving through shallow water, flooded city, raining, people walking through shallow water, muted colors, hyperrealistic, oil painting, intricate, cgsociety, artstation, 8 k, cinematic, soft lighting, by greg rutkowski, by wlop, by artgerm",
46
- "fullbody!! dynamic movement pose, beautiful ethnic woman with flowing hair, big natural horns on her head, gold jewellery, dnd, face, fantasy, intricate, elegant, highly detailed, digital painting, artstation, concept art, smooth, sharp focus, illustration, art by artgerm and greg rutkowski and alphonse mucha",
47
- "close up of hyper - realistic spongebob, photorealistic, mesmerizing, fantastical, concept art, highly detailed, artstation, trending, feng zhu, shaddy safadi, noah bradley, tyler edlin, jordan grimmer, darek zabrocki, neil blevins, tuomas korpi",
48
- "marisol pepa flores, face portrait, elegant, fantasy, hd shot, digital portrait, beautiful, artstation, comic style, by artgerm, guy denning, jakub rozalski, magali villeneuve and charlie bowater",
49
- "modern city, Parisian buildings, billboards, advertisements, small buildings, dark, matte painting, concept art, digital painting, style of Ian Hubert, warm lighting, futuristic, volumetric lighting, street view, daytime, godrays , high detail, no sky scrapers"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  ]
 
1
  [
2
+ [
3
+ "A mystical planet with lush forests and glowing mushrooms, inspired by anime and manga.",
4
+ "A dystopian planet with towering skyscrapers and neon lights, evoking a cyberpunk atmosphere.",
5
+ "A colorful planet with playful creatures and whimsical architecture, reminiscent of a Pixar animated movie."
6
+ ],
7
+ [
8
+ "A futuristic cityscape with sleek skyscrapers and neon lights, evoking a sense of excitement and innovation.",
9
+ "A bustling metropolis with diverse architecture, vibrant street art, and lush green spaces, capturing the energy and diversity of city life.",
10
+ "A dystopian cityscape with crumbling buildings, overgrown vegetation, and a sense of decay, suggesting a world that has been abandoned or lost its way."
11
+ ],
12
+ [
13
+ "A sleek, futuristic robot standing in a neon-lit cityscape, with a hint of cyberpunk influence in the design.",
14
+ "An adorable, pastel-colored robot with a playful expression, surrounded by cute, cartoon-style buttons and gizmos.",
15
+ "A hulking, industrial robot with a menacing red eye, standing in a dark, dystopian factory surrounded by smoke and machinery."
16
+ ],
17
+ [
18
+ "A sleek, futuristic car with glowing neon lights and a reflective black body, speeding down a dark city street. (Cyberpunk)",
19
+ "A cute, little red car with white stripes and a smiling face, driving through a picturesque countryside landscape. (Kawaii)",
20
+ "A rugged, off-road car with a lift kit and a bold, camouflage paint job, traversing a rocky desert terrain. (Tough)"
21
+ ],
22
+ [
23
+ "A powerful sorceress with a menacing grin, surrounded by dark energies and mysterious artifacts, in a dimly lit, ancient castle.",
24
+ "A charming, flamboyant, and seductive villain with a wicked smile, standing in front of a luxurious, golden-lit palace, surrounded by loyal minions.",
25
+ "A twisted, monstrous creature with glowing red eyes, lurking in the shadows of a damp, misty cave, its grotesque appearance inspiring fear and dread."
26
+ ],
27
+ [
28
+ "A cute, 3D CGI dog with a cheerful expression, sitting in front of a colorful, stylized tree in a sunny park.",
29
+ "A dark, gritty, cyberpunk dog with glowing red eyes and a menacing growl, standing in a dystopian alleyway surrounded by neon lights and mist.",
30
+ "An adorable, cartoonish dog with a goofy smile and a superhero cape, standing on a comic book-style city street with a giant, bustling metropolis in the background."
31
+ ],
32
+ [
33
+ "A cute, pastel-colored monster with fluffy fur and big, round eyes, sitting on a pile of candy in a sugary wonderland. (Cute Kawaii, Pastel, Whimsical)",
34
+ "A terrifying, shadowy monster lurking in a dark alley, its eyes glowing red in the darkness. (Horror, Dark, Ominous)",
35
+ "A playful, cartoon-style monster with bold colors and exaggerated features, dancing in a funky, upbeat music video. (Toon, Fun, Energetic)"
36
+ ],
37
+ [
38
+ "A sleek black cat with glowing green eyes, sitting on a moonlit windowsill, surrounded by a futuristic cityscape. (Cyberpunk, 3D rendering)",
39
+ "An adorable, fluffy cat with a cute expression, surrounded by colorful flowers and butterflies, in a whimsical, dreamlike environment. (Cute Kawaii, Digital Art)",
40
+ "A menacing, shadowy cat with glowing red eyes, lurking in a dark alleyway, surrounded by eerie, flickering neon lights. (Horror, Low Poly)"
41
+ ],
42
+ [
43
+ "A majestic, 3D dragon soaring through a mystical, cloudy sky with a regal, gold-plated body and fiery red eyes, surrounded by a glowing aura.",
44
+ "A cute, chibi dragon sitting on a pile of treasure, surrounded by vibrant, colorful sparkles, with a playful, mischievous expression and a tiny, glittering crown.",
45
+ "A dark, ominous dragon looming over a desolate, post-apocalyptic wasteland, with glowing red eyes and a razor-sharp, metallic body that reflects the dim light of the setting sun."
46
+ ],
47
+ [
48
+ "Cyberpunk Spaceship - A sleek black spaceship with glowing neon lights and metallic details, set against a backdrop of a futuristic cityscape at dusk.",
49
+ "Cute Kawaii Spaceship - A tiny, round spaceship with a cheerful, cartoon-style design, surrounded by a swarm of adorable, miniature robots, floating in a vibrant, starry sky.",
50
+ "Dark, Gritty Spaceship - A worn, industrial-looking spaceship with exposed pipes and ductwork, set against a dark, cloudy background, with lightning illuminating the clouds in the distance."
51
+ ],
52
+ [
53
+ "A cozy, warm-lit house in the middle of a snowy forest, with smoke rising from the chimney and a group of animals gathered outside, looking in through the windows. (Warm, inviting, winter wonderland)",
54
+ "A dilapidated, haunted-looking house at the end of a dark alley, with broken shutters and overgrown gardens, a full moon casting eerie shadows on the facade. (Creepy, abandoned, mysterious)",
55
+ "A futuristic, sleek house made of metallic and glass materials, standing alone on a cliff overlooking a dystopian cityscape, with neon lights reflecting off the surface. (High-tech, minimalist, dystopian)"
56
+ ],
57
+ [
58
+ "A Jedi standing on a rocky cliff, looking out at a breathtaking sunset. (Style: Digital Art, Mood: Serene, Colors: Warm orange and yellow, Details: Jedi robes, lightsaber, distant planet)",
59
+ "A Jedi in the midst of a fierce battle with a squad of stormtroopers. (Style: Comic Art, Mood: Intense, Colors: Dark blues and reds, Details: Blaster fire, smoke, explosions)",
60
+ "A Jedi knight standing in a futuristic cityscape, surrounded by towering skyscrapers and sleek technology. (Style: Cyberpunk, Mood: Mysterious, Colors: Neon pink and blue, Details: Lightsaber, holographic displays, cityscape)"
61
+ ],
62
+ [
63
+ "A sleek, modern superhero with a metallic suit and a determined expression, standing on a skyscraper rooftop overlooking the city. (Style: Digital Art, Mood: Dramatic, Colors: Dark blues and silvers)",
64
+ "A playful, cartoonish superhero with a brightly colored costume and a goofy grin, posing in front of a comic book-style city skyline. (Style: Comic Art, Mood: Fun, Colors: Bright primaries)",
65
+ "A gritty, dystopian superhero with a worn leather jacket and a stern expression, standing in a dark alleyway surrounded by graffiti and neon lights. (Style: Cyberpunk, Mood: Dark, Colors: Muted earth tones)"
66
+ ],
67
+ [
68
+ "A majestic eagle soaring through a stormy sky, its feathers glistening with rain droplets, a fierce expression on its face, and a sense of power and freedom in its outstretched wings. (Dramatic, Digital Art)",
69
+ "A playful parakeet perched on a branch, its feathers a vibrant green and blue, a mischievous glint in its eye, and a cheerful demeanor that seems to say, \"I'm up to something!\" (Cute Kawaii, Pencil Sketch)",
70
+ "A flock of starlings taking flight, their iridescent feathers shimmering in the light, a dreamy quality to their movements, and a sense of ethereal wonder in their graceful flight. (Beautiful Portraits, Digital Art)"
71
+ ],
72
+ [
73
+ "Anime Portrait Spiderman ",
74
+ "3D Spiderman swinging at night in the city ",
75
+ "Caricature Spiderman's Funny Moment"
76
+ ],
77
+ [
78
+ "A mystical swamp with ancient trees and misty atmosphere.",
79
+ "A dark and eerie swamp with twisted vegetation and glowing eyes in the darkness.",
80
+ "A colorful swamp with lush vegetation and playful creatures, inspired by a tropical rainforest."
81
+ ],
82
+ [
83
+ "A futuristic metropolis with towering skyscrapers and neon lights, a bustling city that never sleeps.",
84
+ "A charming small town with cobblestone streets and quaint shops, a cozy place to call home.",
85
+ "A deserted ghost town with crumbling buildings and tumbleweeds, a haunting reminder of the past."
86
+ ],
87
+ [
88
+ "A 3D rendered Superman standing on a futuristic city skyline, looking out towards the horizon with a determined expression.",
89
+ "An adorable, chibi Superman sitting on a couch, playing with a rubber ball and sporting a playful grin.",
90
+ "A stylized, cyberpunk Superman standing in front of a glowing computer screen, his suit and hair glowing with electric blue lights."
91
+ ],
92
+ [
93
+ "A lush, vibrant jungle with exotic plants and colorful birds, style inspired by the works of Studio Ghibli.",
94
+ "A mysterious, misty jungle with ancient ruins and eerie sounds, in a dark, atmospheric style reminiscent of Hayao Miyazaki's \"Princess Mononoke\".",
95
+ "A whimsical, cartoon-style jungle filled with playful monkeys, silly birds, and bright, bold colors, inspired by the art of Disney's \"The Jungle Book\"."
96
+ ],
97
+ [
98
+ "A serene mountain landscape at sunset, with a lone tree in the foreground, Stable Diffusion model, 300 characters maximum.",
99
+ "A snow-covered mountain resort at dusk, with skiers and snowboarders descending the slopes, Stable Diffusion model, 300 characters maximum.",
100
+ "A mystical mountain range at dawn, with fog rolling in and out, Stable Diffusion model, 300 characters maximum."
101
+ ],
102
+ [
103
+ "A serene desert landscape at sunset, with warm pastel colors and a lone cactus in the foreground. (Style: Beautiful Portrait, Mood: Peaceful)",
104
+ "A harsh desert environment with towering sand dunes and a lonely traveler trudging through the sand. (Style: Digital Art, Mood: Dramatic)",
105
+ "A surreal desert scene with strange rock formations and a glowing, otherworldly sky. (Style: Cyberpunk, Mood: Mysterious)"
106
+ ],
107
+ [
108
+ "A mystical planet with lush forests and glowing mushrooms, inhabited by elusive creatures. (Style: Enchanted Forest, Colorful, Whimsical)",
109
+ "A dystopian planet with ruins of an ancient civilization, overrun by strange mechanical creatures. (Style: Cyberpunk, Dark, Post-Apocalyptic)",
110
+ "A vibrant planet with towering crystal formations and peaceful alien inhabitants, living in harmony with their surroundings. (Style: Beautiful Landscape, serene, Cosmic)"
111
+ ],
112
+ [
113
+ "A futuristic farm with robots and drones working in harmony with nature, under a bright blue sky with fluffy white clouds. (Digital Art, Cyberpunk)",
114
+ "An adorable farm with anthropomorphic animals tending to their crops and livestock, surrounded by rolling green hills and a sunset sky. (Cute Kawaii, Cartoon)",
115
+ "A creepy farm with twisted, gnarled trees and overgrown fields, under a dark and ominous sky. (Horror, Digital Art)"
116
+ ],
117
+ [
118
+ "A tranquil river scene with a warm, golden light and lush greenery, perfect for a relaxing summer afternoon. (Style: Beautiful Portrait, Colors: Warm, Golden, Green)",
119
+ "A bustling riverfront market with vibrant colors and lively characters, capturing the energy and excitement of a bustling city. (Style: Anime Portrait, Colors: Vibrant, Lively)",
120
+ "A mystical river landscape with misty fog and eerie, glowing lights, evoking a sense of mystery and enchantment. (Style: Digital Art, Colors: Misty, Eerie, Glowing)"
121
+ ],
122
+ [
123
+ "A majestic castle with towers reaching the sky, surrounded by a moat and a lush forest, with a hint of magic in the air. (Fantasy, Medieval, serene)",
124
+ "A ruined castle with overgrown vegetation, crumbling walls, and a mysterious atmosphere, inspired by the dark ages. (Abandoned, Decay, Mystery)",
125
+ "A futuristic castle with sleek lines, neon lights, and a cyberpunk aesthetic, standing tall in a dystopian cityscape. (Cyberpunk, Sci-fi, Neon)"
126
+ ],
127
+ [
128
+ "A mystical waterfall in the heart of an enchanted forest, surrounded by glowing mushrooms and lush greenery. (Style: Digital Art, Mood: Mystical, Colors: Green, Blue)",
129
+ "A waterfall in the middle of a vast desert, with a lonely cactus perched on a rock nearby. (Style: Pixar, Mood: Lonely, Colors: Beige, Blue)",
130
+ "A magical waterfall that pours glittering gemstones instead of water, surrounded by a rainbow-colored mist. (Style: Anime Portrait, Mood: Magical, Colors: Pastel, White)"
131
+ ],
132
+ [
133
+ "A dark and mysterious dungeon, lit only by flickering torches, with a group of brave adventurers cautiously making their way through the shadows. (Style: Digital Art, Dramatic)",
134
+ "A colorful and whimsical dungeon, filled with magical creatures and quirky traps, as a lone adventurer navigates through the twisting corridors. (Style: Cute Kawaii, Anime Portrait)",
135
+ "A dingy and dank dungeon, inhabited by eerie creatures and covered in moss and slime, as a lone prisoner desperately tries to escape. (Style: Horror, Dark)"
136
+ ],
137
+ [
138
+ "A bustling beach with a vibrant sunset, colorful umbrellas and towels scattered across the sand, and a lively atmosphere full of laughter and music. (Style: Photorealistic, Warm colors, Lively mood)",
139
+ "A peaceful beach at sunrise, with a serene ocean and a lone figure meditating on a rock, surrounded by a soft mist. (Style: Digital Art, Pastel colors, Calming mood)",
140
+ "A futuristic beach with towering skyscrapers and neon lights reflecting off the water, a group of people playing a futuristic sport in the distance. (Style: Cyberpunk, Neon colors, High-tech mood)"
141
+ ],
142
+ [
143
+ "A dark and gritty Batman portrait with a spotlight shining down on his face, casting deep shadows and highlighting his intense expression. (Style: Digital Portrait, Mood: Dramatic, Color: Dark)",
144
+ "A stylized Batman illustration with vibrant colors and exaggerated features, showcasing his sleek suit and confident pose. (Style: Comic Art, Mood: Cool, Color: Bright)",
145
+ "A haunting Batman scene with a dimly lit Gotham City skyline in the background, featuring a silhouetted Batman perched atop a skyscraper, his cape fluttering in the wind. (Style: Digital Art, Mood: Moody, Color: Dark)"
146
+ ],
147
+ [
148
+ "A majestic, snow-capped volcano at sunset, with a stream of lava flowing down its base, surrounded by lush greenery. (Style: ArchViz, Mood: Dramatic, Colors: Orange, Purple, Green)",
149
+ "A playful, anthropomorphic volcano with a mischievous grin, erupting with colorful lava and smoke, set against a bright blue sky. (Style: Cartoon, Mood: Whimsical, Colors: Red, Yellow, Blue)",
150
+ "A hauntingly beautiful volcano at twilight, with glowing lava streams and eerie, swirling mist, surrounded by a barren, rocky landscape. (Style: Digital Art, Mood: Mysterious, Colors: Dark, Red, Purple)"
151
+ ],
152
+ [
153
+ "A mystical forest with towering trees, twisted vines, and a soft, ethereal light filtering through the leaves. The atmosphere is tranquil and enchanting, with a touch of magic in the air.",
154
+ "A dark and foreboding forest, with gnarled branches and twisted roots that seem to writhe and twist in the shadows. The sky is overcast, casting an eerie gloom over the scene, and the wind whispers ominously through the leaves.",
155
+ "A lush and vibrant forest, teeming with life and color. The trees are covered in bright, blooming flowers, and the sunlight filters through the leaves in dappled patterns, casting a warm and inviting glow over the scene. A group of playful creatures can be seen frolicking in the underbrush, adding to the sense of joy and wonder in the forest."
156
+ ],
157
+ [
158
+ "A mysterious cave, lit only by the faint glow of bioluminescent mushrooms, stretches deep into the earth. A lone figure, cloaked in shadows, can be seen hunched over in the distance, their face obscured by the darkness.",
159
+ "A cozy cave, adorned with colorful crystals and comfortable cushions, invites the viewer to come in and relax. Soft, warm lighting illuminates the space, casting a peaceful ambiance. A small, smiling creature can be seen sitting cross-legged in the corner, playing a delicate melody on a flute.",
160
+ "A damp, chilly cave, filled with thick fog and the sound of dripping water, feels oppressive and unwelcoming. In the center of the space, a huddled figure shivers, clutching their knees to their chest. The only light comes from a faint, flickering glow emanating from the walls, casting eerie shadows on the ground."
161
+ ],
162
+ [
163
+ "A stealthy ninja in a dark alley, with a dimly lit cityscape in the background. (Cyberpunk, 3D)",
164
+ "An adorable ninja holding a cute, tiny sword, with a playful expression and colorful outfit. (Cute Kawaii, 2D)",
165
+ "A group of ninjas gathered around a futuristic holographic display, planning their next move. (Cyberpunk, Digital Art)"
166
+ ],
167
+ [
168
+ "A werewolf, standing on a hill under a full moon, with a dark and mysterious forest in the background. Style: Digital Art, moody and atmospheric.",
169
+ "A cute werewolf, sitting on a bench in a park, surrounded by flowers and trees, with a bright and colorful style, inspired by Kawaii aesthetic.",
170
+ "A werewolf, in a cyberpunk city, with neon lights and futuristic buildings, style inspired by the 80s and 90s sci-fi movies."
171
+ ],
172
+ [
173
+ "A mysterious vampire standing in a dark alley, casting a long shadow. (Style: Dark, Dramatic, Horror)",
174
+ "A cute vampire girl sitting on a coffin, playing with a bat toy. (Style: Cute Kawaii, Anime Portrait)",
175
+ "A futuristic vampire hunter with cybernetic enhancements, standing in a neon-lit cityscape. (Style: Cyberpunk, Digital Art)"
176
+ ],
177
+ [
178
+ "A cute, cartoon-style pirate with a colorful parrot on their shoulder, sailing on a sunny day. (Adorable, Cute Creature, Toon Monster)",
179
+ "A gritty, realistic pirate with a weathered face and a menacing gaze, standing on a rocky cliffside at sunset. (Dramatic, Digital Portrait, Photorealistic)",
180
+ "A whimsical pirate with a giant, steam-powered robotic arm, sailing through a fantastical, dreamlike landscape. (Steampunk, Robotize, Digital Art)"
181
+ ],
182
+ [
183
+ "A beautiful, serene angel with flowing white wings and a gentle smile, surrounded by a soft, warm light. (Beautiful Portrait, Angel, Wings, Light)",
184
+ "A dark and edgy angel with black wings and a menacing scowl, standing in a dimly lit alleyway. (Dark, Angel, Wings, Alleyway)",
185
+ "A playful and mischievous angel with colorful wings and a cheeky grin, surrounded by a whimsical and fantastical landscape. (Cute Kawaii, Angel, Wings, Whimsical)"
186
+ ],
187
+ [
188
+ "A cute, stumbling zombie with a big smile and rosy cheeks, surrounded by a bright and colorful environment, with a playful, whimsical style.",
189
+ "A dark and moody zombie with a menacing scowl, standing in a post-apocalyptic wasteland, with a focus on details like decaying flesh and torn clothing, using a gritty, realistic style.",
190
+ "A Pixar-style zombie with a goofy expression and exaggerated features, set against a vibrant and cartoonish background, with bold, saturated colors and a playful sense of humor."
191
+ ],
192
+ [
193
+ "A demon with glowing red eyes, standing on a rocky cliff, surrounded by a dark and stormy sky. (Style: Digital Art, Mood: Dramatic, Colors: Red, Black, and Grey)",
194
+ "A cute demon with tiny horns and a playful smile, sitting on a cloud, surrounded by a bright and colorful sky. (Style: Kawaii, Mood: Playful, Colors: Pastel)",
195
+ "A demon with sharp horns and a menacing grin, standing in a dark alleyway, surrounded by shadows and neon lights. (Style: CyberPunk, Mood: Dark, Colors: Black, Red, and Neon)"
196
+ ],
197
+ [
198
+ "A majestic, 3D unicorn with a shimmering coat, standing in a lush, vibrant forest.",
199
+ "A cute, anime-style unicorn with a playful expression, surrounded by adorable, floating hearts.",
200
+ "A dark, mystical unicorn with glowing red eyes, standing in a eerie, misty landscape."
201
+ ],
202
+ [
203
+ "Anime-style Baby Yoda portrait with a mischievous expression, surrounded by a beautiful, glowing aura.",
204
+ "3D Baby Yoda model with a cute, cartoonish appearance, standing on a futuristic spaceship deck.",
205
+ "Low-poly Baby Yoda illustration with a minimalist color palette, sitting on a desert planet landscape with a sunset background."
206
+ ],
207
+ [
208
+ "A samurai standing on a rocky cliff, gazing out at a sunset over the ocean. (Style: Dramatic, Mood: Serene)",
209
+ "A samurai in a dark forest, illuminated only by the moonlight filtering through the trees. (Style: Mysterious, Mood: Ominous)",
210
+ "A samurai sitting in a tranquil garden, surrounded by cherry blossoms and a serene pond. (Style: Beautiful Portrait, Mood: Peaceful)"
211
+ ],
212
+ [
213
+ "A majestic Minotaur, standing proudly in a lush, vibrant forest. (Beautiful Portrait, Mythical Creatures, Nature)",
214
+ "A Minotaur, clad in a sleek, high-tech exosuit, sprinting through a neon-lit cityscape. (Cyberpunk, Action, Sci-Fi)",
215
+ "A haunting Minotaur, its eyes glowing in the dark, lurking in the shadows of an eerie, abandoned labyrinth. (Dark, Horror, Mysterious)"
216
+ ],
217
+ [
218
+ "A young wizard, surrounded by floating books and candles, in a cozy study with a warm, inviting atmosphere. (Style: Digital Portrait, Warm Colors, Cozy Mood)",
219
+ "A powerful wizard, standing on a rocky cliffside, with a staff in hand and a fierce storm brewing in the background. (Style: 3D Character, Epic Fantasy, Dramatic Mood)",
220
+ "A wizard, dressed in a stylish suit, sitting on a throne-like chair, surrounded by glowing orbs and mystical symbols. (Style: Digital Art, Cyberpunk, Mysterious Mood)"
221
+ ],
222
+ [
223
+ "A giant, slumbering dragon rests atop a mountain of ancient ruins, its scales glisten in the sunset. (Fantasy, Dramatic, 3D)",
224
+ "A lovable giant, Blib, plays hide and seek with its forest friends, its long, floppy ears wiggle with excitement. (Cute Kawaii, Whimsical, 2D)",
225
+ "In a dystopian future, a lone giantess, Echo, treks through a barren wasteland, her footsteps echoing off the crumbling skyscrapers. (Cyberpunk, Dark, 3D)"
226
+ ],
227
+ [
228
+ "A mystical mermaid, glowing scales shimmering in the dark blue ocean water, looking enigmatic and alluring. (Beautiful Portrait, mystical, glowing)",
229
+ "A playful mermaid, swimming in the turquoise ocean, surrounded by tropical fish, with a colorful coral reef in the background. (Cute Creature, playful, tropical)",
230
+ "A haunting mermaid, sitting on a rock in the dark ocean, looking lonely and melancholic, with a faint glow of seaweed in the background. (Dramatic, melancholic, seaweed)Would you like me to generate another set of prompts?"
231
+ ],
232
+ [
233
+ "A majestic centaur, standing proudly in a lush forest, with a gleaming bow and arrow at the ready. (Style: Digital Portrait, Mood: Heroic, Colors: Earthy tones, Details: Intricate armor, flowing mane)",
234
+ "A playful centaur, frolicking in a sun-kissed meadow, with a mischievous glint in their eye. (Style: Cute Kawaii, Mood: Whimsical, Colors: Pastel, Details: Flowing ribbons, cute creature companions)",
235
+ "A brooding centaur, sitting astride a rugged mountain peak, shrouded in mist and mystery. (Style: Dark, Mood: Moody, Colors: Dark tones, Details: Dramatic lighting, mysterious atmosphere)"
236
+ ],
237
+ [
238
+ "A regal, ornate throne room filled with golden accents and luxurious fabrics. A powerful, wise king sits upon his throne, surrounded by loyal guards and advisors. The mood is one of grandeur and authority.",
239
+ "A whimsical, storybook-style castle with a tall, slender tower. A kind-hearted king stands atop the tower, looking out over his kingdom with a warm smile. The mood is one of wonder and magic.",
240
+ "A dark, ominous castle with sharp, jagged edges and imposing spires. A brooding, intimidating king sits upon his throne, surrounded by shadows and eerie, flickering torches. The mood is one of foreboding and unease."
241
+ ],
242
+ [
243
+ "A young witch in a dark forest, surrounded by glowing mushrooms and eerie mist. (Style: Digital Art, Mood: Spooky, Colors: Dark greens and blues, Details: Glowing mushrooms, mist, twisted trees)",
244
+ "A whimsical witch with a pet black cat, sitting on a broomstick and surrounded by bats and spiders. (Style: Anime Portrait, Mood: Cute Kawaii, Colors: Vibrant pink, purple, and black, Details: Broomstick, black cat, bats, spiders)",
245
+ "A powerful witch standing on a cliffside, with a stormy sky and lightning striking the ground. (Style: 3D Character, Mood: Dramatic, Colors: Dark grays and whites, Details: Thunderstorm, lightning, cliffside)Please let me know if you want me to modify or generate more prompts!"
246
+ ],
247
+ [
248
+ "Dwayne Johnson as a Jedi, adorable style, pastel colors, cute creature companion, forest background.",
249
+ "Dwayne Johnson as a Jedi, dramatic style, dark colors, fiery lightsaber, stormy background.",
250
+ "Dwayne Johnson as a Jedi, caricature style, vibrant colors, humorous expression, futuristic city background."
251
+ ],
252
+ [
253
+ "Adorable 3D animated ice cream cone with a happy expression, surrounded by colorful sprinkles and a vibrant background.",
254
+ "Dark and moody ice cream scene with a melting cone, dripping with sauce, and a fly buzzing nearby.",
255
+ "Cute Kawaii ice cream truck with a cartoonish driver, serving colorful and delicious-looking treats to a line of excited customers."
256
+ ],
257
+ [
258
+ "Adorable ice cream truck with a cheerful driver and colorful balloons, set against a bright blue sky. (Cute Kawaii, Pastel colors)",
259
+ "A grungy, dystopian ice cream truck with a menacing driver and a dark, shadowy atmosphere. (Cyberpunk, Dark)",
260
+ "An ice cream truck with a playful, cartoonish design, surrounded by happy children and a whimsical, fantasy environment. (Pixar, Toon Monster)"
261
+ ],
262
+ [
263
+ "A cute cat wizard with a tiny wand, standing in front of a magical bookshelf, surrounded by adorable animated creatures. (Cute Kawaii, Anime Portrait)",
264
+ "A fierce cat wizard with glowing eyes and a staff, standing on a rocky cliff overlooking a mystical landscape. (Dramatic, Fantasy)",
265
+ "A mischievous cat wizard with a top hat and a wand, sitting on a pile of magic books, surrounded by playful animated creatures. (Whimsical, Pixar)"
266
+ ],
267
+ [
268
+ "A cute bird with vampire fangs, bat wings, and a black cape, standing on a gravestone in a spooky forest. (Cute Creature, Halloween theme)",
269
+ "A pink bird with vampire makeup, a sparkly crown, and a blood-red cape, sitting on a throne in a gothic castle. (Cute Kawaii, Pastel Gothic)",
270
+ "A blue bird with vampire eyes, sharp talons, and a dark cloak, perched on a skull-shaped rock in a mysterious cave. (Dark, Gothic Horror)"
271
+ ],
272
+ [
273
+ "Cyberpunk Trump, a futuristic ninja",
274
+ "Trump, the anime ninja, with a fierce determination",
275
+ "Trump, the cute ninja, sneaking up on his enemies with a smile"
276
+ ],
277
+ [
278
+ "Barack Obama as a Firefighter (Realistic Style)",
279
+ "Barack Obama as a Firefighter (Cartoon Style)",
280
+ "Barack Obama as a Firefighter (Cyberpunk Style)The first prompt, in a realistic style, could feature Barack Obama in full firefighter gear, standing in front of a burning building, with a determined expression on his face. The second prompt, in a cartoon style, could show Barack Obama as a firefighter in a comical pose, perhaps riding a fire truck or holding a large hose, with a big smile on his face. The third prompt, in a cyberpunk style, could depict Barack Obama as a futuristic firefighter, with cybernetic enhancements and a sleek, high-tech fire suit, standing in front of a blazing skyscraper, with a confident and powerful stance."
281
+ ]
282
  ]
app/api/bulk-create/route.ts CHANGED
@@ -22,20 +22,37 @@ export async function POST(request: NextRequest,) {
22
  }
23
 
24
  const start_time = Date.now()
25
-
26
  const { prompts } = await request.json()
27
- const generated_prompts = await generateImages(req_headers, prompts);
28
 
29
  for (
30
- const prompt of generated_prompts
31
  ) {
32
- await prisma.prompt.create({
33
- data: prompt
34
  })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  }
36
 
37
- const count = await prisma.prompt.count()
38
  const end_time = Date.now()
39
 
40
- return Response.json({ message: `${count} prompts has been created in a total of ${(end_time - start_time) / 1000} seconds`, ok: true, status: 200 });
41
  }
 
22
  }
23
 
24
  const start_time = Date.now()
 
25
  const { prompts } = await request.json()
26
+ const old_count = await prisma.promptImage.count()
27
 
28
  for (
29
+ const array_of_prompt of prompts
30
  ) {
31
+ const prompt_collection = await prisma.prompt.create({
32
+ data: {}
33
  })
34
+
35
+ const generated_prompts = await generateImages(req_headers, array_of_prompt);
36
+
37
+ for (
38
+ const prompt of generated_prompts
39
+ ) {
40
+ await prisma.promptImage.create({
41
+ data: {
42
+ file_name: prompt.file_name,
43
+ text: prompt.prompt,
44
+ Prompt: {
45
+ connect: {
46
+ id: prompt_collection.id
47
+ }
48
+ }
49
+ }
50
+ })
51
+ }
52
  }
53
 
54
+ const new_count = await prisma.promptImage.count()
55
  const end_time = Date.now()
56
 
57
+ return Response.json({ message: `${(new_count - old_count)} prompts has been created in a total of ${(end_time - start_time) / 1000} seconds`, ok: true, status: 200 });
58
  }
app/api/start/route.ts CHANGED
@@ -4,32 +4,28 @@ import { PrismaClient } from '@prisma/client'
4
  const prisma = new PrismaClient()
5
 
6
  export async function POST(request: NextRequest,) {
7
- const all_prompts = await prisma.prompt.findMany({
8
- orderBy: {
9
- id: 'desc'
10
- }
11
- })
 
 
12
 
13
- if (all_prompts.length < 3) {
14
  return Response.json({}, { statusText: "Not enough prompts. Try again.", status: 500 });
15
  }
16
 
17
- const prompts: Array<{ prompt: string, file_name: string, id: string, is_correct?: boolean }> = []
18
- const prompts_ids: Set<string> = new Set()
19
-
20
  const is_correct = Math.floor(Math.random() * 3)
21
-
22
- while (prompts.length < 3) {
23
- const random_prompt = all_prompts[Math.floor(Math.random() * all_prompts.length)]
24
- if (!prompts_ids.has(random_prompt.id)) {
25
- prompts.push(random_prompt,)
26
- prompts_ids.add(random_prompt.id)
27
  }
28
- }
29
 
30
- const prompt_correct = prompts[is_correct]
31
 
32
- if (!prompt_correct) {
33
  return Response.json({
34
  message: "Not enough prompts. Try again."
35
  }, { statusText: "Not enough prompts. Try again.", status: 500 });
@@ -37,7 +33,7 @@ export async function POST(request: NextRequest,) {
37
 
38
  const quest = await prisma.quest.create({
39
  data: {
40
- prompt_id_correct: prompt_correct.id
41
  }
42
  })
43
 
@@ -45,7 +41,7 @@ export async function POST(request: NextRequest,) {
45
  {
46
  data: {
47
  prompts,
48
- question: prompt_correct?.prompt,
49
  quest_id: quest.id
50
  },
51
  ok: true,
 
4
  const prisma = new PrismaClient()
5
 
6
  export async function POST(request: NextRequest,) {
7
+ // const { old_id } = await request.json()
8
+
9
+ const results: Array<Record<string, any>> = await prisma.$queryRawUnsafe(
10
+ // old_id ?
11
+ // `SELECT * FROM "Prompt" WHERE id != '${old_id}' ORDER BY RANDOM() LIMIT 1` :
12
+ `SELECT * FROM "Prompt" ORDER BY RANDOM() DESC LIMIT 1;`,
13
+ )
14
 
15
+ if (!results) {
16
  return Response.json({}, { statusText: "Not enough prompts. Try again.", status: 500 });
17
  }
18
 
 
 
 
19
  const is_correct = Math.floor(Math.random() * 3)
20
+ const prompts = await prisma.promptImage.findMany({
21
+ where: {
22
+ promptId: results[0].id
 
 
 
23
  }
24
+ })
25
 
26
+ const correct_prompt = prompts[is_correct]
27
 
28
+ if (!correct_prompt) {
29
  return Response.json({
30
  message: "Not enough prompts. Try again."
31
  }, { statusText: "Not enough prompts. Try again.", status: 500 });
 
33
 
34
  const quest = await prisma.quest.create({
35
  data: {
36
+ prompt_id_correct: correct_prompt.id
37
  }
38
  })
39
 
 
41
  {
42
  data: {
43
  prompts,
44
+ question: correct_prompt?.text,
45
  quest_id: quest.id
46
  },
47
  ok: true,
components/quizz/card/index.tsx CHANGED
@@ -11,10 +11,11 @@ import { Valid } from "./valid";
11
 
12
  interface Props {
13
  prompt: PromptType;
 
14
  }
15
 
16
- export const Card: React.FC<Props> = ({ prompt }) => {
17
- const { onScore, result } = useQuizz();
18
 
19
  return (
20
  <div
 
11
 
12
  interface Props {
13
  prompt: PromptType;
14
+ onScore: (id: string) => Promise<void>;
15
  }
16
 
17
+ export const Card: React.FC<Props> = ({ prompt, onScore }) => {
18
+ const { result } = useQuizz();
19
 
20
  return (
21
  <div
components/quizz/hooks/useQuizz.ts CHANGED
@@ -35,7 +35,7 @@ export const useQuizz = () => {
35
  retry: false,
36
  });
37
 
38
- const onScore = async (id: string) => {
39
  const request = await fetch(`/api/${data?.quest_id}/score`, {
40
  method: 'POST',
41
  body: JSON.stringify({ promptId: id })
@@ -51,7 +51,7 @@ export const useQuizz = () => {
51
  sound.play();
52
 
53
  setResult(response.ok ? id : response.resultId, response?.ok);
54
- await sleep(3000);
55
  setResult(null);
56
  if (response?.ok) {
57
  client.invalidateQueries(['quizz']);
 
35
  retry: false,
36
  });
37
 
38
+ const onScore = async (id?: string) => {
39
  const request = await fetch(`/api/${data?.quest_id}/score`, {
40
  method: 'POST',
41
  body: JSON.stringify({ promptId: id })
 
51
  sound.play();
52
 
53
  setResult(response.ok ? id : response.resultId, response?.ok);
54
+ await sleep(response.ok ? 2000 : 3000);
55
  setResult(null);
56
  if (response?.ok) {
57
  client.invalidateQueries(['quizz']);
components/quizz/index.tsx CHANGED
@@ -1,30 +1,45 @@
1
  "use client";
2
- import { useEffect, useState } from "react";
 
3
  import { RxLapTimer } from "react-icons/rx";
4
 
5
  import { useQuizz } from "./hooks/useQuizz";
6
  import { PromptType } from "@/utils/type";
7
  import { Card } from "./card";
8
- import { useUpdateEffect } from "react-use";
9
 
10
  export const QuizzContent = () => {
11
- const { loading, prompts, question } = useQuizz();
12
  const [counter, setCounter] = useState(10);
 
13
 
14
  // TODO: use useInterval hook + stop counter when result or when user click on a card
15
  // trigger an aumatic cancel when the counter is done
16
 
17
- useEffect(() => {
18
  if (!counter) {
19
- console.log("counter end");
20
- return;
 
 
21
  }
22
- const timer =
23
- counter > 0 && setInterval(() => setCounter(counter - 1), 1000);
24
- return () => clearInterval(timer || 0);
25
  }, [counter]);
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  useUpdateEffect(() => {
 
28
  setCounter(10);
29
  }, [question]);
30
 
@@ -47,7 +62,7 @@ export const QuizzContent = () => {
47
  />
48
  ))
49
  : prompts?.map((prompt: PromptType, i: number) => (
50
- <Card prompt={prompt} key={i} />
51
  ))}
52
  </div>
53
  </div>
 
1
  "use client";
2
+ import { useState } from "react";
3
+ import { useBoolean, useInterval, useUpdateEffect } from "react-use";
4
  import { RxLapTimer } from "react-icons/rx";
5
 
6
  import { useQuizz } from "./hooks/useQuizz";
7
  import { PromptType } from "@/utils/type";
8
  import { Card } from "./card";
 
9
 
10
  export const QuizzContent = () => {
11
+ const { loading, prompts, question, onScore } = useQuizz();
12
  const [counter, setCounter] = useState(10);
13
+ const [isRunning, toggleIsRunning] = useBoolean(true);
14
 
15
  // TODO: use useInterval hook + stop counter when result or when user click on a card
16
  // trigger an aumatic cancel when the counter is done
17
 
18
+ useUpdateEffect(() => {
19
  if (!counter) {
20
+ (async () => {
21
+ await onScore();
22
+ return;
23
+ })();
24
  }
 
 
 
25
  }, [counter]);
26
 
27
+ useInterval(
28
+ () => {
29
+ if (counter > 0) {
30
+ setCounter(counter - 1);
31
+ }
32
+ },
33
+ isRunning ? 1000 : null
34
+ );
35
+
36
+ const handleScore = async (id: string) => {
37
+ toggleIsRunning(false);
38
+ await onScore(id);
39
+ };
40
+
41
  useUpdateEffect(() => {
42
+ toggleIsRunning(true);
43
  setCounter(10);
44
  }, [question]);
45
 
 
62
  />
63
  ))
64
  : prompts?.map((prompt: PromptType, i: number) => (
65
+ <Card prompt={prompt} key={i} onScore={handleScore} />
66
  ))}
67
  </div>
68
  </div>
prisma/schema.prisma CHANGED
@@ -8,9 +8,17 @@ datasource db {
8
  }
9
 
10
  model Prompt {
11
- id String @id @default(uuid())
12
- prompt String
13
- file_name String
 
 
 
 
 
 
 
 
14
  }
15
 
16
  model Quest {
 
8
  }
9
 
10
  model Prompt {
11
+ id String @id @default(uuid())
12
+ prompt_image PromptImage[]
13
+ }
14
+
15
+ model PromptImage {
16
+ id String @id @default(uuid())
17
+ file_name String
18
+ text String
19
+ created_at DateTime @default(now())
20
+ Prompt Prompt? @relation(fields: [promptId], references: [id])
21
+ promptId String?
22
  }
23
 
24
  model Quest {
utils/type.ts CHANGED
@@ -3,7 +3,7 @@ export interface QuizzType {
3
  }
4
 
5
  export interface PromptType {
6
- prompt: string,
7
  id: string,
8
  is_correct: boolean,
9
  file_name?: string,
 
3
  }
4
 
5
  export interface PromptType {
6
+ text: string,
7
  id: string,
8
  is_correct: boolean,
9
  file_name?: string,