File size: 20,100 Bytes
c47b328
ecd2a2b
c47b328
 
 
ecd2a2b
c47b328
 
 
 
 
 
 
 
8b0d35f
ecd2a2b
8b0d35f
c47b328
 
 
 
 
 
ecd2a2b
 
c47b328
 
 
ecd2a2b
 
 
 
c47b328
 
 
02fc4de
c47b328
ecd2a2b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c47b328
 
 
 
 
 
 
02fc4de
 
 
ecd2a2b
 
 
c47b328
 
 
 
ecd2a2b
c47b328
 
 
 
 
 
ecd2a2b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c47b328
 
 
 
 
 
 
ecd2a2b
 
 
02fc4de
 
 
ecd2a2b
 
 
 
 
02fc4de
 
 
 
 
 
 
ecd2a2b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c47b328
 
ecd2a2b
 
 
 
 
 
 
e63d6ec
 
 
ecd2a2b
 
 
 
3e17c77
ecd2a2b
 
3e17c77
ecd2a2b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c47b328
 
ecd2a2b
 
c47b328
ecd2a2b
c47b328
 
 
 
 
 
 
 
 
 
ecd2a2b
c47b328
 
 
 
ecd2a2b
 
c47b328
 
 
ecd2a2b
c47b328
 
 
 
ecd2a2b
c47b328
 
ecd2a2b
c47b328
 
02fc4de
ecd2a2b
02fc4de
ecd2a2b
02fc4de
ecd2a2b
 
 
02fc4de
c47b328
 
ecd2a2b
 
 
c47b328
02fc4de
ecd2a2b
 
 
 
 
 
02fc4de
 
c47b328
 
ecd2a2b
e63d6ec
 
c47b328
 
 
 
ecd2a2b
02fc4de
 
 
ecd2a2b
b218933
 
ecd2a2b
 
c47b328
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ecd2a2b
c47b328
 
 
 
 
 
02fc4de
c47b328
 
 
 
 
ecd2a2b
c47b328
 
 
 
ecd2a2b
c47b328
 
 
 
02fc4de
c47b328
 
85d983d
c47b328
 
 
 
 
 
 
 
ecd2a2b
c47b328
 
 
02fc4de
 
ecd2a2b
02fc4de
ecd2a2b
02fc4de
ecd2a2b
02fc4de
ecd2a2b
02fc4de
 
 
 
 
ecd2a2b
c47b328
 
02fc4de
 
ecd2a2b
02fc4de
 
c47b328
ecd2a2b
c47b328
02fc4de
c47b328
 
 
02fc4de
 
 
 
 
 
ecd2a2b
02fc4de
 
 
 
ecd2a2b
02fc4de
 
 
 
 
 
 
 
 
 
 
 
c47b328
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ecd2a2b
c47b328
02fc4de
c47b328
 
 
02fc4de
ecd2a2b
02fc4de
 
 
 
 
 
ecd2a2b
02fc4de
 
 
c47b328
 
