Update main.py
Browse files
main.py
CHANGED
@@ -213,7 +213,8 @@ async def chat(request: ChatRequest, background_tasks: BackgroundTasks, api_key:
|
|
213 |
"conversation_id": conversation_id,
|
214 |
"user_id": request.user_id
|
215 |
}
|
216 |
-
|
|
|
217 |
async def response_generator():
|
218 |
full_response = ""
|
219 |
async for chunk in stream_llm_request(api_key, llm_request):
|
@@ -224,7 +225,7 @@ async def chat(request: ChatRequest, background_tasks: BackgroundTasks, api_key:
|
|
224 |
# For example:
|
225 |
# background_tasks.add_task(save_conversation, request.user_id, conversation_id, request.query, full_response)
|
226 |
|
227 |
-
logger.info(f"
|
228 |
return StreamingResponse(response_generator(), media_type="text/event-stream")
|
229 |
|
230 |
except Exception as e:
|
|
|
213 |
"conversation_id": conversation_id,
|
214 |
"user_id": request.user_id
|
215 |
}
|
216 |
+
|
217 |
+
logger.info(f"Starting chat response generation for user: {request.user_id} Full request: {llm_request}")
|
218 |
async def response_generator():
|
219 |
full_response = ""
|
220 |
async for chunk in stream_llm_request(api_key, llm_request):
|
|
|
225 |
# For example:
|
226 |
# background_tasks.add_task(save_conversation, request.user_id, conversation_id, request.query, full_response)
|
227 |
|
228 |
+
logger.info(f"Finished chat response generation for user: {request.user_id} Full response{full_response}")
|
229 |
return StreamingResponse(response_generator(), media_type="text/event-stream")
|
230 |
|
231 |
except Exception as e:
|