optimize stream sse handling
This commit is contained in:
@@ -102,6 +102,16 @@ final class ShopSearchService
|
||||
referenceContext: $referenceContext
|
||||
);
|
||||
|
||||
if ($this->lastSearchHadSystemFailure) {
|
||||
$this->logger->warning('Shop search stopped after Store API system failure during reference probe', [
|
||||
'commerceIntent' => $commerceIntent,
|
||||
'originalPrompt' => $originalPrompt,
|
||||
'failureReason' => $this->lastSearchFailureReason,
|
||||
]);
|
||||
|
||||
//return [];
|
||||
}
|
||||
|
||||
$rankedProducts = $this->executeSearch(
|
||||
$primaryQuery,
|
||||
$commerceIntent,
|
||||
@@ -109,7 +119,7 @@ final class ShopSearchService
|
||||
true
|
||||
);
|
||||
|
||||
if ($rankedProducts === [] && $commerceHistoryContext !== '') {
|
||||
if ($rankedProducts === [] && $commerceHistoryContext !== '' && !$this->lastSearchHadSystemFailure) {
|
||||
$fallbackQuery = $this->queryParser->parse(
|
||||
$originalPrompt,
|
||||
$commerceIntent,
|
||||
@@ -228,6 +238,17 @@ final class ShopSearchService
|
||||
false
|
||||
);
|
||||
|
||||
if ($this->lastSearchHadSystemFailure) {
|
||||
$this->logger->warning('Shop reference probe stopped after Store API system failure', [
|
||||
'commerceIntent' => $commerceIntent,
|
||||
'originalPrompt' => $originalPrompt,
|
||||
'referenceSearchText' => $referenceSearchText,
|
||||
'failureReason' => $this->lastSearchFailureReason,
|
||||
]);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ($results !== []) {
|
||||
$allResults = array_merge($allResults, $results);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user