mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 21:00:58 +03:00
fix error TS2322: Type '{ category: string; threshold: string; }[]' is not assignable to type 'SafetySetting[]
This commit is contained in:
+2
-2
@@ -177,13 +177,13 @@ class GoogleGenerativeAI_ChatModels implements INode {
|
|||||||
let harmBlockThresholds: string[] = convertStringToArrayString(harmBlockThreshold)
|
let harmBlockThresholds: string[] = convertStringToArrayString(harmBlockThreshold)
|
||||||
if (harmCategories.length != harmBlockThresholds.length)
|
if (harmCategories.length != harmBlockThresholds.length)
|
||||||
throw new Error(`Harm Category & Harm Block Threshold are not the same length`)
|
throw new Error(`Harm Category & Harm Block Threshold are not the same length`)
|
||||||
const safetySettings = harmCategories.map((value, index) => {
|
const safetySettings: typeof model.safetySettings = harmCategories.map((value, index) => {
|
||||||
return {
|
return {
|
||||||
category: value,
|
category: value,
|
||||||
threshold: harmBlockThresholds[index]
|
threshold: harmBlockThresholds[index]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (safetySettings) model.safetySettings = safetySettings
|
if (safetySettings.length > 0) model.safetySettings = safetySettings
|
||||||
|
|
||||||
return model
|
return model
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user