@gui-chat-plugin/avatar 0.1.0 → 0.4.0
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/react.cjs +1 -1
- package/dist/react.js +2 -2
- package/dist/style.css +1 -1
- package/dist/{three-vrm.module-D9yGV_Aw.cjs → three-vrm.module-BwfNtY9R.cjs} +3 -3
- package/dist/{three-vrm.module-Dp91hI0o.js → three-vrm.module-DmeOLVso.js} +27 -15
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +1 -1
- package/package.json +13 -13
|
@@ -3671,15 +3671,15 @@ var Gr = {
|
|
|
3671
3671
|
width: e,
|
|
3672
3672
|
height: e,
|
|
3673
3673
|
depth: 1
|
|
3674
|
-
}
|
|
3675
|
-
this.texture = new ri([
|
|
3674
|
+
}, r = [
|
|
3676
3675
|
n,
|
|
3677
3676
|
n,
|
|
3678
3677
|
n,
|
|
3679
3678
|
n,
|
|
3680
3679
|
n,
|
|
3681
3680
|
n
|
|
3682
|
-
]
|
|
3681
|
+
];
|
|
3682
|
+
this.texture = new ri(r, t.mapping, t.wrapS, t.wrapT, t.magFilter, t.minFilter, t.format, t.type, t.anisotropy, t.colorSpace), this.texture.isRenderTargetTexture = !0, this.texture.generateMipmaps = t.generateMipmaps === void 0 ? !1 : t.generateMipmaps, this.texture.minFilter = t.minFilter === void 0 ? s : t.minFilter;
|
|
3683
3683
|
}
|
|
3684
3684
|
fromEquirectangularTexture(e, t) {
|
|
3685
3685
|
this.texture.type = t.type, this.texture.colorSpace = t.colorSpace, this.texture.generateMipmaps = t.generateMipmaps, this.texture.minFilter = t.minFilter, this.texture.magFilter = t.magFilter;
|
|
@@ -12526,9 +12526,11 @@ var Iu = class e {
|
|
|
12526
12526
|
_OutlineColor: Lu.OutlineColor
|
|
12527
12527
|
}, zu = new J(), Bu = class e {
|
|
12528
12528
|
constructor({ material: e, type: t, targetValue: n, targetAlpha: r }) {
|
|
12529
|
-
this.material = e, this.type = t, this.targetValue = n, this.targetAlpha = r ?? 1
|
|
12530
|
-
|
|
12531
|
-
|
|
12529
|
+
this.material = e, this.type = t, this.targetValue = n, this.targetAlpha = r ?? 1;
|
|
12530
|
+
let i = this._initColorBindState(), a = this._initAlphaBindState();
|
|
12531
|
+
this._state = {
|
|
12532
|
+
color: i,
|
|
12533
|
+
alpha: a
|
|
12532
12534
|
};
|
|
12533
12535
|
}
|
|
12534
12536
|
applyWeight(e) {
|
|
@@ -13422,33 +13424,39 @@ var od = new K(), sd = new G(), cd = class {
|
|
|
13422
13424
|
super(), this.matrixAutoUpdate = !1, this.vrmLookAt = e;
|
|
13423
13425
|
{
|
|
13424
13426
|
let e = new vd();
|
|
13425
|
-
e.radius = .5
|
|
13427
|
+
e.radius = .5;
|
|
13428
|
+
let t = new dr({
|
|
13426
13429
|
color: 65280,
|
|
13427
13430
|
transparent: !0,
|
|
13428
13431
|
opacity: .5,
|
|
13429
13432
|
side: 2,
|
|
13430
13433
|
depthTest: !1,
|
|
13431
13434
|
depthWrite: !1
|
|
13432
|
-
})
|
|
13435
|
+
});
|
|
13436
|
+
this._meshPitch = new Lr(e, t), this.add(this._meshPitch);
|
|
13433
13437
|
}
|
|
13434
13438
|
{
|
|
13435
13439
|
let e = new vd();
|
|
13436
|
-
e.radius = .5
|
|
13440
|
+
e.radius = .5;
|
|
13441
|
+
let t = new dr({
|
|
13437
13442
|
color: 16711680,
|
|
13438
13443
|
transparent: !0,
|
|
13439
13444
|
opacity: .5,
|
|
13440
13445
|
side: 2,
|
|
13441
13446
|
depthTest: !1,
|
|
13442
13447
|
depthWrite: !1
|
|
13443
|
-
})
|
|
13448
|
+
});
|
|
13449
|
+
this._meshYaw = new Lr(e, t), this.add(this._meshYaw);
|
|
13444
13450
|
}
|
|
13445
13451
|
{
|
|
13446
13452
|
let e = new yd();
|
|
13447
|
-
e.radius = .1
|
|
13453
|
+
e.radius = .1;
|
|
13454
|
+
let t = new Ui({
|
|
13448
13455
|
color: 16777215,
|
|
13449
13456
|
depthTest: !1,
|
|
13450
13457
|
depthWrite: !1
|
|
13451
|
-
})
|
|
13458
|
+
});
|
|
13459
|
+
this._lineTarget = new ta(e, t), this._lineTarget.frustumCulled = !1, this.add(this._lineTarget);
|
|
13452
13460
|
}
|
|
13453
13461
|
}
|
|
13454
13462
|
dispose() {
|
|
@@ -14509,11 +14517,13 @@ var Rf = class {
|
|
|
14509
14517
|
0
|
|
14510
14518
|
]), 3), this._attrPosition.setUsage(He);
|
|
14511
14519
|
let t = new Tr();
|
|
14512
|
-
t.setAttribute("position", this._attrPosition)
|
|
14520
|
+
t.setAttribute("position", this._attrPosition);
|
|
14521
|
+
let n = new Ui({
|
|
14513
14522
|
color: 16711935,
|
|
14514
14523
|
depthTest: !1,
|
|
14515
14524
|
depthWrite: !1
|
|
14516
|
-
})
|
|
14525
|
+
});
|
|
14526
|
+
this._line = new Zi(t, n), this.add(this._line), this.constraint = e;
|
|
14517
14527
|
}
|
|
14518
14528
|
updateMatrixWorld(e) {
|
|
14519
14529
|
Bf.setFromMatrixPosition(this.constraint.destination.matrixWorld), this._attrPosition.setXYZ(0, Bf.x, Bf.y, Bf.z), this.constraint.source && Bf.setFromMatrixPosition(this.constraint.source.matrixWorld), this._attrPosition.setXYZ(1, Bf.x, Bf.y, Bf.z), this._attrPosition.needsUpdate = !0, super.updateMatrixWorld(e);
|
|
@@ -14903,7 +14913,9 @@ function Fp(e) {
|
|
|
14903
14913
|
}
|
|
14904
14914
|
var Ip = class {
|
|
14905
14915
|
constructor(e) {
|
|
14906
|
-
this._inverseCache = new q(), this._shouldUpdateInverse = !0, this.matrix = e
|
|
14916
|
+
this._inverseCache = new q(), this._shouldUpdateInverse = !0, this.matrix = e;
|
|
14917
|
+
let t = { set: (e, t, n) => (this._shouldUpdateInverse = !0, e[t] = n, !0) };
|
|
14918
|
+
this._originalElements = e.elements, e.elements = new Proxy(e.elements, t);
|
|
14907
14919
|
}
|
|
14908
14920
|
get inverse() {
|
|
14909
14921
|
return this._shouldUpdateInverse &&= (Fp(this._inverseCache.copy(this.matrix)), !1), this._inverseCache;
|
package/dist/vue.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./plugin-DbprBh0b.cjs`),t=require(`./three-vrm.module-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./plugin-DbprBh0b.cjs`),t=require(`./three-vrm.module-BwfNtY9R.cjs`);require(`./react.cjs`);let n=require(`vue`);var r={class:`size-full bg-gradient-to-b from-slate-800 to-slate-900 relative`},i={key:0,class:`absolute inset-0 flex items-center justify-center bg-slate-900/80`},a={key:1,class:`absolute inset-0 flex items-center justify-center bg-slate-900/80`},o={class:`text-red-400 text-lg text-center p-4`},s={key:2,class:`absolute top-4 right-4 px-3 py-1 bg-green-600 text-white text-sm rounded-full`},c=(0,n.defineComponent)({__name:`View`,props:{selectedResult:{},sendTextMessage:{type:Function},isAudioPlaying:{type:Boolean}},setup(e){let c=e,l=(0,n.ref)(null),u=(0,n.ref)(!1),d=(0,n.ref)(null),f=null,p=null,m=null,h=null,g=null,_=null,v=0,y=`neutral`,b=`none`,x=0,S=0,C=``,w={neutral:null,happy:t.t.Happy,sad:t.t.Sad,angry:t.t.Angry,surprised:t.t.Surprised};function T(){if(!l.value)return;let e=l.value,n=e.clientWidth,r=e.clientHeight;f=new t.u,p=new t.c(30,n/r,.1,100),p.position.set(0,1.3,1.5),p.lookAt(0,1.2,0),m=new t.i({antialias:!0,alpha:!0}),m.setSize(n,r),m.setPixelRatio(window.devicePixelRatio),m.outputColorSpace=t.l,e.appendChild(m.domElement);let i=new t.a(16777215,.6);f.add(i);let a=new t.s(16777215,.8);a.position.set(1,1,1),f.add(a),g=new t.o,window.addEventListener(`resize`,E),O()}function E(){if(!l.value||!p||!m)return;let e=l.value.clientWidth,t=l.value.clientHeight;p.aspect=e/t,p.updateProjectionMatrix(),m.setSize(e,t)}async function D(e){if(f){u.value=!0,d.value=null,h&&=(f.remove(h.scene),null);try{let n=new t.r;n.register(e=>new t.n(e));let r=(await n.loadAsync(e)).userData.vrm;if(!r)throw Error(`Failed to load VRM data`);f.add(r.scene),h=r,u.value=!1}catch(e){console.error(`Failed to load VRM:`,e),d.value=`Failed to load avatar: ${e instanceof Error?e.message:`Unknown error`}`,u.value=!1}}}function O(){if(_=requestAnimationFrame(O),!g||!m||!f||!p)return;let e=g.getDelta(),n=g.getElapsedTime();if(h){if(h.update(e),c.isAudioPlaying){v+=e*10;let r=(Math.sin(v)+1)*.3;h.expressionManager?.setValue(t.t.Aa,r);let i=h.humanoid?.getNormalizedBoneNode(`head`),a=h.humanoid?.getNormalizedBoneNode(`neck`),o=h.humanoid?.getNormalizedBoneNode(`spine`);i&&(i.rotation.x=Math.sin(n*2)*.08,i.rotation.z=Math.sin(n*1.5)*.05),a&&(a.rotation.y=Math.sin(n*.8)*.05),o&&(o.rotation.z=Math.sin(n*.5)*.03);let s=h.humanoid?.getNormalizedBoneNode(`leftShoulder`),c=h.humanoid?.getNormalizedBoneNode(`rightShoulder`),l=h.humanoid?.getNormalizedBoneNode(`leftUpperArm`),u=h.humanoid?.getNormalizedBoneNode(`rightUpperArm`),d=h.humanoid?.getNormalizedBoneNode(`leftLowerArm`),f=h.humanoid?.getNormalizedBoneNode(`rightLowerArm`);s&&(s.rotation.z=.1),c&&(c.rotation.z=-.1),l&&(l.rotation.z=-.8+Math.sin(n*1.2)*.1,l.rotation.x=.4+Math.sin(n*.9)*.15,l.rotation.y=Math.sin(n*.7)*.1),u&&(u.rotation.z=.8+Math.sin(n*1.3)*.1,u.rotation.x=.4+Math.sin(n*1)*.15,u.rotation.y=Math.sin(n*.8)*.1),d&&(d.rotation.y=-1-Math.sin(n*1.5)*.2,d.rotation.z=Math.sin(n*1.1)*.1),f&&(f.rotation.y=1+Math.sin(n*1.4)*.2,f.rotation.z=Math.sin(n*1.2)*.1)}else{v=0,h.expressionManager?.setValue(t.t.Aa,0);let e=h.humanoid?.getNormalizedBoneNode(`spine`),r=h.humanoid?.getNormalizedBoneNode(`head`);e&&(e.rotation.x=Math.sin(n*.8)*.02),r&&(r.rotation.x=Math.sin(n*.3)*.03,r.rotation.z=Math.sin(n*.2)*.02);let i=h.humanoid?.getNormalizedBoneNode(`leftShoulder`),a=h.humanoid?.getNormalizedBoneNode(`rightShoulder`),o=h.humanoid?.getNormalizedBoneNode(`leftUpperArm`),s=h.humanoid?.getNormalizedBoneNode(`rightUpperArm`),c=h.humanoid?.getNormalizedBoneNode(`leftLowerArm`),l=h.humanoid?.getNormalizedBoneNode(`rightLowerArm`);i&&(i.rotation.z=.1),a&&(a.rotation.z=-.1),o&&(o.rotation.z=-.9,o.rotation.x=.2,o.rotation.y=0),s&&(s.rotation.z=.9,s.rotation.x=.2,s.rotation.y=0),c&&(c.rotation.y=-.8),l&&(l.rotation.y=.8)}n%4<.1?h.expressionManager?.setValue(t.t.Blink,1):h.expressionManager?.setValue(t.t.Blink,0);let r=w[y];if(h.expressionManager?.setValue(t.t.Happy,0),h.expressionManager?.setValue(t.t.Sad,0),h.expressionManager?.setValue(t.t.Angry,0),h.expressionManager?.setValue(t.t.Surprised,0),r&&h.expressionManager?.setValue(r,.8),b!==`none`){let e=n-x,t=1.5;if(e<t){let n=e/t,r=h.humanoid?.getNormalizedBoneNode(`head`),i=h.humanoid?.getNormalizedBoneNode(`rightUpperArm`),a=h.humanoid?.getNormalizedBoneNode(`rightLowerArm`),o=h.humanoid?.getNormalizedBoneNode(`spine`),s=(e=>e<.5?2*e*e:1-(-2*e+2)**2/2)(n<.5?n*2:(1-n)*2);switch(b){case`nod`:r&&(r.rotation.x=Math.sin(n*Math.PI*3)*.2);break;case`shake`:r&&(r.rotation.y=Math.sin(n*Math.PI*4)*.3);break;case`wave`:i&&(i.rotation.z=1.5*s,i.rotation.x=-.3*s),a&&(a.rotation.y=.5+Math.sin(n*Math.PI*6)*.3);break;case`think`:r&&(r.rotation.x=.1*s,r.rotation.z=.1*s),i&&(i.rotation.z=.3*s,i.rotation.x=.8*s),a&&(a.rotation.y=1.5*s);break;case`bow`:o&&(o.rotation.x=.4*s),r&&(r.rotation.x=.2*s);break}}else b=`none`}}m.render(f,p)}function k(){_!==null&&(cancelAnimationFrame(_),_=null),window.removeEventListener(`resize`,E),m&&l.value&&(l.value.removeChild(m.domElement),m.dispose(),m=null),h&&=null,f=null,p=null,g=null}return(0,n.watch)(()=>c.selectedResult,e=>{if(e?.toolName===`receptron_avatar`&&e.data){let t=e.data;if(t.avatarUrl&&t.avatarUrl!==C&&(C=t.avatarUrl,D(t.avatarUrl)),t.emotion&&t.emotion!==y&&(console.log(`[Avatar Debug] Emotion changed to:`,t.emotion),y=t.emotion),t.action&&t.action!==`none`){let e=t.actionTimestamp||0;e>S&&(console.log(`[Avatar Debug] Action triggered:`,t.action),b=t.action,x=g?.getElapsedTime()||0,S=e)}}},{deep:!0}),(0,n.onMounted)(()=>{if(T(),c.selectedResult?.toolName===`receptron_avatar`&&c.selectedResult.data){let e=c.selectedResult.data;e.avatarUrl&&(C=e.avatarUrl,D(e.avatarUrl)),e.emotion&&(y=e.emotion)}}),(0,n.onUnmounted)(()=>{k()}),(t,c)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,r,[(0,n.createElementVNode)(`div`,{ref_key:`containerRef`,ref:l,class:`size-full`},null,512),u.value?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,i,[...c[0]||=[(0,n.createElementVNode)(`div`,{class:`text-white text-lg`},`Loading Avatar...`,-1)]])):(0,n.createCommentVNode)(``,!0),d.value?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,a,[(0,n.createElementVNode)(`div`,o,(0,n.toDisplayString)(d.value),1)])):(0,n.createCommentVNode)(``,!0),e.isAudioPlaying?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,s,` Speaking... `)):(0,n.createCommentVNode)(``,!0)]))}}),l={class:`p-3 bg-gradient-to-br from-slate-700 to-slate-800 rounded-md`},u={class:`flex flex-col items-center gap-2`},d={key:0,class:`text-xs px-2 py-0.5 bg-blue-500 text-white rounded-full`},f=(0,n.defineComponent)({__name:`Preview`,props:{result:{}},setup(e){let t=e,r=(0,n.computed)(()=>t.result.data),i=(0,n.computed)(()=>r.value?.emotion||`neutral`);return(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,l,[(0,n.createElementVNode)(`div`,u,[t[0]||=(0,n.createElementVNode)(`div`,{class:`size-12 bg-slate-600 rounded-full flex items-center justify-center`},[(0,n.createElementVNode)(`svg`,{class:`size-8 text-slate-300`,fill:`none`,stroke:`currentColor`,viewBox:`0 0 24 24`},[(0,n.createElementVNode)(`path`,{"stroke-linecap":`round`,"stroke-linejoin":`round`,"stroke-width":`2`,d:`M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z`})])],-1),t[1]||=(0,n.createElementVNode)(`div`,{class:`text-sm font-semibold text-white text-center`},` 3D Avatar `,-1),i.value&&i.value!==`neutral`?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,d,(0,n.toDisplayString)(i.value),1)):(0,n.createCommentVNode)(``,!0)])]))}}),p={...e.n,viewComponent:c,previewComponent:f},m={plugin:p};exports.Preview=f,exports.SAMPLES=e.r,exports.TOOL_DEFINITION=e.i,exports.TOOL_NAME=e.a,exports.View=c,exports.default=m,exports.executeAvatar=e.t,exports.plugin=p,exports.pluginCore=e.n;
|
package/dist/vue.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as e, i as t, n, r, t as i } from "./plugin-Cezk5ZnX.js";
|
|
2
|
-
import { a, c as o, i as s, l as c, n as l, o as u, r as d, s as f, t as p, u as m } from "./three-vrm.module-
|
|
2
|
+
import { a, c as o, i as s, l as c, n as l, o as u, r as d, s as f, t as p, u as m } from "./three-vrm.module-DmeOLVso.js";
|
|
3
3
|
import { computed as h, createCommentVNode as g, createElementBlock as _, createElementVNode as v, defineComponent as y, onMounted as b, onUnmounted as x, openBlock as S, ref as C, toDisplayString as w, watch as T } from "vue";
|
|
4
4
|
//#region src/vue/View.vue?vue&type=script&setup=true&lang.ts
|
|
5
5
|
var E = { class: "size-full bg-gradient-to-b from-slate-800 to-slate-900 relative" }, D = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gui-chat-plugin/avatar",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "3D Avatar Plugin for GUIChat - VRM avatar with lip-sync",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -57,26 +57,26 @@
|
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@eslint/js": "^10.0.1",
|
|
60
|
-
"@tailwindcss/vite": "^4.2.
|
|
60
|
+
"@tailwindcss/vite": "^4.2.4",
|
|
61
61
|
"@types/react": "^19.0.0",
|
|
62
62
|
"@types/react-dom": "^19.0.0",
|
|
63
63
|
"@types/three": "^0.174.0",
|
|
64
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
65
|
-
"@typescript-eslint/parser": "^8.
|
|
64
|
+
"@typescript-eslint/eslint-plugin": "^8.59.2",
|
|
65
|
+
"@typescript-eslint/parser": "^8.59.2",
|
|
66
66
|
"@vitejs/plugin-react": "^4.5.0",
|
|
67
67
|
"@vitejs/plugin-vue": "^6.0.5",
|
|
68
|
-
"eslint": "^10.
|
|
69
|
-
"eslint-plugin-vue": "^10.
|
|
70
|
-
"globals": "^17.
|
|
68
|
+
"eslint": "^10.3.0",
|
|
69
|
+
"eslint-plugin-vue": "^10.9.1",
|
|
70
|
+
"globals": "^17.6.0",
|
|
71
71
|
"openai": "^6.16.0",
|
|
72
72
|
"react": "^19.0.0",
|
|
73
73
|
"react-dom": "^19.0.0",
|
|
74
|
-
"tailwindcss": "^4.2.
|
|
75
|
-
"typescript": "~6.0.
|
|
76
|
-
"vite": "^8.0.
|
|
77
|
-
"vue": "^3.5.
|
|
74
|
+
"tailwindcss": "^4.2.4",
|
|
75
|
+
"typescript": "~6.0.3",
|
|
76
|
+
"vite": "^8.0.11",
|
|
77
|
+
"vue": "^3.5.34",
|
|
78
78
|
"vue-eslint-parser": "^10.4.0",
|
|
79
|
-
"vue-tsc": "^3.2.
|
|
79
|
+
"vue-tsc": "^3.2.8"
|
|
80
80
|
},
|
|
81
81
|
"keywords": [
|
|
82
82
|
"guichat",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"license": "MIT",
|
|
94
94
|
"dependencies": {
|
|
95
95
|
"@pixiv/three-vrm": "^3.3.3",
|
|
96
|
-
"gui-chat-protocol": "^0.
|
|
96
|
+
"gui-chat-protocol": "^0.3.3",
|
|
97
97
|
"three": "^0.174.0"
|
|
98
98
|
}
|
|
99
99
|
}
|