feat: 增加豆包请求接口
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
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,
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user