File size: 12,611 Bytes
7706ff4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Codette Cognitive Processing Interface</title>
    <style>

        body {

            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

            background: linear-gradient(135deg, #2c1810 0%, #8b4513 100%);

            color: white;

            margin: 0;

            padding: 2rem;

            min-height: 100vh;

        }



        .container {

            max-width: 1200px;

            margin: 0 auto;

        }



        .header {

            text-align: center;

            margin-bottom: 2rem;

        }



        .header h1 {

            font-size: 2.5rem;

            background: linear-gradient(45deg, #ffd700, #ffb347);

            -webkit-background-clip: text;

            -webkit-text-fill-color: transparent;

            background-clip: text;

        }



        .nav-bar {

            background: rgba(255, 255, 255, 0.1);

            backdrop-filter: blur(10px);

            border-radius: 8px;

            padding: 1rem;

            margin-bottom: 2rem;

            text-align: center;

        }



        .nav-bar a {

            color: white;

            text-decoration: none;

            padding: 0.5rem 1rem;

            margin: 0 0.5rem;

            border-radius: 4px;

            transition: background 0.3s ease;

        }



        .nav-bar a:hover {

            background: rgba(255, 255, 255, 0.2);

        }



        .cognitive-interface {

            display: grid;

            grid-template-columns: 1fr 1fr;

            gap: 2rem;

        }



        .input-panel {

            background: rgba(255, 255, 255, 0.1);

            backdrop-filter: blur(10px);

            border-radius: 16px;

            padding: 2rem;

            border: 1px solid rgba(255, 255, 255, 0.2);

        }



        .output-panel {

            background: rgba(255, 255, 255, 0.1);

            backdrop-filter: blur(10px);

            border-radius: 16px;

            padding: 2rem;

            border: 1px solid rgba(255, 255, 255, 0.2);

        }



        .query-textarea {

            width: 100%;

            height: 150px;

            padding: 1rem;

            border: none;

            border-radius: 8px;

            background: rgba(255, 255, 255, 0.9);

            color: #333;

            font-size: 1rem;

            resize: vertical;

            margin-bottom: 1rem;

        }



        .perspective-selector {

            display: grid;

            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));

            gap: 0.5rem;

            margin: 1rem 0;

        }



        .perspective-option {

            display: flex;

            align-items: center;

            padding: 0.5rem;

            background: rgba(255, 255, 255, 0.1);

            border-radius: 4px;

            cursor: pointer;

            transition: background 0.3s ease;

        }



        .perspective-option:hover {

            background: rgba(255, 255, 255, 0.2);

        }



        .perspective-option input {

            margin-right: 0.5rem;

        }



        .btn-cognitive {

            background: linear-gradient(45deg, #ffd700, #ff8c00);

            color: white;

            padding: 1rem 2rem;

            border: none;

            border-radius: 8px;

            font-size: 1rem;

            cursor: pointer;

            transition: all 0.3s ease;

            width: 100%;

        }



        .btn-cognitive:hover {

            transform: translateY(-2px);

            box-shadow: 0 5px 15px rgba(255, 215, 0, 0.4);

        }



        .response-tabs {

            display: flex;

            margin-bottom: 1rem;

        }



        .tab {

            padding: 0.8rem 1.5rem;

            background: rgba(255, 255, 255, 0.1);

            border: none;

            color: white;

            cursor: pointer;

            border-radius: 8px 8px 0 0;

            margin-right: 0.5rem;

            transition: background 0.3s ease;

        }



        .tab.active {

            background: rgba(255, 255, 255, 0.2);

        }



        .tab-content {

            background: rgba(0, 0, 0, 0.3);

            border-radius: 0 8px 8px 8px;

            padding: 1.5rem;

            min-height: 300px;

            font-family: monospace;

            white-space: pre-wrap;

            overflow-y: auto;

        }



        .perspective-badge {

            display: inline-block;

            padding: 0.3rem 0.8rem;

            background: rgba(255, 215, 0, 0.2);

            border: 1px solid #ffd700;

            border-radius: 20px;

            font-size: 0.8rem;

            margin: 0.2rem;

        }



        @media (max-width: 768px) {

            .cognitive-interface {

                grid-template-columns: 1fr;

            }

        }

    </style>
</head>
<body>
    <div class="container">
        <nav class="nav-bar">
            <a href="/">🏠 Home</a>
            <a href="/dashboard">πŸ“Š Dashboard</a>
            <a href="/quantum">βš›οΈ Quantum</a>
            <a href="/cognitive">🧠 Cognitive</a>
        </nav>

        <header class="header">
            <h1>🧠 Cognitive Processing Interface</h1>
            <p>Multi-perspective AI reasoning with recursive thought loops and ethical analysis</p>
        </header>

        <div class="cognitive-interface">
            <div class="input-panel">
                <h2>πŸ’­ Query Input</h2>
                
                <textarea 

                    id="cognitiveQuery" 

                    class="query-textarea"

                    placeholder="Enter your question or prompt for Codette's cognitive analysis...



Examples:

- What is the ethical implications of AGI?

- How should AI handle conflicting human values?

- Explain consciousness from multiple perspectives

- Design a solution for climate change"

                ></textarea>
                
                <h3>🎭 Perspective Agents</h3>
                <div class="perspective-selector">
                    <div class="perspective-option">
                        <input type="checkbox" id="scientific" checked>
                        <label for="scientific">πŸ”¬ Scientific</label>
                    </div>
                    <div class="perspective-option">
                        <input type="checkbox" id="creative" checked>
                        <label for="creative">🎨 Creative</label>
                    </div>
                    <div class="perspective-option">
                        <input type="checkbox" id="emotional" checked>
                        <label for="emotional">❀️ Emotional</label>
                    </div>
                    <div class="perspective-option">
                        <input type="checkbox" id="ethical">
                        <label for="ethical">βš–οΈ Ethical</label>
                    </div>
                    <div class="perspective-option">
                        <input type="checkbox" id="quantum">
                        <label for="quantum">βš›οΈ Quantum</label>
                    </div>
                    <div class="perspective-option">
                        <input type="checkbox" id="philosophical">
                        <label for="philosophical">πŸ€” Philosophical</label>
                    </div>
                </div>
                
                <button onclick="processCognitiveQuery()" class="btn-cognitive">
                    🧠 Process with Codette
                </button>
            </div>

            <div class="output-panel">
                <h2>🎯 Cognitive Analysis Results</h2>
                
                <div class="response-tabs">
                    <button class="tab active" onclick="showTab('insights')">πŸ’‘ Insights</button>
                    <button class="tab" onclick="showTab('classic')">🧠 Classic</button>
                    <button class="tab" onclick="showTab('cqure')">⚑ CQURE</button>
                    <button class="tab" onclick="showTab('sentiment')">😊 Sentiment</button>
                </div>
                
                <div id="insightsTab" class="tab-content">
                    Select perspectives and enter a query to see Codette's multi-perspective analysis...
                </div>
                
                <div id="classicTab" class="tab-content" style="display: none;">
                    Classic Codette responses will appear here...
                </div>
                
                <div id="cqureTab" class="tab-content" style="display: none;">
                    CQURE system responses will appear here...
                </div>
                
                <div id="sentimentTab" class="tab-content" style="display: none;">
                    Sentiment analysis results will appear here...
                </div>
            </div>
        </div>
    </div>

    <script>

        let currentTab = 'insights';

        

        function showTab(tabName) {

            // Hide all tabs

            const tabs = ['insights', 'classic', 'cqure', 'sentiment'];

            tabs.forEach(tab => {

                document.getElementById(tab + 'Tab').style.display = 'none';

                document.querySelector(`[onclick="showTab('${tab}')"]`).classList.remove('active');

            });

            

            // Show selected tab

            document.getElementById(tabName + 'Tab').style.display = 'block';

            document.querySelector(`[onclick="showTab('${tabName}')"]`).classList.add('active');

            currentTab = tabName;

        }

        

        async function processCognitiveQuery() {

            const query = document.getElementById('cognitiveQuery').value;

            

            if (!query.trim()) {

                alert('Please enter a query for cognitive processing');

                return;

            }

            

            // Show processing state

            const tabs = ['insights', 'classic', 'cqure', 'sentiment'];

            tabs.forEach(tab => {

                document.getElementById(tab + 'Tab').textContent = 'Processing cognitive analysis...';

            });

            

            try {

                const response = await fetch('/api/query', {

                    method: 'POST',

                    headers: {

                        'Content-Type': 'application/json',

                    },

                    body: JSON.stringify({

                        query: query,

                        user_id: 'cognitive_user_' + Date.now()

                    })

                });

                

                const data = await response.json();

                

                if (data.error) {

                    tabs.forEach(tab => {

                        document.getElementById(tab + 'Tab').textContent = `Error: ${data.error}`;

                    });

                } else {

                    // Populate each tab with relevant data

                    document.getElementById('insightsTab').textContent = 

                        data.insights ? data.insights.join('\n\n') : 'No insights generated';

                    

                    document.getElementById('classicTab').textContent = 

                        data.classic_response || 'No classic response generated';

                    

                    document.getElementById('cqureTab').textContent = 

                        data.cqure_response || 'No CQURE response generated';

                    

                    document.getElementById('sentimentTab').textContent = 

                        data.sentiment ? JSON.stringify(data.sentiment, null, 2) : 'No sentiment analysis';

                }

                

            } catch (error) {

                tabs.forEach(tab => {

                    document.getElementById(tab + 'Tab').textContent = `Network Error: ${error.message}`;

                });

            }

        }

        

        // Allow Enter key to submit (with Shift+Enter for new line)

        document.getElementById('cognitiveQuery').addEventListener('keydown', function(e) {

            if (e.key === 'Enter' && !e.shiftKey) {

                e.preventDefault();

                processCognitiveQuery();

            }

        });

    </script>
</body>
</html>