kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
pull/335/head
rodzic
57ecbb3d4d
commit
d0fba024aa
|
@ -291,16 +291,17 @@ export class ChatGPTAPI {
|
|||
console.log(response)
|
||||
}
|
||||
|
||||
if (response.id) {
|
||||
if (response?.id) {
|
||||
result.id = response.id
|
||||
}
|
||||
if (response?.choices?.length) {
|
||||
result.text = response.choices[0].text.trim()
|
||||
} else {
|
||||
const res = response as any
|
||||
return reject(
|
||||
new Error(
|
||||
`ChatGPT error: ${
|
||||
(response as any).detail || response || 'unknown'
|
||||
res?.detail?.message || res?.detail || 'unknown'
|
||||
}`
|
||||
)
|
||||
)
|
||||
|
|
Ładowanie…
Reference in New Issue