last update before full new 1.5.0

This commit is contained in:
team2
2026-04-29 20:05:16 +02:00
parent 19c0f612dc
commit e39a57e00b
5 changed files with 423 additions and 107 deletions

View File

@@ -42,7 +42,8 @@ final readonly class PromptBuilder
?bool $fullContext = false,
?string $swagFullOutPut = '',
bool $commerceSearchAttempted = false,
bool $shopSearchHadSystemFailure = false
bool $shopSearchHadSystemFailure = false,
string $knowledgeEvidenceState = 'unknown'
): string {
$prompt = $this->normalizeBlockText($prompt);
$urlContent = $this->normalizeBlockText($urlContent);
@@ -57,7 +58,8 @@ final readonly class PromptBuilder
hasKnowledge: $hasKnowledge,
hasShopResults: $hasShopResults,
commerceSearchAttempted: $commerceSearchAttempted,
shopSearchHadSystemFailure: $shopSearchHadSystemFailure
shopSearchHadSystemFailure: $shopSearchHadSystemFailure,
knowledgeEvidenceState: $knowledgeEvidenceState
);
$systemBlock = $this->buildSystemBlock();
@@ -275,21 +277,31 @@ final readonly class PromptBuilder
bool $hasKnowledge,
bool $hasShopResults,
bool $commerceSearchAttempted,
bool $shopSearchHadSystemFailure
bool $shopSearchHadSystemFailure,
string $knowledgeEvidenceState = 'unknown'
): string {
if ($shopSearchHadSystemFailure && !$hasKnowledge) {
return 'shopdaten_nicht_verfuegbar';
$hasDirectKnowledgeEvidence = $knowledgeEvidenceState === 'direct' || $knowledgeEvidenceState === 'unknown' && $hasKnowledge;
$hasWeakKnowledgeEvidence = $knowledgeEvidenceState === 'weak';
if ($shopSearchHadSystemFailure && !$hasDirectKnowledgeEvidence) {
return $hasWeakKnowledgeEvidence
? 'semantische_rag_treffer_kein_direkter_fachbeleg_shopdaten_nicht_verfuegbar'
: 'shopdaten_nicht_verfuegbar';
}
if ($hasKnowledge && !$hasShopResults) {
if ($hasWeakKnowledgeEvidence && !$hasShopResults) {
return 'semantische_rag_treffer_kein_direkter_fachbeleg';
}
if ($hasDirectKnowledgeEvidence && !$hasShopResults) {
return 'sicher_beantwortbar';
}
if ($hasKnowledge && $hasShopResults) {
if ($hasDirectKnowledgeEvidence && $hasShopResults) {
return 'wahrscheinlich_beantwortbar';
}
if (!$hasKnowledge && $hasShopResults) {
if (!$hasDirectKnowledgeEvidence && $hasShopResults) {
return 'nur_shop_treffer_kein_belastbares_fachwissen';
}
@@ -540,13 +552,11 @@ final readonly class PromptBuilder
: $this->config->getShopAvailabilityNoLabel());
}
if (!$suppressCommercialFields) {
foreach ($product->highlights as $highlight) {
$highlight = $this->normalizeBlockText((string) $highlight);
foreach ($product->highlights as $highlight) {
$highlight = $this->normalizeBlockText((string) $highlight);
if ($highlight !== '') {
$entryParts[] = $this->config->getShopHighlightPrefix() . $highlight;
}
if ($highlight !== '') {
$entryParts[] = $this->config->getShopHighlightPrefix() . $highlight;
}
}