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
- Register OpenAI
- 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.). - Install Python dependencies:
pip3 install openai epc sexpdata six
. - Install markdown-mode
- Use
git clone
to download this repository and replace theload-path
path in the configuration below. - Add the following code to your configuration file
~/.emacs
:
(add-to-list 'load-path "<path-to-mind-wave>")
(require 'mind-wave)
Usage
Conversation Mode
- Create a
test.chat
file to automatically entermind-wave-chat-mode
. - Execute the command
mind-wave-chat-ask
(press Ctrl + j), input your question, and wait for ChatGPT to respond. - Execute the command
mind-wave-chat-continue
(press Ctrl + u) to continue the conversation. - 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:
- Execute the command
mind-wave-chat-ask-with-multiline
(press Ctrl + Shift + j), input multiple questions, and wait for ChatGPT to respond. - Execute the command
mind-wave-chat-ask-insert-line
to insert the----- User ------
separator, continue inputting multiple lines in the buffer, and finally executemind-wave-chat-ask-send-buffer
.
Document mode
Selected Content:
- Execute the command
mind-wave-translate-to-english
, ChatGPT will automatically replace the selected area with the translated content. - Execute the command
mind-wave-proofreading-doc
, ChatGPT will automatically replace the selected area with the polished document. - 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. - Execute the command
mind-wave-adjust-text
. ChatGPT will adjust the text or code according to your instructions. - Execute the command
mind-wave-check-typos
, ChatGPT will fix typos.
Code Mode
Move the cursor to the function you want to refactor.
- Execute the command
mind-wave-generate-code
, ChatGPT will output the code in the current buffer according to the prompt. - 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. - 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. - 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. - 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. - Execute the command
mind-wave-generate-commit-name
, ChatGPT will automatically analyze the current diff content and generate a patch name. - 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
- 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). - 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 themind-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 togpt-4
, asgpt-4
is slower - mind-wave-git-commit-model: Generate git diff model, default is
gpt-3.5-turbo
, it is not recommended to switch togpt-4
, asgpt-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:
- Install gdb and enable the option
(setq mind-wave-enable-debug t)
- Use the command
mind-wave-restart-process
to restart the MIND-WAVE process. - Send the contents of
*mind-wave*
window when the next crash occurs.
- Install gdb and enable the option