• Stars
    star
    137
  • Rank 266,121 (Top 6 %)
  • Language
    Emacs Lisp
  • License
    GNU General Publi...
  • Created over 1 year ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Emacs AI plugin based on ChatGPT API

English | 简体中文

mind-wave

mind-wave is an Emacs AI plugin developed using ChatGPT API, which can be deeply integrated into Emacs to improve its efficiency in various aspects.

As mind-wave is developed based on multithreading technology, ChatGPT will not block Emacs during calculation.

Installation

  1. Register OpenAI
  2. Obtain OpenAI API Key, and save the API Key to the ~/.emacs.d/mind-wave/chatgpt_api_key.txt file (Or set the environment variable OPENAI_API_KEY.).
  3. Install Python dependencies: pip3 install openai epc sexpdata six.
  4. Install markdown-mode
  5. Use git clone to download this repository and replace the load-path path in the configuration below.
  6. Add the following code to your configuration file ~/.emacs:
(add-to-list 'load-path "<path-to-mind-wave>")

(require 'mind-wave)

Usage

Conversation Mode

  1. Create a test.chat file to automatically enter mind-wave-chat-mode.
  2. Execute the command mind-wave-chat-ask (press Ctrl + j), input your question, and wait for ChatGPT to respond.
  3. Execute the command mind-wave-chat-continue (press Ctrl + u) to continue the conversation.
  4. Execute the command mind-wave-chat-generate-title (press Ctrl + i) to generate a new title based on the content.

If you want to change the topic, create a new *.chat file and continue asking ChatGPT questions.

Multi-line Input

There are two ways of inputting multi-line content:

  1. Execute the command mind-wave-chat-ask-with-multiline (press Ctrl + Shift + j), input multiple questions, and wait for ChatGPT to respond.
  2. Execute the command mind-wave-chat-ask-insert-line to insert the ----- User ------ separator, continue inputting multiple lines in the buffer, and finally execute mind-wave-chat-ask-send-buffer.

Document mode

Selected Content:

  1. Execute the command mind-wave-translate-to-english, ChatGPT will automatically replace the selected area with the translated content.
  2. Execute the command mind-wave-proofreading-doc, ChatGPT will automatically replace the selected area with the polished document.
  3. Execute the command mind-wave-explain-word, ChatGPT will automatically explain the meaning of the words in the current sentence and provide similar example sentences.
  4. Execute the command mind-wave-adjust-text. ChatGPT will adjust the text or code according to your instructions.
  5. Execute the command mind-wave-check-typos, ChatGPT will fix typos.

Code Mode

Move the cursor to the function you want to refactor.

  1. Execute the command mind-wave-generate-code, ChatGPT will output the code in the current buffer according to the prompt.
  2. Execute the command mind-wave-refactory-code, ChatGPT will automatically split the screen and display the refactored code and suggestions on the right side of the screen.
  3. Execute the command mind-wave-comment-code, ChatGPT will automatically split the screen and display the commented code on the right side of the screen.
  4. Execute the command mind-wave-explain-code, ChatGPT will automatically split the screen and display the explanation of the code on the right side of the screen.
  5. Execute the command mind-wave-explain-point, ChatGPT will automatically split the screen and display the explanation of the API at the cursor position on the right side of the screen.
  6. Execute the command mind-wave-generate-commit-name, ChatGPT will automatically analyze the current diff content and generate a patch name.
  7. Execute the command mind-wave-refactory-code-with-input, ChatGPT will automatically split the screen and display the refactored code and suggestions on the right side of the screen according to your prompt.

Code-related commands will automatically adjust the window layout, and you can use mind-wave-restore-window-configuration to restore the previous window layout at any time.

Summary Mode

  1. Open a video website and execute the command mind-wave-summary-video. ChatGPT will automatically retrieve the video subtitles and analyze the summary of the video (YouTube Transcript API installation is required).
  2. Open a text website and execute the command mind-wave-summary-web. ChatGPT will automatically retrieve the core content of the webpage and analyze the summary of the webpage (nodejs-readability-cli installation is required).

Model Selection

mind-wave defaults to using the gpt-3.5-turbo model. If you have already received an internal testing invitation from OpenAI, you can set the following models to gpt-4 or gpt-4-32k.

  • mind-wave-chat-model: Chat file conversation model, default is gpt-3.5-turbo, you can use the mind-wave-chat-model command to switch models
  • mind-wave-async-text-model: Asynchronous text model, default is gpt-3.5-turbo
  • mind-wave-action-code-model: Asynchronous code model, default is gpt-3.5-turbo
  • mind-wave-explain-word-model: English word explanation model, default is gpt-3.5-turbo
  • mind-wave-parse-title-model: Analyze chat file title model, default is gpt-3.5-turbo, it is not recommended to switch to gpt-4, as gpt-4 is slower
  • mind-wave-git-commit-model: Generate git diff model, default is gpt-3.5-turbo, it is not recommended to switch to gpt-4, as gpt-4 is slower

Feedback Issues

Please use the command emacs -q and only add the mind-wave configuration for comparison testing. If emacs -q can work properly, please check your personal configuration file.

If the problem still exists in the emacs -q environment, please submit an issue and attach the contents of the *mind-wave* window to help us troubleshoot. There are many clues there that can help us investigate the problem.

  • If you encounter a crash, please collect the crash information using the following steps:
    1. Install gdb and enable the option (setq mind-wave-enable-debug t)
    2. Use the command mind-wave-restart-process to restart the MIND-WAVE process.
    3. Send the contents of *mind-wave* window when the next crash occurs.

Contributor

More Repositories

1

lazycat-emacs

Andy Stewart's emacs
Emacs Lisp
425
star
2

aweshell

Awesome shell extension base on eshell with wonderful features!
Emacs Lisp
395
star
3

snails

A modern, easy-to-expand fuzzy search framework
Emacs Lisp
386
star
4

awesome-tab

Emacs package to provide out-of-the-box configuration to use tabs.
Emacs Lisp
364
star
5

deepin-terminal

Deepin Terminal written by vala
Vala
257
star
6

awesome-tray

Hide mode-line, display necessary information at right of minibuffer.
Emacs Lisp
233
star
7

nox

Nox is a lightweight, high-performance LSP client for Emacs
Emacs Lisp
206
star
8

color-rg

Search and refactoring tool based on ripgrep.
Emacs Lisp
149
star
9

popweb

Show popup web window for Emacs
JavaScript
142
star
10

company-english-helper

English helper base on Emacs company-mode
Emacs Lisp
99
star
11

insert-translated-name

Insert translated string as variable or function name
Emacs Lisp
87
star
12

awesome-pair

Auto parenthesis pairing with syntax table
Emacs Lisp
76
star
13

auto-save

Automatically save files without temporary files to protect your finger. ;)
Emacs Lisp
73
star
14

blink-search

In the blink of an eye, the search is complete
Emacs Lisp
72
star
15

sdcv

Emacs interface for sdcv (Stardict console version)
Emacs Lisp
64
star
16

deno-bridge

Build bridge between Emacs and Deno, execution of JavaScript and Typescript within Emacs.
Emacs Lisp
59
star
17

deepin-software-center

Software center for linux deepin.
Python
51
star
18

manateelazycat.github.io

My personal blog
HTML
50
star
19

deepin-screen-recorder

Deepin screen recorder
C++
50
star
20

holo-layer

HoloLayer is a multimedia layer plugin designed specifically for Emacs
Emacs Lisp
48
star
21

grammatical-edit

Grammatical edit base on tree-sitter
Emacs Lisp
47
star
22

hammerspoon-config

My config for Hammerspoon Window Manager
Lua
46
star
23

thing-edit

Copy and paste anything under cursor.
Emacs Lisp
46
star
24

sort-tab

Smarter tab solution for Emacs, sort tab with using frequency.
Emacs Lisp
44
star
25

deepin-system-monitor

System monitor for deepin
C++
41
star
26

instant-rename-tag

Instant rename tag
Emacs Lisp
32
star
27

python-bridge

Write Emacs Plugin by Python, split code from EAF.
Emacs Lisp
32
star
28

lazy-load

Lazy load keys for speed ​​up Emacs startup.
Emacs Lisp
30
star
29

deepin-pinyin-assistant

Deepin pinyin assistant
C
27
star
30

fingertip

Fingertip is struct edit plugin that base on treesit
Emacs Lisp
26
star
31

deepin-editor

Simple note application for deepin
C++
24
star
32

markmacro

Keyboard macro for marked regions
Emacs Lisp
21
star
33

one-key

Many commands share one key.
Emacs Lisp
20
star
34

mrkeyboard

Mr. Keyboard
Vala
17
star
35

grep-dired

Find name with given regexp, and show in dired.
Emacs Lisp
16
star
36

lazycat-theme

Cool hacker's emacs theme, but won't hurt your eye
Emacs Lisp
16
star
37

nova

Nova is a multi-threaded remote access plugin designed specifically for Emacs, with outstanding file synchronization performance.
Emacs Lisp
16
star
38

multi-term

Managing multiple terminal buffers in Emacs.
Emacs Lisp
15
star
39

corfu-english-helper

English helper for Emacs, base on corfu-mode
Emacs Lisp
15
star
40

deepin-voice-recorder

Voice recorder application for deepin
C++
15
star
41

lazy-search

Mark current symbol and jump in all matching symbols.
Emacs Lisp
15
star
42

lsp-bridge

Fastest LSP client for Emacs, work in progress...
Python
14
star
43

deepin-picker

Color picker tool for deepin
C++
13
star
44

css-sort

An Emacs extension you can sort CSS attributables automatically.
Emacs Lisp
13
star
45

tower-ng

Use rails write web todo-list tool like https://tower.im, this project is just a learning project
Ruby
12
star
46

smart-align

Smart align block around cursor
Emacs Lisp
11
star
47

delete-block

Delete block effectively
Emacs Lisp
10
star
48

recursive-search-references

Find function references in directory
Emacs Lisp
9
star
49

deepin-desktop-monitor

Deepin Desktop Monitor
C++
8
star
50

key-echo

Key-Echo is an Emacs plugin that uses XRecord technology to listen to system key events
Emacs Lisp
8
star
51

highlight-matching-tag

This plugin will highlight matching tag instantaneously.
Emacs Lisp
8
star
52

bison

Mode to editing bision source code in Emacs
Emacs Lisp
8
star
53

wraplish

Wraplish 是一个在 Unicode 与英文之间加上空格的Emacs插件,
Emacs Lisp
7
star
54

duplicate-line

Duplicate line or region, don't need move cursor.
Emacs Lisp
7
star
55

flex

It's a mode for flex files that provide better syntax highlight than flex-mode.el
Emacs Lisp
7
star
56

watch-other-window

Scroll other window and keep current window's position.
Emacs Lisp
7
star
57

find-define

Jump to the definition of a function or variable
Emacs Lisp
6
star
58

deepin-gnome-shell-3.4.1

Deepin gnome shell 3.4.1
C
6
star
59

move-text

Move current line or region
Emacs Lisp
6
star
60

deepin-translate-tools

Translate tools for deepin linux.
Python
6
star
61

vi-navigate

Navigate read-only buffer like vi behavior.
Emacs Lisp
6
star
62

html-to-word

This is a HTML to Word conversion library for Rails.
Ruby
6
star
63

manateelazycat

Github profile repo
5
star
64

cache-path-from-shell

Provide a chache mechanism make sure exec-path-from-shell just execute once.
Emacs Lisp
5
star
65

find-orphan

Find orphan function that need remove
Emacs Lisp
5
star
66

open-newline

Open newline like vi.
Emacs Lisp
4
star
67

toggle-one-window

Toggle between window layout and one window.
Emacs Lisp
4
star
68

lazycat-gs-theme

Gnome shell for my own use
Shell
3
star
69

manatee

Manatee Integrate Live Environment
Haskell
3
star
70

deb2po

Convert format between *.debian and *.po file.
Python
3
star
71

effortless-indent

Indent paste code without additional selection operations
Emacs Lisp
3
star
72

lazycat-emacs-time-machine

The elisp code that has been tossed, no longer used, archived to commemorate
Emacs Lisp
3
star
73

deno-bridge-ts

Build bridge between Emacs and Deno, execution of JavaScript and Typescript within Emacs, this repo is TypeScript part for deno-bridge
TypeScript
1
star