mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 04:50:23 +00:00
refactor: add canonical talk config payload
This commit is contained in:
@@ -27,6 +27,14 @@ const TalkProviderConfigSchema = Type.Object(
|
||||
{ additionalProperties: true },
|
||||
);
|
||||
|
||||
const ResolvedTalkConfigSchema = Type.Object(
|
||||
{
|
||||
provider: Type.String(),
|
||||
config: TalkProviderConfigSchema,
|
||||
},
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
export const TalkConfigResultSchema = Type.Object(
|
||||
{
|
||||
config: Type.Object(
|
||||
@@ -36,6 +44,7 @@ export const TalkConfigResultSchema = Type.Object(
|
||||
{
|
||||
provider: Type.Optional(Type.String()),
|
||||
providers: Type.Optional(Type.Record(Type.String(), TalkProviderConfigSchema)),
|
||||
resolved: Type.Optional(ResolvedTalkConfigSchema),
|
||||
voiceId: Type.Optional(Type.String()),
|
||||
voiceAliases: Type.Optional(Type.Record(Type.String(), Type.String())),
|
||||
modelId: Type.Optional(Type.String()),
|
||||
|
||||
@@ -91,6 +91,10 @@ describe("gateway talk.config", () => {
|
||||
providers?: {
|
||||
elevenlabs?: { voiceId?: string; apiKey?: string };
|
||||
};
|
||||
resolved?: {
|
||||
provider?: string;
|
||||
config?: { voiceId?: string; apiKey?: string };
|
||||
};
|
||||
apiKey?: string;
|
||||
voiceId?: string;
|
||||
silenceTimeoutMs?: number;
|
||||
@@ -103,6 +107,9 @@ describe("gateway talk.config", () => {
|
||||
expect(res.payload?.config?.talk?.providers?.elevenlabs?.apiKey).toBe(
|
||||
"__OPENCLAW_REDACTED__",
|
||||
);
|
||||
expect(res.payload?.config?.talk?.resolved?.provider).toBe("elevenlabs");
|
||||
expect(res.payload?.config?.talk?.resolved?.config?.voiceId).toBe("voice-123");
|
||||
expect(res.payload?.config?.talk?.resolved?.config?.apiKey).toBe("__OPENCLAW_REDACTED__");
|
||||
expect(res.payload?.config?.talk?.voiceId).toBe("voice-123");
|
||||
expect(res.payload?.config?.talk?.apiKey).toBe("__OPENCLAW_REDACTED__");
|
||||
expect(res.payload?.config?.talk?.silenceTimeoutMs).toBe(1500);
|
||||
@@ -156,6 +163,10 @@ describe("gateway talk.config", () => {
|
||||
providers?: {
|
||||
elevenlabs?: { voiceId?: string };
|
||||
};
|
||||
resolved?: {
|
||||
provider?: string;
|
||||
config?: { voiceId?: string };
|
||||
};
|
||||
voiceId?: string;
|
||||
};
|
||||
};
|
||||
@@ -163,6 +174,8 @@ describe("gateway talk.config", () => {
|
||||
expect(res.ok).toBe(true);
|
||||
expect(res.payload?.config?.talk?.provider).toBe("elevenlabs");
|
||||
expect(res.payload?.config?.talk?.providers?.elevenlabs?.voiceId).toBe("voice-normalized");
|
||||
expect(res.payload?.config?.talk?.resolved?.provider).toBe("elevenlabs");
|
||||
expect(res.payload?.config?.talk?.resolved?.config?.voiceId).toBe("voice-normalized");
|
||||
expect(res.payload?.config?.talk?.voiceId).toBe("voice-normalized");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user