fix(chat): update unlock response contract

This commit is contained in:
2026-06-30 18:15:39 +08:00
parent bfc2c3cc1e
commit 5f94105bc6
7 changed files with 130 additions and 30 deletions
@@ -1,23 +1,21 @@
/**
* 私密消息解锁响应
*/
import { z } from "zod";
export const UnlockPrivateReasonSchema = z.enum([
"ok",
"quota_exceeded",
"not_private",
"not_found",
]);
import { ChatLockDetailSchema } from "./chat_payloads";
/**
* 单条历史付费 / 私密消息解锁响应。
*/
export const UnlockPrivateReasonSchema = z.string().default("");
export const UnlockPrivateResponseSchema = z.object({
unlocked: z.boolean(),
content: z.string().nullable(),
showUpgrade: z.boolean().default(false),
paywallTriggered: z.boolean().default(false),
privateFreeLimit: z.number().default(0),
privateUsedToday: z.number().default(0),
content: z.string().default(""),
reason: UnlockPrivateReasonSchema,
creditBalance: z.number().default(0),
creditsCharged: z.number().default(0),
requiredCredits: z.number().default(0),
shortfallCredits: z.number().default(0),
lockDetail: ChatLockDetailSchema,
});
export type UnlockPrivateReason = z.output<typeof UnlockPrivateReasonSchema>;