gptel-anthropic: Parsing fix
gptel-anthropic.el (gptel-curl--parse-stream): When parsing responses from Anthropic, wait for more input when the corresponding data chunk for the event hasn't arrived yet. (#261)
This commit is contained in:
parent
9a5a4a60d5
commit
26326c302e
1 changed files with 2 additions and 0 deletions
|
@ -45,6 +45,8 @@
|
||||||
(condition-case nil
|
(condition-case nil
|
||||||
(while (re-search-forward "^event: " nil t)
|
(while (re-search-forward "^event: " nil t)
|
||||||
(setq pt (match-beginning 0))
|
(setq pt (match-beginning 0))
|
||||||
|
(if (equal (line-end-position) (point-max))
|
||||||
|
(error "Data block incomplete"))
|
||||||
(when (looking-at "content_block_\\(?:start\\|delta\\|stop\\)")
|
(when (looking-at "content_block_\\(?:start\\|delta\\|stop\\)")
|
||||||
(forward-line 1) (forward-char 5)
|
(forward-line 1) (forward-char 5)
|
||||||
(when-let* ((response (gptel--json-read))
|
(when-let* ((response (gptel--json-read))
|
||||||
|
|
Loading…
Add table
Reference in a new issue