File size: 14,930 Bytes
5a81b95
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
# πŸ—οΈ WidgeTDC PowerPoint Integration - Architecture

## System Overview

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚               WIDGETDC FRONTEND (React 19)                  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  Autonomous PowerPoint Master v2.0                    β”‚  β”‚
β”‚  β”‚  β€’ Real-time WebSocket updates                        β”‚  β”‚
β”‚  β”‚  β€’ Multi-agent orchestration UI                       β”‚  β”‚
β”‚  β”‚  β€’ Quality metrics visualization                      β”‚  β”‚
β”‚  β”‚  β€’ Slide preview & download                           β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚ WebSocket / REST
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            WIDGETDC BACKEND (Node.js/Express)                β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚         Multi-Agent Orchestrator                      β”‚  β”‚
β”‚  β”‚  β€’ Agent lifecycle management                         β”‚  β”‚
β”‚  β”‚  β€’ Parallel execution coordinator                     β”‚  β”‚
β”‚  β”‚  β€’ Real-time progress streaming                       β”‚  β”‚
β”‚  β”‚  β€’ Quality loop orchestration                         β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚
β”‚  β”‚ PPTAgent      β”‚ ChatPPT-MCP    β”‚ Template       β”‚         β”‚
β”‚  β”‚ Service       β”‚ Service        β”‚ Service        β”‚         β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚               β”‚                β”‚
           β–Ό               β–Ό                β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  PPTAgent    β”‚  β”‚ MultiAgent   β”‚  β”‚  ChatPPT     β”‚
β”‚  Docker      β”‚  β”‚  System      β”‚  β”‚  MCP Server  β”‚
β”‚  :9297       β”‚  β”‚  :10001      β”‚  β”‚  :8088       β”‚
β”‚  :8088       β”‚  β”‚  :10011      β”‚  β”‚              β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚                 β”‚                  β”‚
       β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”         β”‚
       β”‚   β”‚                      β”‚         β”‚
       β”‚   β–Ό                      β–Ό         β”‚
       β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
       β”‚ β”‚Research β”‚         β”‚Research β”‚   β”‚
       β”‚ β”‚Agent 1  β”‚         β”‚Agent 2  β”‚   β”‚
       β”‚ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜   β”‚
       β”‚      β”‚                   β”‚         β”‚
       β”‚      β–Ό                   β–Ό         β”‚
       β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
       β”‚ β”‚   Knowledge Base (MCP)      β”‚   β”‚
       β”‚ β”‚   β€’ Neo4j                   β”‚   β”‚
       β”‚ β”‚   β€’ RAG Vector DB           β”‚   β”‚
       β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
       β”‚                                   β”‚
       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                       β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚                              β”‚
        β–Ό                              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ PostgreSQL   β”‚              β”‚  Zenodo10K   β”‚
β”‚ :5433        β”‚              β”‚  Dataset     β”‚
β”‚ (Metadata)   β”‚              β”‚ (Templates)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

## Component Details

### Frontend Layer

**Autonomous PowerPoint Master v2.0 Widget**
- React 19 functional component
- WebSocket client for real-time updates
- Progress visualization for all stages
- Slide preview grid
- Quality metrics dashboard (PPTEval scores)
- Download interface

**Key Features:**
- Real-time streaming of generation progress
- Multi-stage pipeline visualization
- Agent activity monitoring
- Quality score display (Content, Design, Coherence)
- Responsive layout optimized for WidgeTDC grid

### Backend Layer

**Multi-Agent Orchestrator**
```typescript
class MultiAgentOrchestrator {
  // Stage 1: Outline generation
  runOutlineAgent() 
  
  // Stage 2: Parallel research (3x agents)
  runParallelResearch()
  
  // Stage 3: Slide generation with quality loops
  runPPTGeneration()
  
  // Stage 4: Export to .pptx
  exportPresentation()
}
```

**Services:**

1. **PPTAgent Service**
   - 2-stage generation: Analysis β†’ Generation
   - Reference presentation learning
   - PPTEval quality assessment
   - Python-pptx integration

2. **ChatPPT-MCP Service**
   - Enterprise PPT APIs (18 endpoints)
   - Template application
   - Color scheme customization
   - Online editing capabilities

3. **Template Service**
   - Zenodo10K dataset integration
   - Pattern extraction
   - Layout analysis
   - Style learning

### External Services

**PPTAgent (Docker)**
```yaml
Port: 9297 (API), 8088 (UI)
Models:
  - Language: Qwen2.5-72B-Instruct
  - Vision: gpt-4o-2024-08-06
  - Embeddings: text-embedding-3-small
Features:
  - 2-stage generation
  - PPTEval framework
  - Reference learning
```

**MultiAgentPPT**
```yaml
Outline Service: Port 10001
Slides Service: Port 10011
Download Service: Port 10021
Agents:
  - OutlineAgent: GPT-4/Claude
  - ResearchAgent x3: Parallel execution
  - PPTGenAgent: Loop generation
  - QualityChecker: 3-retry validation
Features:
  - A2A (Agent2Agent) communication
  - MCP protocol support
  - Streaming responses
  - RAG integration
```

**ChatPPT-MCP**
```yaml
URL: https://api.yoo-ai.com/mcp (eller self-hosted)
APIs: 18 professional endpoints
Features:
  - Theme generation
  - Document conversion
  - Template application
  - Online editing
```

### Data Layer

**PostgreSQL Database**
```sql
-- Presentations table
CREATE TABLE presentations (
  id SERIAL PRIMARY KEY,
  topic VARCHAR(255),
  file_path VARCHAR(512),
  created_at TIMESTAMP,
  quality_scores JSONB,
  metadata JSONB
);

-- Slides table
CREATE TABLE slides (
  id SERIAL PRIMARY KEY,
  presentation_id INTEGER REFERENCES presentations(id),
  slide_number INTEGER,
  type VARCHAR(50),
  title VARCHAR(255),
  content TEXT,
  created_at TIMESTAMP
);

-- Templates table (from Zenodo10K)
CREATE TABLE templates (
  id SERIAL PRIMARY KEY,
  name VARCHAR(255),
  source_file VARCHAR(512),
  patterns JSONB,
  layouts JSONB,
  created_at TIMESTAMP
);
```

**Redis Cache**
```
# Template patterns cache
template:patterns:{template_id} -> JSON
TTL: 3600 seconds

# Quality scores cache
quality:scores:{presentation_id} -> JSON
TTL: 7200 seconds

# Agent status
agent:status:{agent_id} -> JSON
TTL: 300 seconds
```

## Data Flow

### Generation Pipeline

```
1. USER INPUT
   ↓
   Topic: "AI in Healthcare 2025"
   Requirements: "Target medical professionals"

2. ORCHESTRATOR
   ↓
   Initialize agents
   Start WebSocket stream

3. OUTLINE AGENT
   ↓
   GPT-4 generates outline:
   - 8-12 main sections
   - 2-3 subsections each
   - Key points per section
   ↓
   Stream to frontend: { stage: 'outline', progress: 100, data: outline }

4. RESEARCH AGENTS (Parallel)
   ↓
   Agent 1: Research Section 1,4,7
   Agent 2: Research Section 2,5,8
   Agent 3: Research Section 3,6,9
   ↓
   Each uses MCP to search knowledge base:
   - Neo4j graph queries
   - Vector similarity search
   - External API calls
   ↓
   Synthesize findings with GPT-4
   ↓
   Stream to frontend: { stage: 'research', progress: 33/66/100 }

5. PPT GENERATION (Loop per slide)
   ↓
   FOR EACH section:
     Generate slide with PPTAgent
     ↓
     Check quality with QualityChecker
     ↓
     IF quality < threshold (content<7, design<7, coherence<7):
       Retry with feedback (max 3 attempts)
     ELSE:
       Accept slide
     ↓
     Stream to frontend: { stage: 'generation', progress: X%, data: { slide } }

6. EXPORT
   ↓
   Call python-pptx backend
   Generate .pptx file
   Save to /presentations/
   ↓
   Stream to frontend: { stage: 'export', progress: 100, data: { filePath } }

7. QUALITY ASSESSMENT
   ↓
   Run PPTEval on complete presentation:
   - Content score (accuracy, relevance)
   - Design score (visual appeal, consistency)
   - Coherence score (logical flow)
   ↓
   Return scores to frontend

8. COMPLETE
   ↓
   User downloads .pptx
   (Optional) Apply enterprise template via ChatPPT-MCP
```

## API Endpoints

### Backend REST API

```typescript
// Generate presentation
POST /api/presentations/generate
Body: {
  topic: string,
  requirements?: string,
  templateId?: string
}
Response: {
  success: boolean,
  filePath: string,
  outline: Outline,
  slides: Slide[],
  qualityScores: QualityScores
}

// Get presentation status
GET /api/presentations/:id/status
Response: {
  status: 'generating' | 'complete' | 'failed',
  progress: number,
  currentStage: string
}

// Download presentation
GET /api/presentations/:id/download
Response: File (.pptx)

// Get quality evaluation
GET /api/presentations/:id/evaluation
Response: {
  content: number,
  design: number,
  coherence: number,
  suggestions: string[]
}
```

