From 55128257cb6bb7de124640529e43dc2809975f7e Mon Sep 17 00:00:00 2001 From: RezHackXYZ Date: Sun, 1 Jun 2025 12:04:55 +0530 Subject: [PATCH] fix that the options could still be generated when theres no quetion --- .../kahootclone/create/logic/GenerateOptionsUsingAI.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/routes/kahootclone/create/logic/GenerateOptionsUsingAI.js b/src/routes/kahootclone/create/logic/GenerateOptionsUsingAI.js index 10e5f00..bb65a84 100644 --- a/src/routes/kahootclone/create/logic/GenerateOptionsUsingAI.js +++ b/src/routes/kahootclone/create/logic/GenerateOptionsUsingAI.js @@ -3,6 +3,11 @@ import { AiPrompts } from "$lib/config.js"; import toast from "svelte-5-french-toast"; export function GenerateOptionsUsingAI(index) { + if (!questions.v[index].name) { + toast.error("Please enter a question to generate options."); + return; + } + fetch("https://ai.hackclub.com/chat/completions", { method: "POST", headers: {