Update settings.html
Browse files213 unmodified lines214215216217218219220213 unmodified lines<br><br><br><br></div>213 unmodified lines214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305213 unmodified lines<br><br><br><br><style>body {font-family: Arial, sans-serif;padding: 20px;}#chat-container {max-width: 600px;margin: 0 auto;}#chat-output {background: #f9f9f9;border: 1px solid #ddd;padding: 10px;margin-bottom: 10px;height: 200px;overflow-y: scroll;}#user-input {width: 70%;padding: 10px;margin-right: 10px;}button {padding: 10px;background: #007BFF;color: white;border: none;cursor: pointer;}button:hover {background: #0056b3;}</style></head><body><div id="chat-container"><div id="chat-output"></div><input type="text" id="user-input" placeholder="Type your message here..."><button onclick="sendMessage()">Send</button></div><script>const API_KEY = '<your-openai-api-key>'; // Замените на ваш ключ APIconst BASE_URL = 'https://api.openai.com/v1/chat/completions';function sendMessage() {const userInput = document.getElementById('user-input').value;const outputDiv = document.getElementById('chat-output');// Очищаем поле вводаdocument.getElementById('user-input').value = '';// Добавляем сообщение пользователя в чатoutputDiv.innerHTML += `<p><strong>You:</strong> ${userInput}</p>`;// Формируем запрос к APIconst requestOptions = {method: 'POST',headers: {'Content-Type': 'application/json','Authorization': `Bearer ${API_KEY}`},body: JSON.stringify({model: 'deepseek-chat',messages: [{"role": "system", "content": "You are a helpful assistant"},{"role": "user", "content": userInput}],stream: false})};// Отправляем запрос к APIfetch(BASE_URL, requestOptions).then(response => response.json()).then(data => {// Обрабатываем ответ от APIconst aiResponse = data.choices[0].message.content;outputDiv.innerHTML += `<p><strong>AI:</strong> ${aiResponse}</p>`;}).catch(error => {console.error('Error:', error);});}</script></div>
settings.html+85