feat(chat): render role-bound payment guidance
Docker Image / Build and Push Docker Image (push) Successful in 5m2s
Docker Image / Build and Push Docker Image (push) Successful in 5m2s
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user