5 Star 4 Fork 2

思必驰科技股份有限公司/dui-dds-server-api-samples

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
dds-http.py 1.94 KB
一键复制 编辑 原始数据 按行查看 历史
alfredZhong 提交于 2019-07-18 16:46 +08:00 . remove device2server related params
#!/usr/bin/env python
import time
import hmac
import requests
from uuid import uuid4
from hashlib import sha1
alias = "prod"
# 使用自己产品的相关参数替换下列参数。
productId = "x"
apikey = "x"
def textDm(url):
# 发送文本请求对话。
content = {
"aiType": "dm", # aiType 设置为 "dm"
"topic": 'nlu.input.text',
"recordId": uuid4().hex,
"refText": "苏州的天气"
}
r = requests.post(url, json=content)
print(r.text)
def triggerIntent(url):
# 发送触发意图请求。
content = {
"aiType":"dm",
"topic": "dm.input.intent",
"recordId": uuid4().hex,
"skillId": "2018040200000004",
"task": "查询天气",
"intent": "天气",
"slots": {
"国内城市": "苏州",
}
}
r = requests.post(url, json=content)
print(r.text)
def systemSetting(url):
# 做系统级配置。
content = {
"topic": "system.settings",
"settings": [
{
"key": "location",
"value": {
"longitude": "80",
"latitude": "120",
"address": "china",
"city": "suzhou",
"time": "2019-04-01T09:00:00+0800"
}
}
]
}
r = requests.post(url, json=content)
print(r.text)
def skillSetting(url):
# 做技能级配置。
content = {
"topic": "skill.settings",
"skillId": "2018040200000004",
"settings": [
{
"key": "key1",
"value": "value1"
}
]
}
r = requests.post(url, json=content)
print(r.text)
if __name__ == "__main__":
# 云端对云端。
url = f"https://dds.dui.ai/dds/v2/{alias}?productId={productId}&apikey={apikey}"
textDm(url)
# triggerIntent(url)
# systemSetting(url)
# skillSetting(url)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/szaispeech/dui-dds-server-api-samples.git
git@gitee.com:szaispeech/dui-dds-server-api-samples.git
szaispeech
dui-dds-server-api-samples
dui-dds-server-api-samples
master

搜索帮助