Skip to content

Commit 911c4d1

Browse files
committed
Add ep_rag_attack_patterns filter
1 parent df56a36 commit 911c4d1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

includes/classes/Feature/RAG.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,18 @@ protected function validate_search_term( string $search_term ): bool {
582582
'/\/\*\s*ignore previous\s*\*\//i',
583583
];
584584

585+
/**
586+
* Filter the attack patterns used in the RAG feature.
587+
*
588+
* This filter allows modification of the attack patterns array used by the RAG feature.
589+
*
590+
* @since 2.5.0
591+
* @hook ep_rag_attack_patterns
592+
* @param {array} $attack_patterns The array of attack patterns.
593+
* @return {array} The modified array of attack patterns.
594+
*/
595+
$attack_patterns = apply_filters( 'ep_rag_attack_patterns', $attack_patterns );
596+
585597
foreach ( $attack_patterns as $pattern ) {
586598
if ( preg_match( $pattern, $search_term ) ) {
587599
return false;

0 commit comments

Comments
 (0)