bdunit: update README.md

This commit is contained in:
lanvent
2023-03-28 15:25:55 +08:00
parent 6c362a9b4b
commit d6af1b5827
2 changed files with 27 additions and 14 deletions

View File

@@ -1,14 +1,30 @@
## 插件说明
利用百度UNIT实现智能对话
1.解决问题chatgpt无法处理的指令交给百度UNIT处理如天气日期时间数学运算等
2.如问时间:现在几点钟,今天几号
3.如问天气:明天广州天气怎么样,这个周末深圳会不会下雨
4.如问数学运算23+45=多少100-23=多少35转化为二进制是多少
大家可以在百度UNIT官网上自己创建应用申请百度机器人,可以把预先训练好的模型导入到自己的应用中,
see https://ai.baidu.com/unit/home#/home?track=61fe1b0d3407ce3face1d92cb5c291087095fc10c8377aaf
https://console.bce.baidu.com/ai平台申请
然后在百度UNIT官网上获取应用的API Key和Secret Key然后在config.json中配置
- 1.解决问题chatgpt无法处理的指令交给百度UNIT处理如天气日期时间数学运算等
- 2.如问时间:现在几点钟,今天几号
- 3.如问天气:明天广州天气怎么样,这个周末深圳会不会下雨
- 4.如问数学运算23+45=多少100-23=多少35转化为二进制是多少
## 使用说明
### 获取apikey
在百度UNIT官网上自己创建应用申请百度机器人,可以把预先训练好的模型导入到自己的应用中,
see https://ai.baidu.com/unit/home#/home?track=61fe1b0d3407ce3face1d92cb5c291087095fc10c8377aaf https://console.bce.baidu.com/ai平台申请
### 配置文件
将文件夹中`config.json.template`复制为`config.json`
在其中填写百度UNIT官网上获取应用的API Key和Secret Key
``` json
{
"service_id": "s...", #"机器人ID"
"api_key": "",
"api_key": "",
"secret_key": ""
}
}
```

View File

@@ -25,10 +25,7 @@ class BDunit(Plugin):
config_path = os.path.join(curdir, "config.json")
conf = None
if not os.path.exists(config_path):
conf = {"service_id": "", "api_key": "",
"secret_key": ""}
with open(config_path, "w") as f:
json.dump(conf, f, indent=4)
raise Exception("config.json not found")
else:
with open(config_path, "r") as f:
conf = json.load(f)