├── .gitignore ├── EN_to_RU.txt ├── LICENSE.txt ├── README.md ├── simple_chatbot_EN.html └── simple_chatbot_RU.html /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | # Uncomment if you have tasks that create the project's static files in wwwroot 39 | #wwwroot/ 40 | 41 | # Visual Studio 2017 auto generated files 42 | Generated\ Files/ 43 | 44 | # MSTest test Results 45 | [Tt]est[Rr]esult*/ 46 | [Bb]uild[Ll]og.* 47 | 48 | # NUnit 49 | *.VisualState.xml 50 | TestResult.xml 51 | nunit-*.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # ASP.NET Scaffolding 67 | ScaffoldingReadMe.txt 68 | 69 | # StyleCop 70 | StyleCopReport.xml 71 | 72 | # Files built by Visual Studio 73 | *_i.c 74 | *_p.c 75 | *_h.h 76 | *.ilk 77 | *.meta 78 | *.obj 79 | *.iobj 80 | *.pch 81 | *.pdb 82 | *.ipdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *_wpftmp.csproj 93 | *.log 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio LightSwitch build output 298 | **/*.HTMLClient/GeneratedArtifacts 299 | **/*.DesktopClient/GeneratedArtifacts 300 | **/*.DesktopClient/ModelManifest.xml 301 | **/*.Server/GeneratedArtifacts 302 | **/*.Server/ModelManifest.xml 303 | _Pvt_Extensions 304 | 305 | # Paket dependency manager 306 | .paket/paket.exe 307 | paket-files/ 308 | 309 | # FAKE - F# Make 310 | .fake/ 311 | 312 | # CodeRush personal settings 313 | .cr/personal 314 | 315 | # Python Tools for Visual Studio (PTVS) 316 | __pycache__/ 317 | *.pyc 318 | 319 | # Cake - Uncomment if you are using it 320 | # tools/** 321 | # !tools/packages.config 322 | 323 | # Tabs Studio 324 | *.tss 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs 334 | 335 | # OpenCover UI analysis results 336 | OpenCover/ 337 | 338 | # Azure Stream Analytics local run output 339 | ASALocalRun/ 340 | 341 | # MSBuild Binary and Structured Log 342 | *.binlog 343 | 344 | # NVidia Nsight GPU debugger configuration file 345 | *.nvuser 346 | 347 | # MFractors (Xamarin productivity tool) working folder 348 | .mfractor/ 349 | 350 | # Local History for Visual Studio 351 | .localhistory/ 352 | 353 | # BeatPulse healthcheck temp database 354 | healthchecksdb 355 | 356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 357 | MigrationBackup/ 358 | 359 | # Ionide (cross platform F# VS Code tools) working folder 360 | .ionide/ 361 | 362 | # Fody - auto-generated XML schema 363 | FodyWeavers.xsd 364 | /simple_chatbot.sln 365 | /.gitignore 366 | /.gitattributes 367 | /simple_chatbot (2).html 368 | /simple_chatbot_test.html 369 | -------------------------------------------------------------------------------- /EN_to_RU.txt: -------------------------------------------------------------------------------- 1 | 938c938 2 | < 3 | --- 4 | > 5 | 940c940 6 | < 7 | --- 8 | > 9 | 944,945c944,945 10 | < 11 | < 12 | --- 13 | > 14 | > 15 | 951c951 16 | < System Prompt (Optional) 17 | --- 18 | > Системный Промпт (Опционально) 19 | 955c955 20 | < 21 | --- 22 | > 23 | 970c970 24 | <

Drag & Drop Files Here or Click to Upload

25 | --- 26 | >

Сбросте Файлы Сюда или Нажмите для Выгрузки

27 | 977c977 28 | < 29 | --- 30 | > 31 | 980,981c980,981 32 | < 33 | < 34 | --- 35 | > 36 | > 37 | 988c988 38 | < 39 | --- 40 | > 41 | 1011c1011 42 | < console.log('MathJax is ready.'); 43 | --- 44 | > console.log('MathJax готов.'); 45 | 1025c1025 46 | < console.warn("pdf.js library not loaded. PDF parsing will not be available."); 47 | --- 48 | > console.warn("pdf.js библиотека не загружена. PDF парсинг будет не доступен."); 49 | 1091c1091 50 | < catch (e) { console.warn(`Prism highlighting failed for language "${language}":`, e); return code; } 51 | --- 52 | > catch (e) { console.warn(`Prism подсветка не удалась для языка "${language}":`, e); return code; } 53 | 1112c1112 54 | < modelSelect.innerHTML = ``; 55 | --- 56 | > modelSelect.innerHTML = ``; 57 | 1123,1124c1123,1124 58 | < console.error("Error fetching models:", error); 59 | < modelSelect.innerHTML = ``; 60 | --- 61 | > console.error("Ошибка извлечения моделей:", error); 62 | > modelSelect.innerHTML = ``; 63 | 1126c1126 64 | < alert(`Failed to fetch models from ${OLLAMA_API_URL}:\n${error.message}\n\nPlease ensure Ollama is running and the API URL is correct (including http/https).`); 65 | --- 66 | > alert(`Не удалалось извлечь модели из ${OLLAMA_API_URL}:\n${error.message}\n\nПожалуйста убедитесь, что Ollama запущена, и, что API URL правильный (включая http/https).`); 67 | 1134c1134 68 | < modelSelect.innerHTML = ''; 69 | --- 70 | > modelSelect.innerHTML = ''; 71 | 1153c1153 72 | < copyButton.textContent = 'Copy'; 73 | --- 74 | > copyButton.textContent = 'Скопировать'; 75 | 1155c1155 76 | < copyButton.title = 'Copy code to clipboard'; 77 | --- 78 | > copyButton.title = 'Скопировать код в буфер обмена'; 79 | 1162c1162 80 | < copyButton.textContent = 'Copied!'; 81 | --- 82 | > copyButton.textContent = 'Скопировано!'; 83 | 1165c1165 84 | < copyButton.textContent = 'Copy'; 85 | --- 86 | > copyButton.textContent = 'Копировать'; 87 | 1169c1169 88 | < console.error('Failed to copy code: ', err); 89 | --- 90 | > console.error('Не удалось скопировать код: ', err); 91 | 1171c1171 92 | < setTimeout(() => { copyButton.textContent = 'Copy'; }, 2000); 93 | --- 94 | > setTimeout(() => { copyButton.textContent = 'Скопировать'; }, 2000); 95 | 1192c1192 96 | < attachmentNoteDiv.innerHTML = `Attached file(s): ${filenamesString}`; 97 | --- 98 | > attachmentNoteDiv.innerHTML = `Прикрепленные файлы: ${filenamesString}`; 99 | 1200c1200 100 | < contentDiv.innerHTML = "Typing..."; 101 | --- 102 | > contentDiv.innerHTML = "Печатает..."; 103 | 1233c1233 104 | < } 105 | --- 106 | > } 107 | 1257c1257 108 | < AI Thoughts [+] 109 | --- 110 | > Мысли ИИ [+] 111 | 1299c1299 112 | < if (currentAiMessageContentDiv.innerHTML.includes("Typing...")) { 113 | --- 114 | > if (currentAiMessageContentDiv.innerHTML.includes("Печатает...")) { 115 | 1311c1311 116 | < AI Thoughts (Model Thinking) [+] 117 | --- 118 | > Мысли ИИ (Модель Думает) [+] 119 | 1349c1349 120 | < AI Thoughts (Model Thinking) [+] 121 | --- 122 | > Мысли ИИ (Модель Думает) [+] 123 | 1497c1497 124 | < scrapeStatusElement.textContent = `Found ${urlsToScrape.length} URL(s). Scraping...`; 125 | --- 126 | > scrapeStatusElement.textContent = `Нашло ${urlsToScrape.length} URL(s). Скрейпинг...`; 127 | 1506c1506 128 | < scrapeStatusElement.textContent = `Scraping (${scrapedCount + failedScrapes + 1}/${urlsToScrape.length}): ${escapeHTML(displayUrl)}`; 129 | --- 130 | > scrapeStatusElement.textContent = `Скрейпинг (${scrapedCount + failedScrapes + 1}/${urlsToScrape.length}): ${escapeHTML(displayUrl)}`; 131 | 1517,1518c1517,1518 132 | < else if (!extractedContent) { success = false; detailMsg = "Extracted empty content"; } 133 | < else { success = true; detailMsg = `Parsed ${extractedContent.length} chars`; } 134 | --- 135 | > else if (!extractedContent) { success = false; detailMsg = "Вытащено пустое содержимое"; } 136 | > else { success = true; detailMsg = `Парсировано ${extractedContent.length} символов`; } 137 | 1522,1524c1522,1524 138 | < success = true; detailMsg = `Read ${extractedContent.length} chars`; 139 | < if (contentType.includes("application/json")) { try { JSON.parse(extractedContent); } catch (jsonError) { console.warn("Scraped JSON is invalid:", jsonError, url); detailMsg += " (invalid JSON structure)"; } } 140 | < } else { detailMsg = `Skipped (Unsupported type: ${escapeHTML(contentType)})`; success = false; } 141 | --- 142 | > success = true; detailMsg = `Прочитано ${extractedContent.length} символов`; 143 | > if (contentType.includes("application/json")) { try { JSON.parse(extractedContent); } catch (jsonError) { console.warn("Scraped JSON is invalid:", jsonError, url); detailMsg += " (некоректная JSON структура)"; } } 144 | > } else { detailMsg = `Пропущено (Неподдерживаемы тип: ${escapeHTML(contentType)})`; success = false; } 145 | 1527c1527 146 | < detailMsg = `Failed (${escapeHTML(error.name === 'AbortError' ? 'Timeout' : error.message || "Unknown fetch error")})`; success = false; 147 | --- 148 | > detailMsg = `Провалилось (${escapeHTML(error.name === 'AbortError' ? 'Timeout' : error.message || "Unknown fetch error")})`; success = false; 149 | 1531,1532c1531,1532 150 | < scrapedUrlContentForApi += `\n\n--- Content from ${escapeHTML(url)} ---\n${extractedContent}\n--- End Content from ${escapeHTML(url)} ---\n`; 151 | < scrapedPreambleForUserDisplay += `\n- **Success:** \`${escapeHTML(url)}\` (${detailMsg})`; scrapedCount++; 152 | --- 153 | > scrapedUrlContentForApi += `\n\n--- Контент из ${escapeHTML(url)} ---\n${extractedContent}\n--- Конец контент из ${escapeHTML(url)} ---\n`; 154 | > scrapedPreambleForUserDisplay += `\n- **Успешно:** \`${escapeHTML(url)}\` (${detailMsg})`; scrapedCount++; 155 | 1534c1534 156 | < scrapedPreambleForUserDisplay += `\n- **Failed:** \`${escapeHTML(url)}\` (${detailMsg})`; failedScrapes++; 157 | --- 158 | > scrapedPreambleForUserDisplay += `\n- **Провально:** \`${escapeHTML(url)}\` (${detailMsg})`; failedScrapes++; 159 | 1543c1543 160 | < scrapeStatusElement.textContent = `Scraping finished: ${scrapedCount} successful, ${failedScrapes} failed/skipped.`; 161 | --- 162 | > scrapeStatusElement.textContent = `Скрейпинг завершён: ${scrapedCount} удачно, ${failedScrapes} провалилось/пропущено.`; 163 | 1546c1546 164 | < if (scrapedPreambleForUserDisplay) scrapedPreambleForUserDisplay = `**URL Scraping Results:**${scrapedPreambleForUserDisplay}`; 165 | --- 166 | > if (scrapedPreambleForUserDisplay) scrapedPreambleForUserDisplay = `**Результат URL Скрейпинга:**${scrapedPreambleForUserDisplay}`; 167 | 1548c1548 168 | < scrapeStatusElement.textContent = "No URLs found in the message to scrape."; 169 | --- 170 | > scrapeStatusElement.textContent = "Не найдено URL в сообщении для скрейпинга."; 171 | 1552,1553c1552,1553 172 | < if (!selectedModel) { alert("Please select a model."); modelSelect.focus(); } 173 | < if (isAwaitingResponse) console.log("Already awaiting response."); 174 | --- 175 | > if (!selectedModel) { alert("Пожалуйста выберите модель."); modelSelect.focus(); } 176 | > if (isAwaitingResponse) console.log("Уже ожидается ответ."); 177 | 1564c1564 178 | < const aiMessageElements = displayMessage("AI", "Typing...", null, true); 179 | --- 180 | > const aiMessageElements = displayMessage("ИИ", "Печатает...", null, true); 181 | 1568,1570c1568,1570 182 | < if (scrapedUrlContentForApi) userMessageForApi += `The user provided URLs with the following extracted content:\n${scrapedUrlContentForApi}\n--- End of Extracted URL Content ---\n\n`; 183 | < if (messageText) userMessageForApi += `User's typed message:\n${messageText}\n`; 184 | < else if (scrapedUrlContentForApi) userMessageForApi += `User's typed message:\n(No typed message; content above was from URLs.)\n`; 185 | --- 186 | > if (scrapedUrlContentForApi) userMessageForApi += `Пользователь предоставил URL с следующим вытащенным контентом:\n${scrapedUrlContentForApi}\n--- Конец Вытащенного URL Контента ---\n\n`; 187 | > if (messageText) userMessageForApi += `Пользователь написал сообщение:\n${messageText}\n`; 188 | > else if (scrapedUrlContentForApi) userMessageForApi += `Пользователь написал сообщение:\n(Нет написанного сообщения; контант сверху был из URL.)\n`; 189 | 1574c1574 190 | < filePreambleForApi = "The user has also attached the following files (content included for text-based):\n"; 191 | --- 192 | > filePreambleForApi = "Пользователь также прикрепил следующие файлы (контент включён для text-based):\n"; 193 | 1578c1578 194 | < else textFileContentsForApi += `\n\n--- Content of file "${safeFilename}" ---\n\`\`\`\n${file.content}\n\`\`\`\n--- End Content of file "${safeFilename}" ---\n`; 195 | --- 196 | > else textFileContentsForApi += `\n\n--- Содержимое файла "${safeFilename}" ---\n\`\`\`\n${file.content}\n\`\`\`\n--- Конец содержимого файла "${safeFilename}" ---\n`; 197 | 1586,1588c1586,1588 198 | < scrapeStatusElement.textContent = "Nothing valid to send."; finalizeAiMessage(currentExternalThinkContent, aiMessageElements.messageBubble); 199 | < if (currentAiMessageContentDiv) currentAiMessageContentDiv.innerHTML = marked.parse("**Error:** Processing resulted in an empty message. Nothing sent."); 200 | < else displayMessage("AI", "**Error:** Processing resulted in an empty message. Nothing sent.", null); 201 | --- 202 | > scrapeStatusElement.textContent = "Ничего допустимого для отправки."; finalizeAiMessage(currentExternalThinkContent, aiMessageElements.messageBubble); 203 | > if (currentAiMessageContentDiv) currentAiMessageContentDiv.innerHTML = marked.parse("**Error:** Обработка привела к пустому сообщению. Ничего не отправлено."); 204 | > else displayMessage("AI", "**Error:** Обработка привела к пустому сообщению. Ничего не отправлено.", null); 205 | 1612,1614c1612,1614 206 | < let historyUserContent = messageText || "(No typed message)"; 207 | < if (attachedFiles.length > 0) historyUserContent = `(Attached: ${attachedFiles.map(f => `\`${escapeHTML(f.name)}\``).join(', ')}) ${historyUserContent}`; 208 | < if (scrapedPreambleForUserDisplay && scrapedCount > 0) historyUserContent += `\n*(Scraped ${scrapedCount} URL(s))*`; 209 | --- 210 | > let historyUserContent = messageText || "(Нет написанного сообщения)"; 211 | > if (attachedFiles.length > 0) historyUserContent = `(Прикреплено: ${attachedFiles.map(f => `\`${escapeHTML(f.name)}\``).join(', ')}) ${historyUserContent}`; 212 | > if (scrapedPreambleForUserDisplay && scrapedCount > 0) historyUserContent += `\n*(Скрейпировано ${scrapedCount} URL)*`; 213 | 1618c1618 214 | < if (currentAiMessageContentDiv && currentAiMessageContentDiv.innerHTML.includes("Typing...")) { currentAiMessageContentDiv.innerHTML = ''; currentAiMessageContentDiv.dataset.rawMarkdown = ''; } 215 | --- 216 | > if (currentAiMessageContentDiv && currentAiMessageContentDiv.innerHTML.includes("Печатает...")) { currentAiMessageContentDiv.innerHTML = ''; currentAiMessageContentDiv.dataset.rawMarkdown = ''; } 217 | 1648c1648 218 | < if (scrapeStatusElement) scrapeStatusElement.textContent = "Error during AI response."; 219 | --- 220 | > if (scrapeStatusElement) scrapeStatusElement.textContent = "Ошибка во время ответа ИИ."; 221 | 1670c1670 222 | < const removeBtn = document.createElement('button'); removeBtn.classList.add('remove-file-btn'); removeBtn.innerHTML = '×'; removeBtn.title = `Remove ${file.name}`; removeBtn.dataset.fileId = file.id; 223 | --- 224 | > const removeBtn = document.createElement('button'); removeBtn.classList.add('remove-file-btn'); removeBtn.innerHTML = '×'; removeBtn.title = `Убрать ${file.name}`; removeBtn.dataset.fileId = file.id; 225 | 1682c1682 226 | < dropZoneInstruction.textContent = `Processing PDF: 0/${numPages} pages...`; 227 | --- 228 | > dropZoneInstruction.textContent = `Обработка PDF: 0/${numPages} страниц...`; 229 | 1686c1686 230 | < dropZoneInstruction.textContent = `Processing PDF: ${i}/${numPages} pages...`; page.cleanup(); 231 | --- 232 | > dropZoneInstruction.textContent = `Обработка PDF: ${i}/${numPages} страниц...`; page.cleanup(); 233 | 1688,1690c1688,1690 234 | < if (pdf.numPages > maxPagesToProcess) fullText += `\n\n[PDF processing stopped after ${maxPagesToProcess} pages. Total pages: ${pdf.numPages}]`; 235 | < dropZoneInstruction.textContent = 'Drag & Drop Files Here or Click to Upload'; return fullText.trim(); 236 | < } catch (error) { console.error('Error parsing PDF:', error); dropZoneInstruction.textContent = 'Drag & Drop Files Here or Click to Upload'; return `[Error extracting text from PDF: ${escapeHTML(error.message)}]`; } 237 | --- 238 | > if (pdf.numPages > maxPagesToProcess) fullText += `\n\n[Обработка PDF остановилась после ${maxPagesToProcess} страниц. Всего страниц: ${pdf.numPages}]`; 239 | > dropZoneInstruction.textContent = 'Сбросте Файлы Сюда или Нажмите для Выгрузки'; return fullText.trim(); 240 | > } catch (error) { console.error('Error parsing PDF:', error); dropZoneInstruction.textContent = 'Сбросте Файлы Сюда или Нажмите для Выгрузки'; return `[Error extracting text from PDF: ${escapeHTML(error.message)}]`; } 241 | 1697,1698c1697,1698 242 | < if (attachedFiles.some(f => f.name === file.name)) { alert(`File "${escapeHTML(file.name)}" is already attached.`); continue; } 243 | < if (file.size > maxFileSize) { alert(`File "${escapeHTML(file.name)}" is too large (${(file.size / 1024 / 1024).toFixed(1)} MB). Maximum size is ${maxFileSize / 1024 / 1024} MB.`); continue; } 244 | --- 245 | > if (attachedFiles.some(f => f.name === file.name)) { alert(`Файл "${escapeHTML(file.name)}" уже прикреплён.`); continue; } 246 | > if (file.size > maxFileSize) { alert(`Файл "${escapeHTML(file.name)}" слишком большой (${(file.size / 1024 / 1024).toFixed(1)} MB). Максимальный размер ${maxFileSize / 1024 / 1024} MB.`); continue; } 247 | 1700,1701c1700,1701 248 | < if (!isAllowedType && !isUnknownButAllowed) { alert(`File type "${escapeHTML(fileType)}" for "${escapeHTML(file.name)}" is not supported.`); continue; } 249 | < if (isUnknownButAllowed) console.warn(`File "${escapeHTML(file.name)}" has an unknown type. Attempting to read as text.`); 250 | --- 251 | > if (!isAllowedType && !isUnknownButAllowed) { alert(`Тип файла "${escapeHTML(fileType)}" для "${escapeHTML(file.name)}" не поддерживается.`); continue; } 252 | > if (isUnknownButAllowed) console.warn(`Файл "${escapeHTML(file.name)}" имеет неизвестный тип. Попытка прочитать как текст.`); 253 | 1706c1706 254 | < if (fileType === 'application/pdf') { dropZoneInstruction.textContent = `Processing PDF: ${escapeHTML(file.name)}...`; fileContent = await extractTextFromPdf(e.target.result); } 255 | --- 256 | > if (fileType === 'application/pdf') { dropZoneInstruction.textContent = `Обработка PDF: ${escapeHTML(file.name)}...`; fileContent = await extractTextFromPdf(e.target.result); } 257 | 1709c1709 258 | < } catch (processingError) { console.error(`Error processing file ${file.name}:`, processingError); alert(`Error processing file "${escapeHTML(file.name)}": ${processingError.message}`); if (fileType === 'application/pdf') dropZoneInstruction.textContent = 'Drag & Drop Files Here or Click to Upload'; } 259 | --- 260 | > } catch (processingError) { console.error(`Error processing file ${file.name}:`, processingError); alert(`Ошибка обработки файла "${escapeHTML(file.name)}": ${processingError.message}`); if (fileType === 'application/pdf') dropZoneInstruction.textContent = 'Сбросте Файлы Сюда или Нажмите для Выгрузки'; } 261 | 1711c1711 262 | < reader.onerror = (e) => { console.error("Error reading file:", file.name, e); alert("Error reading file: " + escapeHTML(file.name)); if (fileType === 'application/pdf') dropZoneInstruction.textContent = 'Drag & Drop Files Here or Click to Upload'; }; 263 | --- 264 | > reader.onerror = (e) => { console.error("Error reading file:", file.name, e); alert("Ошибка чтения файла: " + escapeHTML(file.name)); if (fileType === 'application/pdf') dropZoneInstruction.textContent = 'Сбросте Файлы Сюда или Нажмите для Выгрузки'; }; 265 | 1807c1807 266 | < } else { alert("Please enter a valid Ollama API URL (must start with http:// or https://)."); ollamaUrlInput.value = OLLAMA_API_URL; ollamaUrlInput.focus(); } 267 | --- 268 | > } else { alert("Пожалуйста введите правильный Ollama API URL (должен начинаться с http:// или https://)."); ollamaUrlInput.value = OLLAMA_API_URL; ollamaUrlInput.focus(); } 269 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Simple Ollama Chatbot 2 | 3 | ## [EN] 4 | 5 | A simple Ollama chatbot that is easy to install and use. 6 | 7 | ### Install instructions 8 | 1. Install and setup Ollama. 9 | 1. Copy the file ```simple_chatbot_EN.html``` to your disk. 10 | 1. Open the file ```simple_chatbot_EN.html``` in a web browser. 11 | - If you want to set specific model on page load write it in URL. For example ```Folder/with_file/simple_chatbot_EN.html?model=qwen3:14b``` 12 | - If you want to use this in Firefox AI sidebar, you can set ```browser.ml.chat.provider``` to ```Folder/with_file/simple_chatbot_EN``` 13 | 14 | #### Ollama setup instruction 15 | 1. Install Ollama: [ollama.com/download](https://ollama.com/download). 16 | 1. Install your favorite model. For example, you can use the following command to install the qwen3 model: ```ollama pull qwen3```. 17 | 1. Set environment variable ```OLLAMA_ORIGINS=*```. On windows, you can set it simply by running this powershell command: ```[Environment]::SetEnvironmentVariable("OLLAMA_ORIGINS","*","User")```. 18 | 1. Make sure Ollama is running. Either by doing ```ollama serve``` in a terminal or by opening ollama.exe. 19 | 20 | If you want to modify the chatbot, you can edit the file ```simple_chatbot_EN.html``` in a text editor. The chatbot is written in HTML and JavaScript, so you can easily change the code to suit your needs. 21 | Also, you can copy the code in the chatbot interface and ask your favorite ai model to make it better! In fact, the entire code was created by an AI. 22 | 23 | ### Support 24 | Support the following features: 25 | - Markdown 26 | - Mathjax 27 | - Code bloc synthax highlighting 28 | - Attaching files (including pdf) 29 | - Attaching images 30 | - Scrape URL content found in the user input and send it to the model 31 | - Dark and light mode toggle 32 | - Firefox AI sidebar support 33 | - Remember chat history when reopening the file. Chat history can be erased by clicking the ```Reset Chat``` button. 34 | 35 | 36 | ## [RU] 37 | 38 | Простой чат-бот Ollama, который легко установить и использовать. 39 | 40 | ### Инструкции по установке 41 | 1. Установите и настройте Ollama. 42 | 1. Скопируйте файл ```simple_chatbot_RU.html``` на свой диск. 43 | 1. Откройте файл ```simple_chatbot_RU.html``` в веб-браузере. 44 | - Если вы хотите поставить определённую модель во время загрузки страницы, укажите её в URL. Для примера ```Папка/с_файлом/simple_chatbot_RU.html?model=qwen3:14b``` 45 | - Если вы хотите использовать это в ИИ боковой панели Firefox, вы можете установить ```browser.ml.chat.provider``` на ```Папка/с_файлом/simple_chatbot_RU``` 46 | 47 | ### Инструкция по настройке Ollama 48 | 1. Установите Ollama: [ollama.com/download](https://ollama.com/download). 49 | 1. Установите свою любимую модель. Например, вы можете использовать следующую команду для установки модели qwen3: ```ollama pull qwen3```. 50 | 1. Установите переменную окружения ```OLLAMA_ORIGINS=*```. В Windows вы можете сделать это, просто запустив эту команду PowerShell: ```[Environment]::SetEnvironmentVariable("OLLAMA_ORIGINS","*","User")```. 51 | 1. Убедитесь, что Ollama работает. Либо выполнив ```ollama serve``` в терминале, либо открыв ollama.exe. 52 | 53 | Если вы хотите модифицировать чат-бота, вы можете отредактировать файл ```simple_chatbot_RU.html``` в текстовом редакторе. Чат-бот написан на HTML и JavaScript, поэтому вы можете легко изменить код в соответствии со своими потребностями. 54 | Также, вы можете скопировать код в интерфейсе чат-бота и попросить свою любимую ИИ модель сделать его лучше! На самом деле, весь код был создан ИИ. 55 | 56 | ### Поддерживаемые функции: 57 | - Markdown 58 | - Mathjax 59 | - Подсветка синтаксиса для блоков кода 60 | - Прикрепление файлов (включая PDF) 61 | - Прикрепление изображений 62 | - Извлечение содержимого URL, найденного во вводе пользователя, и отправка его модели 63 | - Переключение между темной и светлой темами 64 | - Поддержка ИИ боковой панели Firefox 65 | - Сохранение истории чата при повторном открытии файла. История чата может быть удалена нажатием кнопки ```Очистить чат```. 66 | -------------------------------------------------------------------------------- /simple_chatbot_EN.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Ollama Standalone Chat 7 | 8 | 9 | 10 | 932 | 933 | 934 | 935 |
936 | 937 |
938 | 939 | 942 | 943 | 944 | 945 | 946 |
947 | 948 | 949 |
950 |
951 | System Prompt (Optional) 952 | [+] 953 |
954 | 957 |
958 | 959 | 960 |
961 | 962 |
963 | 964 | 965 |
966 | 967 |
968 | 969 |
970 |

Drag & Drop Files Here or Click to Upload

971 |
972 | 973 | 974 |
975 |
976 |
977 | 978 |
979 |
980 | 981 | 982 |
983 |
984 | 985 | 986 |
987 | 988 | 989 | 990 |
991 |
992 | 993 | 994 | 995 | 996 | 997 | 998 | 999 | 1000 | 1001 | 1017 | 1018 | 1019 | 1020 | 1021 | 1028 | 1029 | 1030 | 1842 | 1843 | 1844 | -------------------------------------------------------------------------------- /simple_chatbot_RU.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Ollama Standalone Chat 7 | 8 | 9 | 10 | 932 | 933 | 934 | 935 |
936 | 937 |
938 | 939 | 942 | 943 | 944 | 945 | 946 |
947 | 948 | 949 |
950 |
951 | Системный Промпт (Опционально) 952 | [+] 953 |
954 | 957 |
958 | 959 | 960 |
961 | 962 |
963 | 964 | 965 |
966 | 967 |
968 | 969 |
970 |

Сбросте Файлы Сюда или Нажмите для Выгрузки

971 |
972 | 973 | 974 |
975 |
976 |
977 | 978 |
979 |
980 | 981 | 982 |
983 |
984 | 985 | 986 |
987 | 988 | 989 | 990 |
991 |
992 | 993 | 994 | 995 | 996 | 997 | 998 | 999 | 1000 | 1001 | 1017 | 1018 | 1019 | 1020 | 1021 | 1028 | 1029 | 1030 | 1842 | 1843 | 1844 | --------------------------------------------------------------------------------