assistant-robot 0.0.2-beta → 0.0.2-gamma

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.mjs CHANGED
@@ -2,7 +2,7 @@ var hA = Object.defineProperty;
2
2
  var ZA = (n, P, A) => P in n ? hA(n, P, { enumerable: !0, configurable: !0, writable: !0, value: A }) : n[P] = A;
3
3
  var j = (n, P, A) => (ZA(n, typeof P != "symbol" ? P + "" : P, A), A);
4
4
  import { TrianglesDrawMode as yA, TriangleFanDrawMode as $, TriangleStripDrawMode as lA, Loader as RA, LoaderUtils as AA, FileLoader as zA, Color as f, LinearSRGBColorSpace as O, SpotLight as FA, PointLight as NA, DirectionalLight as aA, MeshBasicMaterial as V, SRGBColorSpace as W, MeshPhysicalMaterial as U, Vector2 as LA, Matrix4 as S, Vector3 as Z, Quaternion as TA, InstancedMesh as VA, InstancedBufferAttribute as WA, Object3D as uA, TextureLoader as kA, ImageBitmapLoader as SA, BufferAttribute as p, InterleavedBuffer as xA, InterleavedBufferAttribute as pA, LinearFilter as mA, LinearMipmapLinearFilter as bA, RepeatWrapping as PA, PointsMaterial as HA, Material as H, LineBasicMaterial as XA, MeshStandardMaterial as dA, DoubleSide as KA, PropertyBinding as qA, BufferGeometry as _A, SkinnedMesh as $A, Mesh as AP, LineSegments as PP, Line as wP, LineLoop as sP, Points as DP, Group as X, PerspectiveCamera as GA, MathUtils as iP, OrthographicCamera as eP, Skeleton as gP, AnimationClip as wA, Bone as IP, InterpolateLinear as fA, ColorManagement as iA, NearestFilter as BP, NearestMipmapNearestFilter as CP, LinearMipmapNearestFilter as nP, NearestMipmapLinearFilter as QP, ClampToEdgeWrapping as oP, MirroredRepeatWrapping as tP, InterpolateDiscrete as rP, FrontSide as vP, Texture as eA, VectorKeyframeTrack as gA, NumberKeyframeTrack as IA, QuaternionKeyframeTrack as BA, Box3 as cP, Sphere as jP, Interpolant as EP, Clock as MP, Scene as lP, AmbientLight as zP, WebGL1Renderer as aP, AnimationMixer as LP, LoopRepeat as CA, LoopOnce as TP } from "three";
5
- import { A as uP, M as u, a as Y, O as mP, R as bP, E as OA, b as h, i as nA, V as k, T as dP, c as QA, d as oA, e as GP, p as UA, f as fP, g as OP, h as UP, j as JP, C as YP, k as hP, l as ZP, U as yP, m as F, n as RP, t as tA, o as FP } from "./utils-RQ7tdPHo.mjs";
5
+ import { A as uP, M as u, a as Y, O as mP, R as bP, E as OA, b as h, i as nA, V as k, T as dP, c as QA, d as oA, e as GP, p as UA, f as fP, g as OP, h as UP, j as JP, C as YP, k as hP, l as ZP, U as yP, m as F, n as RP, t as tA, o as FP } from "./utils-W4yhvT2-.mjs";
6
6
  import * as NP from "@mediapipe/face_detection";
7
7
  import * as rA from "@tensorflow-models/face-detection";
