mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
fix: ensure guardrail patterns persist on edit and mode toggle
This commit is contained in:
parent
6e091bb26d
commit
fc4c104f77
1 changed files with 5 additions and 13 deletions
|
|
@ -270,23 +270,15 @@ const GuardrailInfoView: React.FC<GuardrailInfoProps> = ({ guardrailId, onClose,
|
|||
updateData.litellm_params.pii_entities_config = newPiiEntitiesConfig;
|
||||
}
|
||||
|
||||
// Only add Content Filter patterns if there are changes
|
||||
// Always include Content Filter patterns to ensure they persist when other fields change
|
||||
if (guardrailData.litellm_params?.guardrail === "litellm_content_filter") {
|
||||
const originalPatterns = guardrailData.litellm_params?.patterns || [];
|
||||
const originalBlockedWords = guardrailData.litellm_params?.blocked_words || [];
|
||||
|
||||
const formattedData = formatContentFilterDataForAPI(
|
||||
contentFilterDataRef.current.patterns,
|
||||
contentFilterDataRef.current.blockedWords,
|
||||
contentFilterDataRef.current.patterns || [],
|
||||
contentFilterDataRef.current.blockedWords || [],
|
||||
);
|
||||
|
||||
if (JSON.stringify(originalPatterns) !== JSON.stringify(formattedData.patterns)) {
|
||||
updateData.litellm_params.patterns = formattedData.patterns;
|
||||
}
|
||||
|
||||
if (JSON.stringify(originalBlockedWords) !== JSON.stringify(formattedData.blocked_words)) {
|
||||
updateData.litellm_params.blocked_words = formattedData.blocked_words;
|
||||
}
|
||||
updateData.litellm_params.patterns = formattedData.patterns;
|
||||
updateData.litellm_params.blocked_words = formattedData.blocked_words;
|
||||
}
|
||||
|
||||
if (guardrailData.litellm_params?.guardrail === "tool_permission") {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue