Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions backend/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@

from ks_search_tool import general_search, general_search_async, global_fuzzy_keyword_search
from retrieval import get_retriever
import logging

# Configure logger
logger = logging.getLogger(__name__)
if not logger.handlers:
_h = logging.StreamHandler()
_h.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(name)s: %(message)s"))
logger.addHandler(_h)
logger.setLevel(logging.INFO)

# LLM (Gemini) client setup
try:
Expand Down Expand Up @@ -576,8 +585,6 @@ async def handle_chat(self, session_id: str, query: str, reset: bool = False) ->
if len(self.chat_history[session_id]) > 20:
self.chat_history[session_id] = self.chat_history[session_id][-20:]
return response_text
except Exception as e:
print(f"Error in handle_chat: {e}")
import traceback
traceback.print_exc()
return "I encountered an error. Please try again."
except Exception:
logger.exception("Error in handle_chat")
return "I'm sorry, I encountered an internal server error and cannot process your request right now."
6 changes: 6 additions & 0 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.