GithubHelp home page GithubHelp logo

sylvianhemus / chatgpt.el Goto Github PK

View Code? Open in Web Editor NEW

This project forked from joshcho/chatgpt.el

0.0 0.0 0.0 55 KB

ChatGPT in Emacs

License: GNU General Public License v3.0

Python 2.49% Emacs Lisp 97.51%

chatgpt.el's Introduction

ChatGPT.el

ChatGPT in Emacs.

Installation

Dependency

pip install epc
pip install git+https://github.com/mmabrouk/chatgpt-wrapper
chatgpt install

This will prompt you to log in with your browser.

NOTE: If you encounter any problems, please submit an issue or see chatgpt-wrapper.

(use-package chatgpt
  :straight (:host github :repo "joshcho/ChatGPT.el" :files ("dist" "*.el"))
  :init
  (require 'python)
  (setq chatgpt-repo-path "~/.emacs.d/straight/repos/ChatGPT.el/")
  :bind ("C-c q" . chatgpt-query))
(require 'quelpa-use-package)
(use-package chatgpt
  :quelpa ((chatgpt :fetcher git :url "https://github.com/joshcho/ChatGPT.el.git") :upgrade t)
  :init
  (require 'python)
  (setq chatgpt-repo-path (expand-file-name "chatgpt/" quelpa-build-dir))
  :bind ("C-c q" . chatgpt-query))

In dotspacemacs/user-config function,

(require 'python)
(setq chatgpt-repo-path (expand-file-name "chatgpt/" quelpa-build-dir))
(global-set-key (kbd "C-c q") #'chatgpt-query)

In dotspacemacs/layers function for setq-default,

dotspacemacs-additional-packages
'(
  (chatgpt :location (recipe
                      :fetcher github
                      :repo "joshcho/ChatGPT.el"))
  ;; other additional packages...
  )

NOTE: Assumes Quelpa installation.

In packages.el ,

(package! chatgpt
  :recipe (:host github :repo "joshcho/ChatGPT.el" :files ("dist" "*.el")))

In config.el ,

(use-package! chatgpt
  :defer t
  :config
  (unless (boundp 'python-interpreter)
    (defvaralias 'python-interpreter 'python-shell-interpreter))
  (setq chatgpt-repo-path (expand-file-name "straight/repos/ChatGPT.el/" doom-local-dir))
  (set-popup-rule! (regexp-quote "*ChatGPT*")
    :side 'bottom :size .5 :ttl nil :quit t :modeline nil)
  :bind ("C-c q" . chatgpt-query))

Usage

  • Press C-c q to query ChatGPT.
  • Select region, then C-c q will prompt you to select a type: doc, bug, understand, or improve. Select a type to query ChatGPT with that prompt.
  • Try making queries in quick succession.
  • If your login is expired, try
pkill ms-playwright/firefox && chatgpt install

in the shell.

  • To reset your conversation, try M-x chatgpt-reset.

Troubleshooting

  • For most scenarios, the reliable method is pkill ms-playwright/firefox && chatgpt install to reauthenticate yourself.
  • Also try M-x chatgpt-reset.
  • If for some reason the ellipses keep blinking, try M-x chatgpt-stop.
  • Make sure you have python installed, and python-interpreter is set (most likely set it to “python” or “python3”).
  • If none of these methods work, please submit an issue.

Customization

Customize chatgpt-query-format-string-map for your own types.

(setq chatgpt-query-format-string-map '(
                                        ;; ChatGPT.el defaults
                                        ("doc" . "Please write the documentation for the following function.\n\n%s")
                                        ("bug" . "There is a bug in the following function, please help me fix it.\n\n%s")
                                        ("understand" . "What does the following function do?\n\n%s")
                                        ("improve" . "Please improve the following code.\n\n%s")
                                        ;; your new prompt
                                        ("my-custom-type" . "My custom prompt.\n\n%s")))

Misc.

  • Don’t use “custom” as a type. It’s reserved for custom prepend string through minibuffer.
  • Check out Pen.el

chatgpt.el's People

Contributors

cnsunyour avatar diamondbond avatar joshcho 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.