fix(imports): agent_runner MailService→Mail model, fix trace_hooks syntax, fix trace_api_contracts warnings
Check Cross-Plugin Imports / check (push) Has been cancelled
Check Cross-Plugin Imports / check (push) Has been cancelled
This commit is contained in:
@@ -112,15 +112,18 @@ async def run_agent(
|
||||
logger.warning("Failed to collect contacts for proactive context")
|
||||
|
||||
try:
|
||||
from app.services.mail_service import MailService
|
||||
mail_svc = MailService(db)
|
||||
recent_mails = await mail_svc.list_mails(
|
||||
tenant_id=agent.tenant_id,
|
||||
user_id=None,
|
||||
page=1,
|
||||
page_size=5,
|
||||
from app.plugins.builtins.mail.models import Mail
|
||||
from sqlalchemy import select as _select
|
||||
mail_q = await db.execute(
|
||||
_select(Mail)
|
||||
.where(Mail.tenant_id == agent.tenant_id)
|
||||
.order_by(Mail.date.desc())
|
||||
.limit(5)
|
||||
)
|
||||
context_data["recent_mails"] = recent_mails.get("items", [])
|
||||
context_data["recent_mails"] = [
|
||||
{"id": str(m.id), "subject": m.subject, "from": m.sender}
|
||||
for m in mail_q.scalars()
|
||||
]
|
||||
except Exception:
|
||||
logger.warning("Failed to collect mails for proactive context")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user