ultron-ai-sdk 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -43907,6 +43907,7 @@ class SceneCanvas{
43907
43907
  console.log("clicked");
43908
43908
  let message = this.welcomeMessage || "Hi I am your AI Agent please tell me how can I help you?";
43909
43909
  if(!this.character) return
43910
+ this.initialClickElement.style.display = 'none';
43910
43911
  await this.character.say(message);
43911
43912
  this.container.removeEventListener("mouseup", this.onClickElement);
43912
43913
  }
@@ -43964,6 +43965,23 @@ class SceneCanvas{
43964
43965
 
43965
43966
  console.log('adding mic button');
43966
43967
  // Create button element
43968
+ this.initialClickElement = document.createElement('div');
43969
+ this.initialClickElement.style.display = 'flex';
43970
+ this.initialClickElement.style.alignItems = 'center';
43971
+ this.initialClickElement.style.justifyContent = 'center';
43972
+ this.initialClickElement.style.fontFamily = '"Inter", sans-serif';
43973
+ this.initialClickElement.style.position = 'absolute';
43974
+ this.initialClickElement.style.top = '100px';
43975
+ this.initialClickElement.style.marginLeft = '50%';
43976
+ this.initialClickElement.style.backgroundColor = "#00000060";
43977
+ this.initialClickElement.style.padding = "10px";
43978
+ this.initialClickElement.style.color = '#fff';
43979
+ this.initialClickElement.style.cursor = 'pointer';
43980
+ this.initialClickElement.style.borderRadius = '8px';
43981
+ this.initialClickElement.style.transform = 'translate(-50%, 0%)';
43982
+ this.initialClickElement.innerHTML = "Click me to start talking";
43983
+
43984
+
43967
43985
  this.voiceElementBlock = document.createElement('div');
43968
43986
 
43969
43987
  this.voiceElementBlock.style.position = 'absolute';
@@ -44028,10 +44046,12 @@ class SceneCanvas{
44028
44046
 
44029
44047
  // Append to target div
44030
44048
  micButton.appendChild(micIcon);
44049
+
44031
44050
  this.voiceElementBlock.append(this.micButton);
44032
44051
  this.voiceElementBlock.append(this.voiceUIText);
44033
44052
 
44034
44053
  this.container.appendChild(this.voiceElementBlock);
44054
+ this.container.append(this.initialClickElement);
44035
44055
  }
44036
44056
  }
44037
44057
 
@@ -44268,16 +44288,22 @@ class Character {
44268
44288
  }
