pull/335/head
Travis Fischer 2023-02-13 00:42:05 -06:00
rodzic 57ecbb3d4d
commit d0fba024aa
1 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -291,16 +291,17 @@ export class ChatGPTAPI {
console.log(response) console.log(response)
} }
if (response.id) { if (response?.id) {
result.id = response.id result.id = response.id
} }
if (response?.choices?.length) { if (response?.choices?.length) {
result.text = response.choices[0].text.trim() result.text = response.choices[0].text.trim()
} else { } else {
const res = response as any
return reject( return reject(
new Error( new Error(
`ChatGPT error: ${ `ChatGPT error: ${
(response as any).detail || response || 'unknown' res?.detail?.message || res?.detail || 'unknown'
}` }`
) )
) )