Metadata-Version: 2.1
Name: pyChatGPTLoop
Version: 0.0.1
Summary: Added backtracking chat on the basis of [terry3041/pyChatGPT]
Home-page: https://github.com/nek0us/pyChatGPTLoop
Author: nek0us
Author-email: nekouss@gmail.com
License: UNKNOWN
Description: # pyChatGPT
        
        [![PyPi](https://img.shields.io/pypi/v/pyChatGPTLoop.svg)](https://pypi.python.org/pypi/pyChatGPTLoop)
        [![License](https://img.shields.io/github/license/terry3041/pyChatGPT.svg?color=green)](https://github.com/terry3041/pyChatGPT/blob/main/LICENSE)
        ![PyPi](https://img.shields.io/badge/code_style-black+flake8-blue.svg)
        
        Added backtracking chat on the basis of [terry3041/pyChatGPT](https://github.com/terry3041/pyChatGPT)
        
        ## Extra Features
        
        -   [x] can go back to a conversational moment in the past
        -   [x] Optimized the output, removing two newlines
        ## Getting Started
        
        > This library is using only the `undetected_chromedriver` to bypass Cloudflare's anti-bot protection.  **Please make sure you have [Google Chrome](https://www.google.com/chrome/) / [Chromium](https://www.chromium.org/) before using this wrapper.**
        
        ### Installation
        
        ```bash
        pip install .
        ```
        
        ### Usage
        
        #### Obtaining session_token
        
        1. Go to https://chat.openai.com/chat and open the developer tools by `F12`.
        2. Find the `__Secure-next-auth.session-token` cookie in `Application` > `Storage` > `Cookies` > `https://chat.openai.com`.
        3. Copy the value in the `Cookie Value` field.
        
        ![image](https://user-images.githubusercontent.com/19218518/206170122-61fbe94f-4b0c-4782-a344-e26ac0d4e2a7.png)
        
        #### Interactive mode
        
        ```bash
        python3 -m pyChatGPT
        ```
        
        #### Import as a module
        
        ```python
        from pyChatGPT import ChatGPT
        
        session_token = 'abc123'  # `__Secure-next-auth.session-token` cookie from https://chat.openai.com/chat
        api = ChatGPT(session_token)  # auth with session token
        api = ChatGPT(session_token, conversation_id='some-random-uuid')  # specify conversation id
        api = ChatGPT(session_token, proxy='https://proxy.example.com:8080')  # specify proxy
        api = ChatGPT(session_token, chrome_args=['--window-size=1920,768'])  # specify chrome args
        api = ChatGPT(session_token, moderation=False)  # disable moderation
        api = ChatGPT(session_token, verbose=True)  # verbose mode (print debug messages)
        
        # auth with google login
        api = ChatGPT(auth_type='google', email='example@gmail.com', password='password')
        # auth with microsoft login
        api = ChatGPT(auth_type='microsoft', email='example@gmail.com', password='password')
        # auth with openai login (captcha solving using speech-to-text engine)
        api = ChatGPT(auth_type='openai', email='example@gmail.com', password='password')
        # auth with openai login (manual captcha solving)
        api = ChatGPT(
            auth_type='openai', captcha_solver=None,
            email='example@gmail.com', password='password'
        )
        # auth with openai login (2captcha for captcha solving)
        api = ChatGPT(
            auth_type='openai', captcha_solver='2captcha', solver_apikey='abc',
            email='example@gmail.com', password='password'
        )
        # reuse cookies generated by successful login before login,
        # if `login_cookies_path` does not exist, it will process logining  with `auth_type`, and save cookies to `login_cookies_path`
        # only works when `auth_type` is `openai` or `google`
        api = ChatGPT(auth_type='openai', email='example@xxx.com', password='password',
            login_cookies_path='your_cookies_path',
        )
        
        resp = api.send_message('Hello, world!')
        print(resp['message'])
        
        api.reset_conversation()  # reset the conversation
        api.clear_conversations()  # clear all conversations
        api.refresh_chat_page()  # refresh the chat page
        api.backtrack_chat(loop_text)  # return the loop_text conversation
        ```
        
        ## Frequently Asked Questions
        
        ### How do i go back to the conversation i had?
        
        ```bash
        # You said some words to chatGPT
        loop_text = 'some words'
        
        # Go back to the dialogue where these words last appeared
        api.backtrack_chat(loop_text)
        `
        
        ### How do I get it to work on headless linux server?
        
        ```bash
        # install chromium & X virtual framebuffer
        sudo apt install chromium-browser xvfb
        
        # start your script
        python3 your_script.py
        ```
        ![image](https://user-images.githubusercontent.com/19218518/206170122-61fbe94f-4b0c-4782-a344-e26ac0d4e2a7.png)
        ### How do I get it to work on Google Colab?
        
        It is normal for the seession to be crashed when installing dependencies. Just ignore the error and run your script.
        
        ```python
        # install dependencies
        !apt install chromium-browser xvfb
        !pip install -U selenium_profiles pyChatGPT
        
        # install chromedriver
        from selenium_profiles.utils.installer import install_chromedriver
        install_chromedriver()
        ```
        
        ```python
        # start your script as normal
        !python3 -m pyChatGPT
        ```
        
        ## Insipration
        
        This project is inspired by
        
        -   [pyChatGPT](https://github.com/terry3041/pyChatGPT)
        -   [ChatGPT](https://github.com/acheong08/ChatGPT)
        -   [chatgpt-api](https://github.com/transitive-bullshit/chatgpt-api)
        
        ## Disclaimer
        
        This project is not affiliated with OpenAI in any way. Use at your own risk. I am not responsible for any damage caused by this project. Please read the [OpenAI Terms of Service](https://beta.openai.com/terms) before using this project.
        
        ## License
        
        This project is licensed under the GPLv3 License - see the [LICENSE](LICENSE) file for details.
        
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3.9
Classifier: License :: OSI Approved :: MIT License
Description-Content-Type: text/markdown
