Spaces:
Running
Running
File size: 21,680 Bytes
d2d1f15 e3e6721 d2d1f15 9905807 300cb10 e125595 7eaa550 e125595 e3e6721 e125595 8f99d28 e125595 c8785d5 8f99d28 e125595 4891fd2 8f99d28 1567153 8f99d28 e42b2f4 557aa8a 8f99d28 557aa8a 8f99d28 557aa8a 7ee9111 557aa8a 8f99d28 557aa8a 8f99d28 557aa8a f69920b e81f723 557aa8a e81f723 557aa8a e81f723 c8785d5 557aa8a de206a1 e3e6721 8f99d28 c8785d5 557aa8a e42b2f4 557aa8a e42b2f4 557aa8a c8785d5 557aa8a c8785d5 557aa8a c8785d5 557aa8a e42b2f4 557aa8a c8785d5 e42b2f4 de206a1 7ee9111 9387b13 557aa8a c8785d5 7ee9111 557aa8a c8785d5 e42b2f4 e3e6721 557aa8a c8785d5 e42b2f4 c8785d5 e42b2f4 1567153 e42b2f4 1567153 e42b2f4 557aa8a c8785d5 1567153 8f99d28 9387b13 300cb10 9387b13 300cb10 9387b13 300cb10 9387b13 8f99d28 9387b13 300cb10 9387b13 8f99d28 9387b13 300cb10 9387b13 300cb10 8f99d28 9387b13 8b23705 9387b13 8f99d28 9387b13 300cb10 8f99d28 9387b13 300cb10 9387b13 300cb10 8f99d28 9387b13 300cb10 8f99d28 9387b13 300cb10 8f99d28 9387b13 300cb10 9387b13 300cb10 9387b13 8f99d28 9387b13 300cb10 9387b13 300cb10 9387b13 1567153 d2d1f15 3a28bf9 e125595 3a28bf9 de206a1 e125595 c8785d5 e125595 c8785d5 b69f858 9905807 1c16999 9bf1014 3a28bf9 e125595 3a28bf9 e125595 c8785d5 e125595 300cb10 e125595 300cb10 c8785d5 300cb10 e125595 c8785d5 4891fd2 3a28bf9 c8785d5 3a28bf9 de206a1 c8785d5 de206a1 8f99d28 c8785d5 e125595 c8785d5 dfe39cb 3a28bf9 de206a1 8f99d28 300cb10 8f99d28 e3e6721 300cb10 c8785d5 e3e6721 3a28bf9 e3e6721 557aa8a c8785d5 e3e6721 300cb10 e3e6721 9387b13 16e8356 557aa8a e125595 c8785d5 1c16999 3a28bf9 e125595 3a28bf9 557aa8a 3a28bf9 e125595 1c16999 3a28bf9 557aa8a ec0e48c a1ce002 c94d578 |
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 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Liberalmind AI</title>
<!-- Preconnect Hints -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="preconnect" href="https://cdn.tailwindcss.com">
<link rel="preconnect" href="https://cdnjs.cloudflare.com">
<link rel="preconnect" href="https://esm.sh">
<link rel="preconnect" href="https://unpkg.com">
<link rel="preconnect" href="https://generativelanguage.googleapis.com">
<!-- Tailwind CSS via CDN -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
<!-- Material Icons -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons+Round" rel="stylesheet">
<!-- Highlight.js CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github.min.css">
<!-- Highlight.js JS (defer) -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js" defer></script>
<!-- Your custom styles -->
<style>
/* --- ALL NECESSARY CSS STYLES HERE --- */
:root {
--primary: #EC4899;
--secondary: #F59E0B;
--on-primary: #FFFFFF;
--primary-container: #FBCFE8;
--on-primary-container: #831843;
}
html { height: 100%; }
body {
font-family: 'Inter', sans-serif;
background-color: #FFF9F9;
color: #1F2937;
transition: all 0.3s ease;
display: flex;
flex-direction: column;
margin: 0;
min-height: 100vh;
overflow-x: hidden;
}
.main-container {
flex: 1;
display: flex;
flex-direction: column;
max-width: 896px;
width: 100%;
margin: 0 auto;
padding: 1rem;
overflow: hidden;
box-sizing: border-box;
min-height: 0;
height: 100%;
}
.chat-container {
flex: 1;
overflow-y: auto;
padding: 0 10px 20px 10px;
scroll-behavior: smooth;
scrollbar-width: thin;
scrollbar-color: var(--primary-container) #FFFFFF;
min-height: 0;
position: relative;
}
.welcome-screen {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
transition: opacity 0.3s ease-out;
padding: 20px;
box-sizing: border-box;
flex-shrink: 0;
}
.welcome-screen.hidden {
opacity: 0;
pointer-events: none;
position: absolute;
top: 0; left: 0;
width: 100%;
height: 100%;
}
.input-container {
background-color: #FFFFFF;
border-radius: 16px;
box-shadow: 0 4px 12px rgba(236, 72, 153, 0.1);
border: 2px solid var(--primary-container);
}
.send-btn {
background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
color: var(--on-primary);
box-shadow: 0 4px 6px rgba(236, 72, 153, 0.2);
transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.send-btn:hover:not(:disabled) {
transform: translateY(-2px);
box-shadow: 0 6px 8px rgba(236, 72, 153, 0.3);
}
.send-btn:disabled {
opacity: 0.6;
cursor: not-allowed;
transform: none;
box-shadow: 0 4px 6px rgba(236, 72, 153, 0.2);
}
.ripple { position: relative; overflow: hidden; }
.ripple:after { content: ""; display: block; position: absolute; width: 100%; height: 100%; top: 0; left: 0; pointer-events: none; background-image: radial-gradient(circle, #fff 10%, transparent 10.01%); background-repeat: no-repeat; background-position: 50%; transform: scale(10, 10); opacity: 0; transition: transform .5s, opacity 1s; }
.ripple:active:after { transform: scale(0, 0); opacity: 0.2; transition: 0s; }
.typing-indicator { display: flex; align-items: center; padding: 8px 0; margin-left: 10px; margin-bottom: 16px; }
.typing-indicator .message-content { display: inline-flex; background-color: #f3f4f6; padding: 10px 14px; border-radius: 18px; border-bottom-left-radius: 4px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); align-items: center; }
#typing-indicator-text {
margin-right: 8px;
font-size: 0.9em;
color: #4b5563;
font-style: italic;
}
.typing-dot { width: 8px; height: 8px; margin: 0 3px; background-color: var(--primary); border-radius: 50%; opacity: 0.4; animation: typing-dot 1.4s infinite both; }
.typing-dot:nth-child(1) { animation-delay: 0s; } .typing-dot:nth-child(2) { animation-delay: 0.2s; } .typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-dot { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-6px); opacity: 1; } }
.fade-in { animation: fadeIn 0.5s ease-in; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.floating { animation: floating 3s ease-in-out infinite; }
@keyframes floating { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-10px); } }
.ai-icon { background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%); position: relative; overflow: hidden; box-shadow: 0 8px 16px rgba(236, 72, 153, 0.3); }
.info-box { width: 100%; max-width: 450px; padding: 20px; background: linear-gradient(135deg, #FFF0F6 0%, #FFF9DB 100%); border-radius: 20px; box-shadow: 0 8px 24px rgba(236, 72, 153, 0.15); margin: 20px 0; position: relative; overflow: hidden; border: 2px solid rgba(236, 72, 153, 0.2); text-align: center; }
.info-box::before { content: ""; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%; background: linear-gradient(to bottom right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.8) 50%, rgba(255,255,255,0) 100%); transform: rotate(45deg); animation: shine 4s infinite linear; }
@keyframes shine { 0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); } 100% { transform: translateX(100%) translateY(100%) rotate(45deg); } }
.date-text { font-size: 1.5rem; font-weight: 800; color: var(--primary); margin-bottom: 12px; text-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.info-text { font-size: 0.95rem; color: #831843; line-height: 1.5; margin-bottom: 8px; }
.emoji { font-size: 1.5rem; margin-bottom: 10px; }
.action-btn { background-color: white; border: 2px solid var(--primary-container); box-shadow: 0 4px 6px rgba(236, 72, 153, 0.1); transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease; }
.action-btn:hover:not(.active):not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 8px rgba(236, 72, 153, 0.2); }
.action-btn.active { background-color: var(--primary-container); border-color: var(--primary); box-shadow: 0 2px 4px rgba(236, 72, 153, 0.15); transform: translateY(1px); }
.action-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; box-shadow: 0 4px 6px rgba(236, 72, 153, 0.1) !important; }
.chat-container::-webkit-scrollbar { width: 8px; }
.chat-container::-webkit-scrollbar-track { background: #FFFFFF; border-radius: 4px; }
.chat-container::-webkit-scrollbar-thumb { background-color: var(--primary-container); border-radius: 4px; border: 2px solid #FFFFFF; }
.message-wrapper { display: flex; margin-bottom: 16px; animation: fadeIn 0.3s ease-out; max-width: 100%; }
.user-message { justify-content: flex-end; }
.ai-message { justify-content: flex-start; }
.system-message { justify-content: center; font-style: italic; opacity: 0.8; }
.system-sub-message { justify-content: flex-start; margin-left: 30px; max-width: calc(100% - 30px); opacity: 0.7; }
/* Style for the attachment info line */
.user-attachment-info { font-style: italic; opacity: 0.8; }
.user-attachment-info .message-content { background-color: #f3f4f6; color: #4b5563; font-size: 0.9em; } /* Lighter background for attachment info */
.message-content { max-width: 85%; padding: 12px 16px; border-radius: 18px; position: relative; line-height: 1.5; word-wrap: break-word; overflow-wrap: break-word; hyphens: auto; }
.user-message .message-content { background-color: var(--primary); color: white; border-bottom-right-radius: 4px; }
.ai-message .message-content { background-color: #FFFFFF; color: #1F2937; border-bottom-left-radius: 4px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); }
.system-message .message-content { background-color: #f3f4f6; color: #4b5563; border-radius: 8px; padding: 8px 12px; font-size: 0.9em; box-shadow: none; max-width: 90%; text-align: center; }
.system-sub-message .message-content { background-color: #eef2ff; color: #4338ca; text-align: left; font-size: 0.85em; font-style: normal; border-radius: 12px; border-bottom-left-radius: 4px; box-shadow: none; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin: 0 8px; align-self: flex-end; }
.user-avatar { background-color: #E5E7EB; color: #6B7280; }
.ai-avatar { background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%); color: white; }
.system-avatar, .system-sub-avatar { display: none; }
.markdown-content { white-space: pre-wrap; word-wrap: break-word; }
.markdown-content > *:first-child { margin-top: 0; }
.markdown-content > *:last-child { margin-bottom: 0; }
.markdown-content code:not(pre > code) { background-color: #fde6f1; padding: 2px 5px; border-radius: 4px; font-family: monospace; color: #831843; font-size: 0.9em; }
.markdown-content pre { background-color: #f3f4f6; padding: 12px; border-radius: 8px; overflow-x: auto; margin: 12px 0; border: 1px solid #e5e7eb; font-size: 0.9em; }
.markdown-content pre code { background-color: transparent; padding: 0; border-radius: 0; color: #1f2937; font-size: 1em; white-space: pre; }
.markdown-content strong, .markdown-content b { font-weight: 700; }
.markdown-content em, .markdown-content i { font-style: italic; }
.markdown-content ul, .markdown-content ol { margin-left: 24px; margin-top: 8px; margin-bottom: 8px; padding-left: 0; }
.markdown-content ul { list-style: disc; }
.markdown-content ol { list-style: decimal; }
.markdown-content li { margin-bottom: 6px; }
.markdown-content li > p { margin-bottom: 4px; }
.markdown-content a { color: var(--primary); text-decoration: underline; }
.markdown-content a:hover { color: var(--secondary); }
.markdown-content p { margin-bottom: 12px; }
.markdown-content h1, .markdown-content h2, .markdown-content h3, .markdown-content h4, .markdown-content h5, .markdown-content h6 { margin-top: 20px; margin-bottom: 10px; font-weight: 600; line-height: 1.3; }
.markdown-content h1 { font-size: 1.5em; } .markdown-content h2 { font-size: 1.3em; } .markdown-content h3 { font-size: 1.15em; }
.markdown-content hr { border-top: 1px solid #e5e7eb; margin: 16px 0; }
.markdown-content blockquote { border-left: 3px solid var(--primary-container); padding-left: 12px; margin: 12px 0; color: var(--on-primary-container); font-style: italic; }
.markdown-content table { border-collapse: collapse; margin: 12px 0; width: auto; }
.markdown-content th, .markdown-content td { border: 1px solid #e5e7eb; padding: 8px 10px; }
.markdown-content th { background-color: #f9fafb; font-weight: 600; }
#sdk-error-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.7); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease; }
#sdk-error-overlay.visible { display: flex; opacity: 1; visibility: visible; }
#sdk-error-box { background-color: white; padding: 30px; border-radius: 12px; box-shadow: 0 5px 20px rgba(0,0,0,0.3); max-width: 500px; text-align: center; border-top: 5px solid #EF4444; }
#sdk-error-box h3 { color: #DC2626; margin-bottom: 15px; font-size: 1.25rem; font-weight: 700; }
#sdk-error-box p { margin-bottom: 10px; line-height: 1.6; color: #374151; font-size: 0.95rem; }
#sdk-error-box ul { text-align: left; margin: 15px 0 20px 20px; list-style: disc; } #sdk-error-box li { margin-bottom: 8px; }
#sdk-error-box code { background-color: #f3f4f6; padding: 2px 5px; border-radius: 4px; font-family: monospace; color: #831843; }
#reload-button { display: inline-block; margin-top: 15px; padding: 10px 20px; background-color: var(--primary); color: white; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; transition: background-color 0.2s ease; }
#reload-button:hover { background-color: #d63c84; }
/* --- STYLES FOR FILE PREVIEW (Multiple Files) --- */
#attachments-preview {
display: none;
flex-wrap: wrap;
gap: 8px;
padding: 5px 10px;
margin-bottom: 8px;
border-top: 1px solid #fbcfe8;
border-bottom: 1px solid #fbcfe8;
max-height: 100px;
overflow-y: auto;
background-color: #fff0f6;
}
.attachment-item {
display: flex;
align-items: center;
background-color: #fce7f3;
border: 1px solid #f9a8d4;
border-radius: 15px;
padding: 3px 8px;
font-size: 0.85em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 200px;
color: #831843;
}
.attachment-info {
display: flex;
align-items: center;
gap: 4px;
overflow: hidden;
text-overflow: ellipsis;
margin-right: 5px;
}
.attachment-info .material-icons-round {
font-size: 1.1em;
flex-shrink: 0;
color: var(--primary);
}
.remove-attachment-btn {
background: none;
border: none;
padding: 0;
margin-left: auto;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
color: #db2777;
border-radius: 50%;
width: 18px;
height: 18px;
flex-shrink: 0;
}
.remove-attachment-btn:hover {
color: #831843;
background-color: #fbcfe8;
}
.remove-attachment-btn .material-icons-round {
font-size: 16px;
}
/* Стили для кнопок прикрепления */
.control-btn {
background-color: white;
border: 2px solid var(--primary-container);
box-shadow: 0 4px 6px rgba(236, 72, 153, 0.1);
transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
width: 40px;
height: 40px;
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
}
.control-btn .material-icons-round {
color: #4B5563;
}
.control-btn:hover:not(:disabled) {
transform: translateY(-2px);
box-shadow: 0 6px 8px rgba(236, 72, 153, 0.2);
}
.control-btn:hover:not(:disabled) .material-icons-round {
color: var(--primary);
}
.control-btn:disabled {
opacity: 0.6;
cursor: not-allowed;
transform: none !important;
box-shadow: 0 4px 6px rgba(236, 72, 153, 0.1) !important;
}
/* Скрытие инпутов */
input[type="file"] {
display: none;
}
</style>
</head>
<body>
<!-- Main Content -->
<div class="main-container">
<!-- Header -->
<div class="flex items-center justify-between mb-6 px-2 flex-shrink-0">
<div class="flex items-center">
<div class="w-10 h-10 rounded-2xl ai-icon flex items-center justify-center mr-3 flex-shrink-0">
<span class="material-icons-round text-white">flare</span>
</div>
<div>
<h1 class="text-xl font-extrabold tracking-tight" style="color: var(--primary);">Liberalmind AI</h1>
</div>
</div>
</div>
<!-- Chat Area -->
<div class="chat-container" id="chat-container">
<!-- Welcome Screen -->
<div class="welcome-screen" id="welcome-screen">
<div class="w-20 h-20 rounded-2xl ai-icon flex items-center justify-center mb-6 floating flex-shrink-0">
<span class="material-icons-round text-white text-4xl">flare</span>
</div>
<h2 class="text-3xl font-extrabold tracking-tight mb-2" style="background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent;">AI Solver</h2>
<div class="info-box">
<div class="date-text">Ask your question</div>
<div class="info-text">
This is an experimental AI assistant. Type your question and get an answer.
</div>
</div>
<div id="init-error-message" style="color: #DC2626; font-weight: bold; margin-top: 10px; font-size: 0.9rem; min-height: 1.2em;"></div>
</div>
<!-- Messages -->
<div id="messages-container"></div>
<!-- Typing Indicator -->
<div class="ai-message hidden" id="typing-indicator">
<div class="avatar ai-avatar"><span class="material-icons-round text-lg">auto_awesome</span></div>
<div class="message-content" style="padding: 10px 14px;">
<span id="typing-indicator-text">AI is thinking...</span>
<div class="typing-dot"></div>
<div class="typing-dot"></div>
<div class="typing-dot"></div>
</div>
</div>
</div>
<!-- Input Area -->
<div class="mt-auto px-2 pb-2 pt-3 flex-shrink-0">
<!-- Область предпросмотра для нескольких файлов -->
<div id="attachments-preview"></div>
<!-- Text Input Container -->
<div class="input-container p-2 mt-2">
<div class="flex items-center space-x-2">
<!-- Text Input Field -->
<input type="text" placeholder="Initializing AI..." class="flex-1 bg-transparent outline-none px-3 py-2 text-base font-semibold placeholder-pink-300 text-gray-800 border-none focus:ring-0" id="message-input" autocomplete="off" disabled>
<!-- Send Button -->
<button class="send-btn w-10 h-10 rounded-xl flex items-center justify-center ripple flex-shrink-0" id="send-btn" disabled>
<span class="material-icons-round font-bold">send</span>
</button>
</div>
</div>
<!-- Action Buttons (Mode Selection & File Attachment) -->
<div class="flex justify-center space-x-3 mt-3">
<!-- Кнопка для перехода на agent.html -->
<button id="agent-btn" class="control-btn ripple" title="Go to Agent Mode" onclick="window.location.href='agent.html'">
<span class="material-icons-round">smart_toy</span>
</button>
<!-- Simple Mode Button -->
<button id="btn-simple" class="action-btn w-10 h-10 rounded-xl flex items-center justify-center ripple" title="Simple Mode (FAST - General/File Focus)">
<span class="material-icons-round" style="color: #a855f7;">bolt</span>
</button>
</div>
</div>
</div>
<!-- SDK Error Overlay -->
<div id="sdk-error-overlay">
<div id="sdk-error-box">
<h3>Initialization Problem</h3>
<p>Checking specific error...</p>
<button id="reload-button">Reload Page</button>
</div>
</div>
<!-- JavaScript Module Connection -->
<script type="module" src="script.js"></script>
</body>
</html> |