Skip to content

Pavinberg/qwen-chat-shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qwen-chat-shell

Qwen chat shell in Emacs with Org Babel, inspired by chatgpt-shell. Qwen is the large-scale language model developed by Alibaba Cloud. You can find more information in this blog. Using Qwen is more convenient and cost-effective in China and it should behave better in the Chinese context.

Usage

Installation

Install with MELPA M-x package-install qwen-chat-shell.

If using use-package,

(use-package qwen-chat-shell
  :ensure t)

Configure Dashscope Key

Visit Dashscope and follow the instructions to create your API-key. The key could be something like sk-abcdefghijkl1234567890. You can configure the key by adding configuration directly:

(use-package qwen-chat-shell
  :ensure t
  :custom
  (qwen-chat-shell-dashscope-key . "sk-abcdefghijkl1234567890"))

Launch the shell

Type M-x qwen-chat-shell.

Input help to get all the available commands and their shortcuts. For example, choose the model with M-x qwen-chat-shell-switch-model-version. Change the prompt with M-x qwen-chat-shell-switch-system-prompt.

Org babel integration

Code block answered by the LLM could be

Customization

The available models are stored in variable qwen-chat-shell-available-models, default to

("qwen2-0.5b-instruct"
 "qwen2-1.5b-instruct"
 "qwen2-7b-instruct"
 "qwen2-72b-instruct"
 "qwen2-57b-a14b-instruct"
 "qwen1.5-0.5b-chat"
 "qwen1.5-1.8b-chat"
 "qwen1.5-7b-chat"
 "qwen1.5-14b-chat"
 "qwen1.5-32b-chat"
 "qwen1.5-72b-chat"
 "qwen1.5-110b-chat"
 "qwen-1.8b-chat"
 "qwen-7b-chat"
 "qwen-14b-chat"
 "qwen-72b-chat"
 "codeqwen1.5-7b-chat"
 "qwen-turbo"
 "qwen-plus"
 "qwen-max"
 "qwen-max-0428"
 "qwen-max-longcontext"
 "qwen-long"
 "qwen-1.8b-longcontext-chat")

Change the default model chosen by M-x customize-variable qwen-chat-shell-current-model, set the value to the model name above or its index in the list.

You can also configure it by:

(use-package qwen-chat-shell
  :ensure t
  :config
  (setq qwen-chat-shell-dashscope-key "sk-abcdefghijkl1234567890")
  (setq qwen-chat-shell-current-model "qwen2-7b-instruct"))

Bultin prompts

M-x customize-variable qwen-chat-shell-system-prompts lists the default system prompts for chat. When chatting, use C-c C-s ( qwen-chat-shell-switch-system-prompt ) to change the prompt.

There are also some builtin commands to make life easier:

CommandAction
qwen-chat-shell-translate-to-englishTranslate text to English
qwen-chat-shell-translate-to-chineseTranslate text to Chinese
qwen-chat-shell-proofread-regionProofread English
qwen-chat-shell-describe-codeDescribe the meaning of code
qwen-chat-shell-generate-unit-testGenerate unit test for the code
qwen-chat-shell-write-git-commitWrite commit message
qwen-chat-shell-refactor-codeRefactor code

For example, to translate English to Chinese, select a region and call the command M-x qwen-chat-shell-translate-to-english .

Future work

  • Use qwen-vl to describe image.

About

Qwen chat shell in Emacs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published