optimize stream sse handling

This commit is contained in:
team 1
2026-04-25 13:21:59 +02:00
parent fa65417efe
commit b9252202eb
4 changed files with 408 additions and 107 deletions

View File

@@ -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);
}