Fix timeout error handling local voice (#23023)

fix timeout error handling local voice
This commit is contained in:
Bram Kragten 2024-11-27 14:36:30 +01:00 committed by GitHub
parent 0a954cf1c7
commit 71214351ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -169,7 +169,7 @@ export class HaVoiceAssistantSetupStepLocal extends LitElement {
await this._setupConfigEntry("whisper"); await this._setupConfigEntry("whisper");
} }
this._detailState = "Creating assistant"; this._detailState = "Creating assistant";
this._findEntitiesAndCreatePipeline(); await this._findEntitiesAndCreatePipeline();
} catch (e) { } catch (e) {
this._state = "ERROR"; this._state = "ERROR";
} }
@ -314,8 +314,10 @@ export class HaVoiceAssistantSetupStepLocal extends LitElement {
if (tryNo > 3) { if (tryNo > 3) {
throw new Error("Timeout searching for local TTS and STT entities"); throw new Error("Timeout searching for local TTS and STT entities");
} }
setTimeout(() => this._findEntitiesAndCreatePipeline(tryNo + 1), 2000); await new Promise<void>((resolve) => {
return; setTimeout(resolve, 2000);
});
return this._findEntitiesAndCreatePipeline(tryNo + 1);
} }
const localPipeline = await this._createPipeline( const localPipeline = await this._createPipeline(
@ -330,6 +332,7 @@ export class HaVoiceAssistantSetupStepLocal extends LitElement {
{ entity_id: this.assistConfiguration?.pipeline_entity_id } { entity_id: this.assistConfiguration?.pipeline_entity_id }
); );
this._nextStep(); this._nextStep();
return undefined;
} }
static styles = [ static styles = [