Skip to content

Commit

Permalink
add support for executing custom backend func
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmoudz committed Apr 7, 2024
1 parent fd0d800 commit a2e40df
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/core/AiAssistantEngine.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AiAssistantEngine extends EventEmitter {

Logger.setDebug(debug);
this.sdkVersion = pkg.version;
Logger.log(`--[SISTA]-- Initializing AiAssistantEngine Version: ${this.sdkVersion} + LOCAL 4`);
Logger.log(`--[SISTA]-- Initializing AiAssistantEngine Version: ${this.sdkVersion}`);

this.audioPlayer = new AudioPlayer();
this.audioRecorder = new AudioRecorder();
Expand Down Expand Up @@ -142,16 +142,18 @@ class AiAssistantEngine extends EventEmitter {
return;
}

// Handle executable functions if they exist
if (message.functions) {
this._handleExecutableFunctionsResponse(message);
}

// Handle audio response if it exists, otherwise handle text response
// Play audio response if it exists, otherwise handle the rest
if (response.audioFile) {
this._handleAudioResponse(response.audioFile);
} else if (message.content !== null) {
this._handleTextResponse(message.content);
} else {
// Handle executable functions if they exist
if (message.functions) {
this._handleExecutableFunctionsResponse(message);
}

if (message.content !== null) {
this._handleTextResponse(message.content);
}
}
};

Expand Down

0 comments on commit a2e40df

Please sign in to comment.