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)
|
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'
|
||||||
}`
|
}`
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
Ładowanie…
Reference in New Issue