02fc4de
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
<!DOCTYPE html>
<html lang="es" class="dark">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>TrueEye - Sistema Inteligente de Alfabetización Mediática</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
    <script>
        tailwind.config = {
            darkMode: 'class',
            theme: {
                extend: {
                    colors: {
                        'trueeye-dark': '#2b0126',
                        'trueeye-gold': '#f6ae2d',
                        'trueeye-navbar': '#2b0126',  // Ahora es el mismo que trueeye-dark
                    }
                }
            }
        }
    </script>
    <style>
        /* Estilos para modo oscuro */
        .dark .markdown-content a {
            color: #f6ae2d;
            text-decoration: underline;
        }
        .dark .markdown-content h1, 
        .dark .markdown-content h2, 
        .dark .markdown-content h3, 
        .dark .markdown-content h4 {
            color: #f6ae2d;
            margin-top: 1rem;
            margin-bottom: 0.5rem;
            font-weight: bold;
        }
        
        /* Estilos para modo claro */
        .markdown-content a {
            color: #420909;
            text-decoration: underline;
            font-weight: 500;
        }
        .markdown-content h1, 
        .markdown-content h2, 
        .markdown-content h3, 
        .markdown-content h4 {
            color: #420909;
            margin-top: 1rem;
            margin-bottom: 0.5rem;
            font-weight: bold;
        }
        
        .markdown-content p {
            margin-bottom: 1rem;
        }
        .markdown-content ul, .markdown-content ol {
            margin-left: 1.5rem;
            margin-bottom: 1rem;
        }
        .markdown-content li {
            margin-bottom: 0.5rem;
        }
        
        /* Código en modo oscuro */
        .dark .markdown-content code {
            background-color: rgba(246, 174, 45, 0.2);
            padding: 0.2rem 0.4rem;
            border-radius: 0.25rem;
        }
        .dark .markdown-content pre {
            background-color: rgba(246, 174, 45, 0.1);
            padding: 1rem;
            border-radius: 0.5rem;
            overflow-x: auto;
            margin-bottom: 1rem;
        }
        
        /* Código en modo claro */
        .markdown-content code {
            background-color: rgba(66, 9, 9, 0.1);
            padding: 0.2rem 0.4rem;
            border-radius: 0.25rem;
        }
        .markdown-content pre {
            background-color: rgba(66, 9, 9, 0.05);
            padding: 1rem;
            border-radius: 0.5rem;
            overflow-x: auto;
            margin-bottom: 1rem;
        }
        
        .markdown-content blockquote {
            border-left: 4px solid #f6ae2d;
            padding-left: 1rem;
            margin-left: 0;
            color: #777;
            margin-bottom: 1rem;
        }
        
        /* Strong text */
        .dark .markdown-content strong {
            font-weight: bold;
            color: #f6ae2d;
        }
        .markdown-content strong {
            font-weight: bold;
            color: #420909;
        }
        
        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.5; }
        }
        .loading-message {
            animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
        }
        
        /* Navbar fija */
        .navbar {
            background-color: #2a0606;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 50;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
        }
        
        /* Compensar el espacio de la navbar */
        body {
            padding-top: 64px;
        }
        
        /* Botones de la navbar */
        .nav-button {
            background-color: #f6ae2d;
            color: #420909;
            padding: 0.5rem 1rem;
            border-radius: 0.375rem;
            font-weight: 600;
            transition: all 0.3s;
        }
        .nav-button:hover {
            background-color: #e09d1c;
            transform: translateY(-1px);
            box-shadow: 0 2px 8px rgba(246, 174, 45, 0.3);
        }
        
        /* Banner cards */
        .feature-card {
            transition: all 0.3s;
        }
        .dark .feature-card {
            background-color: rgba(246, 174, 45, 0.1);
            border: 1px solid rgba(246, 174, 45, 0.3);
        }
        .feature-card {
            background-color: rgba(246, 174, 45, 0.1);
            border: 1px solid rgba(66, 9, 9, 0.2);
        }
        .dark .feature-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(246, 174, 45, 0.2);
            border-color: #f6ae2d;
        }
        .feature-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(66, 9, 9, 0.1);
            border-color: #420909;
        }
    </style>
