作者 lyh

gx

... ... @@ -71,10 +71,10 @@ class ChatLogic extends BaseLogic
$chunk = $stream->read(1024);
if ($chunk !== false) {
$chunk = json_decode($chunk,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($chunk['text'], true) . PHP_EOL, FILE_APPEND);
$aiResponse .= $chunk['text']; // 累积完整的 AI 回复
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($chunk, true) . PHP_EOL, FILE_APPEND);
$aiResponse .= $chunk; // 累积完整的 AI 回复
// 使用 en_sse_data 格式化流数据
echo $gptService->en_sse_data(trim($chunk['text']));
echo $gptService->en_sse_data(trim($chunk));
ob_flush();
flush();
}
... ...