Check out the site!: GenAiGraphics Password: NINEgoal123@*
The GenAiGraphics application aims to address the challenge of guiding users through complex technology setups using a combination of advanced 3D graphics rendering and AI-driven interactions. Traditional setup guides often rely on text-based instructions, which can be challenging for users to follow, especially when dealing with intricate hardware configurations. This project seeks to enhance user experience by visualizing setup processes in a dynamic, interactive manner. By integrating WebGL technology with Three.js for 3D rendering and Azure ML Prompt Flow for AI chat functionalities. Genaigraphics empowers users to interact with realistic 3D models that demonstrate step-by-step procedures. The goal is to provide intuitive visual aids that simplify the setup process, reduce user errors, and enhance overall user satisfaction.
- Helps users visually navigate technology setups, such as configuring a router. Relevant 3D models are loaded, zoomed in, and rotated based on the user's queries to demonstrate specific actions like plugging in, turning on/off, or resetting devices.
- Utilizes Three.js within a core WebGL class to manage rendering, scenes, camera control, resizing events, and frame animations.
- Frontend is built with Astro, featuring distinct pages and reusable components. TailwindCSS is integrated for styling, and server-side settings are configured for API proxying.
- AI-driven chatbot powered by Azure ML Prompt Flow handles user queries and provides intelligent responses and recommendations.
- An Express server acts as middleware, managing API requests using Axios, handling CORS, and logging requests.
- Employs TypeScript for static typing and robust tooling. Npm scripts manage build and development processes efficiently.
- TailwindCSS is integrated for rapid UI development with utility-first CSS.
Clone the repository:
git clone https://github.com/mollybeach/genaigraphics.git
cd genaigraphics
cd webapp
npm install
npm run start
- The user types a question into the ChatBar Component and submits it.
- The store.js triggers the updateMessagesStateEvent(), setting the $question store, adding the message to $historyMessages, and calling threejsCanvasEvent("loadingcircle") to display a loading indicator.
- The store.js then calls postAzureMLMessagesData() to send the question and chat history to Azure ML.
- Azure ML processes the input and responds with relevant data.
- On success, store.js sets $botResponse, adds the AI response to $historyMessages, and calls updateAnimationsStateEvent().
- azureML.js handles further processing by sending the chat history to Azure ML for - animation and recommendation commands.
- Azure ML returns animation commands, which store.js uses to update animations via threejsCanvasEvent().
- It also fetches recommendation commands and updates the recommendations.
- The threejsCanvasEvent(command) in store.js calls mapAssetAttributesByCommand(command), setting $animationAsset and $canvasTitle, and initializes ThreeCanvas.instance.
- ThreeCanvas class initializes the 3D scene, loads assets based on attributes, and supports various asset types like glb, fbx, mp4, png, multipleGlbs, and multipleMp4s. It adds necessary lighting and controls for an interactive experience.
- The ChatMessages Component subscribes to $historyMessages to render messages with typing animations.
- The ChatRecommendationBar Component subscribes to $recommendations to display recommendation buttons.
- The ChatBar Component updates the textarea with selected recommendations, ensuring smooth user interaction.οΈ
Start
|
v
+-------------------------------+
| ChatBar Component |
| - User types a question |
| - User submits the question |
+-------------------------------+
|
v
+-------------------------------+
| store.js |
| - updateMessagesStateEvent() |
| - Sets $question store |
| - Adds message to $historyMessages |
| - Calls threejsCanvasEvent("loadingcircle") |
+-------------------------------+
|
v
+-------------------------------+
| store.js |
| - Calls postAzureMLMessagesData(question, $historyMessages.get()) |
+-------------------------------+
|
v
+-------------------------------+
| azureML.js |
| - postAzureMLMessagesData() |
| - Sends question and chat history to Azure ML |
| - Receives response from Azure ML |
+-------------------------------+
|
v
+-------------------------------+
| store.js |
| - On success: |
| - Sets $botResponse |
| - Adds AI response to $historyMessages |
+-------------------------------+
|
v
+-------------------------------+
| store.js |
| - Calls updateAnimationsStateEvent() |
+-------------------------------+
|
v
+-------------------------------+
| azureML.js |
| - postAzureMLAnimationsData() |
| - Sends question and chat history to Azure ML |
| - Receives animation command from Azure ML |
+-------------------------------+
|
v
+-------------------------------+
| store.js |
| - Calls updateRecommendationsStateEvent() |
+-------------------------------+
|
v
+-------------------------------+
| azureML.js |
| - postAzureMLRecommendationsData() |
| - Sends question and chat history to Azure ML |
| - Receives recommendations from Azure ML |
+-------------------------------+
|
v
+-------------------------------+
| store.js |
| - updateAnimationsStateEvent()|
| - Calls threejsCanvasEvent() with new command |
| - updateRecommendationsStateEvent() |
| - Sets $recommendations |
+-------------------------------+
|
v
+-------------------------------+
| threejsCanvasEvent(command) |
| - Calls mapAssetAttributesByCommand(command) |
| - Sets $animationAsset and $canvasTitle |
| - Initializes ThreeCanvas.instance |
+-------------------------------+
|
v
+-------------------------------+
| mapAttributes.js |
| - mapAssetAttributesByCommand(command) |
| - Retrieves attributes from commandMap and assetMap |
+-------------------------------+
|
v
+-------------------------------+
| commandMap.js |
| - Maps commands to assets |
+-------------------------------+
|
v
+-------------------------------+
| assetMap.js |
| - Defines asset details |
+-------------------------------+
|
v
+-------------------------------+
| ThreeCanvas |
| - Initializes 3D scene |
| - Loads asset based on attributes |
| - Supports various asset types (glb, fbx, mp4, png, multipleGlbs, multipleMp4s) |
| - Adds lighting and controls |
+-------------------------------+
|
v
+-------------------------------+
| ChatMessages Component |
| - Subscribes to $historyMessages |
| - Renders messages including typing animation |
+-------------------------------+
|
v
+-------------------------------+
| ChatRecommendationBar Component |
| - Subscribes to $recommendations |
| - Renders recommendation buttons |
+-------------------------------+
|
v
+-------------------------------+
| ChatBar Component |
| - Updates textarea with recommendation on click |
+-------------------------------+
|
v
End
+-------------------------------+
| Express Server |
| - Serves static files |
| - Handles API requests |
+-------------------------------+
|
v
+-------------------------------+
| /api/getSecret/:key |
| - Fetches secrets from Azure |
+-------------------------------+
|
v
| Azure Configuration Service |
| - Stores configuration data |
+-------------------------------+
+-------------------------------+
| Python Azure Function: |
| telecom_ai/__init__.py |
| - Handles AI chat processing |
| - Sends question and chat history to Azure ML endpoint |
| - Receives and processes AI response |
+-------------------------------+
|
v
+-------------------------------+
| Python Azure Function: |
| animation-helper/__init__.py |
| - Handles animation requests |
| - Sends question and chat history to Azure ML endpoint |
| - Receives and processes animation commands |
+-------------------------------+
|
v
+-------------------------------+
| Python Azure Function: |
| recommendation-helper/__init__.py |
| - Handles recommendation requests |
| - Sends question and chat history to Azure ML endpoint |
| - Receives and processes recommendations |
+-------------------------------+
Inside of GenAiGraphics project, you'll see the following folders and files:
genaipgraphics/
βββ .github/
β βββ workflows/
β βββ azure-static-web-apps-gentle-ocean-0e505290f.yml
β βββ main_vz-llm.yml
βββ dells-curry-python/
β βββ animation-helper/
β β βββ __init__.py
β β βββ function.json
β β βββ sample.dat
β βββ recommendation-helper/
β β βββ __init__.py
β β βββ function.json
β β βββ sample.dat
β βββ secrets-api/
β β βββ __init__.py
β β βββ function.json
β β βββ sample.dat
β βββ telecom_ai/
β β βββ __init__.py
β β βββ function.json
β β βββ sample.dat
β βββ .gitignore
β βββ host.json
β βββ requirements.txt
βββ tests/
β βββ babel.config.js
β βββ chat.test.js
β βββ jest.config.js
β βββ package-lock.json
β βββ package.json
β βββ README.md
βββ webapp/
β βββ config/
β β βββ astro.config.mjs
β β βββ config.js
β β βββ pretter.config.cjs
β β βββ tailwind.config.cjs
β β βββ tsconfig.json
β βββ public/
β β βββ images/
β β β βββ png/
β β β β βββ bot.png
β β β β βββ user.png
β β β βββ readme/
β β β β βββ brand-agent.png
β β β β βββ cable-router.png
β β β β βββ home-page.png
β β β β βββ router-green-button.png
β β β βββ svg/
β β β βββ favicon.svg
β β βββ models/
β β βββ fbx/
β β β βββ model_RouterDiff.png
β β β βββ model_RouterNrm.png
β β β βββ model_RouterOriginal.fbx
β β βββ glb/
β β β βββ model_BoomBox.glb
β β β βββ model_CreditCard.glb
β β β βββ model_DesktopPC.glb
β β β βββ model_EmojiHeart.glb
β β β βββ model_FilmClapperBoard.glb
β β β βββ model_FolderIcon.glb
β β β βββ model_Laptop.glb
β β β βββ model_LowPolyPhone.glb
β β β βββ model_MovieReel.glb
β β β βββ model_MusicIcons.glb
β β β βββ model_PhoneCallIcon.glb
β β β βββ model_PhoneRingIcon.glb
β β β βββ model_Plane.glb
β β β βββ model_RemoteControl.glb
β β β βββ model_RollingBag.glb
β β β βββ model_SaveToCloud.glb
β β β βββ model_SecurityCamera.glb
β β β βββ model_Sports.glb
β β β βββ model_Television.glb
β β β βββ model_VideoGameController.glb
β β β βββ model_VideoGameController2.glb
β β β βββ model_WifiExtender.glb
β β β βββ model_WifiIcon.glb
β β β βββ model_LogoAccenture.glb
β β β βββ model_Router90DegreeRotation.glb
β β β βββ model_RouterCableTexture.glb
β β β βββ model_RouterLightBlinkTexture.glb
β β β βββ model_RouterNoTexture.glb
β β β βββ model_RouterResetButtonTexture.glb
β β βββ gltf/
β β β βββ model_RouterCableTexture.gltf
β β β βββ model_RouterLightBlinkTexture.gltf
β β β βββ model_RouterNoTexture.gltf
β β β βββ model_RouterResetButtonTexture.gltf
β β βββ glsl/
β β β βββ earth.glsl
β β β βββ sphere.glsl
β β βββ mp4/
β β β βββ model_PhoneBlack.mp4
β β β βββ model_PhoneBlue.mp4
β β β βββ model_PhoneColorsAll.mp4
β β β βββ model_PhoneColorsMauve.mp4
β β β βββ model_PhoneColorsRed.mp4
β β β βββ model_PhoneColorsWhite.mp4
β β β βββ model_PhoneColorsYellow.mp4
β β β βββ model_House.mp4
β β β βββ model_House1stHalf.mp4
β β β βββ model_House2ndHalf.mp4
β β β βββ model_House2nd.mp4
β β β βββ model_HouseZoom.mp4
β β β βββ model_Upsell1st.mp4
β β β βββ model_Upsell2nd.mp4
β β β βββ model_Upsell3rd.mp4
β β β βββ model_Upsell4th.mp4
β β β βββ model_Upsell5th.mp4
β β β βββ model_UpsellPhoneColorsMultiStep1st.mp4
β β β βββ model_UpsellPhoneColorMultistep2nd.mp4
β β βββ spjs/
β β βββ torus.spjs
β β βββ sphere.spjs
β βββ src/
β β βββ api/
β β β βββ azureML.js
β β βββ components/
β β β βββ animations/
β β β β βββ Canvas.astro
β β β β βββ CanvasBar.astro
β β β β βββ CanvasScene.astro
β β β βββ common/
β β β β βββ Box.astro
β β β β βββ Card.astro
β β β β βββ CardHeader.astro
β β β β βββ CardHolder.astro
β β β β βββ Container.astro
β β β βββ messages/
β β β β βββ Chat.astro
β β β β βββ ChatBar.astro
β β β β βββ ChatMessages.astro
β β β β βββ ChatRecommendationBar.astro
β β β βββ primitives/
β β β β βββ Button.astro
β β β β βββ Link.astro
β β β β βββ Svg.astro
β β β βββ templates/
β β β βββ Footer.astro
β β β βββ Header.astro
β β β βββ Hero.astro
β β βββ data/
β β β βββ assets
β β β β βββ fbxAssets.js
β β β β βββ glbAssets.js
β β β β βββ glslAssets.js
β β β β βββ mp4Assets.js
β β β β βββ multipleGlbsAssets.js
β β β β βββ multipleMp4sAssets.js
β β β β βββ spjsAssets.js
β β β βββ text
β β β β βββ sampleMessageData.js
β β β β βββ sampleRecommendationsData.js
β β β βββ assetMap.js
β β β βββ baseCommand.js
β β β βββ commandMap.js
β β βββ graphics/
β β β βββ core/
β β β β βββ WebGL.js
β β β βββ shader/
β β β β βββ fragmentShader.glsl
β β β β βββ vertexShader.glsl
β β β βββutils/
β β β β βββ OrbitControls.ts
β β β βββ ThreeCanvas.ts
β β βββ layouts/
β β β βββ Layout.astro
β β βββ pages/
β β β βββ agent.astro
β β β βββ index.astro
β β βββ stores/
β β β βββ store.js
β β βββ styles/
β β βββ classStyles.js
β β βββ svgStyles.js
β βββ types/
β β βββ env.d.ts
β β βββ env.d.ts
β β βββ glsl.d.ts
β βββ .env
β βββ package.json
β βββ server.cjs
β βββ README.md
βββ .gitignore
βββ README.md
Astro looks for .astro
or .md
files in the src/pages/
directory. Each page is exposed as a route based on its file name.
There's nothing special about src/components/
, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
Any static assets, like images, can be placed in the public/
directory.
All commands are run from the root of the project, from a terminal:
Command | Action |
---|---|
npm install |
Installs dependencies |
npm run dev |
Starts local dev server at localhost:3000 |
npm run build |
Build your production site to ./dist/ |
npm run preview |
Preview your build locally, before deploying |
npm run astro ... |
Run CLI commands like astro add , astro check |
npm run astro -- --help |
Get help using the Astro CLI |
Feel free to check our documentation or jump into our Discord server. .