Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/ai/AI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ export class AI extends Script {
}

async init({aiOptions}: {aiOptions: AIOptions}) {
this.lock = false;
this.options = aiOptions;

if (!aiOptions.enabled) {
Expand Down Expand Up @@ -172,7 +171,7 @@ export class AI extends Script {
}

isAvailable() {
return this.model && this.model.isAvailable() && !this.lock;
return this.model && this.model.isAvailable();
}

async query(
Expand All @@ -197,12 +196,10 @@ export class AI extends Script {
if (!('isLiveAvailable' in this.model) || !this.model.isLiveAvailable()) {
throw new Error('Live session is not available for the current model.');
}
this.lock = true;
try {
const session = await this.model.startLiveSession(config, model);
return session;
} catch (error) {
this.lock = false;
console.error('❌ Failed to start Live session:', error);
throw error;
}
Expand All @@ -214,8 +211,6 @@ export class AI extends Script {
await ('stopLiveSession' in this.model && this.model.stopLiveSession());
} catch (error) {
console.error('❌ Error stopping Live session:', error);
} finally {
this.lock = false;
}
}

Expand Down