引言
关于Chat2DB和文心一言是啥我就不赘述了,由于Chat2DB自带的ai有调用次数限制,所以想着接入百度的文心AI,但是由于网上没有找到相关的教程,此方法是本人研究了一段时间才弄出来的,顺便记录一下备忘,也希望对有同样需求有所帮助!
一、注册并实名认证百度智能云账号
百度智能云地址:点击前往百度智能云(注册和实名认证过程不做赘述!)

二、申请体验文心千帆大模型
申请体验文心千帆大模型地址:点击前往申请体验文心千帆大模型(尽量详细的填写申请体验问卷,然后等待申请成功的同志短信)

如果有使用资格则会显示立即使用

三、在千帆大模型平台创建应用并获取access_token
1、创建应用(基本信息大家随意自行填写)
点击前往千帆大模型平台


2、通过应用的api key和Secret key获取到access_token

替换掉下面地址中的"[API Key]"和"[Secret Key]"后访问该地址
https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=[API Key]&client_secret=[Secret Key]

四、把上一步获取到的access_token按照下图配置到chat2db中就搞定了

五、效果示例

