diff --git a/CHANGELOG.md b/CHANGELOG.md index bb85f83..d624675 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [0.5.4] - 2024-10-20 +### Changed +- fix prompting in `org-ai-refactor-code` + ## [0.5.3] - 2024-10-20 ### Changed - fix progress reporter for non-streamed responses (fixes completion for o1 models) diff --git a/org-ai-openai.el b/org-ai-openai.el index a796a55..1be5674 100644 --- a/org-ai-openai.el +++ b/org-ai-openai.el @@ -740,7 +740,8 @@ and the length in chars of the pre-change text replaced by that range." (set-marker org-ai--url-buffer-last-position-marker (point))) (error (setq errored t) - (goto-char org-ai--url-buffer-last-position-marker))))))))))))) + (when org-ai--url-buffer-last-position-marker + (goto-char org-ai--url-buffer-last-position-marker)))))))))))))) (defun org-ai--stream-supported (service model) "Check if the stream is supported by the service and model. diff --git a/org-ai-useful.el b/org-ai-useful.el index f94a86c..e933830 100644 --- a/org-ai-useful.el +++ b/org-ai-useful.el @@ -135,7 +135,8 @@ Will always return t if `org-ai-talk-confirm-speech-input' is nil." (let ((output-buffer (or output-buffer (current-buffer))) (start-pos-marker (point-marker))) (let* ((sys-input (if sys-prompt (format "[SYS]: %s\n" sys-prompt))) - (input (format "%s\n[ME]: %s" sys-input prompt))) + (input (format "%s\n[ME]: %s" sys-input prompt)) + (callback-called nil)) (with-current-buffer output-buffer (setq org-ai-prompt--last-insertion-marker (point-marker))) (org-ai-stream-request :messages (org-ai--collect-chat-messages input) @@ -143,7 +144,8 @@ Will always return t if `org-ai-talk-confirm-speech-input' is nil." :callback (lambda (response) (when (cl-some (lambda (ea) (eq 'stop (org-ai--response-type ea))) (org-ai--insert-stream-response nil output-buffer response nil)) - (when callback + (when (and callback (not callback-called)) + (setq callback-called t) (with-current-buffer output-buffer (funcall callback)))))))))) diff --git a/org-ai.el b/org-ai.el index 232bf9c..e64ecf2 100644 --- a/org-ai.el +++ b/org-ai.el @@ -4,7 +4,7 @@ ;; Author: Robert Krahn ;; URL: https://github.com/rksm/org-ai -;; Version: 0.5.3 +;; Version: 0.5.4 ;; Package-Requires: ((emacs "27.1") (websocket "1.15")) ;; This file is NOT part of GNU Emacs.