Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

服务端响应为stream流式响应时不能使用协程,仍然会堵塞执行 #29

Open
grayTele opened this issue Nov 26, 2023 · 1 comment

Comments

@grayTele
Copy link

请求openai的流式响应输出

{
	"url": "https:\/\/api.openai.com\/v1\/chat\/completions",
	"method": "POST",
	"data": {
		"model": "gpt-3.5-turbo",
		"messages": [{
			"role": "user",
			"content": "200字以上笑话"
		}],
		"temperature": 1,
		"frequency_penalty": 0,
		"presence_penalty": 0,
		"stream": true,
		"top_p": 1
	}
}
@grayTele
Copy link
Author

设置 DefaultHandler::setDefaultHandler(SwooleHandler::class);
不生效,只能设置单个设置才行

   $handler = new SwooleHandler();
                        $stack = HandlerStack::create($handler);
                    $client = new \GuzzleHttp\Client(['handler' => $stack]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant