Update static/index.html
Browse files- static/index.html +34 -0
static/index.html
CHANGED
@@ -71,6 +71,40 @@
|
|
71 |
logsList.appendChild(li);
|
72 |
logsList.scrollTop = logsList.scrollHeight; // Auto-scroll
|
73 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
function connect() {
|
75 |
// Adapte le protocole (ws ou wss pour le sécurisé)
|
76 |
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
|
71 |
logsList.appendChild(li);
|
72 |
logsList.scrollTop = logsList.scrollHeight; // Auto-scroll
|
73 |
}
|
74 |
+
// OpenAI API Call for private mode
|
75 |
+
async function callOpenAI(prompt) {
|
76 |
+
console.log('prompt:', prompt)
|
77 |
+
try {
|
78 |
+
const response = await fetch('https://llm.synapse.thalescloud.io/v1/chat/completions', {
|
79 |
+
method: 'POST',
|
80 |
+
headers: {
|
81 |
+
'Content-Type': 'application/json',
|
82 |
+
'Authorization': `Bearer sk-WzlemPa1Od-gAFwALPbgDA`
|
83 |
+
},
|
84 |
+
body: JSON.stringify({
|
85 |
+
model: 'gemini-2.5-pro',
|
86 |
+
messages: [
|
87 |
+
{
|
88 |
+
role: 'user',
|
89 |
+
content: prompt
|
90 |
+
}
|
91 |
+
],
|
92 |
+
temperature: 0.7
|
93 |
+
})
|
94 |
+
});
|
95 |
+
console.log('response:', response)
|
96 |
+
if (!response.ok) {
|
97 |
+
throw new Error(`OpenAI API error: ${response.status}`);
|
98 |
+
}
|
99 |
+
|
100 |
+
const data = await response.json();
|
101 |
+
console.log('data:', data)
|
102 |
+
return data.choices[0].message.content.trim();
|
103 |
+
} catch (error) {
|
104 |
+
console.error('Error calling OpenAI:', error);
|
105 |
+
throw error;
|
106 |
+
}
|
107 |
+
}
|
108 |
function connect() {
|
109 |
// Adapte le protocole (ws ou wss pour le sécurisé)
|
110 |
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|