Configurable conversation limit now set to 10 exchanges. This helps when you want to manually continue a thread of thought across different models manually.

This commit is contained in:
Fahad
2025-06-14 14:00:13 +04:00
parent bc3f98a291
commit 7d33aafcab
6 changed files with 28 additions and 8 deletions

View File

@@ -57,7 +57,17 @@ from pydantic import BaseModel
logger = logging.getLogger(__name__)
# Configuration constants
MAX_CONVERSATION_TURNS = 10 # Maximum turns allowed per conversation thread
# Get max conversation turns from environment, default to 20 turns (10 exchanges)
try:
MAX_CONVERSATION_TURNS = int(os.getenv("MAX_CONVERSATION_TURNS", "20"))
if MAX_CONVERSATION_TURNS <= 0:
logger.warning(f"Invalid MAX_CONVERSATION_TURNS value ({MAX_CONVERSATION_TURNS}), using default of 20 turns")
MAX_CONVERSATION_TURNS = 20
except ValueError:
logger.warning(
f"Invalid MAX_CONVERSATION_TURNS value ('{os.getenv('MAX_CONVERSATION_TURNS')}'), using default of 20 turns"
)
MAX_CONVERSATION_TURNS = 20
# Get conversation timeout from environment (in hours), default to 3 hours
try: