Preserve legacy rag dispatch payloads
Browse files at this commit184b84d5b496bc77065b2db1e43e0e72b69fe7a7Parent: bbe1499- fix
- preserve legacy rag dispatch payloads
1 changed file +9 -5
- src/bridge/dispatch.py +9 -5
src/bridge/dispatch.pymodified+9 -5
| @@ -170,11 +170,15 @@ class Dispatcher: | ||
| 170 | 170 | else: |
| 171 | 171 | p = RagSummarizeRequestPayload.from_wire(req.payload) |
| 172 | 172 | ek = {} |
| 173 | - return {"scope": p.scope.to_wire(), "user": p.asker or None, | |
| 174 | - "role": ({"role": p.asker_role, "sinif": p.scope.sinif, | |
| 175 | - "ders_list": [p.scope.ders]} if p.asker_role else None), | |
| 176 | - "scope_pairs": list(p.scope_pairs), | |
| 177 | - "school": okul, "deadline_ms": req.deadline_ms, **ek} | |
| 173 | + govde = {"scope": p.scope.to_wire(), "user": p.asker or None, | |
| 174 | + "role": ({"role": p.asker_role, "sinif": p.scope.sinif, | |
| 175 | + "ders_list": [p.scope.ders]} if p.asker_role else None), | |
| 176 | + "school": okul, "deadline_ms": req.deadline_ms, **ek} | |
| 177 | + # Preserve the old handler request shape for old backend frames that | |
| 178 | + # have no scope_pairs field; an explicit empty field still round-trips. | |
| 179 | + if "scope_pairs" in req.payload: | |
| 180 | + govde["scope_pairs"] = list(p.scope_pairs) | |
| 181 | + return govde | |
| 178 | 182 | |
| 179 | 183 | def _rag_summarize(self, req: BridgeRequest, okul: str) -> dict: |
| 180 | 184 | """`rag.summarize` → servis `summarize()` → backend'in `RagSummarizeReplyPayload`i.""" |