import openai import tkinter as tk from tkinter import scrolledtext # đŸ”Ĩ āĻāĻ–াāύে āφāĻĒāύাāϰ OpenAI API Key āĻŦāϏাāύ openai.api_key = "YOUR_OPENAI_API_KEY" # ✅ ChatGPT āωāϤ্āϤāϰ āφāύāϤে āĻĢাংāĻļāύ def chatgpt_reply(): user_input = user_entry.get() if user_input.strip() == "": return try: response = openai.ChatCompletion.create( model="gpt-4", # āĻŦা "gpt-3.5-turbo" messages=[{"role": "user", "content": user_input}] ) reply = response["choices"][0]["message"]["content"] except Exception as e: reply = f"Error: {e}" chat_box.insert(tk.END, f"\n🙍‍♂️ āφāĻĒāύি: {user_input}") chat_box.insert(tk.END, f"\n🤖 ChatGPT: {reply}\n") chat_box.yview(tk.END) user_entry.delete(0, tk.END) # ✅ GUI āϤৈāϰি āĻ•āϰা root = tk.Tk() root.title("ChatGPT Auto Reply Bot") root.geometry("500x500") chat_box = scrolledtext.ScrolledText(root, wrap=tk.WORD, width=60, height=20) chat_box.pack(pady=10) user_entry = tk.Entry(root, width=50) user_entry.pack(pady=5) send_button = tk.Button(root, text="Send", command=chatgpt_reply) send_button.pack(pady=5) # ✅ āĻŽেāχāύ āϞুāĻĒ āϚাāϞু root.mainloop()

Comments

Popular posts from this blog

āĻ•াāϰিāĻ—āϰি āĻ“ āĻŽাāĻĻ্āϰাāϏা āĻļিāĻ•্āώা āĻŦ্āϝāĻŦāϏ্āĻĨাāϰ āφāϧুāύিāĻ•া⧟āύে āωāĻĻ্āϝোāĻ— āĻ—্āϰāĻšāĻŖ

āĻ•ীāĻ­াāĻŦে āĻĒāĻĄ়াāĻļোāύাāϰ āĻĒাāĻļাāĻĒাāĻļি āϚাāĻ•āϰিāϰ āĻĒ্āϰāϏ্āϤুāϤি āύেāĻŦেāύ!