Spaces:
Sleeping
Sleeping
Update settings.html
Browse files- settings.html +73 -84
settings.html
CHANGED
|
@@ -214,92 +214,81 @@ input[type="number"] {
|
|
| 214 |
<br><br><br><br>
|
| 215 |
|
| 216 |
|
| 217 |
-
<style>
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 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 |
-
<
|
| 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 |
</div>
|
| 305 |
|
|
|
|
| 214 |
<br><br><br><br>
|
| 215 |
|
| 216 |
|
| 217 |
+
<style>
|
| 218 |
+
#chat-box {
|
| 219 |
+
width: 300px;
|
| 220 |
+
height: 400px;
|
| 221 |
+
border: 1px solid #ccc;
|
| 222 |
+
overflow-y: scroll;
|
| 223 |
+
padding: 10px;
|
| 224 |
+
}
|
| 225 |
+
.message {
|
| 226 |
+
margin: 5px 0;
|
| 227 |
+
}
|
| 228 |
+
.message.user {
|
| 229 |
+
text-align: right;
|
| 230 |
+
color: blue;
|
| 231 |
+
}
|
| 232 |
+
.message.bot {
|
| 233 |
+
text-align: left;
|
| 234 |
+
color: green;
|
| 235 |
+
}
|
| 236 |
+
</style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
</head>
|
| 238 |
<body>
|
| 239 |
+
<div id="chat-box"></div>
|
| 240 |
+
<input type="text" id="user-input" placeholder="Type a message...">
|
| 241 |
+
<button id="send-btn">Send</button>
|
| 242 |
+
|
| 243 |
+
<script>
|
| 244 |
+
const chatBox = document.getElementById('chat-box');
|
| 245 |
+
const userInput = document.getElementById('user-input');
|
| 246 |
+
const sendBtn = document.getElementById('send-btn');
|
| 247 |
+
|
| 248 |
+
sendBtn.addEventListener('click', () => {
|
| 249 |
+
const userMessage = userInput.value;
|
| 250 |
+
if (!userMessage) return;
|
| 251 |
+
|
| 252 |
+
appendMessage('user', userMessage);
|
| 253 |
+
userInput.value = '';
|
| 254 |
+
|
| 255 |
+
const apiKey = "sk-d77e468c052044eeaefb0f816f3e0944";
|
| 256 |
+
const apiUrl = "https://api.deepseek.com/v1/chat/completions";
|
| 257 |
+
|
| 258 |
+
fetch(apiUrl, {
|
| 259 |
+
method: 'POST',
|
| 260 |
+
headers: {
|
| 261 |
+
'Content-Type': 'application/json',
|
| 262 |
+
'Authorization': `Bearer ${apiKey}`
|
| 263 |
+
},
|
| 264 |
+
body: JSON.stringify({
|
| 265 |
+
model: "deepseek-chat",
|
| 266 |
+
messages: [
|
| 267 |
+
{ role: "system", content: "You are a helpful assistant" },
|
| 268 |
+
{ role: "user", content: userMessage }
|
| 269 |
+
],
|
| 270 |
+
stream: false
|
| 271 |
+
})
|
| 272 |
+
})
|
| 273 |
+
.then(response => response.json())
|
| 274 |
+
.then(data => {
|
| 275 |
+
const botMessage = data.choices[0].message.content;
|
| 276 |
+
appendMessage('bot', botMessage);
|
| 277 |
+
})
|
| 278 |
+
.catch(error => {
|
| 279 |
+
console.error('Error:', error);
|
| 280 |
+
appendMessage('bot', 'Error: Could not retrieve response.');
|
| 281 |
+
});
|
| 282 |
+
});
|
| 283 |
+
|
| 284 |
+
function appendMessage(role, message) {
|
| 285 |
+
const messageDiv = document.createElement('div');
|
| 286 |
+
messageDiv.classList.add('message', role);
|
| 287 |
+
messageDiv.textContent = message;
|
| 288 |
+
chatBox.appendChild(messageDiv);
|
| 289 |
+
chatBox.scrollTop = chatBox.scrollHeight;
|
| 290 |
+
}
|
| 291 |
+
</script>
|
| 292 |
|
| 293 |
</div>
|
| 294 |
|