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,60 @@
# RetrieX Shop Context + SSE Guard Hotfix
Patch-only hotfix for the Shopware query meta-command flow and duplicate SSE reconnect handling.
## Problem
After the user asked a domain question and then wrote a meta-command like `suche im shop`, the system could either:
- fail to recover the previous domain question from history,
- ask for a concrete search query even though a relevant previous question existed,
- continue with a misleading RAG-only final answer after the shop search was skipped,
- append a misleading duplicate SSE reconnect message such as `Der Antwort-Stream läuft bereits...`.
## Changes
- The shop meta-command fallback now uses a larger history budget.
- If the budgeted history is still polluted by repeated meta turns, the fallback checks the full recent context as a last resort.
- The fallback still ignores meta-only turns such as `shop` / `suche im shop` and derives a compact shop query from the last non-meta domain question.
- If no concrete shop query can be resolved, the agent now stops after the clarification message instead of generating a misleading final answer from RAG context.
- Duplicate EventSource reconnects for already-running or completed jobs are silently closed with `done`, so the UI does not append a misleading stream error after the real stream already produced output.
## Expected behavior
Conversation:
```text
mit welchem testomat kann ich freies chlor messen
suche im shop
```
Expected Shop query:
```text
testomat freies chlor
```
Not expected:
```text
shop
mit welchem testomat kann ich freies chlor messen
```
## Notes
- No retrieval logic changed.
- No scoring logic changed.
- No product-family special case was added.
- No Testomat 808 / Testomat 2000 / Tritromat special handling was added.
- Existing config fallbacks remain intact.
## After applying
Run:
```bash
php bin/console cache:clear
php bin/console mto:agent:config:validate
php bin/console mto:agent:regression:test
```