第一次提交:阿龙电竞 Django 后端最新版本

This commit is contained in:
XingQue
2026-06-14 02:23:24 +08:00
commit 4f7bf00224
9654 changed files with 5417000 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
# -*- coding: utf8 -*-
# Copyright (c) 2017-2025 Tencent. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# 内部错误。
INTERNALERROR = 'InternalError'
# 调用元数据服务失败。
INTERNALERROR_CALLMMSFAILED = 'InternalError.CallMMSFailed'
# 请求ASR服务失败。
INTERNALERROR_ERRORASR = 'InternalError.ErrorAsr'
# 查询数据库失败,没有对应数据。
INTERNALERROR_ERRORMMS = 'InternalError.ErrorMms'
# nlu处理失败。
INTERNALERROR_ERRORNLU = 'InternalError.ErrorNlu'
# rpc调用失败。
INTERNALERROR_ERRORRPC = 'InternalError.ErrorRpc'
# 请求TTS服务失败。
INTERNALERROR_ERRORTTS = 'InternalError.ErrorTts'
# webHook处理失败。
INTERNALERROR_ERRORWEBHOOK = 'InternalError.ErrorWebHook'
# 查询元数据失败,没有对应数据。
INTERNALERROR_MMSINTERNALERROR = 'InternalError.MMSInternalError'
# 未开通相关应用访问权限。
INTERNALERROR_NOAPPPRIVILEGE = 'InternalError.NoAppPrivilege'
# 参数错误。
INVALIDPARAMETER = 'InvalidParameter'

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,118 @@
# -*- coding: utf8 -*-
# Copyright (c) 2017-2025 Tencent. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import json
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.common.abstract_client import AbstractClient
from tencentcloud.tbp.v20190311 import models
class TbpClient(AbstractClient):
_apiVersion = '2019-03-11'
_endpoint = 'tbp.tencentcloudapi.com'
_service = 'tbp'
def CreateBot(self, request):
r"""创建机器人
:param request: Request instance for CreateBot.
:type request: :class:`tencentcloud.tbp.v20190311.models.CreateBotRequest`
:rtype: :class:`tencentcloud.tbp.v20190311.models.CreateBotResponse`
"""
try:
params = request._serialize()
headers = request.headers
body = self.call("CreateBot", params, headers=headers)
response = json.loads(body)
model = models.CreateBotResponse()
model._deserialize(response["Response"])
return model
except Exception as e:
if isinstance(e, TencentCloudSDKException):
raise
else:
raise TencentCloudSDKException(type(e).__name__, str(e))
def Reset(self, request):
r"""对当前机器人的会话状态进行复位
:param request: Request instance for Reset.
:type request: :class:`tencentcloud.tbp.v20190311.models.ResetRequest`
:rtype: :class:`tencentcloud.tbp.v20190311.models.ResetResponse`
"""
try:
params = request._serialize()
headers = request.headers
body = self.call("Reset", params, headers=headers)
response = json.loads(body)
model = models.ResetResponse()
model._deserialize(response["Response"])
return model
except Exception as e:
if isinstance(e, TencentCloudSDKException):
raise
else:
raise TencentCloudSDKException(type(e).__name__, str(e))
def TextProcess(self, request):
r"""接收调用侧的文本输入返回应答文本。已废弃推荐使用最新版TextProcess接口。
:param request: Request instance for TextProcess.
:type request: :class:`tencentcloud.tbp.v20190311.models.TextProcessRequest`
:rtype: :class:`tencentcloud.tbp.v20190311.models.TextProcessResponse`
"""
try:
params = request._serialize()
headers = request.headers
body = self.call("TextProcess", params, headers=headers)
response = json.loads(body)
model = models.TextProcessResponse()
model._deserialize(response["Response"])
return model
except Exception as e:
if isinstance(e, TencentCloudSDKException):
raise
else:
raise TencentCloudSDKException(type(e).__name__, str(e))
def TextReset(self, request):
r"""会话重置接口。已废弃推荐使用最新版TextReset接口。
:param request: Request instance for TextReset.
:type request: :class:`tencentcloud.tbp.v20190311.models.TextResetRequest`
:rtype: :class:`tencentcloud.tbp.v20190311.models.TextResetResponse`
"""
try:
params = request._serialize()
headers = request.headers
body = self.call("TextReset", params, headers=headers)
response = json.loads(body)
model = models.TextResetResponse()
model._deserialize(response["Response"])
return model
except Exception as e:
if isinstance(e, TencentCloudSDKException):
raise
else:
raise TencentCloudSDKException(type(e).__name__, str(e))

