assistant-robot 0.0.2-beta → 0.0.2-epsilon
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/LanguageModel.js +1 -1
- package/dist/LanguageModel.mjs +1 -1
- package/dist/constants.d.ts +6 -6
- package/dist/index.js +1 -1
- package/dist/index.mjs +81 -81
- package/dist/type.d.ts +1 -1
- package/dist/{utils-RQ7tdPHo.mjs → utils-u6rFqFWg.mjs} +58 -50
- package/dist/{utils-N0deqkZQ.js → utils-ybKQi2Om.js} +9 -7
- package/dist/utils.d.ts +1 -0
- package/package.json +1 -1
package/dist/type.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
var
|
2
|
-
var h = (
|
3
|
-
var n = (
|
1
|
+
var p = Object.defineProperty;
|
2
|
+
var h = (t, e, o) => e in t ? p(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
|
3
|
+
var n = (t, e, o) => (h(t, typeof e != "symbol" ? e + "" : e, 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 = "
|
32
|
+
}, l = "assistant-robot-model-container", s = "assistant-robot-tip-container", v = '<div class="assistant-robot-container ', R = `">
|
33
33
|
<style>
|
34
34
|
.assistant-robot-container{
|
35
35
|
width: 100%;
|
@@ -78,14 +78,15 @@ const A = 60, y = {
|
|
78
78
|
|
79
79
|
</div>
|
80
80
|
<div>
|
81
|
-
`,
|
81
|
+
`, w = {
|
82
82
|
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.",
|
83
83
|
alreadyOpenCamera: "the camera have be opened"
|
84
84
|
};
|
85
|
-
var
|
86
|
-
const
|
85
|
+
var b = /* @__PURE__ */ ((t) => (t.openCamera = "openCamera", t.hello = "hello", t))(b || {});
|
86
|
+
const x = "assistant-robot-input", u = "assistant-robot-btn", d = "assistant-robot-operation_container", c = "assistant-robot-menu_btn", r = "assistant-robot-menu_list", S = '<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{
|
@@ -117,14 +119,14 @@ const u = "assistant-robot-input", b = "assistant-robot-btn", d = "operation_con
|
|
117
119
|
position: relative;
|
118
120
|
height: 24px;
|
119
121
|
}
|
120
|
-
.${
|
122
|
+
.${c}{
|
121
123
|
color: #dedede;
|
122
124
|
width:24px;
|
123
125
|
height: 24px;
|
124
126
|
cursor: pointer;
|
125
127
|
}
|
126
128
|
|
127
|
-
.${
|
129
|
+
.${r} {
|
128
130
|
display: none;
|
129
131
|
position: absolute;
|
130
132
|
top: 30px;
|
@@ -138,14 +140,14 @@ const u = "assistant-robot-input", b = "assistant-robot-btn", d = "operation_con
|
|
138
140
|
list-style: none;
|
139
141
|
}
|
140
142
|
|
141
|
-
.${
|
143
|
+
.${r} li{
|
142
144
|
line-height: 32px;
|
143
145
|
text-wrap: nowrap;
|
144
146
|
border-bottom: 1px solid #dedede;
|
145
147
|
cursor: pointer;
|
146
148
|
}
|
147
149
|
|
148
|
-
.${
|
150
|
+
.${r} li:last-child{
|
149
151
|
border-bottom: none;
|
150
152
|
}
|
151
153
|
|
@@ -157,7 +159,7 @@ const u = "assistant-robot-input", b = "assistant-robot-btn", d = "operation_con
|
|
157
159
|
<span class="${d}">
|
158
160
|
<svg
|
159
161
|
t="1702017878997"
|
160
|
-
class="${
|
162
|
+
class="${c}"
|
161
163
|
viewBox="0 0 1024 1024"
|
162
164
|
version="1.1"
|
163
165
|
p-id="1322"
|
@@ -180,61 +182,66 @@ const u = "assistant-robot-input", b = "assistant-robot-btn", d = "operation_con
|
|
180
182
|
p-id="1325"
|
181
183
|
></path>
|
182
184
|
</svg>
|
183
|
-
<ul class="${
|
185
|
+
<ul class="${r}">
|
184
186
|
<li data-id="openCamera">Open the Camera</li>
|
185
187
|
`, k = `</ul>
|
186
188
|
</span>
|
187
|
-
<input class="${
|
188
|
-
<button class="${
|
189
|
+
<input class="${x}" type="text" />
|
190
|
+
<button class="${u}">ask</button>
|
189
191
|
</div>`;
|
190
|
-
var f = /* @__PURE__ */ ((
|
192
|
+
var f = /* @__PURE__ */ ((t) => (t[t.loading = 1] = "loading", t[t.ready = 2] = "ready", t[t.error = 3] = "error", t))(f || {});
|
191
193
|
const $ = 50, L = 2e3;
|
192
|
-
var
|
193
|
-
const
|
194
|
-
var
|
194
|
+
var g = /* @__PURE__ */ ((t) => (t.init = "init", t.ready = "ready", t.openCameraRejected = "openCameraRejected", t.userMediaUnavailable = "userMediaUnavailable", t.faceDetectorCreateError = "faceDetectorCreateError", t.error = "error", t))(g || {});
|
195
|
+
const m = "userDetectorStatusChange";
|
196
|
+
var O = /* @__PURE__ */ ((t) => (t.languageModelLoaded = "languageModelLoaded", t[t.userDetectorStatusChange = m] = "userDetectorStatusChange", t.menuClick = "menuClick", t.ask = "ask", t.say = "say", t))(O || {});
|
195
197
|
function _() {
|
196
198
|
return /iPhone|iPad|iPod/i.test(navigator.userAgent);
|
197
199
|
}
|
198
|
-
function
|
200
|
+
function C() {
|
199
201
|
return /Android/i.test(navigator.userAgent);
|
200
202
|
}
|
201
203
|
function P() {
|
202
|
-
return
|
204
|
+
return C() || _();
|
203
205
|
}
|
204
|
-
function B(
|
205
|
-
return new DOMParser().parseFromString(
|
206
|
+
function B(t) {
|
207
|
+
return new DOMParser().parseFromString(t, "text/html").body.firstElementChild;
|
206
208
|
}
|
207
|
-
function M(
|
208
|
-
if (!Array.isArray(
|
209
|
+
function M(t) {
|
210
|
+
if (!Array.isArray(t) || t.length === 0)
|
209
211
|
return null;
|
210
|
-
let
|
211
|
-
for (let
|
212
|
-
const
|
213
|
-
|
212
|
+
let e = -1 / 0, o = null;
|
213
|
+
for (let a = 0; a < t.length; a++) {
|
214
|
+
const i = t[a];
|
215
|
+
i && typeof i.score == "number" && i.score > e && (e = i.score, o = i);
|
214
216
|
}
|
215
|
-
return
|
217
|
+
return o;
|
216
218
|
}
|
217
219
|
class D {
|
218
220
|
constructor() {
|
219
221
|
n(this, "listeners", {});
|
220
222
|
}
|
221
|
-
addEventListener(
|
222
|
-
this.listeners[
|
223
|
+
addEventListener(e, o) {
|
224
|
+
this.listeners[e] ? this.get(e).push(o) : this.listeners[e] = [o];
|
223
225
|
}
|
224
|
-
removeEventListener(
|
225
|
-
this.listeners[
|
226
|
-
(
|
226
|
+
removeEventListener(e, o) {
|
227
|
+
this.listeners[e] && (this.listeners[e] = this.get(e).filter(
|
228
|
+
(a) => a !== o
|
227
229
|
));
|
228
230
|
}
|
229
|
-
emit(
|
230
|
-
this.get(
|
231
|
-
|
231
|
+
emit(e, ...o) {
|
232
|
+
this.get(e).map((a) => {
|
233
|
+
a(...o);
|
232
234
|
});
|
233
235
|
}
|
234
|
-
get(
|
235
|
-
return this.listeners[
|
236
|
+
get(e) {
|
237
|
+
return this.listeners[e] || [];
|
236
238
|
}
|
237
239
|
}
|
240
|
+
function H(t, e) {
|
241
|
+
for (; t.firstChild; )
|
242
|
+
t.removeChild(t.firstChild);
|
243
|
+
t.appendChild(e);
|
244
|
+
}
|
238
245
|
export {
|
239
246
|
s as A,
|
240
247
|
v as C,
|
@@ -243,24 +250,25 @@ export {
|
|
243
250
|
$ as O,
|
244
251
|
L as R,
|
245
252
|
A as T,
|
246
|
-
|
253
|
+
m as U,
|
247
254
|
N as V,
|
248
255
|
y as a,
|
249
|
-
|
250
|
-
|
256
|
+
g as b,
|
257
|
+
S as c,
|
251
258
|
E as d,
|
252
259
|
k as e,
|
253
|
-
|
254
|
-
|
255
|
-
|
260
|
+
u as f,
|
261
|
+
x as g,
|
262
|
+
c as h,
|
256
263
|
P as i,
|
257
|
-
|
264
|
+
r as j,
|
258
265
|
R as k,
|
259
266
|
l,
|
260
|
-
|
261
|
-
|
267
|
+
O as m,
|
268
|
+
b as n,
|
262
269
|
f as o,
|
263
270
|
B as p,
|
264
271
|
M as q,
|
265
|
-
|
272
|
+
H as r,
|
273
|
+
w as t
|
266
274
|
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var A=Object.defineProperty;var E=(t,e,o)=>e in t?A(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var d=(t,e,o)=>(E(t,typeof e!="symbol"?e+"":e,o),o);const x={position:[0,0,0],rotation:[0,Math.PI,0],helloActionName:"hello",idleActionName:"idle",helloContent:"Hi, you can talk to me!"},f={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]}},C={big:{width:640,height:480},small:{width:360,height:270}},s="assistant-robot-model-container",n="assistant-robot-tip-container",I='<div class="assistant-robot-container ',N=`">
|
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
|
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 p=(t=>(t.openCamera="openCamera",t.hello="hello",t))(p||{});const h="assistant-robot-input",_="assistant-robot-btn",c="assistant-robot-operation_container",l="assistant-robot-menu_btn",a="assistant-robot-menu_list",m='<div class="assistant-robot-chartbox',S=`">
|
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
|
-
.${
|
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="${
|
123
|
+
<span class="${c}">
|
122
124
|
<svg
|
123
125
|
t="1702017878997"
|
124
126
|
class="${l}"
|
@@ -148,6 +150,6 @@
|
|
148
150
|
<li data-id="openCamera">Open the Camera</li>
|
149
151
|
`,R=`</ul>
|
150
152
|
</span>
|
151
|
-
<input class="${
|
152
|
-
<button class="${
|
153
|
-
</div>`;var
|
153
|
+
<input class="${h}" type="text" />
|
154
|
+
<button class="${_}">ask</button>
|
155
|
+
</div>`;var O=(t=>(t[t.loading=1]="loading",t[t.ready=2]="ready",t[t.error=3]="error",t))(O||{});const y=50,L=2e3;var T=(t=>(t.init="init",t.ready="ready",t.openCameraRejected="openCameraRejected",t.userMediaUnavailable="userMediaUnavailable",t.faceDetectorCreateError="faceDetectorCreateError",t.error="error",t))(T||{});const u="userDetectorStatusChange";var b=(t=>(t.languageModelLoaded="languageModelLoaded",t[t.userDetectorStatusChange=u]="userDetectorStatusChange",t.menuClick="menuClick",t.ask="ask",t.say="say",t))(b||{});function v(){return/iPhone|iPad|iPod/i.test(navigator.userAgent)}function B(){return/Android/i.test(navigator.userAgent)}function D(){return B()||v()}function w(t){return new DOMParser().parseFromString(t,"text/html").body.firstElementChild}function M(t){if(!Array.isArray(t)||t.length===0)return null;let e=-1/0,o=null;for(let i=0;i<t.length;i++){const r=t[i];r&&typeof r.score=="number"&&r.score>e&&(e=r.score,o=r)}return o}class P{constructor(){d(this,"listeners",{})}addEventListener(e,o){this.listeners[e]?this.get(e).push(o):this.listeners[e]=[o]}removeEventListener(e,o){this.listeners[e]&&(this.listeners[e]=this.get(e).filter(i=>i!==o))}emit(e,...o){this.get(e).map(i=>{i(...o)})}get(e){return this.listeners[e]||[]}}function k(t,e){for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(e)}exports.ASSISTANT_MODEL_CONTAINER_CLASS=s;exports.ASSISTANT_TIP_CONTAINER=n;exports.CONTAINER_BODY=N;exports.CONTAINER_HEAD=I;exports.EAssistantEvent=b;exports.ELanguageModelStatus=O;exports.EMenuKey=p;exports.EUserDetectorStatus=T;exports.EventListener=P;exports.MENU_BTN_CLASS=l;exports.MENU_LIST_CLASS=a;exports.MODEL_CONFIG=x;exports.MODEL_SCENE_CONFIG=f;exports.ONE_LETTER_READ_TIME=y;exports.READ_WAIT_TIME=L;exports.ROBOT_OPERATION_BOX_BODY=S;exports.ROBOT_OPERATION_BOX_HEAD=m;exports.ROBOT_OPERATION_BOX_TAIL=R;exports.ROBOT_OPERATION_BTN_CLASS=_;exports.ROBOT_OPERATION_INPUT_CLASS=h;exports.TARGET_FPS=60;exports.USER_DETECTOR_STATUS_CHANGE_EVENT=u;exports.VIDEO_SIZE=C;exports.findHighestScoreItem=M;exports.isMobile=D;exports.parseHTML=w;exports.replaceChildren=k;exports.tips=g;
|
package/dist/utils.d.ts
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "assistant-robot",
|
3
|
-
"version": "0.0.2-
|
3
|
+
"version": "0.0.2-epsilon",
|
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",
|