44269
44289
  if(this.currentAudio){
44270
44290
  // this.idleAction.fadeOut(0.5).stop()
44271
- this.playAnimation('talking');
44272
- this.currentAudio.play();
44273
- if(action){
44274
- action.play();
44275
- let timeout = setTimeout(()=>{
44276
- this.idleAction.crossFadeFrom(this.talkingAction, 0.5).play();
44277
- clearTimeout(timeout);
44278
- this.onSpeakComplete();
44279
- }, (duration - 0.5)*1000);
44291
+ try{
44292
+ this.playAnimation('talking');
44293
+ this.currentAudio.play();
44294
+ if(action){
44295
+ action.play();
44296
+ clearTimeout(this.idleTimeout);
44297
+ this.idleTimeout = setTimeout(()=>{
44298
+ this.idleAction.crossFadeFrom(this.talkingAction, 0.5).play();
44299
+ clearTimeout(this.idleTimeout);
44300
+ this.onSpeakComplete();
44301
+ }, (duration - 0.5)*1000);
44302
+ }
44303
+ }catch(e){
44304
+ console.error(e);
44280
44305
  }
44306
+
44281
44307
  }
44282
44308
  if(this.sceneCanvasRef?.voiceUIText){
44283
44309
  this.sceneCanvasRef.voiceUIText.innerHTML = "Speaking...";
package/dist/index.mjs CHANGED
@@ -43905,6 +43905,7 @@ class SceneCanvas{
43905
43905
  console.log("clicked");
43906
43906
  let message = this.welcomeMessage || "Hi I am your AI Agent please tell me how can I help you?";
43907
43907
  if(!this.character) return
43908
+ this.initialClickElement.style.display = 'none';
43908
43909
  await this.character.say(message);
43909
43910
  this.container.removeEventListener("mouseup", this.onClickElement);
43910
43911
  }
@@ -43962,6 +43963,23 @@ class SceneCanvas{
43962
43963
 
43963
43964
  console.log('adding mic button');
43964
43965
  // Create button element
43966
+ this.initialClickElement = document.createElement('div');
43967
+ this.initialClickElement.style.display = 'flex';
43968
+ this.initialClickElement.style.alignItems = 'center';
43969
+ this.initialClickElement.style.justifyContent = 'center';
43970
+ this.initialClickElement.style.fontFamily = '"Inter", sans-serif';
43971
+ this.initialClickElement.style.position = 'absolute';
43972
+ this.initialClickElement.style.top = '100px';
43973
+ this.initialClickElement.style.marginLeft = '50%';
43974
+ this.initialClickElement.style.backgroundColor = "#00000060";
43975
+ this.initialClickElement.style.padding = "10px";
43976
+ this.initialClickElement.style.color = '#fff';
43977
+ this.initialClickElement.style.cursor = 'pointer';
43978
+ this.initialClickElement.style.borderRadius = '8px';
43979
+ this.initialClickElement.style.transform = 'translate(-50%, 0%)';
43980
+ this.initialClickElement.innerHTML = "Click me to start talking";
43981
+
43982
+
43965
43983
  this.voiceElementBlock = document.createElement('div');
43966
43984
 
43967
43985
  this.voiceElementBlock.style.position = 'absolute';
@@ -44026,10 +44044,12 @@ class SceneCanvas{
44026
44044
 
44027
44045
  // Append to target div
44028
44046
  micButton.appendChild(micIcon);
44047
+
44029
44048
  this.voiceElementBlock.append(this.micButton);
44030
44049
  this.voiceElementBlock.append(this.voiceUIText);
44031
44050
 
44032
44051
  this.container.appendChild(this.voiceElementBlock);
44052
+ this.container.append(this.initialClickElement);
44033
44053
  }
44034
44054
  }
44035
44055
 
@@ -44266,16 +44286,22 @@ class Character {
44266
44286
  }
44267
44287
  if(this.currentAudio){
44268
44288
  // this.idleAction.fadeOut(0.5).stop()
44269
- this.playAnimation('talking');
44270
- this.currentAudio.play();
44271
- if(action){
44272
- action.play();
44273
- let timeout = setTimeout(()=>{
44274
- this.idleAction.crossFadeFrom(this.talkingAction, 0.5).play();
44275
- clearTimeout(timeout);
44276
- this.onSpeakComplete();
44277
- }, (duration - 0.5)*1000);
44289
+ try{
44290
+ this.playAnimation('talking');
44291
+ this.currentAudio.play();
44292
+ if(action){
44293
+ action.play();
44294
+ clearTimeout(this.idleTimeout);
44295
+ this.idleTimeout = setTimeout(()=>{
44296
+ this.idleAction.crossFadeFrom(this.talkingAction, 0.5).play();
44297
+ clearTimeout(this.idleTimeout);
44298
+ this.onSpeakComplete();
44299
+ }, (duration - 0.5)*1000);
44300
+ }
44301
+ }catch(e){
44302
+ console.error(e);
44278
44303
  }
44304
+
44279
44305
  }
44280
44306
  if(this.sceneCanvasRef?.voiceUIText){
44281
44307
  this.sceneCanvasRef.voiceUIText.innerHTML = "Speaking...";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultron-ai-sdk",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "This package is for integrating Ultron AI Characters as website Companions on a website",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",