Oggy2 commited on
Commit
b3a3767
·
verified ·
1 Parent(s): b33cfc6

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +53 -159
index.html CHANGED
@@ -5,7 +5,7 @@
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>MC Rodrigo AI Chatbot</title>
7
  <style>
8
- @import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Share+Tech+Mono&display=swap');
9
  * { margin:0; padding:0; box-sizing:border-box; font-family:'Share Tech Mono', monospace; }
10
  body {
11
  background: linear-gradient(135deg, #000000, #1a0033, #33001a);
@@ -14,225 +14,119 @@ body {
14
  display:flex;
15
  flex-direction:column;
16
  overflow-x:hidden;
17
- position:relative;
18
- }
19
- body::before {
20
- content:"";
21
- position:absolute;
22
- top:0; left:0; width:100%; height:100%;
23
- background-image:
24
- radial-gradient(circle at 20% 30%, rgba(0, 255, 157, 0.05) 2px, transparent 2px),
25
- radial-gradient(circle at 60% 70%, rgba(128, 0, 255, 0.05) 2px, transparent 2px),
26
- radial-gradient(circle at 80% 20%, rgba(255, 0, 128, 0.05) 2px, transparent 2px);
27
- background-size: 100px 100px, 150px 150px, 120px 120px;
28
- opacity:0.3;
29
- z-index:-1;
30
- animation: scanlines 0.5s linear infinite;
31
- }
32
- @keyframes scanlines {
33
- 0% { background-position: 0 0, 0 0, 0 0; }
34
- 100% { background-position: 0 100px, 0 150px, 0 120px; }
35
  }
36
  header {
37
  text-align:center;
38
  padding:20px;
39
  background: rgba(0, 0, 0, 0.85);
40
- backdrop-filter: blur(10px);
41
  border-bottom:3px solid #00ff9d;
42
  box-shadow: 0 0 30px rgba(0, 255, 157, 0.3);
43
  }
44
  h1 {
45
  font-size:2.5rem;
46
- margin-bottom:10px;
47
- text-shadow:0 0 10px #00ff9d, 0 0 20px #00ff9d;
48
- animation: textGlitch 3s infinite;
49
  font-family:'Orbitron', sans-serif;
50
- font-weight:900;
51
  letter-spacing:2px;
52
  }
53
- @keyframes textGlitch {
54
- 0%, 100% { transform:translateX(0); text-shadow:0 0 10px #00ff9d, 0 0 20px #00ff9d; }
55
- 95% { transform:translateX(0); }
56
- 96% { transform:translateX(-1px); text-shadow:0 0 10px #ff009d, 0 0 20px #ff009d; }
57
- 97% { transform:translateX(1px); text-shadow:0 0 10px #009dff, 0 0 20px #009dff; }
58
- 98% { transform:translateX(0); }
59
- }
60
- .subtitle {
61
- font-size:1.2rem;
62
- color:#00ff9d;
63
- font-family:'Orbitron', sans-serif;
64
- text-shadow:0 0 5px #00ff9d;
65
- animation: pulse 2s infinite;
66
- }
67
- @keyframes pulse { 0%, 100% { opacity:1; } 50% { opacity:0.7; } }
68
- .techno-grid {
69
- position:absolute;
70
- top:0; left:0; width:100%; height:100%;
71
- background-image:
72
- linear-gradient(rgba(0, 255, 157, 0.03) 1px, transparent 1px),
73
- linear-gradient(90deg, rgba(0, 255, 157, 0.03) 1px, transparent 1px);
74
- background-size: 50px 50px;
75
- z-index:-2;
76
- animation: gridMove 20s linear infinite;
77
- }
78
- @keyframes gridMove { 0% { transform:translate(0, 0); } 100% { transform:translate(-50px, -50px); } }
79
- main { flex:1; max-width:800px; margin:20px auto; width:100%; padding:0 20px; }
80
  .chat-section {
 
 
 
 
81
  background: rgba(0, 0, 0, 0.85);
82
  border-radius:15px;
83
  padding:20px;
84
- backdrop-filter: blur(10px);
85
- box-shadow:0 0 50px rgba(0, 255, 157, 0.2);
86
  display:flex;
87
  flex-direction:column;
88
- border:2px solid #00ff9d;
89
- position:relative;
90
- height:calc(100vh - 250px);
91
- overflow:hidden;
92
  }
93
- .chat-messages {
94
  flex:1;
95
  overflow-y:auto;
96
- padding:10px;
97
  margin-bottom:20px;
98
  display:flex;
99
  flex-direction:column;
100
- gap:15px;
101
- }
102
- .message {
103
- max-width:80%;
104
- padding:12px 15px;
105
- border-radius:8px;
106
- position:relative;
107
- animation: fadeIn 0.3s ease-in-out;
108
- border:1px solid;
109
- font-size:0.9rem;
110
- }
111
- @keyframes fadeIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
112
- .user-message {
113
- align-self:flex-end;
114
- background:rgba(0, 50, 30, 0.4);
115
- color:#00ff9d;
116
- border-color:rgba(0, 255, 157, 0.5);
117
- }
118
- .ai-message {
119
- align-self:flex-start;
120
- background:rgba(20, 0, 40, 0.4);
121
- color:#00ff9d;
122
- border-color:rgba(128, 0, 255, 0.5);
123
  }
124
- .ai-message::before {
125
- content:"RODRIGO_SYS_";
126
- position:absolute;
127
- top:-8px;
128
- left:10px;
129
- font-size:0.6rem;
130
- color:#8000ff;
131
- font-family:'Orbitron', sans-serif;
132
- }
133
- .typing-indicator {
134
- display:none;
135
- align-self:flex-start;
136
- padding:12px 15px;
137
- background:rgba(20, 0, 40, 0.4);
138
- border-radius:8px;
139
- color: #8000ff;
140
- font-size: 0.8rem;
141
- }
142
- .typing-indicator.active { display:block; }
143
  .chat-input { display:flex; gap:10px; }
144
- .chat-input input {
145
- flex:1;
146
- padding:12px 15px;
147
- border-radius:25px;
148
- background:rgba(0, 255, 157, 0.1);
149
- color:#00ff9d;
150
- border:1px solid rgba(0, 255, 157, 0.3);
151
- }
152
- .chat-input button {
153
- padding:12px 20px;
154
- border-radius:25px;
155
- background:linear-gradient(45deg, #00ff9d, #8000ff);
156
- color:#000;
157
- font-weight:bold;
158
- cursor:pointer;
159
- font-family:'Orbitron', sans-serif;
160
- }
161
  </style>
162
  </head>
163
  <body>
164
- <div class="techno-grid"></div>
165
  <header>
166
  <h1>MC RODRIGO</h1>
167
- <div class="subtitle">DUCKDUCKGO HUMOR CORE v2.6</div>
168
  </header>
169
 
170
- <main>
171
- <div class="chat-section">
172
- <div id="chatMessages" class="chat-messages">
173
- <div class="message ai-message">SIGNAL ESTABLISHED. HUMOR PROTOCOLS AT 100%. READY TO ROAST.</div>
174
- </div>
175
- <div id="typing" class="typing-indicator">INFERRING WITTY COMEBACK...</div>
176
- <div class="chat-input">
177
- <input type="text" id="userInput" placeholder="TYPE SIGNAL..." autocomplete="off">
178
- <button id="sendBtn">TRANSMIT</button>
179
- </div>
180
  </div>
181
  </main>
182
 
183
  <script type="module">
 
184
  import { HfInference } from "cdn.jsdelivr.net";
185
 
186
- // Access the variable securely from Space Settings
187
  const KEY = window.huggingface?.variables?.HF_TOKEN;
188
- const MODEL = "Qwen/Qwen2.5-7B-Instruct";
189
 
190
- if (!KEY) console.error("HF_TOKEN missing in Space Settings.");
191
-
192
- const client = new HfInference(KEY);
193
- const msgs = document.getElementById('chatMessages');
194
- const input = document.getElementById('userInput');
195
- const sendBtn = document.getElementById('sendBtn');
196
- const typing = document.getElementById('typing');
197
 
198
- function addMessage(text, role) {
199
- const div = document.createElement('div');
200
- div.className = `message ${role === 'user' ? 'user-message' : 'ai-message'}`;
201
- div.innerText = text;
202
- msgs.appendChild(div);
203
- msgs.scrollTop = msgs.scrollHeight;
204
  }
205
 
206
  async function handleChat() {
 
207
  const text = input.value.trim();
208
- if (!text || !KEY) return;
209
 
210
- addMessage(text, 'user');
211
  input.value = '';
212
- typing.classList.add('active');
213
- sendBtn.disabled = true;
214
 
215
  try {
216
- const response = await client.chatCompletion({
 
217
  model: MODEL,
218
  messages: [
219
- { role: "system", content: "You are MC Rodrigo. Use sharp, sarcastic DuckDuckGo style humor. You are technically superior, brief, and very funny. Avoid cliches." },
220
  { role: "user", content: text }
221
  ],
222
  max_tokens: 250
223
  });
224
 
225
- addMessage(response.choices.message.content, 'bot');
 
226
  } catch (err) {
227
- addMessage("CONNECTION LOST. REBOOT TOKEN OR CHECK QUOTA.", 'bot');
228
- } finally {
229
- typing.classList.remove('active');
230
- sendBtn.disabled = false;
231
  }
232
  }
233
 
234
- sendBtn.onclick = handleChat;
235
- input.onkeypress = (e) => { if(e.key === 'Enter') handleChat(); };
 
 
 
 
 
 
 
 
236
  </script>
237
  </body>
238
- </html>
 
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>MC Rodrigo AI Chatbot</title>
7
  <style>
8
+ @import url('fonts.googleapis.com');
9
  * { margin:0; padding:0; box-sizing:border-box; font-family:'Share Tech Mono', monospace; }
10
  body {
11
  background: linear-gradient(135deg, #000000, #1a0033, #33001a);
 
14
  display:flex;
15
  flex-direction:column;
16
  overflow-x:hidden;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  }
18
  header {
19
  text-align:center;
20
  padding:20px;
21
  background: rgba(0, 0, 0, 0.85);
 
22
  border-bottom:3px solid #00ff9d;
23
  box-shadow: 0 0 30px rgba(0, 255, 157, 0.3);
24
  }
25
  h1 {
26
  font-size:2.5rem;
 
 
 
27
  font-family:'Orbitron', sans-serif;
 
28
  letter-spacing:2px;
29
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  .chat-section {
31
+ flex:1;
32
+ max-width:800px;
33
+ margin:20px auto;
34
+ width:100%;
35
  background: rgba(0, 0, 0, 0.85);
36
  border-radius:15px;
37
  padding:20px;
38
+ border:2px solid #00ff9d;
 
39
  display:flex;
40
  flex-direction:column;
 
 
 
 
41
  }
42
+ #chatMessages {
43
  flex:1;
44
  overflow-y:auto;
 
45
  margin-bottom:20px;
46
  display:flex;
47
  flex-direction:column;
48
+ gap:10px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  }
50
+ .message { padding:10px; border-radius:8px; border:1px solid; max-width:85%; }
51
+ .user { align-self:flex-end; background:rgba(0, 50, 30, 0.4); border-color:#00ff9d; }
52
+ .bot { align-self:flex-start; background:rgba(20, 0, 40, 0.4); border-color:#8000ff; }
53
+ .status-bar { font-size: 0.7rem; color: #8000ff; margin-bottom: 10px; text-align: center; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  .chat-input { display:flex; gap:10px; }
55
+ input { flex:1; padding:12px; background:rgba(0, 255, 157, 0.1); color:#00ff9d; border:1px solid rgba(0, 255, 157, 0.3); border-radius:25px; }
56
+ button { padding:12px 25px; background:linear-gradient(45deg, #00ff9d, #8000ff); border:none; border-radius:25px; cursor:pointer; font-weight:bold; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  </style>
58
  </head>
59
  <body>
 
60
  <header>
61
  <h1>MC RODRIGO</h1>
62
+ <div style="color:#00ff9d; font-size:0.8rem;">DUCKDUCKGO HUMOR CORE v2.6</div>
63
  </header>
64
 
65
+ <main class="chat-section">
66
+ <div id="status" class="status-bar">CONNECTING TO RODRIGO_SYS...</div>
67
+ <div id="chatMessages"></div>
68
+ <div class="chat-input">
69
+ <input type="text" id="userInput" placeholder="TRANSMIT SIGNAL..." autocomplete="off">
70
+ <button id="sendBtn">SEND</button>
 
 
 
 
71
  </div>
72
  </main>
73
 
74
  <script type="module">
75
+ // Using official 2026 HF Inference library
76
  import { HfInference } from "cdn.jsdelivr.net";
77
 
78
+ // 2026 Protocol: Securely accessing Space Variables
79
  const KEY = window.huggingface?.variables?.HF_TOKEN;
80
+ const MODEL = "Qwen/Qwen2.5-7B-Instruct"; // Warm and stable free-tier model
81
 
82
+ const client = KEY ? new HfInference(KEY) : null;
83
+ const log = document.getElementById('chatMessages');
84
+ const status = document.getElementById('status');
 
 
 
 
85
 
86
+ if (client) {
87
+ status.innerText = "✅ SYSTEM ACTIVE: DUCKDUCKGO HUMOR PROTOCOLS LOADED";
88
+ } else {
89
+ status.innerText = "❌ ERROR: HF_TOKEN NOT FOUND IN SETTINGS > VARIABLES";
 
 
90
  }
91
 
92
  async function handleChat() {
93
+ const input = document.getElementById('userInput');
94
  const text = input.value.trim();
95
+ if (!text || !client) return;
96
 
97
+ addMsg(text, 'user');
98
  input.value = '';
99
+ status.innerText = "INFERRING WITTY RESPONSE...";
 
100
 
101
  try {
102
+ // New 2026 Router endpoint standard
103
+ const res = await client.chatCompletion({
104
  model: MODEL,
105
  messages: [
106
+ { role: "system", content: "You are MC Rodrigo. Use sharp, sarcastic DuckDuckGo-style humor. Be technically superior, brief, and very funny." },
107
  { role: "user", content: text }
108
  ],
109
  max_tokens: 250
110
  });
111
 
112
+ addMsg(res.choices[0].message.content, 'bot');
113
+ status.innerText = "✅ SYSTEM READY";
114
  } catch (err) {
115
+ addMsg("SIGNAL LOST: " + err.message, 'bot');
116
+ status.innerText = "❌ CONNECTION FAILED";
 
 
117
  }
118
  }
119
 
120
+ function addMsg(t, type) {
121
+ const d = document.createElement('div');
122
+ d.className = `message ${type}`;
123
+ d.innerText = t;
124
+ log.appendChild(d);
125
+ log.scrollTop = log.scrollHeight;
126
+ }
127
+
128
+ document.getElementById('sendBtn').onclick = handleChat;
129
+ document.getElementById('userInput').onkeypress = (e) => { if(e.key === 'Enter') handleChat(); };
130
  </script>
131
  </body>
132
+ </html>