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.
Install with MELPA M-x package-install
qwen-chat-shell
.
If using use-package,
(use-package qwen-chat-shell
:ensure t)
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"))
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
.
Code block answered by the LLM could be
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"))
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:
Command | Action |
---|---|
qwen-chat-shell-translate-to-english | Translate text to English |
qwen-chat-shell-translate-to-chinese | Translate text to Chinese |
qwen-chat-shell-proofread-region | Proofread English |
qwen-chat-shell-describe-code | Describe the meaning of code |
qwen-chat-shell-generate-unit-test | Generate unit test for the code |
qwen-chat-shell-write-git-commit | Write commit message |
qwen-chat-shell-refactor-code | Refactor code |
For example, to translate English to Chinese, select a region and call the command M-x
qwen-chat-shell-translate-to-english
.
- Use
qwen-vl
to describe image.