增加日志
This commit is contained in:
parent
66e0410215
commit
48da46c9e9
@ -88,7 +88,9 @@ async def converse_with_chat_assistant(
|
||||
# ========== 1. 静态问答匹配 ==========
|
||||
try:
|
||||
static_qa_service = get_static_qa_service()
|
||||
logger.info(f'[StaticQA] 开始匹配 | chat_id={converse_params.chat_id} | question={converse_params.question} | threshold=0.70')
|
||||
static_match, static_sim = static_qa_service.find_match(converse_params.question, threshold=0.70)
|
||||
logger.info(f'[StaticQA] 匹配结果 | similarity={static_sim:.2f} | matched={static_match is not None}')
|
||||
|
||||
if static_match:
|
||||
cached_answer = static_match.get('answer', '')
|
||||
@ -118,11 +120,13 @@ async def converse_with_chat_assistant(
|
||||
|
||||
# ========== 2. RAG历史缓存查找 ==========
|
||||
if redis:
|
||||
logger.info(f'[SemanticCache] 开始查找 | chat_id={converse_params.chat_id} | question={converse_params.question} | threshold=0.60')
|
||||
cache_result = await lookup_question(
|
||||
converse_params.chat_id,
|
||||
converse_params.question,
|
||||
redis
|
||||
)
|
||||
logger.info(f'[SemanticCache] 查找结果 | found={cache_result is not None}')
|
||||
if cache_result:
|
||||
cached_answer, cache_similarity = cache_result
|
||||
cache_source = 'rag_history'
|
||||
|
||||
@ -155,10 +155,10 @@ async def stream_chat_async(
|
||||
timer.restart()
|
||||
|
||||
payload = {
|
||||
"chat_id": chat_id,
|
||||
"chatId": chat_id,
|
||||
"question": question,
|
||||
"stream": True,
|
||||
"session_id": session_id,
|
||||
"sessionId": session_id,
|
||||
}
|
||||
headers = {
|
||||
"Authorization": f"Bearer {token}",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user