DONE 조직모드: gptel-org-branching-context

[2024-12-12 Thu 13:25]

서브헤딩으로 가져가면 활용이 편하다

gptel-org-branching-context 인박스에 있을거야. 그래 인박스 정리 좀 하자

(defun gptel-org-toggle-branching-context ()
    "Toggle gptel context between doc and subheading."
    (interactive)
    (if gptel-org-branching-context
        (progn
          (setq-local gptel-org-branching-context nil)
          (message "Context: whole doc"))
      (setq-local gptel-org-branching-context t)
      (message "Context: subheading")))
 
; 활성화
  (setf (alist-get 'org-mode gptel-prompt-prefix-alist) "*Prompt*: "
        (alist-get 'org-mode gptel-response-prefix-alist) "*Response*:\n"
        (alist-get 'markdown-mode gptel-prompt-prefix-alist) "#### ")
  (with-eval-after-load 'gptel-org
    (setq-default gptel-org-branching-context t))
 

karthink/gptel: A simple LLM client for Emacs

(karthink [2023] 2024)

gptel is a simple Large Language Model chat client for Emacs, with support for multiple models and backends. It works in the spirit of Emacs, available at any time and uniformly in any buffer.

지피텔에서 제공하는 클라이언트 중에 다음 목록을 이용한다. 그 중에서 주로 사용하는 녀석은 체크하였다.

  • [X] xAI API key

  • [X] ChatGPT API key

  • [X] Perplexity API key

  • [ ] Anthropic (Claude) API key

  • [ ] Github Models Token

  • [ ] Gemini API key

  • [ ] OpenRouter API key

  • [ ] together.ai API key

  • It's async and fast, streams responses.

  • Interact with LLMs from anywhere in Emacs (any buffer, shell, minibuffer, wherever)

  • LLM responses are in Markdown or Org markup.

  • Supports multiple independent conversations and one-off ad hoc interactions.

  • Supports multi-modal models (include images, documents)

  • Save chats as regular Markdown/Org/Text files and resume them later.

  • You can go back and edit your previous prompts or LLM responses when continuing a conversation. These will be fed back to the model.

  • Don't like gptel's workflow? Use it to create your own for any supported model/backend with a simple API.

gptel uses Curl if available, but falls back to url-retrieve to work without external dependencies.

그외 아직 사용안함

#쥐피텔 #깃허브 모델 - 코파일럿 비교

[2024-10-17 Thu 07:08]

지피텔에서 깃허브 코파일럿을 연동한다면?! 아주 좋지. 10달러 쓰고 있는데.

Register a backend with ;; Github Models offers an OpenAI compatible API (gptel-make-openai "Github Models" ;Any name you want :host "models.inference.ai.azure.com" :endpoint "/chat/completions" :stream t :key "your-github-token" :models '(gpt-4o-mini)) For all the available models, check the marketplace. You can pick this backend from the menu when using (see Usage).

넣으면 코파일럿과 뭐가 다른가?

gptel: Mindblowing integration between Emacs and ChatGPT :

(Simon n.d.)

  • Simon, Ben
  • ChatGPT and its LLM brethren have been a potent source of FOMO : the AI revolution is happening, and I feel like I’m forever late to th...
  • gptel

GPTEL: A simple LLM client for Emacs

(karthink [2023] 2024)

  • "karthink/gptel" karthink 2024

GPTEL-QUICK: Quick LLM lookups in Emacs

(karthink [2024] 2024)

  • "karthink/gptel-quick" karthink 2024

    키바인딩 + M-w M-ret 그리고 버터를 고정해야 한다.

DONE gptel-quick 프롬프트 작성 #프롬프트

NEXT gptel-context with evil in #스페이스맥스

왜? 모르던 기능에 대한 키 바인딩 준수하다.

 
(defvar llm-client--gptel-send-called nil
  "Flag to track if gptel-send has been called at least once.")
 
(defun spacemacs//gptel-send-wrapper ()
  "Wrapper function for gptel-send that sets the flag."
  (interactive)
  (call-interactively 'gptel-send)
  (setq llm-client--gptel-send-called t))
 
(defun spacemacs//gptel-abort-wrapper ()
  "Wrapper function for gptel-abort that checks if gptel-send has been called."
  (interactive)
  (if llm-client--gptel-send-called
      (call-interactively 'gptel-abort)))
 
(defun llm-client/init-gptel ()
  "Initialize the `gptel` package and set up keybindings."
  (use-package gptel
    :defer t
    :ensure t
    :init
    ;; evilify gptel-context-buffer-mode-map
    (require 'gptel-context)
    (evil-set-initial-state 'gptel-context-buffer-mode 'evilified)
    (evilified-state-evilify-map gptel-context-buffer-mode-map
      :mode gptel-context-buffer-mode
      :bindings
      "C-c C-c" #'gptel-context-confirm
      "C-c C-k" #'gptel-context-quit
      "RET"     #'gptel-context-visit
      "n"       #'gptel-context-next
      "p"       #'gptel-context-previous
      "d"       #'gptel-context-flag-deletion)
    ;; set up keybindings
    (spacemacs/declare-prefix "$g" "Gptel")
    (spacemacs/set-leader-keys
      "$gg" 'gptel                          ; Start a new GPTel session
      "$gs" 'spacemacs//gptel-send-wrapper  ; Send a message to GPTel
      "$gq" 'spacemacs//gptel-abort-wrapper ; Abort any active GPTel process
      "$gm" 'gptel-menu                     ; Open the GPTel menu
      "$gc" 'gptel-add                      ; Add context
      "$gf" 'gptel-add-file                 ; Add a file
      "$go" 'gptel-org-set-topic            ; Set topic in Org-mode
      "$gp" 'gptel-org-set-properties)))    ; Set properties in Org-mode
 
(defun llm-client/post-init-org ()
  "Set up Org-mode keybindings for GPTel."
  (spacemacs/declare-prefix-for-mode 'org-mode "m$g" "Gptel")
  (spacemacs/set-leader-keys-for-major-mode 'org-mode
    "$go" 'gptel-org-set-topic
    "$gp" 'gptel-org-set-properties))
 
(defun llm-client/post-init-window-purpose ()
  ;; TODO: Temporary fix to avoid the error when using window-purpose
  ;; see https://github.com/karthink/gptel/issues/237 for details
  ;; (purpose-set-extension-configuration
  ;;  :llm-client-layer
  ;;  (purpose-conf :mode-purposes '((gptel-mode . chat))))
  (defun llm-client/disable-purpose-mode-around-for-gptel (orig-func &rest args)
    "Advice function to disable purpose-mode before calling ORIG-FUNC with ARGS."
    (let ((purpose-mode-was-enabled (bound-and-true-p purpose-mode)))
      (when purpose-mode-was-enabled
        (purpose-mode -1))
      (apply orig-func args)
      (when purpose-mode-was-enabled
        (purpose-mode 1))))
  (advice-add 'gptel :around #'llm-client/disable-purpose-mode-around-for-gptel))
 

관련노트

References

karthink. (2023) 2024. “Karthink/Gptel.” https://github.com/karthink/gptel.

———. (2024) 2024. “Karthink/Gptel-Quick.” https://github.com/karthink/gptel-quick.

Simon, Ben. n.d. “Gptel: Mindblowing Integration between Emacs and ChatGPT.” Accessed August 30, 2024. https://www.blogbyben.com/2024/08/gptel-mindblowing-integration-between.html.