Skip to content

Commit 53be24e

Browse files
psionic-kkarthink
authored andcommitted
gptel-kagi: Use gptel--trim-prefixes
* gptel-kagi.el (gptel--parse-buffer): Use this helper instead of the expanded call to string-trim.
1 parent 52f1902 commit 53be24e

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

gptel-kagi.el

+4-7
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,10 @@
9898
(user-error "No user prompt found!")
9999
(let ((prompts
100100
(if (or gptel-mode gptel-track-response)
101-
(string-trim
102-
(buffer-substring-no-properties (prop-match-beginning prop)
103-
(prop-match-end prop))
104-
(format "[\t\r\n ]*\\(?:%s\\)?[\t\r\n ]*"
105-
(regexp-quote (gptel-prompt-prefix-string)))
106-
(format "[\t\r\n ]*\\(?:%s\\)?[\t\r\n ]*"
107-
(regexp-quote (gptel-response-prefix-string))))
101+
(or (gptel--trim-prefixes
102+
(buffer-substring-no-properties (prop-match-beginning prop)
103+
(prop-match-end prop)))
104+
"")
108105
(string-trim (buffer-substring-no-properties (point-min) (point-max))))))
109106
(pcase-exhaustive (gptel--model-name gptel-model)
110107
("fastgpt" (setq prompts (list :query (if (prop-match-p prop) prompts ""))))

0 commit comments

Comments
 (0)