Skip to content

Commit c671c6d

Browse files
committed
Facilitate monkey patching
1 parent c11d46b commit c671c6d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

llm-service/app/services/chat_history/chat_history_manager.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,12 @@ def append_to_history(
8989

9090

9191
@functools.cache
92-
def get_chat_history_manager() -> ChatHistoryManager:
92+
def _get_chat_history_manager() -> ChatHistoryManager:
93+
"""Return a ChatHistoryManager based on the app's chat store config.
94+
95+
This function can be monkey-patched for testing purposes.
96+
97+
"""
9398
from app.services.chat_history.simple_chat_history_manager import (
9499
SimpleChatHistoryManager,
95100
)
@@ -103,3 +108,7 @@ def get_chat_history_manager() -> ChatHistoryManager:
103108
return S3ChatHistoryManager()
104109
else:
105110
return SimpleChatHistoryManager()
111+
112+
113+
def get_chat_history_manager() -> ChatHistoryManager:
114+
return _get_chat_history_manager()

0 commit comments

Comments
 (0)