diff --git a/gptel-curl.el b/gptel-curl.el index fb9f91c..5f8c79e 100644 --- a/gptel-curl.el +++ b/gptel-curl.el @@ -4,9 +4,8 @@ ;; Author: Karthik Chikmagalur;; ;; Keywords: convenience -;; Version: 0.05 -;; Keywords: convenience -;; URL: https://github.com/karthink/gptel + +;; SPDX-License-Identifier: GPL-3.0-or-later ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -27,13 +26,14 @@ ;;; Code: +(require 'gptel) + (eval-when-compile (require 'subr-x)) (require 'map) (require 'json) (require 'aio) -(defvar gptel-api-key) (defvar gptel--curl-process-alist nil "Alist of active GPTel curl requests.") @@ -69,7 +69,8 @@ PROMPTS is the data to send, TOKEN is a unique identifier." (push (format "-d%s" data) args) (nreverse (cons url args)))) -(defun gptel--curl-get-response (prompts) +;;;###autoload +(defun gptel-curl-get-response (prompts) "Retrieve response to PROMPTS." (with-current-buffer (generate-new-buffer "*gptel-curl*") (let* ((token (md5 (format "%s%s%s%s" diff --git a/gptel.el b/gptel.el index 3e423bd..a09de52 100644 --- a/gptel.el +++ b/gptel.el @@ -48,7 +48,7 @@ ;;; Code: (declare-function markdown-mode "markdown-mode") -(declare-function gptel--curl-get-response "gptel-curl") +(declare-function gptel-curl-get-response "gptel-curl") (eval-when-compile (require 'subr-x) @@ -105,8 +105,8 @@ When set to nil, it is inserted all at once. (full-prompt (gptel--create-prompt)) (response (aio-await (funcall - (if (and gptel-use-curl (require 'gptel-curl nil t)) - #'gptel--curl-get-response #'gptel--get-response) + (if gptel-use-curl + #'gptel-curl-get-response #'gptel--get-response) full-prompt))) (content-str (plist-get response :content)) (status-str (plist-get response :status)))