View File

@@ -0,0 +1,98 @@
# -*- coding: utf8 -*-
# Copyright (c) 2017-2025 Tencent. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from tencentcloud.common.abstract_client_async import AbstractClient
from tencentcloud.tbp.v20190311 import models
from typing import Dict
class TbpClient(AbstractClient):
_apiVersion = '2019-03-11'
_endpoint = 'tbp.tencentcloudapi.com'
_service = 'tbp'
async def CreateBot(
self,
request: models.CreateBotRequest,
opts: Dict = None,
) -> models.CreateBotResponse:
"""
创建机器人
"""
kwargs = {}
kwargs["action"] = "CreateBot"
kwargs["params"] = request._serialize()
kwargs["resp_cls"] = models.CreateBotResponse
kwargs["headers"] = request.headers
kwargs["opts"] = opts or {}
return await self.call_and_deserialize(**kwargs)
async def Reset(
self,
request: models.ResetRequest,
opts: Dict = None,
) -> models.ResetResponse:
"""
对当前机器人的会话状态进行复位
"""
kwargs = {}
kwargs["action"] = "Reset"
kwargs["params"] = request._serialize()
kwargs["resp_cls"] = models.ResetResponse
kwargs["headers"] = request.headers
kwargs["opts"] = opts or {}
return await self.call_and_deserialize(**kwargs)
async def TextProcess(
self,
request: models.TextProcessRequest,
opts: Dict = None,
) -> models.TextProcessResponse:
"""
接收调用侧的文本输入返回应答文本。已废弃推荐使用最新版TextProcess接口。
"""
kwargs = {}
kwargs["action"] = "TextProcess"
kwargs["params"] = request._serialize()
kwargs["resp_cls"] = models.TextProcessResponse
kwargs["headers"] = request.headers
kwargs["opts"] = opts or {}
return await self.call_and_deserialize(**kwargs)
async def TextReset(
self,
request: models.TextResetRequest,
opts: Dict = None,
) -> models.TextResetResponse:
"""
会话重置接口。已废弃推荐使用最新版TextReset接口。
"""
kwargs = {}
kwargs["action"] = "TextReset"
kwargs["params"] = request._serialize()
kwargs["resp_cls"] = models.TextResetResponse
kwargs["headers"] = request.headers
kwargs["opts"] = opts or {}
return await self.call_and_deserialize(**kwargs)

View File

@@ -0,0 +1,36 @@
# -*- coding: utf8 -*-
# Copyright (c) 2017-2025 Tencent. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# 内部错误。
INTERNALERROR = 'InternalError'
# 查询数据库失败,没有对应数据。
INTERNALERROR_ERRORMMS = 'InternalError.ErrorMms'
# nlu处理失败。
INTERNALERROR_ERRORNLU = 'InternalError.ErrorNlu'
# rpc调用失败。
INTERNALERROR_ERRORRPC = 'InternalError.ErrorRpc'
# webHook处理失败。
INTERNALERROR_ERRORWEBHOOK = 'InternalError.ErrorWebHook'
# 未开通相关应用访问权限。
INTERNALERROR_NOAPPPRIVILEGE = 'InternalError.NoAppPrivilege'
# 参数错误。
INVALIDPARAMETER = 'InvalidParameter'

View File

