feat(chat): render role-bound payment guidance
Docker Image / Build and Push Docker Image (push) Successful in 5m2s

This commit is contained in:
Codex
2026-07-27 18:14:04 +08:00
parent 019caae598
commit 8c0d1ad3ce
49 changed files with 882 additions and 81 deletions
+9 -1
View File
@@ -15,8 +15,10 @@ import { Logger } from "@/utils/logger";
import {
CommercialActionSchema,
ChatActionSchema,
PaymentGuidanceSchema,
type ChatAction,
type CommercialAction,
type PaymentGuidance,
} from "@/data/schemas/chat";
import { createClientMessageId } from "@/lib/chat/client_message_id";
@@ -49,6 +51,7 @@ export class ChatWebSocket {
onPaywallStatus: ((payload: PaywallStatusPayload) => void) | null = null;
onCommercialAction: ((action: CommercialAction) => void) | null = null;
onChatAction: ((action: ChatAction) => void) | null = null;
onPaymentGuidance: ((guidance: PaymentGuidance) => void) | null = null;
onError: ((errorMessage: string) => void) | null = null;
constructor(
@@ -146,7 +149,7 @@ export class ChatWebSocket {
done?: boolean;
audioUrl?: string;
error?: string;
data?: {
data?: Record<string, unknown> & {
image?: {
type?: string | null;
url?: string | null;
@@ -209,6 +212,11 @@ export class ChatWebSocket {
if (action.success) this.onChatAction?.(action.data);
break;
}
case "payment_guidance": {
const guidance = PaymentGuidanceSchema.safeParse(payload.data);
if (guidance.success) this.onPaymentGuidance?.(guidance.data);
break;
}
case "error":
this.onError?.(payload.error ?? "Unknown error");
break;