assistant-robot 0.0.2-alpha → 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/Assistant.d.ts +2 -2
- package/dist/AssistantModel.d.ts +2 -6
- package/dist/LanguageModel.js +1 -1
- package/dist/LanguageModel.mjs +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +916 -911
- package/dist/type.d.ts +7 -1
- package/dist/{utils-N0deqkZQ.js → utils-DoHpdGms.js} +7 -5
- package/dist/{utils-RQ7tdPHo.mjs → utils-W4yhvT2-.mjs} +33 -31
- package/package.json +1 -1
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
|
-
|
18
|
+
perationBoxClassName?: string;
|
19
19
|
operationList?: IOperation[];
|
20
20
|
}
|
21
21
|
export interface IModelConfig {
|
@@ -61,4 +61,10 @@ export interface IAssistantRobotConfig<T extends LanguageModel> {
|
|
61
61
|
}
|
62
62
|
export type TCallback = () => void;
|
63
63
|
export type TEventListenFunc = (...args: any[]) => void;
|
64
|
+
export interface IActionConfig {
|
65
|
+
loop?: boolean;
|
66
|
+
weight?: number;
|
67
|
+
timeScale?: number;
|
68
|
+
repetitions?: number;
|
69
|
+
}
|
64
70
|
export {};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
"use strict";var E=Object.defineProperty;var
|
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
|
-
`,
|
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
|
-
.${
|
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}"
|
@@ -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=
|
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,
|
3
|
-
var
|
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",
|
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
|
-
.${
|
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
|
-
.${
|
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="${
|
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
|
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="${
|
188
|
-
<button class="${
|
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
|
193
|
-
const
|
194
|
-
var
|
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,
|
211
|
-
for (let
|
212
|
-
const r = e[
|
213
|
-
r && typeof r.score == "number" && r.score > t && (t = r.score,
|
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
|
217
|
+
return o;
|
216
218
|
}
|
217
219
|
class D {
|
218
220
|
constructor() {
|
219
|
-
|
221
|
+
s(this, "listeners", {});
|
220
222
|
}
|
221
|
-
addEventListener(t,
|
222
|
-
this.listeners[t] ? this.get(t).push(
|
223
|
+
addEventListener(t, o) {
|
224
|
+
this.listeners[t] ? this.get(t).push(o) : this.listeners[t] = [o];
|
223
225
|
}
|
224
|
-
removeEventListener(t,
|
226
|
+
removeEventListener(t, o) {
|
225
227
|
this.listeners[t] && (this.listeners[t] = this.get(t).filter(
|
226
|
-
(
|
228
|
+
(a) => a !== o
|
227
229
|
));
|
228
230
|
}
|
229
|
-
emit(t, ...
|
230
|
-
this.get(t).map((
|
231
|
-
|
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
|
-
|
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
|
-
|
248
|
+
m as U,
|
247
249
|
N as V,
|
248
250
|
y as a,
|
249
|
-
|
251
|
+
g as b,
|
250
252
|
w as c,
|
251
253
|
E as d,
|
252
254
|
k as e,
|
253
|
-
|
254
|
-
|
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
|
-
|
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-
|
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",
|