mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-22 07:01:07 +03:00
fix: ensure Gemini always receives a non-empty contents array (#5229)
This commit is contained in:
+12
@@ -770,6 +770,12 @@ export class LangchainChatGoogleGenerativeAI
|
||||
this.client.systemInstruction = systemInstruction
|
||||
actualPrompt = prompt.slice(1)
|
||||
}
|
||||
|
||||
// Ensure actualPrompt is never empty
|
||||
if (actualPrompt.length === 0) {
|
||||
actualPrompt = [{ role: 'user', parts: [{ text: '...' }] }]
|
||||
}
|
||||
|
||||
const parameters = this.invocationParams(options)
|
||||
|
||||
// Handle streaming
|
||||
@@ -834,6 +840,12 @@ export class LangchainChatGoogleGenerativeAI
|
||||
this.client.systemInstruction = systemInstruction
|
||||
actualPrompt = prompt.slice(1)
|
||||
}
|
||||
|
||||
// Ensure actualPrompt is never empty
|
||||
if (actualPrompt.length === 0) {
|
||||
actualPrompt = [{ role: 'user', parts: [{ text: '...' }] }]
|
||||
}
|
||||
|
||||
const parameters = this.invocationParams(options)
|
||||
const request = {
|
||||
...parameters,
|
||||
|
||||
Reference in New Issue
Block a user