Skip to content

Commit 86b2426

Browse files
committed
hnadling for error during transcription
1 parent 6393f18 commit 86b2426

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

codex-cli/src/components/chat/terminal-chat-input.tsx

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,39 @@ export default function TerminalChatInput({
176176
},
177177
);
178178

179+
transcriber.current.on("error", (error) => {
180+
setIsRecording(false);
181+
setShouldResumeRecording(false);
182+
setItems((prev) => [
183+
...prev,
184+
{
185+
id: `speak-transcription-error-${Date.now()}`,
186+
type: "message",
187+
role: "system",
188+
content: [
189+
{
190+
type: "input_text",
191+
text: `Transcription ${error}`,
192+
},
193+
],
194+
},
195+
]);
196+
197+
// Clean up the transcriber
198+
if (transcriber.current) {
199+
transcriber.current.cleanup();
200+
transcriber.current = null;
201+
}
202+
});
203+
179204
await transcriber.current.start();
180205
} catch (error) {
181206
setIsRecording(false);
182207
setShouldResumeRecording(false);
183208
setItems((prev) => [
184209
...prev,
185210
{
186-
id: `speak-error-${Date.now()}`,
211+
id: `speak-start-error-${Date.now()}`,
187212
type: "message",
188213
role: "system",
189214
content: [

0 commit comments

Comments
 (0)