From eb3d486534f45ecb71089e2369c4d6acf15c3a0f Mon Sep 17 00:00:00 2001 From: Bram Schoenmakers Date: Fri, 2 Feb 2024 21:31:05 +0100 Subject: [PATCH] Started with takeaway summary support --- kagi.el | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/kagi.el b/kagi.el index 801c1fc..658a73b 100644 --- a/kagi.el +++ b/kagi.el @@ -162,6 +162,19 @@ same text will be charged.)" :type 'boolean :group 'kagi) +(defconst kagi--summarizer-summary-formats '((paragraph . "summary") + (takeaway . "takeaway")) + "Mapping from summary type symbol to the expected API string.") + +(defcustom kagi-summarizer-default-summary-format 'paragraph + "The summary format that should be returned. + +Symbol paragraph returns a paragraph of prose. Symbol takeaway +returns a bullet list." + :type '(choice (const :tag "Paragraph" paragraph) + (const :tag "Bullet-list" takeaway)) + :group 'kagi) + (defface kagi-bold '((t :inherit bold)) "Face for bold parts in the Kagi output." :group 'kagi) @@ -324,7 +337,8 @@ list of conses." (append items `(("engine" . ,kagi-summarizer-engine) ("summary_type" . "summary") - ("cache" . ,kagi-summarizer-cache)) + ("cache" . ,kagi-summarizer-cache) + ("summary_type" . ,kagi-summarizer-default-summary-format)) ;; prevent a nil in the result list, causing (json-encode) ;; to generate a wrong request object.