fix(voice): restore failed transcription recovery

This commit is contained in:
zhangheng
2026-07-22 15:35:48 +08:00
parent c54f4214df
commit 146e78e335
15 changed files with 603 additions and 64 deletions

View File

@@ -0,0 +1,18 @@
export async function runWithSessionRefresh<T>(
action: () => Promise<T>,
refreshSession: () => Promise<void>
): Promise<T> {
let result: T
try {
result = await action()
} catch (error) {
try {
await refreshSession()
} catch {
// Preserve the actionable API error and its request ID.
}
throw error
}
await refreshSession()
return result
}