8
8
  function vA(n, P) {
@@ -1825,7 +1825,7 @@ class Lw {
1825
1825
  }
1826
1826
  initChatBox(P, A = {}) {
1827
1827
  let s;
1828
- A.chatBoxClassName ? s = QA + " " + A.chatBoxClassName + oA : s = QA + oA, A.operationList && (s = s + A.operationList.map(
1828
+ A.perationBoxClassName ? s = QA + " " + A.perationBoxClassName + oA : s = QA + oA, A.operationList && (s = s + A.operationList.map(
1829
1829
  (D) => `<li data-id="${D.key}" data-disable="${D.disable}">${D.text}</li>`
1830
1830
  ).join("")), s = s + GP;
1831
1831
  const w = UA(s);
package/dist/type.d.ts CHANGED
@@ -15,7 +15,7 @@ export interface IOperation {
15
15
  }
16
16
  export interface IOperationBoxBoxConfig {
17
17
  hide?: boolean;
18
- chatBoxClassName?: string;
18
+ perationBoxClassName?: string;
19
19
  operationList?: IOperation[];
20
20
  }
21
21
  export interface IModelConfig {
@@ -1,4 +1,4 @@
1
- "use strict";var E=Object.defineProperty;var x=(e,t,o)=>t in e?E(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var d=(e,t,o)=>(x(e,typeof t!="symbol"?t+"":t,o),o);const b={position:[0,0,0],rotation:[0,Math.PI,0],helloActionName:"hello",idleActionName:"idle",helloContent:"Hi, you can talk to me!"},I={backgroundColor:0,backgroundAlpha:0,camera:{fov:50,near:.1,far:10,position:[0,0,2],lookAt:[0,0,0]},ambientLight:{color:16777215,intensity:.5},directionalLight:{color:16777215,intensity:2,position:[10,10,0]}},N={big:{width:640,height:480},small:{width:360,height:270}},s="assistant-robot-model-container",n="assistant_tip_container",f='<div class="assistant-robot-container ',C=`">
1
+ "use strict";var E=Object.defineProperty;var b=(e,t,o)=>t in e?E(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var d=(e,t,o)=>(b(e,typeof t!="symbol"?t+"":t,o),o);const x={position:[0,0,0],rotation:[0,Math.PI,0],helloActionName:"hello",idleActionName:"idle",helloContent:"Hi, you can talk to me!"},I={backgroundColor:0,backgroundAlpha:0,camera:{fov:50,near:.1,far:10,position:[0,0,2],lookAt:[0,0,0]},ambientLight:{color:16777215,intensity:.5},directionalLight:{color:16777215,intensity:2,position:[10,10,0]}},N={big:{width:640,height:480},small:{width:360,height:270}},s="assistant-robot-model-container",n="assistant_tip_container",f='<div class="assistant-robot-container ',g=`">
2
2
  <style>
3
3
  .assistant-robot-container{
4
4
  width: 100%;
@@ -47,9 +47,10 @@
47
47
 
48
48
  </div>
49
49
  <div>
50
- `,g={openCamera:"To interactive with the assistant, we'd like to access your device's camera.Take it easy, your pictures and information won't be sent anywhere or be stored.",alreadyOpenCamera:"the camera have be opened"};var c=(e=>(e.openCamera="openCamera",e.hello="hello",e))(c||{});const _="assistant-robot-input",O="assistant-robot-btn",p="operation_container",l="menu_btn",a="menu_list",S='<div class="assistant-robot-chartbox',m=`">
50
+ `,C={openCamera:"To interactive with the assistant, we'd like to access your device's camera.Take it easy, your pictures and information won't be sent anywhere or be stored.",alreadyOpenCamera:"the camera have be opened"};var p=(e=>(e.openCamera="openCamera",e.hello="hello",e))(p||{});const _="assistant-robot-input",O="assistant-robot-btn",c="operation_container",l="menu_btn",a="menu_list",S='<div class="assistant-robot-chartbox',m=`">
51
51
  <style>
52
52
  .assistant-robot-chartbox{
53
+ box-sizing: content-box;
53
54
  width: 100%;
54
55
  height: 32px;
55
56
  display: flex;
@@ -60,6 +61,7 @@
60
61
  box-shadow: 0 1px 2px -2px rgba(0, 0, 0, 0.16),
61
62
  0 3px 6px 0 rgba(0, 0, 0, 0.12),
62
63
  0 5px 12px 4px rgba(0, 0, 0, 0.09);
64
+ background-color: #fff;
63
65
  padding: 10px 12px;
64
66
  }
65
67
  .assistant-robot-input{
@@ -77,7 +79,7 @@
77
79
  height: 24px;
78
80
  }
79
81
 
80
- .${p}{
82
+ .${c}{
81
83
  position: relative;
82
84
  height: 24px;
83
85
  }
@@ -118,7 +120,7 @@
118
120
  100% { opacity: 1; }
119
121
  }
120
122
  </style>
121
- <span class="${p}">
123
+ <span class="${c}">
122
124
  <svg
123
125
  t="1702017878997"
124
126
  class="${l}"
@@ -150,4 +152,4 @@
150
152
  </span>
151
153
  <input class="${_}" type="text" />
152
154
  <button class="${O}">ask</button>
153
- </div>`;var T=(e=>(e[e.loading=1]="loading",e[e.ready=2]="ready",e[e.error=3]="error",e))(T||{});const y=50,L=2e3;var h=(e=>(e.init="init",e.ready="ready",e.openCameraRejected="openCameraRejected",e.userMediaUnavailable="userMediaUnavailable",e.faceDetectorCreateError="faceDetectorCreateError",e.error="error",e))(h||{});const u="userDetectorStatusChange";var A=(e=>(e.languageModelLoaded="languageModelLoaded",e[e.userDetectorStatusChange=u]="userDetectorStatusChange",e.menuClick="menuClick",e.ask="ask",e.say="say",e))(A||{});function v(){return/iPhone|iPad|iPod/i.test(navigator.userAgent)}function B(){return/Android/i.test(navigator.userAgent)}function D(){return B()||v()}function M(e){return new DOMParser().parseFromString(e,"text/html").body.firstElementChild}function P(e){if(!Array.isArray(e)||e.length===0)return null;let t=-1/0,o=null;for(let i=0;i<e.length;i++){const r=e[i];r&&typeof r.score=="number"&&r.score>t&&(t=r.score,o=r)}return o}class w{constructor(){d(this,"listeners",{})}addEventListener(t,o){this.listeners[t]?this.get(t).push(o):this.listeners[t]=[o]}removeEventListener(t,o){this.listeners[t]&&(this.listeners[t]=this.get(t).filter(i=>i!==o))}emit(t,...o){this.get(t).map(i=>{i(...o)})}get(t){return this.listeners[t]||[]}}exports.ASSISTANT_MODEL_CONTAINER_CLASS=s;exports.ASSISTANT_TIP_CONTAINER=n;exports.CONTAINER_BODY=C;exports.CONTAINER_HEAD=f;exports.EAssistantEvent=A;exports.ELanguageModelStatus=T;exports.EMenuKey=c;exports.EUserDetectorStatus=h;exports.EventListener=w;exports.MENU_BTN_CLASS=l;exports.MENU_LIST_CLASS=a;exports.MODEL_CONFIG=b;exports.MODEL_SCENE_CONFIG=I;exports.ONE_LETTER_READ_TIME=y;exports.READ_WAIT_TIME=L;exports.ROBOT_OPERATION_BOX_BODY=m;exports.ROBOT_OPERATION_BOX_HEAD=S;exports.ROBOT_OPERATION_BOX_TAIL=R;exports.ROBOT_OPERATION_BTN_CLASS=O;exports.ROBOT_OPERATION_INPUT_CLASS=_;exports.TARGET_FPS=60;exports.USER_DETECTOR_STATUS_CHANGE_EVENT=u;exports.VIDEO_SIZE=N;exports.findHighestScoreItem=P;exports.isMobile=D;exports.parseHTML=M;exports.tips=g;
155
+ </div>`;var T=(e=>(e[e.loading=1]="loading",e[e.ready=2]="ready",e[e.error=3]="error",e))(T||{});const y=50,L=2e3;var h=(e=>(e.init="init",e.ready="ready",e.openCameraRejected="openCameraRejected",e.userMediaUnavailable="userMediaUnavailable",e.faceDetectorCreateError="faceDetectorCreateError",e.error="error",e))(h||{});const u="userDetectorStatusChange";var A=(e=>(e.languageModelLoaded="languageModelLoaded",e[e.userDetectorStatusChange=u]="userDetectorStatusChange",e.menuClick="menuClick",e.ask="ask",e.say="say",e))(A||{});function v(){return/iPhone|iPad|iPod/i.test(navigator.userAgent)}function B(){return/Android/i.test(navigator.userAgent)}function D(){return B()||v()}function M(e){return new DOMParser().parseFromString(e,"text/html").body.firstElementChild}function P(e){if(!Array.isArray(e)||e.length===0)return null;let t=-1/0,o=null;for(let i=0;i<e.length;i++){const r=e[i];r&&typeof r.score=="number"&&r.score>t&&(t=r.score,o=r)}return o}class w{constructor(){d(this,"listeners",{})}addEventListener(t,o){this.listeners[t]?this.get(t).push(o):this.listeners[t]=[o]}removeEventListener(t,o){this.listeners[t]&&(this.listeners[t]=this.get(t).filter(i=>i!==o))}emit(t,...o){this.get(t).map(i=>{i(...o)})}get(t){return this.listeners[t]||[]}}exports.ASSISTANT_MODEL_CONTAINER_CLASS=s;exports.ASSISTANT_TIP_CONTAINER=n;exports.CONTAINER_BODY=g;exports.CONTAINER_HEAD=f;exports.EAssistantEvent=A;exports.ELanguageModelStatus=T;exports.EMenuKey=p;exports.EUserDetectorStatus=h;exports.EventListener=w;exports.MENU_BTN_CLASS=l;exports.MENU_LIST_CLASS=a;exports.MODEL_CONFIG=x;exports.MODEL_SCENE_CONFIG=I;exports.ONE_LETTER_READ_TIME=y;exports.READ_WAIT_TIME=L;exports.ROBOT_OPERATION_BOX_BODY=m;exports.ROBOT_OPERATION_BOX_HEAD=S;exports.ROBOT_OPERATION_BOX_TAIL=R;exports.ROBOT_OPERATION_BTN_CLASS=O;exports.ROBOT_OPERATION_INPUT_CLASS=_;exports.TARGET_FPS=60;exports.USER_DETECTOR_STATUS_CHANGE_EVENT=u;exports.VIDEO_SIZE=N;exports.findHighestScoreItem=P;exports.isMobile=D;exports.parseHTML=M;exports.tips=C;
@@ -1,6 +1,6 @@
1
1
  var c = Object.defineProperty;
2
- var h = (e, t, a) => t in e ? c(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a;
3
- var n = (e, t, a) => (h(e, typeof t != "symbol" ? t + "" : t, a), a);
2
+ var h = (e, t, o) => t in e ? c(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
3
+ var s = (e, t, o) => (h(e, typeof t != "symbol" ? t + "" : t, o), o);
4
4
  const A = 60, y = {
5
5
  position: [0, 0, 0],
6
6
  rotation: [0, Math.PI, 0],
@@ -29,7 +29,7 @@ const A = 60, y = {
29
29
  }, N = {
30
30
  big: { width: 640, height: 480 },
31
31
  small: { width: 360, height: 270 }
32
- }, l = "assistant-robot-model-container", s = "assistant_tip_container", v = '<div class="assistant-robot-container ', R = `">
32
+ }, l = "assistant-robot-model-container", n = "assistant_tip_container", v = '<div class="assistant-robot-container ', R = `">
33
33
  <style>
34
34
  .assistant-robot-container{
35
35
  width: 100%;
@@ -42,7 +42,7 @@ const A = 60, y = {
42
42
  position:relative;
43
43
  width:100%;
44
44
  }
45
- .${s}{
45
+ .${n}{
46
46
  position: absolute;
47
47
  top: 2px;
48
48
  left: 50%;
@@ -59,7 +59,7 @@ const A = 60, y = {
59
59
  0% { opacity: 0; }
60
60
  100% { opacity: 1; }
61
61
  }
62
- .${s}::after{
62
+ .${n}::after{
63
63
  content: '';
64
64
  display: block;
65
65
  position: absolute;
@@ -74,7 +74,7 @@ const A = 60, y = {
74
74
  }
75
75
  </style>
76
76
  <div class="${l}">
77
- <div class="${s}">HI!</div>
77
+ <div class="${n}">HI!</div>
78
78
 
79
79
  </div>
80
80
  <div>
@@ -83,9 +83,10 @@ const A = 60, y = {
83
83
  alreadyOpenCamera: "the camera have be opened"
84
84
  };
85
85
  var x = /* @__PURE__ */ ((e) => (e.openCamera = "openCamera", e.hello = "hello", e))(x || {});
86
- const u = "assistant-robot-input", b = "assistant-robot-btn", d = "operation_container", p = "menu_btn", i = "menu_list", w = '<div class="assistant-robot-chartbox', E = `">
86
+ const b = "assistant-robot-input", u = "assistant-robot-btn", d = "operation_container", p = "menu_btn", i = "menu_list", w = '<div class="assistant-robot-chartbox', E = `">
87
87
  <style>
88
88
  .assistant-robot-chartbox{
89
+ box-sizing: content-box;
89
90
  width: 100%;
90
91
  height: 32px;
91
92
  display: flex;
@@ -96,6 +97,7 @@ const u = "assistant-robot-input", b = "assistant-robot-btn", d = "operation_con
96
97
  box-shadow: 0 1px 2px -2px rgba(0, 0, 0, 0.16),
97
98
  0 3px 6px 0 rgba(0, 0, 0, 0.12),
98
99
  0 5px 12px 4px rgba(0, 0, 0, 0.09);
100
+ background-color: #fff;
99
101
  padding: 10px 12px;
100
102
  }
101
103
  .assistant-robot-input{
@@ -184,14 +186,14 @@ const u = "assistant-robot-input", b = "assistant-robot-btn", d = "operation_con
184
186
  <li data-id="openCamera">Open the Camera</li>
185
187
  `, k = `</ul>
186
188
  </span>
187
- <input class="${u}" type="text" />
188
- <button class="${b}">ask</button>
189
+ <input class="${b}" type="text" />
190
+ <button class="${u}">ask</button>
189
191
  </div>`;
190
192
  var f = /* @__PURE__ */ ((e) => (e[e.loading = 1] = "loading", e[e.ready = 2] = "ready", e[e.error = 3] = "error", e))(f || {});
191
193
  const $ = 50, L = 2e3;
192
- var m = /* @__PURE__ */ ((e) => (e.init = "init", e.ready = "ready", e.openCameraRejected = "openCameraRejected", e.userMediaUnavailable = "userMediaUnavailable", e.faceDetectorCreateError = "faceDetectorCreateError", e.error = "error", e))(m || {});
193
- const O = "userDetectorStatusChange";
194
- var g = /* @__PURE__ */ ((e) => (e.languageModelLoaded = "languageModelLoaded", e[e.userDetectorStatusChange = O] = "userDetectorStatusChange", e.menuClick = "menuClick", e.ask = "ask", e.say = "say", e))(g || {});
194
+ var g = /* @__PURE__ */ ((e) => (e.init = "init", e.ready = "ready", e.openCameraRejected = "openCameraRejected", e.userMediaUnavailable = "userMediaUnavailable", e.faceDetectorCreateError = "faceDetectorCreateError", e.error = "error", e))(g || {});
195
+ const m = "userDetectorStatusChange";
196
+ var O = /* @__PURE__ */ ((e) => (e.languageModelLoaded = "languageModelLoaded", e[e.userDetectorStatusChange = m] = "userDetectorStatusChange", e.menuClick = "menuClick", e.ask = "ask", e.say = "say", e))(O || {});
195
197
  function _() {
196
198
  return /iPhone|iPad|iPod/i.test(navigator.userAgent);
197
199
  }
@@ -207,28 +209,28 @@ function B(e) {
207
209
  function M(e) {
208
210
  if (!Array.isArray(e) || e.length === 0)
209
211
  return null;
210
- let t = -1 / 0, a = null;
211
- for (let o = 0; o < e.length; o++) {
212
- const r = e[o];
213
- r && typeof r.score == "number" && r.score > t && (t = r.score, a = r);
212
+ let t = -1 / 0, o = null;
213
+ for (let a = 0; a < e.length; a++) {
214
+ const r = e[a];
215
+ r && typeof r.score == "number" && r.score > t && (t = r.score, o = r);
214
216
  }
215
- return a;
217
+ return o;
216
218
  }
217
219
  class D {
218
220
  constructor() {
219
- n(this, "listeners", {});
221
+ s(this, "listeners", {});
220
222
  }
221
- addEventListener(t, a) {
222
- this.listeners[t] ? this.get(t).push(a) : this.listeners[t] = [a];
223
+ addEventListener(t, o) {
224
+ this.listeners[t] ? this.get(t).push(o) : this.listeners[t] = [o];
223
225
  }
224
- removeEventListener(t, a) {
226
+ removeEventListener(t, o) {
225
227
  this.listeners[t] && (this.listeners[t] = this.get(t).filter(
226
- (o) => o !== a
228
+ (a) => a !== o
227
229
  ));
228
230
  }
229
- emit(t, ...a) {
230
- this.get(t).map((o) => {
231
- o(...a);
231
+ emit(t, ...o) {
232
+ this.get(t).map((a) => {
233
+ a(...o);
232
234
  });
233
235
  }
234
236
  get(t) {
@@ -236,28 +238,28 @@ class D {
236
238
  }
237
239
  }
238
240
  export {
239
- s as A,
241
+ n as A,
240
242
  v as C,
241
243
  D as E,
242
244
  I as M,
243
245
  $ as O,
244
246
  L as R,
245
247
  A as T,
246
- O as U,
248
+ m as U,
247
249
  N as V,
248
250
  y as a,
249
- m as b,
251
+ g as b,
250
252
  w as c,
251
253
  E as d,
252
254
  k as e,
253
- b as f,
254
- u as g,
255
+ u as f,
256
+ b as g,
255
257
  p as h,
256
258
  P as i,
257
259
  i as j,
258
260
  R as k,
259
261
  l,
260
- g as m,
262
+ O as m,
261
263
  x as n,
262
264
  f as o,
263
265
  B as p,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assistant-robot",
3
- "version": "0.0.2-beta",
3
+ "version": "0.0.2-gamma",
4
4
  "description": "An assistant widget, have a 3D robot which can interact with user, have a simple LLM which can chat with user.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",