Skip to content

Commit 1f3c133

Browse files
authored
Update Chat.php
1 parent 50a750f commit 1f3c133

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Chat.php

+9
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,15 @@ public static function formatResponse($buffer)
9494
if ($json) {
9595
return $json;
9696
}
97+
if ($buffer[0] === '<') {
98+
return [
99+
'error' => [
100+
'code' => 'parse_error',
101+
'message' => 'Invalid response from api',
102+
'detail' => $buffer
103+
]
104+
];
105+
}
97106
$chunks = explode("\n", $buffer);
98107
$content = '';
99108
$finishReason = null;

0 commit comments

Comments
 (0)