new tokens
This commit is contained in:
@@ -612,27 +612,7 @@ final readonly class AgentRunner
|
||||
|
||||
private function containsStrongFollowUpReference(string $normalized): bool
|
||||
{
|
||||
$patterns = [
|
||||
'/\bder\s+wert\b/u',
|
||||
'/\bdieser\s+wert\b/u',
|
||||
'/\bdiesen\s+wert\b/u',
|
||||
'/\bdem\s+wert\b/u',
|
||||
'/\bmit\s+welche(?:m|n|r)?\b/u',
|
||||
'/\bwomit\b/u',
|
||||
'/\bdamit\b/u',
|
||||
'/\bdafuer\b/u',
|
||||
'/\bdafür\b/u',
|
||||
'/\bdazu\b/u',
|
||||
'/\bdaraus\b/u',
|
||||
'/\bwelche(?:r|s|m|n)?\s+indikator\b/u',
|
||||
'/\bwelche(?:r|s|m|n)?\s+indikatortyp\b/u',
|
||||
'/\bindikator\s+(?:dafuer|dafür|dazu|hierfuer|hierfür)\b/u',
|
||||
'/\bwelche(?:r|s|m|n)?\s+bereich\b/u',
|
||||
'/\bwelche(?:r|s|m|n)?\s+messbereich\b/u',
|
||||
'/\bwelche(?:r|s|m|n)?\s+grenzwert\b/u',
|
||||
];
|
||||
|
||||
foreach ($patterns as $pattern) {
|
||||
foreach ($this->agentRunnerConfig->getFollowUpStrongReferencePatterns() as $pattern) {
|
||||
if (preg_match($pattern, $normalized) === 1) {
|
||||
return true;
|
||||
}
|
||||
@@ -643,14 +623,8 @@ final readonly class AgentRunner
|
||||
|
||||
private function containsExplicitCommercialFollowUpSignal(string $normalized): bool
|
||||
{
|
||||
$commercialSignals = [
|
||||
'shop', 'preis', 'preise', 'kostet', 'kosten', 'kaufen', 'bestellen',
|
||||
'warenkorb', 'lieferzeit', 'verfuegbar', 'verfügbar', 'lager', 'url',
|
||||
'link', 'artikelnummer', 'sku', 'produktnummer',
|
||||
];
|
||||
|
||||
foreach ($commercialSignals as $signal) {
|
||||
if (str_contains($normalized, $signal)) {
|
||||
foreach ($this->agentRunnerConfig->getFollowUpExplicitCommercialSignalTerms() as $signal) {
|
||||
if (str_contains($normalized, mb_strtolower($signal, 'UTF-8'))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -669,7 +643,7 @@ final readonly class AgentRunner
|
||||
return [];
|
||||
}
|
||||
|
||||
if (preg_match_all('/^Question:\s*(.+)$/mi', $history, $matches) !== 1) {
|
||||
if (preg_match_all($this->agentRunnerConfig->getFollowUpHistoryQuestionPattern(), $history, $matches) !== 1) {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -708,7 +682,7 @@ final readonly class AgentRunner
|
||||
return [];
|
||||
}
|
||||
|
||||
$answer = preg_replace('/^Question:\s*.*(?:\R|$)/u', '', $turn, 1) ?? '';
|
||||
$answer = preg_replace($this->agentRunnerConfig->getFollowUpHistoryQuestionStripPattern(), '', $turn, 1) ?? '';
|
||||
$answer = trim($answer);
|
||||
|
||||
if ($answer === '') {
|
||||
@@ -738,7 +712,7 @@ final readonly class AgentRunner
|
||||
return '';
|
||||
}
|
||||
|
||||
$parts = preg_split('/(?=^Question:\s)/m', $history);
|
||||
$parts = preg_split($this->agentRunnerConfig->getFollowUpHistoryTurnSplitPattern(), $history);
|
||||
|
||||
if ($parts === false || $parts === []) {
|
||||
return '';
|
||||
@@ -758,11 +732,7 @@ final readonly class AgentRunner
|
||||
|
||||
private function extractFirstTestomatModelAnchor(string $text): string
|
||||
{
|
||||
$pattern = '/\bTestomat(?:®)?\s+'
|
||||
. '(?:\d{3,4}|EVO(?:\s+[A-Z]{2,6})?|ECO(?:[-\s]?(?:PLUS|C))?|DUO(?:\s+\d{3,4})?|LAB(?:\s+[A-Z]{2,6})?)'
|
||||
. '\b/iu';
|
||||
|
||||
if (preg_match($pattern, $text, $matches) !== 1) {
|
||||
if (preg_match($this->agentRunnerConfig->getFollowUpReferenceAnchorTestomatModelPattern(), $text, $matches) !== 1) {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -774,7 +744,7 @@ final readonly class AgentRunner
|
||||
|
||||
private function extractFirstHardnessValueAnchor(string $text): string
|
||||
{
|
||||
if (preg_match('/\b\d+(?:[,.]\d+)?\s*°\s*dH\b/iu', $text, $matches) !== 1) {
|
||||
if (preg_match($this->agentRunnerConfig->getFollowUpReferenceAnchorHardnessValuePattern(), $text, $matches) !== 1) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user