DmitrMakeev commited on
Commit
1c9fac5
1 Parent(s): ca93fd5

Update settings.html

Browse files
Files changed (1) hide show
  1. settings.html +85 -0
settings.html CHANGED
@@ -214,7 +214,92 @@ input[type="number"] {
214
  <br><br><br><br>
215
 
216
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
217
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
 
219
  </div>
220
 
 
214
  <br><br><br><br>
215
 
216
 
217
+ <style>
218
+ body {
219
+ font-family: Arial, sans-serif;
220
+ padding: 20px;
221
+ }
222
+ #chat-container {
223
+ max-width: 600px;
224
+ margin: 0 auto;
225
+ }
226
+ #chat-output {
227
+ background: #f9f9f9;
228
+ border: 1px solid #ddd;
229
+ padding: 10px;
230
+ margin-bottom: 10px;
231
+ height: 200px;
232
+ overflow-y: scroll;
233
+ }
234
+ #user-input {
235
+ width: 70%;
236
+ padding: 10px;
237
+ margin-right: 10px;
238
+ }
239
+ button {
240
+ padding: 10px;
241
+ background: #007BFF;
242
+ color: white;
243
+ border: none;
244
+ cursor: pointer;
245
+ }
246
+ button:hover {
247
+ background: #0056b3;
248
+ }
249
+ </style>
250
+ </head>
251
+ <body>
252
 
253
+ <div id="chat-container">
254
+ <div id="chat-output"></div>
255
+ <input type="text" id="user-input" placeholder="Type your message here...">
256
+ <button onclick="sendMessage()">Send</button>
257
+ </div>
258
+
259
+ <script>
260
+ const API_KEY = '<your-openai-api-key>'; // Замените на ваш ключ API
261
+ const BASE_URL = 'https://api.openai.com/v1/chat/completions';
262
+
263
+ function sendMessage() {
264
+ const userInput = document.getElementById('user-input').value;
265
+ const outputDiv = document.getElementById('chat-output');
266
+
267
+ // Очищаем поле ввода
268
+ document.getElementById('user-input').value = '';
269
+
270
+ // Добавляем сообщение пользователя в чат
271
+ outputDiv.innerHTML += `<p><strong>You:</strong> ${userInput}</p>`;
272
+
273
+ // Формируем запрос к API
274
+ const requestOptions = {
275
+ method: 'POST',
276
+ headers: {
277
+ 'Content-Type': 'application/json',
278
+ 'Authorization': `Bearer ${API_KEY}`
279
+ },
280
+ body: JSON.stringify({
281
+ model: 'deepseek-chat',
282
+ messages: [
283
+ {"role": "system", "content": "You are a helpful assistant"},
284
+ {"role": "user", "content": userInput}
285
+ ],
286
+ stream: false
287
+ })
288
+ };
289
+
290
+ // Отправляем запрос к API
291
+ fetch(BASE_URL, requestOptions)
292
+ .then(response => response.json())
293
+ .then(data => {
294
+ // Обрабатываем ответ от API
295
+ const aiResponse = data.choices[0].message.content;
296
+ outputDiv.innerHTML += `<p><strong>AI:</strong> ${aiResponse}</p>`;
297
+ })
298
+ .catch(error => {
299
+ console.error('Error:', error);
300
+ });
301
+ }
302
+ </script>
303
 
304
  </div>
305