From 9a71f6e6e44f40e9fb85d0d8f55127e0daa0b25b Mon Sep 17 00:00:00 2001 From: Charlie Leopard Date: Tue, 29 Oct 2024 12:50:35 +0000 Subject: [PATCH] Remove logs from testing redis chat history --- backend/src/api/app.py | 1 - backend/src/session/redis_session_middleware.py | 1 - backend/src/suggestions_generator.py | 5 +---- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/backend/src/api/app.py b/backend/src/api/app.py index 2588e3b5..50cdbab6 100644 --- a/backend/src/api/app.py +++ b/backend/src/api/app.py @@ -98,7 +98,6 @@ async def suggestions(): logger.info("Requesting chat suggestions") try: final_result = await generate_suggestions() - logger.info(f"Chat suggestions: {final_result}") return JSONResponse(status_code=200, content=final_result) except Exception as e: logger.exception(e) diff --git a/backend/src/session/redis_session_middleware.py b/backend/src/session/redis_session_middleware.py index fef8d4de..41b28014 100644 --- a/backend/src/session/redis_session_middleware.py +++ b/backend/src/session/redis_session_middleware.py @@ -66,7 +66,6 @@ def get_redis_session(request: Request): if session_data and isinstance(session_data, str): parsed_session_data = try_parse_to_json(session_data) if parsed_session_data: - logger.info(f"Parsed session data: {parsed_session_data}") return parsed_session_data return {} diff --git a/backend/src/suggestions_generator.py b/backend/src/suggestions_generator.py index d28ba135..cbe794bd 100644 --- a/backend/src/suggestions_generator.py +++ b/backend/src/suggestions_generator.py @@ -5,11 +5,8 @@ from src.session import Message, get_session_chat from src.utils.config import Config -import logging - config = Config() engine = PromptEngine() -logger = logging.getLogger(__name__) suggestions_prompt = engine.load_prompt("generate_message_suggestions") model = config.suggestions_model @@ -38,7 +35,7 @@ def get_suggestions_model() -> str: def get_chat_history() -> List[str] | str: max_history_length = 4 raw_history = get_session_chat() - logger.info(f"Raw history: {raw_history}") + if raw_history is None: return "No chat history available."