+6
-3
@@ -138,13 +138,16 @@ export class JarvisDaemon extends EventEmitter {
|
||||
this._activeAsk = job;
|
||||
const reply = await job;
|
||||
if (generation !== this._askGeneration || this.locked) return '';
|
||||
this.telemetry.record('llm', startedAt, { success: true });
|
||||
const spoken = spokenReply(reply);
|
||||
if (!spoken) { this._finishSpeech(); return ''; }
|
||||
if (!spoken) throw new Error('The model returned no spoken answer. Please try again.');
|
||||
this.telemetry.record('llm', startedAt, { success: true });
|
||||
this._beginSpeech(); this.lastReply = spoken; this.emit('Reply', spoken); this._speakReply(spoken); return spoken;
|
||||
} catch (error) {
|
||||
if (generation !== this._askGeneration) return '';
|
||||
this.telemetry.record('llm', Date.now(), { success: false }); this.emit('Error', 'QVAC', error.message); this.voice.cancel(); this.setState('ARMED'); throw error;
|
||||
this.telemetry.record('llm', Date.now(), { success: false });
|
||||
this.emit('Error', 'QVAC', error.message);
|
||||
this._finishSpeech();
|
||||
throw error;
|
||||
} finally {
|
||||
if (generation === this._askGeneration) this._activeAsk = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user