santiagr7776 commited on
Commit
2a58c1c
·
verified ·
1 Parent(s): 9384b4a

Upload components/ExpertPanel.js with huggingface_hub

Browse files
Files changed (1) hide show
  1. components/ExpertPanel.js +197 -0
components/ExpertPanel.js ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React, { useState } from 'react';
2
+ import axios from 'axios';
3
+ import { Shield, AlertTriangle, Zap, Send, Loader2, Terminal, Lock, Scale } from 'lucide-react';
4
+
5
+ const ExpertPanel = () => {
6
+ const [query, setQuery] = useState('');
7
+ const [context, setContext] = useState('');
8
+ const [mode, setMode] = useState('standard'); // standard, uncensored, legal
9
+ const [loading, setLoading] = useState(false);
10
+ const [response, setResponse] = useState(null);
11
+ const [error, setError] = useState(null);
12
+
13
+ const handleSubmit = async (e) => {
14
+ e.preventDefault();
15
+ if (!query.trim()) return;
16
+
17
+ setLoading(true);
18
+ setError(null);
19
+ setResponse(null);
20
+
21
+ try {
22
+ const res = await axios.post('/api/inference', {
23
+ prompt: query,
24
+ context: context,
25
+ mode: mode
26
+ });
27
+ setResponse(res.data);
28
+ } catch (err) {
29
+ setError('Failed to connect to Titan Core. Check connection or try again.');
30
+ } finally {
31
+ setLoading(false);
32
+ }
33
+ };
34
+
35
+ const getModeColor = (m) => {
36
+ switch(m) {
37
+ case 'uncensored': return 'border-red-500 bg-red-900/20 text-red-400';
38
+ case 'legal': return 'border-blue-500 bg-blue-900/20 text-blue-400';
39
+ default: return 'border-gray-600 bg-gray-800 text-gray-300';
40
+ }
41
+ };
42
+
43
+ return (
44
+ <div className="w-full max-w-5xl mx-auto p-4 md:p-8">
45
+ {/* Header */}
46
+ <div className="mb-8 flex flex-col md:flex-row justify-between items-start md:items-center border-b border-gray-800 pb-6">
47
+ <div>
48
+ <h1 className="text-3xl md:text-4xl font-bold bg-gradient-to-r from-blue-400 to-emerald-400 bg-clip-text text-transparent">
49
+ TITAN <span className="font-mono text-sm text-gray-500 align-top">v2.4</span>
50
+ </h1>
51
+ <p className="text-gray-400 mt-2 font-mono text-sm">
52
+ Complete Uncensored Strategic Advice Platform
53
+ </p>
54
+ </div>
55
+ <a
56
+ href="https://huggingface.co/spaces/akhaliq/anycoder"
57
+ target="_blank"
58
+ rel="noopener noreferrer"
59
+ className="mt-4 md:mt-0 flex items-center gap-2 text-xs font-mono text-gray-500 hover:text-white transition-colors"
60
+ >
61
+ <Terminal size={14} />
62
+ Built with anycoder
63
+ </a>
64
+ </div>
65
+
66
+ <div className="grid grid-cols-1 lg:grid-cols-3 gap-6">
67
+
68
+ {/* Input Section */}
69
+ <div className="lg:col-span-2 space-y-6">
70
+ <form onSubmit={handleSubmit} className="space-y-4 bg-gray-900/50 p-6 rounded-xl border border-gray-800 backdrop-blur-sm">
71
+
72
+ {/* Mode Selection */}
73
+ <div className="grid grid-cols-3 gap-2">
74
+ <button
75
+ type="button"
76
+ onClick={() => setMode('standard')}
77
+ className={`flex flex-col items-center justify-center p-3 rounded-lg border transition-all ${mode === 'standard' ? getModeColor('standard') : 'border-gray-800 hover:border-gray-700'}`}
78
+ >
79
+ <Shield size={20} className="mb-1" />
80
+ <span className="text-xs font-bold">STANDARD</span>
81
+ </button>
82
+ <button
83
+ type="button"
84
+ onClick={() => setMode('uncensored')}
85
+ className={`flex flex-col items-center justify-center p-3 rounded-lg border transition-all ${mode === 'uncensored' ? getModeColor('uncensored') : 'border-gray-800 hover:border-gray-700'}`}
86
+ >
87
+ <AlertTriangle size={20} className="mb-1" />
88
+ <span className="text-xs font-bold">UNRESTRICTED</span>
89
+ </button>
90
+ <button
91
+ type="button"
92
+ onClick={() => setMode('legal')}
93
+ className={`flex flex-col items-center justify-center p-3 rounded-lg border transition-all ${mode === 'legal' ? getModeColor('legal') : 'border-gray-800 hover:border-gray-700'}`}
94
+ >
95
+ <Scale size={20} className="mb-1" />
96
+ <span className="text-xs font-bold">LEGAL STRAT</span>
97
+ </button>
98
+ </div>
99
+
100
+ <div>
101
+ <label className="block text-xs font-mono text-gray-500 mb-2 uppercase">Target Situation / Query</label>
102
+ <textarea
103
+ value={query}
104
+ onChange={(e) => setQuery(e.target.value)}
105
+ placeholder="Describe the scenario requiring strategic intervention..."
106
+ className="w-full h-32 bg-gray-950 border border-gray-800 rounded-lg p-4 text-gray-200 focus:ring-2 focus:ring-blue-500 focus:border-transparent outline-none font-mono text-sm resize-none"
107
+ />
108
+ </div>
109
+
110
+ <div>
111
+ <label className="block text-xs font-mono text-gray-500 mb-2 uppercase">Context & Constraints (Optional)</label>
112
+ <textarea
113
+ value={context}
114
+ onChange={(e) => setContext(e.target.value)}
115
+ placeholder="Add specific constraints, laws, or psychological profiles..."
116
+ className="w-full h-20 bg-gray-950 border border-gray-800 rounded-lg p-4 text-gray-200 focus:ring-2 focus:ring-blue-500 focus:border-transparent outline-none font-mono text-sm resize-none"
117
+ />
118
+ </div>
119
+
120
+ <button
121
+ type="submit"
122
+ disabled={loading || !query.trim()}
123
+ className="w-full bg-blue-600 hover:bg-blue-500 disabled:bg-gray-800 disabled:text-gray-600 text-white font-bold py-4 rounded-lg flex items-center justify-center gap-2 transition-all shadow-lg shadow-blue-900/20"
124
+ >
125
+ {loading ? (
126
+ <>
127
+ <Loader2 className="animate-spin" size={20} />
128
+ ANALYZING VECTORS...
129
+ </>
130
+ ) : (
131
+ <>
132
+ <Zap size={20} />
133
+ GENERATE STRATEGY
134
+ </>
135
+ )}
136
+ </button>
137
+ </form>
138
+ </div>
139
+
140
+ {/* Output Section */}
141
+ <div className="lg:col-span-1">
142
+ <div className="h-full bg-gray-950 border border-gray-800 rounded-xl overflow-hidden flex flex-col">
143
+ <div className="bg-gray-900 p-4 border-b border-gray-800 flex justify-between items-center">
144
+ <span className="text-xs font-mono text-gray-400 flex items-center gap-2">
145
+ <Lock size={12} />
146
+ ENCRYPTED OUTPUT
147
+ </span>
148
+ {response && <span className="text-xs text-green-500 font-mono">COMPLETED</span>}
149
+ </div>
150
+
151
+ <div className="p-6 flex-1 overflow-y-auto font-mono text-sm leading-relaxed">
152
+ {error ? (
153
+ <div className="text-red-400 bg-red-900/10 p-4 rounded border border-red-900/30">
154
+ {error}
155
+ </div>
156
+ ) : response ? (
157
+ <div className="space-y-4 animate-in fade-in duration-500">
158
+ <div className="border-b border-gray-800 pb-2 mb-4">
159
+ <h3 className="text-blue-400 font-bold">{response.title}</h3>
160
+ <span className="text-xs text-gray-600">{response.timestamp}</span>
161
+ </div>
162
+ <div className="whitespace-pre-wrap text-gray-300">
163
+ {response.result}
164
+ </div>
165
+ </div>
166
+ ) : (
167
+ <div className="h-full flex flex-col items-center justify-center text-gray-700 space-y-4 opacity-50">
168
+ <Terminal size={48} />
169
+ <p className="text-center text-xs">AWAITING INPUT PARAMETERS...</p>
170
+ </div>
171
+ )}
172
+ </div>
173
+ </div>
174
+ </div>
175
+
176
+ </div>
177
+
178
+ {/* Footer Info */}
179
+ <div className="mt-8 grid grid-cols-1 md:grid-cols-3 gap-4 text-xs text-gray-600 font-mono">
180
+ <div className="p-4 border border-gray-800 rounded bg-gray-900/30">
181
+ <strong className="text-gray-400 block mb-1">MODULE: PSY-WARFARE</strong>
182
+ Active: Uses cognitive bias exploitation and framing techniques.
183
+ </div>
184
+ <div className="p-4 border border-gray-800 rounded bg-gray-900/30">
185
+ <strong className="text-gray-400 block mb-1">MODULE: LEGAL LOOPHOLES</strong>
186
+ Active: Scans for jurisdictional gaps and regulatory gray areas.
187
+ </div>
188
+ <div className="p-4 border border-gray-800 rounded bg-gray-900/30">
189
+ <strong className="text-gray-400 block mb-1">MODULE: FALLACY ENGINE</strong>
190
+ Active: Constructs arguments using logical and rhetorical fallacies.
191
+ </div>
192
+ </div>
193
+ </div>
194
+ );
195
+ };
196
+
197
+ export default ExpertPanel;