import { z } from "zod" const groupAgentConfig = z .object({ isGroupChat: z.boolean().describe("是否是群聊问答"), startTime: z .string() .optional() .describe("开始时间,格式为 YYYY-MM-DD HH:mm:ss"), endTime: z .string() .optional() .describe("结束时间,格式为 YYYY-MM-DD HH:mm:ss"), userQueryResponse: z .string() .optional() .describe("如果不是群聊问答的对用户Query的回复"), }) .refine( (data) => { if (data.isGroupChat) { return data.startTime && data.endTime } else { return data.userQueryResponse } }, { message: "isGroupChat 为 true 时需要 startTime 和 endTime,为 false 时需要 userQueryResponse", path: ["isGroupChat"], } )