refactor: extract post-ops helpers from pydantic agent

This commit is contained in:
2026-03-01 15:14:57 +08:00
parent 6458e7dcca
commit b323a64b0b
5 changed files with 190 additions and 211 deletions

View File

@@ -2,6 +2,7 @@ from __future__ import annotations
import asyncio
from typing import TYPE_CHECKING, Optional
from core.post_ops import record_deal_success
if TYPE_CHECKING:
from core.pydantic_ai_agent import AgentResponse, ConversationState, CustomerMessage, CustomerServiceAgent
@@ -31,13 +32,13 @@ async def handle_order_notification(
if is_paid:
asyncio.create_task(agent._check_order_amount(message.from_id, order, message.acc_id))
asyncio.create_task(
agent._record_deal_success(
message.from_id,
message.from_name,
message.acc_id,
message.acc_type,
order,
state,
record_deal_success(
customer_id=message.from_id,
customer_name=message.from_name,
acc_id=message.acc_id,
platform=message.acc_type,
order=order,
state=state,
)
)
try: