From d12fa61748f85297c2b68c11653f91b88b753a1c Mon Sep 17 00:00:00 2001 From: Bram Schoenmakers Date: Fri, 29 Dec 2023 08:45:43 +0100 Subject: [PATCH] Add flag to toggle cached results from the Summarizer API --- kagi.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/kagi.el b/kagi.el index 7be9386..3ed2a24 100644 --- a/kagi.el +++ b/kagi.el @@ -126,6 +126,16 @@ https://help.kagi.com/kagi/api/summarizer.html." (const :tag "Chinese (simplified)" "ZH")) :group 'kagi) +(defcustom kagi-api-summarizer-cache t + "Determines whether the Summarizer should cache results. + +Repetitive queries won't be charged if caching is enabled (the +default). For sensitive texts, you may opt for disabling the +cache by setting this item to nil (but subsequent queries on the +same text will be charged.)" + :type 'boolean + :group 'kagi) + (defface kagi-bold '((t :inherit bold)) "Face for bold parts in the Kagi output." :group 'kagi) @@ -241,7 +251,8 @@ configuration. The given ITEMS are appended to it, which is a list of conses." (append items `(("engine" . ,kagi-api-summarizer-engine) - ("summary_type" . "summary")) + ("summary_type" . "summary") + ("cache" . ,kagi-api-summarizer-cache)) ;; prevent a nil in the result list, causing (json-encode) ;; to generate a wrong request object.