Git Product home page Git Product logo

stevenlee19820119 / autodoc-chatgpt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from awekrx/autodoc-chatgpt

0.0 0.0 0.0 38 KB

AutoDoc-ChatGPT is a Python script that leverages the power of ChatGPT model to automatically generate documentation for any programming language. With AutoDoc-ChatGPT, you can easily generate comprehensive documentation for your codebase.

License: MIT License

JavaScript 1.80% Python 86.45% TypeScript 11.75%

autodoc-chatgpt's Introduction

AutoDoc-ChatGPT

AutoDoc-ChatGPT is a Python script that leverages the power of ChatGPT model to automatically generate documentation for any programming language.

With AutoDoc-ChatGPT, you can easily generate comprehensive documentation for your codebase. Simply provide the path to file you wish to document, and AutoDoc-ChatGPT will generate a detailed description of its functionality, parameters, and return values in natural language.

Getting Started

Installing

Clone this repository to your local machine:

git clone https://github.com/awekrx/AutoDoc-ChatGPT.git

Then install the required packages:

pip install -r requirements.txt

Supported programming languages

  • Python
  • JavaScript
  • TypeScript
  • Go
  • C#
  • C++
  • PHP
  • Ruby
  • Rust
  • Java
  • Kotlin

And others...

disclaimer: TypeScript and JavScript has some bugs and is under testing

disclaimer_2.0: There is a known error commenting files with 2 or more classes that have methods with the same name.

Usage

Edit config

Open config.ini and add email and password there if you are not using OAuth authorization. Otherwise open ChatGPT and get the __Secure-next-auth.session-token cookie and write it to the session-token.

Start

py main.py -file "path to the file"

The path to the file can be either relative or absolute.

After execution, the file yourfilename_commented.language is created in the folder with the desired file.

OR

py main.py -file "path to the file"

Not recommended, little tested. You can specify a file with a comment option to create such comments.

Usage example

Usage preview

Alternative usage

You can also use this as a function in python.

from modules.autodoc import AutoDoc
import configparser

config = configparser.ConfigParser()
config.read("config.ini")

auth = {
    "email": config["ChatGPT"]["email"],
    "password": config["ChatGPT"]["password"],
    "session_token": config["ChatGPT"]["session_token"]
}

result = AutoDoc(
        auth,
        "Code for commenting",
        "language code",
        "example comment model (optional)"
    ).start()
print(result)
# out: Code with comments

Disclaimer

Doesn't always create correct comments. It doesn't always mean what you want. Use as a draft of comments that may need to be edited.

License

This project is licensed under the MIT License.

Acknowledgments

Thanks a lot to the development of AI and separately to СhatGPT for generating the Readme.

And also acheong08 for creating ChatGPT.

autodoc-chatgpt's People

Contributors

awekrx avatar

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.