p34
This commit is contained in:
@@ -289,7 +289,7 @@ final readonly class RetriexEffectiveConfigProvider
|
||||
$errors[] = 'Shop query optimizer prompt no longer contains the configured original query.';
|
||||
}
|
||||
|
||||
$metaOnlyTerms = $this->agentRunnerConfig->getShopQueryMetaOnlyTerms();
|
||||
$metaOnlyTerms = $this->effectiveShopQueryMetaGuardTerms();
|
||||
foreach ($this->governanceConfig->getRegressionShopQueryMetaGuardTerms() as $term) {
|
||||
$key = 'shop_query_meta_guard_term_' . $this->guardrailCheckKey($term);
|
||||
$checks[$key] = in_array($term, $metaOnlyTerms, true);
|
||||
@@ -302,7 +302,7 @@ final readonly class RetriexEffectiveConfigProvider
|
||||
$errors[] = 'Shop query context fallback is disabled.';
|
||||
}
|
||||
|
||||
$contextFallbackFilterTerms = $this->agentRunnerConfig->getShopQueryContextFallbackFilterTerms();
|
||||
$contextFallbackFilterTerms = $this->effectiveShopQueryContextFallbackFilterTerms();
|
||||
foreach ($this->governanceConfig->getRegressionShopQueryContextFallbackFilterTerms() as $term) {
|
||||
$key = 'shop_query_context_fallback_filter_' . $this->guardrailCheckKey($term);
|
||||
$checks[$key] = in_array($term, $contextFallbackFilterTerms, true);
|
||||
@@ -339,6 +339,56 @@ final readonly class RetriexEffectiveConfigProvider
|
||||
'warnings' => $warnings,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/** @return string[] */
|
||||
private function effectiveShopQueryMetaGuardTerms(): array
|
||||
{
|
||||
$profileName = $this->agentRunnerConfig->getShopQueryContextFallbackCleanupProfile();
|
||||
|
||||
return $this->mergeUniqueStrings(
|
||||
$this->mergeUniqueStrings(
|
||||
$this->languageCleanupConfig->getStopWordsForProfile($profileName),
|
||||
$this->languageCleanupConfig->getPhrasesForProfile($profileName)
|
||||
),
|
||||
$this->mergeUniqueStrings(
|
||||
$this->languageCleanupConfig->getMetaTermsForProfile($profileName),
|
||||
$this->agentRunnerConfig->getShopQueryMetaOnlyTerms()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/** @return string[] */
|
||||
private function effectiveShopQueryContextFallbackFilterTerms(): array
|
||||
{
|
||||
$profileName = $this->agentRunnerConfig->getShopQueryContextFallbackCleanupProfile();
|
||||
|
||||
return $this->mergeUniqueStrings(
|
||||
$this->effectiveShopQueryMetaGuardTerms(),
|
||||
$this->agentRunnerConfig->getShopQueryContextFallbackFilterTerms()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] $left
|
||||
* @param string[] $right
|
||||
* @return string[]
|
||||
*/
|
||||
private function mergeUniqueStrings(array $left, array $right): array
|
||||
{
|
||||
$out = [];
|
||||
foreach (array_merge($left, $right) as $item) {
|
||||
$item = trim((string) $item);
|
||||
if ($item === '' || isset($out[$item])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$out[$item] = $item;
|
||||
}
|
||||
|
||||
return array_values($out);
|
||||
}
|
||||
|
||||
/** @param string[] $markers */
|
||||
private function containsAnyConfiguredMarker(string $haystack, array $markers): bool
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user