p74
This commit is contained in:
@@ -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 '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user