[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/gptel a500c76a68 053/273: Encode a lambda-provided API key
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/gptel a500c76a68 053/273: Encode a lambda-provided API key as utf-8 |
Date: |
Wed, 1 May 2024 10:01:39 -0400 (EDT) |
branch: elpa/gptel
commit a500c76a685c12dd7dc37d3a999eb4d5fbab3152
Author: algal <algal@penguin>
Commit: karthink <karthikchikmagalur@gmail.com>
Encode a lambda-provided API key as utf-8
If the user provides the OpenAPI key via a function, as is the case by
default if the user puts credentials in an auth-sources resource like
.authinfo or .authinfo.gpg, then it is necessary to encode the
function's returned value into utf-8 before passing it onward to build
the HTTP request. This commit ensures that happen.
Why is this necessary, given that the API key contains only
alphanumeric characters and therefore should be byte-for-byte the same
in utf-8 as in us-acii? I don't know. It may because emacs's
url-http.el library concats many strings together, and they all need
to be identically encoded before they can be combined correctly.
Whatever the reason, this fix works and allows you to send prompts
which include Unicode characters that require multibyte encodings in UTF-8
---
gptel.el | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/gptel.el b/gptel.el
index 606bc63a74..bdbd6c0d07 100644
--- a/gptel.el
+++ b/gptel.el
@@ -202,7 +202,9 @@ By default, \"openai.com\" is used as HOST and \"apikey\"
as USER."
:host (or host "openai.com")
:user (or user "apikey")))
:secret)))
- (if (functionp secret) (funcall secret) secret)
+ (if (functionp secret)
+ (encode-coding-string (funcall secret) 'utf-8)
+ secret)
(user-error "No `gptel-api-key' found in the auth source")))
(defun gptel--api-key ()
- [nongnu] elpa/gptel af5444a2ea 201/273: gptel: docstrings for multi-LLM support, bump version, (continued)
- [nongnu] elpa/gptel af5444a2ea 201/273: gptel: docstrings for multi-LLM support, bump version, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 49cfc78378 203/273: gptel: Add page boundaries, restructure files, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 0d6264f268 214/273: gptel-curl: Adjust response beginning position, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 39376aa3f4 020/273: gptel-transient: Add transient menus for setting parameters, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel dfca03a266 028/273: LICENSE: Add GPLv3 license, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 048eaf9b64 044/273: README: Update description of chat parameters, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 051501c892 035/273: README: Change installation instructions (no aio), ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 1ab8a57183 051/273: add installation instructions, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel cd22ea836c 045/273: Add autoload for gptel-send, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel f843614f5b 048/273: gptel: Set gptel-api-key if reading from minibuffer, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel a500c76a68 053/273: Encode a lambda-provided API key as utf-8,
ELPA Syncer <=
- [nongnu] elpa/gptel c22c59d20a 061/273: gptel: Add post-response hook and fix org converter, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 1cd0f58552 067/273: gptel-curl: Better error handling when streaming, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 44045be327 072/273: gptel: gptel-mode is local by default, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel a43f5ac5fa 064/273: gptel: Rename stream-related vars and defuns, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 2e34981aa0 062/273: gptel: Rename :insert-marker, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 23332a9bc5 077/273: gptel-transient: Add outline-minor-mode support, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 00abbf7597 081/273: gptel-transient: More visual feedback, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 444a43134f 083/273: gptel-curl: Fix current-buffer for Curl requests, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel 37c381c2e5 092/273: README: Update with acknowledgments and more, ELPA Syncer, 2024/05/01
- [nongnu] elpa/gptel d13b0c4ab7 088/273: gptel-transient: Fix gptel-system-prompt, ELPA Syncer, 2024/05/01