mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 23:01:09 +03:00
Merge pull request #1447 from FlowiseAI/feature/OpenAI-Assistant
Feature/OpenAI Assistant
This commit is contained in:
@@ -324,14 +324,19 @@ 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
|
||||||
|
|
||||||
if (submitToolOutputs.length && newStatus !== 'in_progress') {
|
try {
|
||||||
await openai.beta.threads.runs.submitToolOutputs(threadId, runId, {
|
if (submitToolOutputs.length && newStatus === 'requires_action') {
|
||||||
tool_outputs: submitToolOutputs
|
await openai.beta.threads.runs.submitToolOutputs(threadId, runId, {
|
||||||
})
|
tool_outputs: submitToolOutputs
|
||||||
resolve(state)
|
})
|
||||||
} else {
|
resolve(state)
|
||||||
await openai.beta.threads.runs.cancel(threadId, runId)
|
} else {
|
||||||
resolve('requires_action_retry')
|
await openai.beta.threads.runs.cancel(threadId, runId)
|
||||||
|
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') {
|
||||||
|
|||||||
Reference in New Issue
Block a user