gptel-curl: Autoload gptel-curl-get-response
gptel-curl.el (gptel-curl-get-response): Rename from `gptel--curl-get-response' and autoload it to ease its use in `gptel-send'. Remove Version header identifying gptel-curl as a separate package and make it require `gptel' instead.
This commit is contained in:
parent
5159a773a0
commit
172059060a
2 changed files with 9 additions and 8 deletions
|
@ -4,9 +4,8 @@
|
|||
|
||||
;; Author: Karthik Chikmagalur;; <karthikchikmagalur@gmail.com>
|
||||
;; 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"
|
||||
|
|
6
gptel.el
6
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)))
|
||||
|
|
Loading…
Add table
Reference in a new issue