部分逻辑修正
This commit is contained in:
+3
-2
@@ -51,7 +51,8 @@ export default function request({
|
||||
suppressErrors,
|
||||
toastErrors,
|
||||
header = {},
|
||||
timeout = 6000
|
||||
timeout = 6000,
|
||||
baseUrl = ''
|
||||
}) {
|
||||
const base_url = get_base_url(url);
|
||||
|
||||
@@ -67,7 +68,7 @@ export default function request({
|
||||
let that = this
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
url: `${base_url}${url}`,
|
||||
url: `${baseUrl || base_url}${url}`,
|
||||
data: data,
|
||||
method: method,
|
||||
header: headers_base,
|
||||
|
||||
@@ -94,3 +94,52 @@ export const waitMakeEvaluateApi = (data) => {
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
// /trastudy/intgask/askAbout
|
||||
// 流式获取文本
|
||||
export const getAskAboutRawApi = (data) => {
|
||||
// return request({
|
||||
// baseUrl:'http://25.18.122.76:3030',
|
||||
// url: '/api/v1/prediction/a402cf58-9f64-479b-a9f8-c527300a7905',
|
||||
// isStream: true,
|
||||
// header: {
|
||||
// 'Accept':'text/event-stream',
|
||||
// 'content-type': 'application/json; charset=UTF-8',
|
||||
// 'Authorization': 'Bearer PjadGPFSHDg6F8ZRekROe-QxS2fPXlWRsmvP5Mp0vxA'
|
||||
// },
|
||||
// method: 'post',
|
||||
// toastErrors: false,
|
||||
// data
|
||||
// });
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
url: base_url + '/intgask/askAbout',
|
||||
header: {
|
||||
'Accept':'text/event-stream',
|
||||
'content-type': 'application/json; charset=UTF-8',
|
||||
},
|
||||
method: 'get',
|
||||
isStream: true,
|
||||
timeout: 30000,
|
||||
toastErrors: false,
|
||||
data
|
||||
}).then(res=>{
|
||||
console.log(res.data)
|
||||
let _str = `[${ res.data.split('}{').join('},{')}]`
|
||||
console.log(JSON.parse(_str))
|
||||
|
||||
})
|
||||
});
|
||||
// return request({
|
||||
// url: base_url + '/intgask/askAbout',
|
||||
// header: {
|
||||
// 'Accept':'text/event-stream',
|
||||
// 'content-type': 'application/json; charset=UTF-8',
|
||||
// },
|
||||
// method: 'get',
|
||||
// isStream: true,
|
||||
// timeout: 30000,
|
||||
// toastErrors: false,
|
||||
// data
|
||||
// });
|
||||
};
|
||||
Reference in New Issue
Block a user