harden history find tokens and shops earch

This commit is contained in:
team 1
2026-04-26 19:59:31 +02:00
parent ff273ff9a0
commit 308e980b4a
11 changed files with 1230 additions and 75 deletions

View File

@@ -0,0 +1,68 @@
# RetrieX Shop Query Language Fix
Patch-only fix for v1.5.0.
## Problem
The Shopware query optimizer could translate German user input into English, for example:
```text
welchen testomat kann ich nutzen zur freien chlor messung
```
became:
```text
testomat free chlorine measurement
```
This reduced Shopware hit quality because the shop catalog is primarily queried with German/domain terms.
## Fix
- Strengthens `config/retriex/agent.yaml` prompt rules so the optimized shop query must preserve the language of the current user input.
- Adds configurable language-preservation settings under `shop_prompt.language_preservation`.
- Adds a small post-optimizer repair step in `AgentRunner` that only applies configured replacements when the current user input matches configured language markers.
- Keeps all translation/repair terms in YAML/fallback config, not as hard-coded product-specific logic in the Shop/Retrieval core.
- Extends the effective config dump with the new language-preservation settings.
## Example
```text
testomat free chlorine measurement
```
is repaired to:
```text
testomat freies chlor messung
```
for German input.
## Safety
- No Retrieval, Vector, Scoring, PromptBuilder, SearchRepair or Shopware API logic changed.
- No Testomat-808-specific logic.
- Product names, brands and model numbers remain preserved.
- All new language repair rules are configurable in `agent.yaml`.
## After installation
```bash
php bin/console cache:clear
php bin/console mto:agent:config:validate
php bin/console mto:agent:regression:test
```
Then retest:
```text
welchen testomat kann ich nutzen zur freien chlor messung
```
The displayed shop query should stay German, e.g.:
```text
testomat freies chlor messung
```