optimize intention
This commit is contained in:
@@ -128,7 +128,19 @@ final readonly class AgentRunner
|
||||
yield $this->systemMsg("Ich rufe Shopdaten ab (type: " . $commerceIntent . ")", "think");
|
||||
|
||||
//Search in swag by ai optimized query
|
||||
$shopResults = $swagFullOutPut ? $this->shopSearchService->search($swagFullOutPut, $commerceIntent) : '';
|
||||
try {
|
||||
$shopResults = $swagFullOutPut !== ''
|
||||
? $this->shopSearchService->search($swagFullOutPut, $commerceIntent)
|
||||
: [];
|
||||
} catch (Throwable $e) {
|
||||
$this->agentLogger->warning('Shop search failed, continuing without shop results', [
|
||||
'userId' => $userId,
|
||||
'exception' => $e,
|
||||
]);
|
||||
|
||||
$shopResults = [];
|
||||
yield $this->systemMsg('Shopdaten konnten nicht geladen werden, ich antworte mit Wissensbasis weiter...', 'think');
|
||||
}
|
||||
}
|
||||
|
||||
if ($commerceIntent === CommerceIntentLite::PRODUCT_SEARCH) {
|
||||
@@ -203,8 +215,8 @@ final readonly class AgentRunner
|
||||
$finalChunk = $chunker->flush();
|
||||
if ($finalChunk !== null) {
|
||||
yield $this->systemMsg($finalChunk, 'answer');
|
||||
} else {
|
||||
yield $this->systemMsg('... no more data received from llm', 'err');
|
||||
} elseif ($fullOutput === '') {
|
||||
yield $this->systemMsg('❌ Es wurden keine Daten vom LLM empfangen.', 'err');
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------
|
||||
@@ -229,7 +241,7 @@ final readonly class AgentRunner
|
||||
'exception' => $e,
|
||||
]);
|
||||
|
||||
$this->systemMsg("\n❌ An internal error occurred while processing the request. \nError: " . $e->getMessage(), 'err');
|
||||
yield $this->systemMsg("\n❌ An internal error occurred while processing the request. \nError: " . $e->getMessage(), 'err');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user