This commit is contained in:
team 1
2026-05-09 11:49:54 +02:00
parent bd62248c8d
commit 7f25335c44
5 changed files with 87 additions and 2 deletions

View File

@@ -92,6 +92,7 @@ parameters:
shop_query_optimization_heartbeat: Shop-Suchanfrage wird optimiert… shop_query_optimization_heartbeat: Shop-Suchanfrage wird optimiert…
generic_internal_error: ❌ Bei der Verarbeitung der Anfrage ist ein interner Fehler aufgetreten. generic_internal_error: ❌ Bei der Verarbeitung der Anfrage ist ein interner Fehler aufgetreten.
debug_internal_error_prefix: '❌ Interner Fehler: ' debug_internal_error_prefix: '❌ Interner Fehler: '
technical_error_detail_template: '<br><small>Technischer Fehler: {message}</small>'
final_answer_guard: final_answer_guard:
truncation_message: |2- truncation_message: |2-
@@ -231,6 +232,7 @@ parameters:
shop_meta_result_count: 'Shoptreffer: {count}' shop_meta_result_count: 'Shoptreffer: {count}'
history_notice_without_detail: 'Systemhinweis: {title}.' history_notice_without_detail: 'Systemhinweis: {title}.'
history_notice_with_detail: 'Systemhinweis: {title}. Ursache: {detail}' history_notice_with_detail: 'Systemhinweis: {title}. Ursache: {detail}'
history_response_system_notice: 'Systemhinweis: {message}'
follow_up_actions: follow_up_actions:
commerce: commerce:
- label: Im Shop suchen - label: Im Shop suchen

View File

@@ -0,0 +1,56 @@
# RetrieX Patch 66 - Chat Message Residual Cleanup
## Ziel
p66 schliesst die Chat-Messages-Migration nach p63, p64 und p65 ab, indem zwei verbliebene user-lesbare Resttexte aus `AgentRunner.php` nach `config/retriex/chat-messages.yaml` verschoben werden.
## Geaenderte Dateien
- `config/retriex/chat-messages.yaml`
- neuer Key `agent.messages.technical_error_detail_template`
- neuer Key `agent.production_ui.templates.history_response_system_notice`
- `src/Config/ChatMessagesConfig.php`
- Validation der neuen Chat-Message-Keys
- `src/Config/AgentRunnerConfig.php`
- neue Getter fuer die beiden Rest-Templates
- neue chat-only Zugriffsmethode fuer neue Keys ohne Legacy-Agent-Fallback
- `src/Agent/AgentRunner.php`
- History-Fallback-Systemhinweis rendert ueber YAML-Template
- technischer Fehlerdetail-Hinweis rendert ueber YAML-Template
## Bewusst nicht geaendert
- keine Aenderung an Retrieval
- keine Aenderung an Scoring oder Ranking
- keine Aenderung an Intent- oder Shop-Matching
- keine Aenderung an `AgentRunner.php`-Ablauflogik ausser der Message-Template-Herkunft
- keine neuen chat-sichtbaren Legacy-Keys in `agent.yaml`
## Ergebnis
Nach p66 liegen die bekannten user-lesbaren Chat-/SSE-/Frontend-/Agent-Messages zentral in `config/retriex/chat-messages.yaml`.
## Lokale Checks
Gruen:
```bash
php -l src/Config/ChatMessagesConfig.php
php -l src/Config/AgentRunnerConfig.php
php -l src/Agent/AgentRunner.php
python3 -c "import yaml; yaml.safe_load(open('config/retriex/chat-messages.yaml'))"
php /tmp/p66_smoke.php
php /tmp/p66_agent_config_smoke.php
```
Nicht lokal ausfuehrbar im ZIP ohne `vendor/`:
```bash
php bin/console mto:agent:config:validate
```
Fehler:
```text
Dependencies are missing. Try running "composer install".
```

View File

