@@ -42,6 +42,17 @@ export const executeChatCompletionOpenAIRequest = async ({
|
|||||||
return { response, logs }
|
return { response, logs }
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof HTTPError) {
|
if (error instanceof HTTPError) {
|
||||||
|
if (error.response.statusCode === 503) {
|
||||||
|
console.log('OpenAI API error - 503, retrying in 3 seconds')
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 3000))
|
||||||
|
return executeChatCompletionOpenAIRequest({
|
||||||
|
apiKey,
|
||||||
|
model,
|
||||||
|
messages,
|
||||||
|
temperature,
|
||||||
|
currentLogs: logs,
|
||||||
|
})
|
||||||
|
}
|
||||||
if (error.response.statusCode === 400) {
|
if (error.response.statusCode === 400) {
|
||||||
const log = {
|
const log = {
|
||||||
status: 'info',
|
status: 'info',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typebot.io/js",
|
"name": "@typebot.io/js",
|
||||||
"version": "0.0.63",
|
"version": "0.0.64",
|
||||||
"description": "Javascript library to display typebots on your website",
|
"description": "Javascript library to display typebots on your website",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export const streamChat =
|
|||||||
if (dataString.includes('503 Service Temporarily Unavailable')) {
|
if (dataString.includes('503 Service Temporarily Unavailable')) {
|
||||||
if (isRetrying)
|
if (isRetrying)
|
||||||
return { error: { message: "Couldn't get streamer data" } }
|
return { error: { message: "Couldn't get streamer data" } }
|
||||||
await new Promise((resolve) => setTimeout(resolve, 1000))
|
await new Promise((resolve) => setTimeout(resolve, 3000))
|
||||||
return streamChat(context)(messages, {
|
return streamChat(context)(messages, {
|
||||||
onStreamedMessage,
|
onStreamedMessage,
|
||||||
isRetrying: true,
|
isRetrying: true,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typebot.io/react",
|
"name": "@typebot.io/react",
|
||||||
"version": "0.0.63",
|
"version": "0.0.64",
|
||||||
"description": "React library to display typebots on your website",
|
"description": "React library to display typebots on your website",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
|||||||
Reference in New Issue
Block a user