Merge branch 'main' of https://github.com/kwaroran/RisuAI
This commit is contained in:
@@ -1194,8 +1194,7 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
|
|
||||||
let fullRes = ''
|
let fullRes = ''
|
||||||
|
|
||||||
for(const data of res.data){
|
const processDataItem = (data:any) => {
|
||||||
|
|
||||||
if(data?.candidates?.[0]?.content?.parts?.[0]?.text){
|
if(data?.candidates?.[0]?.content?.parts?.[0]?.text){
|
||||||
fullRes += data.candidates[0].content.parts[0].text
|
fullRes += data.candidates[0].content.parts[0].text
|
||||||
}
|
}
|
||||||
@@ -1213,6 +1212,15 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// traverse responded data if it contains multipart contents
|
||||||
|
if (typeof (res.data)[Symbol.iterator] === 'function') {
|
||||||
|
for(const data of res.data){
|
||||||
|
processDataItem(data)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
processDataItem(res.data)
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: 'success',
|
type: 'success',
|
||||||
result: fullRes
|
result: fullRes
|
||||||
|
|||||||
Reference in New Issue
Block a user