43 lines
925 B
JavaScript
43 lines
925 B
JavaScript
import Request from 'luch-request';
|
||
|
||
const init = () => {
|
||
const http = new Request({
|
||
baseURL: 'https://ark.cn-beijing.volces.com/api/v3/chat/completions',
|
||
timeout: 100 * 1000,
|
||
method: 'GET',
|
||
header: {
|
||
Accept: 'text/json',
|
||
'Content-Type': 'application/json;charset=UTF-8',
|
||
Authorization: 'Bearer 14fc0280-fc65-462d-ac2d-50178c0212e3',
|
||
},
|
||
// #ifdef H5
|
||
// 跨域请求时是否携带凭证(cookies)仅H5支持(HBuilderX 2.6.15+)
|
||
withCredentials: false,
|
||
// #endif
|
||
});
|
||
|
||
return http;
|
||
};
|
||
|
||
export const praiseTextApi = (data) => {
|
||
const http = init();
|
||
|
||
return http.request({
|
||
method: 'POST',
|
||
data: {
|
||
model: 'doubao-1-5-thinking-pro-m-250428',
|
||
messages: [
|
||
{
|
||
role: 'system',
|
||
content: data.system_prompt,
|
||
},
|
||
|
||
{
|
||
role: 'user',
|
||
content: data.text,
|
||
},
|
||
],
|
||
},
|
||
});
|
||
};
|