feat: 打通通知回链与历史节点回看
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
|
||||
from .models import AgentAuditLog, NotificationRecord
|
||||
from apps.chat.models import Conversation
|
||||
|
||||
|
||||
def log_list(request):
|
||||
@@ -31,8 +32,9 @@ def log_detail(request, log_id: int):
|
||||
conversation_id=audit_log.conversation_id,
|
||||
batch_id=audit_log.batch_id,
|
||||
)
|
||||
conversation = Conversation.objects.filter(conversation_id=audit_log.conversation_id).first()
|
||||
return render(
|
||||
request,
|
||||
"audit/log_detail.html",
|
||||
{"log": audit_log, "notifications": notifications},
|
||||
{"log": audit_log, "notifications": notifications, "conversation": conversation},
|
||||
)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from django.utils import timezone
|
||||
from django.shortcuts import get_object_or_404, redirect, render
|
||||
from django.urls import reverse
|
||||
|
||||
from agent_core.orchestrator import run_agent
|
||||
from agent_core.results import AgentResult
|
||||
@@ -72,7 +73,10 @@ def detail(request, conversation_id: str):
|
||||
product_name=conversation.product_name,
|
||||
)
|
||||
_apply_agent_result_to_conversation(conversation, result)
|
||||
_persist_notification_records(result)
|
||||
_persist_notification_records(
|
||||
result,
|
||||
web_detail_url=reverse("audit:detail", args=[audit_log.id]),
|
||||
)
|
||||
active_node = "risk"
|
||||
conversation.refresh_from_db()
|
||||
workspace_summary = _build_workspace_summary(conversation, batch)
|
||||
@@ -97,7 +101,7 @@ def detail(request, conversation_id: str):
|
||||
)
|
||||
|
||||
|
||||
def _persist_notification_records(result: AgentResult) -> None:
|
||||
def _persist_notification_records(result: AgentResult, *, web_detail_url: str = "") -> None:
|
||||
payload = result.notification_payload or {}
|
||||
owners = payload.get("owners") or []
|
||||
if not owners:
|
||||
@@ -112,7 +116,7 @@ def _persist_notification_records(result: AgentResult) -> None:
|
||||
owner_role=owner.get("owner_role", ""),
|
||||
feishu_user_id=owner.get("feishu_user_id", ""),
|
||||
message_status="sent" if result.status == "success" else "failed",
|
||||
web_detail_url="",
|
||||
web_detail_url=web_detail_url,
|
||||
receipt={"status": result.status},
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user