Request $request)
{
$connection = $request->connection;
// https://api.openai.com 国内访问不到的话可以用地址], [
'stream' => function($data) use ($connection) {
// 当openai接口返回数据时转发给浏览器"\n"));
}
// 返回空的chunk代表响应结束
$connection->send(new Chunk(''));
},
]);
// 先返回一个http头,后面数据异步返回
return response()->withHeaders