Spaces:
Sleeping
Sleeping
File size: 14,439 Bytes
fcbe31c aeb57d7 fcbe31c 59a861d fcbe31c 59a861d fcbe31c aeb57d7 fcbe31c aeb57d7 fcbe31c aeb57d7 fcbe31c aeb57d7 fcbe31c 59a861d fcbe31c 59a861d fcbe31c 59a861d fcbe31c aeb57d7 fcbe31c 59a861d fcbe31c 59a861d fcbe31c 59a861d fcbe31c aeb57d7 fcbe31c aeb57d7 fcbe31c aeb57d7 fcbe31c aeb57d7 fcbe31c aeb57d7 fcbe31c 59a861d fcbe31c aeb57d7 fcbe31c aeb57d7 fcbe31c aeb57d7 fcbe31c aeb57d7 fcbe31c aeb57d7 fcbe31c |
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 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 |
<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html lang="en"> <!--<![endif]-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="TechWave">
<meta name="author" content="SRBThemes">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>AI Chat Bot</title>
<script>
if (!localStorage.frenify_skin) {
localStorage.frenify_skin = 'dark';
}
if (!localStorage.frenify_panel) {
localStorage.frenify_panel = '';
}
document.documentElement.setAttribute("data-techwave-skin", localStorage.frenify_skin);
if(localStorage.frenify_panel !== ''){
document.documentElement.classList.add(localStorage.frenify_panel);
}
</script>
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Heebo:wght@100;200;300;400;500;600;700;800;900&family=Work+Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
<!-- !Google Fonts -->
<!-- Styles -->
<link type="text/css" rel="stylesheet" href="desine/css/plugins.css?ver=1.0.0" />
<link type="text/css" rel="stylesheet" href="desine/css/style.css?ver=1.0.0" />
<!--[if lt IE 9]> <script type="text/javascript" src="desine/js/modernizr.custom.js"></script> <![endif]-->
<!-- !Styles -->
</head>
<body>
<!-- Moving Submenu -->
<div class="techwave_fn_fixedsub">
<ul></ul>
</div>
<!-- !Moving Submenu -->
<!-- Preloader -->
<div class="techwave_fn_preloader">
<svg>
<circle class="first_circle" cx="50%" cy="50%" r="110"></circle>
<circle class="second_circle" cx="50%" cy="50%" r="110"></circle>
</svg>
</div>
<!-- !Preloader -->
<div class="techwave_fn_font">
<a class="font__closer_link fn__icon_button" href="#"><img src="desine/svg/close.svg" alt="" class="fn__svg"></a>
<div class="font__closer"></div>
<div class="font__dialog">
<h3 class="title">Font Options</h3>
<label for="font_size">Font Size</label>
<select id="font_size">
<option value="10">10 px</option>
<option value="12">12 px</option>
<option value="14">14 px</option>
<option value="16" selected> 16 px</option>
<option value="18">18 px</option>
<option value="20">20 px</option>
<option value="22" >22 px</option>
<option value="24">24 px</option>
<option value="26">26 px</option>
<option value="28">28 px</option>
</select>
<a href="#" class="apply techwave_fn_button"><span>Apply</span></a>
</div>
</div>
<!-- MAIN WRAPPER -->
<div class="techwave_fn_wrapper fn__has_sidebar">
<div class="techwave_fn_wrap">
<!-- Searchbar -->
<div class="techwave_fn_searchbar">
<div class="search__bar">
<input class="search__input" type="text" placeholder="Search here...">
<img src="desine/svg/search.svg" alt="" class="fn__svg search__icon">
<a class="search__closer" href="#"><img src="desine/svg/close.svg" alt="" class="fn__svg"></a>
</div>
<div class="search__results">
<!-- Results will come here (via ajax after the integration you made after purchase as it doesn't work in HTML) -->
<div class="results__list">
<ul>
</ul>
</div>
</div>
</div>
<!-- !Searchbar -->
<!-- HEADER -->
<header class="techwave_fn_header">
<!-- Header right: navigation bar -->
<div class="header__right">
<div class="fn__nav_bar">
<!-- Site Skin (bar item) -->
<div class="bar__item bar__item_skin">
<a href="#" class="item_opener">
<img src="desine/svg/sun.svg" alt="" class="fn__svg light_mode">
<img src="desine/svg/moon.svg" alt="" class="fn__svg dark_mode">
</a>
</div>
<!-- !Site Skin (bar item) -->
<!-- User (bar item) -->
<div class="bar__item bar__item_user">
<a href="#" class="user_opener">
<img src="https://raw.githubusercontent.com/omarnuwrar/urmkklsoqpgh-45kjfnskhbnqwhn3jgfj2mgjm3/main/{{account_name}}.png" alt="">
</a>
<div class="item_popup">
<div class="user_profile">
<div class="user_img">
<img src="https://raw.githubusercontent.com/omarnuwrar/urmkklsoqpgh-45kjfnskhbnqwhn3jgfj2mgjm3/main/{{account_name}}.png" alt="">
</div>
<div class="user_info">
<h2 class="user_name">{{ account_name }}<span>Free</span></h2>
</div>
</div>
<div class="user_nav">
<ul>
<li>
<a href="/login">
<span class="icon"><img src="desine/svg/logout.svg" alt="" class="fn__svg"></span>
<span class="text">Log out</span>
</a>
</li>
</ul>
</div>
</div>
</div>
<!-- !User (bar item) -->
</div>
</div>
<!-- !Header right: navigation bar -->
</header>
<!-- !HEADER -->
<!-- LEFT PANEL -->
<div class="techwave_fn_leftpanel">
<div class="mobile_extra_closer"></div>
</div>
<!-- !LEFT PANEL -->
<!-- CONTENT -->
<div class="techwave_fn_content">
<!-- PAGE (all pages go inside this div) -->
<div class="techwave_fn_page">
<!-- AI Chat Bot Page -->
<div class="techwave_fn_aichatbot_page fn__chatbot">
<div class="chat__page">
<div class="font__trigger">
<span></span>
</div>
<div class="fn__title_holder">
<div class="container">
<!-- Active chat title -->
<h1 class="title">ِAI ALEX-9</h1>
<!-- !Active chat title -->
</div>
</div>
<div class="container">
<div class="chat__list">
<div id="chat0" class="chat__item"></div>
<div class="chat__item active" id="chat1">
<div class="chat__box bot__chat">
<div class="author"><span>ALEX-9</span></div>
<div class="chat">
<div class="fn__animated_text"><p>{{greet}}</p></div>
</div>
</div>
</div>
</div>
</div>
<div class="chat__comment">
<div class="container">
<div class="fn__chat_comment">
<textarea rows="1" class="fn__hidden_textarea" tabindex="-1"></textarea>
<textarea rows="1" placeholder="Send a message..." id="user_input"></textarea>
<button onclick="sendMessage()"><img src="desine/svg/enter.svg" alt="" class="fn__svg"></button>
</div>
</div>
</div>
<div id="chat1"></div> <!-- Container for chat history -->
<style>
.copy__button, .download__button {
color: #7c5fe3;
background-color: rgb(0, 0, 0);
border: none;
border-radius: 5px;
padding: 5px 10px;
margin: 5px;
cursor: pointer;
font-size: 14px;
}
.copy__button:hover, .download__button:hover {
background-color: #5a4a9d;
}
</style>
<script>
var conversationHistory = [];
var userFirstName = "{{ first }}";
function sendMessage() {
var user_input = document.getElementById("user_input").value;
if (user_input.trim() !== "") {
// Display user's message immediately
addChatMessage(user_input, userFirstName);
document.getElementById("user_input").value = "";
// Store user input in conversation history
conversationHistory.push({author: userFirstName, message: user_input});
var xhr = new XMLHttpRequest();
xhr.open("POST", "/get_response", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
var response_text = xhr.responseText;
// Display bot's response
addChatMessage2(response_text, "Bot");
// Store bot response in conversation history
conversationHistory.push({author: "Bot", message: response_text});
}
};
xhr.send("user_input=" + encodeURIComponent(user_input) + "&conversation_history=" + encodeURIComponent(JSON.stringify(conversationHistory)));
}
}
function addChatMessage(message, author) {
var chatItem = document.createElement("div");
chatItem.className = "chat__box your__chat";
var authorElement = document.createElement("div");
authorElement.className = "author";
authorElement.innerHTML = "<span>{{first}}</span>";
var chatElement = document.createElement("div");
chatElement.className = "chat";
chatElement.innerHTML = "<p>" + message + "</p>";
chatItem.appendChild(authorElement);
chatItem.appendChild(chatElement);
document.getElementById("chat1").appendChild(chatItem);
}
function addChatMessage2(message, author) {
var chatItem = document.createElement("div");
chatItem.className = "chat__box bot__chat";
var authorElement = document.createElement("div");
authorElement.className = "author";
authorElement.innerHTML = "<span>ALEX-9</span>";
var chatElement = document.createElement("div");
chatElement.className = "chat";
chatItem.appendChild(authorElement);
chatItem.appendChild(chatElement);
document.getElementById("chat1").appendChild(chatItem);
var messageElement = document.createElement("p");
chatElement.appendChild(messageElement);
var copyButton = document.createElement("button");
copyButton.innerHTML = "Copy";
copyButton.className = "copy__button";
copyButton.onclick = function() {
var tempElement = document.createElement('textarea');
tempElement.value = message.replace(/<br\s*\/?>/gi, '\n');
document.body.appendChild(tempElement);
tempElement.select();
document.execCommand('copy');
document.body.removeChild(tempElement);
alert("Copied to clipboard!");
};
chatElement.appendChild(copyButton);
var index = 0;
var typingInterval = setInterval(function() {
if (index < message.length) {
if (message.charAt(index) === "<" && message.charAt(index + 1) === "b" && message.charAt(index + 2) === "r" && message.charAt(index + 3) === ">") {
messageElement.innerHTML += "<br>";
index += 3;
} else if (message.charAt(index) === "<" && message.charAt(index + 1) === "i" && message.charAt(index + 2) === "m" && message.charAt(index + 3) === "g" && message.charAt(index + 4) === " ") {
var srcStart = message.indexOf("src='", index) + 5;
var srcEnd = message.indexOf("'", srcStart);
var imageUrl = message.substring(srcStart, srcEnd);
var imageElement = document.createElement("img");
imageElement.src = imageUrl;
imageElement.className = "chat__image"; // Add CSS class for styling
messageElement.appendChild(imageElement);
var downloadButton = document.createElement("button");
downloadButton.innerHTML = "Download";
downloadButton.className = "download__button";
downloadButton.onclick = function() {
fetch(imageUrl)
.then(response => response.blob())
.then(blob => {
var url = window.URL.createObjectURL(blob);
var a = document.createElement("a");
a.style.display = "none";
a.href = url;
a.download = imageUrl.substring(imageUrl.lastIndexOf('/') + 1);
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
})
.catch(() => alert('Could not download the image.'));
};
chatElement.appendChild(downloadButton);
index = srcEnd + 1;
} else {
messageElement.innerHTML += message.charAt(index);
}
index++;
} else {
clearInterval(typingInterval);
}
}, 30); // Adjust the delay (in milliseconds) between each character being added
}
</script>
<style>
pre {
background-color: #f5f5f5;
padding: 10px;
border-radius: 5px;
overflow-x: auto;
white-space: pre-wrap; /* Adjust this based on your preference */
margin: 10px 0;
}
code {
color: #d63384;
font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
font-size: 14px;
}
.chat__image {
max-width: 200px; /* Adjust the maximum width as desired */
max-height: 200px; /* Adjust the maximum height as desired */
border-radius: 10px; /* Add rounded corners */
}
.chat__download-button {
display: block;
margin-top: 10px;
text-align: center;
color: #fff;
background-color: #007bff;
border: none;
border-radius: 5px;
padding: 5px 10px;
text-decoration: none;
cursor: pointer;
}
.chat__download-button:hover {
background-color: #0056b3;
}
</style> </div>
<div class="chat__sidebar">
<div class="sidebar_header">
<a href="{{ url_for('chat', account_name=account_name, greet=greet, first=first, last=last, token2=token2) }}" class="fn__new_chat_link">
<span class="icon"></span>
<span class="text">New Chat</span>
</a>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- !AI Chat Bot Page -->
</div>
<!-- !PAGE (all pages go inside this div) -->
</div>
<!-- !CONTENT -->
</div>
</div>
<!-- !MAIN WRAPPER -->
<!-- Scripts -->
<script type="text/javascript" src="desine/js/jquery.js?ver=1.0.0"></script>
<script type="text/javascript" src="desine/js/plugins.js?ver=1.0.0"></script>
<!--[if lt IE 10]> <script type="text/javascript" src="desine/js/ie8.js"></script> <![endif]-->
<script type="text/javascript" src="desine/js/init.js?ver=1.0.0"></script>
<!-- !Scripts -->
</body>
</html> |