/docGPT

ChatGPT directly within Google Docs as an Editor Add-on 📑

Primary LanguagePython

docGPT 📄

ChatGPT directly integrated into Google Docs 📑

This project is now discontinued. Please Contribute (Read Below)! 🙏

Feel free to make any pull requests to update this project. I will review and then approve them.

Thank you to the wonderful devs who are building ChatGPT APIs!

Feel free to rebuild this project with these APIs!

Table of Contents

Notes
Usage
Run your own ChatGPT API (Devs only)
Credits

Usage

  • Google Docs
  • MS Word

Google Docs

  1. Get the template: https://docs.google.com/document/d/1N7qvw5mZdVe2u2IQ5pnVDmUjHsLEfq9_Z0Tf8PHloZA/edit?usp=sharing

  2. Make a copy of the document

alt text

  1. Type something in your Google Doc

alt text

  1. Select your question, or whatever text you want to send to ChatGPT

alt text

  1. Use the extension!

alt text

  1. Accept the Authorization request & sign into google

alt text

  1. Click Advanced, go to ChatGPT & allow the scopes required

alt text

  1. Get your result!

alt text

MS Word

  1. Open a new word document

  2. Enable the Developer Tab on Word

  3. Click Macros alt text

  4. Create a new macro with the name AddToShortcut alt text

  5. Copy the code in wordGPT/ask.bas of this repo, and paste it into the Word VBA Editor

  6. Click Tools > References in the navbar
    alt text

  7. Search for Microsoft Scripting Runtime and enable it
    image

  8. Click OK and Save the file containing the code you pasted.

  9. Right click selected text in Word and click Ask ChatGPT

image

  1. Wait for your result! (Word may become temporarily unresponsive while waiting for the result)

API

Follow this guide if you don't want to use my premade template, and want to start a ChatGPT REST API server of your own!

Without Docker

  1. Clone this repo with
git clone https://github.com/cesarhuret/docGPT.git
  1. Visit https://chat.openai.com/chat and log in or sign up
  • Rename .env.example to .env
  • Get your OpenAI email and password, and insert them into the .env file.
  1. Set up and host the web server:
cd server
## Install Requirements
pip install -r requirements.txt

## Run the server
python server.py

Docker Installation

  1. Make sure you have docker installed and running

  2. Build your docker image

cd server

#Build the image
docker build -t chatgpt-api

  1. Run your docker image
docker run -p 8080:8080 -e email=YOUR_EMAIL_GOES_HERE -e password=YOUR_PASSWORD_GOES_HERE chatgpt-api

Using the REST API

  • Send a POST request to https://docgpt.kesarx.repl.co/chat with an application/json body:
{
  'message': 'Your questions go here'
}
  • returns a string:
"here's the response to your question"

In Google Docs

  1. Get the URL of the server. Ex: http://localhost:8080/chat

  2. Enter your server URL into the Google Docs add-on script.

  3. Google Docs

  • Go to Google Docs and create a new document.
  • Click on Extension > Apps Script
  • Copy the contents of add-on/ask.js into the script editor
  • Replace the SERVER_URL variable with your server URL
  • Save the script
  • Go back to the Google Doc and refresh the page
  • Click on Extension - ChatGPT should be visible under Apps Script

Credits