@@ -4516,7 +4516,10 @@ final readonly class AgentRunner
$noLlmMessage = $this->agentRunnerConfig->getProductionUiText('no_llm_history_default'); $noLlmMessage = $this->agentRunnerConfig->getProductionUiText('no_llm_history_default');
} }
$parts[] = 'Systemhinweis: ' . $noLlmMessage; $parts[] = $this->renderAgentTemplate(
$this->agentRunnerConfig->getHistoryResponseSystemNoticeTemplate(),
['message' => $noLlmMessage]
);
} }
return trim(implode("\n\n", $parts)); return trim(implode("\n\n", $parts));
@@ -5015,7 +5018,10 @@ final readonly class AgentRunner
if (!$this->debug) { if (!$this->debug) {
return $this->agentRunnerConfig->getGenericInternalErrorMessage() return $this->agentRunnerConfig->getGenericInternalErrorMessage()
. '<br><small>Technischer Fehler: ' . $safeMessage . '</small>'; . $this->renderAgentTemplate(
$this->agentRunnerConfig->getTechnicalErrorDetailTemplate(),
['message' => $safeMessage]
);
} }
return $this->agentRunnerConfig->getDebugInternalErrorPrefix() return $this->agentRunnerConfig->getDebugInternalErrorPrefix()

View File

@@ -386,6 +386,15 @@ final class AgentRunnerConfig
return $this->getRequiredString($legacyKey); return $this->getRequiredString($legacyKey);
} }
private function getChatOnlyRequiredString(string $chatKey): string
{
if ($this->chatMessages === null) {
throw new \InvalidArgumentException(sprintf('RetrieX chat messages config key "%s" is required.', $chatKey));
}
return $this->chatMessages->getString($chatKey);
}
private function getChatStringAllowEmpty(string $chatKey, string $legacyKey): string private function getChatStringAllowEmpty(string $chatKey, string $legacyKey): string
{ {
if ($this->chatMessages !== null) { if ($this->chatMessages !== null) {
@@ -1045,6 +1054,16 @@ final class AgentRunnerConfig
return $this->getChatRequiredString('agent.messages.debug_internal_error_prefix', 'messages.debug_internal_error_prefix'); return $this->getChatRequiredString('agent.messages.debug_internal_error_prefix', 'messages.debug_internal_error_prefix');
} }
public function getTechnicalErrorDetailTemplate(): string
{
return $this->getChatOnlyRequiredString('agent.messages.technical_error_detail_template');
}
public function getHistoryResponseSystemNoticeTemplate(): string
{
return $this->getChatOnlyRequiredString('agent.production_ui.templates.history_response_system_notice');
}
public function getExternalUrlSourceLabel(): string public function getExternalUrlSourceLabel(): string
{ {
return $this->getChatRequiredString('agent.source_labels.external_url', 'source_labels.external_url'); return $this->getChatRequiredString('agent.source_labels.external_url', 'source_labels.external_url');

View File

@@ -298,6 +298,7 @@ final class ChatMessagesConfig
'agent.messages.shop_query_optimization_heartbeat', 'agent.messages.shop_query_optimization_heartbeat',
'agent.messages.generic_internal_error', 'agent.messages.generic_internal_error',
'agent.messages.debug_internal_error_prefix', 'agent.messages.debug_internal_error_prefix',
'agent.messages.technical_error_detail_template',
'agent.final_answer_guard.truncation_message', 'agent.final_answer_guard.truncation_message',
'agent.no_llm_fallback.messages.shop_only', 'agent.no_llm_fallback.messages.shop_only',
'agent.no_llm_fallback.messages.shop_with_knowledge', 'agent.no_llm_fallback.messages.shop_with_knowledge',
@@ -419,6 +420,7 @@ final class ChatMessagesConfig
'agent.production_ui.templates.shop_meta_result_count', 'agent.production_ui.templates.shop_meta_result_count',
'agent.production_ui.templates.history_notice_without_detail', 'agent.production_ui.templates.history_notice_without_detail',
'agent.production_ui.templates.history_notice_with_detail', 'agent.production_ui.templates.history_notice_with_detail',
'agent.production_ui.templates.history_response_system_notice',
'agent.source_labels.external_url', 'agent.source_labels.external_url',
'agent.source_labels.rag_knowledge', 'agent.source_labels.rag_knowledge',
'agent.source_labels.conversation_history', 'agent.source_labels.conversation_history',