Fix SupaMemory error handling in supaMemory.ts
This commit is contained in:
@@ -224,7 +224,14 @@ export async function supaMemory(
|
||||
}
|
||||
})
|
||||
|
||||
console.log(da)
|
||||
try {
|
||||
if(!da.ok){
|
||||
return {
|
||||
currentTokens: currentTokens,
|
||||
chats: chats,
|
||||
error: "SupaMemory: HTTP: " + await da.data
|
||||
}
|
||||
}
|
||||
|
||||
result = (await da.data)?.choices[0]?.text?.trim()
|
||||
|
||||
@@ -235,6 +242,15 @@ export async function supaMemory(
|
||||
error: "SupaMemory: HTTP: " + await da.data
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
} catch (error) {
|
||||
return {
|
||||
currentTokens: currentTokens,
|
||||
chats: chats,
|
||||
error: "SupaMemory: HTTP: " + error
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
const promptbody:OpenAIChat[] = [
|
||||
|
||||
Reference in New Issue
Block a user