From 90f1245ff1f0fd094a6796bb271cdbc179678c3e Mon Sep 17 00:00:00 2001 From: zetaloop Date: Mon, 23 Feb 2026 10:09:59 +0800 Subject: [PATCH] fix(chat): surface PolicyDecision feedback on send failure --- app/(order)/chat/[id]/page.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/(order)/chat/[id]/page.tsx b/app/(order)/chat/[id]/page.tsx index 19f0ef5..bb3a9ca 100644 --- a/app/(order)/chat/[id]/page.tsx +++ b/app/(order)/chat/[id]/page.tsx @@ -11,6 +11,7 @@ import { Input } from "@/components/ui/input" import { ScrollArea } from "@/components/ui/scroll-area" import { sendImageMessage, sendTextMessage } from "@/lib/api/chat" import { cn } from "@/lib/utils" +import { notifyInfo } from "@/lib/toast" import { useAuthStore } from "@/store/auth" import { useChatStore } from "@/store/chat" @@ -146,7 +147,8 @@ export default function ChatDetailPage({ params }: { params: Promise<{ id: strin onChange={(event) => { const file = event.target.files?.[0] if (!file) return - sendImageMessage(session.id, URL.createObjectURL(file)) + const result = sendImageMessage(session.id, URL.createObjectURL(file)) + if (result && !result.ok) notifyInfo(result.message ?? "发送失败") event.target.value = "" }} /> @@ -157,7 +159,11 @@ export default function ChatDetailPage({ params }: { params: Promise<{ id: strin const text = input.trim() if (!text) return - sendTextMessage(session.id, text) + const result = sendTextMessage(session.id, text) + if (result && !result.ok) { + notifyInfo(result.message ?? "发送失败") + return + } setInput("") }} >