Skip to content

Commit d2a008c

Browse files
clean up logging
1 parent 56d9c9b commit d2a008c

File tree

5 files changed

+54
-76
lines changed

5 files changed

+54
-76
lines changed

src/backend/app_kernel.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ async def input_task_endpoint(input_task: InputTask, request: Request):
139139
# Use the planner to handle the task
140140
result = await group_chat_manager.handle_input_task(input_task)
141141

142-
print(f"Result: {result}")
143142
# Get plan from memory store
144143
plan = await memory_store.get_plan_by_session(input_task.session_id)
145144

@@ -176,7 +175,6 @@ async def input_task_endpoint(input_task: InputTask, request: Request):
176175
}
177176

178177
except Exception as e:
179-
logging.exception(f"Error handling input task: {e}")
180178
track_event_if_configured(
181179
"InputTaskError",
182180
{
@@ -779,18 +777,17 @@ async def delete_all_messages(request: Request) -> Dict[str, str]:
779777
authenticated_user = get_authenticated_user_details(request_headers=request.headers)
780778
user_id = authenticated_user["user_principal_id"]
781779
if not user_id:
780+
track_event_if_configured(
781+
"UserIdNotFound", {"status_code": 400, "detail": "no user"}
782+
)
782783
raise HTTPException(status_code=400, detail="no user")
783784

784785
# Initialize memory context
785786
kernel, memory_store = await initialize_runtime_and_context("", user_id)
786787

787-
logging.info("Deleting all plans")
788788
await memory_store.delete_all_items("plan")
789-
logging.info("Deleting all sessions")
790789
await memory_store.delete_all_items("session")
791-
logging.info("Deleting all steps")
792790
await memory_store.delete_all_items("step")
793-
logging.info("Deleting all agent_messages")
794791
await memory_store.delete_all_items("agent_message")
795792

796793
# Clear the agent factory cache
@@ -840,6 +837,9 @@ async def get_all_messages(request: Request):
840837
authenticated_user = get_authenticated_user_details(request_headers=request.headers)
841838
user_id = authenticated_user["user_principal_id"]
842839
if not user_id:
840+
track_event_if_configured(
841+
"UserIdNotFound", {"status_code": 400, "detail": "no user"}
842+
)
843843
raise HTTPException(status_code=400, detail="no user")
844844

845845
# Initialize memory context

src/backend/context/cosmos_memory_kernel.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ async def initialize(self):
8484
id=self._cosmos_container,
8585
partition_key=PartitionKey(path="/session_id"),
8686
)
87-
logging.info("Successfully connected to CosmosDB")
8887
except Exception as e:
8988
logging.error(
9089
f"Failed to initialize CosmosDB container: {e}. Continuing without CosmosDB for testing."

src/backend/handlers/runtime_interrupt_kernel.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ async def on_message(
5555
Returns:
5656
The original message (for pass-through functionality)
5757
"""
58-
print(
59-
f"NeedsUserInputHandler received message: {message} from sender: {sender_type}/{sender_key}"
60-
)
61-
6258
if isinstance(message, GetHumanInputMessage):
6359
self.question_for_human = message
6460
self.messages.append(
@@ -67,7 +63,6 @@ async def on_message(
6763
"content": message.content,
6864
}
6965
)
70-
print("Captured question for human in NeedsUserInputHandler")
7166
elif isinstance(message, GroupChatMessage):
7267
# Ensure we extract content consistently with the original implementation
7368
content = (
@@ -81,7 +76,6 @@ async def on_message(
8176
"content": content,
8277
}
8378
)
84-
print(f"Captured group chat message in NeedsUserInputHandler - {message}")
8579
elif isinstance(message, dict) and "content" in message:
8680
# Handle messages directly from AzureAIAgent
8781
self.question_for_human = GetHumanInputMessage(content=message["content"])
@@ -91,7 +85,6 @@ async def on_message(
9185
"content": message["content"],
9286
}
9387
)
94-
print("Captured question from AzureAIAgent in NeedsUserInputHandler")
9588

9689
return message
9790

@@ -111,7 +104,6 @@ def get_messages(self) -> List[Dict[str, Any]]:
111104
"""Get captured messages and clear buffer."""
112105
messages = self.messages.copy()
113106
self.messages.clear()
114-
print("Returning and clearing captured messages in NeedsUserInputHandler")
115107
return messages
116108

117109

@@ -133,38 +125,28 @@ async def on_message(self, message: Any, sender_type: str = None) -> Any:
133125
Returns:
134126
The original message (for pass-through functionality)
135127
"""
136-
print(
137-
f"on_message called in AssistantResponseHandler with message from sender: {sender_type} - {message}"
138-
)
139-
140128
if hasattr(message, "body") and sender_type in ["writer", "editor"]:
141129
# Ensure we're handling the content consistently with the original implementation
142130
self.assistant_response = (
143131
message.body.content
144132
if hasattr(message.body, "content")
145133
else str(message.body)
146134
)
147-
print("Assistant response set in AssistantResponseHandler")
148135
elif isinstance(message, dict) and "value" in message and sender_type:
149136
# Handle message from AzureAIAgent
150137
self.assistant_response = message["value"]
151-
print(
152-
"Assistant response from AzureAIAgent set in AssistantResponseHandler"
153-
)
154138

155139
return message
156140

157141
@property
158142
def has_response(self) -> bool:
159143
"""Check if response is available."""
160144
has_response = self.assistant_response is not None
161-
print(f"has_response called, returning: {has_response}")
162145
return has_response
163146

164147
def get_response(self) -> Optional[str]:
165148
"""Get captured response."""
166149
response = self.assistant_response
167-
print(f"get_response called, returning: {response}")
168150
return response
169151

170152

@@ -201,7 +183,6 @@ def register_handlers(kernel: sk.Kernel, session_id: str) -> tuple:
201183
kernel.set_variable(f"input_handler_{session_id}", user_input_handler)
202184
kernel.set_variable(f"response_handler_{session_id}", assistant_handler)
203185

204-
print(f"Registered handlers for session {session_id} with kernel")
205186
return user_input_handler, assistant_handler
206187

207188

0 commit comments

Comments
 (0)