fix that the options could still be generated when theres no quetion

This commit is contained in:
RezHackXYZ 2025-06-01 12:04:55 +05:30
parent c3cfa144d3
commit 55128257cb

View file

@ -3,6 +3,11 @@ import { AiPrompts } from "$lib/config.js";
import toast from "svelte-5-french-toast"; import toast from "svelte-5-french-toast";
export function GenerateOptionsUsingAI(index) { 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", { fetch("https://ai.hackclub.com/chat/completions", {
method: "POST", method: "POST",
headers: { headers: {