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

@@ -17,7 +17,6 @@ limitations under the License.
from unittest.mock import MagicMock, Mock, patch
from uuid import uuid4
import pytest
from sqlalchemy.orm import Session
from app.agents.chat_agent import ChatAgent
@@ -36,13 +35,13 @@ def build_agent(transfer_to_human: bool) -> ChatAgent:
storage = Mock()
storage.get_session_state.return_value = {"status": "active"}
with patch('app.agents.chat_agent.get_db') as mock_get_db, \
with patch('app.agents.chat_agent.SessionLocal') as mock_session_local, \
patch('app.agents.chat_agent.JiraRepository') as mock_jira_repo, \
patch('app.tools.knowledge_search_byagent.KnowledgeSearchByAgent', return_value=Mock()), \
patch('app.agents.chat_agent.EncryptedPostgresAgentStorage', return_value=storage), \
patch('app.agents.chat_agent.settings.DATABASE_URL', "mock://test"), \
patch.dict('os.environ', {}, clear=True):
mock_get_db.return_value = iter([MagicMock(spec=Session)])
mock_session_local.return_value.__enter__.return_value = MagicMock(spec=Session)
mock_jira_repo.return_value.get_agent_with_jira_config.return_value = agent_data
return ChatAgent(