This commit is contained in:
team 1
2026-05-10 08:24:34 +02:00
parent 7d9a3b2f29
commit 7e96af5f1d
4 changed files with 95 additions and 1 deletions

View File

@@ -3321,6 +3321,10 @@ final readonly class AgentRunner
return $shopResults;
}
if ($this->isMixedDeviceAndAccessoryProductRequest($prompt, $shopSearchQuery)) {
return $shopResults;
}
$primaryMatches = [];
$corpusMatches = [];
@@ -3379,6 +3383,10 @@ final readonly class AgentRunner
return $emptyResult;
}
if ($this->isMixedDeviceAndAccessoryProductRequest($prompt, $shopSearchQuery)) {
return $emptyResult;
}
$repairQuery = $this->buildDirectProductPrimaryIdentityRepairQuery(
shopSearchQuery: $shopSearchQuery,
requestedTerms: $requestedTerms
@@ -4062,7 +4070,7 @@ final readonly class AgentRunner
}
$terms = [];
foreach ($this->agentRunnerConfig->getShopQueryProductAttributeCleanupProductTypeTerms() as $term) {
foreach ($this->agentRunnerConfig->getDirectShopResultProductIdentityTerms() as $term) {
if ($this->containsAllShopQueryTokens($combined, $term)) {
$terms[] = $term;
}
@@ -4071,6 +4079,17 @@ final readonly class AgentRunner
return array_values(array_unique($terms));
}
private function isMixedDeviceAndAccessoryProductRequest(string $prompt, string $shopSearchQuery): bool
{
$combined = mb_strtolower($this->normalizeOneLine($prompt . ' ' . $shopSearchQuery), 'UTF-8');
if ($combined === '') {
return false;
}
return $this->containsAnyConfiguredTerm($combined, $this->agentRunnerConfig->getNoLlmMainDeviceRequestRoleKeywords())
&& $this->containsAnyConfiguredTerm($combined, $this->agentRunnerConfig->getNoLlmAccessoryProductRoleKeywords());
}
private function containsAllShopQueryTokens(string $text, string $term): bool
{
$tokens = array_fill_keys($this->tokenizeShopQueryCandidate($text), true);
@@ -4216,6 +4235,7 @@ final readonly class AgentRunner
|| !$shopSearchAttempted
|| $shopSearchHadSystemFailure
|| $this->extractRequestedDirectProductTerms($prompt, $shopSearchQuery) === []
|| $this->isMixedDeviceAndAccessoryProductRequest($prompt, $shopSearchQuery)
) {
return '';
}