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()
ChatGPT Auto Reply Bot ChatGPT Bot Send
Comments
Post a Comment