{
    "openapi": "3.0.0",
    "info": {
        "title": "天行机器人 - API文档",
        "version": "1.0.0",
        "description": "<p>天行机器人支持私有词库批量管理、对话管理及机器人三十多项能力设置。<span style=\"color:red\">您可以在控制台 - 人机管理 - 身份属性中设置机器人身份信息或自行替换机器人名称{robotname}等变量代码<\/span>。完成设置后，可以通过向机器人发送指令“robot”查看代码或设置效果。<\/p>\n<p>受限于技术因素，目前机器人智能交互问答能力一般，建议先测试是否符合项目需求。mode参数设置为2私有词库模式时，机器人只会从您后台添加的私有词库中找结果，你可以通过priv参数选择适合的匹配方式。<\/p>\n<p>帮助扩展：天行机器人的<a target=\"_blank\" href=\"https:\/\/www.tianapi.com\/article\/82\">功能介绍<\/a>、如何使用<a target=\"_blank\" href=\"https:\/\/www.tianapi.com\/article\/143\">私有词库的多种匹配模式<\/a>、漫游机器人对话记录<a target=\"_blank\" href=\"https:\/\/www.tianapi.com\/apiview\/179\">机器人日志<\/a>接口、快速体验<a target=\"_blank\" href=\"https:\/\/www.tianapi.com\/demo\/robot\">天行机器人<\/a>。\n<p>本平台已纳入地方网安部门日常巡查管理，一经发现如诈骗、色情等违法情形，将直接封号并立即上报地方网安部门。<\/p>"
    },
    "servers": [
        {
            "url": "https:\/\/apis.tianapi.com"
        }
    ],
    "paths": {
        "\/robot\/index": {
            "get": {
                "summary": "天行机器人对话",
                "tags": [
                    "天行机器人"
                ],
                "description": "机器人交互对话支持三十多个小功能",
                "parameters": [
                    {
                        "name": "key",
                        "in": "query",
                        "description": "API密钥",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "description": "API密钥"
                        }
                    },
                    {
                        "name": "mode",
                        "in": "query",
                        "description": "工作模式，宽松模式0（回答率高）、精确模式1（相关性高）、私有模式2（只从私有词库中回答）",
                        "required": false,
                        "schema": {
                            "type": "int",
                            "example": 0,
                            "description": "工作模式，宽松模式0（回答率高）、精确模式1（相关性高）、私有模式2（只从私有词库中回答）"
                        }
                    },
                    {
                        "name": "priv",
                        "in": "query",
                        "description": "私有词库匹配模式，完整匹配0[默认]、智能匹配1、模糊匹配2、结尾匹配3、开头匹配4",
                        "required": false,
                        "schema": {
                            "type": "int",
                            "example": 0,
                            "description": "私有词库匹配模式，完整匹配0[默认]、智能匹配1、模糊匹配2、结尾匹配3、开头匹配4"
                        }
                    },
                    {
                        "name": "restype",
                        "in": "query",
                        "description": "输入类型，文本0、语音1、人脸图片2",
                        "required": false,
                        "schema": {
                            "type": "int",
                            "example": 0,
                            "description": "输入类型，文本0、语音1、人脸图片2"
                        }
                    },
                    {
                        "name": "question",
                        "in": "query",
                        "description": "提问（建议urlencode）",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "example": "robot",
                            "description": "提问（建议urlencode）"
                        }
                    },
                    {
                        "name": "uniqueid",
                        "in": "query",
                        "description": "用户唯一身份ID，方便上下文关联",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "a36586d752193ea6",
                            "description": "用户唯一身份ID，方便上下文关联"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "成功响应",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "reply": {
                                            "type": "string",
                                            "example": "亲爱的主银你好，我叫小天......",
                                            "description": "回答内容，datatype为view时返回一个列表对象"
                                        },
                                        "datatype": {
                                            "type": "string",
                                            "example": "text",
                                            "description": "数据类型：text文本；view图文；image图片"
                                        }
                                    }
                                },
                                "example": {
                                    "msg": "success",
                                    "code": 200,
                                    "result": {
                                        "reply": "亲爱的主银你好，我叫小天，性别男，来自湖北，正在从事互联网工作。金牛座的我，爱好摄影也喜欢和人类做朋友！",
                                        "datatype": "text"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "summary": "天行机器人对话",
                "tags": [
                    "天行机器人"
                ],
                "description": "机器人交互对话支持三十多个小功能",
                "requestBody": {
                    "content": {
                        "application\/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "key": {
                                        "type": "string",
                                        "description": "API密钥"
                                    },
                                    "mode": {
                                        "type": "int",
                                        "example": 0,
                                        "description": "工作模式，宽松模式0（回答率高）、精确模式1（相关性高）、私有模式2（只从私有词库中回答）"
                                    },
                                    "priv": {
                                        "type": "int",
                                        "example": 0,
                                        "description": "私有词库匹配模式，完整匹配0[默认]、智能匹配1、模糊匹配2、结尾匹配3、开头匹配4"
                                    },
                                    "restype": {
                                        "type": "int",
                                        "example": 0,
                                        "description": "输入类型，文本0、语音1、人脸图片2"
                                    },
                                    "question": {
                                        "type": "string",
                                        "example": "robot",
                                        "description": "提问（建议urlencode）"
                                    },
                                    "uniqueid": {
                                        "type": "string",
                                        "example": "a36586d752193ea6",
                                        "description": "用户唯一身份ID，方便上下文关联"
                                    }
                                },
                                "required": [
                                    "key",
                                    "question"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "成功响应",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "reply": {
                                            "type": "string",
                                            "example": "亲爱的主银你好，我叫小天......",
                                            "description": "回答内容，datatype为view时返回一个列表对象"
                                        },
                                        "datatype": {
                                            "type": "string",
                                            "example": "text",
                                            "description": "数据类型：text文本；view图文；image图片"
                                        }
                                    }
                                },
                                "example": {
                                    "msg": "success",
                                    "code": 200,
                                    "result": {
                                        "reply": "亲爱的主银你好，我叫小天，性别男，来自湖北，正在从事互联网工作。金牛座的我，爱好摄影也喜欢和人类做朋友！",
                                        "datatype": "text"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}