gptel-anthropic: Simplify stream parser
* gptel-anthropic.el (gptel-curl--parse-stream): Remove extraneous statements and simplify the stream parser. Addresses #261, but the main problem is still elusive.
This commit is contained in:
parent
22f7043c32
commit
5d069cfca8
1 changed files with 6 additions and 8 deletions
|
@ -45,14 +45,12 @@
|
|||
(condition-case nil
|
||||
(while (re-search-forward "^event: " nil t)
|
||||
(setq pt (match-beginning 0))
|
||||
(cond
|
||||
((looking-at "content_block_\\(?:start\\|delta\\|stop\\)")
|
||||
(save-match-data
|
||||
(when (looking-at "content_block_\\(?:start\\|delta\\|stop\\)")
|
||||
(forward-line 1) (forward-char 5)
|
||||
(when-let* ((response (gptel--json-read))
|
||||
(content (map-nested-elt
|
||||
response '(:delta :text))))
|
||||
(push content content-strs))))))
|
||||
(push content content-strs))))
|
||||
(error (goto-char pt)))
|
||||
(apply #'concat (nreverse content-strs))))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue