mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 09:20:43 +00:00
feat(webchat): add server-side dictation
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user