Update ai stuff
This commit is contained in:
@@ -3865,27 +3865,39 @@ one of the normal rainbow-delimiters-depth-N-face faces."
|
||||
:custom
|
||||
(minuet-provider 'openai-fim-compatible)
|
||||
(minuet-n-completions 1)
|
||||
(minuet-context-window 512)
|
||||
;; (minuet-context-window 16000)
|
||||
(minuet-request-timeout 5)
|
||||
(minuet-auto-suggestion-throttle-delay 0.0)
|
||||
:config
|
||||
(evil-define-key 'insert minuet-active-mode
|
||||
(kbd "<escape>") #'minuet-dismiss-suggestion)
|
||||
;; Llama.cpp (backend used in LocalAI) does not support the `suffix` option in
|
||||
;; FIM completion. Therefore, we must disable it and manually populate the
|
||||
;; special tokens required for FIM completion.
|
||||
(defun my/-minuet-llama-cpp-fim-qwen-prompt-function (ctx)
|
||||
(format "<|fim_prefix|>%s\n%s<|fim_suffix|>%s<|fim_middle|>"
|
||||
(plist-get ctx :language-and-tab)
|
||||
(plist-get ctx :before-cursor)
|
||||
(plist-get ctx :after-cursor)))
|
||||
(setq minuet-openai-fim-compatible-options
|
||||
`(:model "qwen3-32b-coding"
|
||||
`(:model "qwen2.5-coder-32b-instruct-q4_k_m"
|
||||
:end-point ,(format "https://%s/v1/completions"
|
||||
(my/get-private 'localai-host))
|
||||
:api-key "TERM"
|
||||
:name "LocalAI"
|
||||
:template (:prompt minuet--default-fim-prompt-function
|
||||
:suffix minuet--default-fim-suffix-function)
|
||||
:template (:prompt my/-minuet-llama-cpp-fim-qwen-prompt-function
|
||||
:suffix nil)
|
||||
;; a list of functions to transform the end-point, headers, and body
|
||||
:transform ()
|
||||
;; function to extract LLM-generated text from JSON output
|
||||
:get-text-fn minuet--openai-fim-get-text-fn
|
||||
:optional (:top_p 0.9
|
||||
:max_tokens 1024))))
|
||||
:optional (:top_p 0.9))))
|
||||
|
||||
;; chatting
|
||||
(use-package gptel
|
||||
:defer t
|
||||
:hook (gptel-mode . my/-setup-gptel-mode)
|
||||
:custom-face (pulse-highlight-start-face ((default (:background "gray20"))))
|
||||
:init
|
||||
(defvar-keymap my/gptel-map
|
||||
:prefix 'my/gptel-prefix-map
|
||||
@@ -3900,6 +3912,24 @@ one of the normal rainbow-delimiters-depth-N-face faces."
|
||||
"q" #'gptel-abort)
|
||||
(keymap-global-set "C-c y" #'my/gptel-prefix-map)
|
||||
:config
|
||||
(defun my/-setup-gptel-mode ()
|
||||
"Set up `gptel-mode'."
|
||||
(setq-local show-trailing-whitespace nil))
|
||||
(defun my/-gptel-fix-markdown-tables-in-region (start end)
|
||||
"Fix markdown tables in the buffer between START and END."
|
||||
(save-excursion
|
||||
(with-restriction start end
|
||||
(goto-char start)
|
||||
(while (not (eobp))
|
||||
(if (not (markdown-table-at-point-p))
|
||||
(forward-line)
|
||||
(markdown-table-align)
|
||||
(while (markdown-table-at-point-p)
|
||||
(forward-line)))))))
|
||||
(add-hook 'gptel-post-response-functions
|
||||
#'my/-gptel-fix-markdown-tables-in-region
|
||||
;; come last (before the highlight function)
|
||||
90)
|
||||
(evil-define-key '(insert normal) gptel-mode-map
|
||||
(kbd "C-<return>") #'gptel-send
|
||||
(kbd "C-RET") #'gptel-send)
|
||||
@@ -3955,7 +3985,11 @@ vising, and their major mode"
|
||||
image/gif image/webp)
|
||||
:context-window 16
|
||||
:cutoff-date "2026-3")
|
||||
(qwen3.6-27b :description "Alibaba Qwen 2.6 (27b) for coding"
|
||||
(qwen2.5-coder-32b-instruct-q4_k_m
|
||||
:description "Alibaba Qwen 2.5 (32b) for coding"
|
||||
:capabilities ()
|
||||
:context-window 32)
|
||||
(qwen3.6-27b :description "Alibaba Qwen 3.6 (27b) for coding"
|
||||
:capabilities (media tool-use)
|
||||
:mime-types (image/jpeg image/png
|
||||
image/gif image/webp)
|
||||
@@ -3986,8 +4020,13 @@ vising, and their major mode"
|
||||
:model 'gemma-4-31b-it-qat-q4_0
|
||||
:system 'default
|
||||
:tools '("WebSearch" "list_buffers" "read_buffer"))
|
||||
(setq gptel-backend my/-localai-backend)
|
||||
(setq gptel-model 'gemma-4-31b-it-qat-q4_0))
|
||||
(gptel-make-preset 'localai-code
|
||||
:description "LocalAI with Qwen2.5 Coder (32b) (web search enabled)"
|
||||
:backend my/-localai-backend
|
||||
:model 'qwen2.5-coder-32b-instruct-q4_k_m
|
||||
:system 'default
|
||||
:tools '("WebSearch" "list_buffers" "read_buffer"))
|
||||
(gptel-preset 'localai-chat))
|
||||
(use-package gptel-agent
|
||||
:after 'gptel
|
||||
:defer t
|
||||
|
||||
Reference in New Issue
Block a user