|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* This file is part of the mucts.com. |
|
4
|
|
|
* |
|
5
|
|
|
* This source file is subject to the MIT license that is bundled |
|
6
|
|
|
* with this source code in the file LICENSE. |
|
7
|
|
|
* |
|
8
|
|
|
* @version 1.0 |
|
9
|
|
|
* @author herry<[email protected]> |
|
10
|
|
|
* @copyright © 2020 MuCTS.com All Rights Reserved. |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace MuCTS\Sobot\Robot; |
|
14
|
|
|
|
|
15
|
|
|
|
|
16
|
|
|
use MuCTS\Sobot\Contracts\Sobot; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Class RobotChat |
|
20
|
|
|
* 用户咨询机器人 |
|
21
|
|
|
* |
|
22
|
|
|
* 接口说明: |
|
23
|
|
|
* 接口类型:主动调用接口。 |
|
24
|
|
|
* 接口作用:可通过调用该接口实现以用户的身份咨询机器人并获取答案。 |
|
25
|
|
|
* |
|
26
|
|
|
* @property-write string $partnerid 企业自己的用户id,可自行传值 |
|
27
|
|
|
* @property-write string $question 用户问题,示例参照表格下方详解 |
|
28
|
|
|
* @property-write string|null $user_nick 用户昵称 |
|
29
|
|
|
* @property-write int|null $source 用户渠道,0:pc,1:微信,2:app,3:微博,4:移动网站,9:企业微信,10:小程序 |
|
30
|
|
|
* @property-write int|null $robot_flag 机器人编号 |
|
31
|
|
|
* @property-write int|null $question_flag 问题类型,问题类型:点击-1,输入-0,多轮会话中点击-2 |
|
32
|
|
|
* @property-write string|null $request_text 问题内容,questionFlag=0时,传入原问题; questionFlag=1时,传入docId; questionFlag=2时,示例参照表格下方详解 |
|
33
|
|
|
* |
|
34
|
|
|
* @method RobotChat partnerid(string $value) 企业自己的用户id,可自行传值 |
|
35
|
|
|
* @method RobotChat question(string $value) 用户问题,示例参照表格下方详解 |
|
36
|
|
|
* @method RobotChat userNick(?string $value) 用户昵称 |
|
37
|
|
|
* @method RobotChat source(?int $value) 用户渠道,0:pc, 1:微信,2:app, 3:微博,4:移动网站,9:企业微信,10:小程序 |
|
38
|
|
|
* @method RobotChat robotFlag(?int $value) 机器人编号 |
|
39
|
|
|
* @method RobotChat questionFlag(?int $value) 问题类型,问题类型:点击-1,输入-0,多轮会话中点击-2 |
|
40
|
|
|
* @method RobotChat requestText(?string $value) 问题内容,questionFlag = 0时,传入原问题; questionFlag = 1时,传入docId; questionFlag = 2时,示例参照表格下方详解 |
|
41
|
|
|
* |
|
42
|
|
|
* @link https://www.sobot.com/developerdocs/service/knowledge_base.html#_2-3%E3%80%81%E7%94%A8%E6%88%B7%E5%92%A8%E8%AF%A2%E6%9C%BA%E5%99%A8%E4%BA%BA |
|
43
|
|
|
* |
|
44
|
|
|
* @package MuCTS\Sobot\Robot |
|
45
|
|
|
*/ |
|
46
|
|
|
class RobotChat extends Sobot |
|
47
|
|
|
{ |
|
48
|
|
|
|
|
49
|
|
|
public function getRequestMethod(): string |
|
50
|
|
|
{ |
|
51
|
|
|
return self::METHOD_POST; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function getRequestPath(): string |
|
55
|
|
|
{ |
|
56
|
|
|
return '/api/chat/5/user/robot_chat'; |
|
57
|
|
|
} |
|
58
|
|
|
} |