@@ -0,0 +1,782 @@
# -*- coding: utf8 -*-
# Copyright (c) 2017-2025 Tencent. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import warnings
from tencentcloud.common.abstract_model import AbstractModel
class Group(AbstractModel):
r"""Group是消息组的具体定义当前包含ContentType、Url、Content三个字段。其中具体的ContentType字段定义参考互联网MIME类型标准。
"""
def __init__(self):
r"""
:param _ContentType: 消息类型参考互联网MIME类型标准当前仅支持"text/plain"
:type ContentType: str
:param _Url: 返回内容以链接形式提供。
注意:此字段可能返回 null表示取不到有效值。
:type Url: str
:param _Content: 普通文本。
注意:此字段可能返回 null表示取不到有效值。
:type Content: str
"""
self._ContentType = None
self._Url = None
self._Content = None
@property
def ContentType(self):
r"""消息类型参考互联网MIME类型标准当前仅支持"text/plain"
:rtype: str
"""
return self._ContentType
@ContentType.setter
def ContentType(self, ContentType):
self._ContentType = ContentType
@property
def Url(self):
r"""返回内容以链接形式提供。
注意:此字段可能返回 null表示取不到有效值。
:rtype: str
"""
return self._Url
@Url.setter
def Url(self, Url):
self._Url = Url
@property
def Content(self):
r"""普通文本。
注意:此字段可能返回 null表示取不到有效值。
:rtype: str
"""
return self._Content
@Content.setter
def Content(self, Content):
self._Content = Content
def _deserialize(self, params):
self._ContentType = params.get("ContentType")
self._Url = params.get("Url")
self._Content = params.get("Content")
memeber_set = set(params.keys())
for name, value in vars(self).items():
property_name = name[1:]
if property_name in memeber_set:
memeber_set.remove(property_name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class ResponseMessage(AbstractModel):
r"""从TBP-RTS服务v1.3版本起机器人以消息组列表的形式响应消息组列表GroupList包含多组消息用户根据需要对部分或全部消息组进行组合使用。
"""
def __init__(self):
r"""
:param _GroupList: 消息组列表。
注意:此字段可能返回 null表示取不到有效值。
:type GroupList: list of Group
"""
self._GroupList = None
@property
def GroupList(self):
r"""消息组列表。
注意:此字段可能返回 null表示取不到有效值。
:rtype: list of Group
"""
return self._GroupList
@GroupList.setter
def GroupList(self, GroupList):
self._GroupList = GroupList
def _deserialize(self, params):
if params.get("GroupList") is not None:
self._GroupList = []
for item in params.get("GroupList"):
obj = Group()
obj._deserialize(item)
self._GroupList.append(obj)
memeber_set = set(params.keys())
for name, value in vars(self).items():
property_name = name[1:]
if property_name in memeber_set:
memeber_set.remove(property_name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class SlotInfo(AbstractModel):
r"""槽位信息
"""
def __init__(self):
r"""
:param _SlotName: 槽位名称
注意:此字段可能返回 null表示取不到有效值。
:type SlotName: str
:param _SlotValue: 槽位值
注意:此字段可能返回 null表示取不到有效值。
:type SlotValue: str
"""
self._SlotName = None
self._SlotValue = None
@property
def SlotName(self):
r"""槽位名称
注意:此字段可能返回 null表示取不到有效值。
:rtype: str
"""
return self._SlotName
@SlotName.setter
def SlotName(self, SlotName):
self._SlotName = SlotName
@property
def SlotValue(self):
r"""槽位值
注意:此字段可能返回 null表示取不到有效值。
:rtype: str
"""
return self._SlotValue
@SlotValue.setter
def SlotValue(self, SlotValue):
self._SlotValue = SlotValue
def _deserialize(self, params):
self._SlotName = params.get("SlotName")
self._SlotValue = params.get("SlotValue")
memeber_set = set(params.keys())
for name, value in vars(self).items():
property_name = name[1:]
if property_name in memeber_set:
memeber_set.remove(property_name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class TextProcessRequest(AbstractModel):
r"""TextProcess请求参数结构体
"""
def __init__(self):
r"""
:param _BotId: 机器人标识,用于定义抽象机器人。
:type BotId: str
:param _BotEnv: 机器人版本,取值"dev""release"{调试版本dev线上版本release}。
:type BotEnv: str
:param _TerminalId: 终端标识,每个终端(或线程)对应一个,区分并发多用户。
:type TerminalId: str
:param _InputText: 请求的文本。
:type InputText: str
:param _SessionAttributes: 透传字段透传给用户自定义的WebService服务。
:type SessionAttributes: str
:param _PlatformType: 平台类型,{小程序MiniProgram小微XiaoWei公众号OfficialAccount企业微信: WXWork}。
:type PlatformType: str
:param _PlatformId: 当PlatformType为微信公众号或企业微信时传递对应微信公众号或企业微信的唯一标识
:type PlatformId: str
"""
self._BotId = None
self._BotEnv = None
self._TerminalId = None
self._InputText = None
self._SessionAttributes = None
self._PlatformType = None
self._PlatformId = None
@property
def BotId(self):
r"""机器人标识,用于定义抽象机器人。
:rtype: str
"""
return self._BotId
@BotId.setter
def BotId(self, BotId):
self._BotId = BotId
@property
def BotEnv(self):
r"""机器人版本,取值"dev""release"{调试版本dev线上版本release}。
:rtype: str
"""
return self._BotEnv
@BotEnv.setter
def BotEnv(self, BotEnv):
self._BotEnv = BotEnv
@property
def TerminalId(self):
r"""终端标识,每个终端(或线程)对应一个,区分并发多用户。
:rtype: str
"""
return self._TerminalId
@TerminalId.setter
def TerminalId(self, TerminalId):
self._TerminalId = TerminalId
@property
def InputText(self):
r"""请求的文本。
:rtype: str
"""
return self._InputText
@InputText.setter
def InputText(self, InputText):
self._InputText = InputText
@property
def SessionAttributes(self):
r"""透传字段透传给用户自定义的WebService服务。
:rtype: str
"""
return self._SessionAttributes
@SessionAttributes.setter
def SessionAttributes(self, SessionAttributes):
self._SessionAttributes = SessionAttributes
@property
def PlatformType(self):
r"""平台类型,{小程序MiniProgram小微XiaoWei公众号OfficialAccount企业微信: WXWork}。
:rtype: str
"""
return self._PlatformType
@PlatformType.setter
def PlatformType(self, PlatformType):
self._PlatformType = PlatformType
@property
def PlatformId(self):
r"""当PlatformType为微信公众号或企业微信时传递对应微信公众号或企业微信的唯一标识
:rtype: str
"""
return self._PlatformId
@PlatformId.setter
def PlatformId(self, PlatformId):
self._PlatformId = PlatformId
def _deserialize(self, params):
self._BotId = params.get("BotId")
self._BotEnv = params.get("BotEnv")
self._TerminalId = params.get("TerminalId")
self._InputText = params.get("InputText")
self._SessionAttributes = params.get("SessionAttributes")
self._PlatformType = params.get("PlatformType")
self._PlatformId = params.get("PlatformId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
property_name = name[1:]
if property_name in memeber_set:
memeber_set.remove(property_name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class TextProcessResponse(AbstractModel):
r"""TextProcess返回参数结构体
"""
def __init__(self):
r"""
:param _DialogStatus: 当前会话状态{会话开始: START; 会话中: COUTINUE; 会话结束: COMPLETE}。
注意:此字段可能返回 null表示取不到有效值。
:type DialogStatus: str
:param _BotName: 匹配到的机器人名称。
注意:此字段可能返回 null表示取不到有效值。
:type BotName: str
:param _IntentName: 匹配到的意图名称。
注意:此字段可能返回 null表示取不到有效值。
:type IntentName: str
:param _SlotInfoList: 槽位信息。
注意:此字段可能返回 null表示取不到有效值。
:type SlotInfoList: list of SlotInfo
:param _InputText: 原始的用户说法。
注意:此字段可能返回 null表示取不到有效值。
:type InputText: str
:param _ResponseMessage: 机器人应答。
注意:此字段可能返回 null表示取不到有效值。
:type ResponseMessage: :class:`tencentcloud.tbp.v20190627.models.ResponseMessage`
:param _SessionAttributes: 透传字段由用户自定义的WebService服务返回。
注意:此字段可能返回 null表示取不到有效值。
:type SessionAttributes: str
:param _ResultType: 结果类型 {中间逻辑出错:0; 任务型机器人:1; 问答型机器人:2; 闲聊型机器人:3; 未匹配上,返回预设兜底话术:5; 未匹配上,返回相似问题列表:6}。
注意:此字段可能返回 null表示取不到有效值。
:type ResultType: str
:param _ResponseText: 机器人对话的应答文本。
:type ResponseText: str
:param _RequestId: 唯一请求 ID由服务端生成每次请求都会返回若请求因其他原因未能抵达服务端则该次请求不会获得 RequestId。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self._DialogStatus = None
self._BotName = None
self._IntentName = None
self._SlotInfoList = None
self._InputText = None
self._ResponseMessage = None
self._SessionAttributes = None
self._ResultType = None
self._ResponseText = None
self._RequestId = None
@property
def DialogStatus(self):
r"""当前会话状态{会话开始: START; 会话中: COUTINUE; 会话结束: COMPLETE}。
注意:此字段可能返回 null表示取不到有效值。
:rtype: str
"""
return self._DialogStatus
@DialogStatus.setter
def DialogStatus(self, DialogStatus):
self._DialogStatus = DialogStatus
@property
def BotName(self):
r"""匹配到的机器人名称。
注意:此字段可能返回 null表示取不到有效值。
:rtype: str
"""
return self._BotName
@BotName.setter
def BotName(self, BotName):
self._BotName = BotName
@property
def IntentName(self):
r"""匹配到的意图名称。
注意:此字段可能返回 null表示取不到有效值。
:rtype: str
"""
return self._IntentName
@IntentName.setter
def IntentName(self, IntentName):
self._IntentName = IntentName
@property
def SlotInfoList(self):
r"""槽位信息。
注意:此字段可能返回 null表示取不到有效值。
:rtype: list of SlotInfo
"""
return self._SlotInfoList
@SlotInfoList.setter
def SlotInfoList(self, SlotInfoList):
self._SlotInfoList = SlotInfoList
@property
def InputText(self):
r"""原始的用户说法。
注意:此字段可能返回 null表示取不到有效值。
:rtype: str
"""
return self._InputText
@InputText.setter
def InputText(self, InputText):
self._InputText = InputText
@property
def ResponseMessage(self):
r"""机器人应答。
注意:此字段可能返回 null表示取不到有效值。
:rtype: :class:`tencentcloud.tbp.v20190627.models.ResponseMessage`
"""
return self._ResponseMessage
@ResponseMessage.setter
def ResponseMessage(self, ResponseMessage):
self._ResponseMessage = ResponseMessage
@property
def SessionAttributes(self):
r"""透传字段由用户自定义的WebService服务返回。
注意:此字段可能返回 null表示取不到有效值。
:rtype: str
"""
return self._SessionAttributes
@SessionAttributes.setter
def SessionAttributes(self, SessionAttributes):
self._SessionAttributes = SessionAttributes
@property
def ResultType(self):
r"""结果类型 {中间逻辑出错:0; 任务型机器人:1; 问答型机器人:2; 闲聊型机器人:3; 未匹配上,返回预设兜底话术:5; 未匹配上,返回相似问题列表:6}。
注意:此字段可能返回 null表示取不到有效值。
:rtype: str
"""
return self._ResultType
@ResultType.setter
def ResultType(self, ResultType):
self._ResultType = ResultType
@property
def ResponseText(self):
r"""机器人对话的应答文本。
:rtype: str
"""
return self._ResponseText
@ResponseText.setter
def ResponseText(self, ResponseText):
self._ResponseText = ResponseText
@property
def RequestId(self):
r"""唯一请求 ID由服务端生成每次请求都会返回若请求因其他原因未能抵达服务端则该次请求不会获得 RequestId。定位问题时需要提供该次请求的 RequestId。
:rtype: str
"""
return self._RequestId
@RequestId.setter
def RequestId(self, RequestId):
self._RequestId = RequestId
def _deserialize(self, params):
self._DialogStatus = params.get("DialogStatus")
self._BotName = params.get("BotName")
self._IntentName = params.get("IntentName")
if params.get("SlotInfoList") is not None:
self._SlotInfoList = []
for item in params.get("SlotInfoList"):
obj = SlotInfo()
obj._deserialize(item)
self._SlotInfoList.append(obj)
self._InputText = params.get("InputText")
if params.get("ResponseMessage") is not None:
self._ResponseMessage = ResponseMessage()
self._ResponseMessage._deserialize(params.get("ResponseMessage"))
self._SessionAttributes = params.get("SessionAttributes")
self._ResultType = params.get("ResultType")
self._ResponseText = params.get("ResponseText")
self._RequestId = params.get("RequestId")
class TextResetRequest(AbstractModel):
r"""TextReset请求参数结构体
"""
def __init__(self):
r"""
:param _BotId: 机器人标识,用于定义抽象机器人。
:type BotId: str
:param _BotEnv: 机器人版本,取值"dev""release"{调试版本dev线上版本release}。
:type BotEnv: str
:param _TerminalId: 终端标识,每个终端(或线程)对应一个,区分并发多用户。
:type TerminalId: str
:param _PlatformType: 平台类型,{小程序MiniProgram小微XiaoWei公众号OfficialAccount企业微信: WXWork}。
:type PlatformType: str
:param _PlatformId: 当PlatformType为微信公众号或企业微信时传递对应微信公众号或企业微信的唯一标识
:type PlatformId: str
"""
self._BotId = None
self._BotEnv = None
self._TerminalId = None
self._PlatformType = None
self._PlatformId = None
@property
def BotId(self):
r"""机器人标识,用于定义抽象机器人。
:rtype: str
"""
return self._BotId
@BotId.setter
def BotId(self, BotId):
self._BotId = BotId
@property
def BotEnv(self):
r"""机器人版本,取值"dev""release"{调试版本dev线上版本release}。
:rtype: str
"""
return self._BotEnv
@BotEnv.setter
def BotEnv(self, BotEnv):
self._BotEnv = BotEnv
@property
def TerminalId(self):
r"""终端标识,每个终端(或线程)对应一个,区分并发多用户。
:rtype: str
"""
return self._TerminalId
@TerminalId.setter
def TerminalId(self, TerminalId):
self._TerminalId = TerminalId
@property
def PlatformType(self):
r"""平台类型,{小程序MiniProgram小微XiaoWei公众号OfficialAccount企业微信: WXWork}。
:rtype: str
"""
return self._PlatformType
@PlatformType.setter
def PlatformType(self, PlatformType):
self._PlatformType = PlatformType
@property
def PlatformId(self):
r"""当PlatformType为微信公众号或企业微信时传递对应微信公众号或企业微信的唯一标识
:rtype: str
"""
return self._PlatformId
@PlatformId.setter
def PlatformId(self, PlatformId):
self._PlatformId = PlatformId
def _deserialize(self, params):
self._BotId = params.get("BotId")
self._BotEnv = params.get("BotEnv")
self._TerminalId = params.get("TerminalId")
self._PlatformType = params.get("PlatformType")
self._PlatformId = params.get("PlatformId")
memeber_set = set(params.keys())
for name, value in vars(self).items():
property_name = name[1:]
if property_name in memeber_set:
memeber_set.remove(property_name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class TextResetResponse(AbstractModel):
r"""TextReset返回参数结构体
"""
def __init__(self):
r"""
:param _DialogStatus: 当前会话状态{会话开始: START; 会话中: COUTINUE; 会话结束: COMPLETE}。
注意:此字段可能返回 null表示取不到有效值。
:type DialogStatus: str
:param _BotName: 匹配到的机器人名称。
注意:此字段可能返回 null表示取不到有效值。
:type BotName: str
:param _IntentName: 匹配到的意图名称。
注意:此字段可能返回 null表示取不到有效值。
:type IntentName: str
:param _SlotInfoList: 槽位信息。
注意:此字段可能返回 null表示取不到有效值。
:type SlotInfoList: list of SlotInfo
:param _InputText: 原始的用户说法。
注意:此字段可能返回 null表示取不到有效值。
:type InputText: str
:param _ResponseMessage: 机器人应答。
注意:此字段可能返回 null表示取不到有效值。
:type ResponseMessage: :class:`tencentcloud.tbp.v20190627.models.ResponseMessage`
:param _SessionAttributes: 透传字段由用户自定义的WebService服务返回。
注意:此字段可能返回 null表示取不到有效值。
:type SessionAttributes: str
:param _ResultType: 结果类型 {中间逻辑出错:0; 任务型机器人:1; 问答型机器人:2; 闲聊型机器人:3; 未匹配上,返回预设兜底话术:5; 未匹配上,返回相似问题列表:6}。
注意:此字段可能返回 null表示取不到有效值。
:type ResultType: str
:param _ResponseText: 机器人对话的应答文本。
注意:此字段可能返回 null表示取不到有效值。
:type ResponseText: str
:param _RequestId: 唯一请求 ID由服务端生成每次请求都会返回若请求因其他原因未能抵达服务端则该次请求不会获得 RequestId。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self._DialogStatus = None
self._BotName = None
self._IntentName = None
self._SlotInfoList = None
self._InputText = None
self._ResponseMessage = None
self._SessionAttributes = None
self._ResultType = None
self._ResponseText = None
self._RequestId = None
@property
def DialogStatus(self):
r"""当前会话状态{会话开始: START; 会话中: COUTINUE; 会话结束: COMPLETE}。
注意:此字段可能返回 null表示取不到有效值。
:rtype: str
"""
return self._DialogStatus
@DialogStatus.setter
def DialogStatus(self, DialogStatus):
self._DialogStatus = DialogStatus
@property
def BotName(self):
r"""匹配到的机器人名称。
注意:此字段可能返回 null表示取不到有效值。
:rtype: str
"""
return self._BotName
@BotName.setter
def BotName(self, BotName):
self._BotName = BotName
@property
def IntentName(self):
r"""匹配到的意图名称。
注意:此字段可能返回 null表示取不到有效值。
:rtype: str
"""
return self._IntentName
@IntentName.setter
def IntentName(self, IntentName):
self._IntentName = IntentName
@property
def SlotInfoList(self):
r"""槽位信息。
注意:此字段可能返回 null表示取不到有效值。
:rtype: list of SlotInfo
"""
return self._SlotInfoList
@SlotInfoList.setter
def SlotInfoList(self, SlotInfoList):
self._SlotInfoList = SlotInfoList
@property
def InputText(self):
r"""原始的用户说法。
注意:此字段可能返回 null表示取不到有效值。
:rtype: str
"""
return self._InputText
@InputText.setter
def InputText(self, InputText):
self._InputText = InputText
@property
def ResponseMessage(self):
r"""机器人应答。
注意:此字段可能返回 null表示取不到有效值。
:rtype: :class:`tencentcloud.tbp.v20190627.models.ResponseMessage`
"""
return self._ResponseMessage
@ResponseMessage.setter
def ResponseMessage(self, ResponseMessage):
self._ResponseMessage = ResponseMessage
@property
def SessionAttributes(self):
r"""透传字段由用户自定义的WebService服务返回。
注意:此字段可能返回 null表示取不到有效值。
:rtype: str
"""
return self._SessionAttributes
@SessionAttributes.setter
def SessionAttributes(self, SessionAttributes):
self._SessionAttributes = SessionAttributes
@property
def ResultType(self):
r"""结果类型 {中间逻辑出错:0; 任务型机器人:1; 问答型机器人:2; 闲聊型机器人:3; 未匹配上,返回预设兜底话术:5; 未匹配上,返回相似问题列表:6}。
注意:此字段可能返回 null表示取不到有效值。
:rtype: str
"""
return self._ResultType
@ResultType.setter
def ResultType(self, ResultType):
self._ResultType = ResultType
@property
def ResponseText(self):
r"""机器人对话的应答文本。
注意:此字段可能返回 null表示取不到有效值。
:rtype: str
"""
return self._ResponseText
@ResponseText.setter
def ResponseText(self, ResponseText):
self._ResponseText = ResponseText
@property
def RequestId(self):
r"""唯一请求 ID由服务端生成每次请求都会返回若请求因其他原因未能抵达服务端则该次请求不会获得 RequestId。定位问题时需要提供该次请求的 RequestId。
:rtype: str
"""
return self._RequestId
@RequestId.setter
def RequestId(self, RequestId):
self._RequestId = RequestId
def _deserialize(self, params):
self._DialogStatus = params.get("DialogStatus")
self._BotName = params.get("BotName")
self._IntentName = params.get("IntentName")
if params.get("SlotInfoList") is not None:
self._SlotInfoList = []
for item in params.get("SlotInfoList"):
obj = SlotInfo()
obj._deserialize(item)
self._SlotInfoList.append(obj)
self._InputText = params.get("InputText")
if params.get("ResponseMessage") is not None:
self._ResponseMessage = ResponseMessage()
self._ResponseMessage._deserialize(params.get("ResponseMessage"))
self._SessionAttributes = params.get("SessionAttributes")
self._ResultType = params.get("ResultType")
self._ResponseText = params.get("ResponseText")
self._RequestId = params.get("RequestId")

View File

@@ -0,0 +1,72 @@
# -*- coding: utf8 -*-
# Copyright (c) 2017-2025 Tencent. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import json
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.common.abstract_client import AbstractClient
from tencentcloud.tbp.v20190627 import models
class TbpClient(AbstractClient):
_apiVersion = '2019-06-27'
_endpoint = 'tbp.tencentcloudapi.com'
_service = 'tbp'
def TextProcess(self, request):
r"""接收调用侧的文本输入,返回应答文本。
:param request: Request instance for TextProcess.
:type request: :class:`tencentcloud.tbp.v20190627.models.TextProcessRequest`
:rtype: :class:`tencentcloud.tbp.v20190627.models.TextProcessResponse`
"""
try:
params = request._serialize()
headers = request.headers
body = self.call("TextProcess", params, headers=headers)
response = json.loads(body)
model = models.TextProcessResponse()
model._deserialize(response["Response"])
return model
except Exception as e:
if isinstance(e, TencentCloudSDKException):
raise
else:
raise TencentCloudSDKException(type(e).__name__, str(e))
def TextReset(self, request):
r"""会话重置接口。
:param request: Request instance for TextReset.
:type request: :class:`tencentcloud.tbp.v20190627.models.TextResetRequest`
:rtype: :class:`tencentcloud.tbp.v20190627.models.TextResetResponse`
"""
try:
params = request._serialize()
headers = request.headers
body = self.call("TextReset", params, headers=headers)
response = json.loads(body)
model = models.TextResetResponse()
model._deserialize(response["Response"])
return model
except Exception as e:
if isinstance(e, TencentCloudSDKException):
raise
else:
raise TencentCloudSDKException(type(e).__name__, str(e))

View File

@@ -0,0 +1,62 @@
# -*- coding: utf8 -*-
# Copyright (c) 2017-2025 Tencent. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from tencentcloud.common.abstract_client_async import AbstractClient
from tencentcloud.tbp.v20190627 import models
from typing import Dict
class TbpClient(AbstractClient):
_apiVersion = '2019-06-27'
_endpoint = 'tbp.tencentcloudapi.com'
_service = 'tbp'
async def TextProcess(
self,
request: models.TextProcessRequest,
opts: Dict = None,
) -> models.TextProcessResponse:
"""
接收调用侧的文本输入,返回应答文本。
"""
kwargs = {}
kwargs["action"] = "TextProcess"
kwargs["params"] = request._serialize()
kwargs["resp_cls"] = models.TextProcessResponse
kwargs["headers"] = request.headers
kwargs["opts"] = opts or {}
return await self.call_and_deserialize(**kwargs)
async def TextReset(
self,
request: models.TextResetRequest,
opts: Dict = None,
) -> models.TextResetResponse:
"""
会话重置接口。
"""
kwargs = {}
kwargs["action"] = "TextReset"
kwargs["params"] = request._serialize()
kwargs["resp_cls"] = models.TextResetResponse
kwargs["headers"] = request.headers
kwargs["opts"] = opts or {}
return await self.call_and_deserialize(**kwargs)