fix: Resolve circular import between context.py and handlers.py

- Move RotationHandler import inside method to avoid circular dependency
- Import RotationHandler only when needed in ContextManager.__init__
parent fe7b1fd9
...@@ -27,7 +27,6 @@ from typing import Dict, List, Optional, Union, Any ...@@ -27,7 +27,6 @@ from typing import Dict, List, Optional, Union, Any
from .utils import count_messages_tokens from .utils import count_messages_tokens
from .config import config from .config import config
from .providers import get_provider_handler from .providers import get_provider_handler
from .handlers import RotationHandler
class ContextManager: class ContextManager:
...@@ -76,6 +75,8 @@ class ContextManager: ...@@ -76,6 +75,8 @@ class ContextManager:
if is_rotation: if is_rotation:
# Use rotation handler for condensation # Use rotation handler for condensation
# Import here to avoid circular import
from .handlers import RotationHandler
rotation_handler = RotationHandler() rotation_handler = RotationHandler()
# Store rotation handler and rotation_id for later use # Store rotation handler and rotation_id for later use
self._rotation_handler = rotation_handler self._rotation_handler = rotation_handler
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment