Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherTrimboli committed Feb 10, 2024
2 parents 87b622d + e8ca58a commit 4bbb002
Show file tree
Hide file tree
Showing 7 changed files with 1,549 additions and 1,008 deletions.
1,576 changes: 909 additions & 667 deletions package-lock.json

Large diffs are not rendered by default.

33 changes: 17 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lala-companion",
"productName": "lala-companion",
"version": "0.0.10",
"version": "0.0.11",
"description": "3D personified desktop assistants, tuned for you, powered by AI vision and voice.",
"main": ".webpack/main",
"scripts": {
Expand Down Expand Up @@ -31,39 +31,40 @@
"@electron-forge/plugin-webpack": "^7.2.0",
"@electron-forge/publisher-github": "^7.2.0",
"@types/hark": "^1.2.5",
"@types/react-dom": "^18.2.18",
"@typescript-eslint/eslint-plugin": "^6.18.0",
"@typescript-eslint/parser": "^6.18.0",
"@types/react-dom": "^18.2.19",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@vercel/webpack-asset-relocator-loader": "^1.7.3",
"css-loader": "^6.8.1",
"electron": "28.1.1",
"css-loader": "^6.10.0",
"electron": "28.2.2",
"eslint": "^8.56.0",
"eslint-plugin-import": "^2.29.1",
"fork-ts-checker-webpack-plugin": "^9.0.2",
"node-loader": "^2.0.0",
"style-loader": "^3.3.3",
"style-loader": "^3.3.4",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
},
"dependencies": {
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.15.3",
"@mui/material": "^5.15.3",
"@mui/icons-material": "^5.15.9",
"@mui/material": "^5.15.9",
"@nut-tree/nut-js": "^3.1.2",
"@pixiv/three-vrm": "^2.0.7",
"@react-three/drei": "^9.93.0",
"@react-three/fiber": "^8.15.13",
"ai": "^2.2.31",
"dotenv": "^16.3.1",
"@pixiv/three-vrm": "^2.0.10",
"@react-three/drei": "^9.97.3",
"@react-three/fiber": "^8.15.16",
"@react-three/rapier": "^1.2.1",
"ai": "^2.2.34",
"dotenv": "^16.4.1",
"electron-squirrel-startup": "^1.0.0",
"hark": "^1.2.3",
"node-fetch": "^3.3.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"three": "^0.160.0",
"three": "^0.161.0",
"update-electron-app": "^3.0.0",
"wavesurfer.js": "^7.6.2"
"wavesurfer.js": "^7.7.2"
}
}
84 changes: 84 additions & 0 deletions src/Scene.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import { VRM } from "@pixiv/three-vrm";
import { OrbitControls } from "@react-three/drei";
import { Canvas } from "@react-three/fiber";
import { RapierRigidBody } from "@react-three/rapier";
import React, { useRef, useEffect, MutableRefObject } from "react";
import { Mesh } from "three";
import { animations } from "./constants/animations";
import VrmCompanion from "./components/VRMCompanion";

interface SceneProps {
virtualText: string;
voiceUrl: string;
audioRef?: MutableRefObject<HTMLAudioElement>;
onSpeakStart?: () => void;
onSpeakEnd?: () => void;
}

const Scene = ({
virtualText,
voiceUrl,
onSpeakStart,
onSpeakEnd,
}: SceneProps) => {
const vrmRef = useRef<VRM>(null);
const vrmMeshRef = useRef<Mesh>(null);
const vrmPhysicsRef = useRef<RapierRigidBody>(null);

useEffect(() => {
if (virtualText) {
(vrmRef as any)?.current?.setText?.(virtualText);
}
}, [virtualText]);

useEffect(() => {
const speak = async () => {
if (voiceUrl) {
onSpeakStart?.();
await (vrmRef as any)?.current?.talk?.(voiceUrl);
onSpeakEnd?.();
}
};
speak();
}, [voiceUrl]);

return (
<>
<Canvas
style={{
zIndex: 1,
height: "100vh",
width: "100%",
}}
>
<OrbitControls
makeDefault
minDistance={0.75}
maxDistance={1.5}
enableDamping
/>
<ambientLight />

{/* left */}
<pointLight position={[1, 2, 1]} intensity={2.5} castShadow />

{/* right */}
<pointLight position={[-1, 2, 1]} intensity={2.5} castShadow />

<VrmCompanion
ref={vrmRef}
meshRef={vrmMeshRef}
physicsRef={vrmPhysicsRef}
vrmUrl={"https://lalaland.chat/vrms/purple-girl.vrm"}
animations={animations}
scale={[1, 1, 1]}
position={[0, -1, 0]}
rotation={[0, Math.PI, 0]}
isStaticPosition
/>
</Canvas>
</>
);
};

export default Scene;
Loading

0 comments on commit 4bbb002

Please sign in to comment.