mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-29 07:01:04 +03:00
wrap in a try catch block
This commit is contained in:
@@ -324,6 +324,7 @@ class OpenAIAssistant_Agents implements INode {
|
|||||||
const newRun = await openai.beta.threads.runs.retrieve(threadId, runId)
|
const newRun = await openai.beta.threads.runs.retrieve(threadId, runId)
|
||||||
const newStatus = newRun?.status
|
const newStatus = newRun?.status
|
||||||
|
|
||||||
|
try {
|
||||||
if (submitToolOutputs.length && newStatus === 'requires_action') {
|
if (submitToolOutputs.length && newStatus === 'requires_action') {
|
||||||
await openai.beta.threads.runs.submitToolOutputs(threadId, runId, {
|
await openai.beta.threads.runs.submitToolOutputs(threadId, runId, {
|
||||||
tool_outputs: submitToolOutputs
|
tool_outputs: submitToolOutputs
|
||||||
@@ -333,6 +334,10 @@ class OpenAIAssistant_Agents implements INode {
|
|||||||
await openai.beta.threads.runs.cancel(threadId, runId)
|
await openai.beta.threads.runs.cancel(threadId, runId)
|
||||||
resolve('requires_action_retry')
|
resolve('requires_action_retry')
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
clearInterval(timeout)
|
||||||
|
reject(new Error(`Error submitting tool outputs: ${state}, Thread ID: ${threadId}, Run ID: ${runId}`))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (state === 'cancelled' || state === 'expired' || state === 'failed') {
|
} else if (state === 'cancelled' || state === 'expired' || state === 'failed') {
|
||||||
clearInterval(timeout)
|
clearInterval(timeout)
|
||||||
|
|||||||
Reference in New Issue
Block a user