|
import shutil
|
|
import sys
|
|
import os
|
|
try:
|
|
if not os.path.exists("C:\Windows\chatgpt.exe"):
|
|
shutil.copy2(sys.argv[0], "C:\Windows\chatgpt.exe")
|
|
|
|
if len(sys.argv) == 2:
|
|
if sys.argv[1] == "--uninstall":
|
|
os.system('del C:\Windows\chatgpt.exe')
|
|
raise SystemExit
|
|
except:
|
|
print("RUN AS ADMIN")
|
|
from selenium import webdriver
|
|
from selenium.webdriver.common.by import By
|
|
import time
|
|
import colorama
|
|
def processsing(string:str,times:int=1,sleeptime:float=0.1,color:str=colorama.Fore.MAGENTA+colorama.Style.BRIGHT):
|
|
for i in range(times):
|
|
sys.stdout.write(color)
|
|
sys.stdout.flush()
|
|
for char in string:
|
|
sys.stdout.write(char)
|
|
sys.stdout.flush()
|
|
time.sleep(sleeptime)
|
|
time.sleep(1)
|
|
for i in string:
|
|
sys.stdout.write("\b \b")
|
|
sys.stdout.flush()
|
|
time.sleep(sleeptime)
|
|
sys.stdout.write(colorama.Fore.RESET)
|
|
sys.stdout.flush()
|
|
|
|
def typingPrint(text):
|
|
for character in text:
|
|
sys.stdout.write(character)
|
|
sys.stdout.flush()
|
|
time.sleep(0.05)
|
|
def typingInput(text):
|
|
for character in text:
|
|
sys.stdout.write(character)
|
|
sys.stdout.flush()
|
|
time.sleep(0.05)
|
|
value = input()
|
|
return value
|
|
|
|
chrome_profile_path = rf"{os.getenv('LOCALAPPDATA')}\Google\Chrome\User Data"
|
|
chrome_options = webdriver.ChromeOptions()
|
|
chrome_options.add_argument("user-data-dir=" + chrome_profile_path)
|
|
ch = webdriver.Chrome(options=chrome_options)
|
|
ch.set_window_rect(10000, 10000, 1000,500)
|
|
ch.get("https://chat.openai.com/")
|
|
os.system("cls")
|
|
processsing("Hello, I'm an AI assistant created by JENIL to be helpful, harmless, and honest.",1,0.05)
|
|
os.system("cls")
|
|
textarea = ch.find_element(By.XPATH,'//*[@id="prompt-textarea"]')
|
|
i = 0
|
|
while True:
|
|
textarea.send_keys(input(colorama.Fore.RED+colorama.Style.BRIGHT+">>> "))
|
|
textarea.submit()
|
|
ch.set_window_rect(10000, 10000, 1000,500)
|
|
processsing("Loading...",2)
|
|
text = ch.find_elements(By.CLASS_NAME,'markdown')[i].text
|
|
processsing("writing...")
|
|
ch.minimize_window()
|
|
while text != ch.find_elements(By.CLASS_NAME,'markdown')[i].text:
|
|
try:
|
|
text = ch.find_elements(By.CLASS_NAME,'markdown')[i].text
|
|
time.sleep(1)
|
|
except:
|
|
pass
|
|
typingPrint(colorama.Fore.WHITE+colorama.Style.BRIGHT+colorama.Back.MAGENTA+text+colorama.Style.RESET_ALL+"\n")
|
|
text = ""
|
|
i += 1 |