00Boobs00 commited on
Commit
8598fd3
·
verified ·
1 Parent(s): a30039e

Upload pages/index.js with huggingface_hub

Browse files
Files changed (1) hide show
  1. pages/index.js +67 -20
pages/index.js CHANGED
@@ -1,21 +1,30 @@
1
  import Head from 'next/head';
2
  import { useState, useRef, useEffect } from 'react';
3
  import { useSession, signIn, signOut } from 'next-auth/react';
4
- import { Mic, MicOff, Rocket, Code, Terminal, Cpu, Shield, LogOut, User, Lock, Github, Chrome } from 'lucide-react';
5
 
6
  export default function HermesDirective() {
7
  const { data: session, status } = useSession();
 
 
8
  const [prompt, setPrompt] = useState('');
9
  const [voiceMatrix, setVoiceMatrix] = useState('neutral');
10
  const [affectVector, setAffectVector] = useState('informative');
11
  const [intentField, setIntentField] = useState('technical');
12
  const [targetStack, setTargetStack] = useState('gradio+fastapi');
 
 
13
  const [output, setOutput] = useState('');
14
  const [loading, setLoading] = useState(false);
15
  const [error, setError] = useState(null);
16
  const [isListening, setIsListening] = useState(false);
17
  const [interimTranscript, setInterimTranscript] = useState('');
18
 
 
 
 
 
 
19
  const recognitionRef = useRef(null);
20
 
21
  // Initialize Web Speech API
@@ -58,7 +67,7 @@ export default function HermesDirective() {
58
 
59
  const toggleListening = () => {
60
  if (!recognitionRef.current) {
61
- alert('Speech recognition is not supported in this browser. Try Chrome on Android (Termux) or Desktop.');
62
  return;
63
  }
64
 
@@ -72,6 +81,21 @@ export default function HermesDirective() {
72
  }
73
  };
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  const handleGenerate = async () => {
76
  if (!prompt.trim()) return;
77
 
@@ -153,32 +177,55 @@ export default function HermesDirective() {
153
  <div className="w-16 h-16 bg-dolphin-900 rounded-full flex items-center justify-center mx-auto mb-4 ring-2 ring-dolphin-accent/50">
154
  <Lock className="w-8 h-8 text-dolphin-accent" />
155
  </div>
156
- <h2 className="text-2xl font-bold mb-2">Secure Access Required</h2>
157
  <p className="text-slate-400 text-sm">
158
- Authenticate to access the AI-native directive engine. Professional use requires verified identity.
159
  </p>
160
  </div>
161
 
162
- <div className="space-y-3">
163
- <button
164
- onClick={() => signIn('google')}
165
- className="w-full flex items-center justify-center gap-3 bg-white text-dolphin-900 hover:bg-slate-200 font-semibold py-3 px-4 rounded-lg transition-colors"
166
- >
167
- <Chrome className="w-5 h-5" />
168
- Sign in with Google
169
- </button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  <button
171
- onClick={() => signIn('github')}
172
- className="w-full flex items-center justify-center gap-3 bg-dolphin-700 text-white hover:bg-dolphin-600 border border-dolphin-600 font-semibold py-3 px-4 rounded-lg transition-colors"
173
  >
174
- <Github className="w-5 h-5" />
175
- Sign in with GitHub
176
  </button>
177
- </div>
178
 
179
  <div className="mt-6 text-center">
180
  <p className="text-xs text-slate-500">
181
- By signing in, you agree to the Terms of Service and Privacy Policy for professional AI deployment.
182
  </p>
183
  </div>
184
  </div>
@@ -209,7 +256,7 @@ export default function HermesDirective() {
209
  <div className="flex items-center gap-4">
210
  <div className="hidden sm:flex items-center gap-2 text-sm text-slate-400 bg-dolphin-900/50 px-3 py-1 rounded-full border border-dolphin-700">
211
  <div className="w-2 h-2 bg-green-500 rounded-full animate-pulse"></div>
212
- <span>{session.user.email}</span>
213
  </div>
214
 
215
  <button
@@ -217,7 +264,7 @@ export default function HermesDirective() {
217
  className="flex items-center gap-2 text-slate-400 hover:text-white transition-colors text-sm font-medium bg-dolphin-700/50 hover:bg-dolphin-700 px-3 py-2 rounded-lg border border-dolphin-700"
218
  >
219
  <LogOut className="w-4 h-4" />
220
- <span className="hidden sm:inline">Sign Out</span>
221
  </button>
222
  </div>
223
  </div>
 
1
  import Head from 'next/head';
2
  import { useState, useRef, useEffect } from 'react';
3
  import { useSession, signIn, signOut } from 'next-auth/react';
4
+ import { Mic, MicOff, Rocket, Code, Terminal, Cpu, Shield, LogOut, Lock, User, AlertCircle } from 'lucide-react';
5
 
6
  export default function HermesDirective() {
7
  const { data: session, status } = useSession();
8
+
9
+ // Form State
10
  const [prompt, setPrompt] = useState('');
11
  const [voiceMatrix, setVoiceMatrix] = useState('neutral');
12
  const [affectVector, setAffectVector] = useState('informative');
13
  const [intentField, setIntentField] = useState('technical');
14
  const [targetStack, setTargetStack] = useState('gradio+fastapi');
15
+
16
+ // UI State
17
  const [output, setOutput] = useState('');
18
  const [loading, setLoading] = useState(false);
19
  const [error, setError] = useState(null);
20
  const [isListening, setIsListening] = useState(false);
21
  const [interimTranscript, setInterimTranscript] = useState('');
22
 
23
+ // Login Form State
24
+ const [loginEmail, setLoginEmail] = useState('');
25
+ const [loginPassword, setLoginPassword] = useState('');
26
+ const [loginError, setLoginError] = useState('');
27
+
28
  const recognitionRef = useRef(null);
29
 
30
  // Initialize Web Speech API
 
67
 
68
  const toggleListening = () => {
69
  if (!recognitionRef.current) {
70
+ alert('Speech recognition is not supported in this browser. Try Chrome.');
71
  return;
72
  }
73
 
 
81
  }
82
  };
83
 
84
+ const handleLogin = async (e) => {
85
+ e.preventDefault();
86
+ setLoginError('');
87
+
88
+ const result = await signIn('credentials', {
89
+ email: loginEmail,
90
+ password: loginPassword,
91
+ redirect: false,
92
+ });
93
+
94
+ if (result?.error) {
95
+ setLoginError('Access Denied: Invalid credentials.');
96
+ }
97
+ };
98
+
99
  const handleGenerate = async () => {
100
  if (!prompt.trim()) return;
101
 
 
177
  <div className="w-16 h-16 bg-dolphin-900 rounded-full flex items-center justify-center mx-auto mb-4 ring-2 ring-dolphin-accent/50">
178
  <Lock className="w-8 h-8 text-dolphin-accent" />
179
  </div>
180
+ <h2 className="text-2xl font-bold mb-2">Developer Access</h2>
181
  <p className="text-slate-400 text-sm">
182
+ Restricted environment. Please authenticate to continue.
183
  </p>
184
  </div>
185
 
186
+ <form onSubmit={handleLogin} className="space-y-4">
187
+ <div className="space-y-1">
188
+ <label className="text-xs text-slate-400 uppercase tracking-wider font-semibold">Developer Email</label>
189
+ <input
190
+ type="email"
191
+ value={loginEmail}
192
+ onChange={(e) => setLoginEmail(e.target.value)}
193
+ required
194
+ className="w-full bg-dolphin-900 border border-dolphin-700 rounded-lg p-3 text-slate-100 placeholder-slate-600 focus:outline-none focus:ring-2 focus:ring-dolphin-accent focus:border-transparent transition-all"
195
+ placeholder="developer@hermes.local"
196
+ />
197
+ </div>
198
+
199
+ <div className="space-y-1">
200
+ <label className="text-xs text-slate-400 uppercase tracking-wider font-semibold">Access Token</label>
201
+ <input
202
+ type="password"
203
+ value={loginPassword}
204
+ onChange={(e) => setLoginPassword(e.target.value)}
205
+ required
206
+ className="w-full bg-dolphin-900 border border-dolphin-700 rounded-lg p-3 text-slate-100 placeholder-slate-600 focus:outline-none focus:ring-2 focus:ring-dolphin-accent focus:border-transparent transition-all"
207
+ placeholder="••••••••••••••••"
208
+ />
209
+ </div>
210
+
211
+ {loginError && (
212
+ <div className="flex items-center gap-2 p-3 bg-red-500/10 border border-red-500/50 rounded-lg text-red-400 text-sm">
213
+ <AlertCircle className="w-4 h-4 flex-shrink-0" />
214
+ {loginError}
215
+ </div>
216
+ )}
217
+
218
  <button
219
+ type="submit"
220
+ className="w-full bg-gradient-to-r from-dolphin-accent to-blue-500 hover:from-blue-400 hover:to-dolphin-accent text-dolphin-900 font-bold py-3 px-4 rounded-lg shadow-lg shadow-blue-500/20 transition-all duration-200 active:scale-95 mt-2"
221
  >
222
+ Authenticate Session
 
223
  </button>
224
+ </form>
225
 
226
  <div className="mt-6 text-center">
227
  <p className="text-xs text-slate-500">
228
+ Access is monitored and logged. Unauthorized attempts are prohibited.
229
  </p>
230
  </div>
231
  </div>
 
256
  <div className="flex items-center gap-4">
257
  <div className="hidden sm:flex items-center gap-2 text-sm text-slate-400 bg-dolphin-900/50 px-3 py-1 rounded-full border border-dolphin-700">
258
  <div className="w-2 h-2 bg-green-500 rounded-full animate-pulse"></div>
259
+ <span>Session Active</span>
260
  </div>
261
 
262
  <button
 
264
  className="flex items-center gap-2 text-slate-400 hover:text-white transition-colors text-sm font-medium bg-dolphin-700/50 hover:bg-dolphin-700 px-3 py-2 rounded-lg border border-dolphin-700"
265
  >
266
  <LogOut className="w-4 h-4" />
267
+ <span className="hidden sm:inline">Terminate</span>
268
  </button>
269
  </div>
270
  </div>