Skip to content

Commit a89b16d

Browse files
authored
Update monday.mdx
1 parent 23645e1 commit a89b16d

File tree

1 file changed

+24
-88
lines changed

1 file changed

+24
-88
lines changed

docs/showcase/monday.mdx

Lines changed: 24 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Before using Monday, ensure you have:
4444

4545
## Installation
4646

47+
```bash
4748
# Clone the repository
4849
git clone https://github.com/srivastavanik/monday.git
4950
cd monday
@@ -58,13 +59,12 @@ PERPLEXITY_API_KEY=your_api_key
5859
ELEVENLABS_API_KEY=your_api_key
5960
YOUTUBE_API_KEY=your_api_key
6061

61-
#Start Backend Server (Terminal 1)
62+
# Start Backend Server (Terminal 1)
6263
node backend-server.js
6364

6465
# Start frontend
6566
npm run dev
6667

67-
6868
## Usage
6969

7070
1. Launch the app in your browser.
@@ -79,32 +79,10 @@ npm run dev
7979
- Interactive 3D models (when relevant)
8080

8181
## Code Explanation
82-
Voice Capture (Frontend)
83-
ts
84-
CopyEdit
85-
// Captures finalized speech recognition results and forwards them to the command processor.
86-
this.recognition.onresult = (event: SpeechRecognitionEvent) => {
87-
let finalTranscript = ''
88-
for (let i = event.resultIndex; i < event.results.length; i++) {
89-
if (event.results[i].isFinal) {
90-
finalTranscript += event.results[i][0].transcript
91-
}
92-
}
93-
if (finalTranscript) {
94-
console.log('VoiceController: 🎤 Final transcript:', finalTranscript)
95-
this.currentTranscript = finalTranscript
96-
this.onTranscriptChange?.(finalTranscript)
97-
// Send directly to command processor—no filtering here
98-
this.commandProcessor.queueCommand(finalTranscript, Date.now())
99-
}
100-
}
10182

102-
Description.
103-
The client’s VoiceSystemController uses the Web Speech API to continuously listen for speech. In the onresult handler above, any finalized recognition result is captured as finalTranscript and immediately forwarded to the command-processing system via queueCommand. This converts spoken input into text and injects it into the pipeline without local filtering, delegating interpretation to the command processor.
83+
# Voice Command Processing & Activation (Frontend)
10484

105-
Voice Command Processing & Activation (Frontend)
106-
ts
107-
CopyEdit
85+
```ts
10886
private async processCommand(event: CommandEvent): Promise<void> {
10987
const normalizedTranscript = event.transcript.toLowerCase().trim()
11088
const isActivation = normalizedTranscript.includes('hey monday')
@@ -139,13 +117,11 @@ private async processCommand(event: CommandEvent): Promise<void> {
139117
140118
event.processed = true
141119
}
120+
Description:
121+
The CommandProcessor manages voice-command routing and conversation context on the client. It checks whether the transcript contains the wake phrase (“hey monday”) or an ongoing conversation is active. Only then is the user’s command treated as actionable. On activation, it may start a new conversation session, timestamp the interaction, and dispatch the raw transcript to the backend (sendToBackend). Inputs outside an active session without the trigger phrase are ignored.
142122
143-
Description.
144-
The CommandProcessor manages voice-command routing and conversation context on the client. It checks whether the transcript contains the wake phrase (“hey monday”) or an ongoing conversation is active. Only then is the user’s command treated as actionable. On activation, it may start a new conversation session, timestamp the interaction, and dispatch the raw transcript to the backend (sendToBackend). Inputs outside an active session without the trigger phrase are ignored.
123+
#Backend Voice Command Handler (Socket.IO Server)
145124
146-
Backend Voice Command Handler (Socket.IO Server)
147-
ts
148-
CopyEdit
149125
socket.on('voice_command', async (data: any) => {
150126
logger.info('Voice command received', { socketId: socket.id, command: data.command?.substring(0, 50) })
151127
@@ -225,13 +201,13 @@ socket.on('voice_command', async (data: any) => {
225201
// ... (spatial and focus commands omitted for brevity)
226202
}
227203
})
204+
# Description
205+
The server receives voice_command events and parses them to infer intent (e.g., greeting, basic Q&A, reasoning, deep research). For each type, it invokes the Perplexity service with the corresponding mode and the user’s query. The resulting answer—including content, citations, and, where applicable, a reasoning chain or research sources—is emitted back to the client as a monday_response with a type aligned to the mode.
228206
229-
Description.
230-
The server receives voice_command events and parses them to infer intent (e.g., greeting, basic Q&A, reasoning, deep research). For each type, it invokes the Perplexity service with the corresponding mode and the user’s query. The resulting answer—including content, citations, and, where applicable, a reasoning chain or research sources—is emitted back to the client as a monday_response with a type aligned to the mode.
231-
232-
AI Query Processing (Perplexity Service Integration)
207+
#AI Query Processing (Perplexity Service Integration)
233208
ts
234-
CopyEdit
209+
Copy
210+
Edit
235211
const result = await this.makeRequest('/chat/completions', requestData)
236212
return {
237213
id: result.id || 'reasoning_query',
@@ -244,13 +220,14 @@ return {
244220
responseTime: 0
245221
}
246222
}
223+
Description
224+
PerplexityService prepares a mode-specific request and calls the external API. It returns a structured result containing the main answer (content), any citations, and—when in reasoning mode—a parsed list of reasoning steps. Using the Sonar API, it also includes metadata such as token usage and the model identifier.
247225
248-
Description.
249-
PerplexityService prepares a mode-specific request and calls the external API. It returns a structured result containing the main answer (content), any citations, and—when in reasoning mode—a parsed list of reasoning steps. Using the Sonar API, It also includes metadata such as token usage and the model identifier.
250226
251-
Reasoning Workflow — Extracting Step-by-Step Logic
227+
#Reasoning Workflow — Extracting Step-by-Step Logic
252228
ts
253-
CopyEdit
229+
Copy
230+
Edit
254231
private extractReasoningSteps(content: string): ReasoningStep[] {
255232
const steps: ReasoningStep[] = []
256233
const lines = content.split('\n')
@@ -271,13 +248,13 @@ private extractReasoningSteps(content: string): ReasoningStep[] {
271248
}
272249
return steps
273250
}
251+
Description
252+
In reasoning mode, answers are expected to include an ordered thought process. This utility scans the text for step indicators (e.g., “Step 1:” or “1.”), producing a structured array of steps with content and an initial confidence score. This enables the client to render reasoning as a clear, enumerated sequence.
274253
275-
Description.
276-
In reasoning mode, answers are expected to include an ordered thought process. This utility scans the text for step indicators (e.g., “Step 1:or1.”), producing a structured array of steps with content and an initial confidence score. This enables the client to render reasoning as a clear, enumerated sequence.
277-
278-
VR Spatial Response Visualization
254+
#VR Spatial Response Visualization
279255
ts
280-
CopyEdit
256+
Copy
257+
Edit
281258
function createSpatialPanels(response: any, mode: string, query: string): any[] {
282259
const panels: any[] = []
283260
@@ -333,50 +310,9 @@ function createSpatialPanels(response: any, mode: string, query: string): any[]
333310
return panels
334311
}
335312
336-
Description.
337-
To bridge AI output into a 3D presentation, the backend constructs spatial panel objects. A main content panel is centered; optional citations and reasoning panels are positioned to the sides. Each panel has an ID, type, position/rotation, title, content, and opacity. These definitions are sent with the response so the client can render floating informational boards in VR.
338-
339-
Spatial Orchestration & Layout (Frontend VR)
340-
ts
341-
CopyEdit
342-
useFrame(() => {
343-
// Continuously rotate the entire group of panels slowly
344-
if (groupRef.current) {
345-
groupRef.current.rotation.y += 0.001
346-
}
347-
348-
// Dynamic layout based on mode
349-
panels.forEach((panel, index) => {
350-
if (spatialLayout === 'focus' && panel.id !== activePanel) {
351-
// In focus mode, push non-active panels far outward
352-
const distance = 5
353-
const angle = (index / panels.length) * Math.PI * 2
354-
panel.position[0] = Math.cos(angle) * distance
355-
panel.position[2] = Math.sin(angle) * distance
356-
357-
} else if (spatialLayout === 'research') {
358-
// In research mode, distribute panels in a layered circle (knowledge constellation)
359-
const radius = 3
360-
const layer = Math.floor(index / 6)
361-
const angleStep = (Math.PI * 2) / Math.min(6, panels.length - layer * 6)
362-
const angle = (index % 6) * angleStep
363-
panel.position[0] = Math.cos(angle) * (radius + layer * 1.5)
364-
panel.position[1] = 1.6 + layer * 0.5
365-
panel.position[2] = Math.sin(angle) * (radius + layer * 1.5)
366-
367-
} else {
368-
// Default layout: semi-circle in front of the user
369-
const angle = (index / Math.max(panels.length - 1, 1)) * Math.PI - Math.PI / 2
370-
const radius = 2.5
371-
panel.position[0] = Math.cos(angle) * radius
372-
panel.position[1] = 1.6 + Math.sin(index * 0.5) * 0.3
373-
panel.position[2] = Math.sin(angle) * radius * 0.5 - 1
374-
}
375-
})
376-
})
313+
Description
314+
To bridge AI output into a 3D presentation, the backend constructs spatial panel objects. A main content panel is centered; optional citations and reasoning panels are positioned to the sides. Each panel has an ID, type, position/rotation, title, content, and opacity. These definitions are sent with the response so the client can render floating informational boards in VR.
377315
378-
Description.
379-
SpatialOrchestrator renders panels in VR and animates placement per the current layout. Default mode arranges panels in a semi-circle ahead of the user. Focus mode pushes non-active panels outward to minimize distraction. Research mode distributes panels into layered circular constellations to accommodate more nodes. The layout logic runs every frame for smooth transitions.
380316
## Links
381317
382318
- [GitHub Repository](https://github.com/srivastavanik/monday/tree/final)

0 commit comments

Comments
 (0)