Option to save <ChatGPT> buffers by default #129
Replies: 2 comments 9 replies
-
There are many ways to do it:
(defun my/gptel-write-buffer ()
"Save buffer to disk when starting gptel"
(unless (buffer-file-name (current-buffer))
(let ((suffix (format-time-string "%Y%m%dT%H%M" (current-time)))
(chat-dir "~/chatgpt-log"))
(unless (file-directory-p chat-dir)
(make-directory chat-dir :parents))
(write-file (expand-file-name (concat "gptel-" suffix ".txt") chat-dir)))))
(add-hook 'gptel-mode-hook #'my/gptel-write-buffer) This will save new gptel sessions to
This is a feature best tailored by users for their individual workflows, and thus not something I plan to implement in gptel -- so I'm moving this thread to the discussions section. |
Beta Was this translation helpful? Give feedback.
-
I have another question about this approach. It looks like that it sets some local vars in the header of the buffer, inserting e.g., something like:
That's nice, but then it doesn't do anything when you switch the model. I wonder if the mode-hook is the best one for this task? |
Beta Was this translation helpful? Give feedback.
-
It would be nice to have the configurable option to automatically associated the gptel buffers (named <ChatGPT #n> by default with a file (e.g. in a configurable directory with file name .txt). This way, without extra effort, one can maintain a well-accessible history of chat interactions.
If not within
gptel
, do you have a recommendation how to implement this in the easiest manner?Beta Was this translation helpful? Give feedback.
All reactions