import requests

def salom():
    return "Assalomu alaykum, Doliyev kutubxonasi ishga tushdi "


def ai(prompt):
    url = "https://ai.abdulaziz-repository.workers.dev/"
    try:
        r = requests.get(url, params={"prompt": prompt}, timeout=20)
        data = r.json()
        return data.get("response") or data
    except Exception as e:
        return f"AI xatolik: {e}"

def worm(prompt):
    url = "https://68f77a7f47cf9.myxvest1.ru/Apilarim/Wormgpt.php/"
    try:
        r = requests.get(url, params={"prompt": prompt}, timeout=20)
        data = r.json()
        return data.get("response") or data
    except Exception as e:
        return f"AI xatolik: {e}"

def ai2(prompt):
    url = "https://68f77a7f47cf9.myxvest1.ru/Apilarim/groqapi.php"
    try:
        r = requests.get(url, params={"prompt": prompt}, timeout=20)
        r.raise_for_status()

        try:
            data = r.json()
            return data.get("response", data)
        except ValueError:
            return r.text.strip()

    except requests.exceptions.RequestException as e:
        return f"AI xatolik: {e}"
