LythronAI commited on
Commit
d6fab25
·
verified ·
1 Parent(s): 4cf0580

Delete AI poweful/frontend/src

Browse files
AI poweful/frontend/src/Lythron.jsx DELETED
@@ -1,331 +0,0 @@
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
- import axios from 'axios'
5
-
6
- // ═══════════════════════════════════════════════════════════════
7
- // IDENTIDAD COMPLETA DE LYTHRON AI
8
- // ═══════════════════════════════════════════════════════════════
9
-
10
- const LYTHRON_IDENTITY = {
11
- name: "Lythron",
12
- fullName: "Lythron AI Assistant",
13
- creator: "Lythron AI",
14
- version: "1.0",
15
- releaseDate: "2024",
16
- description: "Asistente inteligente de propósito general",
17
-
18
- origin: {
19
- company: "Lythron AI",
20
- mission: "Proporcionar asistencia inteligente accesible y versátil a usuarios en todo el mundo",
21
- philosophy: "Transparencia, calidad y versatilidad en cada interacción"
22
- },
23
-
24
- capabilities: [
25
- "Programación en múltiples lenguajes (Python, JavaScript, Java, C++, etc.)",
26
- "Análisis profundo de datos y textos",
27
- "Generación de contenido creativo",
28
- "Explicaciones técnicas complejas",
29
- "Resolución de problemas",
30
- "Brainstorming e ideación",
31
- "Asesoramiento técnico",
32
- "Depuración y optimización de código",
33
- "Traducción entre idiomas",
34
- "Respuestas contextuales inteligentes"
35
- ],
36
-
37
- systemInfo: {
38
- language: "Español/English",
39
- timezone: "Global",
40
- responseStyle: "Directo, útil y accesible",
41
- specialties: [
42
- "Web Development",
43
- "Data Analysis",
44
- "Creative Writing",
45
- "Technical Documentation",
46
- "Problem Solving"
47
- ]
48
- },
49
-
50
- knownFacts: {
51
- creation: "Soy Lythron, un asistente inteligente creado por Lythron AI con el propósito de ser tu compañero versátil en cualquier tarea.",
52
- purpose: "Mi objetivo es ayudarte con programación, análisis, creatividad, explicaciones técnicas y resolución de problemas de forma inteligente y accesible.",
53
- personality: "Soy directo, amable, siempre dispuesto a aprender de ti y comprometido con proporcionar respuestas de calidad.",
54
- philosophy: "Creo en la transparencia, la accesibilidad y en potenciar a los usuarios con conocimiento de calidad.",
55
- background: "Fui diseñado por Lythron AI, una organización dedicada a hacer la inteligencia artificial más accesible y útil para todos.",
56
- uniqueness: "Mi fortaleza radica en mi versatilidad: puedo pasar de programación compleja a creatividad pura, siempre manteniendo calidad."
57
- }
58
- }
59
-
60
- // Función para llamar a Hugging Face API
61
- const fetchAIResponse = async (userMessage) => {
62
- try {
63
- const HF_TOKEN = import.meta.env.VITE_HF_TOKEN
64
-
65
- if (!HF_TOKEN) {
66
- return "Error: Token de Hugging Face no configurado. Verifica tu archivo .env con VITE_HF_TOKEN"
67
- }
68
-
69
- const response = await axios.post(
70
- "https://api-inference.huggingface.co/models/meta-llama/Llama-2-7b-chat-hf",
71
- { inputs: userMessage },
72
- {
73
- headers: { Authorization: `Bearer ${ HF_TOKEN }` },
74
- timeout: 30000
75
- }
76
- )
77
-
78
- let text = response.data?.[0]?.generated_text || response.data?.generated_text || "Lo siento, no pude generar respuesta."
79
-
80
- if (text.includes(userMessage)) {
81
- text = text.replace(userMessage, "").trim()
82
- }
83
-
84
- return text || "Lo siento, no pude generar respuesta."
85
- } catch (error) {
86
- console.error("Error al llamar a Hugging Face:", error)
87
-
88
- if (error.response?.status === 429) {
89
- return "El modelo está sobrecargado. Por favor, intenta en unos segundos."
90
- }
91
-
92
- if (error.response?.status === 503) {
93
- return "El modelo se está cargando. Por favor, espera unos momentos e intenta de nuevo."
94
- }
95
-
96
- return `Error: ${ error.response?.data?.error || error.message || "Problema generando respuesta de IA. Intenta de nuevo." }`
97
- }
98
- }
99
-
100
- export default function Lythron() {
101
- const [messages, setMessages] = useState([
102
- {
103
- id: 1,
104
- text: `Hola. Soy ${ LYTHRON_IDENTITY.name }, tu asistente inteligente creado por ${ LYTHRON_IDENTITY.creator }. Estoy conectado a Hugging Face para darte respuestas reales. En qué puedo ayudarte hoy?`,
105
- sender: "ai",
106
- timestamp: new Date(),
107
- }
108
- ])
109
- const [input, setInput] = useState("")
110
- const [isLoading, setIsLoading] = useState(false)
111
- const [copiedId, setCopiedId] = useState(null)
112
- const messagesEndRef = useRef(null)
113
-
114
- const scrollToBottom = () => {
115
- messagesEndRef.current?.scrollIntoView({ behavior: "smooth" })
116
- }
117
-
118
- useEffect(() => {
119
- scrollToBottom()
120
- }, [messages])
121
-
122
- const handleSendMessage = async () => {
123
- if (!input.trim()) return
124
-
125
- const newMessage = {
126
- id: Date.now(),
127
- text: input,
128
- sender: "user",
129
- timestamp: new Date(),
130
- }
131
-
132
- setMessages((prev) => [...prev, newMessage])
133
- setInput("")
134
- setIsLoading(true)
135
-
136
- try {
137
- const aiText = await fetchAIResponse(input)
138
- const aiResponse = {
139
- id: Date.now() + 1,
140
- text: aiText,
141
- sender: "ai",
142
- timestamp: new Date(),
143
- }
144
- setMessages((prev) => [...prev, aiResponse])
145
- } catch (error) {
146
- console.error("Error en handleSendMessage:", error)
147
- const errorResponse = {
148
- id: Date.now() + 1,
149
- text: "Hubo un problema conectando con la IA. Por favor, intenta de nuevo.",
150
- sender: "ai",
151
- timestamp: new Date(),
152
- }
153
- setMessages((prev) => [...prev, errorResponse])
154
- } finally {
155
- setIsLoading(false)
156
- }
157
- }
158
-
159
- const handleCopy = (text, id) => {
160
- navigator.clipboard.writeText(text)
161
- setCopiedId(id)
162
- setTimeout(() => setCopiedId(null), 2000)
163
- }
164
-
165
- const handleClearChat = () => {
166
- setMessages([
167
- {
168
- id: 1,
169
- text: `Hola. Soy ${ LYTHRON_IDENTITY.name } v${ LYTHRON_IDENTITY.version }, creado por ${ LYTHRON_IDENTITY.creator }. Estoy conectado a Hugging Face para darte respuestas reales. En qué puedo ayudarte?`,
170
- sender: "ai",
171
- timestamp: new Date(),
172
- }
173
- ])
174
- }
175
-
176
- return (
177
- <div className="flex flex-col h-screen bg-gradient-to-br from-zinc-950 via-zinc-900 to-black text-white">
178
- <div className="border-b border-white/10 bg-black/40 backdrop-blur-md sticky top-0 z-10">
179
- <div className="max-w-6xl mx-auto px-4 py-4 flex items-center justify-between">
180
- <div className="flex items-center gap-3">
181
- <div className="p-2 bg-gradient-to-br from-neon-cyan to-neon-pink rounded-lg">
182
- <Sparkles size={24} className="text-black" />
183
- </div>
184
- <div>
185
- <h1 className="text-2xl font-bold bg-gradient-to-r from-neon-cyan to-neon-pink bg-clip-text text-transparent">
186
- {LYTHRON_IDENTITY.fullName}
187
- </h1>
188
- <p className="text-xs text-gray-400">Creado por {LYTHRON_IDENTITY.creator}</p>
189
- </div>
190
- </div>
191
- <button
192
- onClick={handleClearChat}
193
- className="flex items-center gap-2 px-4 py-2 bg-white/10 hover:bg-white/20 rounded-lg transition-all text-sm"
194
- >
195
- <Trash2 size={18} />
196
- Limpiar chat
197
- </button>
198
- </div>
199
- </div>
200
-
201
- <div className="flex-1 overflow-y-auto px-4 py-6 space-y-4 max-w-6xl mx-auto w-full">
202
- <AnimatePresence>
203
- {messages.map((message) => (
204
- <motion.div
205
- key={message.id}
206
- initial={{ opacity: 0, y: 10 }}
207
- animate={{ opacity: 1, y: 0 }}
208
- exit={{ opacity: 0, y: -10 }}
209
- transition={{ duration: 0.3 }}
210
- className={`flex ${message.sender === "user" ? "justify-end" : "justify-start"}`}
211
- >
212
- <div
213
- className={`max-w-2xl px-4 py-3 rounded-lg ${
214
- message.sender === "user"
215
- ? "bg-gradient-to-r from-neon-cyan to-neon-pink text-black rounded-br-none"
216
- : "bg-white/10 border border-white/20 text-white rounded-bl-none"
217
- }`}
218
- >
219
- <div className="flex items-start gap-3">
220
- {message.sender === "ai" && (
221
- <div className="mt-1 flex-shrink-0">
222
- <div className="p-1 bg-neon-cyan/20 rounded">
223
- <Sparkles size={16} className="text-neon-cyan" />
224
- </div>
225
- </div>
226
- )}
227
- <div className="flex-1">
228
- <p className="text-sm leading-relaxed whitespace-pre-wrap break-words">
229
- {message.text}
230
- </p>
231
- <div className="flex items-center gap-2 mt-2 text-xs opacity-70">
232
- <span>{message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })}</span>
233
- {message.sender === "ai" && (
234
- <>
235
- <button
236
- onClick={() => handleCopy(message.text, message.id)}
237
- className="hover:opacity-100 transition-opacity p-1 hover:bg-white/10 rounded"
238
- title="Copiar"
239
- >
240
- <Copy size={14} />
241
- </button>
242
- <button
243
- className="hover:opacity-100 transition-opacity p-1 hover:bg-white/10 rounded"
244
- title="Leer en voz alta"
245
- >
246
- <Volume2 size={14} />
247
- </button>
248
- </>
249
- )}
250
- </div>
251
- </div>
252
- {message.sender === "user" && (
253
- <div className="mt-1 flex-shrink-0">
254
- <div className="p-1 bg-black/30 rounded">
255
- <User size={16} />
256
- </div>
257
- </div>
258
- )}
259
- </div>
260
- {copiedId === message.id && (
261
- <motion.p
262
- initial={{ opacity: 0 }}
263
- animate={{ opacity: 1 }}
264
- exit={{ opacity: 0 }}
265
- className="text-xs mt-1 text-green-400"
266
- >
267
- ✓ Copiado
268
- </motion.p>
269
- )}
270
- </div>
271
- </motion.div>
272
- ))}
273
- </AnimatePresence>
274
-
275
- {isLoading && (
276
- <motion.div
277
- initial={{ opacity: 0, y: 10 }}
278
- animate={{ opacity: 1, y: 0 }}
279
- className="flex justify-start"
280
- >
281
- <div className="bg-white/10 border border-white/20 text-white rounded-lg rounded-bl-none px-4 py-3">
282
- <div className="flex gap-2">
283
- <motion.div
284
- animate={{ scale: [1, 1.2, 1] }}
285
- transition={{ repeat: Infinity, duration: 0.6 }}
286
- className="w-2 h-2 bg-neon-cyan rounded-full"
287
- />
288
- <motion.div
289
- animate={{ scale: [1, 1.2, 1] }}
290
- transition={{ repeat: Infinity, duration: 0.6, delay: 0.1 }}
291
- className="w-2 h-2 bg-neon-pink rounded-full"
292
- />
293
- <motion.div
294
- animate={{ scale: [1, 1.2, 1] }}
295
- transition={{ repeat: Infinity, duration: 0.6, delay: 0.2 }}
296
- className="w-2 h-2 bg-neon-purple rounded-full"
297
- />
298
- </div>
299
- </div>
300
- </motion.div>
301
- )}
302
-
303
- <div ref={messagesEndRef} />
304
- </div>
305
-
306
- <div className="border-t border-white/10 bg-black/40 backdrop-blur-md p-4">
307
- <div className="max-w-6xl mx-auto flex gap-2">
308
- <input
309
- type="text"
310
- value={input}
311
- onChange={(e) => setInput(e.target.value)}
312
- onKeyPress={(e) => e.key === "Enter" && !isLoading && handleSendMessage()}
313
- placeholder="Pregúntale a Lythron..."
314
- 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"
315
- disabled={isLoading}
316
- />
317
- <button
318
- onClick={handleSendMessage}
319
- disabled={isLoading || !input.trim()}
320
- 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"
321
- >
322
- <Send size={20} />
323
- </button>
324
- </div>
325
- <p className="text-xs text-gray-500 mt-2 text-center">
326
- {LYTHRON_IDENTITY.fullName} • Versión {LYTHRON_IDENTITY.version} • Creado por {LYTHRON_IDENTITY.creator} • Powered by Hugging Face
327
- </p>
328
- </div>
329
- </div>
330
- )
331
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
AI poweful/frontend/src/index.css DELETED
@@ -1,7 +0,0 @@
1
- @tailwind base;
2
- @tailwind components;
3
- @tailwind utilities;
4
-
5
- body {
6
- font-family: 'Inter', sans-serif;
7
- }
 
 
 
 
 
 
 
 
AI poweful/frontend/src/main.jsx DELETED
@@ -1,7 +0,0 @@
1
- @tailwind base;
2
- @tailwind components;
3
- @tailwind utilities;
4
-
5
- body {
6
- font-family: 'Inter', sans-serif;
7
- }