Skip to content

Commit

Permalink
feat: expose daily avoidEval config via web.
Browse files Browse the repository at this point in the history
Merge pull request #52 from VapiAI/fix/allow-daily-config
  • Loading branch information
kaustubhkagrawal committed Jul 10, 2024
2 parents f2fafe9 + 2dcea88 commit a260acb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion vapi.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Call, CreateAssistantDTO, CreateSquadDTO, AssistantOverrides } from './api';
import DailyIframe, {
DailyAdvancedConfig,
DailyCall,
DailyEventObjectAppMessage,
DailyEventObjectParticipant,
Expand Down Expand Up @@ -108,11 +109,13 @@ export default class Vapi extends VapiEventEmitter {
private started: boolean = false;
private call: DailyCall | null = null;
private speakingTimeout: NodeJS.Timeout | null = null;
private dailyCallConfig: DailyAdvancedConfig = {}

constructor(apiToken: string, apiBaseUrl?: string) {
constructor(apiToken: string, apiBaseUrl?: string, dailyCallConfig?: Pick<DailyAdvancedConfig, 'avoidEval'>) {
super();
client.baseUrl = apiBaseUrl ?? 'https://api.vapi.ai';
client.setSecurityData(apiToken);
this.dailyCallConfig = dailyCallConfig ?? {}
}

private cleanup() {
Expand Down Expand Up @@ -155,6 +158,7 @@ export default class Vapi extends VapiEventEmitter {
this.call = DailyIframe.createCallObject({
audioSource: true,
videoSource: isVideoRecordingEnabled,
dailyConfig: this.dailyCallConfig
});
this.call.iframe()?.style.setProperty('display', 'none');

Expand Down

0 comments on commit a260acb

Please sign in to comment.