to lazy for good messages
This commit is contained in:
@@ -216,32 +216,32 @@
|
|||||||
|
|
||||||
;;ollama stuff
|
;;ollama stuff
|
||||||
;;
|
;;
|
||||||
(use-package ellama
|
;;(use-package ellama
|
||||||
:init
|
;; :init
|
||||||
;; setup key bindings
|
;; ;; setup key bindings
|
||||||
(setopt ellama-keymap-prefix "C-c e")
|
;; (setopt ellama-keymap-prefix "C-c e")
|
||||||
;; language you want ellama to translate to
|
;; ;; language you want ellama to translate to
|
||||||
(setopt ellama-language "English")
|
;; (setopt ellama-language "English")
|
||||||
;; could be llm-openai for example
|
;; ;; could be llm-openai for example
|
||||||
(require 'llm-ollama)
|
;; (require 'llm-ollama)
|
||||||
(setopt ellama-provider
|
;; (setopt ellama-provider
|
||||||
(make-llm-ollama
|
;; (make-llm-ollama
|
||||||
;; this model should be pulled to use it
|
;; ;; this model should be pulled to use it
|
||||||
;; value should be the same as you print in terminal during pull
|
;; ;; value should be the same as you print in terminal during pull
|
||||||
:chat-model "codellama:13b"
|
;; :chat-model "codellama:13b"
|
||||||
:embedding-model "codellama:13b"))
|
;; :embedding-model "codellama:13b"))
|
||||||
)
|
;; )
|
||||||
(use-package qml-ts-mode
|
;;(use-package qml-ts-mode
|
||||||
:after lsp-mode
|
;; :after lsp-mode
|
||||||
:config
|
;; :config
|
||||||
(add-to-list 'lsp-language-id-configuration '(qml-ts-mode . "qml-ts"))
|
;; (add-to-list 'lsp-language-id-configuration '(qml-ts-mode . "qml-ts"))
|
||||||
(lsp-register-client
|
;; (lsp-register-client
|
||||||
(make-lsp-client :new-connection (lsp-stdio-connection '("qmlls", "-E"))
|
;; (make-lsp-client :new-connection (lsp-stdio-connection '("qmlls", "-E"))
|
||||||
:activation-fn (lsp-activate-on "qml-ts")
|
;; :activation-fn (lsp-activate-on "qml-ts")
|
||||||
:server-id 'qmlls))
|
;; :server-id 'qmlls))
|
||||||
(add-hook 'qml-ts-mode-hook (lambda ()
|
;; (add-hook 'qml-ts-mode-hook (lambda ()
|
||||||
(setq-local electric-indent-chars '(?\n ?\( ?\) ?{ ?} ?\[ ?\] ?\; ?,))
|
;; (setq-local electric-indent-chars '(?\n ?\( ?\) ?{ ?} ?\[ ?\] ?\; ?,))
|
||||||
(lsp-deferred))))
|
;; (lsp-deferred))))
|
||||||
|
|
||||||
|
|
||||||
;; custom functions
|
;; custom functions
|
||||||
|
|||||||
@@ -28,85 +28,86 @@
|
|||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
(require 'json)
|
(require 'json)
|
||||||
|
Package-Requires: ((cl-lib "0.5"))
|
||||||
(require 'cl-lib)
|
(require 'cl-lib)
|
||||||
(require 'url)
|
(require 'url)
|
||||||
|
|
||||||
(defgroup ollama nil
|
(defgroup ollama nil
|
||||||
"Ollama client for Emacs."
|
"Ollama client for Emacs."
|
||||||
:group 'ollama)
|
:group 'ollama)
|
||||||
|
|
||||||
(defcustom ollama:endpoint "http://localhost:11434/api/generate"
|
(defcustom ollama:endpoint "http://localhost:11434/api/generate"
|
||||||
"Ollama http service endpoint."
|
"Ollama http service endpoint."
|
||||||
:group 'ollama
|
:group 'ollama
|
||||||
:type 'string)
|
:type 'string)
|
||||||
|
|
||||||
(defcustom ollama:model "codellama:13b"
|
(defcustom ollama:model "codellama:13b"
|
||||||
"Ollama model."
|
"Ollama model."
|
||||||
:group 'ollama
|
:group 'ollama
|
||||||
:type 'string)
|
:type 'string)
|
||||||
|
|
||||||
(defcustom ollama:language "English"
|
(defcustom ollama:language "English"
|
||||||
"Language to translate to."
|
"Language to translate to."
|
||||||
:group 'ollama
|
:group 'ollama
|
||||||
:type 'string)
|
:type 'string)
|
||||||
|
|
||||||
(defun ollama-fetch (url prompt model)
|
(defun ollama-fetch (url prompt model)
|
||||||
(let* ((url-request-method "POST")
|
(let* ((url-request-method "POST")
|
||||||
(url-request-extra-headers
|
(url-request-extra-headers
|
||||||
'(("Content-Type" . "application/json")))
|
'(("Content-Type" . "application/json")))
|
||||||
(url-request-data
|
(url-request-data
|
||||||
(encode-coding-string
|
(encode-coding-string
|
||||||
(json-encode `((model . ,model) (prompt . ,prompt)))
|
(json-encode `((model . ,model) (prompt . ,prompt)))
|
||||||
'utf-8)))
|
'utf-8)))
|
||||||
(with-current-buffer (url-retrieve-synchronously url)
|
(with-current-buffer (url-retrieve-synchronously url)
|
||||||
(goto-char url-http-end-of-headers)
|
(goto-char url-http-end-of-headers)
|
||||||
(decode-coding-string
|
(decode-coding-string
|
||||||
(buffer-substring-no-properties
|
(buffer-substring-no-properties
|
||||||
(point)
|
(point)
|
||||||
(point-max))
|
(point-max))
|
||||||
'utf-8))))
|
'utf-8))))
|
||||||
|
|
||||||
(defun ollama-get-response-from-line (line)
|
(defun ollama-get-response-from-line (line)
|
||||||
(cdr
|
(cdr
|
||||||
(assoc 'response
|
(assoc 'response
|
||||||
(json-read-from-string line))))
|
(json-read-from-string line))))
|
||||||
|
|
||||||
(defun ollama-prompt (url prompt model)
|
(defun ollama-prompt (url prompt model)
|
||||||
(mapconcat 'ollama-get-response-from-line
|
(mapconcat 'ollama-get-response-from-line
|
||||||
(cl-remove-if #'(lambda (str) (string= str ""))
|
(cl-remove-if #'(lambda (str) (string= str ""))
|
||||||
(split-string (ollama-fetch url prompt model) "\n")) ""))
|
(split-string (ollama-fetch url prompt model) "\n")) ""))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun ollama-prompt-line ()
|
(defun ollama-prompt-line ()
|
||||||
"Prompt with current word."
|
"Prompt with current word."
|
||||||
(interactive)
|
(interactive)
|
||||||
(with-output-to-temp-buffer "*ollama*"
|
(with-output-to-temp-buffer "*ollama*"
|
||||||
(princ
|
(princ
|
||||||
(ollama-prompt ollama:endpoint (thing-at-point 'line) ollama:model))))
|
(ollama-prompt ollama:endpoint (thing-at-point 'line) ollama:model))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun ollama-define-word ()
|
(defun ollama-define-word ()
|
||||||
"Find definition of current word."
|
"Find definition of current word."
|
||||||
(interactive)
|
(interactive)
|
||||||
(with-output-to-temp-buffer "*ollama*"
|
(with-output-to-temp-buffer "*ollama*"
|
||||||
(princ
|
(princ
|
||||||
(ollama-prompt ollama:endpoint (format "define %s" (thing-at-point 'word)) ollama:model))))
|
(ollama-prompt ollama:endpoint (format "define %s" (thing-at-point 'word)) ollama:model))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun ollama-translate-word ()
|
(defun ollama-translate-word ()
|
||||||
"Translate current word."
|
"Translate current word."
|
||||||
(interactive)
|
(interactive)
|
||||||
(with-output-to-temp-buffer "*ollama*"
|
(with-output-to-temp-buffer "*ollama*"
|
||||||
(princ
|
(princ
|
||||||
(ollama-prompt ollama:endpoint (format "translate \"%s\" to %s" (thing-at-point 'word) ollama:language) ollama:model))))
|
(ollama-prompt ollama:endpoint (format "translate \"%s\" to %s" (thing-at-point 'word) ollama:language) ollama:model))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun ollama-summarize-region ()
|
(defun ollama-summarize-region ()
|
||||||
"Summarize marked text."
|
"Summarize marked text."
|
||||||
(interactive)
|
(interactive)
|
||||||
(with-output-to-temp-buffer "*ollama*"
|
(with-output-to-temp-buffer "*ollama*"
|
||||||
(princ
|
(princ
|
||||||
(ollama-prompt ollama:endpoint (format "summarize \"\"\"%s\"\"\"" (buffer-substring (region-beginning) (region-end))) ollama:model))))
|
(ollama-prompt ollama:endpoint (format "summarize \"\"\"%s\"\"\"" (buffer-substring (region-beginning) (region-end))) ollama:model))))
|
||||||
|
|
||||||
(provide 'ollama)
|
(provide 'ollama)
|
||||||
;;; ollama.el ends here
|
;;; ollama.el ends here
|
||||||
|
|||||||
@@ -35,13 +35,18 @@ in
|
|||||||
];
|
];
|
||||||
# Autostart necessary processes (like notifications daemons, status bars, etc.)
|
# Autostart necessary processes (like notifications daemons, status bars, etc.)
|
||||||
# Or execute your favorite apps at launch like this:
|
# Or execute your favorite apps at launch like this:
|
||||||
exec-once = [
|
exec-once =
|
||||||
#"waybar"
|
[
|
||||||
#"quickshell"
|
#"waybar"
|
||||||
"${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"
|
#"quickshell"
|
||||||
"fcitx5 -d"
|
"${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"
|
||||||
"foot -s"
|
"fcitx5 -d"
|
||||||
] ++ lib.optional (config.home.username == "work") "thunderbird";
|
"foot -s"
|
||||||
|
]
|
||||||
|
++ lib.optionals (config.home.username == "work") [
|
||||||
|
"thunderbird"
|
||||||
|
"sleep 10 && emacsclient -c --frame-parameters='((name . \"work\"))' $HOME/Documents/work/README.org"
|
||||||
|
];
|
||||||
#++ lib.optional (systemName == "laptop") "swaybg -o eDP-1 -i ${../assets/Wallpapers/138.png}"
|
#++ lib.optional (systemName == "laptop") "swaybg -o eDP-1 -i ${../assets/Wallpapers/138.png}"
|
||||||
#++
|
#++
|
||||||
# lib.optional (systemName == "pc")
|
# lib.optional (systemName == "pc")
|
||||||
@@ -283,6 +288,7 @@ in
|
|||||||
# Fix some dragging issues with XWayland
|
# Fix some dragging issues with XWayland
|
||||||
"nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0"
|
"nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0"
|
||||||
"workspace special:magic silent, class:thunderbird"
|
"workspace special:magic silent, class:thunderbird"
|
||||||
|
"workspace special:magic silent, class:emacs, title:work"
|
||||||
];
|
];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -198,6 +198,8 @@ in
|
|||||||
cava
|
cava
|
||||||
lm_sensors
|
lm_sensors
|
||||||
thunderbird
|
thunderbird
|
||||||
|
libnotify
|
||||||
|
localsend
|
||||||
wmctrl
|
wmctrl
|
||||||
xdotool
|
xdotool
|
||||||
libinput-gestures
|
libinput-gestures
|
||||||
|
|||||||
@@ -59,9 +59,13 @@ in
|
|||||||
package = pkgs.open-sans;
|
package = pkgs.open-sans;
|
||||||
name = "Open Sans";
|
name = "Open Sans";
|
||||||
};
|
};
|
||||||
|
#monospace = {
|
||||||
|
# package = pkgs.dejavu_fonts;
|
||||||
|
# name = "DejaVu Sans Mono";
|
||||||
|
#};
|
||||||
monospace = {
|
monospace = {
|
||||||
package = pkgs.dejavu_fonts;
|
package = pkgs.iosevka-comfy.comfy;
|
||||||
name = "DejaVu Sans Mono";
|
name = "Iosevka Comfy";
|
||||||
};
|
};
|
||||||
emoji = {
|
emoji = {
|
||||||
package = pkgs.noto-fonts-emoji;
|
package = pkgs.noto-fonts-emoji;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ in
|
|||||||
../dots/hyprlock.nix
|
../dots/hyprlock.nix
|
||||||
./stylix.nix
|
./stylix.nix
|
||||||
./homePkgs.nix
|
./homePkgs.nix
|
||||||
|
./services.nix
|
||||||
../dots/xdg.nix
|
../dots/xdg.nix
|
||||||
../dots/river.nix
|
../dots/river.nix
|
||||||
../dots/niri.nix
|
../dots/niri.nix
|
||||||
|
|||||||
Reference in New Issue
Block a user