我用angular5的http post调用短文本相似分析的api
代码如下,然后一直都提示这个错误信息到底哪里错了啊啊啊啊啊啊啊
const headers: HttpHeaders = new HttpHeaders().set('Content-Type', 'application/json');
const params: HttpParams = new HttpParams().set('access_token', '秘钥');
const body: any = {
text_1: '123123123123123',
text_2: '123123123123'
};
console.log(body);
this.http.post('https://aip.baidubce.com/rpc/2.0/nlp/v2/simnet',
body,
{ headers, params })
.subscribe(
val => {
console.log('相似度为', val['score']);
}
);
收藏
点赞
0
个赞
请登录后评论
TOP
切换版块
请求中包含非法参数,请检查后重新尝试
access_token是拼接在接口后面的
https://aip.baidubce.com/rpc/2.0/nlp/v2/simnet?access_token=你自己根据apikey&secretkey获取的