</head>
<body class="bg-white dark:bg-trueeye-dark min-h-screen transition-colors duration-300">
    <!-- Navbar fija -->
    <nav class="navbar">
        <div class="container mx-auto px-4">
            <div class="flex justify-between items-center h-16">
                <!-- Logo y título -->
                <div class="flex items-center space-x-3">
                    <a href="https://deeprat-trueeye-reports.hf.space" target="_blank">
                        <img src="/static/te.png" alt="TrueEye Logo" class="h-24 w-24">
                    </a>  
                </div>
                
                <!-- Botones de navegación -->
                <div class="flex items-center space-x-4">
                    <a href="https://deeprat.tech" target="_blank" class="nav-button" id="my-web-btn">
                        Mi Web
                    </a>
                    <a href="https://trueeye.deeprat.tech" target="_blank" class="nav-button" id="trueeye-project-btn">
                        Proyecto TrueEye
                    </a>
                </div>
            </div>
        </div>
    </nav>

    <div class="container mx-auto px-4 py-8 max-w-6xl">
        <!-- Banner de características -->
        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-8">
            <div class="feature-card rounded-lg p-4">
                <h3 class="text-trueeye-gold dark:text-trueeye-gold font-bold mb-2">Detección de Sesgos</h3>
                <p class="text-sm text-gray-700 dark:text-gray-200">Identificación precisa de inclinaciones positivas, negativas o neutrales</p>
            </div>
            <div class="feature-card rounded-lg p-4">
                <h3 class="text-trueeye-gold dark:text-trueeye-gold font-bold mb-2">Verificación de Hechos</h3>
                <p class="text-sm text-gray-700 dark:text-gray-200">Detección de falacias, argumentos engañosos y desinformación</p>
            </div>
            <div class="feature-card rounded-lg p-4">
                <h3 class="text-trueeye-gold dark:text-trueeye-gold font-bold mb-2">Análisis de Audiencia</h3>
                <p class="text-sm text-gray-700 dark:text-gray-200">Perfil demográfico y psicográfico del público objetivo</p>
            </div>
            <div class="feature-card rounded-lg p-4">
                <h3 class="text-trueeye-gold dark:text-trueeye-gold font-bold mb-2">Evaluación de Intencionalidad</h3>
                <p class="text-sm text-gray-700 dark:text-gray-200">Análisis de manipulación y niveles de animosidad</p>
            </div>
        </div>

        <!-- Header principal -->
        <header class="flex justify-between items-center mb-8">
            <div>
                <h1 class="text-4xl font-bold text-trueeye-dark dark:text-trueeye-gold">TrueEye</h1>
                <p class="text-lg text-gray-700 dark:text-gray-300">Sistema Inteligente de Alfabetización Mediática</p>
            </div>
            <button id="theme-toggle" class="p-2 rounded-full bg-trueeye-gold dark:bg-trueeye-dark text-trueeye-dark dark:text-trueeye-gold border-2 border-trueeye-dark dark:border-trueeye-gold">
                <svg id="theme-icon-dark" xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z" />
                </svg>
                <svg id="theme-icon-light" xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 hidden" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                    <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z" />
                </svg>
            </button>
        </header>

        <main>
            <div class="bg-trueeye-gold/10 dark:bg-trueeye-gold/10 border border-trueeye-dark/20 dark:border-trueeye-gold/30 rounded-lg shadow-lg p-6 mb-8 transition-colors duration-300">
                <div class="flex flex-col md:flex-row gap-4">
                    <input 
                        id="input-url" 
                        type="url" 
                        placeholder="Ingrese la URL a analizar..." 
                        class="flex-grow px-4 py-3 rounded-lg border border-trueeye-dark/30 dark:border-trueeye-gold/30 focus:outline-none focus:ring-2 focus:ring-trueeye-gold dark:focus:ring-trueeye-gold bg-white dark:bg-trueeye-dark/50 text-black dark:text-white placeholder-gray-500 dark:placeholder-gray-400"
                    >
                    <button 
                        id="analyze-btn" 
                        class="px-6 py-3 bg-trueeye-gold hover:bg-trueeye-gold/90 text-trueeye-dark font-semibold rounded-lg transition-all duration-300 flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed hover:shadow-lg"
                    >
                        <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
                            <path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd" />
                        </svg>
                        Analizar
                    </button>
                </div>
                <div id="error-message" class="mt-2 text-red-600 dark:text-red-400 hidden"></div>
            </div>

            <div id="loading" class="hidden">
                <div class="bg-trueeye-gold/10 dark:bg-trueeye-gold/10 border border-trueeye-dark/20 dark:border-trueeye-gold/30 rounded-lg shadow-lg p-8 text-center">
                    <div class="flex justify-center items-center mb-4">
                        <div class="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-trueeye-gold"></div>
                    </div>
                    <p class="text-gray-700 dark:text-gray-200 loading-message">Analizando contenido...</p>
                    <p class="text-sm text-gray-600 dark:text-gray-400 mt-2">Esto puede tomar algunos minutos mientras realizamos un análisis exhaustivo</p>
                    <div id="progress-timer" class="text-xs text-gray-500 dark:text-gray-500 mt-4">Tiempo transcurrido: 0:00</div>
                </div>
            </div>

            <div id="result-container" class="hidden bg-trueeye-gold/10 dark:bg-trueeye-gold/10 border border-trueeye-dark/20 dark:border-trueeye-gold/30 rounded-lg shadow-lg p-6 transition-colors duration-300">
                <h2 class="text-2xl font-semibold text-trueeye-dark dark:text-trueeye-gold mb-4">Resultado del Análisis</h2>
                <div id="result" class="markdown-content text-gray-800 dark:text-gray-200"></div>
            </div>

            <div id="info-box" class="mt-8 bg-trueeye-gold/20 dark:bg-trueeye-gold/10 border border-trueeye-dark/20 dark:border-trueeye-gold/30 rounded-lg p-4">
                <h3 class="text-lg font-semibold text-trueeye-dark dark:text-trueeye-gold mb-2">¿Cómo funciona?</h3>
                <p class="text-gray-700 dark:text-gray-300 text-sm">
                    TrueEye analiza artículos de noticias y contenido web para detectar sesgos, identificar audiencias objetivo 
                    y revelar agendas ocultas. Simplemente pegue una URL y deje que nuestro sistema impulsado por IA le proporcione 
                    un informe completo de alfabetización mediática.
                </p>
            </div>
        </main>

        <footer class="mt-12 text-center text-gray-600 dark:text-gray-400">
            <p>Powered by <a href="https://anthropic.com" target="_blank">Claude (Anthropic)</a> • 
                Desarrollado para promover la alfabetización mediática y el pensamiento crítico</p>
        </footer>
    </div>

    <script>
        // Variables globales
        let analysisStartTime = null;
        let timerInterval = null;

        // Configurar URLs de los botones (cambiar estas URLs según necesites)
        document.getElementById('my-web-btn').href = 'https://deeprat.tech'; // Cambia esto a tu URL
        document.getElementById('trueeye-project-btn').href = 'https://trueeye.deeprat.tech'; // Cambia esto a la URL del proyecto

        // Cambio de tema
        const themeToggle = document.getElementById('theme-toggle');
        const themeIconDark = document.getElementById('theme-icon-dark');
        const themeIconLight = document.getElementById('theme-icon-light');
        
        if (localStorage.getItem('color-theme') === 'dark' || (!('color-theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
            document.documentElement.classList.add('dark');
            themeIconLight.classList.remove('hidden');
            themeIconDark.classList.add('hidden');
        } else {
            document.documentElement.classList.remove('dark');
            themeIconLight.classList.add('hidden');
            themeIconDark.classList.remove('hidden');
        }

        themeToggle.addEventListener('click', () => {
            if (document.documentElement.classList.contains('dark')) {
                document.documentElement.classList.remove('dark');
                localStorage.setItem('color-theme', 'light');
                themeIconLight.classList.add('hidden');
                themeIconDark.classList.remove('hidden');
            } else {
                document.documentElement.classList.add('dark');
                localStorage.setItem('color-theme', 'dark');
                themeIconLight.classList.remove('hidden');
                themeIconDark.classList.add('hidden');
            }
        });

        // Funcionalidad de análisis
        const analyzeBtn = document.getElementById('analyze-btn');
        const inputUrl = document.getElementById('input-url');
        const resultContainer = document.getElementById('result-container');
        const resultDiv = document.getElementById('result');
        const loadingDiv = document.getElementById('loading');
        const errorMessage = document.getElementById('error-message');
        const progressTimer = document.getElementById('progress-timer');

        analyzeBtn.addEventListener('click', async () => {
            const url = inputUrl.value.trim();
            
            if (!url) {
                showError('Por favor ingrese una URL');
                return;
            }
            
            if (!isValidUrl(url)) {
                showError('Por favor ingrese una URL válida (incluya http:// o https://)');
                return;
            }
            
            clearError();
            startAnalysis();
            
            try {
                const response = await fetch(window.location.origin + '/analyze', {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json',
                    },
                    body: JSON.stringify({ url })
                });
                
                if (!response.ok) {
                    throw new Error(`El servidor retornó ${response.status}`);
                }
                
                const data = await response.json();
                
                if (!data.success && data.error) {
                    // Manejar tipos de error específicos
                    if (data.error === 'timeout') {
                        showError('El análisis tardó demasiado tiempo. Por favor intente nuevamente con un artículo más simple o intente más tarde.');
                    } else if (data.error === 'connection') {
                        showError('No se pudo conectar con el servicio de análisis. Por favor verifique su conexión e intente nuevamente.');
                    } else {
                        showError(data.result || 'Ocurrió un error durante el análisis.');
                    }
                    stopAnalysis();
                    return;
                }
                
                // Mostrar resultados
                resultDiv.innerHTML = marked.parse(data.result);
                resultContainer.classList.remove('hidden');
                stopAnalysis();
                
                // Hacer scroll a los resultados
                resultContainer.scrollIntoView({ behavior: 'smooth', block: 'start' });
                
            } catch (error) {
                showError('Error al analizar la URL. Por favor intente más tarde.');
                console.error('Error:', error);
                stopAnalysis();
            }
        });

        function startAnalysis() {
            loadingDiv.classList.remove('hidden');
            resultContainer.classList.add('hidden');
            analyzeBtn.disabled = true;
            analysisStartTime = Date.now();
            
            // Actualizar timer cada segundo
            timerInterval = setInterval(() => {
                const elapsed = Date.now() - analysisStartTime;
                const minutes = Math.floor(elapsed / 60000);
                const seconds = Math.floor((elapsed % 60000) / 1000);
                progressTimer.textContent = `Tiempo transcurrido: ${minutes}:${seconds.toString().padStart(2, '0')}`;
            }, 1000);
        }

        function stopAnalysis() {
            loadingDiv.classList.add('hidden');
            analyzeBtn.disabled = false;
            if (timerInterval) {
                clearInterval(timerInterval);
                timerInterval = null;
            }
        }

        function isValidUrl(string) {
            try {
                new URL(string);
                return true;
            } catch (_) {
                return false;
            }
        }

        function showError(message) {
            errorMessage.textContent = message;
            errorMessage.classList.remove('hidden');
        }

        function clearError() {
            errorMessage.textContent = '';
            errorMessage.classList.add('hidden');
        }

        // Permitir presionar Enter en el campo de entrada
        inputUrl.addEventListener('keypress', (e) => {
            if (e.key === 'Enter' && !analyzeBtn.disabled) {
                analyzeBtn.click();
            }
        });

        // URLs de ejemplo para pruebas
        const exampleUrls = [
            'https://example.com/news-article',
            'https://bbc.com/news/article-123',
            'https://cnn.com/2025/01/article'
        ];
        
        // Agregar URL de ejemplo con doble clic (para pruebas)
        inputUrl.addEventListener('dblclick', () => {
            inputUrl.value = exampleUrls[Math.floor(Math.random() * exampleUrls.length)];
        });
    </script>
</body>
</html>