28-09-2026
This commit is contained in:
parent
8bbc077767
commit
bc3634adbd
4 changed files with 8 additions and 43 deletions
|
|
@ -1,3 +1,7 @@
|
||||||
|
#+begin_src elisp
|
||||||
|
;; -*- lexical-binding: t; -*-
|
||||||
|
#+end_src
|
||||||
|
|
||||||
* PERFORMANCE
|
* PERFORMANCE
|
||||||
Configuração do Garbage Collector para acelerar o arranque.
|
Configuração do Garbage Collector para acelerar o arranque.
|
||||||
#+begin_src elisp
|
#+begin_src elisp
|
||||||
|
|
@ -492,47 +496,6 @@ Integração com o servidor Khoj para busca semântica nas notas.
|
||||||
(setq khoj-index-directories '("~/org/roam/")))
|
(setq khoj-index-directories '("~/org/roam/")))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
* O MEU PRIMEIRO AGENTE (RAG)
|
|
||||||
Integração direta entre a pesquisa semântica (Khoj) e a geração de texto (Llama).
|
|
||||||
#+begin_src elisp
|
|
||||||
(defun gabi/agente-notas (pesquisa pergunta)
|
|
||||||
"Agente RAG de 2 Fases: Pesquisa Cirúrgica + Resposta Estrita."
|
|
||||||
(interactive
|
|
||||||
(list (read-string "1. Palavras-chave para o Khoj (ex: gentoo instalação): ")
|
|
||||||
(read-string "2. O que queres perguntar ao Llama sobre isto?: ")))
|
|
||||||
|
|
||||||
(require 'gptel)
|
|
||||||
(message "Fase 1: A extrair as notas sobre '%s' do Khoj..." pesquisa)
|
|
||||||
|
|
||||||
(let* ((url (format "http://127.0.0.1:5000/api/search?q=%s&n=5" (url-hexify-string pesquisa)))
|
|
||||||
(comando (format "curl -s '%s'" url))
|
|
||||||
(resultados-khoj (shell-command-to-string comando))
|
|
||||||
(buffer-resposta (get-buffer-create "*Síntese do Agente*"))
|
|
||||||
|
|
||||||
;; PROMPT DE FERRO: Proibido inventar.
|
|
||||||
(prompt-sistema (concat "És um assistente técnico de extração de informação. "
|
|
||||||
"Vais receber dados JSON retirados das notas do utilizador.\n\n"
|
|
||||||
"REGRAS ABSOLUTAS:\n"
|
|
||||||
"1. Baseia a resposta EXCLUSIVAMENTE nos dados abaixo.\n"
|
|
||||||
"2. NÃO inventes conhecimento externo. Se não está nos dados, não escrevas.\n"
|
|
||||||
"3. Ignora o código JSON e foca-te apenas no texto org-mode que está lá dentro.\n\n"
|
|
||||||
"DADOS EXTRAÍDOS:\n"
|
|
||||||
resultados-khoj)))
|
|
||||||
|
|
||||||
(pop-to-buffer buffer-resposta)
|
|
||||||
(erase-buffer)
|
|
||||||
(org-mode)
|
|
||||||
(insert (format "#+TITLE: %s\n" pergunta))
|
|
||||||
(insert (format "#+SUBTITLE: Baseado na pesquisa por: %s\n" pesquisa))
|
|
||||||
(insert (format "#+DATE: %s\n\n" (format-time-string "%Y-%m-%d")))
|
|
||||||
|
|
||||||
(message "Fase 2: A analisar notas e a gerar resposta...")
|
|
||||||
(gptel-request pergunta
|
|
||||||
:system prompt-sistema
|
|
||||||
:stream t)))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
|
|
||||||
* LEITOR DE NOTÍCIAS (ELFEED + FRESHRSS)
|
* LEITOR DE NOTÍCIAS (ELFEED + FRESHRSS)
|
||||||
#+begin_src elisp
|
#+begin_src elisp
|
||||||
(use-package elfeed
|
(use-package elfeed
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
;; -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; Desligar alguns avisos de compilação desnecessários
|
;; Desligar alguns avisos de compilação desnecessários
|
||||||
(setq ad-redefinition-action 'accept)
|
(setq ad-redefinition-action 'accept)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ client.urgent #f38ba8 #1e1e2e #f38ba8 #f38ba8 #f38ba8
|
||||||
### Output configuration
|
### Output configuration
|
||||||
#
|
#
|
||||||
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
|
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
|
||||||
output * bg /home/gabi/Pictures/Wallpapers/space.jpg fill
|
output * bg /home/gabi/Pictures/Wallpapers/red_supra.jpg fill
|
||||||
#
|
#
|
||||||
# Example configuration:
|
# Example configuration:
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ bindkey "\e[1;5C" forward-word
|
||||||
bindkey '^[[A' history-substring-search-up
|
bindkey '^[[A' history-substring-search-up
|
||||||
bindkey '^[[B' history-substring-search-down
|
bindkey '^[[B' history-substring-search-down
|
||||||
bindkey '^R' history-incremental-search-backward
|
bindkey '^R' history-incremental-search-backward
|
||||||
bindkey "^W" backward-kill-word
|
bindkey "^H" backward-kill-word
|
||||||
bindkey "^U" backward-kill-line
|
bindkey "^U" backward-kill-line
|
||||||
bindkey "^K" kill-line
|
bindkey "^K" kill-line
|
||||||
bindkey "^A" beginning-of-line
|
bindkey "^A" beginning-of-line
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue