-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathembedding_guide.html
More file actions
366 lines (324 loc) · 10.7 KB
/
embedding_guide.html
File metadata and controls
366 lines (324 loc) · 10.7 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Oversight AI - Embedding Guide</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 1.6;
color: #333;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
background: #f8f9fa;
}
.container {
background: white;
padding: 30px;
border-radius: 10px;
box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
h1, h2, h3 {
color: #667eea;
}
h1 {
text-align: center;
margin-bottom: 30px;
font-size: 2.5rem;
}
.code-block {
background: #f8f9fa;
border: 1px solid #ddd;
border-radius: 6px;
padding: 15px;
margin: 15px 0;
overflow-x: auto;
font-family: 'Courier New', monospace;
font-size: 14px;
}
.example-section {
margin: 30px 0;
padding: 20px;
border: 2px solid #667eea;
border-radius: 8px;
background: #f8f9ff;
}
.iframe-demo {
border: 2px solid #ddd;
border-radius: 8px;
margin: 20px 0;
}
table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
}
th, td {
border: 1px solid #ddd;
padding: 12px;
text-align: left;
}
th {
background: #667eea;
color: white;
}
.note {
background: #fff3cd;
border: 1px solid #ffeaa7;
border-radius: 6px;
padding: 15px;
margin: 15px 0;
}
.warning {
background: #f8d7da;
border: 1px solid #f5c6cb;
border-radius: 6px;
padding: 15px;
margin: 15px 0;
}
</style>
</head>
<body>
<div class="container">
<h1>Oversight AI - Embedding Guide</h1>
<h2>Overview</h2>
<p>Oversight AI can be easily embedded into any website using iframes. We provide multiple embedding options to suit different use cases and space constraints.</p>
<h2>Available Embedding Options</h2>
<table>
<thead>
<tr>
<th>Version</th>
<th>URL</th>
<th>Recommended Size</th>
<th>Best For</th>
</tr>
</thead>
<tbody>
<tr>
<td>Full Interface</td>
<td>/</td>
<td>800x600px or larger</td>
<td>Dedicated pages, large sidebars</td>
</tr>
<tr>
<td>Embeddable</td>
<td>/embed</td>
<td>600x500px or larger</td>
<td>Blog posts, content pages</td>
</tr>
<tr>
<td>Minimal</td>
<td>/embed/minimal</td>
<td>400x400px or larger</td>
<td>Small widgets, mobile views</td>
</tr>
</tbody>
</table>
<h2>Basic Embedding</h2>
<h3>Standard Embed (Recommended)</h3>
<div class="code-block">
<iframe
src="http://localhost:12000/embed"
width="600"
height="500"
frameborder="0"
style="border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.1);">
</iframe>
</div>
<h3>Minimal Embed (For Small Spaces)</h3>
<div class="code-block">
<iframe
src="http://localhost:12000/embed/minimal"
width="400"
height="400"
frameborder="0"
style="border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.1);">
</iframe>
</div>
<h2>Responsive Embedding</h2>
<h3>CSS for Responsive Iframe</h3>
<div class="code-block">
<style>
.oversight-ai-container {
position: relative;
width: 100%;
max-width: 800px;
height: 0;
padding-bottom: 75%; /* 4:3 Aspect Ratio */
margin: 20px auto;
}
.oversight-ai-iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: none;
border-radius: 8px;
box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
</style>
<div class="oversight-ai-container">
<iframe
class="oversight-ai-iframe"
src="http://localhost:12000/embed">
</iframe>
</div>
</div>
<h2>Advanced Configuration</h2>
<h3>Custom Styling</h3>
<p>You can customize the appearance of the embedded widget by wrapping it in a container with custom CSS:</p>
<div class="code-block">
<div style="
border: 2px solid #667eea;
border-radius: 12px;
padding: 10px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
box-shadow: 0 8px 25px rgba(0,0,0,0.2);
">
<iframe
src="http://localhost:12000/embed"
width="600"
height="500"
frameborder="0"
style="border-radius: 8px; width: 100%;">
</iframe>
</div>
</div>
<h3>JavaScript Integration</h3>
<p>For advanced integration, you can communicate with the embedded iframe using postMessage:</p>
<div class="code-block">
<script>
// Listen for messages from the embedded Oversight AI
window.addEventListener('message', function(event) {
if (event.origin !== 'http://localhost:12000') return;
// Handle messages from the embedded app
if (event.data.type === 'analysis_complete') {
console.log('Analysis completed:', event.data.sessionId);
// Your custom handling here
}
});
// Send messages to the embedded app
function sendTopicToOversightAI(topic) {
const iframe = document.getElementById('oversight-ai-iframe');
iframe.contentWindow.postMessage({
type: 'set_topic',
topic: topic
}, 'http://localhost:12000');
}
</script>
</div>
<h2>Security Considerations</h2>
<div class="warning">
<strong>Important:</strong> When embedding in production, make sure to:
<ul>
<li>Use HTTPS for both your site and the Oversight AI server</li>
<li>Configure proper CORS settings</li>
<li>Consider implementing Content Security Policy (CSP) headers</li>
<li>Validate that the iframe source is from a trusted domain</li>
</ul>
</div>
<h2>Live Examples</h2>
<div class="example-section">
<h3>Standard Embed Example</h3>
<p>This is how the standard embeddable version looks:</p>
<div class="iframe-demo">
<iframe
src="http://localhost:12000/embed"
width="100%"
height="500"
frameborder="0"
style="border-radius: 8px;">
</iframe>
</div>
</div>
<div class="example-section">
<h3>Minimal Embed Example</h3>
<p>This is how the minimal version looks in a smaller space:</p>
<div class="iframe-demo" style="max-width: 400px; margin: 20px auto;">
<iframe
src="http://localhost:12000/embed/minimal"
width="100%"
height="400"
frameborder="0"
style="border-radius: 8px;">
</iframe>
</div>
</div>
<h2>API Integration</h2>
<p>For more advanced integrations, you can also use the REST API directly:</p>
<div class="code-block">
// Example API usage
fetch('http://localhost:12000/api/analyze', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
topic: 'Artificial Intelligence',
report_type: 'detailed'
})
})
.then(response => response.json())
.then(data => {
if (data.success) {
console.log('Analysis completed:', data);
// Handle the results
}
});
</div>
<h2>Available API Endpoints</h2>
<table>
<thead>
<tr>
<th>Endpoint</th>
<th>Method</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>/api/analyze</td>
<td>POST</td>
<td>Start a new analysis</td>
</tr>
<tr>
<td>/api/status/{session_id}</td>
<td>GET</td>
<td>Get processing status</td>
</tr>
<tr>
<td>/api/results/{session_id}</td>
<td>GET</td>
<td>Get analysis results</td>
</tr>
<tr>
<td>/api/download/{session_id}</td>
<td>GET</td>
<td>Download report as text file</td>
</tr>
<tr>
<td>/api/report-types</td>
<td>GET</td>
<td>Get available report types</td>
</tr>
</tbody>
</table>
<div class="note">
<strong>Note:</strong> Replace <code>http://localhost:12000</code> with your actual Oversight AI server URL when deploying to production.
</div>
<h2>Troubleshooting</h2>
<h3>Common Issues</h3>
<ul>
<li><strong>Iframe not loading:</strong> Check CORS settings and ensure the server is running</li>
<li><strong>Styling issues:</strong> Verify iframe dimensions and CSS conflicts</li>
<li><strong>API errors:</strong> Check network connectivity and API endpoint URLs</li>
<li><strong>Cross-origin issues:</strong> Ensure proper CORS configuration on the server</li>
</ul>
<h3>Support</h3>
<p>For additional support or custom integration requirements, please refer to the project documentation or contact the development team.</p>
</div>
</body>
</html>