feat(webchat): add server-side dictation

This commit is contained in:
clawsweeper
2026-05-02 22:57:08 +00:00
parent 9e12718c91
commit 850571380a
2 changed files with 5 additions and 7 deletions

View File

@@ -136,13 +136,10 @@ describe("OpenClawApp dictation recorder lifecycle", () => {
await app.toggleChatDictation();
const recorder = MockMediaRecorder.instances[0];
recorder.emitData(new Blob(["audio"], { type: "audio/webm" }));
transcribeChatAudioMock.mockImplementationOnce(async () => {
expect(app.chatDictationChunks).toEqual([]);
return null;
});
const transcription = createDeferred<null>();
transcribeChatAudioMock.mockReturnValueOnce(transcription.promise);
await app.toggleChatDictation();
await Promise.resolve();
expect(app.chatDictationChunks).toEqual([]);
expect(transcribeChatAudioMock).toHaveBeenCalledTimes(1);
@@ -150,6 +147,8 @@ describe("OpenClawApp dictation recorder lifecycle", () => {
size: 5,
type: "audio/webm",
});
transcription.resolve(null);
await transcription.promise;
});
it("ignores duplicate starts while microphone permission is pending", async () => {

View File

@@ -1015,8 +1015,7 @@ export class OpenClawApp extends LitElement {
if (this.chatDictationRecorder !== recorder) {
return;
}
const chunks = [...this.chatDictationChunks];
this.chatDictationChunks = [];
const chunks = this.chatDictationChunks.splice(0);
const canceledByRequest = this.chatDictationCancelNextStop;
this.chatDictationCancelNextStop = false;
this.chatDictationRecorder = null;