add used sources

This commit is contained in:
team 1
2026-04-17 09:42:25 +02:00
parent 4247825528
commit 992b3d0be3

View File

@@ -72,7 +72,7 @@ final readonly class AgentRunner
yield $this->systemMsg("Ich prüfe auf Internet Quellen...", "think"); yield $this->systemMsg("Ich prüfe auf Internet Quellen...", "think");
$urlContent = $this->urlAnalyzer->extractContentFromPrompt($prompt); $urlContent = $this->urlAnalyzer->extractContentFromPrompt($prompt);
if($urlContent){ if($urlContent){
$sources[]= 'Externe URL'; $sources[]= '<span class="badge bg-info text-black">Externe URL</span>';
} }
// --------------------------------------------------------- // ---------------------------------------------------------
@@ -81,7 +81,7 @@ final readonly class AgentRunner
yield $this->systemMsg("Ich hole relevante Daten aus meinem RAG Wissen...", "think"); yield $this->systemMsg("Ich hole relevante Daten aus meinem RAG Wissen...", "think");
$knowledgeChunks = $this->retriever->retrieve($prompt); $knowledgeChunks = $this->retriever->retrieve($prompt);
if($knowledgeChunks){ if($knowledgeChunks){
$sources[]= 'RAG Wissen'; $sources[]= '<span class="badge bg-info text-black">RAG Wissen</span>';
} }
// --------------------------------------------------------- // ---------------------------------------------------------
// 4) commerce/shop search // 4) commerce/shop search
@@ -133,7 +133,7 @@ final readonly class AgentRunner
} }
if($shopResults){ if($shopResults){
$sources[]= 'Shopsystem'; $sources[]= '<span class="badge bg-info text-black">Shopsystem</span>';
} }
if ($commerceIntent === CommerceIntentLite::PRODUCT_SEARCH) { if ($commerceIntent === CommerceIntentLite::PRODUCT_SEARCH) {
@@ -147,6 +147,7 @@ final readonly class AgentRunner
// --------------------------------------------------------- // ---------------------------------------------------------
// 5) Build final prompt // 5) Build final prompt
// --------------------------------------------------------- // ---------------------------------------------------------
$finalPrompt = $this->promptBuilder->build( $finalPrompt = $this->promptBuilder->build(
prompt: $prompt, prompt: $prompt,
userId: $userId, userId: $userId,
@@ -179,7 +180,7 @@ final readonly class AgentRunner
$this->thinkSuppressor->reset(); $this->thinkSuppressor->reset();
if($sources){ if($sources){
yield $this->systemMsg("Genutze Quellen: ".implode(', ',$sources), 'info'); yield $this->systemMsg("Genutze Quellen: ".implode(' ',$sources), 'info');
} }
foreach ($this->ollamaClient->stream($finalPrompt) as $token) { foreach ($this->ollamaClient->stream($finalPrompt) as $token) {
@@ -217,7 +218,7 @@ final readonly class AgentRunner
} }
if($sources){ if($sources){
yield $this->systemMsg("Quellen: ".implode(', ',$sources), 'info'); yield $this->systemMsg("Quellen: ".implode(' ',$sources), 'info');
} }
// --------------------------------------------------------- // ---------------------------------------------------------