合并分支 'lyh-server' 到 'master'
gx 查看合并请求 !1709
正在显示
1 个修改的文件
包含
2 行增加
和
2 行删除
| @@ -68,9 +68,9 @@ class ChatLogic extends BaseLogic | @@ -68,9 +68,9 @@ class ChatLogic extends BaseLogic | ||
| 68 | header('Connection: keep-alive'); | 68 | header('Connection: keep-alive'); |
| 69 | $aiResponse = ''; | 69 | $aiResponse = ''; |
| 70 | while (!$stream->eof()) { | 70 | while (!$stream->eof()) { |
| 71 | - $chunk = $stream->read(1024); | 71 | + $chunk = $stream->read(1); |
| 72 | + $chunk = str_replace(chr(1), '', $chunk); | ||
| 72 | if ($chunk !== false) { | 73 | if ($chunk !== false) { |
| 73 | - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($chunk, true) . PHP_EOL, FILE_APPEND); | ||
| 74 | $aiResponse .= $chunk; // 累积完整的 AI 回复 | 74 | $aiResponse .= $chunk; // 累积完整的 AI 回复 |
| 75 | // 使用 en_sse_data 格式化流数据 | 75 | // 使用 en_sse_data 格式化流数据 |
| 76 | echo $gptService->en_sse_data(trim($chunk)); | 76 | echo $gptService->en_sse_data(trim($chunk)); |
-
请 注册 或 登录 后发表评论