1
0
Fork 0

Detect URL properly, such that correct API call is made

This fixes issue #2. Whenever a text contains an URL anywhere, the
kagi-url-p function would return positive and the text is submitted as
an URL to the Kagi Summarizer API. Now this is only done when the
string is a URL only, otherwise the text summarizer is invoked.
This commit is contained in:
Bram Schoenmakers 2024-01-11 19:20:39 +01:00
parent fe72d5cebc
commit bc0eb7023b
Signed by: bram
GPG key ID: 0CCD19DFDC63258F

View file

@ -337,7 +337,7 @@ Returns a formatted string to be displayed by the shell."
(defun kagi--url-p (s)
"Non-nil if string S is a URL."
(string-match-p (rx (seq "http" (? "s") "://")) s))
(string-match-p (rx (seq bos "http" (? "s") "://" (+ (not space)) eos)) s))
;;;###autoload
(defun kagi-summarize (text-or-url)