optimize data retrieve by customfields und enricher

This commit is contained in:
team 1
2026-04-13 16:11:19 +02:00
parent 0a05ccaee3
commit f7685c6fb5
10 changed files with 234 additions and 32 deletions

View File

@@ -58,7 +58,7 @@ final readonly class AgentRunner
//$includeFullContext = false;
if ($includeFullContext) {
yield $this->systemMsg("Ich analyse deine Anfrage...", "think");
yield $this->systemMsg("Ich analysiere deine Anfrage...", "think");
$promptSwagSearch = '
Erzeuge aus dem folgenden Nutzereingabetext einen kurzen Suchtext für die Shopware-6-Suche.
@@ -80,6 +80,7 @@ final readonly class AgentRunner
';
$this->thinkSuppressor->reset();
foreach ($this->ollamaClient->stream($promptSwagSearch) as $swagToken) {
if (!is_string($swagToken)) {
@@ -138,7 +139,6 @@ final readonly class AgentRunner
yield $this->systemMsg("Denke nach...", "think");
// ---------------------------------------------------------
// 5) Build final prompt
// ---------------------------------------------------------

View File

@@ -75,6 +75,7 @@ final readonly class PromptBuilder
// 3) LIVE SHOP RESULTS (AUTHORITATIVE FOR PRODUCTS)
// ------------------------------------------------------------
$shopBlock = '';
$isDetailed = !(count($shopResults) > 5);
if ($shopResults !== []) {
$lines = [];
@@ -113,6 +114,18 @@ final readonly class PromptBuilder
$parts[] = "URL: " . $product->url;
}
if ($product->productImage) {
$parts[] = "productImage: " . $product->productImage;
}
if ($isDetailed && $product->description) {
$parts[] = "description: " . $product->description;
}
if ($product->customFields) {
$parts[] = "Meta-Informationen: " . $product->customFields;
}
$lines[] = implode("\n", $parts);
}