|
|
@@ -2428,6 +2428,11 @@ class DeepSeekService
|
|
|
}
|
|
|
|
|
|
// 处理流式输出
|
|
|
+ if (!is_iterable($streamGenerator)) {
|
|
|
+ dLog('deepseek')->error('addChat流式生成器无效', ['generator_type' => gettype($streamGenerator)]);
|
|
|
+ Utils::throwError('20003:接口返回数据异常,请重新请求');
|
|
|
+ }
|
|
|
+
|
|
|
foreach ($streamGenerator as $chunk) {
|
|
|
if (isset($chunk['type'])) {
|
|
|
if ($chunk['type'] === 'done') {
|
|
|
@@ -3272,6 +3277,11 @@ class DeepSeekService
|
|
|
}
|
|
|
|
|
|
// 处理流式输出
|
|
|
+ if (!is_iterable($streamGenerator)) {
|
|
|
+ dLog('deepseek')->error('chat流式生成器无效', ['generator_type' => gettype($streamGenerator)]);
|
|
|
+ Utils::throwError('20003:接口返回数据异常,请重新请求');
|
|
|
+ }
|
|
|
+
|
|
|
foreach ($streamGenerator as $chunk) {
|
|
|
if (isset($chunk['type'])) {
|
|
|
if ($chunk['type'] === 'done') {
|