1
0
Fork 0

Avoid repetition of the choices of the summary choices

This commit is contained in:
Bram Schoenmakers 2024-02-23 22:22:53 +01:00
parent fa402763fa
commit eb846635a0
Signed by: bram
GPG key ID: 0CCD19DFDC63258F
2 changed files with 4 additions and 1 deletions

View file

@ -314,6 +314,8 @@ https://www.example.com"
(setq kagi-summarizer-engine "steve")
(expect (kagi-summarize dummy-https-url) :to-equal dummy-output)
(kagi-test--expect-object #'kagi--call-summarizer "engine" :to-equal "cecil"))
(it "returns a summary when the summary style is requested"
(expect (kagi-summarize just-enough-text-input nil nil 'summary) :to-equal dummy-output))
(it "returns a summary when the take-away style is requested"
(expect (kagi-summarize just-enough-text-input nil nil 'takeaway) :to-equal dummy-output))
(it "uses the summary style when an invalid format is given"

View file

@ -553,7 +553,8 @@ to `kagi-summarizer-default-language'."
(defun kagi--summarizer-format (hint)
"Return a valid summary type based on the type given in HINT."
(let ((choices '(summary takeaway)))
(let* ((custom-type (cdr (get 'kagi-summarizer-default-summary-format 'custom-type)))
(choices (mapcar (lambda (e) (car (last e))) custom-type)))
(cond ((seq-contains-p choices hint) hint)
((seq-contains-p choices kagi-summarizer-default-summary-format)
kagi-summarizer-default-summary-format)