Commit 37a27a173fe2

Vincent Demeester <vincent@sbr.pm>
2025-07-15 15:39:57
tools/emacs: gptel and mcp updates
… and trying out a small function. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent f61f30e
Changed files (2)
tools
tools/emacs/site-lisp/init-func.el
@@ -1,6 +1,16 @@
 ;;; init-func.el --- -*- lexical-binding: t -*-
 ;;
 
+;;;###autoload
+(defmacro vde/run-and-delete-frame (name &rest body)
+  "Define a function NAME that executes BODY and then closes the current frame.
+   Intended for use with emacsclient -c -e."
+  `(defun ,name ()
+     ,(format "Performs a task and then closes the current frame for %S." name)
+     (interactive)
+     ,@body
+     (delete-frame)))
+
 ;;;###autoload
 (defun vde/el-load-dir (dir)
   "Load el files from the given folder `DIR'."
tools/emacs/init.el
@@ -156,6 +156,13 @@
 (eval-when-compile
   (require 'use-package))
 
+(require 'init-func)
+;; TODO: do useful stuff with the macro instead
+(vde/run-and-delete-frame my-greet-and-close ()
+			  "Displays a greeting and closes the frame after a short delay."
+			  (message "Hello from a macro-defined function! Closing soon...")
+			  (sit-for 2))
+
 (use-package emacs
   :bind
   ("C-x m" . mark-defun)
@@ -1361,9 +1368,16 @@ Add this function to the `after-save-hook'."
   :commands (mcp-hub-start-all-server)
   :after gptel
   :custom (mcp-hub-servers
-	   `(("jira" :command "/home/vincent/src/github.com/chmouel/jayrah/.venv/bin/jayrah" :args ("mcp"))
-	     ("github" :command "github-mcp-server" :args ("stdio")
-	      :env (:GITHUB_PERSONAL_ACCESS_TOKEN ,(passage-get "github/vdemeester/github-mcp-server")))))
+	   `(("jira"
+	      :command "/home/vincent/src/github.com/chmouel/jayrah/.venv/bin/jayrah"
+	      :args ("mcp"))
+	     ("github"
+	      :command "github-mcp-server"
+	      :args ("stdio")
+	      :env (:GITHUB_PERSONAL_ACCESS_TOKEN ,(passage-get "github/vdemeester/github-mcp-server")))
+	     ("playwright"
+	      :command "npx @playwright/mcp@latest"
+	      :args ("--executable-path", "/run/current-system/sw/bin/chromium"))))
   :config (require 'mcp-hub))
 
 (use-package gptel
@@ -1393,44 +1407,47 @@ Add this function to the `after-save-hook'."
   
   (setq gptel-model 'gemini-2.5-flash
 	gptel-backend (gptel-make-gemini "Gemini"
-					 :key (passage-get "ai/gemini/api_key"))
+			:key (passage-get "ai/gemini/api_key"))
 	)
 
+  (gptel-make-gemini "Gemini Red Hat"
+    :key (passage-get "redhat/google/osp/vdeemest-api-key"))
+  
   (gptel-make-openai "MistralLeChat"
-		     :host "api.mistral.ai/v1"
-		     :endpoint "/chat/completions"
-		     :protocol "https"
-		     :key (passage-get "ai/mistralai/api_key")
-		     :models '("mistral-small"))
+    :host "api.mistral.ai/v1"
+    :endpoint "/chat/completions"
+    :protocol "https"
+    :key (passage-get "ai/mistralai/api_key")
+    :models '("mistral-small"))
   
   (gptel-make-openai "OpenRouter"
-		     :host "openrouter.ai"
-		     :endpoint "/api/v1/chat/completions"
-		     :stream t
-		     :key (passage-get "ai/openroute/api_key")
-		     :models '(cognittivecomputations/dolphin3.0-mistral-24b:free
-			       cognitivecomputations/dolphin3.0-r1-mistral-24b:free
-			       deepseek/deepseek-r1-zero:free
-			       deepseek/deepseek-chat:free
-			       deepseek/deepseek-r1-distill-qwen-32b:free
-			       deepseek/deepseek-r1-distill-llama-70b:free
-			       google/gemini-2.0-flash-lite-preview-02-05:free
-			       google/gemini-2.0-pro-exp-02-05:free
-			       google/gemini-2.5-pro-exp-03-25:free
-			       google/gemma-3-12b-it:free
-			       google/gemma-3-27b-it:free
-			       google/gemma-3-4b-it:free
-			       mistralai/mistral-small-3.1-24b-instruct:free
-			       open-r1/olympiccoder-32b:free
-			       qwen/qwen2.5-vl-3b-instruct:free
-			       qwen/qwen-2.5-coder-32b-instruct:free
-			       qwen/qwq-32b:free
-			       codellama/codellama-70b-instruct
-			       google/gemini-pro
-			       google/palm-2-codechat-bison-32k
-			       meta-llama/codellama-34b-instruct
-			       mistralai/mixtral-8x7b-instruct
-			       openai/gpt-3.5-turbo))
+    :host "openrouter.ai"
+    :endpoint "/api/v1/chat/completions"
+    :stream t
+    :key (passage-get "ai/openroute/api_key")
+    :models '(cognittivecomputations/dolphin3.0-mistral-24b:free
+	      cognitivecomputations/dolphin3.0-r1-mistral-24b:free
+	      deepseek/deepseek-r1-zero:free
+	      deepseek/deepseek-chat:free
+	      deepseek/deepseek-r1-distill-qwen-32b:free
+	      deepseek/deepseek-r1-distill-llama-70b:free
+	      google/gemini-2.0-flash-lite-preview-02-05:free
+	      google/gemini-2.0-pro-exp-02-05:free
+	      google/gemini-2.5-pro-exp-03-25:free
+	      google/gemma-3-12b-it:free
+	      google/gemma-3-27b-it:free
+	      google/gemma-3-4b-it:free
+	      mistralai/mistral-small-3.1-24b-instruct:free
+	      open-r1/olympiccoder-32b:free
+	      qwen/qwen2.5-vl-3b-instruct:free
+	      qwen/qwen-2.5-coder-32b-instruct:free
+	      qwen/qwq-32b:free
+	      codellama/codellama-70b-instruct
+	      google/gemini-pro
+	      google/palm-2-codechat-bison-32k
+	      meta-llama/codellama-34b-instruct
+	      mistralai/mixtral-8x7b-instruct
+	      openai/gpt-3.5-turbo))
 
   ;; TODO: configure shikoku/kobe ollama instances here
   ;; (gptel-make-ollama "Ollama"