Exhub is an Elixir-powered enhancement plugin for Emacs, based on WebSocket communication. It facilitates real-time interaction and communication between Emacs and the Elixir server.
- WebSocket Communication: Establishes a bi-directional connection between Emacs and Elixir using WebSockets.
- Message Handling: Enables sending and receiving messages between Emacs and the Elixir server.
- Erlang/Elixir Backend: Leverages Elixir and Erlang for robust backend processing.
- Emacs Integration: Provides Emacs Lisp functions to interact seamlessly with the Elixir server.
-
Clone the Repository:
git clone https://github.com/edmondfrank/exhub.git cd exhub
-
Install Dependencies:
mix deps.get
-
Configuration:
The configuration for Exhub is managed in config/config.exs
. Here are the relevant settings:
-
LLM Configuration:
config :exhub, llm: %{ model: "Qwen/Qwen2.5-7B-Instruct", api_base: "https://ai.gitee.com/v1" }
-
Langchain Configuration:
config :langchain, openai_key: "your api key"
-
Build:
MIX_ENV=prod mix release
-
Run the Server:
_build/prod/rel/exhub/bin/exhub start
- Install the Emacs Package:
Add the following to your Emacs configuration file (e.g.,
~/.emacs.d/init.el
):(add-to-list 'load-path (expand-file-name "site-lisp/exhub" user-emacs-directory)) (require 'exhub) (exhub-start-elixir) (exhub-start)
Use the exhub-send
function to send messages to the Elixir server:
(exhub-send "your message here")
The exhub-chat
package provides chat functionality for Emacs using Exhub.
Add the following to your Emacs configuration file (e.g., ~/.emacs.d/init.el
):
(require 'exhub-chat)
exhub-chat
: Start a chat session with Exhub.exhub-chat-with-multiline
: Start a chat session with Exhub using a multiline input buffer.
exhub-chat-generate-code
: Generate code using Exhub.exhub-chat-adjust-code
: Adjust code using Exhub.exhub-chat-comment-code
: Add comments to code using Exhub.exhub-chat-refactory-code
: Refactor code using Exhub.exhub-chat-format-code
: Format code using Exhub.
exhub-chat-polish-document
: Polish and proofread a document using Exhub.
exhub-chat-explain-code
: Explain code using Exhub.
exhub-chat-generate-commit-message
: Generate a commit message using Exhub.
exhub-chat-translate-into-chinese
: Translate text into Chinese using Exhub.exhub-chat-translate-into-english
: Translate text into English using Exhub.
exhub-chat-choose-drafts
: Choose from saved drafts using Exhub.
The exhub-translate
package provides translation functionality for Emacs using Exhub.
Add the following to your Emacs configuration file (e.g., ~/.emacs.d/init.el
):
(require 'exhub-translate)
exhub-translate-insert
: Insert translation based on the current mode.exhub-translate-insert-original-translation
: Insert original translation.exhub-translate-insert-with-line
: Insert translation with line style.exhub-translate-insert-with-underline
: Insert translation with underline style.exhub-translate-insert-with-camel
: Insert translation with camel case style.
exhub-translate-replace
: Replace the current symbol with its translation.exhub-translate-replace-with-line
: Replace with line style.exhub-translate-replace-with-underline
: Replace with underline style.exhub-translate-replace-with-camel
: Replace with camel case style.
exhub-translate-posframe
: Show translation in a posframe.