diff --git a/backend/app/services/agent_context.py b/backend/app/services/agent_context.py index 84ebaece2..6e15c0602 100644 --- a/backend/app/services/agent_context.py +++ b/backend/app/services/agent_context.py @@ -199,9 +199,10 @@ async def build_agent_context(agent_id: uuid.UUID, agent_name: str, role_descrip try: from app.models.channel_config import ChannelConfig from app.database import async_session as _ctx_session + from sqlalchemy import select as _feishu_select async with _ctx_session() as _ctx_db: _cfg_r = await _ctx_db.execute( - select(ChannelConfig).where( + _feishu_select(ChannelConfig).where( ChannelConfig.agent_id == agent_id, ChannelConfig.channel_type == "feishu", ChannelConfig.is_configured == True, @@ -334,6 +335,7 @@ async def build_agent_context(agent_id: uuid.UUID, agent_name: str, role_descrip try: from app.database import async_session from app.models.system_settings import SystemSetting + from app.models.agent import Agent as _AgentModel from sqlalchemy import select as sa_select async with async_session() as db: # Resolve agent's tenant_id