diff --git a/aria-brain/agent.py b/aria-brain/agent.py index 7d7dc13..57fb58c 100644 --- a/aria-brain/agent.py +++ b/aria-brain/agent.py @@ -1062,6 +1062,8 @@ class Agent: # /shared/config/local_llm.json (Default aus → alles Claude wie bisher). # Rueckgabe: fertige Antwort (str) wenn lokal erledigt, sonst None → Claude. + _LOCAL_WINDOW_TURNS = 8 # nur die letzten N Turns ans lokale Modell (Speed) + def _try_local_fast_lane(self, user_message: str, active_project_id: str) -> Optional[str]: cfg = router_mod.load_config() @@ -1069,7 +1071,10 @@ class Agent: return None sys_prompt = router_mod.build_local_system_prompt(IDENTITY_ANCHOR) - window = self.conversation.window(project_id=active_project_id) + # Nur die letzten paar Turns ans lokale Modell — es ist fuer kurze + # Plauder-Turns da. Volles Fenster (bis 50) wuerde das Prefill aufblaehen + # und den Speed-Vorteil auffressen (gemessen: 12 Turns → ~2,6s statt ~0,8s). + window = self.conversation.window(project_id=active_project_id)[-self._LOCAL_WINDOW_TURNS:] messages = [{"role": "system", "content": sys_prompt}] messages += [{"role": t.role, "content": t.content} for t in window]