mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 21:00:58 +03:00
Bugfix/Check for proper thread id and avoid throwing error (#2551)
check for proper thread id and avoid throwing error
This commit is contained in:
@@ -138,10 +138,14 @@ class OpenAIAssistant_Agents implements INode {
|
|||||||
const openai = new OpenAI({ apiKey: openAIApiKey })
|
const openai = new OpenAI({ apiKey: openAIApiKey })
|
||||||
options.logger.info(`Clearing OpenAI Thread ${sessionId}`)
|
options.logger.info(`Clearing OpenAI Thread ${sessionId}`)
|
||||||
try {
|
try {
|
||||||
if (sessionId) await openai.beta.threads.del(sessionId)
|
if (sessionId && sessionId.startsWith('thread_')) {
|
||||||
options.logger.info(`Successfully cleared OpenAI Thread ${sessionId}`)
|
await openai.beta.threads.del(sessionId)
|
||||||
|
options.logger.info(`Successfully cleared OpenAI Thread ${sessionId}`)
|
||||||
|
} else {
|
||||||
|
options.logger.error(`Error clearing OpenAI Thread ${sessionId}`)
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error(e)
|
options.logger.error(`Error clearing OpenAI Thread ${sessionId}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user