GithubHelp home page GithubHelp logo

mind-wave's Introduction

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 -U 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

mind-wave's People

Contributors

improve100 avatar manateelazycat avatar nasyxx avatar sawyerzheng avatar tennix avatar thanhvg avatar xashes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mind-wave's Issues

提供自定义储存路径

Instead of set-visited-file-name, possilbe /usr/define/location/as/prefix/?

mind-wave/mind-wave.el

Lines 420 to 426 in f9a2689

(defun mind-wave-parse-title--response (filename title)
(mind-wave--with-file-buffer
filename
(message "Generate title done.")
(set-visited-file-name (format "#%s#.chat" (string-replace "/" "_" title)))
(delete-file filename)
(save-buffer)))

[Proposal] remove ---- xxx ---- markers, user markdown headlines in chat mode

Replace usages of:

  • "------ User ------\n" marker with # > User:
  • "------ Assistant ------\n" with ## > Assistant:

Example:

# > User: hello

## > Assistant: Hello! How can I assist you today?

Benefit:

  • nice presentation, similar to markdown
  • built in support for imenu,
  • can hide and show chat nodes

I have a prototype here thanhvg@4995c7f if you think it's a good idea I can create a PR.

Thanks.

Is it possible to get API key from environment variable?

Playing around several tools and applications based on ChatGPT. Some of them get the API key through environment OPENAI_API_KEY. Do you think that will be better than source it from API txt file?

export OPENAI_API_KEY='your_api_key'

[Proposal] support Azure OpenAI API

I tried define these 3 variables:

  1. (setq mind-wave-api-base "<my azure openai api endpoint>")
  2. (setq mind-wave-api-type "azure")
  3. (setq mind-wave-api-version "2023-03-15-preview")

It's looks like there are some differences between OpenAI api and Azure OpenAI api.
doc: https://github.com/openai/openai-python

It will be great if mind-wave could support both.

Thanks

Enhancement: Model Selection Support for Elisp Function

Is your feature request related to a problem? Please describe.
Currently, the elisp function used to call the Python script for GPT model execution is hard-coded to work with a specific model: gpt-3.5-turbo. This limits the flexibility and adaptability of the code for users who may want to work with different models.

Describe the solution you'd like
I propose an enhancement to the elisp function to support model selection, allowing users to easily specify which GPT model they want to use. This can be achieved by accepting the model name as an argument and passing it to the Python script.

Proposed changes:

  1. Update the Python script to accept a model_name argument:
# python_script.py
import openai

def send_stream_request(model_name, messages, callback):
    response = openai.ChatCompletion.create(
        model=model_name,
        messages=messages,
        temperature=0,
        stream=True
    )
    # ...rest of the code
  1. Modify the elisp function to accept the desired model and pass it as an argument to the Python script:
(defun call-python-script-with-model (model)
  "Call the Python script with a specific model."
  (interactive "sEnter model name: ")
  (let ((python-command "python")
        (script-path "/path/to/your/python_script.py"))
    (call-process
     python-command
     nil
     "*Python Script Output*"
     nil
     script-path
     model)
    (switch-to-buffer "*Python Script Output*")))

Describe alternatives you've considered
An alternative solution is to use a configuration file to store the model name. However, this approach requires users to edit the configuration file every time they want to change the model, which is less convenient than simply passing the model name as an argument.

Additional context
This enhancement will provide users with greater flexibility in using various GPT models, making it easier to adapt the code for different use cases and improving the overall user experience.

LATEST MODEL DESCRIPTION MAX TOKENS TRAINING DATA
gpt-4 More capable than any GPT-3.5 model, able to do more complex tasks, and optimized for chat. Will be updated with our latest model iteration. 8,192 tokens Up to Sep 2021
gpt-4-0314 Snapshot of gpt-4 from March 14th 2023. Unlike gpt-4, this model will not receive updates, and will only be supported for a three month period ending on June 14th 2023. 8,192 tokens Up to Sep 2021
gpt-4-32k Same capabilities as the base gpt-4 mode but with 4x the context length. Will be updated with our latest model iteration. 32,768 tokens Up to Sep 2021
gpt-4-32k-0314 Snapshot of gpt-4-32 from March 14th 2023. Unlike gpt-4-32k, this model will not receive updates, and will only be supported for a three month period ending on June 14th 2023. 32,768 tokens Up to Sep 2021

It works but the output is in Chinese

