File tree Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change 22
33; ;; Code:
44
5- ; ; TODO use file path or url at point as default
65(require 'org-ai-openai )
76
87(defcustom org-ai-image-query-model " gpt-4o-mini"
@@ -79,16 +78,10 @@ Calls CALLBACK with the response."
7978;;;### autoload
8079(defun org-ai-query-image ()
8180 " Query OpenAI API with a BASE64 encoded image path or URL and a QUESTION."
82- (interactive )
83- (let ((image-path-or-url (org-ai--get-image-path-or-url))
84- (question (org-ai--get-question)))
85- (if (string-match-p " ^https?://" image-path-or-url)
86- (org-ai--send-url-image-query image-path-or-url question #'org-ai--handle-openai-response )
87- (let ((base64-image (with-temp-buffer
88- (insert-file-contents-literally image-path-or-url)
89- (base64-encode-region (point-min ) (point-max ))
90- (buffer-string ))))
91- (org-ai--send-base64-image-query base64-image question #'org-ai--handle-openai-response )))))
81+ (interactive (list
82+ (read-file-name " Image file path: " nil nil nil (or (thing-at-point 'existing-filename )
83+ (thing-at-point 'url )))
84+ (read-string " Question: " nil 'minibuffer-history ))))
9285
9386(provide 'org-ai-openai-image-query )
9487
You can’t perform that action at this time.
0 commit comments