@@ -25,6 +25,7 @@ async def update_conversation(request: Request):
2525 # Parse request body
2626 request_json = await request .json ()
2727 conversation_id = request_json .get ("conversation_id" )
28+ logger .info ("POST /history/update called: conversation_id=%s, user_id=%s" , conversation_id , user_id )
2829
2930 if not conversation_id :
3031 raise HTTPException (status_code = 400 , detail = "No conversation_id found" )
@@ -39,6 +40,8 @@ async def update_conversation(request: Request):
3940
4041 if not update_response :
4142 raise HTTPException (status_code = 500 , detail = "Failed to update conversation" )
43+ logger .info ("Conversation updated successfully: conversation_id=%s, title='%s'" ,
44+ conversation_id , update_response .get ("title" ))
4245 track_event_if_configured ("ConversationUpdated" , {
4346 "user_id" : user_id ,
4447 "conversation_id" : conversation_id ,
@@ -80,6 +83,7 @@ async def update_message_feedback(request: Request):
8083 request_json = await request .json ()
8184 message_id = request_json .get ("message_id" )
8285 message_feedback = request_json .get ("message_feedback" )
86+ logger .info ("POST /history/message_feedback called: message_id=%s, user_id=%s" , message_id , user_id )
8387
8488 if not message_id :
8589 track_event_if_configured ("MessageFeedbackValidationError" , {
@@ -144,6 +148,7 @@ async def delete_conversation(request: Request):
144148 # Parse request body
145149 request_json = await request .json ()
146150 conversation_id = request_json .get ("conversation_id" )
151+ logger .info ("DELETE /history/delete called: conversation_id=%s, user_id=%s" , conversation_id , user_id )
147152 if not conversation_id :
148153 track_event_if_configured ("DeleteConversationValidationError" , {
149154 "error" : "conversation_id is missing" ,
@@ -159,6 +164,7 @@ async def delete_conversation(request: Request):
159164 # Delete conversation using HistoryService
160165 deleted = await history_service .delete_conversation (user_id , conversation_id )
161166 if deleted :
167+ logger .info ("Conversation deleted successfully: conversation_id=%s, user_id=%s" , conversation_id , user_id )
162168 track_event_if_configured ("ConversationDeleted" , {
163169 "user_id" : user_id ,
164170 "conversation_id" : conversation_id
@@ -247,6 +253,7 @@ async def get_conversation_messages(request: Request):
247253 # Parse request body
248254 request_json = await request .json ()
249255 conversation_id = request_json .get ("conversation_id" )
256+ logger .info ("POST /history/read called: conversation_id=%s, user_id=%s" , conversation_id , user_id )
250257
251258 if not conversation_id :
252259 track_event_if_configured ("ReadConversationValidationError" , {
@@ -271,6 +278,7 @@ async def get_conversation_messages(request: Request):
271278 status_code = 404 ,
272279 detail = f"Conversation { conversation_id } was not found. It either does not exist or the user does not have access to it."
273280 )
281+ logger .info ("Returning %d message(s) for conversation %s" , len (conversationMessages ), conversation_id )
274282 track_event_if_configured ("ConversationRead" , {
275283 "user_id" : user_id ,
276284 "conversation_id" : conversation_id ,
@@ -307,6 +315,8 @@ async def rename_conversation(request: Request):
307315 request_json = await request .json ()
308316 conversation_id = request_json .get ("conversation_id" )
309317 title = request_json .get ("title" )
318+ logger .info ("POST /history/rename called: conversation_id=%s, user_id=%s, new_title='%s'" ,
319+ conversation_id , user_id , title )
310320
311321 if not conversation_id :
312322 track_event_if_configured ("RenameConversationValidationError" , {
@@ -328,6 +338,7 @@ async def rename_conversation(request: Request):
328338 raise HTTPException (status_code = 400 , detail = "title is required" )
329339
330340 rename_conversation = await history_service .rename_conversation (user_id , conversation_id , title )
341+ logger .info ("Conversation renamed successfully: conversation_id=%s, new_title='%s'" , conversation_id , title )
331342
332343 track_event_if_configured ("ConversationRenamed" , {
333344 "user_id" : user_id ,
@@ -357,6 +368,7 @@ async def delete_all_conversations(request: Request):
357368 authenticated_user = get_authenticated_user_details (
358369 request_headers = request .headers )
359370 user_id = authenticated_user ["user_principal_id" ]
371+ logger .info ("DELETE /history/delete_all called: user_id=%s" , user_id )
360372
361373 # Get all user conversations
362374 conversations = await history_service .get_conversations (user_id , offset = 0 , limit = None )
@@ -368,8 +380,10 @@ async def delete_all_conversations(request: Request):
368380 detail = f"No conversations for { user_id } were found" )
369381
370382 # Delete all conversations
383+ logger .info ("Deleting %d conversation(s) for user %s" , len (conversations ), user_id )
371384 for conversation in conversations :
372385 await history_service .delete_conversation (user_id , conversation ["id" ])
386+ logger .info ("All conversations deleted successfully for user %s" , user_id )
373387
374388 track_event_if_configured ("AllConversationsDeleted" , {
375389 "user_id" : user_id ,
@@ -406,6 +420,7 @@ async def clear_messages(request: Request):
406420 # Parse request body
407421 request_json = await request .json ()
408422 conversation_id = request_json .get ("conversation_id" )
423+ logger .info ("POST /history/clear called: conversation_id=%s, user_id=%s" , conversation_id , user_id )
409424
410425 if not conversation_id :
411426 track_event_if_configured ("ClearMessagesValidationError" , {
@@ -430,6 +445,7 @@ async def clear_messages(request: Request):
430445 raise HTTPException (
431446 status_code = 404 ,
432447 detail = "Failed to clear messages or conversation not found" )
448+ logger .info ("Messages cleared successfully for conversation %s, user %s" , conversation_id , user_id )
433449 track_event_if_configured ("MessagesCleared" , {
434450 "user_id" : user_id ,
435451 "conversation_id" : conversation_id
@@ -456,6 +472,7 @@ async def clear_messages(request: Request):
456472@router .get ("/history/ensure" )
457473async def ensure_cosmos ():
458474 try :
475+ logger .info ("GET /history/ensure called" )
459476 success , err = await history_service .ensure_cosmos ()
460477 if not success :
461478 track_event_if_configured ("CosmosDBEnsureFailed" , {
0 commit comments