refactor(logging): introduce centralized logging and FastAPI lifespan
Some checks failed
Build and Push Docker / build-and-push (push) Failing after 2m38s
Some checks failed
Build and Push Docker / build-and-push (push) Failing after 2m38s
This commit is contained in:
@ -1,11 +1,15 @@
|
||||
# main.py
|
||||
import sys
|
||||
import logging
|
||||
from haystack import Document
|
||||
|
||||
# 需要 OpenAIDocumentEmbedder 来嵌入要写入的文档
|
||||
from haystack.components.embedders import OpenAIDocumentEmbedder
|
||||
from haystack.utils import Secret
|
||||
|
||||
# 设置logger
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# 导入所需的配置和构建函数
|
||||
from config import (
|
||||
DEFAULT_USER_ID,
|
||||
@ -130,7 +134,7 @@ def run_chat_session(user_id: str):
|
||||
print(f"Chatbot: {answer} (Tokens: {total_tokens})")
|
||||
else:
|
||||
print("Chatbot: Sorry, I couldn't generate an answer for that.")
|
||||
print("Debug Info (Pipeline Results):", results) # 打印完整结果以供调试
|
||||
logger.debug(f"Pipeline Results: {results}") # 记录调试信息
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("\nExiting chat session. Goodbye!")
|
||||
|
Reference in New Issue
Block a user