feat: 增加豆包请求接口

This commit is contained in:
kenny
2025-10-13 17:54:02 +08:00
parent 0b96a81021
commit 0c5a32ae3e
7 changed files with 532 additions and 397 deletions
+42
View File
@@ -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,
},
],
},
});
};