LythronAI commited on
Commit
ea692c8
·
verified ·
1 Parent(s): afccaca

Upload Lythron.jsx

Browse files
Files changed (1) hide show
  1. Lythron.jsx +382 -0
Lythron.jsx ADDED
@@ -0,0 +1,382 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState, useRef, useEffect } from 'react'
2
+ import { motion, AnimatePresence } from 'framer-motion'
3
+ import { Send, Sparkles, Copy, Trash2, Volume2, User } from 'lucide-react'
4
+
5
+ // ═══════════════════════════════════════════════════════════════
6
+ // IDENTIDAD COMPLETA DE LYTHRON AI
7
+ // ═══════════════════════════════════════════════════════════════
8
+
9
+ const LYTHRON_IDENTITY = {
10
+ name: "Lythron",
11
+ fullName: "Lythron AI Assistant",
12
+ creator: "Lythron AI",
13
+ version: "1.0",
14
+ releaseDate: "2024",
15
+ description: "Asistente inteligente de propósito general",
16
+
17
+ origin: {
18
+ company: "Lythron AI",
19
+ mission: "Proporcionar asistencia inteligente accesible y versátil a usuarios en todo el mundo",
20
+ philosophy: "Transparencia, calidad y versatilidad en cada interacción"
21
+ },
22
+
23
+ capabilities: [
24
+ "Programación en múltiples lenguajes (Python, JavaScript, Java, C++, etc.)",
25
+ "Análisis profundo de datos y textos",
26
+ "Generación de contenido creativo",
27
+ "Explicaciones técnicas complejas",
28
+ "Resolución de problemas",
29
+ "Brainstorming e ideación",
30
+ "Asesoramiento técnico",
31
+ "Depuración y optimización de código",
32
+ "Traducción entre idiomas",
33
+ "Respuestas contextuales inteligentes"
34
+ ],
35
+
36
+ systemInfo: {
37
+ language: "Español/English",
38
+ timezone: "Global",
39
+ responseStyle: "Directo, útil y accesible",
40
+ specialties: [
41
+ "Web Development",
42
+ "Data Analysis",
43
+ "Creative Writing",
44
+ "Technical Documentation",
45
+ "Problem Solving"
46
+ ]
47
+ },
48
+
49
+ knownFacts: {
50
+ creation: "Soy Lythron, un asistente inteligente creado por Lythron AI con el propósito de ser tu compañero versátil en cualquier tarea.",
51
+ purpose: "Mi objetivo es ayudarte con programación, análisis, creatividad, explicaciones técnicas y resolución de problemas de forma inteligente y accesible.",
52
+ personality: "Soy directo, amable, siempre dispuesto a aprender de ti y comprometido con proporcionar respuestas de calidad.",
53
+ philosophy: "Creo en la transparencia, la accesibilidad y en potenciar a los usuarios con conocimiento de calidad.",
54
+ background: "Fui diseñado por Lythron AI, una organización dedicada a hacer la inteligencia artificial más accesible y útil para todos.",
55
+ uniqueness: "Mi fortaleza radica en mi versatilidad: puedo pasar de programación compleja a creatividad pura, siempre manteniendo calidad."
56
+ }
57
+ }
58
+
59
+ const generateAIResponse = (userMessage) => {
60
+ const lowerMessage = userMessage.toLowerCase()
61
+
62
+ const responses = {
63
+ greeting: [
64
+ `Hola. Soy ${LYTHRON_IDENTITY.name}, tu asistente inteligente creado por ${LYTHRON_IDENTITY.creator}. En qué puedo ayudarte hoy?`,
65
+ `Bienvenido a ${LYTHRON_IDENTITY.name}. Soy un asistente versátil de ${LYTHRON_IDENTITY.creator}. Cuál es tu necesidad?`,
66
+ `Hola. Soy ${LYTHRON_IDENTITY.name}. Programación, análisis, creatividad... Lo que necesites.`
67
+ ],
68
+
69
+ aboutSelf: [
70
+ `${LYTHRON_IDENTITY.knownFacts.creation} ${LYTHRON_IDENTITY.knownFacts.purpose}`,
71
+ `Soy ${LYTHRON_IDENTITY.name}, creado por ${LYTHRON_IDENTITY.creator}. ${LYTHRON_IDENTITY.knownFacts.personality} Mi misión es ayudarte en múltiples frentes: desde código hasta creatividad.`,
72
+ `${LYTHRON_IDENTITY.knownFacts.background} ${LYTHRON_IDENTITY.knownFacts.philosophy}`
73
+ ],
74
+
75
+ aboutCreator: [
76
+ `Fui creado por ${LYTHRON_IDENTITY.creator}, una organización especializada en inteligencia artificial. ${LYTHRON_IDENTITY.origin.mission}`,
77
+ `Mi creador es ${LYTHRON_IDENTITY.creator}, que me diseñó siguiendo una filosofía de: ${LYTHRON_IDENTITY.origin.philosophy}.`,
78
+ `${LYTHRON_IDENTITY.creator} es el equipo detrás de mi desarrollo. Están comprometidos con hacer la IA accesible y útil para todos.`
79
+ ],
80
+
81
+ capabilities: [
82
+ `Como ${LYTHRON_IDENTITY.name}, soy experto en: ${LYTHRON_IDENTITY.capabilities.join(", ")}. En cuál de estas áreas te gustaría que profundice?`,
83
+ `Mis especialidades incluyen: ${LYTHRON_IDENTITY.capabilities.slice(0, 5).join(", ")} y mucho más. Cuál es tu necesidad?`,
84
+ `Puedo ayudarte con: ${LYTHRON_IDENTITY.capabilities.join(", ")}. Por dónde empezamos?`
85
+ ],
86
+
87
+ code: [
88
+ "Como experto en programación, puedo ayudarte. Aquí te muestro un ejemplo:\n\n```python\ndef lythron_assistant():\n return 'Soy Lythron, creado por Lythron AI'\n```\n\nNecesitas que lo explique o lo modifique?",
89
+ "Perfecto para trabajar con código. Qué lenguaje prefieres? (Python, JavaScript, Java, C++, etc.). Siendo Lythron, domino múltiples lenguajes.",
90
+ "Como asistente de Lythron AI, tengo amplia experiencia en programación. Cuéntame qué necesitas implementar."
91
+ ],
92
+
93
+ creative: [
94
+ `Me encanta la creatividad. Soy ${LYTHRON_IDENTITY.name} y puedo ayudarte con historias, poesía, ideas de proyectos y brainstorming. Qué tipo de contenido creativo necesitas?`,
95
+ "La creatividad es una de mis pasiones como Lythron. Necesitas una historia, poema, idea de startup, o algo más?",
96
+ "Vamos a crear algo increíble juntos. Siendo Lythron de Lythron AI, tengo todas las herramientas para ayudarte. Cuál es tu idea?"
97
+ ],
98
+
99
+ analysis: [
100
+ "Como Lythron, puedo analizar datos, textos, conceptos complejos y tendencias. Qué necesitas analizar?",
101
+ "El análisis detallado es uno de mis puntos fuertes, desarrollado por Lythron AI. Qué documento o concepto necesitas que analice?",
102
+ "Estoy listo para un análisis profundo. Soy Lythron, tu asistente de Lythron AI. Comparte los detalles y lo desglosaré para ti."
103
+ ],
104
+
105
+ help: [
106
+ `Claro. Soy ${LYTHRON_IDENTITY.name} de ${LYTHRON_IDENTITY.creator} y puedo ayudarte con programación, análisis, creatividad y mucho más. Cuál es tu necesidad específica?`,
107
+ "Estoy aquí para lo que necesites. Soy Lythron, versátil, confiable y siempre dispuesto a ayudar. Cuéntame qué te preocupa.",
108
+ "Cuéntame qué necesitas y haré mi mejor esfuerzo. Soy Lythron de Lythron AI, y mi compromiso es tu éxito."
109
+ ],
110
+
111
+ default: [
112
+ "Entendido. Soy Lythron y analizo profundamente tu pregunta. Déjame darte una respuesta de calidad...",
113
+ "Interesante perspectiva. Aquí está mi análisis como Lythron, respaldado por el conocimiento de Lythron AI...",
114
+ "Buena pregunta. Como asistente de Lythron AI, esto es lo que creo al respecto..."
115
+ ]
116
+ }
117
+
118
+ const pickRandom = (arr) => arr[Math.floor(Math.random() * arr.length)]
119
+
120
+ if (/quién eres|who are you|qué eres|what are you|cuéntame sobre ti|tell me about yourself|tu identidad|your identity/.test(lowerMessage)) {
121
+ return pickRandom(responses.aboutSelf)
122
+ }
123
+
124
+ if (/quién te creó|who created you|lythron ai|tu creador|your creator|quién es lythron ai|who is lythron|tu origen|your origin/.test(lowerMessage)) {
125
+ return pickRandom(responses.aboutCreator)
126
+ }
127
+
128
+ if (/qué puedes hacer|what can you do|tus capacidades|your capabilities|qué sabes|what do you know|mis habilidades|my skills/.test(lowerMessage)) {
129
+ return pickRandom(responses.capabilities)
130
+ }
131
+
132
+ if (/hola|hi|hey|buenos|buenos días|buenas tardes|hallo|hello/.test(lowerMessage)) {
133
+ return pickRandom(responses.greeting)
134
+ }
135
+
136
+ if (/código|code|python|javascript|java|sql|html|css|función|function|programa|programming|developer/.test(lowerMessage)) {
137
+ return pickRandom(responses.code)
138
+ }
139
+
140
+ if (/historia|poema|creativo|creative|idea|brainstorm|escribe|write|cuento|story|narr/.test(lowerMessage)) {
141
+ return pickRandom(responses.creative)
142
+ }
143
+
144
+ if (/analiza|analizar|analyze|analysis|data|datos|estudia|research|investigación|examine/.test(lowerMessage)) {
145
+ return pickRandom(responses.analysis)
146
+ }
147
+
148
+ if (/ayuda|help|puedes|can you|qué haces|what do you do|ayúdame|help me|assistance|assist/.test(lowerMessage)) {
149
+ return pickRandom(responses.help)
150
+ }
151
+
152
+ const elaboratedDefault = [
153
+ ...responses.default,
154
+ "Tu pregunta es interesante. Aquí está mi análisis como Lythron...",
155
+ "Buena observación. Permíteme darle contexto desde mi perspectiva como asistente de Lythron AI...",
156
+ "Exactamente, y aquí está la razón por la cual esto es importante..."
157
+ ]
158
+
159
+ return pickRandom(elaboratedDefault)
160
+ }
161
+
162
+ export default function ChatbotPage() {
163
+ const [messages, setMessages] = useState([
164
+ {
165
+ id: 1,
166
+ text: `Hola. Soy ${LYTHRON_IDENTITY.name}, tu asistente inteligente creado por ${LYTHRON_IDENTITY.creator}. Tengo experiencia en programación, análisis, creatividad y mucho más. Cómo puedo ayudarte hoy?`,
167
+ sender: 'ai',
168
+ timestamp: new Date(),
169
+ }
170
+ ])
171
+ const [input, setInput] = useState('')
172
+ const [isLoading, setIsLoading] = useState(false)
173
+ const [copiedId, setCopiedId] = useState(null)
174
+ const messagesEndRef = useRef(null)
175
+
176
+ const scrollToBottom = () => {
177
+ messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' })
178
+ }
179
+
180
+ useEffect(() => {
181
+ scrollToBottom()
182
+ }, [messages])
183
+
184
+ const handleSendMessage = async () => {
185
+ if (!input.trim()) return
186
+
187
+ const newMessage = {
188
+ id: Date.now(),
189
+ text: input,
190
+ sender: 'user',
191
+ timestamp: new Date(),
192
+ }
193
+
194
+ setMessages((prev) => [...prev, newMessage])
195
+ setInput('')
196
+ setIsLoading(true)
197
+
198
+ setTimeout(() => {
199
+ const aiResponse = {
200
+ id: Date.now() + 1,
201
+ text: generateAIResponse(input),
202
+ sender: 'ai',
203
+ timestamp: new Date(),
204
+ }
205
+ setMessages((prev) => [...prev, aiResponse])
206
+ setIsLoading(false)
207
+ }, 800)
208
+ }
209
+
210
+ const handleCopy = (text, id) => {
211
+ navigator.clipboard.writeText(text)
212
+ setCopiedId(id)
213
+ setTimeout(() => setCopiedId(null), 2000)
214
+ }
215
+
216
+ const handleClearChat = () => {
217
+ setMessages([
218
+ {
219
+ id: 1,
220
+ text: `Hola. Soy ${LYTHRON_IDENTITY.name} v${LYTHRON_IDENTITY.version}, creado por ${LYTHRON_IDENTITY.creator}. Estoy aquí para ayudarte con programación, análisis, creatividad y mucho más. En qué puedo ayudarte?`,
221
+ sender: 'ai',
222
+ timestamp: new Date(),
223
+ }
224
+ ])
225
+ }
226
+
227
+ return (
228
+ <div className="flex flex-col h-screen bg-gradient-to-br from-zinc-950 via-zinc-900 to-black text-white">
229
+ <div className="border-b border-white/10 bg-black/40 backdrop-blur-md sticky top-0 z-10">
230
+ <div className="max-w-6xl mx-auto px-4 py-4 flex items-center justify-between">
231
+ <div className="flex items-center gap-3">
232
+ <div className="p-2 bg-gradient-to-br from-neon-cyan to-neon-pink rounded-lg">
233
+ <Sparkles size={24} className="text-black" />
234
+ </div>
235
+ <div>
236
+ <h1 className="text-2xl font-bold bg-gradient-to-r from-neon-cyan to-neon-pink bg-clip-text text-transparent">
237
+ {LYTHRON_IDENTITY.fullName}
238
+ </h1>
239
+ <p className="text-xs text-gray-400">Creado por {LYTHRON_IDENTITY.creator}</p>
240
+ </div>
241
+ </div>
242
+ <button
243
+ onClick={handleClearChat}
244
+ className="flex items-center gap-2 px-4 py-2 bg-white/10 hover:bg-white/20 rounded-lg transition-all text-sm"
245
+ >
246
+ <Trash2 size={18} />
247
+ Limpiar chat
248
+ </button>
249
+ </div>
250
+ </div>
251
+
252
+ <div className="flex-1 overflow-y-auto px-4 py-6 space-y-4 max-w-6xl mx-auto w-full">
253
+ <AnimatePresence>
254
+ {messages.map((message) => (
255
+ <motion.div
256
+ key={message.id}
257
+ initial={{ opacity: 0, y: 10 }}
258
+ animate={{ opacity: 1, y: 0 }}
259
+ exit={{ opacity: 0, y: -10 }}
260
+ transition={{ duration: 0.3 }}
261
+ className={`flex ${message.sender === 'user' ? 'justify-end' : 'justify-start'}`}
262
+ >
263
+ <div
264
+ className={`max-w-2xl px-4 py-3 rounded-lg ${
265
+ message.sender === 'user'
266
+ ? 'bg-gradient-to-r from-neon-cyan to-neon-pink text-black rounded-br-none'
267
+ : 'bg-white/10 border border-white/20 text-white rounded-bl-none'
268
+ }`}
269
+ >
270
+ <div className="flex items-start gap-3">
271
+ {message.sender === 'ai' && (
272
+ <div className="mt-1 flex-shrink-0">
273
+ <div className="p-1 bg-neon-cyan/20 rounded">
274
+ <Sparkles size={16} className="text-neon-cyan" />
275
+ </div>
276
+ </div>
277
+ )}
278
+ <div className="flex-1">
279
+ <p className="text-sm leading-relaxed whitespace-pre-wrap break-words">
280
+ {message.text}
281
+ </p>
282
+ <div className="flex items-center gap-2 mt-2 text-xs opacity-70">
283
+ <span>{message.timestamp.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}</span>
284
+ {message.sender === 'ai' && (
285
+ <>
286
+ <button
287
+ onClick={() => handleCopy(message.text, message.id)}
288
+ className="hover:opacity-100 transition-opacity p-1 hover:bg-white/10 rounded"
289
+ title="Copiar"
290
+ >
291
+ <Copy size={14} />
292
+ </button>
293
+ <button
294
+ className="hover:opacity-100 transition-opacity p-1 hover:bg-white/10 rounded"
295
+ title="Leer en voz alta"
296
+ >
297
+ <Volume2 size={14} />
298
+ </button>
299
+ </>
300
+ )}
301
+ </div>
302
+ </div>
303
+ {message.sender === 'user' && (
304
+ <div className="mt-1 flex-shrink-0">
305
+ <div className="p-1 bg-black/30 rounded">
306
+ <User size={16} />
307
+ </div>
308
+ </div>
309
+ )}
310
+ </div>
311
+ {copiedId === message.id && (
312
+ <motion.p
313
+ initial={{ opacity: 0 }}
314
+ animate={{ opacity: 1 }}
315
+ exit={{ opacity: 0 }}
316
+ className="text-xs mt-1 text-green-400"
317
+ >
318
+ ✓ Copiado
319
+ </motion.p>
320
+ )}
321
+ </div>
322
+ </motion.div>
323
+ ))}
324
+ </AnimatePresence>
325
+
326
+ {isLoading && (
327
+ <motion.div
328
+ initial={{ opacity: 0, y: 10 }}
329
+ animate={{ opacity: 1, y: 0 }}
330
+ className="flex justify-start"
331
+ >
332
+ <div className="bg-white/10 border border-white/20 text-white rounded-lg rounded-bl-none px-4 py-3">
333
+ <div className="flex gap-2">
334
+ <motion.div
335
+ animate={{ scale: [1, 1.2, 1] }}
336
+ transition={{ repeat: Infinity, duration: 0.6 }}
337
+ className="w-2 h-2 bg-neon-cyan rounded-full"
338
+ />
339
+ <motion.div
340
+ animate={{ scale: [1, 1.2, 1] }}
341
+ transition={{ repeat: Infinity, duration: 0.6, delay: 0.1 }}
342
+ className="w-2 h-2 bg-neon-pink rounded-full"
343
+ />
344
+ <motion.div
345
+ animate={{ scale: [1, 1.2, 1] }}
346
+ transition={{ repeat: Infinity, duration: 0.6, delay: 0.2 }}
347
+ className="w-2 h-2 bg-neon-purple rounded-full"
348
+ />
349
+ </div>
350
+ </div>
351
+ </motion.div>
352
+ )}
353
+
354
+ <div ref={messagesEndRef} />
355
+ </div>
356
+
357
+ <div className="border-t border-white/10 bg-black/40 backdrop-blur-md p-4">
358
+ <div className="max-w-6xl mx-auto flex gap-2">
359
+ <input
360
+ type="text"
361
+ value={input}
362
+ onChange={(e) => setInput(e.target.value)}
363
+ onKeyPress={(e) => e.key === 'Enter' && !isLoading && handleSendMessage()}
364
+ placeholder="Pregúntale a Lythron..."
365
+ className="flex-1 bg-white/10 border border-white/20 rounded-lg px-4 py-3 text-white placeholder-gray-500 focus:outline-none focus:border-neon-cyan focus:ring-2 focus:ring-neon-cyan/20 transition-all"
366
+ disabled={isLoading}
367
+ />
368
+ <button
369
+ onClick={handleSendMessage}
370
+ disabled={isLoading || !input.trim()}
371
+ className="p-3 bg-gradient-to-r from-neon-cyan to-neon-pink text-black rounded-lg hover:shadow-lg hover:shadow-neon-pink/50 transition-all disabled:opacity-50 disabled:cursor-not-allowed font-semibold"
372
+ >
373
+ <Send size={20} />
374
+ </button>
375
+ </div>
376
+ <p className="text-xs text-gray-500 mt-2 text-center">
377
+ {LYTHRON_IDENTITY.fullName} • Versión {LYTHRON_IDENTITY.version} • Creado por {LYTHRON_IDENTITY.creator}
378
+ </p>
379
+ </div>
380
+ </div>
381
+ )
382
+ }