Skip to content

Commit 81e1fba

Browse files
Merge dev to main - UI improvements & code cleanup (#104)
* Fix TypeScript error in git-errors.ts * Remove code review documentation * Improve stt response time * Fix repo navigation when download dialog closes
1 parent 059b9a1 commit 81e1fba

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

frontend/src/components/repo/RepoCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export function RepoCard({
5555
const unstagedCount = gitStatus?.files.filter((f) => !f.staged).length || 0;
5656

5757
const handleCardClick = () => {
58-
if (isReady && !showSourceControl) {
58+
if (isReady && !showSourceControl && !showDownloadDialog) {
5959
navigate(`/repos/${repo.id}`);
6060
}
6161
};

frontend/src/hooks/useSTT.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ export function useSTT(userId = 'default') {
166166
audioRecorder.current = new AudioRecorder()
167167
}
168168

169+
audioRecorder.current.warmup()
170+
169171
setupAudioRecorder(audioRecorder.current)
170172

171173
return () => {

frontend/src/lib/audioRecorder.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,26 @@ export class AudioRecorder {
5353
)
5454
}
5555

56+
async warmup(): Promise<boolean> {
57+
if (!AudioRecorder.isSupported()) {
58+
return false
59+
}
60+
61+
try {
62+
const stream = await navigator.mediaDevices.getUserMedia({
63+
audio: {
64+
echoCancellation: true,
65+
noiseSuppression: true,
66+
autoGainControl: true,
67+
},
68+
})
69+
stream.getTracks().forEach(track => track.stop())
70+
return true
71+
} catch {
72+
return false
73+
}
74+
}
75+
5676
getState(): AudioRecorderState {
5777
return this.state
5878
}
@@ -186,3 +206,8 @@ export function getAudioRecorder(): AudioRecorder {
186206
export function isAudioRecordingSupported(): boolean {
187207
return AudioRecorder.isSupported()
188208
}
209+
210+
export async function warmupAudioRecorder(): Promise<boolean> {
211+
const recorder = getAudioRecorder()
212+
return recorder.warmup()
213+
}

0 commit comments

Comments
 (0)