### WebSocket API

```typescript
// Connect to generation stream
WebSocket: ws://localhost:3000/ppt-generation

// Messages from server
{
  type: 'progress',
  stage: 'outline' | 'research' | 'generation' | 'export',
  progress: number (0-100),
  data?: any
}

{
  type: 'slide-generated',
  slide: Slide,
  index: number,
  total: number
}

{
  type: 'complete',
  filePath: string,
  qualityScores: QualityScores
}

{
  type: 'error',
  error: string,
  stage: string
}
```

## Agent Communication

### A2A (Agent2Agent) Protocol

```typescript
// Outline β†’ Research agents
{
  protocol: 'A2A',
  from: 'outline-agent',
  to: 'research-agent-1',
  action: 'research',
  payload: {
    section: Section,
    keywords: string[],
    priority: 'high'
  }
}

// Research β†’ PPT Gen agent
{
  protocol: 'A2A',
  from: 'research-agent-1',
  to: 'ppt-gen-agent',
  action: 'generate-slide',
  payload: {
    section: Section,
    research: ResearchResult,
    template: TemplatePattern
  }
}

// PPT Gen β†’ Quality Checker
{
  protocol: 'A2A',
  from: 'ppt-gen-agent',
  to: 'quality-checker-agent',
  action: 'validate',
  payload: {
    slide: Slide,
    criteria: {
      minContentScore: 7.0,
      minDesignScore: 7.0,
      minCoherenceScore: 7.0
    }
  }
}
```

### MCP (Model Context Protocol)

```typescript
// Knowledge base search
{
  protocol: 'MCP',
  tool: 'knowledge-search',
  parameters: {
    query: string,
    top_k: number,
    filters: { type: string, date_range?: [string, string] }
  }
}

// Neo4j graph query
{
  protocol: 'MCP',
  tool: 'neo4j-query',
  parameters: {
    cypher: string,
    params: Record<string, any>
  }
}

// Template pattern extraction
{
  protocol: 'MCP',
  tool: 'extract-template-patterns',
  parameters: {
    file_path: string,
    analysis_type: 'layout' | 'color' | 'typography'
  }
}
```

## Quality Assurance

### PPTEval Framework

**Content Score (0-10)**
- Accuracy: Facts correct?
- Relevance: On-topic?
- Completeness: All key points?
- Clarity: Easy to understand?

**Design Score (0-10)**
- Visual appeal: Attractive?
- Consistency: Uniform styling?
- Layout: Well-organized?
- Readability: Font sizes appropriate?

**Coherence Score (0-10)**
- Logical flow: Makes sense?
- Transitions: Smooth connections?
- Structure: Clear organization?
- Narrative: Story flows well?

### Quality Loop

```
Generate Slide
    ↓
Evaluate Quality
    ↓
Score < 7.0? ──YES─→ Retry (Max 3x)
    ↓ NO               ↓
Accept Slide β†β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

## Scaling & Performance

### Horizontal Scaling

```yaml
# Scale research agents
docker-compose scale research-agent=5

# Scale orchestrator workers
docker-compose scale orchestrator=3
```

### Caching Strategy

```
Level 1: Redis (Hot cache)
  - Template patterns
  - Recent presentations
  - Agent status

Level 2: PostgreSQL (Warm storage)
  - Presentation metadata
  - Quality scores
  - User preferences

Level 3: File System (Cold storage)
  - .pptx files
  - Template library
  - Training data
```

### Performance Metrics

**Target Times:**
- Outline generation: 10-15s
- Research (3 agents): 20-30s
- Slide generation (per slide): 15-20s
- Quality check: 5s
- Export: 5-10s

**Total:** 8-12 slides in 3-5 minutes

## Security

### API Key Management

```env
# Stored in .env (never committed)
OPENAI_API_KEY=sk-...
CHATPPT_API_KEY=...

# Accessed via process.env in backend
# Never exposed to frontend
```

### CORS Policy

```typescript
app.use(cors({
  origin: ['http://localhost:5173', 'http://localhost:3000'],
  credentials: true
}));
```

### Rate Limiting

```typescript
rateLimit({
  windowMs: 15 * 60 * 1000, // 15 minutes
  max: 100 // limit each IP to 100 requests per windowMs
})
```

---

**Version:** 2.0.0  
**Last Updated:** December 2024  
**Architecture:** Multi-Agent + MCP + Docker Microservices