fix: improve maintenance and synchronize live conversations

This commit is contained in:
WangShen007 committed 2026-10-29 09:46:21 +08:00
1 parent bb541bd212
commit ef86a5d3af
297 files changed
+2983 -1274

No files matched your search

+3 -8
View File
@@ -17,9 +17,7 @@ limitations under the License.
import asyncio
import pytest
import pytz
from datetime import datetime, timedelta
from unittest.mock import patch, MagicMock, AsyncMock
import sys
from app.agents.transfer_agent import (
FOLLOW_UP_TIMEOUT_MESSAGE,
TRANSFER_TIMEOUT_MESSAGE,
@@ -32,8 +30,6 @@ from app.models.agent import Agent, AgentType
from app.models.organization import Organization
from app.models.user import User, UserGroup
from uuid import uuid4
import app.utils.agno_utils
from fastapi import HTTPException
# Mock for agno.agent.Agent
class MockPhiAgent:
@@ -132,7 +128,6 @@ async def test_transfer_response_agent_initialization():
# Create a spy to track calls to create_model
create_model_calls = []
original_create_model = app.utils.agno_utils.create_model
def spy_create_model(*args, **kwargs):
create_model_calls.append((args, kwargs))
@@ -533,7 +528,7 @@ async def test_timezone_handling(test_agent):
mock_pytz.UTC = pytz.UTC
mock_pytz.UnknownTimeZoneError = pytz.exceptions.UnknownTimeZoneError
response = await get_agent_availability_response(
await get_agent_availability_response(
agent=test_agent,
customer_id="customer123",
chat_history=[],
@@ -552,7 +547,7 @@ async def test_timezone_handling(test_agent):
mock_pytz.timezone.side_effect = pytz.exceptions.UnknownTimeZoneError("Invalid/Timezone")
test_agent.organization.timezone = "Invalid/Timezone"
response = await get_agent_availability_response(
await get_agent_availability_response(
agent=test_agent,
customer_id="customer123",
chat_history=[],
@@ -564,4 +559,4 @@ async def test_timezone_handling(test_agent):
)
# Verify that timezone was called with the invalid timezone
mock_pytz.timezone.assert_called_with("Invalid/Timezone")
mock_pytz.timezone.assert_called_with("Invalid/Timezone")