Skip to content

Application merges WebGL technology with Three.js for 3D rendering and Azure ML for AI chat functionalities, 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 πŸ‘Ύ

Notifications You must be signed in to change notification settings

mollybeach/genaigraphics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GenAiGraphics - πŸ‘Ύ 3D Graphics Rendering and AI Chat Application πŸ’¬

Check out the site!: GenAiGraphics Password: NINEgoal123@*

Project Overview πŸ’»

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.

Key Features

Visual Technology Setup Assistance πŸ”Œ:

  • 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.

WebGL Integration 🌐:

  • Utilizes Three.js within a core WebGL class to manage rendering, scenes, camera control, resizing events, and frame animations.

Astro Framework πŸš€:

  • 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 Chat Functionality πŸ€–:

  • AI-driven chatbot powered by Azure ML Prompt Flow handles user queries and provides intelligent responses and recommendations.

Server-Side Operations πŸ–₯️:

  • An Express server acts as middleware, managing API requests using Axios, handling CORS, and logging requests.

Robust Tooling and Configuration πŸ› οΈ:

  • Employs TypeScript for static typing and robust tooling. Npm scripts manage build and development processes efficiently.

Styling with TailwindCSS 🎨:

  • TailwindCSS is integrated for rapid UI development with utility-first CSS.

Getting Started πŸ”§

1. Installation

Clone the repository:

git clone https://github.com/mollybeach/genaigraphics.git

2. Navigate into the project directory:

cd genaigraphics
cd webapp

3. Install the dependencies:

npm install

4. Start the application:

npm run start

genaigraphics Application Screenshot

Application Screenshots πŸ“Έ Lighting Sculpture Router Green Button Brand Agent Cable Router Home Page Model BoomBox Model Wifi Extender Model Laptop Router Green Button Home Page

How it Works πŸ› 

1. User Interaction πŸ–±οΈ:

  • The user types a question into the ChatBar Component and submits it.

2. Initial Store Update πŸ”„:

  • The store.js triggers the updateMessagesStateEvent(), setting the $question store, adding the message to $historyMessages, and calling threejsCanvasEvent("loadingcircle") to display a loading indicator.

3. Azure ML Interaction ☁️:

  • 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.

4. Handling Azure ML Responses πŸ“©:

  • 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.

5. Updating Animations and Recommendations πŸ”§:

  • Azure ML returns animation commands, which store.js uses to update animations via threejsCanvasEvent().
  • It also fetches recommendation commands and updates the recommendations.

6. Rendering and 3D Visualization 🎨:

  • 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.

7. Chat Components πŸ’¬:

  • 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.️

Application Flowchart 🌐

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

Server-Side Operations

+-------------------------------+
| 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 Functions

+-------------------------------+
| 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 |
+-------------------------------+

Project Structure πŸ“

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.

🧞 Commands

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

πŸ‘€ Want to learn more?

Feel free to check our documentation or jump into our Discord server. .

About

Application merges WebGL technology with Three.js for 3D rendering and Azure ML for AI chat functionalities, 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 πŸ‘Ύ

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published