Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/backend/app_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,8 @@ async def input_task_endpoint(input_task: InputTask, request: Request):
# Convert input task to JSON for the kernel function, add user_id here

# Use the planner to handle the task
result = await group_chat_manager.handle_input_task(input_task)
await group_chat_manager.handle_input_task(input_task)

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

Expand Down Expand Up @@ -176,7 +175,6 @@ async def input_task_endpoint(input_task: InputTask, request: Request):
}

except Exception as e:
logging.exception(f"Error handling input task: {e}")
track_event_if_configured(
"InputTaskError",
{
Expand Down Expand Up @@ -779,18 +777,17 @@ async def delete_all_messages(request: Request) -> Dict[str, str]:
authenticated_user = get_authenticated_user_details(request_headers=request.headers)
user_id = authenticated_user["user_principal_id"]
if not user_id:
track_event_if_configured(
"UserIdNotFound", {"status_code": 400, "detail": "no user"}
)
raise HTTPException(status_code=400, detail="no user")

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

logging.info("Deleting all plans")
await memory_store.delete_all_items("plan")
logging.info("Deleting all sessions")
await memory_store.delete_all_items("session")
logging.info("Deleting all steps")
await memory_store.delete_all_items("step")
logging.info("Deleting all agent_messages")
await memory_store.delete_all_items("agent_message")

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

# Initialize memory context
Expand Down
1 change: 0 additions & 1 deletion src/backend/context/cosmos_memory_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ async def initialize(self):
id=self._cosmos_container,
partition_key=PartitionKey(path="/session_id"),
)
logging.info("Successfully connected to CosmosDB")
except Exception as e:
logging.error(
f"Failed to initialize CosmosDB container: {e}. Continuing without CosmosDB for testing."
Expand Down
19 changes: 0 additions & 19 deletions src/backend/handlers/runtime_interrupt_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ async def on_message(
Returns:
The original message (for pass-through functionality)
"""
print(
f"NeedsUserInputHandler received message: {message} from sender: {sender_type}/{sender_key}"
)

if isinstance(message, GetHumanInputMessage):
self.question_for_human = message
self.messages.append(
Expand All @@ -67,7 +63,6 @@ async def on_message(
"content": message.content,
}
)
print("Captured question for human in NeedsUserInputHandler")
elif isinstance(message, GroupChatMessage):
# Ensure we extract content consistently with the original implementation
content = (
Expand All @@ -81,7 +76,6 @@ async def on_message(
"content": content,
}
)
print(f"Captured group chat message in NeedsUserInputHandler - {message}")
elif isinstance(message, dict) and "content" in message:
# Handle messages directly from AzureAIAgent
self.question_for_human = GetHumanInputMessage(content=message["content"])
Expand All @@ -91,7 +85,6 @@ async def on_message(
"content": message["content"],
}
)
print("Captured question from AzureAIAgent in NeedsUserInputHandler")

return message

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


Expand All @@ -133,38 +125,28 @@ async def on_message(self, message: Any, sender_type: str = None) -> Any:
Returns:
The original message (for pass-through functionality)
"""
print(
f"on_message called in AssistantResponseHandler with message from sender: {sender_type} - {message}"
)

if hasattr(message, "body") and sender_type in ["writer", "editor"]:
# Ensure we're handling the content consistently with the original implementation
self.assistant_response = (
message.body.content
if hasattr(message.body, "content")
else str(message.body)
)
print("Assistant response set in AssistantResponseHandler")
elif isinstance(message, dict) and "value" in message and sender_type:
# Handle message from AzureAIAgent
self.assistant_response = message["value"]
print(
"Assistant response from AzureAIAgent set in AssistantResponseHandler"
)

return message

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

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


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

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


Expand Down
Loading
Loading