



























@@ -191,10 +191,9 @@ describe("generateVoiceResponse", () => {
191191modelOverride: "gpt-4.1-nano",
192192modelOverrideSource: "auto",
193193});
194-expect(updateSessionStore).toHaveBeenCalledWith(
195-"/tmp/openclaw/main/sessions.json",
196-expect.any(Function),
197-);
194+const updateSessionStoreCall = updateSessionStore.mock.calls[0];
195+expect(updateSessionStoreCall?.[0]).toBe("/tmp/openclaw/main/sessions.json");
196+expect(updateSessionStoreCall?.[1]).toBeTypeOf("function");
198197expect(runEmbeddedPiAgent).toHaveBeenCalledWith(
199198expect.objectContaining({
200199provider: "openai",
@@ -246,6 +245,7 @@ describe("generateVoiceResponse", () => {
246245 resolveAgentIdentity,
247246 resolveStorePath,
248247 resolveSessionFilePath,
248+ sessionStore,
249249} = createAgentRuntime([{ text: '{"spoken":"Default agent."}' }]);
250250const coreConfig = {} as CoreConfig;
251251@@ -263,9 +263,15 @@ describe("generateVoiceResponse", () => {
263263expect(resolveAgentDir).toHaveBeenCalledWith(coreConfig, "main");
264264expect(resolveAgentWorkspaceDir).toHaveBeenCalledWith(coreConfig, "main");
265265expect(resolveAgentIdentity).toHaveBeenCalledWith(coreConfig, "main");
266-expect(resolveSessionFilePath).toHaveBeenCalledWith(expect.any(String), expect.any(Object), {
267-agentId: "main",
268-});
266+const defaultSessionEntry = sessionStore["voice:15550001111"];
267+expect(defaultSessionEntry).toBeDefined();
268+expect(resolveSessionFilePath).toHaveBeenCalledWith(
269+defaultSessionEntry?.sessionId,
270+defaultSessionEntry,
271+{
272+agentId: "main",
273+},
274+);
269275expect(runEmbeddedPiAgent).toHaveBeenCalledWith(
270276expect.objectContaining({
271277agentDir: "/tmp/openclaw/agents/main",
@@ -286,6 +292,7 @@ describe("generateVoiceResponse", () => {
286292 resolveAgentIdentity,
287293 resolveStorePath,
288294 resolveSessionFilePath,
295+ sessionStore,
289296} = createAgentRuntime([{ text: '{"spoken":"Voice agent."}' }]);
290297const coreConfig = {} as CoreConfig;
291298@@ -307,9 +314,15 @@ describe("generateVoiceResponse", () => {
307314expect(resolveAgentDir).toHaveBeenCalledWith(coreConfig, "voice");
308315expect(resolveAgentWorkspaceDir).toHaveBeenCalledWith(coreConfig, "voice");
309316expect(resolveAgentIdentity).toHaveBeenCalledWith(coreConfig, "voice");
310-expect(resolveSessionFilePath).toHaveBeenCalledWith(expect.any(String), expect.any(Object), {
311-agentId: "voice",
312-});
317+const voiceSessionEntry = sessionStore["voice:15550001111"];
318+expect(voiceSessionEntry).toBeDefined();
319+expect(resolveSessionFilePath).toHaveBeenCalledWith(
320+voiceSessionEntry?.sessionId,
321+voiceSessionEntry,
322+{
323+agentId: "voice",
324+},
325+);
313326expect(runEmbeddedPiAgent).toHaveBeenCalledWith(
314327expect.objectContaining({
315328agentDir: "/tmp/openclaw/agents/voice",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。