更新
This commit is contained in:
parent
9dccfd0bf5
commit
5140a4adc4
@ -33,12 +33,16 @@ class XunFeiController extends BaseApiController
|
||||
|
||||
public function chat()
|
||||
{
|
||||
$parmas=$this->request->param('content');
|
||||
if(empty($parmas)){
|
||||
return $this->success('success');
|
||||
}
|
||||
$chat=new ChatClient($this->app_id,$this->api_key,$this->api_secret);
|
||||
$client = new Client($chat->assembleAuthUrl('wss://spark-api.xf-yun.com/v2.1/chat'));
|
||||
// 连接到 WebSocket 服务器
|
||||
if ($client) {
|
||||
// 发送数据到 WebSocket 服务器
|
||||
$data = $this->getBody($this->app_id,"你是谁?");
|
||||
$data = $this->getBody($this->app_id,$parmas);
|
||||
|
||||
$client->send($data);
|
||||
// 从 WebSocket 服务器接收数据
|
||||
|
Loading…
x
Reference in New Issue
Block a user