diff --git a/config/retriex/chat-messages.yaml b/config/retriex/chat-messages.yaml
index 1871e89..5aa91b8 100644
--- a/config/retriex/chat-messages.yaml
+++ b/config/retriex/chat-messages.yaml
@@ -92,6 +92,7 @@ parameters:
shop_query_optimization_heartbeat: Shop-Suchanfrage wird optimiert…
generic_internal_error: ❌ Bei der Verarbeitung der Anfrage ist ein interner Fehler aufgetreten.
debug_internal_error_prefix: '❌ Interner Fehler: '
+ technical_error_detail_template: '
Technischer Fehler: {message}'
final_answer_guard:
truncation_message: |2-
@@ -231,6 +232,7 @@ parameters:
shop_meta_result_count: 'Shoptreffer: {count}'
history_notice_without_detail: 'Systemhinweis: {title}.'
history_notice_with_detail: 'Systemhinweis: {title}. Ursache: {detail}'
+ history_response_system_notice: 'Systemhinweis: {message}'
follow_up_actions:
commerce:
- label: Im Shop suchen
diff --git a/patch_history/RETRIEX_PATCH_66_CHAT_MESSAGE_RESIDUAL_CLEANUP_README.md b/patch_history/RETRIEX_PATCH_66_CHAT_MESSAGE_RESIDUAL_CLEANUP_README.md
new file mode 100644
index 0000000..3073bef
--- /dev/null
+++ b/patch_history/RETRIEX_PATCH_66_CHAT_MESSAGE_RESIDUAL_CLEANUP_README.md
@@ -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".
+```
diff --git a/src/Agent/AgentRunner.php b/src/Agent/AgentRunner.php
index 82c5d09..d605002 100644
--- a/src/Agent/AgentRunner.php
+++ b/src/Agent/AgentRunner.php
@@ -4516,7 +4516,10 @@ final readonly class AgentRunner
$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));
@@ -5015,7 +5018,10 @@ final readonly class AgentRunner
if (!$this->debug) {
return $this->agentRunnerConfig->getGenericInternalErrorMessage()
- . '
Technischer Fehler: ' . $safeMessage . '';
+ . $this->renderAgentTemplate(
+ $this->agentRunnerConfig->getTechnicalErrorDetailTemplate(),
+ ['message' => $safeMessage]
+ );
}
return $this->agentRunnerConfig->getDebugInternalErrorPrefix()
diff --git a/src/Config/AgentRunnerConfig.php b/src/Config/AgentRunnerConfig.php
index b6bc405..f722cf7 100644
--- a/src/Config/AgentRunnerConfig.php
+++ b/src/Config/AgentRunnerConfig.php
@@ -386,6 +386,15 @@ final class AgentRunnerConfig
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
{
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');
}
+ 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
{
return $this->getChatRequiredString('agent.source_labels.external_url', 'source_labels.external_url');
diff --git a/src/Config/ChatMessagesConfig.php b/src/Config/ChatMessagesConfig.php
index cb45520..98543d6 100644
--- a/src/Config/ChatMessagesConfig.php
+++ b/src/Config/ChatMessagesConfig.php
@@ -298,6 +298,7 @@ final class ChatMessagesConfig
'agent.messages.shop_query_optimization_heartbeat',
'agent.messages.generic_internal_error',
'agent.messages.debug_internal_error_prefix',
+ 'agent.messages.technical_error_detail_template',
'agent.final_answer_guard.truncation_message',
'agent.no_llm_fallback.messages.shop_only',
'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.history_notice_without_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.rag_knowledge',
'agent.source_labels.conversation_history',