Maybe that's deliberate, but as someone who one speaks one language it's not very useful.

I eventually hacked the lisp and python files to get it back to English.

openai.error.AuthenticationError: <empty message>

向 ChatGPT 发去问题,得到报错:

Wrote /home/mawen/chat/0005.chat
Wait ChatGPT...
[Mind-Wave] Traceback (most recent call last):
  File "/home/mawen/.emacs.d/site-lisp/mind-wave/mind_wave.py", line 38, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/home/mawen/.emacs.d/site-lisp/mind-wave/mind_wave.py", line 130, in send_stream_request
    response = openai.ChatCompletion.create(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mawen/.local/lib/python3.11/site-packages/openai/api_resources/chat_completion.py", line 25, in create
    return super().create(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mawen/.local/lib/python3.11/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
    response, _, api_key = requestor.request(
                           ^^^^^^^^^^^^^^^^^^
  File "/home/mawen/.local/lib/python3.11/site-packages/openai/api_requestor.py", line 230, in request
    resp, got_stream = self._interpret_response(result, stream)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mawen/.local/lib/python3.11/site-packages/openai/api_requestor.py", line 624, in _interpret_response
    self._interpret_response_line(
  File "/home/mawen/.local/lib/python3.11/site-packages/openai/api_requestor.py", line 687, in _interpret_response_line
    raise self.handle_error_response(
openai.error.AuthenticationError: <empty message>

这个 sk- 开头的 API key 在 Chrome 的 ChatHub 插件是能用的,应该能排除 key 过期的问题

路径有一些文件系统不太喜欢的一些字符 能不能给用户设一个选择 提供一种比较可靠的方式 来命名文件?

例子:
/PATH/#"Introducing the AI Language Model Assistant"#.chat

使用 gpt/hugo-slug-as-underscore 后:

/PATH/introducing_the_ai_language_model_assistant.chat

附,参考脚本

(defun gpt/hugo-slug-as-underscore (beg end)
  (interactive "r")
  (insert (gpt/org-hugo-slug (buffer-substring-no-properties
                             (region-beginning) (region-end))))
  (delete-region beg end))

(defun gpt/hugo-slug-as-underscore (beg end)
  (interactive "r")

  (insert (gpt/org-hugo-slug (buffer-substring-no-properties
                         (region-beginning) (region-end))))
  (delete-region beg end))

(defun gpt/org-hugo-slug (str &optional allow-double-hyphens)
  "See function `org-hugo-slug'"
  (let* ((str (downcase str))
         (str (replace-regexp-in-string "<\\(?1:[a-z]+\\)[^>]*>.*</\\1>" "" str))
         (str (replace-regexp-in-string (concat "\\](" ffap-url-regexp "[^)]+)") "]" str))
         (str (replace-regexp-in-string
               "&" " and "
               (replace-regexp-in-string
                "\\." " dot "
                (replace-regexp-in-string
                 "\\+" " plus " str))))
         (str (replace-regexp-in-string "[^[:alnum:]()]" " " str))
         (str (if (version< emacs-version "25.0")
                  (let ((multibyte-punctuations-str ""))
                    (replace-regexp-in-string (format "[%s]" multibyte-punctuations-str) " " str))
                str))
         (str (replace-regexp-in-string "\\(^[[:space:]]*\\|[[:space:]]*$\\)" "" str))
         (str (replace-regexp-in-string "[[:space:]]\\{2,\\}" " " str))
         (str (replace-regexp-in-string "\\s-*([[:space:]]*\\([^)]+?\\)[[:space:]]*)\\s-*" " -\\1- " str))
         (str (replace-regexp-in-string "[()]" "" str))
         (str (replace-regexp-in-string " " "_" str))
         (str (replace-regexp-in-string "\\(^[-]*\\|[-]*$\\)" "" str)))
    (unless allow-double-hyphens
      (setq str (replace-regexp-in-string "--" "_" str)))
    str))

加载 mind-wave 后,tramp 陷入无限嵌套

加载 mind-wave 后,使用 tramp 打开远程主机上的问题,报错

error: "Lisp nesting exceeds ‘max-lisp-eval-depth’"

错误堆栈如下(超出了 issue 最大长度,删除了其中一部分)

Debugger entered--Lisp error: (error "Lisp nesting exceeds ‘max-lisp-eval-depth’")
  signal(error ("Lisp nesting exceeds ‘max-lisp-eval-depth’"))
  tramp-error((tramp-file-name "ssh" "dell" nil "192.168.1.12" nil "/home/dell/xxx/xxx/code/pytorch-3dunet/" nil) error "Lisp nesting exceeds ‘max-lisp-eval-depth’")
  tramp-signal-hook-function(error ("Lisp nesting exceeds ‘max-lisp-eval-depth’"))
  (memq (car-safe cl-x) cl-struct-tramp-file-name-tags)
  (and (memq (car-safe cl-x) cl-struct-tramp-file-name-tags) t)
  (progn (and (memq (car-safe cl-x) cl-struct-tramp-file-name-tags) t))
  (or (progn (and (memq (car-safe cl-x) cl-struct-tramp-file-name-tags) t)) (signal 'wrong-type-argument (list 'tramp-file-name cl-x)))
  (progn (or (progn (and (memq (car-safe cl-x) cl-struct-tramp-file-name-tags) t)) (signal 'wrong-type-argument (list 'tramp-file-name cl-x))) (nth 1 cl-x))
  (let ((cl-x (tramp-dissect-file-name filename))) (progn (or (progn (and (memq (car-safe cl-x) cl-struct-tramp-file-name-tags) t)) (signal 'wrong-type-argument (list 'tramp-file-name cl-x))) (nth 1 cl-x)))
  (string= (let ((cl-x (tramp-dissect-file-name filename))) (progn (or (progn (and (memq (car-safe cl-x) cl-struct-tramp-file-name-tags) t)) (signal 'wrong-type-argument (list 'tramp-file-name cl-x))) (nth 1 cl-x))) tramp-adb-method)
  (and (tramp-tramp-file-p filename) (string= (let ((cl-x (tramp-dissect-file-name filename))) (progn (or (progn (and (memq ... cl-struct-tramp-file-name-tags) t)) (signal 'wrong-type-argument (list 'tramp-file-name cl-x))) (nth 1 cl-x))) tramp-adb-method))
  tramp-adb-file-name-p("/ssh:[email protected]:/home/dell/xxx/xxx...")
  tramp-find-foreign-file-name-handler("/ssh:[email protected]:/home/dell/xxx/xxx..." expand-file-name)
  tramp-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  (closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a))("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  cl-reduce((closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a)) ("/ssh:[email protected]:/home/dell/xxx/xxx..." "."))
  tramp-compat-file-name-concat("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  tramp-sh-handle-expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-handle-expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-sh-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-file-name-handler expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  (closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a))("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  cl-reduce((closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a)) ("/ssh:[email protected]:/home/dell/xxx/xxx..." "."))
  tramp-compat-file-name-concat("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  tramp-sh-handle-expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-handle-expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-sh-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-file-name-handler expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")

  ...

  expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  (closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a))("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  cl-reduce((closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a)) ("/ssh:[email protected]:/home/dell/xxx/xxx..." "."))
  tramp-compat-file-name-concat("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  tramp-sh-handle-expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-handle-expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-sh-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-file-name-handler expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  (closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a))("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  cl-reduce((closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a)) ("/ssh:[email protected]:/home/dell/xxx/xxx..." "."))
  tramp-compat-file-name-concat("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  tramp-sh-handle-expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-handle-expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-sh-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-file-name-handler expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  (closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a))("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  cl-reduce((closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a)) ("/ssh:[email protected]:/home/dell/xxx/xxx..." "."))
  tramp-compat-file-name-concat("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  tramp-sh-handle-expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-handle-expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-sh-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-file-name-handler expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  (closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a))("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  cl-reduce((closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a)) ("/ssh:[email protected]:/home/dell/xxx/xxx..." "."))
  tramp-compat-file-name-concat("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  tramp-sh-handle-expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-handle-expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-sh-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-file-name-handler expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  (closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a))("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  cl-reduce((closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a)) ("/ssh:[email protected]:/home/dell/xxx/xxx..." "."))
  tramp-compat-file-name-concat("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  tramp-sh-handle-expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-handle-expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-sh-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-file-name-handler expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  (closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a))("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  cl-reduce((closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a)) ("/ssh:[email protected]:/home/dell/xxx/xxx..." "."))
  tramp-compat-file-name-concat("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  tramp-sh-handle-expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-handle-expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-sh-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-file-name-handler expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  (closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a))("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  cl-reduce((closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a)) ("/ssh:[email protected]:/home/dell/xxx/xxx..." "."))
  tramp-compat-file-name-concat("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  tramp-sh-handle-expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-handle-expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-sh-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-file-name-handler expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  (closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a))("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  cl-reduce((closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a)) ("/ssh:[email protected]:/home/dell/xxx/xxx..." "."))
  tramp-compat-file-name-concat("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  tramp-sh-handle-expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-handle-expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-sh-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-file-name-handler expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  (closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a))("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  cl-reduce((closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a)) ("/ssh:[email protected]:/home/dell/xxx/xxx..." "."))
  tramp-compat-file-name-concat("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  tramp-sh-handle-expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-handle-expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-sh-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-file-name-handler expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  (closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a))("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  cl-reduce((closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a)) ("/ssh:[email protected]:/home/dell/xxx/xxx..." "."))
  tramp-compat-file-name-concat("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  tramp-sh-handle-expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-handle-expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-sh-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-file-name-handler expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  (closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a))("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  cl-reduce((closure ((parts "/ssh:[email protected]:/home/dell/xxx/xxx..." ".") t) (a b) (expand-file-name b a)) ("/ssh:[email protected]:/home/dell/xxx/xxx..." "."))
  tramp-compat-file-name-concat("/ssh:[email protected]:/home/dell/xxx/xxx..." ".")
  tramp-sh-handle-expand-file-name("." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-handle-expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-sh-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  apply(tramp-sh-file-name-handler expand-file-name ("." "/ssh:[email protected]:/home/dell/xxx/xxx..."))
  tramp-file-name-handler(expand-file-name "." "/ssh:[email protected]:/home/dell/xxx/xxx...")
  file-system-info(".")
  get-free-disk-space(".")
  tramp-sh-handle-insert-directory("/ssh:[email protected]:/home/dell/xxx/xxx..." "--dired -lXh" nil t)
  apply(tramp-sh-handle-insert-directory ("/ssh:[email protected]:/home/dell/xxx/xxx..." "--dired -lXh" nil t))
  tramp-sh-file-name-handler(insert-directory "/ssh:[email protected]:/home/dell/xxx/xxx..." "--dired -lXh" nil t)
  apply(tramp-sh-file-name-handler insert-directory ("/ssh:[email protected]:/home/dell/xxx/xxx..." "--dired -lXh" nil t))
  tramp-file-name-handler(insert-directory "/ssh:[email protected]:/home/dell/xxx/xxx..." "--dired -lXh" nil t)
  #f(compiled-function (file switches &optional wildcard full-directory-p) "Insert directory listing for FILE, formatted according to SWITCHES.\nLeaves point after the inserted text.\nSWITCHES may be a string of options, or a list of strings\nrepresenting individual options.\nOptional third arg WILDCARD means treat FILE as shell wildcard.\nOptional fourth arg FULL-DIRECTORY-P means file is a directory and\nswitches do not contain `d', so that a full listing is expected.\n\nThis works by running a directory listing program\nwhose name is in the variable `insert-directory-program'.\nIf WILDCARD, it also runs the shell specified by `shell-file-name'.\n\nWhen SWITCHES contains the long `--dired' option, this function\ntreats it specially, for the sake of dired.  However, the\nnormally equivalent short `-D' option is just passed on to\n`insert-directory-program', as any other option." #<bytecode -0x2b943892e8008b8>)("/ssh:[email protected]:/home/dell/xxx/xxx..." "--dired -lXh" nil t)
  ls-lisp--insert-directory(#f(compiled-function (file switches &optional wildcard full-directory-p) "Insert directory listing for FILE, formatted according to SWITCHES.\nLeaves point after the inserted text.\nSWITCHES may be a string of options, or a list of strings\nrepresenting individual options.\nOptional third arg WILDCARD means treat FILE as shell wildcard.\nOptional fourth arg FULL-DIRECTORY-P means file is a directory and\nswitches do not contain `d', so that a full listing is expected.\n\nThis works by running a directory listing program\nwhose name is in the variable `insert-directory-program'.\nIf WILDCARD, it also runs the shell specified by `shell-file-name'.\n\nWhen SWITCHES contains the long `--dired' option, this function\ntreats it specially, for the sake of dired.  However, the\nnormally equivalent short `-D' option is just passed on to\n`insert-directory-program', as any other option." #<bytecode -0x2b943892e8008b8>) "/ssh:[email protected]:/home/dell/xxx/xxx..." "--dired -lXh" nil t)
  apply(ls-lisp--insert-directory #f(compiled-function (file switches &optional wildcard full-directory-p) "Insert directory listing for FILE, formatted according to SWITCHES.\nLeaves point after the inserted text.\nSWITCHES may be a string of options, or a list of strings\nrepresenting individual options.\nOptional third arg WILDCARD means treat FILE as shell wildcard.\nOptional fourth arg FULL-DIRECTORY-P means file is a directory and\nswitches do not contain `d', so that a full listing is expected.\n\nThis works by running a directory listing program\nwhose name is in the variable `insert-directory-program'.\nIf WILDCARD, it also runs the shell specified by `shell-file-name'.\n\nWhen SWITCHES contains the long `--dired' option, this function\ntreats it specially, for the sake of dired.  However, the\nnormally equivalent short `-D' option is just passed on to\n`insert-directory-program', as any other option." #<bytecode -0x2b943892e8008b8>) ("/ssh:[email protected]:/home/dell/xxx/xxx..." "--dired -lXh" nil t))
  insert-directory("/ssh:[email protected]:/home/dell/xxx/xxx..." "--dired -lXh" nil t)
  dired-insert-directory("/ssh:[email protected]:/home/dell/xxx/xxx..." "-lXh" nil nil t)
  dired-readin-insert()
  #f(compiled-function () #<bytecode -0x72b2d1df96e760>)()
  combine-change-calls-1(1 1 #f(compiled-function () #<bytecode -0x72b2d1df96e760>))
  dired-readin()
  dired-internal-noselect("/ssh:[email protected]:/home/dell/xxx/xxx..." nil)
  dired-noselect("/ssh:[email protected]:/home/dell/xxx/xxx...")
  run-hook-with-args-until-success(dired-noselect "/ssh:[email protected]:/home/dell/xxx/xxx...")
  find-file-noselect("/ssh:[email protected]:/home/dell/xxx/xxx..." nil nil nil)
  find-file-other-window("/ssh:[email protected]:/home/dell/xxx/xxx...")
  org-open-file("/ssh:[email protected]:/home/dell/xxx/xxx..." nil)
  apply(org-open-file "/ssh:[email protected]:/home/dell/xxx/xxx..." nil nil)
  org-link-open-as-file("/ssh:[email protected]:/home/dell/xxx/xxx..." nil)
  org-link-open((link (:type "file" :path "/ssh:[email protected]:/home/dell/xxx/xxx..." :format bracket :raw-link "file:/ssh:[email protected]:/home/dell/xxx/xxx..." :application nil :search-option nil :begin 2950 :end 3033 :contents-begin nil :contents-end nil :post-blank 4 :parent (paragraph (:begin 2938 :end 3112 :contents-begin 2938 :contents-end 3111 :post-blank 1 :post-affiliated 2938 :parent nil)))) nil)
  org-open-at-point()
  (lambda nil (interactive) (org-open-at-point) (delete-other-windows))()
  funcall-interactively((lambda nil (interactive) (org-open-at-point) (delete-other-windows)))
  call-interactively((lambda nil (interactive) (org-open-at-point) (delete-other-windows)) nil nil)
  command-execute((lambda nil (interactive) (org-open-at-point) (delete-other-windows)))

mind-wave 加载和配置代码如下

(add-to-list 'load-path (expand-file-name "elpa-alone/mind-wave" user-emacs-directory))
(require 'mind-wave)
(setq mind-wave-auto-change-title nil)

注释掉上述加载代码后,tramp 可正常打开

No response.

Execute C-j with a question, it saids Wait ChatGpt..., but no response can received, and also nothing show in *mind-wave*.

文档如果存在某种字符串的格式会导致无响应

当前文档如果存在某种字符串的格式会导致无响应.
下文是这个出问题的文档.
还附了一个出问题的视频.

------ User ------
什么是人类的落日?


------ Assistant ------ "人类的落日"是一个比喻,指的是人类文明的衰落和
灭亡。这个比喻通常用来描述一些重大的历史事件或者趋势,比如战争、自然灾
害、环境破坏、文化冲突等等,这些事件或趋势可能会导致人类文明的崩溃和衰
落。


------ User ------
为什么人类会衰落?

It's not working .... (I am typing....)


------ User ------
为什么人类会衰落?


------ Assistant ------
人类会衰落的原因有很多,以下是一些可能的原因:

1. 自然灾害:自然灾害如地震、洪水、飓风等可能会破坏人类的基础设施和生产力,导致经济崩溃和社会动荡。

2. 环境破坏:人类对环境的过度开发和污染可能会导致生态系统的崩溃,影响人类的生存和发展。

3. 资源枯竭:人类对自然资源的过度开采和消耗可能会导致资源的枯竭,影响经济和社会的发展。

4. 社会动荡:政治动荡、战争、恐怖主义等社会动荡可能会导致社会秩序的崩溃和经济的衰退。

5. 科技进步:科技进步可能会导致社会结构的变化和经济的转型,但也可能会导致失业和社会不平等的加剧。

这些因素可能相互作用,导致人类文明的衰落和灭亡。

Good! (I am typing....)
doom-day.mp4

Issue with get_chunk_result

After installing dependencies I had an issue with the get_chunk_result function in mind_wave.py. The attributes being checked for were never found. Not sure if it's a python 3.10 issue.

This correctly checks the chunk

def get_chunk_result(self, chunk):
        delta = chunk.choices[0].delta
        if chunk.choices[0].finish_reason == "stop":
            return ("end", "")

        # Check if delta has the attribute 'role'
        if hasattr(delta, 'role') and delta.role is not None:
            return ("start", "")
    
        # Check if delta has the attribute 'content'
        if hasattr(delta, 'content') and delta.content is not None:
            return ("content", string_to_base64(delta.content))            

        # Handle any other case not covered above
        return ("unknown", "")

No line breaks in code examples when chat becomes long.

Hi, thanks for this awesome package. I am encountering a weird behaviour in chat mode, seeking any hints to troubleshoot it.

In chat mode when I ask about a coding problem, in the first couples question I would get nice response with code examples properly formatted. But then after that, chatgpt would reply code examples without any line breaks. Just one line. I ask it to reformat it, sometimes it does sometimes doesn't. If I start a new conversation with the same last question from previous chat, the output from chatgpt is fine again.

I don't think my chat reaches the token limit otherwise it would throw error in *mind-wave* buffer.

Do you have this issue on your side?

[feature request] system prompt

猫大,很喜欢mind-wave,在网络顺畅的时候很好用。

有些 ChatGPT 的应用,主打对话,会针对不同场景做 system prompt。

为 mind-wave 引入 system prompt 的一种方式是 (与其他 app 的思路相同):
设计不同场景下的 *.chat 文件,在最开头写入这种场景的 system prompt 【下图为一个典型例子】
image

但应该还有其他解决思路,请问猫大是否觉得 system prompt 的引入会帮助 mind-wave 性能的提升?比如在文档模式、摘要模式、代码模式等等。

GPT 4 之后会对系统 Prompt 会非常敏感 相对于 GPT 3 是一个长足的进步 我们现在能不能提供一个接口留给系统 Prompt?

可以参考下方的函数

(system-prompt (or (cdr (assoc prompt-identifier chatgpt-arcana-system-prompts-alist))
                            chatgpt-arcana-fallback-system-prompt))
                            
(defcustom chatgpt-arcana-system-prompts-alist
  '((programming-prompt . "You are a large language model living inside Emacs, and the perfect programmer. You may only respond with concise code unless explicitly asked. ")
    (writing-prompt . "You are a large language model living inside Emacs, and an excellent writing assistant. Respond concisely and carry out instructions. ")
    (chat-prompt . "You are a large language model living inside Emacs, and an excellent conversation partner. Respond concisely. "))
  "An alist that maps system prompt identifiers to actual system prompts."
  :type '(alist :key-type symbol :value-type string)
  :group 'chatgpt-arcana)                            

之后可以接入类似于这种别人提供好的接口

https://github.com/f/awesome-chatgpt-prompts/blob/main/prompts.csv

提供一个更好的输出选项?

目前 在我有限的了解下, MineWave 中许多函数的返回内容,很多时候都是返
回到一个独立的 buffer 内容下。 能不能提供一个选项, 这样可以使我在任何
地方都可以调用这个函数, 它的返回值指向一个比如说,Temp Buffer, 然后
这个 Temp Buffer 内容可以被Postframe去读取 展示在当前的buffer下 这样的
话根据不同的场景用户可以选择插入, 改写,或者关闭,从而不打乱整体的frame
window布局?

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.