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| 6 |
+
<title>چت بات هوش مصنوعی با پنل رمزدار</title>
|
| 7 |
+
<style>
|
| 8 |
+
/* Reset and base */
|
| 9 |
+
*, *::before, *::after { box-sizing: border-box; }
|
| 10 |
+
html, body {
|
| 11 |
+
margin: 0; padding: 0;
|
| 12 |
+
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
|
| 13 |
+
direction: rtl;
|
| 14 |
+
background: #ffffff;
|
| 15 |
+
color: #6b7280;
|
| 16 |
+
font-size: 16px;
|
| 17 |
+
line-height: 1.5;
|
| 18 |
+
min-height: 100vh;
|
| 19 |
+
}
|
| 20 |
+
a { color: #2563eb; text-decoration: none; }
|
| 21 |
+
a:hover, button:hover { text-decoration: underline; cursor: pointer; }
|
| 22 |
+
|
| 23 |
+
/* Container */
|
| 24 |
+
.container {
|
| 25 |
+
max-width: 1200px;
|
| 26 |
+
margin: 3rem auto 5rem;
|
| 27 |
+
padding: 0 1rem;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
/* Header & Navigation */
|
| 31 |
+
header {
|
| 32 |
+
position: sticky;
|
| 33 |
+
top: 0;
|
| 34 |
+
background: white;
|
| 35 |
+
border-bottom: 1px solid #e5e7eb;
|
| 36 |
+
display: flex;
|
| 37 |
+
justify-content: space-between;
|
| 38 |
+
align-items: center;
|
| 39 |
+
padding: 1rem 2rem;
|
| 40 |
+
z-index: 1000;
|
| 41 |
+
}
|
| 42 |
+
header .logo {
|
| 43 |
+
font-size: 2rem;
|
| 44 |
+
font-weight: 700;
|
| 45 |
+
color: #111827;
|
| 46 |
+
user-select: none;
|
| 47 |
+
}
|
| 48 |
+
nav a {
|
| 49 |
+
margin-left: 2rem;
|
| 50 |
+
font-weight: 600;
|
| 51 |
+
color: #6b7280;
|
| 52 |
+
transition: color 0.3s ease;
|
| 53 |
+
font-size: 1rem;
|
| 54 |
+
}
|
| 55 |
+
nav a:hover { color: #111827; }
|
| 56 |
+
nav .cta-btn {
|
| 57 |
+
background: #111827;
|
| 58 |
+
color: white;
|
| 59 |
+
padding: 0.5rem 1.5rem;
|
| 60 |
+
border-radius: 0.5rem;
|
| 61 |
+
font-weight: 700;
|
| 62 |
+
font-size: 1rem;
|
| 63 |
+
text-decoration: none;
|
| 64 |
+
user-select: none;
|
| 65 |
+
transition: background-color 0.3s ease;
|
| 66 |
+
}
|
| 67 |
+
nav .cta-btn:hover {
|
| 68 |
+
background: #374151;
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
/* Hero Section */
|
| 72 |
+
.hero {
|
| 73 |
+
text-align: center;
|
| 74 |
+
margin-bottom: 4rem;
|
| 75 |
+
}
|
| 76 |
+
.hero h1 {
|
| 77 |
+
font-weight: 800;
|
| 78 |
+
font-size: 48px;
|
| 79 |
+
color: #111827;
|
| 80 |
+
margin-bottom: 1rem;
|
| 81 |
+
user-select: none;
|
| 82 |
+
}
|
| 83 |
+
.hero p {
|
| 84 |
+
font-size: 18px;
|
| 85 |
+
color: #6b7280;
|
| 86 |
+
max-width: 600px;
|
| 87 |
+
margin: 0 auto 2rem;
|
| 88 |
+
}
|
| 89 |
+
.hero button {
|
| 90 |
+
font-weight: 700;
|
| 91 |
+
font-size: 18px;
|
| 92 |
+
padding: 14px 36px;
|
| 93 |
+
border-radius: 0.75rem;
|
| 94 |
+
border: none;
|
| 95 |
+
background: #111827;
|
| 96 |
+
color: white;
|
| 97 |
+
user-select: none;
|
| 98 |
+
transition: background-color 0.3s ease;
|
| 99 |
+
}
|
| 100 |
+
.hero button:hover {
|
| 101 |
+
background: #4b5563;
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
/* Chatbot widget */
|
| 105 |
+
#chatbot {
|
| 106 |
+
position: fixed;
|
| 107 |
+
bottom: 24px;
|
| 108 |
+
left: 24px;
|
| 109 |
+
width: 350px;
|
| 110 |
+
max-height: 600px;
|
| 111 |
+
background: white;
|
| 112 |
+
box-shadow: 0 4px 24px rgba(0,0,0,0.1);
|
| 113 |
+
border-radius: 0.75rem;
|
| 114 |
+
display: flex;
|
| 115 |
+
flex-direction: column;
|
| 116 |
+
overflow: hidden;
|
| 117 |
+
z-index: 10000;
|
| 118 |
+
font-size: 16px;
|
| 119 |
+
user-select: text;
|
| 120 |
+
transform: translateY(120%);
|
| 121 |
+
transition: transform 0.4s ease;
|
| 122 |
+
}
|
| 123 |
+
#chatbot.open {
|
| 124 |
+
transform: translateY(0);
|
| 125 |
+
}
|
| 126 |
+
#chatbot-header {
|
| 127 |
+
background: linear-gradient(45deg, #0088cc, #e1306c);
|
| 128 |
+
color: white;
|
| 129 |
+
font-weight: 700;
|
| 130 |
+
font-size: 1.25rem;
|
| 131 |
+
padding: 1rem 1.5rem;
|
| 132 |
+
border-top-left-radius: 0.75rem;
|
| 133 |
+
border-top-right-radius: 0.75rem;
|
| 134 |
+
display: flex;
|
| 135 |
+
justify-content: space-between;
|
| 136 |
+
align-items: center;
|
| 137 |
+
user-select: none;
|
| 138 |
+
}
|
| 139 |
+
#chatbot-header #bot-name {
|
| 140 |
+
max-width: 80%;
|
| 141 |
+
overflow: hidden;
|
| 142 |
+
text-overflow: ellipsis;
|
| 143 |
+
white-space: nowrap;
|
| 144 |
+
}
|
| 145 |
+
#chatbot-close-btn {
|
| 146 |
+
background: transparent;
|
| 147 |
+
border: none;
|
| 148 |
+
color: white;
|
| 149 |
+
font-size: 1.5rem;
|
| 150 |
+
line-height: 1;
|
| 151 |
+
cursor: pointer;
|
| 152 |
+
transition: color 0.3s ease;
|
| 153 |
+
}
|
| 154 |
+
#chatbot-close-btn:hover {
|
| 155 |
+
color: #ffcccb;
|
| 156 |
+
}
|
| 157 |
+
#chat-messages {
|
| 158 |
+
flex: 1;
|
| 159 |
+
padding: 1rem;
|
| 160 |
+
overflow-y: auto;
|
| 161 |
+
background: #fafafa;
|
| 162 |
+
display: flex;
|
| 163 |
+
flex-direction: column;
|
| 164 |
+
}
|
| 165 |
+
.message {
|
| 166 |
+
max-width: 80%;
|
| 167 |
+
margin-bottom: 0.75rem;
|
| 168 |
+
padding: 12px 16px;
|
| 169 |
+
border-radius: 12px;
|
| 170 |
+
font-size: 14px;
|
| 171 |
+
line-height: 1.4;
|
| 172 |
+
white-space: pre-wrap;
|
| 173 |
+
word-break: break-word;
|
| 174 |
+
box-shadow: 0 1px 4px rgb(0 0 0 / 0.05);
|
| 175 |
+
animation: fadeInUp 0.3s ease forwards;
|
| 176 |
+
user-select: text;
|
| 177 |
+
}
|
| 178 |
+
@keyframes fadeInUp {
|
| 179 |
+
from {opacity: 0; transform: translateY(10px);} to {opacity:1; transform: translateY(0);}
|
| 180 |
+
}
|
| 181 |
+
.message.user {
|
| 182 |
+
background: linear-gradient(135deg, #e1306c, #0088cc);
|
| 183 |
+
color: white;
|
| 184 |
+
align-self: flex-end;
|
| 185 |
+
border-bottom-right-radius: 4px;
|
| 186 |
+
}
|
| 187 |
+
.message.bot {
|
| 188 |
+
background: white;
|
| 189 |
+
color: #374151;
|
| 190 |
+
border: 1.5px solid #0088cc;
|
| 191 |
+
align-self: flex-start;
|
| 192 |
+
border-bottom-left-radius: 4px;
|
| 193 |
+
}
|
| 194 |
+
#chat-input-form {
|
| 195 |
+
display: flex;
|
| 196 |
+
border-top: 1.5px solid #0088cc;
|
| 197 |
+
background: white;
|
| 198 |
+
padding: 0.75rem 1rem;
|
| 199 |
+
}
|
| 200 |
+
#chat-input {
|
| 201 |
+
flex: 1;
|
| 202 |
+
border-radius: 0.5rem;
|
| 203 |
+
border: 1px solid #ddd;
|
| 204 |
+
padding: 10px 14px;
|
| 205 |
+
font-size: 14px;
|
| 206 |
+
font-family: inherit;
|
| 207 |
+
resize: none;
|
| 208 |
+
height: 50px;
|
| 209 |
+
line-height: 1.3;
|
| 210 |
+
outline-offset: 2px;
|
| 211 |
+
color: #374151;
|
| 212 |
+
}
|
| 213 |
+
#chat-input::placeholder {
|
| 214 |
+
color: #a1a1aa;
|
| 215 |
+
}
|
| 216 |
+
#chat-send-btn {
|
| 217 |
+
background: #0088cc;
|
| 218 |
+
border: none;
|
| 219 |
+
color: white;
|
| 220 |
+
font-weight: 700;
|
| 221 |
+
font-size: 16px;
|
| 222 |
+
padding: 0 18px;
|
| 223 |
+
margin-left: 12px;
|
| 224 |
+
border-radius: 0.5rem;
|
| 225 |
+
cursor: pointer;
|
| 226 |
+
user-select: none;
|
| 227 |
+
transition: background-color 0.3s ease;
|
| 228 |
+
}
|
| 229 |
+
#chat-send-btn:hover:not(:disabled) {
|
| 230 |
+
background: #e1306c;
|
| 231 |
+
}
|
| 232 |
+
#chat-send-btn:disabled {
|
| 233 |
+
background: #ccc;
|
| 234 |
+
cursor: not-allowed;
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
/* Typing indicator */
|
| 238 |
+
.typing-indicator {
|
| 239 |
+
display: flex;
|
| 240 |
+
gap: 6px;
|
| 241 |
+
margin-left: 4px;
|
| 242 |
+
align-items: center;
|
| 243 |
+
padding: 12px 16px;
|
| 244 |
+
}
|
| 245 |
+
.typing-indicator span {
|
| 246 |
+
width: 8px;
|
| 247 |
+
height: 8px;
|
| 248 |
+
background: #0088cc;
|
| 249 |
+
border-radius: 50%;
|
| 250 |
+
opacity: 0.4;
|
| 251 |
+
animation: typing-blink 1.4s infinite;
|
| 252 |
+
}
|
| 253 |
+
.typing-indicator span:nth-child(2) {
|
| 254 |
+
animation-delay: 0.2s;
|
| 255 |
+
}
|
| 256 |
+
.typing-indicator span:nth-child(3) {
|
| 257 |
+
animation-delay: 0.4s;
|
| 258 |
+
}
|
| 259 |
+
@keyframes typing-blink {
|
| 260 |
+
0%, 80%, 100% {opacity: 0.4;}
|
| 261 |
+
40% {opacity: 1;}
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
/* Developer Panel Overlay */
|
| 265 |
+
#dev-overlay {
|
| 266 |
+
position: fixed;
|
| 267 |
+
inset: 0;
|
| 268 |
+
background: rgba(0,0,0,0.75);
|
| 269 |
+
backdrop-filter: blur(4px);
|
| 270 |
+
display: none;
|
| 271 |
+
justify-content: center;
|
| 272 |
+
align-items: center;
|
| 273 |
+
z-index: 11000;
|
| 274 |
+
user-select: text;
|
| 275 |
+
}
|
| 276 |
+
#dev-overlay.active {
|
| 277 |
+
display: flex;
|
| 278 |
+
}
|
| 279 |
+
#dev-panel {
|
| 280 |
+
background: white;
|
| 281 |
+
width: 750px;
|
| 282 |
+
max-width: 95vw;
|
| 283 |
+
max-height: 90vh;
|
| 284 |
+
border-radius: 0.75rem;
|
| 285 |
+
box-shadow: 0 10px 40px rgb(0 0 0 / 0.15);
|
| 286 |
+
display: flex;
|
| 287 |
+
flex-direction: column;
|
| 288 |
+
overflow: hidden;
|
| 289 |
+
}
|
| 290 |
+
#dev-header {
|
| 291 |
+
background: linear-gradient(45deg, #0088cc, #e1306c);
|
| 292 |
+
color: white;
|
| 293 |
+
font-size: 1.75rem;
|
| 294 |
+
font-weight: 700;
|
| 295 |
+
padding: 1rem 2rem;
|
| 296 |
+
user-select: none;
|
| 297 |
+
display: flex;
|
| 298 |
+
justify-content: space-between;
|
| 299 |
+
align-items: center;
|
| 300 |
+
}
|
| 301 |
+
#dev-close-btn {
|
| 302 |
+
background: transparent;
|
| 303 |
+
border: none;
|
| 304 |
+
font-size: 1.5rem;
|
| 305 |
+
color: white;
|
| 306 |
+
cursor: pointer;
|
| 307 |
+
transition: color 0.3s ease;
|
| 308 |
+
}
|
| 309 |
+
#dev-close-btn:hover {
|
| 310 |
+
color: #fca5a5;
|
| 311 |
+
}
|
| 312 |
+
#dev-content {
|
| 313 |
+
flex: 1;
|
| 314 |
+
overflow-y: auto;
|
| 315 |
+
padding: 1.5rem 2rem;
|
| 316 |
+
color: #374151;
|
| 317 |
+
font-size: 15px;
|
| 318 |
+
}
|
| 319 |
+
.tabs {
|
| 320 |
+
display: flex;
|
| 321 |
+
border-bottom: 2px solid #ddd;
|
| 322 |
+
margin-bottom: 1rem;
|
| 323 |
+
gap: 1rem;
|
| 324 |
+
user-select: none;
|
| 325 |
+
}
|
| 326 |
+
.tabs button {
|
| 327 |
+
padding: 12px 20px;
|
| 328 |
+
border: none;
|
| 329 |
+
border-bottom: 4px solid transparent;
|
| 330 |
+
font-weight: 600;
|
| 331 |
+
font-size: 1rem;
|
| 332 |
+
background: transparent;
|
| 333 |
+
color: #6b7280;
|
| 334 |
+
cursor: pointer;
|
| 335 |
+
transition: border-color 0.3s ease, color 0.3s ease;
|
| 336 |
+
border-radius: 0.5rem 0.5rem 0 0;
|
| 337 |
+
}
|
| 338 |
+
.tabs button.active {
|
| 339 |
+
border-color: #e1306c;
|
| 340 |
+
color: #e1306c;
|
| 341 |
+
font-weight: 700;
|
| 342 |
+
}
|
| 343 |
+
.tabs button:hover:not(.active) {
|
| 344 |
+
color: #0088cc;
|
| 345 |
+
}
|
| 346 |
+
.tab-panel {
|
| 347 |
+
display: none;
|
| 348 |
+
}
|
| 349 |
+
.tab-panel.active {
|
| 350 |
+
display: block;
|
| 351 |
+
}
|
| 352 |
+
form label {
|
| 353 |
+
display: block;
|
| 354 |
+
margin-top: 1rem;
|
| 355 |
+
margin-bottom: .5rem;
|
| 356 |
+
font-weight: 700;
|
| 357 |
+
color: #374151;
|
| 358 |
+
}
|
| 359 |
+
input[type=text], input[type=url], textarea, select, input[type=password] {
|
| 360 |
+
width: 100%;
|
| 361 |
+
padding: 10px 14px;
|
| 362 |
+
border: 1.5px solid #ddd;
|
| 363 |
+
border-radius: 0.5rem;
|
| 364 |
+
font-size: 15px;
|
| 365 |
+
resize: vertical;
|
| 366 |
+
font-family: inherit;
|
| 367 |
+
}
|
| 368 |
+
textarea {
|
| 369 |
+
min-height: 100px;
|
| 370 |
+
}
|
| 371 |
+
button[type=submit], button.remove-btn, button.add-btn {
|
| 372 |
+
margin-top: 1.25rem;
|
| 373 |
+
padding: 10px 20px;
|
| 374 |
+
font-weight: 700;
|
| 375 |
+
font-size: 1rem;
|
| 376 |
+
border-radius: 0.5rem;
|
| 377 |
+
border: none;
|
| 378 |
+
cursor: pointer;
|
| 379 |
+
user-select: none;
|
| 380 |
+
transition: background-color 0.3s ease;
|
| 381 |
+
}
|
| 382 |
+
button[type=submit] {
|
| 383 |
+
background: linear-gradient(45deg, #0088cc, #e1306c);
|
| 384 |
+
color: white;
|
| 385 |
+
}
|
| 386 |
+
button[type=submit]:hover {
|
| 387 |
+
background: linear-gradient(45deg, #e1306c, #0088cc);
|
| 388 |
+
}
|
| 389 |
+
button.remove-btn {
|
| 390 |
+
background: #ef4444;
|
| 391 |
+
color: white;
|
| 392 |
+
padding: 6px 12px;
|
| 393 |
+
font-size: 14px;
|
| 394 |
+
}
|
| 395 |
+
button.remove-btn:hover {
|
| 396 |
+
background: #b91c1c;
|
| 397 |
+
}
|
| 398 |
+
button.add-btn {
|
| 399 |
+
background: #22c55e;
|
| 400 |
+
color: white;
|
| 401 |
+
}
|
| 402 |
+
button.add-btn:hover {
|
| 403 |
+
background: #15803d;
|
| 404 |
+
}
|
| 405 |
+
table {
|
| 406 |
+
width: 100%;
|
| 407 |
+
border-collapse: collapse;
|
| 408 |
+
margin-top: 1rem;
|
| 409 |
+
}
|
| 410 |
+
th, td {
|
| 411 |
+
padding: 12px 10px;
|
| 412 |
+
border-bottom: 1px solid #eee;
|
| 413 |
+
text-align: right;
|
| 414 |
+
font-weight: 600;
|
| 415 |
+
font-size: 14px;
|
| 416 |
+
color: #4b5563;
|
| 417 |
+
}
|
| 418 |
+
th {
|
| 419 |
+
background: #f9fafb;
|
| 420 |
+
color: #374151;
|
| 421 |
+
}
|
| 422 |
+
tr:hover td {
|
| 423 |
+
background: #f3f4f6;
|
| 424 |
+
}
|
| 425 |
+
#password-message {
|
| 426 |
+
margin-top: 0.5rem;
|
| 427 |
+
min-height: 1.25rem;
|
| 428 |
+
font-weight: 700;
|
| 429 |
+
}
|
| 430 |
+
#password-message.error { color: #ef4444; }
|
| 431 |
+
#password-message.success { color: #22c55e; }
|
| 432 |
+
</style>
|
| 433 |
+
</head>
|
| 434 |
+
<body>
|
| 435 |
+
|
| 436 |
+
<header>
|
| 437 |
+
<div class="logo" aria-label="لوگوی چت بات هوش مصنوعی">AI ChatBot</div>
|
| 438 |
+
<nav>
|
| 439 |
+
<a href="#features">ویژگیها</a>
|
| 440 |
+
<a href="#usage">نحوه استفاده</a>
|
| 441 |
+
<a href="#contact">تماس</a>
|
| 442 |
+
<a href="javascript:void(0)" id="open-chat-btn" class="cta-btn" aria-expanded="false" aria-controls="chatbot">شروع چت</a>
|
| 443 |
+
</nav>
|
| 444 |
+
</header>
|
| 445 |
+
|
| 446 |
+
<main class="container" role="main">
|
| 447 |
+
<section id="features" aria-label="ویژگی های چت بات">
|
| 448 |
+
<h1>چت بات هوش مصنوعی با پنل توسعهدهنده رمزدار</h1>
|
| 449 |
+
<p>افزودن پایگاه دانش، مدیریت چند ربات، انتخاب تم و تنظیمات پیشرفته بدون نیاز به سرور و با استفاده از هوش مصنوعی Hugging Face.</p>
|
| 450 |
+
</section>
|
| 451 |
+
|
| 452 |
+
<section id="usage" aria-label="نحوه استفاده">
|
| 453 |
+
<h2>کد کوتاه برای افزودن به سایت شما:</h2>
|
| 454 |
+
<pre style="background:#f3f4f6;padding:1rem;border-radius:0.5rem;user-select:text;">
|
| 455 |
+
<div id="ai-chatbot-container"></div>
|
| 456 |
+
<script src="PATH_TO_THIS_FILE_OR_EMBED_JS" defer></script>
|
| 457 |
+
</pre>
|
| 458 |
+
</section>
|
| 459 |
+
|
| 460 |
+
<section id="contact" aria-label="تماس">
|
| 461 |
+
<h2>تماس با ما</h2>
|
| 462 |
+
<p>برای همکاری، میزبانی یا راهنمایی، ایمیل بزنید: <a href="mailto:support@example.com">support@example.com</a></p>
|
| 463 |
+
</section>
|
| 464 |
+
</main>
|
| 465 |
+
|
| 466 |
+
<!-- Chatbot Widget -->
|
| 467 |
+
<div id="chatbot" role="dialog" aria-modal="true" aria-label="پنجره چت بات هوش مصنوعی" tabindex="-1" aria-hidden="true" >
|
| 468 |
+
<div id="chatbot-header">
|
| 469 |
+
<span id="bot-name" aria-live="polite" aria-atomic="true" aria-relevant="additions">ربات من</span>
|
| 470 |
+
<button aria-label="بستن چت بات" id="chatbot-close-btn" title="بستن چت بات">×</button>
|
| 471 |
+
</div>
|
| 472 |
+
<div id="chat-messages" tabindex="0" aria-live="polite" aria-atomic="false"></div>
|
| 473 |
+
<form id="chat-input-form" aria-label="فرم ارسال پیام چت">
|
| 474 |
+
<textarea id="chat-input" autocomplete="off" placeholder="پیام خود را اینجا بنویسید..." rows="2" required></textarea>
|
| 475 |
+
<button type="submit" id="chat-send-btn" disabled>ارسال</button>
|
| 476 |
+
</form>
|
| 477 |
+
<button id="open-dev-panel-btn" title="پنل توسعهدهنده" aria-label="باز کردن پنل توسعهدهنده" style="position:absolute;top:0.75rem;left:0.75rem;background:none;border:none;font-size:1.5rem;color:white;cursor:pointer;user-select:none;">⚙️</button>
|
| 478 |
+
</div>
|
| 479 |
+
|
| 480 |
+
<!-- Developer Panel Overlay -->
|
| 481 |
+
<div id="dev-overlay" role="dialog" aria-modal="true" aria-labelledby="dev-header-title" tabindex="-1" aria-hidden="true">
|
| 482 |
+
<div id="dev-panel">
|
| 483 |
+
<div id="dev-header">
|
| 484 |
+
<span id="dev-header-title">پنل توسعهدهنده</span>
|
| 485 |
+
<button id="dev-close-btn" aria-label="بستن پنل توسعهدهنده" title="بستن پنل توسعهدهنده">×</button>
|
| 486 |
+
</div>
|
| 487 |
+
<div id="dev-content">
|
| 488 |
+
<div class="tabs" role="tablist" aria-label="تبهای پنل توسعهدهنده">
|
| 489 |
+
<button role="tab" aria-selected="true" aria-controls="tab-kb" id="tab-kb-btn" class="active">پایگاه دانش</button>
|
| 490 |
+
<button role="tab" aria-selected="false" aria-controls="tab-settings" id="tab-settings-btn">تنظیمات ربات</button>
|
| 491 |
+
<button role="tab" aria-selected="false" aria-controls="tab-bots" id="tab-bots-btn">رباتها</button>
|
| 492 |
+
</div>
|
| 493 |
+
<section id="tab-kb" class="tab-panel active" role="tabpanel" aria-labelledby="tab-kb-btn" tabindex="0">
|
| 494 |
+
<form id="kb-form" aria-label="فرم افزودن سوال و پاسخ به پایگاه دانش">
|
| 495 |
+
<label for="kb-question">سوال</label>
|
| 496 |
+
<input type="text" id="kb-question" autocomplete="off" placeholder="سوال خود را وارد کنید" required/>
|
| 497 |
+
<label for="kb-answer">پاسخ</label>
|
| 498 |
+
<textarea id="kb-answer" placeholder="پاسخ خود را وارد کنید" required></textarea>
|
| 499 |
+
<button type="submit">افزودن به پایگاه دانش</button>
|
| 500 |
+
</form>
|
| 501 |
+
<table aria-label="لیست سوال و پاسخها">
|
| 502 |
+
<thead>
|
| 503 |
+
<tr><th>سوال</th><th>پاسخ</th><th>حذف</th></tr>
|
| 504 |
+
</thead>
|
| 505 |
+
<tbody id="kb-list"></tbody>
|
| 506 |
+
</table>
|
| 507 |
+
</section>
|
| 508 |
+
<section id="tab-settings" class="tab-panel" role="tabpanel" aria-labelledby="tab-settings-btn" tabindex="0" hidden>
|
| 509 |
+
<form id="settings-form" aria-label="فرم تنظیمات ربات">
|
| 510 |
+
<label for="bot-name-input">نام ربات</label>
|
| 511 |
+
<input type="text" id="bot-name-input" placeholder="نام ربات" />
|
| 512 |
+
<label for="response-type-select">نوع پاسخدهی ربات</label>
|
| 513 |
+
<select id="response-type-select" aria-label="نوع پاسخدهی ربات">
|
| 514 |
+
<option value="knowledge-base">پاسخ بر اساس پایگاه دانش</option>
|
| 515 |
+
<option value="ai">پاسخ با هوش مصنوعی</option>
|
| 516 |
+
<option value="hybrid">ترکیبی از هر دو</option>
|
| 517 |
+
</select>
|
| 518 |
+
<label for="allow-profanity-select">مجاز بودن فحش</label>
|
| 519 |
+
<select id="allow-profanity-select" aria-label="تنظیم مجاز بودن فحش">
|
| 520 |
+
<option value="false" selected>غیرمجاز</option>
|
| 521 |
+
<option value="true">مجاز</option>
|
| 522 |
+
</select>
|
| 523 |
+
<label for="bot-image-url">آدرس تصویر ربات (URL)</label>
|
| 524 |
+
<input type="url" id="bot-image-url" placeholder="https://example.com/avatar.png" />
|
| 525 |
+
<fieldset style="border:1px solid #ddd; padding:1rem; margin-top:2rem; border-radius:0.5rem;">
|
| 526 |
+
<legend>تغییر رمز پنل توسعهدهنده</legend>
|
| 527 |
+
<label for="mother-password">رمز مادر (برای غیرفعال کردن رمز)</label>
|
| 528 |
+
<input type="password" id="mother-password" placeholder="رمز مادر" autocomplete="new-password" />
|
| 529 |
+
<label for="current-password">رمز فعلی</label>
|
| 530 |
+
<input type="password" id="current-password" placeholder="رمز فعلی" autocomplete="current-password" />
|
| 531 |
+
<label for="new-password">رمز جدید</label>
|
| 532 |
+
<input type="password" id="new-password" placeholder="رمز جدید" autocomplete="new-password" />
|
| 533 |
+
<label for="confirm-password">تکرار رمز جدید</label>
|
| 534 |
+
<input type="password" id="confirm-password" placeholder="تکرار رمز جدید" />
|
| 535 |
+
<button type="button" id="change-password-btn">تغییر رمز</button>
|
| 536 |
+
<p id="password-message" aria-live="polite"></p>
|
| 537 |
+
</fieldset>
|
| 538 |
+
<button type="submit">ذخیره تنظیمات</button>
|
| 539 |
+
</form>
|
| 540 |
+
</section>
|
| 541 |
+
<section id="tab-bots" class="tab-panel" role="tabpanel" aria-labelledby="tab-bots-btn" tabindex="0" hidden>
|
| 542 |
+
<button id="create-bot-btn" class="add-btn">ساخت ربات جدید</button>
|
| 543 |
+
<table aria-label="لیست رباتها">
|
| 544 |
+
<thead>
|
| 545 |
+
<tr><th>نام ربات</th><th>فعالسازی</th><th>حذف</th></tr>
|
| 546 |
+
</thead>
|
| 547 |
+
<tbody id="bots-list"></tbody>
|
| 548 |
+
</table>
|
| 549 |
+
</section>
|
| 550 |
+
</div>
|
| 551 |
+
</div>
|
| 552 |
+
</div>
|
| 553 |
+
|
| 554 |
+
<script>
|
| 555 |
+
(async () => {
|
| 556 |
+
// Utility
|
| 557 |
+
const $ = id => document.getElementById(id);
|
| 558 |
+
function delay(ms) { return new Promise(r => setTimeout(r, ms)); }
|
| 559 |
+
async function sha256(msg) {
|
| 560 |
+
const buf = new TextEncoder().encode(msg);
|
| 561 |
+
const hash = await crypto.subtle.digest('SHA-256', buf);
|
| 562 |
+
return Array.from(new Uint8Array(hash)).map(b => b.toString(16).padStart(2,'0')).join('');
|
| 563 |
+
}
|
| 564 |
+
function sanitize(str) {
|
| 565 |
+
const div = document.createElement('div');
|
| 566 |
+
div.textContent = str;
|
| 567 |
+
return div.innerHTML;
|
| 568 |
+
}
|
| 569 |
+
|
| 570 |
+
// DOM Elements
|
| 571 |
+
const chatbot = $('chatbot');
|
| 572 |
+
const openChatBtn = $('open-chat-btn');
|
| 573 |
+
const closeChatBtn = $('chatbot-close-btn');
|
| 574 |
+
const chatMessages = $('chat-messages');
|
| 575 |
+
const chatInput = $('chat-input');
|
| 576 |
+
const chatSendBtn = $('chat-send-btn');
|
| 577 |
+
const openDevPanelBtn = $('open-dev-panel-btn');
|
| 578 |
+
const devOverlay = $('dev-overlay');
|
| 579 |
+
const devCloseBtn = $('dev-close-btn');
|
| 580 |
+
|
| 581 |
+
// Developer panel elements
|
| 582 |
+
const tabs = {
|
| 583 |
+
kbBtn: $('tab-kb-btn'),
|
| 584 |
+
settingsBtn: $('tab-settings-btn'),
|
| 585 |
+
botsBtn: $('tab-bots-btn'),
|
| 586 |
+
kbPanel: $('tab-kb'),
|
| 587 |
+
settingsPanel: $('tab-settings'),
|
| 588 |
+
botsPanel: $('tab-bots'),
|
| 589 |
+
};
|
| 590 |
+
const kbForm = $('kb-form');
|
| 591 |
+
const kbQuestion = $('kb-question');
|
| 592 |
+
const kbAnswer = $('kb-answer');
|
| 593 |
+
const kbList = $('kb-list');
|
| 594 |
+
|
| 595 |
+
const settingsForm = $('settings-form');
|
| 596 |
+
const botNameInput = $('bot-name-input');
|
| 597 |
+
const responseTypeSelect = $('response-type-select');
|
| 598 |
+
const allowProfanitySelect = $('allow-profanity-select');
|
| 599 |
+
const botImageUrlInput = $('bot-image-url');
|
| 600 |
+
const motherPasswordInput = $('mother-password');
|
| 601 |
+
const currentPasswordInput = $('current-password');
|
| 602 |
+
const newPasswordInput = $('new-password');
|
| 603 |
+
const confirmPasswordInput = $('confirm-password');
|
| 604 |
+
const changePasswordBtn = $('change-password-btn');
|
| 605 |
+
const passwordMessage = $('password-message');
|
| 606 |
+
|
| 607 |
+
const botsList = $('bots-list');
|
| 608 |
+
const createBotBtn = $('create-bot-btn');
|
| 609 |
+
|
| 610 |
+
const botNameDisplay = $('bot-name');
|
| 611 |
+
|
| 612 |
+
// Persistent keys and default passwords
|
| 613 |
+
const STORAGE_KEY = 'ai_chatbot_app_state';
|
| 614 |
+
const PASSWORD_HASH_KEY = 'ai_chatbot_dev_password_hash';
|
| 615 |
+
const MOTHER_PASS_HASH_KEY = 'ai_chatbot_mother_pass_hash';
|
| 616 |
+
const DEFAULT_PASSWORD = '1234';
|
| 617 |
+
const MASTER_PASSWORD = '12340000';
|
| 618 |
+
|
| 619 |
+
// State
|
| 620 |
+
let state = {
|
| 621 |
+
bots: {},
|
| 622 |
+
activeBotId: '',
|
| 623 |
+
devPanelOpen: false,
|
| 624 |
+
authenticated: false
|
| 625 |
+
};
|
| 626 |
+
|
| 627 |
+
// Initialize default bot
|
| 628 |
+
function defaultBotTemplate() {
|
| 629 |
+
return {
|
| 630 |
+
id: 'default-bot',
|
| 631 |
+
name: 'ربات من',
|
| 632 |
+
kb: [],
|
| 633 |
+
settings: {
|
| 634 |
+
responseType: 'hybrid',
|
| 635 |
+
allowProfanity: false,
|
| 636 |
+
botImageUrl: ''
|
| 637 |
+
}
|
| 638 |
+
};
|
| 639 |
+
}
|
| 640 |
+
|
| 641 |
+
// Load state from localStorage
|
| 642 |
+
async function loadState() {
|
| 643 |
+
const data = localStorage.getItem(STORAGE_KEY);
|
| 644 |
+
if (data) {
|
| 645 |
+
try {
|
| 646 |
+
state = JSON.parse(data);
|
| 647 |
+
if (!state.bots || Object.keys(state.bots).length === 0) {
|
| 648 |
+
state.bots = {[defaultBotTemplate().id]: defaultBotTemplate()};
|
| 649 |
+
state.activeBotId = defaultBotTemplate().id;
|
| 650 |
+
}
|
| 651 |
+
if (!state.activeBotId || !state.bots[state.activeBotId]) {
|
| 652 |
+
state.activeBotId = Obje
|