chore(addon/aikefu): 流式对话接口实现

This commit is contained in:
2025-12-10 10:19:36 +08:00
parent fd7593c72b
commit ed81982239
4 changed files with 828 additions and 314 deletions

View File

@@ -12,7 +12,7 @@ class KefuChat
/**
* 处理智能客服聊天事件
* @param array $data 事件数据
* @return array
* @return array|null
*/
public function handle($data)
{
@@ -26,6 +26,11 @@ class KefuChat
// 调用addon的chat方法
$response = $kefu_api->chat();
// 对于流式请求,直接输出不返回数据
if (isset($data['stream']) && $data['stream']) {
return null;
}
// 返回响应数据
return json_decode($response->getContent(), true);
} catch (\Exception $e) {