From 9b5324ff7e0fa7c5a58f7c5d2b9fceb4893a024d Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 20 Apr 2026 17:16:27 +0100 Subject: [PATCH] refactor: share qqbot speech provider schema --- extensions/qqbot/src/config-schema.ts | 37 +++++++++++---------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/extensions/qqbot/src/config-schema.ts b/extensions/qqbot/src/config-schema.ts index 56610e576ec..6929f98c733 100644 --- a/extensions/qqbot/src/config-schema.ts +++ b/extensions/qqbot/src/config-schema.ts @@ -15,31 +15,24 @@ const AudioFormatPolicySchema = z const QQBotSpeechQueryParamsSchema = z.record(z.string(), z.string()).optional(); -const QQBotTtsSchema = z - .object({ - enabled: z.boolean().optional(), - provider: z.string().optional(), - baseUrl: z.string().optional(), - apiKey: z.string().optional(), - model: z.string().optional(), - voice: z.string().optional(), - authStyle: z.enum(["bearer", "api-key"]).optional(), - queryParams: QQBotSpeechQueryParamsSchema, - speed: z.number().optional(), - }) +const QQBotSpeechProviderSchema = z.object({ + enabled: z.boolean().optional(), + provider: z.string().optional(), + baseUrl: z.string().optional(), + apiKey: z.string().optional(), + model: z.string().optional(), +}); + +const QQBotTtsSchema = QQBotSpeechProviderSchema.extend({ + voice: z.string().optional(), + authStyle: z.enum(["bearer", "api-key"]).optional(), + queryParams: QQBotSpeechQueryParamsSchema, + speed: z.number().optional(), +}) .strict() .optional(); -const QQBotSttSchema = z - .object({ - enabled: z.boolean().optional(), - provider: z.string().optional(), - baseUrl: z.string().optional(), - apiKey: z.string().optional(), - model: z.string().optional(), - }) - .strict() - .optional(); +const QQBotSttSchema = QQBotSpeechProviderSchema.strict().optional(); const QQBotStreamingSchema = z .union([