mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 13:21:43 +00:00
feat: talk mode key distribution and tts polling
This commit is contained in:
@@ -174,3 +174,50 @@ describe("config identity defaults", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("talk api key fallback", () => {
|
||||
let previousEnv: string | undefined;
|
||||
|
||||
beforeEach(() => {
|
||||
previousEnv = process.env.ELEVENLABS_API_KEY;
|
||||
delete process.env.ELEVENLABS_API_KEY;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
process.env.ELEVENLABS_API_KEY = previousEnv;
|
||||
});
|
||||
|
||||
it("injects talk.apiKey from profile when config is missing", async () => {
|
||||
await withTempHome(async (home) => {
|
||||
await fs.writeFile(
|
||||
path.join(home, ".profile"),
|
||||
"export ELEVENLABS_API_KEY=profile-key\n",
|
||||
"utf-8",
|
||||
);
|
||||
|
||||
vi.resetModules();
|
||||
const { readConfigFileSnapshot } = await import("./config.js");
|
||||
const snap = await readConfigFileSnapshot();
|
||||
|
||||
expect(snap.config?.talk?.apiKey).toBe("profile-key");
|
||||
expect(snap.exists).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
it("prefers ELEVENLABS_API_KEY env over profile", async () => {
|
||||
await withTempHome(async (home) => {
|
||||
await fs.writeFile(
|
||||
path.join(home, ".profile"),
|
||||
"export ELEVENLABS_API_KEY=profile-key\n",
|
||||
"utf-8",
|
||||
);
|
||||
process.env.ELEVENLABS_API_KEY = "env-key";
|
||||
|
||||
vi.resetModules();
|
||||
const { readConfigFileSnapshot } = await import("./config.js");
|
||||
const snap = await readConfigFileSnapshot();
|
||||
|
||||
expect(snap.config?.talk?.apiKey).toBe("env-key");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user