Giter Site home page Giter Site logo

unofficial-chatgpt-api's Introduction

ChatGPT api

  • It uses playwright and chromium to open browser and parse html.
  • It is an unoffical api for development purpose only.

How to install

  • Make sure that python and virual environment is installed.

  • Create a new virtual environment

# one time
virtualenv -p $(which python3) pyenv

# everytime you want to run the server
source pyenv/bin/activate
  • Now install the requirements
pip install -r requirements.txt
  • If you are installing playwright for the first time, it will ask you to run this command for one time only.
playwright install
  • Now run the server
python server.py
  • The server runs at port 5001. If you want to change, you can change it in server.py

Api Documentation

  • There is a single end point only. It is available at /chat
curl -XGET http://localhost:5001/chat?q=Write%20a%20python%20program%20to%20reverse%20a%20list

Updates

  • [8 Dec 2022]: Updated parsing logic (credits @CoolLoong)

Credit

  • All the credit for this script goes to Daniel Gross's whatsapp gpt package. I have just taken the script as an individual file and added documentation for how to install and run it.

Disclaimer

Please note that this project is a personal undertaking and not an official OpenAI product. It is not affiliated with OpenAI in any way, and should not be mistaken as such.

unofficial-chatgpt-api's People

Contributors

shaal avatar taranjeet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unofficial-chatgpt-api's Issues

Incorrect usage of the term 'API' in project description

This project is not an API, but rather a project that utilizes a Chrome-based automation library to open the chat.openai.com website and retrieve the output from that website. This output is not an API, but rather the direct output from the OpenAI website. Therefore, it is not appropriate to refer to this project as an API. Instead, it should be referred to as a project that utilizes the output from the OpenAI website in order to achieve its intended purpose.

Getting this right after I login and hit enter

Screenshot 2022-12-03 140118

░▒▓ ~/g/chatgpt-api │ on main ▓▒░ node:events:491 ░▒▓ ✔ │ took 30s │ pyenv Py │ at 11:49:40 ▓▒░
throw er; // Unhandled 'error' event
^

Error: write EPIPE
at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16)
Emitted 'error' event on Socket instance at:
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -32,
code: 'EPIPE',
syscall: 'write'
}
Can you help me with this

Improve response time

Hi,
thanks for the great repo!
Currently, the python scripts waits 10 seconds before returning the response. This can lead to errors for example if the result takes longer.

You can take this code (or something similar) that looks for the loading indicator and immediately returns the result when the indicator disappears.

...    
send_message(message)

  # Check if an answer was received
    while True:
        # Check loading indicator
        loading = PAGE.query_selector_all(
            "div[class*='result-streaming']")
        if len(loading) == 0:
            response = get_last_message()
            break

print("Response: ", response)
...

Thanks for the great work!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.