first update to external config values

This commit is contained in:
team 1
2026-04-24 13:13:56 +02:00
parent 868f9a8857
commit 26ec0afc5c
11 changed files with 292 additions and 187 deletions

View File

@@ -6,24 +6,32 @@ namespace App\Config;
final class AgentRunnerConfig
{
/**
* @param array<string, mixed> $config
*/
public function __construct(
private readonly array $config = [],
) {
}
public function getCommerceHistoryBudgetChars(): int
{
return 1000;
return $this->getInt('commerce_history_budget_chars', 1000);
}
public function getProductSearchKnowledgeChunkLimit(): int
{
return 6;
return $this->getInt('product_search_knowledge_chunk_limit', 6);
}
public function getAdvisoryProductSearchKnowledgeChunkLimit(): int
{
return 9;
return $this->getInt('advisory_product_search_knowledge_chunk_limit', 9);
}
public function getOptimizedShopQueryPrefixPattern(): string
{
return '/^(?:keywords?|suchquery|search\s*query|query)\s*:\s*/iu';
return $this->getString('optimized_shop_query_prefix_pattern', '/^(?:keywords?|suchquery|search\\s*query|query)\\s*:\\s*/iu');
}
public function getOptimizedShopQueryTrimCharacters(): string
@@ -31,6 +39,20 @@ final class AgentRunnerConfig
return " \t\n\r\0\x0B\"'`";
}
private function getInt(string $key, int $default): int
{
$value = $this->config[$key] ?? $default;
return is_numeric($value) ? (int) $value : $default;
}
private function getString(string $key, string $default): string
{
$value = $this->config[$key] ?? $default;
return is_string($value) && $value !== '' ? $value : $default;
}
public function getEmptyPromptMessage(): string
{
return '❌ Empty prompt.';