请求格式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const accessToken = "xxxxxx";
const url = "https://aip.baidubce.com/rpc/2.0/ai_custom/v1/wenxinworkshop/chat/completions_pro?access_token=" + accessToken;
const headers = {headers: {'Content-Type': 'application/json'}}

const params = JSON.stringify({
'messages': [
{"role": "user", "content": "你好呀!"},
]
});

axios.post(url, params, headers).then((res) => {
console.log("文心一言");
console.log(res);
arrWenxin.value.push({user: 2, text: res.data.result});
loadingSumbit.value = false;
setTimeout(() => {
// 业务逻辑
getHeight();
}, 500);
})