diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-16 02:00:19 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-16 02:00:19 -0500 |
| commit | 3f50f682053dd31d5fac96ecdf2b98aad1ce56d7 (patch) | |
| tree | e87cdc207cba893ac68ad6dcbbff8da17fbe8232 /modules/ai-config.el | |
| parent | 6ee37e0a68d31909861cf59684d3601bf40f5abe (diff) | |
| download | dotemacs-3f50f682053dd31d5fac96ecdf2b98aad1ce56d7.tar.gz dotemacs-3f50f682053dd31d5fac96ecdf2b98aad1ce56d7.zip | |
feat(ai-conversations-browser): dired-style browser for saved GPTel conversations
`cj/gptel-load-conversation` prompts via `completing-read`. A
dedicated browser shows what each conversation is about at a
glance and supports single-key load / delete / rename without
having to scroll a minibuffer list.
New module `modules/ai-conversations-browser.el` +
`cj/gptel-browse-conversations` entry point bound to `C-; a b`
("browse conversations"). Opens `*GPTel-Conversations*` in
`cj/gptel-browser-mode` (a `special-mode` derivative).
Each row shows date, time, topic slug, and a preview of the most
recent message (length configurable via
`cj/gptel-browser-preview-length`, default 60 chars). Rows sort
newest first.
In the browser:
- `RET` / `l`: load the conversation (delegates to
`cj/gptel-load-conversation` with the file pre-selected via a
`cl-letf` stub on `completing-read` so the user isn't prompted
twice), then bury the window.
- `d`: delete the file under point after `y-or-n-p` confirmation,
re-render.
- `r`: rename the file under point. Preserves the timestamp,
slugifies the new topic, refuses unchanged input and existing
targets.
- `g`: refresh.
- `n` / `p`: next / previous row.
- `q`: quit-window.
21 tests cover the helpers (topic parsing, header stripping,
preview shaping for truncate / short / empty cases, row-for-file
with conversation + non-conversation filenames, rows enumeration,
render output for empty + populated cases, newest-first sort,
rename-target preservation of timestamp + slug, rename-target
error on missing timestamp) and the file-touching actions (delete
with y, cancel with n, rename, rename-on-empty-line error).
Diffstat (limited to 'modules/ai-config.el')
| -rw-r--r-- | modules/ai-config.el | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/modules/ai-config.el b/modules/ai-config.el index c7a14cae..9ac00bfe 100644 --- a/modules/ai-config.el +++ b/modules/ai-config.el @@ -37,6 +37,7 @@ (autoload 'cj/gptel-quick-ask "ai-quick-ask" "One-shot quick-ask in a transient buffer." t) (autoload 'cj/gptel-rewrite-with-directive "ai-rewrite" "Pick a directive and run gptel-rewrite on the region." t) (autoload 'cj/gptel-rewrite-redo-with-different-directive "ai-rewrite" "Re-run the previous rewrite with a different directive." t) +(autoload 'cj/gptel-browse-conversations "ai-conversations-browser" "Browse saved GPTel conversations." t) ;;; ------------------------- AI Config Helper Functions ------------------------ @@ -508,6 +509,7 @@ Works for any buffer, whether it's visiting a file or not." "d" #'cj/gptel-delete-conversation ;; delete conversation "." #'cj/gptel-add-this-buffer ;; add buffer to context "f" #'cj/gptel-add-file ;; add a file to context + "b" #'cj/gptel-browse-conversations ;; browse saved conversations "l" #'cj/gptel-load-conversation ;; load and continue conversation "m" #'cj/gptel-change-model ;; change the LLM model "p" #'gptel-system-prompt ;; change prompt @@ -526,6 +528,7 @@ Works for any buffer, whether it's visiting a file or not." "C-; a A" "toggle autosave" "C-; a B" "switch backend" "C-; a M" "gptel menu" + "C-; a b" "browse conversations" "C-; a d" "delete conversation" "C-; a ." "add buffer" "C-; a f" "add file" |
