- Table of Content
-
Install pip requirements
pip install -r requirements.txt
-
Download Firefox and geckodriver and place it in folder registered in PATH.
-
In a Firefox profile of your choise, (or default one) ensure you are logged in to chatgpt.
-
Provide the firefox profile absolute path to the
ask_chatgpt
function, using theprofile_path
parameter.
-
import gptauto QUESTION = input("Ask question\n>>").lstrip().rstrip() res = gptauto.ask_chatgpt(QUESTION, headless=True, quiet=True, ) print(res)
import gptauto long_text = "" with open("text.txt", "r") as fp: transcript = fp.read().rstrip() # Any of these prompts can be omitted START_PROMPT = ( "A message with a start prompt, if present is written before question message" ) # These will only be written if # the text was long enough to be # separated in batches START_BATCH_PROMPT = "<WRITTEN BEFORE TEXT CHUNK>\n" END_BATCH_PROMPT = "<WRITTEN AFTER TEXT CHUNK>\n" END_PROMPT = ( "This message if present will be written at last, after every chunk is sent" ) res = gptauto.ask_chatgpt( long_text, start_prompt=START_PROMPT, start_batch_prompt=START_BATCH_PROMPT, end_batch_prompt=END_BATCH_PROMPT, end_prompt=END_PROMPT, headless=True, # False by default quiet=False, # Use False to watch progress )
import gptauto import traceback # None initialize driver driver = None # Previous messages used for filtering response last_messages = [] while True: try: QUESTION = input("\nAsk question\n>>").lstrip().rstrip() # If chat_mode is enabled, ask_chatgpt will return a tuple # with (driver_intsance, response). driver, res = gptauto.ask_chatgpt( QUESTION, headless=True, # False by default quiet=True, # Disable status print() chat_mode=True, # Enable chat mode driver=driver, # Pass cached driver instance ) # Filter old answers... for m in last_messages: res = res.replace(m, "") last_messages.append(res) print(res) except Exception as e: traceback.print_exc() # Once done, ensure to call quit() on driver instance if driver: driver.quit() break
For bug reporting, please feel free to open an issue in this repository : )
gptauto's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.