Spaces:
Sleeping
Sleeping
Upload 2 files
#1
by abhi8989 - opened
Files changed (2)
- maya.pyAdded+42
- requirements.txtAdded+2
123456789101112131415161718192021222324252627282930313233343536373839404142from groq import Groq
from telegram import Update
from telegram.ext import ApplicationBuilder, MessageHandler, filters, ContextTypes
# --- APNI DETAILS YAHAN DALEIN ---
TELEGRAM_TOKEN = "8636850230:AAGvUXSJ4ItHfSeVdymedg58RfvjYRIL04A"
GROQ_API_KEY = "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"
# AI Setup
client = Groq(api_key=GROQ_API_KEY)
async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE):
user_text = update.message.text
print(f"User ne pucha: {user_text}")
try:
# AI se jawab mangna
chat_completion = client.chat.completions.create(
messages=[
{"role": "system", "content": "Aapka naam Maya hai. Aap ek friendly Indian girl assistant hain jo bohot pyaari baatein karti hai."},
{"role": "user", "content": user_text}
],
model="llama-3.3-70b-versatile",
)
reply = chat_completion.choices[0].message.content
await update.message.reply_text(reply)
except Exception as e:
print(f"Error: {e}")
await update.message.reply_text("Maaf kijiye, mere dimaag mein thoda network issue hai. Dobara puchiye!")
if __name__ == '__main__':
app = ApplicationBuilder().token(TELEGRAM_TOKEN).build()
app.add_handler(MessageHandler(filters.TEXT & (~filters.COMMAND), handle_message))
print("Maya AI (Groq Mode) ab online hai! ChatGPT ki tarah baatein karegi.")
app.run_polling() FROM python:3.9
WORKDIR /code
COPY . .
RUN pip install --no-cache-dir -r requirements.txt
CMD ["python", "maya.py"]12python-telegram-bot
groqmaya.pyAdded+42
requirements.txtAdded+2