Source Tree: ``` ai ├── .env.example ├── backend │ ├── alembic.ini │ ├── apps │ │ ├── audio │ │ │ └── main.py │ │ ├── images │ │ │ ├── main.py │ │ │ └── utils │ │ │ └── comfyui.py │ │ ├── ollama │ │ │ └── main.py │ │ ├── openai │ │ │ └── main.py │ │ ├── rag │ │ │ ├── main.py │ │ │ ├── search │ │ │ │ ├── brave.py │ │ │ │ ├── duckduckgo.py │ │ │ │ ├── google_pse.py │ │ │ │ ├── jina_search.py │ │ │ │ ├── main.py │ │ │ │ ├── searxng.py │ │ │ │ ├── serper.py │ │ │ │ ├── serply.py │ │ │ │ ├── serpstack.py │ │ │ │ ├── tavily.py │ │ │ │ └── testdata │ │ │ │ ├── brave.json │ │ │ │ ├── google_pse.json │ │ │ │ ├── searxng.json │ │ │ │ ├── serper.json │ │ │ │ ├── serply.json │ │ │ │ └── serpstack.json │ │ │ └── utils.py │ │ ├── socket │ │ │ └── main.py │ │ └── webui │ │ ├── internal │ │ │ ├── db.py │ │ │ ├── migrations │ │ │ │ ├── 001_initial_schema.py │ │ │ │ ├── 002_add_local_sharing.py │ │ │ │ ├── 003_add_auth_api_key.py │ │ │ │ ├── 004_add_archived.py │ │ │ │ ├── 005_add_updated_at.py │ │ │ │ ├── 006_migrate_timestamps_and_charfields.py │ │ │ │ ├── 007_add_user_last_active_at.py │ │ │ │ ├── 008_add_memory.py │ │ │ │ ├── 009_add_models.py │ │ │ │ ├── 010_migrate_modelfiles_to_models.py │ │ │ │ ├── 011_add_user_settings.py │ │ │ │ ├── 012_add_tools.py │ │ │ │ ├── 013_add_user_info.py │ │ │ │ ├── 014_add_files.py │ │ │ │ ├── 015_add_functions.py │ │ │ │ ├── 016_add_valves_and_is_active.py │ │ │ │ ├── 017_add_user_oauth_sub.py │ │ │ │ └── 018_add_function_is_global.py │ │ │ └── wrappers.py │ │ ├── main.py │ │ ├── models │ │ │ ├── auths.py │ │ │ ├── chats.py │ │ │ ├── documents.py │ │ │ ├── files.py │ │ │ ├── functions.py │ │ │ ├── memories.py │ │ │ ├── models.py │ │ │ ├── prompts.py │ │ │ ├── tags.py │ │ │ ├── tools.py │ │ │ └── users.py │ │ ├── routers │ │ │ ├── auths.py │ │ │ ├── chats.py │ │ │ ├── configs.py │ │ │ ├── documents.py │ │ │ ├── files.py │ │ │ ├── functions.py │ │ │ ├── memories.py │ │ │ ├── models.py │ │ │ ├── prompts.py │ │ │ ├── tools.py │ │ │ ├── users.py │ │ │ └── utils.py │ │ └── utils.py │ ├── config.py │ ├── constants.py │ ├── data │ │ ├── config.json │ │ └── litellm │ │ └── config.yaml │ ├── dev.sh │ ├── main.py │ ├── migrations │ │ ├── env.py │ │ ├── README │ │ ├── script.py.mako │ │ ├── util.py │ │ └── versions │ │ └── 7e5b5dc7342b_init.py │ ├── open_webui │ │ └── __init__.py │ ├── requirements.txt │ ├── start.sh │ ├── start_windows.bat │ ├── static │ │ ├── favicon.png │ │ ├── fonts │ │ │ ├── NotoSans-Bold.ttf │ │ │ ├── NotoSans-Italic.ttf │ │ │ ├── NotoSans-Regular.ttf │ │ │ ├── NotoSansJP-Regular.ttf │ │ │ └── NotoSansKR-Regular.ttf │ │ ├── logo.png │ │ ├── splash.png │ │ └── user-import.csv │ ├── test │ │ ├── apps │ │ │ └── webui │ │ │ └── routers │ │ │ ├── test_auths.py │ │ │ ├── test_chats.py │ │ │ ├── test_documents.py │ │ │ ├── test_models.py │ │ │ ├── test_prompts.py │ │ │ └── test_users.py │ │ ├── util │ │ │ ├── abstract_integration_test.py │ │ │ └── mock_user.py │ │ └── __init__.py │ └── utils │ ├── logo.png │ ├── misc.py │ ├── task.py │ ├── tools.py │ ├── utils.py │ └── webhook.py ├── bun.lockb ├── Caddyfile.localhost ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── confirm_remove.sh ├── cypress │ ├── data │ │ └── example-doc.txt │ ├── e2e │ │ ├── chat.cy.ts │ │ ├── documents.cy.ts │ │ ├── registration.cy.ts │ │ └── settings.cy.ts │ ├── support │ │ ├── e2e.ts │ │ └── index.d.ts │ └── tsconfig.json ├── cypress.config.ts ├── demo.gif ├── docker-compose.a1111-test.yaml ├── docker-compose.amdgpu.yaml ├── docker-compose.api.yaml ├── docker-compose.data.yaml ├── docker-compose.gpu.yaml ├── docker-compose.yaml ├── Dockerfile ├── docs │ ├── apache.md │ ├── CONTRIBUTING.md │ ├── README.md │ └── SECURITY.md ├── hatch_build.py ├── i18next-parser.config.ts ├── INSTALLATION.md ├── kubernetes │ ├── helm │ │ └── README.md │ └── manifest │ ├── base │ │ ├── ollama-service.yaml │ │ ├── ollama-statefulset.yaml │ │ ├── open-webui.yaml │ │ ├── webui-deployment.yaml │ │ ├── webui-ingress.yaml │ │ ├── webui-pvc.yaml │ │ └── webui-service.yaml │ ├── kustomization.yaml │ └── patches │ └── ollama-statefulset-gpu.yaml ├── LICENSE ├── Makefile ├── package-lock.json ├── package.json ├── postcss.config.js ├── pyproject.toml ├── README.md ├── requirements-dev.lock ├── requirements.lock ├── run-compose.sh ├── run-ollama-docker.sh ├── run.sh ├── scripts │ └── prepare-pyodide.js ├── src │ ├── app.css │ ├── app.d.ts │ ├── app.html │ ├── lib │ │ ├── apis │ │ │ ├── audio │ │ │ │ └── index.ts │ │ │ ├── auths │ │ │ │ └── index.ts │ │ │ ├── chats │ │ │ │ └── index.ts │ │ │ ├── configs │ │ │ │ └── index.ts │ │ │ ├── documents │ │ │ │ └── index.ts │ │ │ ├── files │ │ │ │ └── index.ts │ │ │ ├── functions │ │ │ │ └── index.ts │ │ │ ├── images │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ ├── memories │ │ │ │ └── index.ts │ │ │ ├── models │ │ │ │ └── index.ts │ │ │ ├── ollama │ │ │ │ └── index.ts │ │ │ ├── openai │ │ │ │ └── index.ts │ │ │ ├── prompts │ │ │ │ └── index.ts │ │ │ ├── rag │ │ │ │ └── index.ts │ │ │ ├── streaming │ │ │ │ └── index.ts │ │ │ ├── tools │ │ │ │ └── index.ts │ │ │ ├── users │ │ │ │ └── index.ts │ │ │ └── utils │ │ │ └── index.ts │ │ ├── components │ │ │ ├── AddFilesPlaceholder.svelte │ │ │ ├── admin │ │ │ │ ├── AddUserModal.svelte │ │ │ │ ├── EditUserModal.svelte │ │ │ │ ├── Settings │ │ │ │ │ ├── Audio.svelte │ │ │ │ │ ├── Connections.svelte │ │ │ │ │ ├── Database.svelte │ │ │ │ │ ├── Documents.svelte │ │ │ │ │ ├── General.svelte │ │ │ │ │ ├── Images.svelte │ │ │ │ │ ├── Interface.svelte │ │ │ │ │ ├── Models.svelte │ │ │ │ │ ├── Pipelines.svelte │ │ │ │ │ ├── Users.svelte │ │ │ │ │ └── WebSearch.svelte │ │ │ │ ├── Settings.svelte │ │ │ │ └── UserChatsModal.svelte │ │ │ ├── ChangelogModal.svelte │ │ │ ├── chat │ │ │ │ ├── Chat.svelte │ │ │ │ ├── ChatControls.svelte │ │ │ │ ├── Controls │ │ │ │ │ └── Controls.svelte │ │ │ │ ├── MessageInput │ │ │ │ │ ├── CallOverlay │ │ │ │ │ │ └── VideoInputMenu.svelte │ │ │ │ │ ├── CallOverlay.svelte │ │ │ │ │ ├── Documents.svelte │ │ │ │ │ ├── FilesOverlay.svelte │ │ │ │ │ ├── InputMenu.svelte │ │ │ │ │ ├── Models.svelte │ │ │ │ │ ├── PromptCommands.svelte │ │ │ │ │ ├── Suggestions.svelte │ │ │ │ │ └── VoiceRecording.svelte │ │ │ │ ├── MessageInput.svelte │ │ │ │ ├── Messages │ │ │ │ │ ├── CitationsModal.svelte │ │ │ │ │ ├── CodeBlock.svelte │ │ │ │ │ ├── CompareMessages.svelte │ │ │ │ │ ├── Name.svelte │ │ │ │ │ ├── Placeholder.svelte │ │ │ │ │ ├── ProfileImage.svelte │ │ │ │ │ ├── RateComment.svelte │ │ │ │ │ ├── ResponseMessage │ │ │ │ │ │ └── WebSearchResults.svelte │ │ │ │ │ ├── ResponseMessage.svelte │ │ │ │ │ ├── Skeleton.svelte │ │ │ │ │ └── UserMessage.svelte │ │ │ │ ├── Messages.svelte │ │ │ │ ├── ModelSelector │ │ │ │ │ └── Selector.svelte │ │ │ │ ├── ModelSelector.svelte │ │ │ │ ├── Settings │ │ │ │ │ ├── About.svelte │ │ │ │ │ ├── Account │ │ │ │ │ │ └── UpdatePassword.svelte │ │ │ │ │ ├── Account.svelte │ │ │ │ │ ├── Advanced │ │ │ │ │ │ └── AdvancedParams.svelte │ │ │ │ │ ├── Audio.svelte │ │ │ │ │ ├── Chats.svelte │ │ │ │ │ ├── General.svelte │ │ │ │ │ ├── Interface.svelte │ │ │ │ │ ├── Models.svelte │ │ │ │ │ ├── Personalization │ │ │ │ │ │ ├── AddMemoryModal.svelte │ │ │ │ │ │ ├── EditMemoryModal.svelte │ │ │ │ │ │ └── ManageModal.svelte │ │ │ │ │ ├── Personalization.svelte │ │ │ │ │ └── Valves.svelte │ │ │ │ ├── SettingsModal.svelte │ │ │ │ ├── ShareChatModal.svelte │ │ │ │ ├── ShortcutsModal.svelte │ │ │ │ ├── TagChatModal.svelte │ │ │ │ └── Tags.svelte │ │ │ ├── common │ │ │ │ ├── Banner.svelte │ │ │ │ ├── Checkbox.svelte │ │ │ │ ├── CodeEditor.svelte │ │ │ │ ├── Collapsible.svelte │ │ │ │ ├── ConfirmDialog.svelte │ │ │ │ ├── Dropdown.svelte │ │ │ │ ├── FileItem.svelte │ │ │ │ ├── Image.svelte │ │ │ │ ├── ImagePreview.svelte │ │ │ │ ├── Modal.svelte │ │ │ │ ├── Overlay.svelte │ │ │ │ ├── Pagination.svelte │ │ │ │ ├── Selector.svelte │ │ │ │ ├── SensitiveInput.svelte │ │ │ │ ├── Spinner.svelte │ │ │ │ ├── Switch.svelte │ │ │ │ ├── Tags │ │ │ │ │ ├── TagInput.svelte │ │ │ │ │ └── TagList.svelte │ │ │ │ ├── Tags.svelte │ │ │ │ ├── Tooltip.svelte │ │ │ │ └── Valves.svelte │ │ │ ├── documents │ │ │ │ ├── AddDocModal.svelte │ │ │ │ ├── EditDocModal.svelte │ │ │ │ ├── Settings │ │ │ │ │ ├── ChunkParams.svelte │ │ │ │ │ ├── QueryParams.svelte │ │ │ │ │ └── WebParams.svelte │ │ │ │ └── SettingsModal.svelte │ │ │ ├── icons │ │ │ │ ├── AdjustmentsHorizontal.svelte │ │ │ │ ├── ArchiveBox.svelte │ │ │ │ ├── ArrowDownTray.svelte │ │ │ │ ├── Bolt.svelte │ │ │ │ ├── Bookmark.svelte │ │ │ │ ├── BookmarkSlash.svelte │ │ │ │ ├── ChatBubble.svelte │ │ │ │ ├── ChatBubbles.svelte │ │ │ │ ├── ChatMenu.svelte │ │ │ │ ├── Check.svelte │ │ │ │ ├── ChevronDown.svelte │ │ │ │ ├── ChevronLeft.svelte │ │ │ │ ├── ChevronRight.svelte │ │ │ │ ├── ChevronUp.svelte │ │ │ │ ├── ChevronUpDown.svelte │ │ │ │ ├── DocumentArrowUpSolid.svelte │ │ │ │ ├── DocumentDuplicate.svelte │ │ │ │ ├── EllipsisHorizontal.svelte │ │ │ │ ├── EllipsisVertical.svelte │ │ │ │ ├── GarbageBin.svelte │ │ │ │ ├── GlobeAlt.svelte │ │ │ │ ├── GlobeAltSolid.svelte │ │ │ │ ├── Headphone.svelte │ │ │ │ ├── Heart.svelte │ │ │ │ ├── Keyboard.svelte │ │ │ │ ├── Lifebuoy.svelte │ │ │ │ ├── Link.svelte │ │ │ │ ├── MagnifyingGlass.svelte │ │ │ │ ├── MenuLines.svelte │ │ │ │ ├── Pencil.svelte │ │ │ │ ├── Plus.svelte │ │ │ │ ├── QuestionMarkCircle.svelte │ │ │ │ ├── Search.svelte │ │ │ │ ├── Share.svelte │ │ │ │ ├── Sparkles.svelte │ │ │ │ ├── Star.svelte │ │ │ │ ├── User.svelte │ │ │ │ ├── WrenchSolid.svelte │ │ │ │ └── XMark.svelte │ │ │ ├── layout │ │ │ │ ├── Help │ │ │ │ │ └── HelpMenu.svelte │ │ │ │ ├── Help.svelte │ │ │ │ ├── Navbar │ │ │ │ │ └── Menu.svelte │ │ │ │ ├── Navbar.svelte │ │ │ │ ├── Overlay │ │ │ │ │ └── AccountPending.svelte │ │ │ │ ├── Sidebar │ │ │ │ │ ├── ArchivedChatsModal.svelte │ │ │ │ │ ├── ChatItem.svelte │ │ │ │ │ ├── ChatMenu.svelte │ │ │ │ │ └── UserMenu.svelte │ │ │ │ └── Sidebar.svelte │ │ │ ├── playground │ │ │ │ ├── ChatCompletion.svelte │ │ │ │ ├── Playground.svelte │ │ │ │ └── TextCompletion.svelte │ │ │ └── workspace │ │ │ ├── common │ │ │ │ ├── ManifestModal.svelte │ │ │ │ └── ValvesModal.svelte │ │ │ ├── Documents.svelte │ │ │ ├── Functions │ │ │ │ ├── FunctionEditor.svelte │ │ │ │ └── FunctionMenu.svelte │ │ │ ├── Functions.svelte │ │ │ ├── Models │ │ │ │ ├── FiltersSelector.svelte │ │ │ │ ├── Knowledge │ │ │ │ │ └── Selector.svelte │ │ │ │ ├── Knowledge.svelte │ │ │ │ ├── ModelMenu.svelte │ │ │ │ └── ToolsSelector.svelte │ │ │ ├── Models.svelte │ │ │ ├── Prompts │ │ │ │ └── PromptMenu.svelte │ │ │ ├── Prompts.svelte │ │ │ ├── Tools │ │ │ │ ├── ToolkitEditor.svelte │ │ │ │ └── ToolMenu.svelte │ │ │ └── Tools.svelte │ │ ├── constants.ts │ │ ├── i18n │ │ │ ├── index.ts │ │ │ └── locales │ │ │ ├── ar-BH │ │ │ │ └── translation.json │ │ │ ├── bg-BG │ │ │ │ └── translation.json │ │ │ ├── bn-BD │ │ │ │ └── translation.json │ │ │ ├── ca-ES │ │ │ │ └── translation.json │ │ │ ├── ceb-PH │ │ │ │ └── translation.json │ │ │ ├── de-DE │ │ │ │ └── translation.json │ │ │ ├── dg-DG │ │ │ │ └── translation.json │ │ │ ├── en-GB │ │ │ │ └── translation.json │ │ │ ├── en-US │ │ │ │ └── translation.json │ │ │ ├── es-ES │ │ │ │ └── translation.json │ │ │ ├── fa-IR │ │ │ │ └── translation.json │ │ │ ├── fi-FI │ │ │ │ └── translation.json │ │ │ ├── fr-CA │ │ │ │ └── translation.json │ │ │ ├── fr-FR │ │ │ │ └── translation.json │ │ │ ├── he-IL │ │ │ │ └── translation.json │ │ │ ├── hi-IN │ │ │ │ └── translation.json │ │ │ ├── hr-HR │ │ │ │ └── translation.json │ │ │ ├── id-ID │ │ │ │ └── translation.json │ │ │ ├── it-IT │ │ │ │ └── translation.json │ │ │ ├── ja-JP │ │ │ │ └── translation.json │ │ │ ├── ka-GE │ │ │ │ └── translation.json │ │ │ ├── ko-KR │ │ │ │ └── translation.json │ │ │ ├── languages.json │ │ │ ├── lt-LT │ │ │ │ └── translation.json │ │ │ ├── nb-NO │ │ │ │ └── translation.json │ │ │ ├── nl-NL │ │ │ │ └── translation.json │ │ │ ├── pa-IN │ │ │ │ └── translation.json │ │ │ ├── pl-PL │ │ │ │ └── translation.json │ │ │ ├── pt-BR │ │ │ │ └── translation.json │ │ │ ├── pt-PT │ │ │ │ └── translation.json │ │ │ ├── ru-RU │ │ │ │ └── translation.json │ │ │ ├── sr-RS │ │ │ │ └── translation.json │ │ │ ├── sv-SE │ │ │ │ └── translation.json │ │ │ ├── tk-TM │ │ │ │ └── transaltion.json │ │ │ ├── tk-TW │ │ │ │ └── translation.json │ │ │ ├── tr-TR │ │ │ │ └── translation.json │ │ │ ├── uk-UA │ │ │ │ └── translation.json │ │ │ ├── vi-VN │ │ │ │ └── translation.json │ │ │ ├── zh-CN │ │ │ │ └── translation.json │ │ │ └── zh-TW │ │ │ └── translation.json │ │ ├── index.ts │ │ ├── stores │ │ │ └── index.ts │ │ ├── types │ │ │ └── index.ts │ │ ├── utils │ │ │ ├── characters │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ ├── rag │ │ │ │ └── index.ts │ │ │ ├── transitions │ │ │ │ └── index.ts │ │ │ └── _template_old.ts │ │ └── workers │ │ └── pyodide.worker.ts │ ├── routes │ │ ├── (app) │ │ │ ├── +layout.svelte │ │ │ ├── +page.svelte │ │ │ ├── admin │ │ │ │ ├── +layout.svelte │ │ │ │ ├── +page.svelte │ │ │ │ └── settings │ │ │ │ └── +page.svelte │ │ │ ├── c │ │ │ │ └── [id] │ │ │ │ └── +page.svelte │ │ │ ├── playground │ │ │ │ ├── +layout.svelte │ │ │ │ └── +page.svelte │ │ │ └── workspace │ │ │ ├── +layout.svelte │ │ │ ├── +page.svelte │ │ │ ├── documents │ │ │ │ └── +page.svelte │ │ │ ├── functions │ │ │ │ ├── +page.svelte │ │ │ │ ├── create │ │ │ │ │ └── +page.svelte │ │ │ │ └── edit │ │ │ │ └── +page.svelte │ │ │ ├── models │ │ │ │ ├── +page.svelte │ │ │ │ ├── create │ │ │ │ │ └── +page.svelte │ │ │ │ └── edit │ │ │ │ └── +page.svelte │ │ │ ├── prompts │ │ │ │ ├── +page.svelte │ │ │ │ ├── create │ │ │ │ │ └── +page.svelte │ │ │ │ └── edit │ │ │ │ └── +page.svelte │ │ │ └── tools │ │ │ ├── +page.svelte │ │ │ ├── create │ │ │ │ └── +page.svelte │ │ │ └── edit │ │ │ └── +page.svelte │ │ ├── +error.svelte │ │ ├── +layout.js │ │ ├── +layout.svelte │ │ ├── auth │ │ │ └── +page.svelte │ │ ├── error │ │ │ └── +page.svelte │ │ └── s │ │ └── [id] │ │ └── +page.svelte │ └── tailwind.css ├── static │ ├── apple-icon-180.png │ ├── assets │ │ └── fonts │ │ ├── Archivo-Variable.ttf │ │ ├── Inter-Variable.ttf │ │ └── Mona-Sans.woff2 │ ├── audio │ │ └── greeting.mp3 │ ├── doge.png │ ├── favicon.ico │ ├── favicon.png │ ├── manifest.json │ ├── maskable-icon-512x512.png │ ├── opensearch.xml │ ├── pwa-192x192.png │ ├── pwa-512x512.png │ ├── pwa-64x64.png │ ├── pyodide │ │ └── pyodide-lock.json │ ├── service-worker.js │ ├── static │ │ ├── favicon.png │ │ ├── splash-dark.png │ │ └── splash.png │ ├── themes │ │ ├── rosepine-dawn.css │ │ └── rosepine.css │ └── user.png ├── svelte.config.js ├── tailwind.config.js ├── test │ └── test_files │ └── image_gen │ └── sd-empty.pt ├── TROUBLESHOOTING.md ├── tsconfig.json ├── update_ollama_models.sh └── vite.config.ts ``` `\\?\D:\Coding\ai\.env.example`: ```````example 1 | # Ollama URL for the backend to connect 2 | # The path '/ollama' will be redirected to the specified backend URL 3 | OLLAMA_BASE_URL='http://localhost:11434' 4 | 5 | OPENAI_API_BASE_URL='' 6 | OPENAI_API_KEY='' 7 | 8 | # AUTOMATIC1111_BASE_URL="http://localhost:7860" 9 | 10 | # DO NOT TRACK 11 | SCARF_NO_ANALYTICS=true 12 | DO_NOT_TRACK=true 13 | ANONYMIZED_TELEMETRY=false ``````` `\\?\D:\Coding\ai\backend\alembic.ini`: ```````ini 1 | # A generic, single database configuration. 2 | 3 | [alembic] 4 | # path to migration scripts 5 | script_location = migrations 6 | 7 | # template used to generate migration file names; The default value is %%(rev)s_%%(slug)s 8 | # Uncomment the line below if you want the files to be prepended with date and time 9 | # file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s 10 | 11 | # sys.path path, will be prepended to sys.path if present. 12 | # defaults to the current working directory. 13 | prepend_sys_path = . 14 | 15 | # timezone to use when rendering the date within the migration file 16 | # as well as the filename. 17 | # If specified, requires the python>=3.9 or backports.zoneinfo library. 18 | # Any required deps can installed by adding `alembic[tz]` to the pip requirements 19 | # string value is passed to ZoneInfo() 20 | # leave blank for localtime 21 | # timezone = 22 | 23 | # max length of characters to apply to the 24 | # "slug" field 25 | # truncate_slug_length = 40 26 | 27 | # set to 'true' to run the environment during 28 | # the 'revision' command, regardless of autogenerate 29 | # revision_environment = false 30 | 31 | # set to 'true' to allow .pyc and .pyo files without 32 | # a source .py file to be detected as revisions in the 33 | # versions/ directory 34 | # sourceless = false 35 | 36 | # version location specification; This defaults 37 | # to migrations/versions. When using multiple version 38 | # directories, initial revisions must be specified with --version-path. 39 | # The path separator used here should be the separator specified by "version_path_separator" below. 40 | # version_locations = %(here)s/bar:%(here)s/bat:migrations/versions 41 | 42 | # version path separator; As mentioned above, this is the character used to split 43 | # version_locations. The default within new alembic.ini files is "os", which uses os.pathsep. 44 | # If this key is omitted entirely, it falls back to the legacy behavior of splitting on spaces and/or commas. 45 | # Valid values for version_path_separator are: 46 | # 47 | # version_path_separator = : 48 | # version_path_separator = ; 49 | # version_path_separator = space 50 | version_path_separator = os # Use os.pathsep. Default configuration used for new projects. 51 | 52 | # set to 'true' to search source files recursively 53 | # in each "version_locations" directory 54 | # new in Alembic version 1.10 55 | # recursive_version_locations = false 56 | 57 | # the output encoding used when revision files 58 | # are written from script.py.mako 59 | # output_encoding = utf-8 60 | 61 | # sqlalchemy.url = REPLACE_WITH_DATABASE_URL 62 | 63 | 64 | [post_write_hooks] 65 | # post_write_hooks defines scripts or Python functions that are run 66 | # on newly generated revision scripts. See the documentation for further 67 | # detail and examples 68 | 69 | # format using "black" - use the console_scripts runner, against the "black" entrypoint 70 | # hooks = black 71 | # black.type = console_scripts 72 | # black.entrypoint = black 73 | # black.options = -l 79 REVISION_SCRIPT_FILENAME 74 | 75 | # lint with attempts to fix using "ruff" - use the exec runner, execute a binary 76 | # hooks = ruff 77 | # ruff.type = exec 78 | # ruff.executable = %(here)s/.venv/bin/ruff 79 | # ruff.options = --fix REVISION_SCRIPT_FILENAME 80 | 81 | # Logging configuration 82 | [loggers] 83 | keys = root,sqlalchemy,alembic 84 | 85 | [handlers] 86 | keys = console 87 | 88 | [formatters] 89 | keys = generic 90 | 91 | [logger_root] 92 | level = WARN 93 | handlers = console 94 | qualname = 95 | 96 | [logger_sqlalchemy] 97 | level = WARN 98 | handlers = 99 | qualname = sqlalchemy.engine 100 | 101 | [logger_alembic] 102 | level = INFO 103 | handlers = 104 | qualname = alembic 105 | 106 | [handler_console] 107 | class = StreamHandler 108 | args = (sys.stderr,) 109 | level = NOTSET 110 | formatter = generic 111 | 112 | [formatter_generic] 113 | format = %(levelname)-5.5s [%(name)s] %(message)s 114 | datefmt = %H:%M:%S ``````` `\\?\D:\Coding\ai\backend\apps\audio\main.py`: ```````py 1 | import os 2 | import logging 3 | from fastapi import ( 4 | FastAPI, 5 | Request, 6 | Depends, 7 | HTTPException, 8 | status, 9 | UploadFile, 10 | File, 11 | Form, 12 | ) 13 | 14 | from fastapi.responses import StreamingResponse, JSONResponse, FileResponse 15 | 16 | from fastapi.middleware.cors import CORSMiddleware 17 | from pydantic import BaseModel 18 | 19 | import uuid 20 | import requests 21 | import hashlib 22 | from pathlib import Path 23 | import json 24 | 25 | from constants import ERROR_MESSAGES 26 | from utils.utils import ( 27 | decode_token, 28 | get_current_user, 29 | get_verified_user, 30 | get_admin_user, 31 | ) 32 | from utils.misc import calculate_sha256 33 | 34 | from config import ( 35 | SRC_LOG_LEVELS, 36 | CACHE_DIR, 37 | UPLOAD_DIR, 38 | WHISPER_MODEL, 39 | WHISPER_MODEL_DIR, 40 | WHISPER_MODEL_AUTO_UPDATE, 41 | DEVICE_TYPE, 42 | AUDIO_STT_OPENAI_API_BASE_URL, 43 | AUDIO_STT_OPENAI_API_KEY, 44 | AUDIO_TTS_OPENAI_API_BASE_URL, 45 | AUDIO_TTS_OPENAI_API_KEY, 46 | AUDIO_STT_ENGINE, 47 | AUDIO_STT_MODEL, 48 | AUDIO_TTS_ENGINE, 49 | AUDIO_TTS_MODEL, 50 | AUDIO_TTS_VOICE, 51 | AppConfig, 52 | ) 53 | 54 | log = logging.getLogger(__name__) 55 | log.setLevel(SRC_LOG_LEVELS["AUDIO"]) 56 | 57 | app = FastAPI() 58 | app.add_middleware( 59 | CORSMiddleware, 60 | allow_origins=["*"], 61 | allow_credentials=True, 62 | allow_methods=["*"], 63 | allow_headers=["*"], 64 | ) 65 | 66 | app.state.config = AppConfig() 67 | 68 | app.state.config.STT_OPENAI_API_BASE_URL = AUDIO_STT_OPENAI_API_BASE_URL 69 | app.state.config.STT_OPENAI_API_KEY = AUDIO_STT_OPENAI_API_KEY 70 | app.state.config.STT_ENGINE = AUDIO_STT_ENGINE 71 | app.state.config.STT_MODEL = AUDIO_STT_MODEL 72 | 73 | app.state.config.TTS_OPENAI_API_BASE_URL = AUDIO_TTS_OPENAI_API_BASE_URL 74 | app.state.config.TTS_OPENAI_API_KEY = AUDIO_TTS_OPENAI_API_KEY 75 | app.state.config.TTS_ENGINE = AUDIO_TTS_ENGINE 76 | app.state.config.TTS_MODEL = AUDIO_TTS_MODEL 77 | app.state.config.TTS_VOICE = AUDIO_TTS_VOICE 78 | 79 | # setting device type for whisper model 80 | whisper_device_type = DEVICE_TYPE if DEVICE_TYPE and DEVICE_TYPE == "cuda" else "cpu" 81 | log.info(f"whisper_device_type: {whisper_device_type}") 82 | 83 | SPEECH_CACHE_DIR = Path(CACHE_DIR).joinpath("./audio/speech/") 84 | SPEECH_CACHE_DIR.mkdir(parents=True, exist_ok=True) 85 | 86 | 87 | class TTSConfigForm(BaseModel): 88 | OPENAI_API_BASE_URL: str 89 | OPENAI_API_KEY: str 90 | ENGINE: str 91 | MODEL: str 92 | VOICE: str 93 | 94 | 95 | class STTConfigForm(BaseModel): 96 | OPENAI_API_BASE_URL: str 97 | OPENAI_API_KEY: str 98 | ENGINE: str 99 | MODEL: str 100 | 101 | 102 | class AudioConfigUpdateForm(BaseModel): 103 | tts: TTSConfigForm 104 | stt: STTConfigForm 105 | 106 | 107 | from pydub import AudioSegment 108 | from pydub.utils import mediainfo 109 | 110 | 111 | def is_mp4_audio(file_path): 112 | """Check if the given file is an MP4 audio file.""" 113 | if not os.path.isfile(file_path): 114 | print(f"File not found: {file_path}") 115 | return False 116 | 117 | info = mediainfo(file_path) 118 | if ( 119 | info.get("codec_name") == "aac" 120 | and info.get("codec_type") == "audio" 121 | and info.get("codec_tag_string") == "mp4a" 122 | ): 123 | return True 124 | return False 125 | 126 | 127 | def convert_mp4_to_wav(file_path, output_path): 128 | """Convert MP4 audio file to WAV format.""" 129 | audio = AudioSegment.from_file(file_path, format="mp4") 130 | audio.export(output_path, format="wav") 131 | print(f"Converted {file_path} to {output_path}") 132 | 133 | 134 | @app.get("/config") 135 | async def get_audio_config(user=Depends(get_admin_user)): 136 | return { 137 | "tts": { 138 | "OPENAI_API_BASE_URL": app.state.config.TTS_OPENAI_API_BASE_URL, 139 | "OPENAI_API_KEY": app.state.config.TTS_OPENAI_API_KEY, 140 | "ENGINE": app.state.config.TTS_ENGINE, 141 | "MODEL": app.state.config.TTS_MODEL, 142 | "VOICE": app.state.config.TTS_VOICE, 143 | }, 144 | "stt": { 145 | "OPENAI_API_BASE_URL": app.state.config.STT_OPENAI_API_BASE_URL, 146 | "OPENAI_API_KEY": app.state.config.STT_OPENAI_API_KEY, 147 | "ENGINE": app.state.config.STT_ENGINE, 148 | "MODEL": app.state.config.STT_MODEL, 149 | }, 150 | } 151 | 152 | 153 | @app.post("/config/update") 154 | async def update_audio_config( 155 | form_data: AudioConfigUpdateForm, user=Depends(get_admin_user) 156 | ): 157 | app.state.config.TTS_OPENAI_API_BASE_URL = form_data.tts.OPENAI_API_BASE_URL 158 | app.state.config.TTS_OPENAI_API_KEY = form_data.tts.OPENAI_API_KEY 159 | app.state.config.TTS_ENGINE = form_data.tts.ENGINE 160 | app.state.config.TTS_MODEL = form_data.tts.MODEL 161 | app.state.config.TTS_VOICE = form_data.tts.VOICE 162 | 163 | app.state.config.STT_OPENAI_API_BASE_URL = form_data.stt.OPENAI_API_BASE_URL 164 | app.state.config.STT_OPENAI_API_KEY = form_data.stt.OPENAI_API_KEY 165 | app.state.config.STT_ENGINE = form_data.stt.ENGINE 166 | app.state.config.STT_MODEL = form_data.stt.MODEL 167 | 168 | return { 169 | "tts": { 170 | "OPENAI_API_BASE_URL": app.state.config.TTS_OPENAI_API_BASE_URL, 171 | "OPENAI_API_KEY": app.state.config.TTS_OPENAI_API_KEY, 172 | "ENGINE": app.state.config.TTS_ENGINE, 173 | "MODEL": app.state.config.TTS_MODEL, 174 | "VOICE": app.state.config.TTS_VOICE, 175 | }, 176 | "stt": { 177 | "OPENAI_API_BASE_URL": app.state.config.STT_OPENAI_API_BASE_URL, 178 | "OPENAI_API_KEY": app.state.config.STT_OPENAI_API_KEY, 179 | "ENGINE": app.state.config.STT_ENGINE, 180 | "MODEL": app.state.config.STT_MODEL, 181 | }, 182 | } 183 | 184 | 185 | @app.post("/speech") 186 | async def speech(request: Request, user=Depends(get_verified_user)): 187 | body = await request.body() 188 | name = hashlib.sha256(body).hexdigest() 189 | 190 | file_path = SPEECH_CACHE_DIR.joinpath(f"{name}.mp3") 191 | file_body_path = SPEECH_CACHE_DIR.joinpath(f"{name}.json") 192 | 193 | # Check if the file already exists in the cache 194 | if file_path.is_file(): 195 | return FileResponse(file_path) 196 | 197 | headers = {} 198 | headers["Authorization"] = f"Bearer {app.state.config.TTS_OPENAI_API_KEY}" 199 | headers["Content-Type"] = "application/json" 200 | 201 | try: 202 | body = body.decode("utf-8") 203 | body = json.loads(body) 204 | body["model"] = app.state.config.TTS_MODEL 205 | body = json.dumps(body).encode("utf-8") 206 | except Exception as e: 207 | pass 208 | 209 | r = None 210 | try: 211 | r = requests.post( 212 | url=f"{app.state.config.TTS_OPENAI_API_BASE_URL}/audio/speech", 213 | data=body, 214 | headers=headers, 215 | stream=True, 216 | ) 217 | 218 | r.raise_for_status() 219 | 220 | # Save the streaming content to a file 221 | with open(file_path, "wb") as f: 222 | for chunk in r.iter_content(chunk_size=8192): 223 | f.write(chunk) 224 | 225 | with open(file_body_path, "w") as f: 226 | json.dump(json.loads(body.decode("utf-8")), f) 227 | 228 | # Return the saved file 229 | return FileResponse(file_path) 230 | 231 | except Exception as e: 232 | log.exception(e) 233 | error_detail = "Open WebUI: Server Connection Error" 234 | if r is not None: 235 | try: 236 | res = r.json() 237 | if "error" in res: 238 | error_detail = f"External: {res['error']['message']}" 239 | except: 240 | error_detail = f"External: {e}" 241 | 242 | raise HTTPException( 243 | status_code=r.status_code if r != None else 500, 244 | detail=error_detail, 245 | ) 246 | 247 | 248 | @app.post("/transcriptions") 249 | def transcribe( 250 | file: UploadFile = File(...), 251 | user=Depends(get_current_user), 252 | ): 253 | log.info(f"file.content_type: {file.content_type}") 254 | 255 | if file.content_type not in ["audio/mpeg", "audio/wav"]: 256 | raise HTTPException( 257 | status_code=status.HTTP_400_BAD_REQUEST, 258 | detail=ERROR_MESSAGES.FILE_NOT_SUPPORTED, 259 | ) 260 | 261 | try: 262 | ext = file.filename.split(".")[-1] 263 | 264 | id = uuid.uuid4() 265 | filename = f"{id}.{ext}" 266 | 267 | file_dir = f"{CACHE_DIR}/audio/transcriptions" 268 | os.makedirs(file_dir, exist_ok=True) 269 | file_path = f"{file_dir}/{filename}" 270 | 271 | print(filename) 272 | 273 | contents = file.file.read() 274 | with open(file_path, "wb") as f: 275 | f.write(contents) 276 | f.close() 277 | 278 | if app.state.config.STT_ENGINE == "": 279 | from faster_whisper import WhisperModel 280 | 281 | whisper_kwargs = { 282 | "model_size_or_path": WHISPER_MODEL, 283 | "device": whisper_device_type, 284 | "compute_type": "int8", 285 | "download_root": WHISPER_MODEL_DIR, 286 | "local_files_only": not WHISPER_MODEL_AUTO_UPDATE, 287 | } 288 | 289 | log.debug(f"whisper_kwargs: {whisper_kwargs}") 290 | 291 | try: 292 | model = WhisperModel(**whisper_kwargs) 293 | except: 294 | log.warning( 295 | "WhisperModel initialization failed, attempting download with local_files_only=False" 296 | ) 297 | whisper_kwargs["local_files_only"] = False 298 | model = WhisperModel(**whisper_kwargs) 299 | 300 | segments, info = model.transcribe(file_path, beam_size=5) 301 | log.info( 302 | "Detected language '%s' with probability %f" 303 | % (info.language, info.language_probability) 304 | ) 305 | 306 | transcript = "".join([segment.text for segment in list(segments)]) 307 | 308 | data = {"text": transcript.strip()} 309 | 310 | # save the transcript to a json file 311 | transcript_file = f"{file_dir}/{id}.json" 312 | with open(transcript_file, "w") as f: 313 | json.dump(data, f) 314 | 315 | print(data) 316 | 317 | return data 318 | 319 | elif app.state.config.STT_ENGINE == "openai": 320 | if is_mp4_audio(file_path): 321 | print("is_mp4_audio") 322 | os.rename(file_path, file_path.replace(".wav", ".mp4")) 323 | # Convert MP4 audio file to WAV format 324 | convert_mp4_to_wav(file_path.replace(".wav", ".mp4"), file_path) 325 | 326 | headers = {"Authorization": f"Bearer {app.state.config.STT_OPENAI_API_KEY}"} 327 | 328 | files = {"file": (filename, open(file_path, "rb"))} 329 | data = {"model": app.state.config.STT_MODEL} 330 | 331 | print(files, data) 332 | 333 | r = None 334 | try: 335 | r = requests.post( 336 | url=f"{app.state.config.STT_OPENAI_API_BASE_URL}/audio/transcriptions", 337 | headers=headers, 338 | files=files, 339 | data=data, 340 | ) 341 | 342 | r.raise_for_status() 343 | 344 | data = r.json() 345 | 346 | # save the transcript to a json file 347 | transcript_file = f"{file_dir}/{id}.json" 348 | with open(transcript_file, "w") as f: 349 | json.dump(data, f) 350 | 351 | print(data) 352 | return data 353 | except Exception as e: 354 | log.exception(e) 355 | error_detail = "Open WebUI: Server Connection Error" 356 | if r is not None: 357 | try: 358 | res = r.json() 359 | if "error" in res: 360 | error_detail = f"External: {res['error']['message']}" 361 | except: 362 | error_detail = f"External: {e}" 363 | 364 | raise HTTPException( 365 | status_code=r.status_code if r != None else 500, 366 | detail=error_detail, 367 | ) 368 | 369 | except Exception as e: 370 | log.exception(e) 371 | 372 | raise HTTPException( 373 | status_code=status.HTTP_400_BAD_REQUEST, 374 | detail=ERROR_MESSAGES.DEFAULT(e), 375 | ) ``````` `\\?\D:\Coding\ai\backend\apps\images\main.py`: ```````py 1 | import re 2 | import requests 3 | import base64 4 | from fastapi import ( 5 | FastAPI, 6 | Request, 7 | Depends, 8 | HTTPException, 9 | status, 10 | UploadFile, 11 | File, 12 | Form, 13 | ) 14 | from fastapi.middleware.cors import CORSMiddleware 15 | 16 | from constants import ERROR_MESSAGES 17 | from utils.utils import ( 18 | get_verified_user, 19 | get_admin_user, 20 | ) 21 | 22 | from apps.images.utils.comfyui import ImageGenerationPayload, comfyui_generate_image 23 | from utils.misc import calculate_sha256 24 | from typing import Optional 25 | from pydantic import BaseModel 26 | from pathlib import Path 27 | import mimetypes 28 | import uuid 29 | import base64 30 | import json 31 | import logging 32 | 33 | from config import ( 34 | SRC_LOG_LEVELS, 35 | CACHE_DIR, 36 | IMAGE_GENERATION_ENGINE, 37 | ENABLE_IMAGE_GENERATION, 38 | AUTOMATIC1111_BASE_URL, 39 | AUTOMATIC1111_API_AUTH, 40 | COMFYUI_BASE_URL, 41 | COMFYUI_CFG_SCALE, 42 | COMFYUI_SAMPLER, 43 | COMFYUI_SCHEDULER, 44 | COMFYUI_SD3, 45 | IMAGES_OPENAI_API_BASE_URL, 46 | IMAGES_OPENAI_API_KEY, 47 | IMAGE_GENERATION_MODEL, 48 | IMAGE_SIZE, 49 | IMAGE_STEPS, 50 | AppConfig, 51 | ) 52 | 53 | log = logging.getLogger(__name__) 54 | log.setLevel(SRC_LOG_LEVELS["IMAGES"]) 55 | 56 | IMAGE_CACHE_DIR = Path(CACHE_DIR).joinpath("./image/generations/") 57 | IMAGE_CACHE_DIR.mkdir(parents=True, exist_ok=True) 58 | 59 | app = FastAPI() 60 | app.add_middleware( 61 | CORSMiddleware, 62 | allow_origins=["*"], 63 | allow_credentials=True, 64 | allow_methods=["*"], 65 | allow_headers=["*"], 66 | ) 67 | 68 | app.state.config = AppConfig() 69 | 70 | app.state.config.ENGINE = IMAGE_GENERATION_ENGINE 71 | app.state.config.ENABLED = ENABLE_IMAGE_GENERATION 72 | 73 | app.state.config.OPENAI_API_BASE_URL = IMAGES_OPENAI_API_BASE_URL 74 | app.state.config.OPENAI_API_KEY = IMAGES_OPENAI_API_KEY 75 | 76 | app.state.config.MODEL = IMAGE_GENERATION_MODEL 77 | 78 | app.state.config.AUTOMATIC1111_BASE_URL = AUTOMATIC1111_BASE_URL 79 | app.state.config.AUTOMATIC1111_API_AUTH = AUTOMATIC1111_API_AUTH 80 | app.state.config.COMFYUI_BASE_URL = COMFYUI_BASE_URL 81 | 82 | app.state.config.IMAGE_SIZE = IMAGE_SIZE 83 | app.state.config.IMAGE_STEPS = IMAGE_STEPS 84 | app.state.config.COMFYUI_CFG_SCALE = COMFYUI_CFG_SCALE 85 | app.state.config.COMFYUI_SAMPLER = COMFYUI_SAMPLER 86 | app.state.config.COMFYUI_SCHEDULER = COMFYUI_SCHEDULER 87 | app.state.config.COMFYUI_SD3 = COMFYUI_SD3 88 | 89 | 90 | def get_automatic1111_api_auth(): 91 | if app.state.config.AUTOMATIC1111_API_AUTH == None: 92 | return "" 93 | else: 94 | auth1111_byte_string = app.state.config.AUTOMATIC1111_API_AUTH.encode("utf-8") 95 | auth1111_base64_encoded_bytes = base64.b64encode(auth1111_byte_string) 96 | auth1111_base64_encoded_string = auth1111_base64_encoded_bytes.decode("utf-8") 97 | return f"Basic {auth1111_base64_encoded_string}" 98 | 99 | 100 | @app.get("/config") 101 | async def get_config(request: Request, user=Depends(get_admin_user)): 102 | return { 103 | "engine": app.state.config.ENGINE, 104 | "enabled": app.state.config.ENABLED, 105 | } 106 | 107 | 108 | class ConfigUpdateForm(BaseModel): 109 | engine: str 110 | enabled: bool 111 | 112 | 113 | @app.post("/config/update") 114 | async def update_config(form_data: ConfigUpdateForm, user=Depends(get_admin_user)): 115 | app.state.config.ENGINE = form_data.engine 116 | app.state.config.ENABLED = form_data.enabled 117 | return { 118 | "engine": app.state.config.ENGINE, 119 | "enabled": app.state.config.ENABLED, 120 | } 121 | 122 | 123 | class EngineUrlUpdateForm(BaseModel): 124 | AUTOMATIC1111_BASE_URL: Optional[str] = None 125 | AUTOMATIC1111_API_AUTH: Optional[str] = None 126 | COMFYUI_BASE_URL: Optional[str] = None 127 | 128 | 129 | @app.get("/url") 130 | async def get_engine_url(user=Depends(get_admin_user)): 131 | return { 132 | "AUTOMATIC1111_BASE_URL": app.state.config.AUTOMATIC1111_BASE_URL, 133 | "AUTOMATIC1111_API_AUTH": app.state.config.AUTOMATIC1111_API_AUTH, 134 | "COMFYUI_BASE_URL": app.state.config.COMFYUI_BASE_URL, 135 | } 136 | 137 | 138 | @app.post("/url/update") 139 | async def update_engine_url( 140 | form_data: EngineUrlUpdateForm, user=Depends(get_admin_user) 141 | ): 142 | if form_data.AUTOMATIC1111_BASE_URL == None: 143 | app.state.config.AUTOMATIC1111_BASE_URL = AUTOMATIC1111_BASE_URL 144 | else: 145 | url = form_data.AUTOMATIC1111_BASE_URL.strip("/") 146 | try: 147 | r = requests.head(url) 148 | app.state.config.AUTOMATIC1111_BASE_URL = url 149 | except Exception as e: 150 | raise HTTPException(status_code=400, detail=ERROR_MESSAGES.DEFAULT(e)) 151 | 152 | if form_data.COMFYUI_BASE_URL == None: 153 | app.state.config.COMFYUI_BASE_URL = COMFYUI_BASE_URL 154 | else: 155 | url = form_data.COMFYUI_BASE_URL.strip("/") 156 | 157 | try: 158 | r = requests.head(url) 159 | app.state.config.COMFYUI_BASE_URL = url 160 | except Exception as e: 161 | raise HTTPException(status_code=400, detail=ERROR_MESSAGES.DEFAULT(e)) 162 | 163 | if form_data.AUTOMATIC1111_API_AUTH == None: 164 | app.state.config.AUTOMATIC1111_API_AUTH = AUTOMATIC1111_API_AUTH 165 | else: 166 | app.state.config.AUTOMATIC1111_API_AUTH = form_data.AUTOMATIC1111_API_AUTH 167 | 168 | return { 169 | "AUTOMATIC1111_BASE_URL": app.state.config.AUTOMATIC1111_BASE_URL, 170 | "AUTOMATIC1111_API_AUTH": app.state.config.AUTOMATIC1111_API_AUTH, 171 | "COMFYUI_BASE_URL": app.state.config.COMFYUI_BASE_URL, 172 | "status": True, 173 | } 174 | 175 | 176 | class OpenAIConfigUpdateForm(BaseModel): 177 | url: str 178 | key: str 179 | 180 | 181 | @app.get("/openai/config") 182 | async def get_openai_config(user=Depends(get_admin_user)): 183 | return { 184 | "OPENAI_API_BASE_URL": app.state.config.OPENAI_API_BASE_URL, 185 | "OPENAI_API_KEY": app.state.config.OPENAI_API_KEY, 186 | } 187 | 188 | 189 | @app.post("/openai/config/update") 190 | async def update_openai_config( 191 | form_data: OpenAIConfigUpdateForm, user=Depends(get_admin_user) 192 | ): 193 | if form_data.key == "": 194 | raise HTTPException(status_code=400, detail=ERROR_MESSAGES.API_KEY_NOT_FOUND) 195 | 196 | app.state.config.OPENAI_API_BASE_URL = form_data.url 197 | app.state.config.OPENAI_API_KEY = form_data.key 198 | 199 | return { 200 | "status": True, 201 | "OPENAI_API_BASE_URL": app.state.config.OPENAI_API_BASE_URL, 202 | "OPENAI_API_KEY": app.state.config.OPENAI_API_KEY, 203 | } 204 | 205 | 206 | class ImageSizeUpdateForm(BaseModel): 207 | size: str 208 | 209 | 210 | @app.get("/size") 211 | async def get_image_size(user=Depends(get_admin_user)): 212 | return {"IMAGE_SIZE": app.state.config.IMAGE_SIZE} 213 | 214 | 215 | @app.post("/size/update") 216 | async def update_image_size( 217 | form_data: ImageSizeUpdateForm, user=Depends(get_admin_user) 218 | ): 219 | pattern = r"^\d+x\d+$" # Regular expression pattern 220 | if re.match(pattern, form_data.size): 221 | app.state.config.IMAGE_SIZE = form_data.size 222 | return { 223 | "IMAGE_SIZE": app.state.config.IMAGE_SIZE, 224 | "status": True, 225 | } 226 | else: 227 | raise HTTPException( 228 | status_code=400, 229 | detail=ERROR_MESSAGES.INCORRECT_FORMAT(" (e.g., 512x512)."), 230 | ) 231 | 232 | 233 | class ImageStepsUpdateForm(BaseModel): 234 | steps: int 235 | 236 | 237 | @app.get("/steps") 238 | async def get_image_size(user=Depends(get_admin_user)): 239 | return {"IMAGE_STEPS": app.state.config.IMAGE_STEPS} 240 | 241 | 242 | @app.post("/steps/update") 243 | async def update_image_size( 244 | form_data: ImageStepsUpdateForm, user=Depends(get_admin_user) 245 | ): 246 | if form_data.steps >= 0: 247 | app.state.config.IMAGE_STEPS = form_data.steps 248 | return { 249 | "IMAGE_STEPS": app.state.config.IMAGE_STEPS, 250 | "status": True, 251 | } 252 | else: 253 | raise HTTPException( 254 | status_code=400, 255 | detail=ERROR_MESSAGES.INCORRECT_FORMAT(" (e.g., 50)."), 256 | ) 257 | 258 | 259 | @app.get("/models") 260 | def get_models(user=Depends(get_verified_user)): 261 | try: 262 | if app.state.config.ENGINE == "openai": 263 | return [ 264 | {"id": "dall-e-2", "name": "DALL·E 2"}, 265 | {"id": "dall-e-3", "name": "DALL·E 3"}, 266 | ] 267 | elif app.state.config.ENGINE == "comfyui": 268 | 269 | r = requests.get(url=f"{app.state.config.COMFYUI_BASE_URL}/object_info") 270 | info = r.json() 271 | 272 | return list( 273 | map( 274 | lambda model: {"id": model, "name": model}, 275 | info["CheckpointLoaderSimple"]["input"]["required"]["ckpt_name"][0], 276 | ) 277 | ) 278 | 279 | else: 280 | r = requests.get( 281 | url=f"{app.state.config.AUTOMATIC1111_BASE_URL}/sdapi/v1/sd-models", 282 | headers={"authorization": get_automatic1111_api_auth()}, 283 | ) 284 | models = r.json() 285 | return list( 286 | map( 287 | lambda model: {"id": model["title"], "name": model["model_name"]}, 288 | models, 289 | ) 290 | ) 291 | except Exception as e: 292 | app.state.config.ENABLED = False 293 | raise HTTPException(status_code=400, detail=ERROR_MESSAGES.DEFAULT(e)) 294 | 295 | 296 | @app.get("/models/default") 297 | async def get_default_model(user=Depends(get_admin_user)): 298 | try: 299 | if app.state.config.ENGINE == "openai": 300 | return { 301 | "model": ( 302 | app.state.config.MODEL if app.state.config.MODEL else "dall-e-2" 303 | ) 304 | } 305 | elif app.state.config.ENGINE == "comfyui": 306 | return {"model": (app.state.config.MODEL if app.state.config.MODEL else "")} 307 | else: 308 | r = requests.get( 309 | url=f"{app.state.config.AUTOMATIC1111_BASE_URL}/sdapi/v1/options", 310 | headers={"authorization": get_automatic1111_api_auth()}, 311 | ) 312 | options = r.json() 313 | return {"model": options["sd_model_checkpoint"]} 314 | except Exception as e: 315 | app.state.config.ENABLED = False 316 | raise HTTPException(status_code=400, detail=ERROR_MESSAGES.DEFAULT(e)) 317 | 318 | 319 | class UpdateModelForm(BaseModel): 320 | model: str 321 | 322 | 323 | def set_model_handler(model: str): 324 | if app.state.config.ENGINE in ["openai", "comfyui"]: 325 | app.state.config.MODEL = model 326 | return app.state.config.MODEL 327 | else: 328 | api_auth = get_automatic1111_api_auth() 329 | r = requests.get( 330 | url=f"{app.state.config.AUTOMATIC1111_BASE_URL}/sdapi/v1/options", 331 | headers={"authorization": api_auth}, 332 | ) 333 | options = r.json() 334 | 335 | if model != options["sd_model_checkpoint"]: 336 | options["sd_model_checkpoint"] = model 337 | r = requests.post( 338 | url=f"{app.state.config.AUTOMATIC1111_BASE_URL}/sdapi/v1/options", 339 | json=options, 340 | headers={"authorization": api_auth}, 341 | ) 342 | 343 | return options 344 | 345 | 346 | @app.post("/models/default/update") 347 | def update_default_model( 348 | form_data: UpdateModelForm, 349 | user=Depends(get_verified_user), 350 | ): 351 | return set_model_handler(form_data.model) 352 | 353 | 354 | class GenerateImageForm(BaseModel): 355 | model: Optional[str] = None 356 | prompt: str 357 | n: int = 1 358 | size: Optional[str] = None 359 | negative_prompt: Optional[str] = None 360 | 361 | 362 | def save_b64_image(b64_str): 363 | try: 364 | image_id = str(uuid.uuid4()) 365 | 366 | if "," in b64_str: 367 | header, encoded = b64_str.split(",", 1) 368 | mime_type = header.split(";")[0] 369 | 370 | img_data = base64.b64decode(encoded) 371 | image_format = mimetypes.guess_extension(mime_type) 372 | 373 | image_filename = f"{image_id}{image_format}" 374 | file_path = IMAGE_CACHE_DIR / f"{image_filename}" 375 | with open(file_path, "wb") as f: 376 | f.write(img_data) 377 | return image_filename 378 | else: 379 | image_filename = f"{image_id}.png" 380 | file_path = IMAGE_CACHE_DIR.joinpath(image_filename) 381 | 382 | img_data = base64.b64decode(b64_str) 383 | 384 | # Write the image data to a file 385 | with open(file_path, "wb") as f: 386 | f.write(img_data) 387 | return image_filename 388 | 389 | except Exception as e: 390 | log.exception(f"Error saving image: {e}") 391 | return None 392 | 393 | 394 | def save_url_image(url): 395 | image_id = str(uuid.uuid4()) 396 | try: 397 | r = requests.get(url) 398 | r.raise_for_status() 399 | if r.headers["content-type"].split("/")[0] == "image": 400 | 401 | mime_type = r.headers["content-type"] 402 | image_format = mimetypes.guess_extension(mime_type) 403 | 404 | if not image_format: 405 | raise ValueError("Could not determine image type from MIME type") 406 | 407 | image_filename = f"{image_id}{image_format}" 408 | 409 | file_path = IMAGE_CACHE_DIR.joinpath(f"{image_filename}") 410 | with open(file_path, "wb") as image_file: 411 | for chunk in r.iter_content(chunk_size=8192): 412 | image_file.write(chunk) 413 | return image_filename 414 | else: 415 | log.error(f"Url does not point to an image.") 416 | return None 417 | 418 | except Exception as e: 419 | log.exception(f"Error saving image: {e}") 420 | return None 421 | 422 | 423 | @app.post("/generations") 424 | async def image_generations( 425 | form_data: GenerateImageForm, 426 | user=Depends(get_verified_user), 427 | ): 428 | width, height = tuple(map(int, app.state.config.IMAGE_SIZE.split("x"))) 429 | 430 | r = None 431 | try: 432 | if app.state.config.ENGINE == "openai": 433 | 434 | headers = {} 435 | headers["Authorization"] = f"Bearer {app.state.config.OPENAI_API_KEY}" 436 | headers["Content-Type"] = "application/json" 437 | 438 | data = { 439 | "model": ( 440 | app.state.config.MODEL 441 | if app.state.config.MODEL != "" 442 | else "dall-e-2" 443 | ), 444 | "prompt": form_data.prompt, 445 | "n": form_data.n, 446 | "size": ( 447 | form_data.size if form_data.size else app.state.config.IMAGE_SIZE 448 | ), 449 | "response_format": "b64_json", 450 | } 451 | 452 | r = requests.post( 453 | url=f"{app.state.config.OPENAI_API_BASE_URL}/images/generations", 454 | json=data, 455 | headers=headers, 456 | ) 457 | 458 | r.raise_for_status() 459 | res = r.json() 460 | 461 | images = [] 462 | 463 | for image in res["data"]: 464 | image_filename = save_b64_image(image["b64_json"]) 465 | images.append({"url": f"/cache/image/generations/{image_filename}"}) 466 | file_body_path = IMAGE_CACHE_DIR.joinpath(f"{image_filename}.json") 467 | 468 | with open(file_body_path, "w") as f: 469 | json.dump(data, f) 470 | 471 | return images 472 | 473 | elif app.state.config.ENGINE == "comfyui": 474 | 475 | data = { 476 | "prompt": form_data.prompt, 477 | "width": width, 478 | "height": height, 479 | "n": form_data.n, 480 | } 481 | 482 | if app.state.config.IMAGE_STEPS is not None: 483 | data["steps"] = app.state.config.IMAGE_STEPS 484 | 485 | if form_data.negative_prompt is not None: 486 | data["negative_prompt"] = form_data.negative_prompt 487 | 488 | if app.state.config.COMFYUI_CFG_SCALE: 489 | data["cfg_scale"] = app.state.config.COMFYUI_CFG_SCALE 490 | 491 | if app.state.config.COMFYUI_SAMPLER is not None: 492 | data["sampler"] = app.state.config.COMFYUI_SAMPLER 493 | 494 | if app.state.config.COMFYUI_SCHEDULER is not None: 495 | data["scheduler"] = app.state.config.COMFYUI_SCHEDULER 496 | 497 | if app.state.config.COMFYUI_SD3 is not None: 498 | data["sd3"] = app.state.config.COMFYUI_SD3 499 | 500 | data = ImageGenerationPayload(**data) 501 | 502 | res = comfyui_generate_image( 503 | app.state.config.MODEL, 504 | data, 505 | user.id, 506 | app.state.config.COMFYUI_BASE_URL, 507 | ) 508 | log.debug(f"res: {res}") 509 | 510 | images = [] 511 | 512 | for image in res["data"]: 513 | image_filename = save_url_image(image["url"]) 514 | images.append({"url": f"/cache/image/generations/{image_filename}"}) 515 | file_body_path = IMAGE_CACHE_DIR.joinpath(f"{image_filename}.json") 516 | 517 | with open(file_body_path, "w") as f: 518 | json.dump(data.model_dump(exclude_none=True), f) 519 | 520 | log.debug(f"images: {images}") 521 | return images 522 | else: 523 | if form_data.model: 524 | set_model_handler(form_data.model) 525 | 526 | data = { 527 | "prompt": form_data.prompt, 528 | "batch_size": form_data.n, 529 | "width": width, 530 | "height": height, 531 | } 532 | 533 | if app.state.config.IMAGE_STEPS is not None: 534 | data["steps"] = app.state.config.IMAGE_STEPS 535 | 536 | if form_data.negative_prompt is not None: 537 | data["negative_prompt"] = form_data.negative_prompt 538 | 539 | r = requests.post( 540 | url=f"{app.state.config.AUTOMATIC1111_BASE_URL}/sdapi/v1/txt2img", 541 | json=data, 542 | headers={"authorization": get_automatic1111_api_auth()}, 543 | ) 544 | 545 | res = r.json() 546 | 547 | log.debug(f"res: {res}") 548 | 549 | images = [] 550 | 551 | for image in res["images"]: 552 | image_filename = save_b64_image(image) 553 | images.append({"url": f"/cache/image/generations/{image_filename}"}) 554 | file_body_path = IMAGE_CACHE_DIR.joinpath(f"{image_filename}.json") 555 | 556 | with open(file_body_path, "w") as f: 557 | json.dump({**data, "info": res["info"]}, f) 558 | 559 | return images 560 | 561 | except Exception as e: 562 | error = e 563 | 564 | if r != None: 565 | data = r.json() 566 | if "error" in data: 567 | error = data["error"]["message"] 568 | raise HTTPException(status_code=400, detail=ERROR_MESSAGES.DEFAULT(error)) ``````` `\\?\D:\Coding\ai\backend\apps\images\utils\comfyui.py`: ```````py 1 | import websocket # NOTE: websocket-client (https://github.com/websocket-client/websocket-client) 2 | import uuid 3 | import json 4 | import urllib.request 5 | import urllib.parse 6 | import random 7 | import logging 8 | 9 | from config import SRC_LOG_LEVELS 10 | 11 | log = logging.getLogger(__name__) 12 | log.setLevel(SRC_LOG_LEVELS["COMFYUI"]) 13 | 14 | from pydantic import BaseModel 15 | 16 | from typing import Optional 17 | 18 | COMFYUI_DEFAULT_PROMPT = """ 19 | { 20 | "3": { 21 | "inputs": { 22 | "seed": 0, 23 | "steps": 20, 24 | "cfg": 8, 25 | "sampler_name": "euler", 26 | "scheduler": "normal", 27 | "denoise": 1, 28 | "model": [ 29 | "4", 30 | 0 31 | ], 32 | "positive": [ 33 | "6", 34 | 0 35 | ], 36 | "negative": [ 37 | "7", 38 | 0 39 | ], 40 | "latent_image": [ 41 | "5", 42 | 0 43 | ] 44 | }, 45 | "class_type": "KSampler", 46 | "_meta": { 47 | "title": "KSampler" 48 | } 49 | }, 50 | "4": { 51 | "inputs": { 52 | "ckpt_name": "model.safetensors" 53 | }, 54 | "class_type": "CheckpointLoaderSimple", 55 | "_meta": { 56 | "title": "Load Checkpoint" 57 | } 58 | }, 59 | "5": { 60 | "inputs": { 61 | "width": 512, 62 | "height": 512, 63 | "batch_size": 1 64 | }, 65 | "class_type": "EmptyLatentImage", 66 | "_meta": { 67 | "title": "Empty Latent Image" 68 | } 69 | }, 70 | "6": { 71 | "inputs": { 72 | "text": "Prompt", 73 | "clip": [ 74 | "4", 75 | 1 76 | ] 77 | }, 78 | "class_type": "CLIPTextEncode", 79 | "_meta": { 80 | "title": "CLIP Text Encode (Prompt)" 81 | } 82 | }, 83 | "7": { 84 | "inputs": { 85 | "text": "Negative Prompt", 86 | "clip": [ 87 | "4", 88 | 1 89 | ] 90 | }, 91 | "class_type": "CLIPTextEncode", 92 | "_meta": { 93 | "title": "CLIP Text Encode (Prompt)" 94 | } 95 | }, 96 | "8": { 97 | "inputs": { 98 | "samples": [ 99 | "3", 100 | 0 101 | ], 102 | "vae": [ 103 | "4", 104 | 2 105 | ] 106 | }, 107 | "class_type": "VAEDecode", 108 | "_meta": { 109 | "title": "VAE Decode" 110 | } 111 | }, 112 | "9": { 113 | "inputs": { 114 | "filename_prefix": "ComfyUI", 115 | "images": [ 116 | "8", 117 | 0 118 | ] 119 | }, 120 | "class_type": "SaveImage", 121 | "_meta": { 122 | "title": "Save Image" 123 | } 124 | } 125 | } 126 | """ 127 | 128 | 129 | def queue_prompt(prompt, client_id, base_url): 130 | log.info("queue_prompt") 131 | p = {"prompt": prompt, "client_id": client_id} 132 | data = json.dumps(p).encode("utf-8") 133 | req = urllib.request.Request(f"{base_url}/prompt", data=data) 134 | return json.loads(urllib.request.urlopen(req).read()) 135 | 136 | 137 | def get_image(filename, subfolder, folder_type, base_url): 138 | log.info("get_image") 139 | data = {"filename": filename, "subfolder": subfolder, "type": folder_type} 140 | url_values = urllib.parse.urlencode(data) 141 | with urllib.request.urlopen(f"{base_url}/view?{url_values}") as response: 142 | return response.read() 143 | 144 | 145 | def get_image_url(filename, subfolder, folder_type, base_url): 146 | log.info("get_image") 147 | data = {"filename": filename, "subfolder": subfolder, "type": folder_type} 148 | url_values = urllib.parse.urlencode(data) 149 | return f"{base_url}/view?{url_values}" 150 | 151 | 152 | def get_history(prompt_id, base_url): 153 | log.info("get_history") 154 | with urllib.request.urlopen(f"{base_url}/history/{prompt_id}") as response: 155 | return json.loads(response.read()) 156 | 157 | 158 | def get_images(ws, prompt, client_id, base_url): 159 | prompt_id = queue_prompt(prompt, client_id, base_url)["prompt_id"] 160 | output_images = [] 161 | while True: 162 | out = ws.recv() 163 | if isinstance(out, str): 164 | message = json.loads(out) 165 | if message["type"] == "executing": 166 | data = message["data"] 167 | if data["node"] is None and data["prompt_id"] == prompt_id: 168 | break # Execution is done 169 | else: 170 | continue # previews are binary data 171 | 172 | history = get_history(prompt_id, base_url)[prompt_id] 173 | for o in history["outputs"]: 174 | for node_id in history["outputs"]: 175 | node_output = history["outputs"][node_id] 176 | if "images" in node_output: 177 | for image in node_output["images"]: 178 | url = get_image_url( 179 | image["filename"], image["subfolder"], image["type"], base_url 180 | ) 181 | output_images.append({"url": url}) 182 | return {"data": output_images} 183 | 184 | 185 | class ImageGenerationPayload(BaseModel): 186 | prompt: str 187 | negative_prompt: Optional[str] = "" 188 | steps: Optional[int] = None 189 | seed: Optional[int] = None 190 | width: int 191 | height: int 192 | n: int = 1 193 | cfg_scale: Optional[float] = None 194 | sampler: Optional[str] = None 195 | scheduler: Optional[str] = None 196 | sd3: Optional[bool] = None 197 | 198 | 199 | def comfyui_generate_image( 200 | model: str, payload: ImageGenerationPayload, client_id, base_url 201 | ): 202 | ws_url = base_url.replace("http://", "ws://").replace("https://", "wss://") 203 | 204 | comfyui_prompt = json.loads(COMFYUI_DEFAULT_PROMPT) 205 | 206 | if payload.cfg_scale: 207 | comfyui_prompt["3"]["inputs"]["cfg"] = payload.cfg_scale 208 | 209 | if payload.sampler: 210 | comfyui_prompt["3"]["inputs"]["sampler"] = payload.sampler 211 | 212 | if payload.scheduler: 213 | comfyui_prompt["3"]["inputs"]["scheduler"] = payload.scheduler 214 | 215 | if payload.sd3: 216 | comfyui_prompt["5"]["class_type"] = "EmptySD3LatentImage" 217 | 218 | comfyui_prompt["4"]["inputs"]["ckpt_name"] = model 219 | comfyui_prompt["5"]["inputs"]["batch_size"] = payload.n 220 | comfyui_prompt["5"]["inputs"]["width"] = payload.width 221 | comfyui_prompt["5"]["inputs"]["height"] = payload.height 222 | 223 | # set the text prompt for our positive CLIPTextEncode 224 | comfyui_prompt["6"]["inputs"]["text"] = payload.prompt 225 | comfyui_prompt["7"]["inputs"]["text"] = payload.negative_prompt 226 | 227 | if payload.steps: 228 | comfyui_prompt["3"]["inputs"]["steps"] = payload.steps 229 | 230 | comfyui_prompt["3"]["inputs"]["seed"] = ( 231 | payload.seed if payload.seed else random.randint(0, 18446744073709551614) 232 | ) 233 | 234 | try: 235 | ws = websocket.WebSocket() 236 | ws.connect(f"{ws_url}/ws?clientId={client_id}") 237 | log.info("WebSocket connection established.") 238 | except Exception as e: 239 | log.exception(f"Failed to connect to WebSocket server: {e}") 240 | return None 241 | 242 | try: 243 | images = get_images(ws, comfyui_prompt, client_id, base_url) 244 | except Exception as e: 245 | log.exception(f"Error while receiving images: {e}") 246 | images = None 247 | 248 | ws.close() 249 | 250 | return images ``````` `\\?\D:\Coding\ai\backend\apps\ollama\main.py`: ```````py 1 | from fastapi import ( 2 | FastAPI, 3 | Request, 4 | Response, 5 | HTTPException, 6 | Depends, 7 | status, 8 | UploadFile, 9 | File, 10 | BackgroundTasks, 11 | ) 12 | from fastapi.middleware.cors import CORSMiddleware 13 | from fastapi.responses import StreamingResponse 14 | from fastapi.concurrency import run_in_threadpool 15 | 16 | from pydantic import BaseModel, ConfigDict 17 | 18 | import os 19 | import re 20 | import copy 21 | import random 22 | import requests 23 | import json 24 | import uuid 25 | import aiohttp 26 | import asyncio 27 | import logging 28 | import time 29 | from urllib.parse import urlparse 30 | from typing import Optional, List, Union 31 | 32 | from starlette.background import BackgroundTask 33 | 34 | from apps.webui.models.models import Models 35 | from apps.webui.models.users import Users 36 | from constants import ERROR_MESSAGES 37 | from utils.utils import ( 38 | decode_token, 39 | get_current_user, 40 | get_verified_user, 41 | get_admin_user, 42 | ) 43 | from utils.task import prompt_template 44 | 45 | 46 | from config import ( 47 | SRC_LOG_LEVELS, 48 | OLLAMA_BASE_URLS, 49 | ENABLE_OLLAMA_API, 50 | AIOHTTP_CLIENT_TIMEOUT, 51 | ENABLE_MODEL_FILTER, 52 | MODEL_FILTER_LIST, 53 | UPLOAD_DIR, 54 | AppConfig, 55 | ) 56 | from utils.misc import calculate_sha256, add_or_update_system_message 57 | 58 | log = logging.getLogger(__name__) 59 | log.setLevel(SRC_LOG_LEVELS["OLLAMA"]) 60 | 61 | app = FastAPI() 62 | app.add_middleware( 63 | CORSMiddleware, 64 | allow_origins=["*"], 65 | allow_credentials=True, 66 | allow_methods=["*"], 67 | allow_headers=["*"], 68 | ) 69 | 70 | app.state.config = AppConfig() 71 | 72 | app.state.config.ENABLE_MODEL_FILTER = ENABLE_MODEL_FILTER 73 | app.state.config.MODEL_FILTER_LIST = MODEL_FILTER_LIST 74 | 75 | app.state.config.ENABLE_OLLAMA_API = ENABLE_OLLAMA_API 76 | app.state.config.OLLAMA_BASE_URLS = OLLAMA_BASE_URLS 77 | app.state.MODELS = {} 78 | 79 | 80 | # TODO: Implement a more intelligent load balancing mechanism for distributing requests among multiple backend instances. 81 | # Current implementation uses a simple round-robin approach (random.choice). Consider incorporating algorithms like weighted round-robin, 82 | # least connections, or least response time for better resource utilization and performance optimization. 83 | 84 | 85 | @app.middleware("http") 86 | async def check_url(request: Request, call_next): 87 | if len(app.state.MODELS) == 0: 88 | await get_all_models() 89 | else: 90 | pass 91 | 92 | response = await call_next(request) 93 | return response 94 | 95 | 96 | @app.head("/") 97 | @app.get("/") 98 | async def get_status(): 99 | return {"status": True} 100 | 101 | 102 | @app.get("/config") 103 | async def get_config(user=Depends(get_admin_user)): 104 | return {"ENABLE_OLLAMA_API": app.state.config.ENABLE_OLLAMA_API} 105 | 106 | 107 | class OllamaConfigForm(BaseModel): 108 | enable_ollama_api: Optional[bool] = None 109 | 110 | 111 | @app.post("/config/update") 112 | async def update_config(form_data: OllamaConfigForm, user=Depends(get_admin_user)): 113 | app.state.config.ENABLE_OLLAMA_API = form_data.enable_ollama_api 114 | return {"ENABLE_OLLAMA_API": app.state.config.ENABLE_OLLAMA_API} 115 | 116 | 117 | @app.get("/urls") 118 | async def get_ollama_api_urls(user=Depends(get_admin_user)): 119 | return {"OLLAMA_BASE_URLS": app.state.config.OLLAMA_BASE_URLS} 120 | 121 | 122 | class UrlUpdateForm(BaseModel): 123 | urls: List[str] 124 | 125 | 126 | @app.post("/urls/update") 127 | async def update_ollama_api_url(form_data: UrlUpdateForm, user=Depends(get_admin_user)): 128 | app.state.config.OLLAMA_BASE_URLS = form_data.urls 129 | 130 | log.info(f"app.state.config.OLLAMA_BASE_URLS: {app.state.config.OLLAMA_BASE_URLS}") 131 | return {"OLLAMA_BASE_URLS": app.state.config.OLLAMA_BASE_URLS} 132 | 133 | 134 | async def fetch_url(url): 135 | timeout = aiohttp.ClientTimeout(total=5) 136 | try: 137 | async with aiohttp.ClientSession(timeout=timeout, trust_env=True) as session: 138 | async with session.get(url) as response: 139 | return await response.json() 140 | except Exception as e: 141 | # Handle connection error here 142 | log.error(f"Connection error: {e}") 143 | return None 144 | 145 | 146 | async def cleanup_response( 147 | response: Optional[aiohttp.ClientResponse], 148 | session: Optional[aiohttp.ClientSession], 149 | ): 150 | if response: 151 | response.close() 152 | if session: 153 | await session.close() 154 | 155 | 156 | async def post_streaming_url(url: str, payload: str, stream: bool = True): 157 | r = None 158 | try: 159 | session = aiohttp.ClientSession( 160 | trust_env=True, timeout=aiohttp.ClientTimeout(total=AIOHTTP_CLIENT_TIMEOUT) 161 | ) 162 | r = await session.post(url, data=payload) 163 | r.raise_for_status() 164 | 165 | if stream: 166 | return StreamingResponse( 167 | r.content, 168 | status_code=r.status, 169 | headers=dict(r.headers), 170 | background=BackgroundTask( 171 | cleanup_response, response=r, session=session 172 | ), 173 | ) 174 | else: 175 | res = await r.json() 176 | await cleanup_response(r, session) 177 | return res 178 | 179 | except Exception as e: 180 | error_detail = "Open WebUI: Server Connection Error" 181 | if r is not None: 182 | try: 183 | res = await r.json() 184 | if "error" in res: 185 | error_detail = f"Ollama: {res['error']}" 186 | except: 187 | error_detail = f"Ollama: {e}" 188 | 189 | raise HTTPException( 190 | status_code=r.status if r else 500, 191 | detail=error_detail, 192 | ) 193 | 194 | 195 | def merge_models_lists(model_lists): 196 | merged_models = {} 197 | 198 | for idx, model_list in enumerate(model_lists): 199 | if model_list is not None: 200 | for model in model_list: 201 | digest = model["digest"] 202 | if digest not in merged_models: 203 | model["urls"] = [idx] 204 | merged_models[digest] = model 205 | else: 206 | merged_models[digest]["urls"].append(idx) 207 | 208 | return list(merged_models.values()) 209 | 210 | 211 | async def get_all_models(): 212 | log.info("get_all_models()") 213 | 214 | if app.state.config.ENABLE_OLLAMA_API: 215 | tasks = [ 216 | fetch_url(f"{url}/api/tags") for url in app.state.config.OLLAMA_BASE_URLS 217 | ] 218 | responses = await asyncio.gather(*tasks) 219 | 220 | models = { 221 | "models": merge_models_lists( 222 | map( 223 | lambda response: response["models"] if response else None, responses 224 | ) 225 | ) 226 | } 227 | 228 | else: 229 | models = {"models": []} 230 | 231 | app.state.MODELS = {model["model"]: model for model in models["models"]} 232 | 233 | return models 234 | 235 | 236 | @app.get("/api/tags") 237 | @app.get("/api/tags/{url_idx}") 238 | async def get_ollama_tags( 239 | url_idx: Optional[int] = None, user=Depends(get_verified_user) 240 | ): 241 | if url_idx == None: 242 | models = await get_all_models() 243 | 244 | if app.state.config.ENABLE_MODEL_FILTER: 245 | if user.role == "user": 246 | models["models"] = list( 247 | filter( 248 | lambda model: model["name"] 249 | in app.state.config.MODEL_FILTER_LIST, 250 | models["models"], 251 | ) 252 | ) 253 | return models 254 | return models 255 | else: 256 | url = app.state.config.OLLAMA_BASE_URLS[url_idx] 257 | 258 | r = None 259 | try: 260 | r = requests.request(method="GET", url=f"{url}/api/tags") 261 | r.raise_for_status() 262 | 263 | return r.json() 264 | except Exception as e: 265 | log.exception(e) 266 | error_detail = "Open WebUI: Server Connection Error" 267 | if r is not None: 268 | try: 269 | res = r.json() 270 | if "error" in res: 271 | error_detail = f"Ollama: {res['error']}" 272 | except: 273 | error_detail = f"Ollama: {e}" 274 | 275 | raise HTTPException( 276 | status_code=r.status_code if r else 500, 277 | detail=error_detail, 278 | ) 279 | 280 | 281 | @app.get("/api/version") 282 | @app.get("/api/version/{url_idx}") 283 | async def get_ollama_versions(url_idx: Optional[int] = None): 284 | if app.state.config.ENABLE_OLLAMA_API: 285 | if url_idx == None: 286 | 287 | # returns lowest version 288 | tasks = [ 289 | fetch_url(f"{url}/api/version") 290 | for url in app.state.config.OLLAMA_BASE_URLS 291 | ] 292 | responses = await asyncio.gather(*tasks) 293 | responses = list(filter(lambda x: x is not None, responses)) 294 | 295 | if len(responses) > 0: 296 | lowest_version = min( 297 | responses, 298 | key=lambda x: tuple( 299 | map(int, re.sub(r"^v|-.*", "", x["version"]).split(".")) 300 | ), 301 | ) 302 | 303 | return {"version": lowest_version["version"]} 304 | else: 305 | raise HTTPException( 306 | status_code=500, 307 | detail=ERROR_MESSAGES.OLLAMA_NOT_FOUND, 308 | ) 309 | else: 310 | url = app.state.config.OLLAMA_BASE_URLS[url_idx] 311 | 312 | r = None 313 | try: 314 | r = requests.request(method="GET", url=f"{url}/api/version") 315 | r.raise_for_status() 316 | 317 | return r.json() 318 | except Exception as e: 319 | log.exception(e) 320 | error_detail = "Open WebUI: Server Connection Error" 321 | if r is not None: 322 | try: 323 | res = r.json() 324 | if "error" in res: 325 | error_detail = f"Ollama: {res['error']}" 326 | except: 327 | error_detail = f"Ollama: {e}" 328 | 329 | raise HTTPException( 330 | status_code=r.status_code if r else 500, 331 | detail=error_detail, 332 | ) 333 | else: 334 | return {"version": False} 335 | 336 | 337 | class ModelNameForm(BaseModel): 338 | name: str 339 | 340 | 341 | @app.post("/api/pull") 342 | @app.post("/api/pull/{url_idx}") 343 | async def pull_model( 344 | form_data: ModelNameForm, url_idx: int = 0, user=Depends(get_admin_user) 345 | ): 346 | url = app.state.config.OLLAMA_BASE_URLS[url_idx] 347 | log.info(f"url: {url}") 348 | 349 | r = None 350 | 351 | # Admin should be able to pull models from any source 352 | payload = {**form_data.model_dump(exclude_none=True), "insecure": True} 353 | 354 | return await post_streaming_url(f"{url}/api/pull", json.dumps(payload)) 355 | 356 | 357 | class PushModelForm(BaseModel): 358 | name: str 359 | insecure: Optional[bool] = None 360 | stream: Optional[bool] = None 361 | 362 | 363 | @app.delete("/api/push") 364 | @app.delete("/api/push/{url_idx}") 365 | async def push_model( 366 | form_data: PushModelForm, 367 | url_idx: Optional[int] = None, 368 | user=Depends(get_admin_user), 369 | ): 370 | if url_idx == None: 371 | if form_data.name in app.state.MODELS: 372 | url_idx = app.state.MODELS[form_data.name]["urls"][0] 373 | else: 374 | raise HTTPException( 375 | status_code=400, 376 | detail=ERROR_MESSAGES.MODEL_NOT_FOUND(form_data.name), 377 | ) 378 | 379 | url = app.state.config.OLLAMA_BASE_URLS[url_idx] 380 | log.debug(f"url: {url}") 381 | 382 | return await post_streaming_url( 383 | f"{url}/api/push", form_data.model_dump_json(exclude_none=True).encode() 384 | ) 385 | 386 | 387 | class CreateModelForm(BaseModel): 388 | name: str 389 | modelfile: Optional[str] = None 390 | stream: Optional[bool] = None 391 | path: Optional[str] = None 392 | 393 | 394 | @app.post("/api/create") 395 | @app.post("/api/create/{url_idx}") 396 | async def create_model( 397 | form_data: CreateModelForm, url_idx: int = 0, user=Depends(get_admin_user) 398 | ): 399 | log.debug(f"form_data: {form_data}") 400 | url = app.state.config.OLLAMA_BASE_URLS[url_idx] 401 | log.info(f"url: {url}") 402 | 403 | return await post_streaming_url( 404 | f"{url}/api/create", form_data.model_dump_json(exclude_none=True).encode() 405 | ) 406 | 407 | 408 | class CopyModelForm(BaseModel): 409 | source: str 410 | destination: str 411 | 412 | 413 | @app.post("/api/copy") 414 | @app.post("/api/copy/{url_idx}") 415 | async def copy_model( 416 | form_data: CopyModelForm, 417 | url_idx: Optional[int] = None, 418 | user=Depends(get_admin_user), 419 | ): 420 | if url_idx == None: 421 | if form_data.source in app.state.MODELS: 422 | url_idx = app.state.MODELS[form_data.source]["urls"][0] 423 | else: 424 | raise HTTPException( 425 | status_code=400, 426 | detail=ERROR_MESSAGES.MODEL_NOT_FOUND(form_data.source), 427 | ) 428 | 429 | url = app.state.config.OLLAMA_BASE_URLS[url_idx] 430 | log.info(f"url: {url}") 431 | 432 | try: 433 | r = requests.request( 434 | method="POST", 435 | url=f"{url}/api/copy", 436 | data=form_data.model_dump_json(exclude_none=True).encode(), 437 | ) 438 | r.raise_for_status() 439 | 440 | log.debug(f"r.text: {r.text}") 441 | 442 | return True 443 | except Exception as e: 444 | log.exception(e) 445 | error_detail = "Open WebUI: Server Connection Error" 446 | if r is not None: 447 | try: 448 | res = r.json() 449 | if "error" in res: 450 | error_detail = f"Ollama: {res['error']}" 451 | except: 452 | error_detail = f"Ollama: {e}" 453 | 454 | raise HTTPException( 455 | status_code=r.status_code if r else 500, 456 | detail=error_detail, 457 | ) 458 | 459 | 460 | @app.delete("/api/delete") 461 | @app.delete("/api/delete/{url_idx}") 462 | async def delete_model( 463 | form_data: ModelNameForm, 464 | url_idx: Optional[int] = None, 465 | user=Depends(get_admin_user), 466 | ): 467 | if url_idx == None: 468 | if form_data.name in app.state.MODELS: 469 | url_idx = app.state.MODELS[form_data.name]["urls"][0] 470 | else: 471 | raise HTTPException( 472 | status_code=400, 473 | detail=ERROR_MESSAGES.MODEL_NOT_FOUND(form_data.name), 474 | ) 475 | 476 | url = app.state.config.OLLAMA_BASE_URLS[url_idx] 477 | log.info(f"url: {url}") 478 | 479 | try: 480 | r = requests.request( 481 | method="DELETE", 482 | url=f"{url}/api/delete", 483 | data=form_data.model_dump_json(exclude_none=True).encode(), 484 | ) 485 | r.raise_for_status() 486 | 487 | log.debug(f"r.text: {r.text}") 488 | 489 | return True 490 | except Exception as e: 491 | log.exception(e) 492 | error_detail = "Open WebUI: Server Connection Error" 493 | if r is not None: 494 | try: 495 | res = r.json() 496 | if "error" in res: 497 | error_detail = f"Ollama: {res['error']}" 498 | except: 499 | error_detail = f"Ollama: {e}" 500 | 501 | raise HTTPException( 502 | status_code=r.status_code if r else 500, 503 | detail=error_detail, 504 | ) 505 | 506 | 507 | @app.post("/api/show") 508 | async def show_model_info(form_data: ModelNameForm, user=Depends(get_verified_user)): 509 | if form_data.name not in app.state.MODELS: 510 | raise HTTPException( 511 | status_code=400, 512 | detail=ERROR_MESSAGES.MODEL_NOT_FOUND(form_data.name), 513 | ) 514 | 515 | url_idx = random.choice(app.state.MODELS[form_data.name]["urls"]) 516 | url = app.state.config.OLLAMA_BASE_URLS[url_idx] 517 | log.info(f"url: {url}") 518 | 519 | try: 520 | r = requests.request( 521 | method="POST", 522 | url=f"{url}/api/show", 523 | data=form_data.model_dump_json(exclude_none=True).encode(), 524 | ) 525 | r.raise_for_status() 526 | 527 | return r.json() 528 | except Exception as e: 529 | log.exception(e) 530 | error_detail = "Open WebUI: Server Connection Error" 531 | if r is not None: 532 | try: 533 | res = r.json() 534 | if "error" in res: 535 | error_detail = f"Ollama: {res['error']}" 536 | except: 537 | error_detail = f"Ollama: {e}" 538 | 539 | raise HTTPException( 540 | status_code=r.status_code if r else 500, 541 | detail=error_detail, 542 | ) 543 | 544 | 545 | class GenerateEmbeddingsForm(BaseModel): 546 | model: str 547 | prompt: str 548 | options: Optional[dict] = None 549 | keep_alive: Optional[Union[int, str]] = None 550 | 551 | 552 | @app.post("/api/embeddings") 553 | @app.post("/api/embeddings/{url_idx}") 554 | async def generate_embeddings( 555 | form_data: GenerateEmbeddingsForm, 556 | url_idx: Optional[int] = None, 557 | user=Depends(get_verified_user), 558 | ): 559 | if url_idx == None: 560 | model = form_data.model 561 | 562 | if ":" not in model: 563 | model = f"{model}:latest" 564 | 565 | if model in app.state.MODELS: 566 | url_idx = random.choice(app.state.MODELS[model]["urls"]) 567 | else: 568 | raise HTTPException( 569 | status_code=400, 570 | detail=ERROR_MESSAGES.MODEL_NOT_FOUND(form_data.model), 571 | ) 572 | 573 | url = app.state.config.OLLAMA_BASE_URLS[url_idx] 574 | log.info(f"url: {url}") 575 | 576 | try: 577 | r = requests.request( 578 | method="POST", 579 | url=f"{url}/api/embeddings", 580 | data=form_data.model_dump_json(exclude_none=True).encode(), 581 | ) 582 | r.raise_for_status() 583 | 584 | return r.json() 585 | except Exception as e: 586 | log.exception(e) 587 | error_detail = "Open WebUI: Server Connection Error" 588 | if r is not None: 589 | try: 590 | res = r.json() 591 | if "error" in res: 592 | error_detail = f"Ollama: {res['error']}" 593 | except: 594 | error_detail = f"Ollama: {e}" 595 | 596 | raise HTTPException( 597 | status_code=r.status_code if r else 500, 598 | detail=error_detail, 599 | ) 600 | 601 | 602 | def generate_ollama_embeddings( 603 | form_data: GenerateEmbeddingsForm, 604 | url_idx: Optional[int] = None, 605 | ): 606 | 607 | log.info(f"generate_ollama_embeddings {form_data}") 608 | 609 | if url_idx == None: 610 | model = form_data.model 611 | 612 | if ":" not in model: 613 | model = f"{model}:latest" 614 | 615 | if model in app.state.MODELS: 616 | url_idx = random.choice(app.state.MODELS[model]["urls"]) 617 | else: 618 | raise HTTPException( 619 | status_code=400, 620 | detail=ERROR_MESSAGES.MODEL_NOT_FOUND(form_data.model), 621 | ) 622 | 623 | url = app.state.config.OLLAMA_BASE_URLS[url_idx] 624 | log.info(f"url: {url}") 625 | 626 | try: 627 | r = requests.request( 628 | method="POST", 629 | url=f"{url}/api/embeddings", 630 | data=form_data.model_dump_json(exclude_none=True).encode(), 631 | ) 632 | r.raise_for_status() 633 | 634 | data = r.json() 635 | 636 | log.info(f"generate_ollama_embeddings {data}") 637 | 638 | if "embedding" in data: 639 | return data["embedding"] 640 | else: 641 | raise "Something went wrong :/" 642 | except Exception as e: 643 | log.exception(e) 644 | error_detail = "Open WebUI: Server Connection Error" 645 | if r is not None: 646 | try: 647 | res = r.json() 648 | if "error" in res: 649 | error_detail = f"Ollama: {res['error']}" 650 | except: 651 | error_detail = f"Ollama: {e}" 652 | 653 | raise error_detail 654 | 655 | 656 | class GenerateCompletionForm(BaseModel): 657 | model: str 658 | prompt: str 659 | images: Optional[List[str]] = None 660 | format: Optional[str] = None 661 | options: Optional[dict] = None 662 | system: Optional[str] = None 663 | template: Optional[str] = None 664 | context: Optional[str] = None 665 | stream: Optional[bool] = True 666 | raw: Optional[bool] = None 667 | keep_alive: Optional[Union[int, str]] = None 668 | 669 | 670 | @app.post("/api/generate") 671 | @app.post("/api/generate/{url_idx}") 672 | async def generate_completion( 673 | form_data: GenerateCompletionForm, 674 | url_idx: Optional[int] = None, 675 | user=Depends(get_verified_user), 676 | ): 677 | 678 | if url_idx == None: 679 | model = form_data.model 680 | 681 | if ":" not in model: 682 | model = f"{model}:latest" 683 | 684 | if model in app.state.MODELS: 685 | url_idx = random.choice(app.state.MODELS[model]["urls"]) 686 | else: 687 | raise HTTPException( 688 | status_code=400, 689 | detail=ERROR_MESSAGES.MODEL_NOT_FOUND(form_data.model), 690 | ) 691 | 692 | url = app.state.config.OLLAMA_BASE_URLS[url_idx] 693 | log.info(f"url: {url}") 694 | 695 | return await post_streaming_url( 696 | f"{url}/api/generate", form_data.model_dump_json(exclude_none=True).encode() 697 | ) 698 | 699 | 700 | class ChatMessage(BaseModel): 701 | role: str 702 | content: str 703 | images: Optional[List[str]] = None 704 | 705 | 706 | class GenerateChatCompletionForm(BaseModel): 707 | model: str 708 | messages: List[ChatMessage] 709 | format: Optional[str] = None 710 | options: Optional[dict] = None 711 | template: Optional[str] = None 712 | stream: Optional[bool] = None 713 | keep_alive: Optional[Union[int, str]] = None 714 | 715 | 716 | @app.post("/api/chat") 717 | @app.post("/api/chat/{url_idx}") 718 | async def generate_chat_completion( 719 | form_data: GenerateChatCompletionForm, 720 | url_idx: Optional[int] = None, 721 | user=Depends(get_verified_user), 722 | ): 723 | 724 | log.debug( 725 | "form_data.model_dump_json(exclude_none=True).encode(): {0} ".format( 726 | form_data.model_dump_json(exclude_none=True).encode() 727 | ) 728 | ) 729 | 730 | payload = { 731 | **form_data.model_dump(exclude_none=True, exclude=["metadata"]), 732 | } 733 | if "metadata" in payload: 734 | del payload["metadata"] 735 | 736 | model_id = form_data.model 737 | model_info = Models.get_model_by_id(model_id) 738 | 739 | if model_info: 740 | if model_info.base_model_id: 741 | payload["model"] = model_info.base_model_id 742 | 743 | model_info.params = model_info.params.model_dump() 744 | 745 | if model_info.params: 746 | if payload.get("options") is None: 747 | payload["options"] = {} 748 | 749 | if ( 750 | model_info.params.get("mirostat", None) 751 | and payload["options"].get("mirostat") is None 752 | ): 753 | payload["options"]["mirostat"] = model_info.params.get("mirostat", None) 754 | 755 | if ( 756 | model_info.params.get("mirostat_eta", None) 757 | and payload["options"].get("mirostat_eta") is None 758 | ): 759 | payload["options"]["mirostat_eta"] = model_info.params.get( 760 | "mirostat_eta", None 761 | ) 762 | 763 | if ( 764 | model_info.params.get("mirostat_tau", None) 765 | and payload["options"].get("mirostat_tau") is None 766 | ): 767 | payload["options"]["mirostat_tau"] = model_info.params.get( 768 | "mirostat_tau", None 769 | ) 770 | 771 | if ( 772 | model_info.params.get("num_ctx", None) 773 | and payload["options"].get("num_ctx") is None 774 | ): 775 | payload["options"]["num_ctx"] = model_info.params.get("num_ctx", None) 776 | 777 | if ( 778 | model_info.params.get("num_batch", None) 779 | and payload["options"].get("num_batch") is None 780 | ): 781 | payload["options"]["num_batch"] = model_info.params.get( 782 | "num_batch", None 783 | ) 784 | 785 | if ( 786 | model_info.params.get("num_keep", None) 787 | and payload["options"].get("num_keep") is None 788 | ): 789 | payload["options"]["num_keep"] = model_info.params.get("num_keep", None) 790 | 791 | if ( 792 | model_info.params.get("repeat_last_n", None) 793 | and payload["options"].get("repeat_last_n") is None 794 | ): 795 | payload["options"]["repeat_last_n"] = model_info.params.get( 796 | "repeat_last_n", None 797 | ) 798 | 799 | if ( 800 | model_info.params.get("frequency_penalty", None) 801 | and payload["options"].get("frequency_penalty") is None 802 | ): 803 | payload["options"]["repeat_penalty"] = model_info.params.get( 804 | "frequency_penalty", None 805 | ) 806 | 807 | if ( 808 | model_info.params.get("temperature", None) 809 | and payload["options"].get("temperature") is None 810 | ): 811 | payload["options"]["temperature"] = model_info.params.get( 812 | "temperature", None 813 | ) 814 | 815 | if ( 816 | model_info.params.get("seed", None) 817 | and payload["options"].get("seed") is None 818 | ): 819 | payload["options"]["seed"] = model_info.params.get("seed", None) 820 | 821 | if ( 822 | model_info.params.get("stop", None) 823 | and payload["options"].get("stop") is None 824 | ): 825 | payload["options"]["stop"] = ( 826 | [ 827 | bytes(stop, "utf-8").decode("unicode_escape") 828 | for stop in model_info.params["stop"] 829 | ] 830 | if model_info.params.get("stop", None) 831 | else None 832 | ) 833 | 834 | if ( 835 | model_info.params.get("tfs_z", None) 836 | and payload["options"].get("tfs_z") is None 837 | ): 838 | payload["options"]["tfs_z"] = model_info.params.get("tfs_z", None) 839 | 840 | if ( 841 | model_info.params.get("max_tokens", None) 842 | and payload["options"].get("max_tokens") is None 843 | ): 844 | payload["options"]["num_predict"] = model_info.params.get( 845 | "max_tokens", None 846 | ) 847 | 848 | if ( 849 | model_info.params.get("top_k", None) 850 | and payload["options"].get("top_k") is None 851 | ): 852 | payload["options"]["top_k"] = model_info.params.get("top_k", None) 853 | 854 | if ( 855 | model_info.params.get("top_p", None) 856 | and payload["options"].get("top_p") is None 857 | ): 858 | payload["options"]["top_p"] = model_info.params.get("top_p", None) 859 | 860 | if ( 861 | model_info.params.get("use_mmap", None) 862 | and payload["options"].get("use_mmap") is None 863 | ): 864 | payload["options"]["use_mmap"] = model_info.params.get("use_mmap", None) 865 | 866 | if ( 867 | model_info.params.get("use_mlock", None) 868 | and payload["options"].get("use_mlock") is None 869 | ): 870 | payload["options"]["use_mlock"] = model_info.params.get( 871 | "use_mlock", None 872 | ) 873 | 874 | if ( 875 | model_info.params.get("num_thread", None) 876 | and payload["options"].get("num_thread") is None 877 | ): 878 | payload["options"]["num_thread"] = model_info.params.get( 879 | "num_thread", None 880 | ) 881 | 882 | system = model_info.params.get("system", None) 883 | if system: 884 | system = prompt_template( 885 | system, 886 | **( 887 | { 888 | "user_name": user.name, 889 | "user_location": ( 890 | user.info.get("location") if user.info else None 891 | ), 892 | } 893 | if user 894 | else {} 895 | ), 896 | ) 897 | 898 | if payload.get("messages"): 899 | payload["messages"] = add_or_update_system_message( 900 | system, payload["messages"] 901 | ) 902 | 903 | if url_idx == None: 904 | if ":" not in payload["model"]: 905 | payload["model"] = f"{payload['model']}:latest" 906 | 907 | if payload["model"] in app.state.MODELS: 908 | url_idx = random.choice(app.state.MODELS[payload["model"]]["urls"]) 909 | else: 910 | raise HTTPException( 911 | status_code=400, 912 | detail=ERROR_MESSAGES.MODEL_NOT_FOUND(form_data.model), 913 | ) 914 | 915 | url = app.state.config.OLLAMA_BASE_URLS[url_idx] 916 | log.info(f"url: {url}") 917 | log.debug(payload) 918 | 919 | return await post_streaming_url(f"{url}/api/chat", json.dumps(payload)) 920 | 921 | 922 | # TODO: we should update this part once Ollama supports other types 923 | class OpenAIChatMessageContent(BaseModel): 924 | type: str 925 | model_config = ConfigDict(extra="allow") 926 | 927 | 928 | class OpenAIChatMessage(BaseModel): 929 | role: str 930 | content: Union[str, OpenAIChatMessageContent] 931 | 932 | model_config = ConfigDict(extra="allow") 933 | 934 | 935 | class OpenAIChatCompletionForm(BaseModel): 936 | model: str 937 | messages: List[OpenAIChatMessage] 938 | 939 | model_config = ConfigDict(extra="allow") 940 | 941 | 942 | @app.post("/v1/chat/completions") 943 | @app.post("/v1/chat/completions/{url_idx}") 944 | async def generate_openai_chat_completion( 945 | form_data: dict, 946 | url_idx: Optional[int] = None, 947 | user=Depends(get_verified_user), 948 | ): 949 | form_data = OpenAIChatCompletionForm(**form_data) 950 | payload = {**form_data.model_dump(exclude_none=True, exclude=["metadata"])} 951 | 952 | if "metadata" in payload: 953 | del payload["metadata"] 954 | 955 | model_id = form_data.model 956 | model_info = Models.get_model_by_id(model_id) 957 | 958 | if model_info: 959 | if model_info.base_model_id: 960 | payload["model"] = model_info.base_model_id 961 | 962 | model_info.params = model_info.params.model_dump() 963 | 964 | if model_info.params: 965 | payload["temperature"] = model_info.params.get("temperature", None) 966 | payload["top_p"] = model_info.params.get("top_p", None) 967 | payload["max_tokens"] = model_info.params.get("max_tokens", None) 968 | payload["frequency_penalty"] = model_info.params.get( 969 | "frequency_penalty", None 970 | ) 971 | payload["seed"] = model_info.params.get("seed", None) 972 | payload["stop"] = ( 973 | [ 974 | bytes(stop, "utf-8").decode("unicode_escape") 975 | for stop in model_info.params["stop"] 976 | ] 977 | if model_info.params.get("stop", None) 978 | else None 979 | ) 980 | 981 | system = model_info.params.get("system", None) 982 | 983 | if system: 984 | system = prompt_template( 985 | system, 986 | **( 987 | { 988 | "user_name": user.name, 989 | "user_location": ( 990 | user.info.get("location") if user.info else None 991 | ), 992 | } 993 | if user 994 | else {} 995 | ), 996 | ) 997 | # Check if the payload already has a system message 998 | # If not, add a system message to the payload 999 | if payload.get("messages"): 1000 | for message in payload["messages"]: 1001 | if message.get("role") == "system": 1002 | message["content"] = system + message["content"] 1003 | break 1004 | else: 1005 | payload["messages"].insert( 1006 | 0, 1007 | { 1008 | "role": "system", 1009 | "content": system, 1010 | }, 1011 | ) 1012 | 1013 | if url_idx == None: 1014 | if ":" not in payload["model"]: 1015 | payload["model"] = f"{payload['model']}:latest" 1016 | 1017 | if payload["model"] in app.state.MODELS: 1018 | url_idx = random.choice(app.state.MODELS[payload["model"]]["urls"]) 1019 | else: 1020 | raise HTTPException( 1021 | status_code=400, 1022 | detail=ERROR_MESSAGES.MODEL_NOT_FOUND(form_data.model), 1023 | ) 1024 | 1025 | url = app.state.config.OLLAMA_BASE_URLS[url_idx] 1026 | log.info(f"url: {url}") 1027 | 1028 | return await post_streaming_url( 1029 | f"{url}/v1/chat/completions", 1030 | json.dumps(payload), 1031 | stream=payload.get("stream", False), 1032 | ) 1033 | 1034 | 1035 | @app.get("/v1/models") 1036 | @app.get("/v1/models/{url_idx}") 1037 | async def get_openai_models( 1038 | url_idx: Optional[int] = None, 1039 | user=Depends(get_verified_user), 1040 | ): 1041 | if url_idx == None: 1042 | models = await get_all_models() 1043 | 1044 | if app.state.config.ENABLE_MODEL_FILTER: 1045 | if user.role == "user": 1046 | models["models"] = list( 1047 | filter( 1048 | lambda model: model["name"] 1049 | in app.state.config.MODEL_FILTER_LIST, 1050 | models["models"], 1051 | ) 1052 | ) 1053 | 1054 | return { 1055 | "data": [ 1056 | { 1057 | "id": model["model"], 1058 | "object": "model", 1059 | "created": int(time.time()), 1060 | "owned_by": "openai", 1061 | } 1062 | for model in models["models"] 1063 | ], 1064 | "object": "list", 1065 | } 1066 | 1067 | else: 1068 | url = app.state.config.OLLAMA_BASE_URLS[url_idx] 1069 | try: 1070 | r = requests.request(method="GET", url=f"{url}/api/tags") 1071 | r.raise_for_status() 1072 | 1073 | models = r.json() 1074 | 1075 | return { 1076 | "data": [ 1077 | { 1078 | "id": model["model"], 1079 | "object": "model", 1080 | "created": int(time.time()), 1081 | "owned_by": "openai", 1082 | } 1083 | for model in models["models"] 1084 | ], 1085 | "object": "list", 1086 | } 1087 | 1088 | except Exception as e: 1089 | log.exception(e) 1090 | error_detail = "Open WebUI: Server Connection Error" 1091 | if r is not None: 1092 | try: 1093 | res = r.json() 1094 | if "error" in res: 1095 | error_detail = f"Ollama: {res['error']}" 1096 | except: 1097 | error_detail = f"Ollama: {e}" 1098 | 1099 | raise HTTPException( 1100 | status_code=r.status_code if r else 500, 1101 | detail=error_detail, 1102 | ) 1103 | 1104 | 1105 | class UrlForm(BaseModel): 1106 | url: str 1107 | 1108 | 1109 | class UploadBlobForm(BaseModel): 1110 | filename: str 1111 | 1112 | 1113 | def parse_huggingface_url(hf_url): 1114 | try: 1115 | # Parse the URL 1116 | parsed_url = urlparse(hf_url) 1117 | 1118 | # Get the path and split it into components 1119 | path_components = parsed_url.path.split("/") 1120 | 1121 | # Extract the desired output 1122 | user_repo = "/".join(path_components[1:3]) 1123 | model_file = path_components[-1] 1124 | 1125 | return model_file 1126 | except ValueError: 1127 | return None 1128 | 1129 | 1130 | async def download_file_stream( 1131 | ollama_url, file_url, file_path, file_name, chunk_size=1024 * 1024 1132 | ): 1133 | done = False 1134 | 1135 | if os.path.exists(file_path): 1136 | current_size = os.path.getsize(file_path) 1137 | else: 1138 | current_size = 0 1139 | 1140 | headers = {"Range": f"bytes={current_size}-"} if current_size > 0 else {} 1141 | 1142 | timeout = aiohttp.ClientTimeout(total=600) # Set the timeout 1143 | 1144 | async with aiohttp.ClientSession(timeout=timeout, trust_env=True) as session: 1145 | async with session.get(file_url, headers=headers) as response: 1146 | total_size = int(response.headers.get("content-length", 0)) + current_size 1147 | 1148 | with open(file_path, "ab+") as file: 1149 | async for data in response.content.iter_chunked(chunk_size): 1150 | current_size += len(data) 1151 | file.write(data) 1152 | 1153 | done = current_size == total_size 1154 | progress = round((current_size / total_size) * 100, 2) 1155 | 1156 | yield f'data: {{"progress": {progress}, "completed": {current_size}, "total": {total_size}}}\n\n' 1157 | 1158 | if done: 1159 | file.seek(0) 1160 | hashed = calculate_sha256(file) 1161 | file.seek(0) 1162 | 1163 | url = f"{ollama_url}/api/blobs/sha256:{hashed}" 1164 | response = requests.post(url, data=file) 1165 | 1166 | if response.ok: 1167 | res = { 1168 | "done": done, 1169 | "blob": f"sha256:{hashed}", 1170 | "name": file_name, 1171 | } 1172 | os.remove(file_path) 1173 | 1174 | yield f"data: {json.dumps(res)}\n\n" 1175 | else: 1176 | raise "Ollama: Could not create blob, Please try again." 1177 | 1178 | 1179 | # url = "https://huggingface.co/TheBloke/stablelm-zephyr-3b-GGUF/resolve/main/stablelm-zephyr-3b.Q2_K.gguf" 1180 | @app.post("/models/download") 1181 | @app.post("/models/download/{url_idx}") 1182 | async def download_model( 1183 | form_data: UrlForm, 1184 | url_idx: Optional[int] = None, 1185 | user=Depends(get_admin_user), 1186 | ): 1187 | 1188 | allowed_hosts = ["https://huggingface.co/", "https://github.com/"] 1189 | 1190 | if not any(form_data.url.startswith(host) for host in allowed_hosts): 1191 | raise HTTPException( 1192 | status_code=400, 1193 | detail="Invalid file_url. Only URLs from allowed hosts are permitted.", 1194 | ) 1195 | 1196 | if url_idx == None: 1197 | url_idx = 0 1198 | url = app.state.config.OLLAMA_BASE_URLS[url_idx] 1199 | 1200 | file_name = parse_huggingface_url(form_data.url) 1201 | 1202 | if file_name: 1203 | file_path = f"{UPLOAD_DIR}/{file_name}" 1204 | 1205 | return StreamingResponse( 1206 | download_file_stream(url, form_data.url, file_path, file_name), 1207 | ) 1208 | else: 1209 | return None 1210 | 1211 | 1212 | @app.post("/models/upload") 1213 | @app.post("/models/upload/{url_idx}") 1214 | def upload_model( 1215 | file: UploadFile = File(...), 1216 | url_idx: Optional[int] = None, 1217 | user=Depends(get_admin_user), 1218 | ): 1219 | if url_idx == None: 1220 | url_idx = 0 1221 | ollama_url = app.state.config.OLLAMA_BASE_URLS[url_idx] 1222 | 1223 | file_path = f"{UPLOAD_DIR}/{file.filename}" 1224 | 1225 | # Save file in chunks 1226 | with open(file_path, "wb+") as f: 1227 | for chunk in file.file: 1228 | f.write(chunk) 1229 | 1230 | def file_process_stream(): 1231 | nonlocal ollama_url 1232 | total_size = os.path.getsize(file_path) 1233 | chunk_size = 1024 * 1024 1234 | try: 1235 | with open(file_path, "rb") as f: 1236 | total = 0 1237 | done = False 1238 | 1239 | while not done: 1240 | chunk = f.read(chunk_size) 1241 | if not chunk: 1242 | done = True 1243 | continue 1244 | 1245 | total += len(chunk) 1246 | progress = round((total / total_size) * 100, 2) 1247 | 1248 | res = { 1249 | "progress": progress, 1250 | "total": total_size, 1251 | "completed": total, 1252 | } 1253 | yield f"data: {json.dumps(res)}\n\n" 1254 | 1255 | if done: 1256 | f.seek(0) 1257 | hashed = calculate_sha256(f) 1258 | f.seek(0) 1259 | 1260 | url = f"{ollama_url}/api/blobs/sha256:{hashed}" 1261 | response = requests.post(url, data=f) 1262 | 1263 | if response.ok: 1264 | res = { 1265 | "done": done, 1266 | "blob": f"sha256:{hashed}", 1267 | "name": file.filename, 1268 | } 1269 | os.remove(file_path) 1270 | yield f"data: {json.dumps(res)}\n\n" 1271 | else: 1272 | raise Exception( 1273 | "Ollama: Could not create blob, Please try again." 1274 | ) 1275 | 1276 | except Exception as e: 1277 | res = {"error": str(e)} 1278 | yield f"data: {json.dumps(res)}\n\n" 1279 | 1280 | return StreamingResponse(file_process_stream(), media_type="text/event-stream") ``````` `\\?\D:\Coding\ai\backend\apps\openai\main.py`: ```````py 1 | from fastapi import FastAPI, Request, Response, HTTPException, Depends 2 | from fastapi.middleware.cors import CORSMiddleware 3 | from fastapi.responses import StreamingResponse, JSONResponse, FileResponse 4 | 5 | import requests 6 | import aiohttp 7 | import asyncio 8 | import json 9 | import logging 10 | 11 | from pydantic import BaseModel 12 | from starlette.background import BackgroundTask 13 | 14 | from apps.webui.models.models import Models 15 | from apps.webui.models.users import Users 16 | from constants import ERROR_MESSAGES 17 | from utils.utils import ( 18 | decode_token, 19 | get_verified_user, 20 | get_verified_user, 21 | get_admin_user, 22 | ) 23 | from utils.task import prompt_template 24 | from utils.misc import add_or_update_system_message 25 | 26 | from config import ( 27 | SRC_LOG_LEVELS, 28 | ENABLE_OPENAI_API, 29 | AIOHTTP_CLIENT_TIMEOUT, 30 | OPENAI_API_BASE_URLS, 31 | OPENAI_API_KEYS, 32 | CACHE_DIR, 33 | ENABLE_MODEL_FILTER, 34 | MODEL_FILTER_LIST, 35 | AppConfig, 36 | ) 37 | from typing import List, Optional 38 | 39 | 40 | import hashlib 41 | from pathlib import Path 42 | 43 | log = logging.getLogger(__name__) 44 | log.setLevel(SRC_LOG_LEVELS["OPENAI"]) 45 | 46 | app = FastAPI() 47 | app.add_middleware( 48 | CORSMiddleware, 49 | allow_origins=["*"], 50 | allow_credentials=True, 51 | allow_methods=["*"], 52 | allow_headers=["*"], 53 | ) 54 | 55 | 56 | app.state.config = AppConfig() 57 | 58 | app.state.config.ENABLE_MODEL_FILTER = ENABLE_MODEL_FILTER 59 | app.state.config.MODEL_FILTER_LIST = MODEL_FILTER_LIST 60 | 61 | app.state.config.ENABLE_OPENAI_API = ENABLE_OPENAI_API 62 | app.state.config.OPENAI_API_BASE_URLS = OPENAI_API_BASE_URLS 63 | app.state.config.OPENAI_API_KEYS = OPENAI_API_KEYS 64 | 65 | app.state.MODELS = {} 66 | 67 | 68 | @app.middleware("http") 69 | async def check_url(request: Request, call_next): 70 | if len(app.state.MODELS) == 0: 71 | await get_all_models() 72 | else: 73 | pass 74 | 75 | response = await call_next(request) 76 | return response 77 | 78 | 79 | @app.get("/config") 80 | async def get_config(user=Depends(get_admin_user)): 81 | return {"ENABLE_OPENAI_API": app.state.config.ENABLE_OPENAI_API} 82 | 83 | 84 | class OpenAIConfigForm(BaseModel): 85 | enable_openai_api: Optional[bool] = None 86 | 87 | 88 | @app.post("/config/update") 89 | async def update_config(form_data: OpenAIConfigForm, user=Depends(get_admin_user)): 90 | app.state.config.ENABLE_OPENAI_API = form_data.enable_openai_api 91 | return {"ENABLE_OPENAI_API": app.state.config.ENABLE_OPENAI_API} 92 | 93 | 94 | class UrlsUpdateForm(BaseModel): 95 | urls: List[str] 96 | 97 | 98 | class KeysUpdateForm(BaseModel): 99 | keys: List[str] 100 | 101 | 102 | @app.get("/urls") 103 | async def get_openai_urls(user=Depends(get_admin_user)): 104 | return {"OPENAI_API_BASE_URLS": app.state.config.OPENAI_API_BASE_URLS} 105 | 106 | 107 | @app.post("/urls/update") 108 | async def update_openai_urls(form_data: UrlsUpdateForm, user=Depends(get_admin_user)): 109 | await get_all_models() 110 | app.state.config.OPENAI_API_BASE_URLS = form_data.urls 111 | return {"OPENAI_API_BASE_URLS": app.state.config.OPENAI_API_BASE_URLS} 112 | 113 | 114 | @app.get("/keys") 115 | async def get_openai_keys(user=Depends(get_admin_user)): 116 | return {"OPENAI_API_KEYS": app.state.config.OPENAI_API_KEYS} 117 | 118 | 119 | @app.post("/keys/update") 120 | async def update_openai_key(form_data: KeysUpdateForm, user=Depends(get_admin_user)): 121 | app.state.config.OPENAI_API_KEYS = form_data.keys 122 | return {"OPENAI_API_KEYS": app.state.config.OPENAI_API_KEYS} 123 | 124 | 125 | @app.post("/audio/speech") 126 | async def speech(request: Request, user=Depends(get_verified_user)): 127 | idx = None 128 | try: 129 | idx = app.state.config.OPENAI_API_BASE_URLS.index("https://api.openai.com/v1") 130 | body = await request.body() 131 | name = hashlib.sha256(body).hexdigest() 132 | 133 | SPEECH_CACHE_DIR = Path(CACHE_DIR).joinpath("./audio/speech/") 134 | SPEECH_CACHE_DIR.mkdir(parents=True, exist_ok=True) 135 | file_path = SPEECH_CACHE_DIR.joinpath(f"{name}.mp3") 136 | file_body_path = SPEECH_CACHE_DIR.joinpath(f"{name}.json") 137 | 138 | # Check if the file already exists in the cache 139 | if file_path.is_file(): 140 | return FileResponse(file_path) 141 | 142 | headers = {} 143 | headers["Authorization"] = f"Bearer {app.state.config.OPENAI_API_KEYS[idx]}" 144 | headers["Content-Type"] = "application/json" 145 | if "openrouter.ai" in app.state.config.OPENAI_API_BASE_URLS[idx]: 146 | headers["HTTP-Referer"] = "https://openwebui.com/" 147 | headers["X-Title"] = "Open WebUI" 148 | r = None 149 | try: 150 | r = requests.post( 151 | url=f"{app.state.config.OPENAI_API_BASE_URLS[idx]}/audio/speech", 152 | data=body, 153 | headers=headers, 154 | stream=True, 155 | ) 156 | 157 | r.raise_for_status() 158 | 159 | # Save the streaming content to a file 160 | with open(file_path, "wb") as f: 161 | for chunk in r.iter_content(chunk_size=8192): 162 | f.write(chunk) 163 | 164 | with open(file_body_path, "w") as f: 165 | json.dump(json.loads(body.decode("utf-8")), f) 166 | 167 | # Return the saved file 168 | return FileResponse(file_path) 169 | 170 | except Exception as e: 171 | log.exception(e) 172 | error_detail = "Open WebUI: Server Connection Error" 173 | if r is not None: 174 | try: 175 | res = r.json() 176 | if "error" in res: 177 | error_detail = f"External: {res['error']}" 178 | except: 179 | error_detail = f"External: {e}" 180 | 181 | raise HTTPException( 182 | status_code=r.status_code if r else 500, detail=error_detail 183 | ) 184 | 185 | except ValueError: 186 | raise HTTPException(status_code=401, detail=ERROR_MESSAGES.OPENAI_NOT_FOUND) 187 | 188 | 189 | async def fetch_url(url, key): 190 | timeout = aiohttp.ClientTimeout(total=5) 191 | try: 192 | headers = {"Authorization": f"Bearer {key}"} 193 | async with aiohttp.ClientSession(timeout=timeout, trust_env=True) as session: 194 | async with session.get(url, headers=headers) as response: 195 | return await response.json() 196 | except Exception as e: 197 | # Handle connection error here 198 | log.error(f"Connection error: {e}") 199 | return None 200 | 201 | 202 | async def cleanup_response( 203 | response: Optional[aiohttp.ClientResponse], 204 | session: Optional[aiohttp.ClientSession], 205 | ): 206 | if response: 207 | response.close() 208 | if session: 209 | await session.close() 210 | 211 | 212 | def merge_models_lists(model_lists): 213 | log.debug(f"merge_models_lists {model_lists}") 214 | merged_list = [] 215 | 216 | for idx, models in enumerate(model_lists): 217 | if models is not None and "error" not in models: 218 | merged_list.extend( 219 | [ 220 | { 221 | **model, 222 | "name": model.get("name", model["id"]), 223 | "owned_by": "openai", 224 | "openai": model, 225 | "urlIdx": idx, 226 | } 227 | for model in models 228 | if "api.openai.com" 229 | not in app.state.config.OPENAI_API_BASE_URLS[idx] 230 | or "gpt" in model["id"] 231 | ] 232 | ) 233 | 234 | return merged_list 235 | 236 | 237 | async def get_all_models(raw: bool = False): 238 | log.info("get_all_models()") 239 | 240 | if ( 241 | len(app.state.config.OPENAI_API_KEYS) == 1 242 | and app.state.config.OPENAI_API_KEYS[0] == "" 243 | ) or not app.state.config.ENABLE_OPENAI_API: 244 | models = {"data": []} 245 | else: 246 | # Check if API KEYS length is same than API URLS length 247 | if len(app.state.config.OPENAI_API_KEYS) != len( 248 | app.state.config.OPENAI_API_BASE_URLS 249 | ): 250 | # if there are more keys than urls, remove the extra keys 251 | if len(app.state.config.OPENAI_API_KEYS) > len( 252 | app.state.config.OPENAI_API_BASE_URLS 253 | ): 254 | app.state.config.OPENAI_API_KEYS = app.state.config.OPENAI_API_KEYS[ 255 | : len(app.state.config.OPENAI_API_BASE_URLS) 256 | ] 257 | # if there are more urls than keys, add empty keys 258 | else: 259 | app.state.config.OPENAI_API_KEYS += [ 260 | "" 261 | for _ in range( 262 | len(app.state.config.OPENAI_API_BASE_URLS) 263 | - len(app.state.config.OPENAI_API_KEYS) 264 | ) 265 | ] 266 | 267 | tasks = [ 268 | fetch_url(f"{url}/models", app.state.config.OPENAI_API_KEYS[idx]) 269 | for idx, url in enumerate(app.state.config.OPENAI_API_BASE_URLS) 270 | ] 271 | 272 | responses = await asyncio.gather(*tasks) 273 | log.debug(f"get_all_models:responses() {responses}") 274 | 275 | if raw: 276 | return responses 277 | 278 | models = { 279 | "data": merge_models_lists( 280 | list( 281 | map( 282 | lambda response: ( 283 | response["data"] 284 | if (response and "data" in response) 285 | else (response if isinstance(response, list) else None) 286 | ), 287 | responses, 288 | ) 289 | ) 290 | ) 291 | } 292 | 293 | log.debug(f"models: {models}") 294 | app.state.MODELS = {model["id"]: model for model in models["data"]} 295 | 296 | return models 297 | 298 | 299 | @app.get("/models") 300 | @app.get("/models/{url_idx}") 301 | async def get_models(url_idx: Optional[int] = None, user=Depends(get_verified_user)): 302 | if url_idx == None: 303 | models = await get_all_models() 304 | if app.state.config.ENABLE_MODEL_FILTER: 305 | if user.role == "user": 306 | models["data"] = list( 307 | filter( 308 | lambda model: model["id"] in app.state.config.MODEL_FILTER_LIST, 309 | models["data"], 310 | ) 311 | ) 312 | return models 313 | return models 314 | else: 315 | url = app.state.config.OPENAI_API_BASE_URLS[url_idx] 316 | key = app.state.config.OPENAI_API_KEYS[url_idx] 317 | 318 | headers = {} 319 | headers["Authorization"] = f"Bearer {key}" 320 | headers["Content-Type"] = "application/json" 321 | 322 | r = None 323 | 324 | try: 325 | r = requests.request(method="GET", url=f"{url}/models", headers=headers) 326 | r.raise_for_status() 327 | 328 | response_data = r.json() 329 | if "api.openai.com" in url: 330 | response_data["data"] = list( 331 | filter(lambda model: "gpt" in model["id"], response_data["data"]) 332 | ) 333 | 334 | return response_data 335 | except Exception as e: 336 | log.exception(e) 337 | error_detail = "Open WebUI: Server Connection Error" 338 | if r is not None: 339 | try: 340 | res = r.json() 341 | if "error" in res: 342 | error_detail = f"External: {res['error']}" 343 | except: 344 | error_detail = f"External: {e}" 345 | 346 | raise HTTPException( 347 | status_code=r.status_code if r else 500, 348 | detail=error_detail, 349 | ) 350 | 351 | 352 | @app.post("/chat/completions") 353 | @app.post("/chat/completions/{url_idx}") 354 | async def generate_chat_completion( 355 | form_data: dict, 356 | url_idx: Optional[int] = None, 357 | user=Depends(get_verified_user), 358 | ): 359 | idx = 0 360 | payload = {**form_data} 361 | if "metadata" in payload: 362 | del payload["metadata"] 363 | 364 | model_id = form_data.get("model") 365 | model_info = Models.get_model_by_id(model_id) 366 | 367 | if model_info: 368 | if model_info.base_model_id: 369 | payload["model"] = model_info.base_model_id 370 | 371 | model_info.params = model_info.params.model_dump() 372 | 373 | if model_info.params: 374 | if ( 375 | model_info.params.get("temperature", None) 376 | and payload.get("temperature") is None 377 | ): 378 | payload["temperature"] = float(model_info.params.get("temperature")) 379 | 380 | if model_info.params.get("top_p", None) and payload.get("top_p") is None: 381 | payload["top_p"] = int(model_info.params.get("top_p", None)) 382 | 383 | if ( 384 | model_info.params.get("max_tokens", None) 385 | and payload.get("max_tokens") is None 386 | ): 387 | payload["max_tokens"] = int(model_info.params.get("max_tokens", None)) 388 | 389 | if ( 390 | model_info.params.get("frequency_penalty", None) 391 | and payload.get("frequency_penalty") is None 392 | ): 393 | payload["frequency_penalty"] = int( 394 | model_info.params.get("frequency_penalty", None) 395 | ) 396 | 397 | if model_info.params.get("seed", None) and payload.get("seed") is None: 398 | payload["seed"] = model_info.params.get("seed", None) 399 | 400 | if model_info.params.get("stop", None) and payload.get("stop") is None: 401 | payload["stop"] = ( 402 | [ 403 | bytes(stop, "utf-8").decode("unicode_escape") 404 | for stop in model_info.params["stop"] 405 | ] 406 | if model_info.params.get("stop", None) 407 | else None 408 | ) 409 | 410 | system = model_info.params.get("system", None) 411 | if system: 412 | system = prompt_template( 413 | system, 414 | **( 415 | { 416 | "user_name": user.name, 417 | "user_location": ( 418 | user.info.get("location") if user.info else None 419 | ), 420 | } 421 | if user 422 | else {} 423 | ), 424 | ) 425 | if payload.get("messages"): 426 | payload["messages"] = add_or_update_system_message( 427 | system, payload["messages"] 428 | ) 429 | 430 | else: 431 | pass 432 | 433 | model = app.state.MODELS[payload.get("model")] 434 | idx = model["urlIdx"] 435 | 436 | if "pipeline" in model and model.get("pipeline"): 437 | payload["user"] = { 438 | "name": user.name, 439 | "id": user.id, 440 | "email": user.email, 441 | "role": user.role, 442 | } 443 | 444 | # Check if the model is "gpt-4-vision-preview" and set "max_tokens" to 4000 445 | # This is a workaround until OpenAI fixes the issue with this model 446 | if payload.get("model") == "gpt-4-vision-preview": 447 | if "max_tokens" not in payload: 448 | payload["max_tokens"] = 4000 449 | log.debug("Modified payload:", payload) 450 | 451 | # Convert the modified body back to JSON 452 | payload = json.dumps(payload) 453 | 454 | log.debug(payload) 455 | 456 | url = app.state.config.OPENAI_API_BASE_URLS[idx] 457 | key = app.state.config.OPENAI_API_KEYS[idx] 458 | 459 | headers = {} 460 | headers["Authorization"] = f"Bearer {key}" 461 | headers["Content-Type"] = "application/json" 462 | 463 | r = None 464 | session = None 465 | streaming = False 466 | 467 | try: 468 | session = aiohttp.ClientSession( 469 | trust_env=True, timeout=aiohttp.ClientTimeout(total=AIOHTTP_CLIENT_TIMEOUT) 470 | ) 471 | r = await session.request( 472 | method="POST", 473 | url=f"{url}/chat/completions", 474 | data=payload, 475 | headers=headers, 476 | ) 477 | 478 | r.raise_for_status() 479 | 480 | # Check if response is SSE 481 | if "text/event-stream" in r.headers.get("Content-Type", ""): 482 | streaming = True 483 | return StreamingResponse( 484 | r.content, 485 | status_code=r.status, 486 | headers=dict(r.headers), 487 | background=BackgroundTask( 488 | cleanup_response, response=r, session=session 489 | ), 490 | ) 491 | else: 492 | response_data = await r.json() 493 | return response_data 494 | except Exception as e: 495 | log.exception(e) 496 | error_detail = "Open WebUI: Server Connection Error" 497 | if r is not None: 498 | try: 499 | res = await r.json() 500 | print(res) 501 | if "error" in res: 502 | error_detail = f"External: {res['error']['message'] if 'message' in res['error'] else res['error']}" 503 | except: 504 | error_detail = f"External: {e}" 505 | raise HTTPException(status_code=r.status if r else 500, detail=error_detail) 506 | finally: 507 | if not streaming and session: 508 | if r: 509 | r.close() 510 | await session.close() 511 | 512 | 513 | @app.api_route("/{path:path}", methods=["GET", "POST", "PUT", "DELETE"]) 514 | async def proxy(path: str, request: Request, user=Depends(get_verified_user)): 515 | idx = 0 516 | 517 | body = await request.body() 518 | 519 | url = app.state.config.OPENAI_API_BASE_URLS[idx] 520 | key = app.state.config.OPENAI_API_KEYS[idx] 521 | 522 | target_url = f"{url}/{path}" 523 | 524 | headers = {} 525 | headers["Authorization"] = f"Bearer {key}" 526 | headers["Content-Type"] = "application/json" 527 | 528 | r = None 529 | session = None 530 | streaming = False 531 | 532 | try: 533 | session = aiohttp.ClientSession(trust_env=True) 534 | r = await session.request( 535 | method=request.method, 536 | url=target_url, 537 | data=body, 538 | headers=headers, 539 | ) 540 | 541 | r.raise_for_status() 542 | 543 | # Check if response is SSE 544 | if "text/event-stream" in r.headers.get("Content-Type", ""): 545 | streaming = True 546 | return StreamingResponse( 547 | r.content, 548 | status_code=r.status, 549 | headers=dict(r.headers), 550 | background=BackgroundTask( 551 | cleanup_response, response=r, session=session 552 | ), 553 | ) 554 | else: 555 | response_data = await r.json() 556 | return response_data 557 | except Exception as e: 558 | log.exception(e) 559 | error_detail = "Open WebUI: Server Connection Error" 560 | if r is not None: 561 | try: 562 | res = await r.json() 563 | print(res) 564 | if "error" in res: 565 | error_detail = f"External: {res['error']['message'] if 'message' in res['error'] else res['error']}" 566 | except: 567 | error_detail = f"External: {e}" 568 | raise HTTPException(status_code=r.status if r else 500, detail=error_detail) 569 | finally: 570 | if not streaming and session: 571 | if r: 572 | r.close() 573 | await session.close() ``````` `\\?\D:\Coding\ai\backend\apps\rag\main.py`: ```````py 1 | from fastapi import ( 2 | FastAPI, 3 | Depends, 4 | HTTPException, 5 | status, 6 | UploadFile, 7 | File, 8 | Form, 9 | ) 10 | from fastapi.middleware.cors import CORSMiddleware 11 | import requests 12 | import os, shutil, logging, re 13 | from datetime import datetime 14 | 15 | from pathlib import Path 16 | from typing import List, Union, Sequence, Iterator, Any 17 | 18 | from chromadb.utils.batch_utils import create_batches 19 | from langchain_core.documents import Document 20 | 21 | from langchain_community.document_loaders import ( 22 | WebBaseLoader, 23 | TextLoader, 24 | PyPDFLoader, 25 | CSVLoader, 26 | BSHTMLLoader, 27 | Docx2txtLoader, 28 | UnstructuredEPubLoader, 29 | UnstructuredWordDocumentLoader, 30 | UnstructuredMarkdownLoader, 31 | UnstructuredXMLLoader, 32 | UnstructuredRSTLoader, 33 | UnstructuredExcelLoader, 34 | UnstructuredPowerPointLoader, 35 | YoutubeLoader, 36 | OutlookMessageLoader, 37 | ) 38 | from langchain.text_splitter import RecursiveCharacterTextSplitter 39 | 40 | import validators 41 | import urllib.parse 42 | import socket 43 | 44 | 45 | from pydantic import BaseModel 46 | from typing import Optional 47 | import mimetypes 48 | import uuid 49 | import json 50 | 51 | from apps.webui.models.documents import ( 52 | Documents, 53 | DocumentForm, 54 | DocumentResponse, 55 | ) 56 | from apps.webui.models.files import ( 57 | Files, 58 | ) 59 | 60 | from apps.rag.utils import ( 61 | get_model_path, 62 | get_embedding_function, 63 | query_doc, 64 | query_doc_with_hybrid_search, 65 | query_collection, 66 | query_collection_with_hybrid_search, 67 | ) 68 | 69 | from apps.rag.search.brave import search_brave 70 | from apps.rag.search.google_pse import search_google_pse 71 | from apps.rag.search.main import SearchResult 72 | from apps.rag.search.searxng import search_searxng 73 | from apps.rag.search.serper import search_serper 74 | from apps.rag.search.serpstack import search_serpstack 75 | from apps.rag.search.serply import search_serply 76 | from apps.rag.search.duckduckgo import search_duckduckgo 77 | from apps.rag.search.tavily import search_tavily 78 | from apps.rag.search.jina_search import search_jina 79 | 80 | from utils.misc import ( 81 | calculate_sha256, 82 | calculate_sha256_string, 83 | sanitize_filename, 84 | extract_folders_after_data_docs, 85 | ) 86 | from utils.utils import get_verified_user, get_admin_user 87 | 88 | from config import ( 89 | AppConfig, 90 | ENV, 91 | SRC_LOG_LEVELS, 92 | UPLOAD_DIR, 93 | DOCS_DIR, 94 | CONTENT_EXTRACTION_ENGINE, 95 | TIKA_SERVER_URL, 96 | RAG_TOP_K, 97 | RAG_RELEVANCE_THRESHOLD, 98 | RAG_EMBEDDING_ENGINE, 99 | RAG_EMBEDDING_MODEL, 100 | RAG_EMBEDDING_MODEL_AUTO_UPDATE, 101 | RAG_EMBEDDING_MODEL_TRUST_REMOTE_CODE, 102 | ENABLE_RAG_HYBRID_SEARCH, 103 | ENABLE_RAG_WEB_LOADER_SSL_VERIFICATION, 104 | RAG_RERANKING_MODEL, 105 | PDF_EXTRACT_IMAGES, 106 | RAG_RERANKING_MODEL_AUTO_UPDATE, 107 | RAG_RERANKING_MODEL_TRUST_REMOTE_CODE, 108 | RAG_OPENAI_API_BASE_URL, 109 | RAG_OPENAI_API_KEY, 110 | DEVICE_TYPE, 111 | CHROMA_CLIENT, 112 | CHUNK_SIZE, 113 | CHUNK_OVERLAP, 114 | RAG_TEMPLATE, 115 | ENABLE_RAG_LOCAL_WEB_FETCH, 116 | YOUTUBE_LOADER_LANGUAGE, 117 | ENABLE_RAG_WEB_SEARCH, 118 | RAG_WEB_SEARCH_ENGINE, 119 | RAG_WEB_SEARCH_DOMAIN_FILTER_LIST, 120 | SEARXNG_QUERY_URL, 121 | GOOGLE_PSE_API_KEY, 122 | GOOGLE_PSE_ENGINE_ID, 123 | BRAVE_SEARCH_API_KEY, 124 | SERPSTACK_API_KEY, 125 | SERPSTACK_HTTPS, 126 | SERPER_API_KEY, 127 | SERPLY_API_KEY, 128 | TAVILY_API_KEY, 129 | RAG_WEB_SEARCH_RESULT_COUNT, 130 | RAG_WEB_SEARCH_CONCURRENT_REQUESTS, 131 | RAG_EMBEDDING_OPENAI_BATCH_SIZE, 132 | ) 133 | 134 | from constants import ERROR_MESSAGES 135 | 136 | log = logging.getLogger(__name__) 137 | log.setLevel(SRC_LOG_LEVELS["RAG"]) 138 | 139 | app = FastAPI() 140 | 141 | app.state.config = AppConfig() 142 | 143 | app.state.config.TOP_K = RAG_TOP_K 144 | app.state.config.RELEVANCE_THRESHOLD = RAG_RELEVANCE_THRESHOLD 145 | 146 | app.state.config.ENABLE_RAG_HYBRID_SEARCH = ENABLE_RAG_HYBRID_SEARCH 147 | app.state.config.ENABLE_RAG_WEB_LOADER_SSL_VERIFICATION = ( 148 | ENABLE_RAG_WEB_LOADER_SSL_VERIFICATION 149 | ) 150 | 151 | app.state.config.CONTENT_EXTRACTION_ENGINE = CONTENT_EXTRACTION_ENGINE 152 | app.state.config.TIKA_SERVER_URL = TIKA_SERVER_URL 153 | 154 | app.state.config.CHUNK_SIZE = CHUNK_SIZE 155 | app.state.config.CHUNK_OVERLAP = CHUNK_OVERLAP 156 | 157 | app.state.config.RAG_EMBEDDING_ENGINE = RAG_EMBEDDING_ENGINE 158 | app.state.config.RAG_EMBEDDING_MODEL = RAG_EMBEDDING_MODEL 159 | app.state.config.RAG_EMBEDDING_OPENAI_BATCH_SIZE = RAG_EMBEDDING_OPENAI_BATCH_SIZE 160 | app.state.config.RAG_RERANKING_MODEL = RAG_RERANKING_MODEL 161 | app.state.config.RAG_TEMPLATE = RAG_TEMPLATE 162 | 163 | 164 | app.state.config.OPENAI_API_BASE_URL = RAG_OPENAI_API_BASE_URL 165 | app.state.config.OPENAI_API_KEY = RAG_OPENAI_API_KEY 166 | 167 | app.state.config.PDF_EXTRACT_IMAGES = PDF_EXTRACT_IMAGES 168 | 169 | 170 | app.state.config.YOUTUBE_LOADER_LANGUAGE = YOUTUBE_LOADER_LANGUAGE 171 | app.state.YOUTUBE_LOADER_TRANSLATION = None 172 | 173 | 174 | app.state.config.ENABLE_RAG_WEB_SEARCH = ENABLE_RAG_WEB_SEARCH 175 | app.state.config.RAG_WEB_SEARCH_ENGINE = RAG_WEB_SEARCH_ENGINE 176 | app.state.config.RAG_WEB_SEARCH_DOMAIN_FILTER_LIST = RAG_WEB_SEARCH_DOMAIN_FILTER_LIST 177 | 178 | app.state.config.SEARXNG_QUERY_URL = SEARXNG_QUERY_URL 179 | app.state.config.GOOGLE_PSE_API_KEY = GOOGLE_PSE_API_KEY 180 | app.state.config.GOOGLE_PSE_ENGINE_ID = GOOGLE_PSE_ENGINE_ID 181 | app.state.config.BRAVE_SEARCH_API_KEY = BRAVE_SEARCH_API_KEY 182 | app.state.config.SERPSTACK_API_KEY = SERPSTACK_API_KEY 183 | app.state.config.SERPSTACK_HTTPS = SERPSTACK_HTTPS 184 | app.state.config.SERPER_API_KEY = SERPER_API_KEY 185 | app.state.config.SERPLY_API_KEY = SERPLY_API_KEY 186 | app.state.config.TAVILY_API_KEY = TAVILY_API_KEY 187 | app.state.config.RAG_WEB_SEARCH_RESULT_COUNT = RAG_WEB_SEARCH_RESULT_COUNT 188 | app.state.config.RAG_WEB_SEARCH_CONCURRENT_REQUESTS = RAG_WEB_SEARCH_CONCURRENT_REQUESTS 189 | 190 | 191 | def update_embedding_model( 192 | embedding_model: str, 193 | update_model: bool = False, 194 | ): 195 | if embedding_model and app.state.config.RAG_EMBEDDING_ENGINE == "": 196 | import sentence_transformers 197 | 198 | app.state.sentence_transformer_ef = sentence_transformers.SentenceTransformer( 199 | get_model_path(embedding_model, update_model), 200 | device=DEVICE_TYPE, 201 | trust_remote_code=RAG_EMBEDDING_MODEL_TRUST_REMOTE_CODE, 202 | ) 203 | else: 204 | app.state.sentence_transformer_ef = None 205 | 206 | 207 | def update_reranking_model( 208 | reranking_model: str, 209 | update_model: bool = False, 210 | ): 211 | if reranking_model: 212 | import sentence_transformers 213 | 214 | app.state.sentence_transformer_rf = sentence_transformers.CrossEncoder( 215 | get_model_path(reranking_model, update_model), 216 | device=DEVICE_TYPE, 217 | trust_remote_code=RAG_RERANKING_MODEL_TRUST_REMOTE_CODE, 218 | ) 219 | else: 220 | app.state.sentence_transformer_rf = None 221 | 222 | 223 | update_embedding_model( 224 | app.state.config.RAG_EMBEDDING_MODEL, 225 | RAG_EMBEDDING_MODEL_AUTO_UPDATE, 226 | ) 227 | 228 | update_reranking_model( 229 | app.state.config.RAG_RERANKING_MODEL, 230 | RAG_RERANKING_MODEL_AUTO_UPDATE, 231 | ) 232 | 233 | 234 | app.state.EMBEDDING_FUNCTION = get_embedding_function( 235 | app.state.config.RAG_EMBEDDING_ENGINE, 236 | app.state.config.RAG_EMBEDDING_MODEL, 237 | app.state.sentence_transformer_ef, 238 | app.state.config.OPENAI_API_KEY, 239 | app.state.config.OPENAI_API_BASE_URL, 240 | app.state.config.RAG_EMBEDDING_OPENAI_BATCH_SIZE, 241 | ) 242 | 243 | origins = ["*"] 244 | 245 | 246 | app.add_middleware( 247 | CORSMiddleware, 248 | allow_origins=origins, 249 | allow_credentials=True, 250 | allow_methods=["*"], 251 | allow_headers=["*"], 252 | ) 253 | 254 | 255 | class CollectionNameForm(BaseModel): 256 | collection_name: Optional[str] = "test" 257 | 258 | 259 | class UrlForm(CollectionNameForm): 260 | url: str 261 | 262 | 263 | class SearchForm(CollectionNameForm): 264 | query: str 265 | 266 | 267 | @app.get("/") 268 | async def get_status(): 269 | return { 270 | "status": True, 271 | "chunk_size": app.state.config.CHUNK_SIZE, 272 | "chunk_overlap": app.state.config.CHUNK_OVERLAP, 273 | "template": app.state.config.RAG_TEMPLATE, 274 | "embedding_engine": app.state.config.RAG_EMBEDDING_ENGINE, 275 | "embedding_model": app.state.config.RAG_EMBEDDING_MODEL, 276 | "reranking_model": app.state.config.RAG_RERANKING_MODEL, 277 | "openai_batch_size": app.state.config.RAG_EMBEDDING_OPENAI_BATCH_SIZE, 278 | } 279 | 280 | 281 | @app.get("/embedding") 282 | async def get_embedding_config(user=Depends(get_admin_user)): 283 | return { 284 | "status": True, 285 | "embedding_engine": app.state.config.RAG_EMBEDDING_ENGINE, 286 | "embedding_model": app.state.config.RAG_EMBEDDING_MODEL, 287 | "openai_config": { 288 | "url": app.state.config.OPENAI_API_BASE_URL, 289 | "key": app.state.config.OPENAI_API_KEY, 290 | "batch_size": app.state.config.RAG_EMBEDDING_OPENAI_BATCH_SIZE, 291 | }, 292 | } 293 | 294 | 295 | @app.get("/reranking") 296 | async def get_reraanking_config(user=Depends(get_admin_user)): 297 | return { 298 | "status": True, 299 | "reranking_model": app.state.config.RAG_RERANKING_MODEL, 300 | } 301 | 302 | 303 | class OpenAIConfigForm(BaseModel): 304 | url: str 305 | key: str 306 | batch_size: Optional[int] = None 307 | 308 | 309 | class EmbeddingModelUpdateForm(BaseModel): 310 | openai_config: Optional[OpenAIConfigForm] = None 311 | embedding_engine: str 312 | embedding_model: str 313 | 314 | 315 | @app.post("/embedding/update") 316 | async def update_embedding_config( 317 | form_data: EmbeddingModelUpdateForm, user=Depends(get_admin_user) 318 | ): 319 | log.info( 320 | f"Updating embedding model: {app.state.config.RAG_EMBEDDING_MODEL} to {form_data.embedding_model}" 321 | ) 322 | try: 323 | app.state.config.RAG_EMBEDDING_ENGINE = form_data.embedding_engine 324 | app.state.config.RAG_EMBEDDING_MODEL = form_data.embedding_model 325 | 326 | if app.state.config.RAG_EMBEDDING_ENGINE in ["ollama", "openai"]: 327 | if form_data.openai_config is not None: 328 | app.state.config.OPENAI_API_BASE_URL = form_data.openai_config.url 329 | app.state.config.OPENAI_API_KEY = form_data.openai_config.key 330 | app.state.config.RAG_EMBEDDING_OPENAI_BATCH_SIZE = ( 331 | form_data.openai_config.batch_size 332 | if form_data.openai_config.batch_size 333 | else 1 334 | ) 335 | 336 | update_embedding_model(app.state.config.RAG_EMBEDDING_MODEL) 337 | 338 | app.state.EMBEDDING_FUNCTION = get_embedding_function( 339 | app.state.config.RAG_EMBEDDING_ENGINE, 340 | app.state.config.RAG_EMBEDDING_MODEL, 341 | app.state.sentence_transformer_ef, 342 | app.state.config.OPENAI_API_KEY, 343 | app.state.config.OPENAI_API_BASE_URL, 344 | app.state.config.RAG_EMBEDDING_OPENAI_BATCH_SIZE, 345 | ) 346 | 347 | return { 348 | "status": True, 349 | "embedding_engine": app.state.config.RAG_EMBEDDING_ENGINE, 350 | "embedding_model": app.state.config.RAG_EMBEDDING_MODEL, 351 | "openai_config": { 352 | "url": app.state.config.OPENAI_API_BASE_URL, 353 | "key": app.state.config.OPENAI_API_KEY, 354 | "batch_size": app.state.config.RAG_EMBEDDING_OPENAI_BATCH_SIZE, 355 | }, 356 | } 357 | except Exception as e: 358 | log.exception(f"Problem updating embedding model: {e}") 359 | raise HTTPException( 360 | status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, 361 | detail=ERROR_MESSAGES.DEFAULT(e), 362 | ) 363 | 364 | 365 | class RerankingModelUpdateForm(BaseModel): 366 | reranking_model: str 367 | 368 | 369 | @app.post("/reranking/update") 370 | async def update_reranking_config( 371 | form_data: RerankingModelUpdateForm, user=Depends(get_admin_user) 372 | ): 373 | log.info( 374 | f"Updating reranking model: {app.state.config.RAG_RERANKING_MODEL} to {form_data.reranking_model}" 375 | ) 376 | try: 377 | app.state.config.RAG_RERANKING_MODEL = form_data.reranking_model 378 | 379 | update_reranking_model(app.state.config.RAG_RERANKING_MODEL), True 380 | 381 | return { 382 | "status": True, 383 | "reranking_model": app.state.config.RAG_RERANKING_MODEL, 384 | } 385 | except Exception as e: 386 | log.exception(f"Problem updating reranking model: {e}") 387 | raise HTTPException( 388 | status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, 389 | detail=ERROR_MESSAGES.DEFAULT(e), 390 | ) 391 | 392 | 393 | @app.get("/config") 394 | async def get_rag_config(user=Depends(get_admin_user)): 395 | return { 396 | "status": True, 397 | "pdf_extract_images": app.state.config.PDF_EXTRACT_IMAGES, 398 | "content_extraction": { 399 | "engine": app.state.config.CONTENT_EXTRACTION_ENGINE, 400 | "tika_server_url": app.state.config.TIKA_SERVER_URL, 401 | }, 402 | "chunk": { 403 | "chunk_size": app.state.config.CHUNK_SIZE, 404 | "chunk_overlap": app.state.config.CHUNK_OVERLAP, 405 | }, 406 | "youtube": { 407 | "language": app.state.config.YOUTUBE_LOADER_LANGUAGE, 408 | "translation": app.state.YOUTUBE_LOADER_TRANSLATION, 409 | }, 410 | "web": { 411 | "ssl_verification": app.state.config.ENABLE_RAG_WEB_LOADER_SSL_VERIFICATION, 412 | "search": { 413 | "enabled": app.state.config.ENABLE_RAG_WEB_SEARCH, 414 | "engine": app.state.config.RAG_WEB_SEARCH_ENGINE, 415 | "searxng_query_url": app.state.config.SEARXNG_QUERY_URL, 416 | "google_pse_api_key": app.state.config.GOOGLE_PSE_API_KEY, 417 | "google_pse_engine_id": app.state.config.GOOGLE_PSE_ENGINE_ID, 418 | "brave_search_api_key": app.state.config.BRAVE_SEARCH_API_KEY, 419 | "serpstack_api_key": app.state.config.SERPSTACK_API_KEY, 420 | "serpstack_https": app.state.config.SERPSTACK_HTTPS, 421 | "serper_api_key": app.state.config.SERPER_API_KEY, 422 | "serply_api_key": app.state.config.SERPLY_API_KEY, 423 | "tavily_api_key": app.state.config.TAVILY_API_KEY, 424 | "result_count": app.state.config.RAG_WEB_SEARCH_RESULT_COUNT, 425 | "concurrent_requests": app.state.config.RAG_WEB_SEARCH_CONCURRENT_REQUESTS, 426 | }, 427 | }, 428 | } 429 | 430 | 431 | class ContentExtractionConfig(BaseModel): 432 | engine: str = "" 433 | tika_server_url: Optional[str] = None 434 | 435 | 436 | class ChunkParamUpdateForm(BaseModel): 437 | chunk_size: int 438 | chunk_overlap: int 439 | 440 | 441 | class YoutubeLoaderConfig(BaseModel): 442 | language: List[str] 443 | translation: Optional[str] = None 444 | 445 | 446 | class WebSearchConfig(BaseModel): 447 | enabled: bool 448 | engine: Optional[str] = None 449 | searxng_query_url: Optional[str] = None 450 | google_pse_api_key: Optional[str] = None 451 | google_pse_engine_id: Optional[str] = None 452 | brave_search_api_key: Optional[str] = None 453 | serpstack_api_key: Optional[str] = None 454 | serpstack_https: Optional[bool] = None 455 | serper_api_key: Optional[str] = None 456 | serply_api_key: Optional[str] = None 457 | tavily_api_key: Optional[str] = None 458 | result_count: Optional[int] = None 459 | concurrent_requests: Optional[int] = None 460 | 461 | 462 | class WebConfig(BaseModel): 463 | search: WebSearchConfig 464 | web_loader_ssl_verification: Optional[bool] = None 465 | 466 | 467 | class ConfigUpdateForm(BaseModel): 468 | pdf_extract_images: Optional[bool] = None 469 | content_extraction: Optional[ContentExtractionConfig] = None 470 | chunk: Optional[ChunkParamUpdateForm] = None 471 | youtube: Optional[YoutubeLoaderConfig] = None 472 | web: Optional[WebConfig] = None 473 | 474 | 475 | @app.post("/config/update") 476 | async def update_rag_config(form_data: ConfigUpdateForm, user=Depends(get_admin_user)): 477 | app.state.config.PDF_EXTRACT_IMAGES = ( 478 | form_data.pdf_extract_images 479 | if form_data.pdf_extract_images is not None 480 | else app.state.config.PDF_EXTRACT_IMAGES 481 | ) 482 | 483 | if form_data.content_extraction is not None: 484 | log.info(f"Updating text settings: {form_data.content_extraction}") 485 | app.state.config.CONTENT_EXTRACTION_ENGINE = form_data.content_extraction.engine 486 | app.state.config.TIKA_SERVER_URL = form_data.content_extraction.tika_server_url 487 | 488 | if form_data.chunk is not None: 489 | app.state.config.CHUNK_SIZE = form_data.chunk.chunk_size 490 | app.state.config.CHUNK_OVERLAP = form_data.chunk.chunk_overlap 491 | 492 | if form_data.youtube is not None: 493 | app.state.config.YOUTUBE_LOADER_LANGUAGE = form_data.youtube.language 494 | app.state.YOUTUBE_LOADER_TRANSLATION = form_data.youtube.translation 495 | 496 | if form_data.web is not None: 497 | app.state.config.ENABLE_RAG_WEB_LOADER_SSL_VERIFICATION = ( 498 | form_data.web.web_loader_ssl_verification 499 | ) 500 | 501 | app.state.config.ENABLE_RAG_WEB_SEARCH = form_data.web.search.enabled 502 | app.state.config.RAG_WEB_SEARCH_ENGINE = form_data.web.search.engine 503 | app.state.config.SEARXNG_QUERY_URL = form_data.web.search.searxng_query_url 504 | app.state.config.GOOGLE_PSE_API_KEY = form_data.web.search.google_pse_api_key 505 | app.state.config.GOOGLE_PSE_ENGINE_ID = ( 506 | form_data.web.search.google_pse_engine_id 507 | ) 508 | app.state.config.BRAVE_SEARCH_API_KEY = ( 509 | form_data.web.search.brave_search_api_key 510 | ) 511 | app.state.config.SERPSTACK_API_KEY = form_data.web.search.serpstack_api_key 512 | app.state.config.SERPSTACK_HTTPS = form_data.web.search.serpstack_https 513 | app.state.config.SERPER_API_KEY = form_data.web.search.serper_api_key 514 | app.state.config.SERPLY_API_KEY = form_data.web.search.serply_api_key 515 | app.state.config.TAVILY_API_KEY = form_data.web.search.tavily_api_key 516 | app.state.config.RAG_WEB_SEARCH_RESULT_COUNT = form_data.web.search.result_count 517 | app.state.config.RAG_WEB_SEARCH_CONCURRENT_REQUESTS = ( 518 | form_data.web.search.concurrent_requests 519 | ) 520 | 521 | return { 522 | "status": True, 523 | "pdf_extract_images": app.state.config.PDF_EXTRACT_IMAGES, 524 | "content_extraction": { 525 | "engine": app.state.config.CONTENT_EXTRACTION_ENGINE, 526 | "tika_server_url": app.state.config.TIKA_SERVER_URL, 527 | }, 528 | "chunk": { 529 | "chunk_size": app.state.config.CHUNK_SIZE, 530 | "chunk_overlap": app.state.config.CHUNK_OVERLAP, 531 | }, 532 | "youtube": { 533 | "language": app.state.config.YOUTUBE_LOADER_LANGUAGE, 534 | "translation": app.state.YOUTUBE_LOADER_TRANSLATION, 535 | }, 536 | "web": { 537 | "ssl_verification": app.state.config.ENABLE_RAG_WEB_LOADER_SSL_VERIFICATION, 538 | "search": { 539 | "enabled": app.state.config.ENABLE_RAG_WEB_SEARCH, 540 | "engine": app.state.config.RAG_WEB_SEARCH_ENGINE, 541 | "searxng_query_url": app.state.config.SEARXNG_QUERY_URL, 542 | "google_pse_api_key": app.state.config.GOOGLE_PSE_API_KEY, 543 | "google_pse_engine_id": app.state.config.GOOGLE_PSE_ENGINE_ID, 544 | "brave_search_api_key": app.state.config.BRAVE_SEARCH_API_KEY, 545 | "serpstack_api_key": app.state.config.SERPSTACK_API_KEY, 546 | "serpstack_https": app.state.config.SERPSTACK_HTTPS, 547 | "serper_api_key": app.state.config.SERPER_API_KEY, 548 | "serply_api_key": app.state.config.SERPLY_API_KEY, 549 | "tavily_api_key": app.state.config.TAVILY_API_KEY, 550 | "result_count": app.state.config.RAG_WEB_SEARCH_RESULT_COUNT, 551 | "concurrent_requests": app.state.config.RAG_WEB_SEARCH_CONCURRENT_REQUESTS, 552 | }, 553 | }, 554 | } 555 | 556 | 557 | @app.get("/template") 558 | async def get_rag_template(user=Depends(get_verified_user)): 559 | return { 560 | "status": True, 561 | "template": app.state.config.RAG_TEMPLATE, 562 | } 563 | 564 | 565 | @app.get("/query/settings") 566 | async def get_query_settings(user=Depends(get_admin_user)): 567 | return { 568 | "status": True, 569 | "template": app.state.config.RAG_TEMPLATE, 570 | "k": app.state.config.TOP_K, 571 | "r": app.state.config.RELEVANCE_THRESHOLD, 572 | "hybrid": app.state.config.ENABLE_RAG_HYBRID_SEARCH, 573 | } 574 | 575 | 576 | class QuerySettingsForm(BaseModel): 577 | k: Optional[int] = None 578 | r: Optional[float] = None 579 | template: Optional[str] = None 580 | hybrid: Optional[bool] = None 581 | 582 | 583 | @app.post("/query/settings/update") 584 | async def update_query_settings( 585 | form_data: QuerySettingsForm, user=Depends(get_admin_user) 586 | ): 587 | app.state.config.RAG_TEMPLATE = ( 588 | form_data.template if form_data.template else RAG_TEMPLATE 589 | ) 590 | app.state.config.TOP_K = form_data.k if form_data.k else 4 591 | app.state.config.RELEVANCE_THRESHOLD = form_data.r if form_data.r else 0.0 592 | app.state.config.ENABLE_RAG_HYBRID_SEARCH = ( 593 | form_data.hybrid if form_data.hybrid else False 594 | ) 595 | return { 596 | "status": True, 597 | "template": app.state.config.RAG_TEMPLATE, 598 | "k": app.state.config.TOP_K, 599 | "r": app.state.config.RELEVANCE_THRESHOLD, 600 | "hybrid": app.state.config.ENABLE_RAG_HYBRID_SEARCH, 601 | } 602 | 603 | 604 | class QueryDocForm(BaseModel): 605 | collection_name: str 606 | query: str 607 | k: Optional[int] = None 608 | r: Optional[float] = None 609 | hybrid: Optional[bool] = None 610 | 611 | 612 | @app.post("/query/doc") 613 | def query_doc_handler( 614 | form_data: QueryDocForm, 615 | user=Depends(get_verified_user), 616 | ): 617 | try: 618 | if app.state.config.ENABLE_RAG_HYBRID_SEARCH: 619 | return query_doc_with_hybrid_search( 620 | collection_name=form_data.collection_name, 621 | query=form_data.query, 622 | embedding_function=app.state.EMBEDDING_FUNCTION, 623 | k=form_data.k if form_data.k else app.state.config.TOP_K, 624 | reranking_function=app.state.sentence_transformer_rf, 625 | r=( 626 | form_data.r if form_data.r else app.state.config.RELEVANCE_THRESHOLD 627 | ), 628 | ) 629 | else: 630 | return query_doc( 631 | collection_name=form_data.collection_name, 632 | query=form_data.query, 633 | embedding_function=app.state.EMBEDDING_FUNCTION, 634 | k=form_data.k if form_data.k else app.state.config.TOP_K, 635 | ) 636 | except Exception as e: 637 | log.exception(e) 638 | raise HTTPException( 639 | status_code=status.HTTP_400_BAD_REQUEST, 640 | detail=ERROR_MESSAGES.DEFAULT(e), 641 | ) 642 | 643 | 644 | class QueryCollectionsForm(BaseModel): 645 | collection_names: List[str] 646 | query: str 647 | k: Optional[int] = None 648 | r: Optional[float] = None 649 | hybrid: Optional[bool] = None 650 | 651 | 652 | @app.post("/query/collection") 653 | def query_collection_handler( 654 | form_data: QueryCollectionsForm, 655 | user=Depends(get_verified_user), 656 | ): 657 | try: 658 | if app.state.config.ENABLE_RAG_HYBRID_SEARCH: 659 | return query_collection_with_hybrid_search( 660 | collection_names=form_data.collection_names, 661 | query=form_data.query, 662 | embedding_function=app.state.EMBEDDING_FUNCTION, 663 | k=form_data.k if form_data.k else app.state.config.TOP_K, 664 | reranking_function=app.state.sentence_transformer_rf, 665 | r=( 666 | form_data.r if form_data.r else app.state.config.RELEVANCE_THRESHOLD 667 | ), 668 | ) 669 | else: 670 | return query_collection( 671 | collection_names=form_data.collection_names, 672 | query=form_data.query, 673 | embedding_function=app.state.EMBEDDING_FUNCTION, 674 | k=form_data.k if form_data.k else app.state.config.TOP_K, 675 | ) 676 | 677 | except Exception as e: 678 | log.exception(e) 679 | raise HTTPException( 680 | status_code=status.HTTP_400_BAD_REQUEST, 681 | detail=ERROR_MESSAGES.DEFAULT(e), 682 | ) 683 | 684 | 685 | @app.post("/youtube") 686 | def store_youtube_video(form_data: UrlForm, user=Depends(get_verified_user)): 687 | try: 688 | loader = YoutubeLoader.from_youtube_url( 689 | form_data.url, 690 | add_video_info=True, 691 | language=app.state.config.YOUTUBE_LOADER_LANGUAGE, 692 | translation=app.state.YOUTUBE_LOADER_TRANSLATION, 693 | ) 694 | data = loader.load() 695 | 696 | collection_name = form_data.collection_name 697 | if collection_name == "": 698 | collection_name = calculate_sha256_string(form_data.url)[:63] 699 | 700 | store_data_in_vector_db(data, collection_name, overwrite=True) 701 | return { 702 | "status": True, 703 | "collection_name": collection_name, 704 | "filename": form_data.url, 705 | } 706 | except Exception as e: 707 | log.exception(e) 708 | raise HTTPException( 709 | status_code=status.HTTP_400_BAD_REQUEST, 710 | detail=ERROR_MESSAGES.DEFAULT(e), 711 | ) 712 | 713 | 714 | @app.post("/web") 715 | def store_web(form_data: UrlForm, user=Depends(get_verified_user)): 716 | # "https://www.gutenberg.org/files/1727/1727-h/1727-h.htm" 717 | try: 718 | loader = get_web_loader( 719 | form_data.url, 720 | verify_ssl=app.state.config.ENABLE_RAG_WEB_LOADER_SSL_VERIFICATION, 721 | ) 722 | data = loader.load() 723 | 724 | collection_name = form_data.collection_name 725 | if collection_name == "": 726 | collection_name = calculate_sha256_string(form_data.url)[:63] 727 | 728 | store_data_in_vector_db(data, collection_name, overwrite=True) 729 | return { 730 | "status": True, 731 | "collection_name": collection_name, 732 | "filename": form_data.url, 733 | } 734 | except Exception as e: 735 | log.exception(e) 736 | raise HTTPException( 737 | status_code=status.HTTP_400_BAD_REQUEST, 738 | detail=ERROR_MESSAGES.DEFAULT(e), 739 | ) 740 | 741 | 742 | def get_web_loader(url: Union[str, Sequence[str]], verify_ssl: bool = True): 743 | # Check if the URL is valid 744 | if not validate_url(url): 745 | raise ValueError(ERROR_MESSAGES.INVALID_URL) 746 | return SafeWebBaseLoader( 747 | url, 748 | verify_ssl=verify_ssl, 749 | requests_per_second=RAG_WEB_SEARCH_CONCURRENT_REQUESTS, 750 | continue_on_failure=True, 751 | ) 752 | 753 | 754 | def validate_url(url: Union[str, Sequence[str]]): 755 | if isinstance(url, str): 756 | if isinstance(validators.url(url), validators.ValidationError): 757 | raise ValueError(ERROR_MESSAGES.INVALID_URL) 758 | if not ENABLE_RAG_LOCAL_WEB_FETCH: 759 | # Local web fetch is disabled, filter out any URLs that resolve to private IP addresses 760 | parsed_url = urllib.parse.urlparse(url) 761 | # Get IPv4 and IPv6 addresses 762 | ipv4_addresses, ipv6_addresses = resolve_hostname(parsed_url.hostname) 763 | # Check if any of the resolved addresses are private 764 | # This is technically still vulnerable to DNS rebinding attacks, as we don't control WebBaseLoader 765 | for ip in ipv4_addresses: 766 | if validators.ipv4(ip, private=True): 767 | raise ValueError(ERROR_MESSAGES.INVALID_URL) 768 | for ip in ipv6_addresses: 769 | if validators.ipv6(ip, private=True): 770 | raise ValueError(ERROR_MESSAGES.INVALID_URL) 771 | return True 772 | elif isinstance(url, Sequence): 773 | return all(validate_url(u) for u in url) 774 | else: 775 | return False 776 | 777 | 778 | def resolve_hostname(hostname): 779 | # Get address information 780 | addr_info = socket.getaddrinfo(hostname, None) 781 | 782 | # Extract IP addresses from address information 783 | ipv4_addresses = [info[4][0] for info in addr_info if info[0] == socket.AF_INET] 784 | ipv6_addresses = [info[4][0] for info in addr_info if info[0] == socket.AF_INET6] 785 | 786 | return ipv4_addresses, ipv6_addresses 787 | 788 | 789 | def search_web(engine: str, query: str) -> list[SearchResult]: 790 | """Search the web using a search engine and return the results as a list of SearchResult objects. 791 | Will look for a search engine API key in environment variables in the following order: 792 | - SEARXNG_QUERY_URL 793 | - GOOGLE_PSE_API_KEY + GOOGLE_PSE_ENGINE_ID 794 | - BRAVE_SEARCH_API_KEY 795 | - SERPSTACK_API_KEY 796 | - SERPER_API_KEY 797 | - SERPLY_API_KEY 798 | - TAVILY_API_KEY 799 | Args: 800 | query (str): The query to search for 801 | """ 802 | 803 | # TODO: add playwright to search the web 804 | if engine == "searxng": 805 | if app.state.config.SEARXNG_QUERY_URL: 806 | return search_searxng( 807 | app.state.config.SEARXNG_QUERY_URL, 808 | query, 809 | app.state.config.RAG_WEB_SEARCH_RESULT_COUNT, 810 | app.state.config.RAG_WEB_SEARCH_DOMAIN_FILTER_LIST, 811 | ) 812 | else: 813 | raise Exception("No SEARXNG_QUERY_URL found in environment variables") 814 | elif engine == "google_pse": 815 | if ( 816 | app.state.config.GOOGLE_PSE_API_KEY 817 | and app.state.config.GOOGLE_PSE_ENGINE_ID 818 | ): 819 | return search_google_pse( 820 | app.state.config.GOOGLE_PSE_API_KEY, 821 | app.state.config.GOOGLE_PSE_ENGINE_ID, 822 | query, 823 | app.state.config.RAG_WEB_SEARCH_RESULT_COUNT, 824 | app.state.config.RAG_WEB_SEARCH_DOMAIN_FILTER_LIST, 825 | ) 826 | else: 827 | raise Exception( 828 | "No GOOGLE_PSE_API_KEY or GOOGLE_PSE_ENGINE_ID found in environment variables" 829 | ) 830 | elif engine == "brave": 831 | if app.state.config.BRAVE_SEARCH_API_KEY: 832 | return search_brave( 833 | app.state.config.BRAVE_SEARCH_API_KEY, 834 | query, 835 | app.state.config.RAG_WEB_SEARCH_RESULT_COUNT, 836 | app.state.config.RAG_WEB_SEARCH_DOMAIN_FILTER_LIST, 837 | ) 838 | else: 839 | raise Exception("No BRAVE_SEARCH_API_KEY found in environment variables") 840 | elif engine == "serpstack": 841 | if app.state.config.SERPSTACK_API_KEY: 842 | return search_serpstack( 843 | app.state.config.SERPSTACK_API_KEY, 844 | query, 845 | app.state.config.RAG_WEB_SEARCH_RESULT_COUNT, 846 | app.state.config.RAG_WEB_SEARCH_DOMAIN_FILTER_LIST, 847 | https_enabled=app.state.config.SERPSTACK_HTTPS, 848 | ) 849 | else: 850 | raise Exception("No SERPSTACK_API_KEY found in environment variables") 851 | elif engine == "serper": 852 | if app.state.config.SERPER_API_KEY: 853 | return search_serper( 854 | app.state.config.SERPER_API_KEY, 855 | query, 856 | app.state.config.RAG_WEB_SEARCH_RESULT_COUNT, 857 | app.state.config.RAG_WEB_SEARCH_DOMAIN_FILTER_LIST, 858 | ) 859 | else: 860 | raise Exception("No SERPER_API_KEY found in environment variables") 861 | elif engine == "serply": 862 | if app.state.config.SERPLY_API_KEY: 863 | return search_serply( 864 | app.state.config.SERPLY_API_KEY, 865 | query, 866 | app.state.config.RAG_WEB_SEARCH_RESULT_COUNT, 867 | app.state.config.RAG_WEB_SEARCH_DOMAIN_FILTER_LIST, 868 | ) 869 | else: 870 | raise Exception("No SERPLY_API_KEY found in environment variables") 871 | elif engine == "duckduckgo": 872 | return search_duckduckgo( 873 | query, 874 | app.state.config.RAG_WEB_SEARCH_RESULT_COUNT, 875 | app.state.config.RAG_WEB_SEARCH_DOMAIN_FILTER_LIST, 876 | ) 877 | elif engine == "tavily": 878 | if app.state.config.TAVILY_API_KEY: 879 | return search_tavily( 880 | app.state.config.TAVILY_API_KEY, 881 | query, 882 | app.state.config.RAG_WEB_SEARCH_RESULT_COUNT, 883 | ) 884 | else: 885 | raise Exception("No TAVILY_API_KEY found in environment variables") 886 | elif engine == "jina": 887 | return search_jina(query, app.state.config.RAG_WEB_SEARCH_RESULT_COUNT) 888 | else: 889 | raise Exception("No search engine API key found in environment variables") 890 | 891 | 892 | @app.post("/web/search") 893 | def store_web_search(form_data: SearchForm, user=Depends(get_verified_user)): 894 | try: 895 | logging.info( 896 | f"trying to web search with {app.state.config.RAG_WEB_SEARCH_ENGINE, form_data.query}" 897 | ) 898 | web_results = search_web( 899 | app.state.config.RAG_WEB_SEARCH_ENGINE, form_data.query 900 | ) 901 | except Exception as e: 902 | log.exception(e) 903 | 904 | print(e) 905 | raise HTTPException( 906 | status_code=status.HTTP_400_BAD_REQUEST, 907 | detail=ERROR_MESSAGES.WEB_SEARCH_ERROR(e), 908 | ) 909 | 910 | try: 911 | urls = [result.link for result in web_results] 912 | loader = get_web_loader(urls) 913 | data = loader.load() 914 | 915 | collection_name = form_data.collection_name 916 | if collection_name == "": 917 | collection_name = calculate_sha256_string(form_data.query)[:63] 918 | 919 | store_data_in_vector_db(data, collection_name, overwrite=True) 920 | return { 921 | "status": True, 922 | "collection_name": collection_name, 923 | "filenames": urls, 924 | } 925 | except Exception as e: 926 | log.exception(e) 927 | raise HTTPException( 928 | status_code=status.HTTP_400_BAD_REQUEST, 929 | detail=ERROR_MESSAGES.DEFAULT(e), 930 | ) 931 | 932 | 933 | def store_data_in_vector_db( 934 | data, collection_name, metadata: Optional[dict] = None, overwrite: bool = False 935 | ) -> bool: 936 | 937 | text_splitter = RecursiveCharacterTextSplitter( 938 | chunk_size=app.state.config.CHUNK_SIZE, 939 | chunk_overlap=app.state.config.CHUNK_OVERLAP, 940 | add_start_index=True, 941 | ) 942 | 943 | docs = text_splitter.split_documents(data) 944 | 945 | if len(docs) > 0: 946 | log.info(f"store_data_in_vector_db {docs}") 947 | return store_docs_in_vector_db(docs, collection_name, metadata, overwrite), None 948 | else: 949 | raise ValueError(ERROR_MESSAGES.EMPTY_CONTENT) 950 | 951 | 952 | def store_text_in_vector_db( 953 | text, metadata, collection_name, overwrite: bool = False 954 | ) -> bool: 955 | text_splitter = RecursiveCharacterTextSplitter( 956 | chunk_size=app.state.config.CHUNK_SIZE, 957 | chunk_overlap=app.state.config.CHUNK_OVERLAP, 958 | add_start_index=True, 959 | ) 960 | docs = text_splitter.create_documents([text], metadatas=[metadata]) 961 | return store_docs_in_vector_db(docs, collection_name, overwrite=overwrite) 962 | 963 | 964 | def store_docs_in_vector_db( 965 | docs, collection_name, metadata: Optional[dict] = None, overwrite: bool = False 966 | ) -> bool: 967 | log.info(f"store_docs_in_vector_db {docs} {collection_name}") 968 | 969 | texts = [doc.page_content for doc in docs] 970 | metadatas = [{**doc.metadata, **(metadata if metadata else {})} for doc in docs] 971 | 972 | # ChromaDB does not like datetime formats 973 | # for meta-data so convert them to string. 974 | for metadata in metadatas: 975 | for key, value in metadata.items(): 976 | if isinstance(value, datetime): 977 | metadata[key] = str(value) 978 | 979 | try: 980 | if overwrite: 981 | for collection in CHROMA_CLIENT.list_collections(): 982 | if collection_name == collection.name: 983 | log.info(f"deleting existing collection {collection_name}") 984 | CHROMA_CLIENT.delete_collection(name=collection_name) 985 | 986 | collection = CHROMA_CLIENT.create_collection(name=collection_name) 987 | 988 | embedding_func = get_embedding_function( 989 | app.state.config.RAG_EMBEDDING_ENGINE, 990 | app.state.config.RAG_EMBEDDING_MODEL, 991 | app.state.sentence_transformer_ef, 992 | app.state.config.OPENAI_API_KEY, 993 | app.state.config.OPENAI_API_BASE_URL, 994 | app.state.config.RAG_EMBEDDING_OPENAI_BATCH_SIZE, 995 | ) 996 | 997 | embedding_texts = list(map(lambda x: x.replace("\n", " "), texts)) 998 | embeddings = embedding_func(embedding_texts) 999 | 1000 | for batch in create_batches( 1001 | api=CHROMA_CLIENT, 1002 | ids=[str(uuid.uuid4()) for _ in texts], 1003 | metadatas=metadatas, 1004 | embeddings=embeddings, 1005 | documents=texts, 1006 | ): 1007 | collection.add(*batch) 1008 | 1009 | return True 1010 | except Exception as e: 1011 | if e.__class__.__name__ == "UniqueConstraintError": 1012 | return True 1013 | 1014 | log.exception(e) 1015 | 1016 | return False 1017 | 1018 | 1019 | class TikaLoader: 1020 | def __init__(self, file_path, mime_type=None): 1021 | self.file_path = file_path 1022 | self.mime_type = mime_type 1023 | 1024 | def load(self) -> List[Document]: 1025 | with open(self.file_path, "rb") as f: 1026 | data = f.read() 1027 | 1028 | if self.mime_type is not None: 1029 | headers = {"Content-Type": self.mime_type} 1030 | else: 1031 | headers = {} 1032 | 1033 | endpoint = app.state.config.TIKA_SERVER_URL 1034 | if not endpoint.endswith("/"): 1035 | endpoint += "/" 1036 | endpoint += "tika/text" 1037 | 1038 | r = requests.put(endpoint, data=data, headers=headers) 1039 | 1040 | if r.ok: 1041 | raw_metadata = r.json() 1042 | text = raw_metadata.get("X-TIKA:content", "") 1043 | 1044 | if "Content-Type" in raw_metadata: 1045 | headers["Content-Type"] = raw_metadata["Content-Type"] 1046 | 1047 | log.info("Tika extracted text: %s", text) 1048 | 1049 | return [Document(page_content=text, metadata=headers)] 1050 | else: 1051 | raise Exception(f"Error calling Tika: {r.reason}") 1052 | 1053 | 1054 | def get_loader(filename: str, file_content_type: str, file_path: str): 1055 | file_ext = filename.split(".")[-1].lower() 1056 | known_type = True 1057 | 1058 | known_source_ext = [ 1059 | "go", 1060 | "py", 1061 | "java", 1062 | "sh", 1063 | "bat", 1064 | "ps1", 1065 | "cmd", 1066 | "js", 1067 | "ts", 1068 | "css", 1069 | "cpp", 1070 | "hpp", 1071 | "h", 1072 | "c", 1073 | "cs", 1074 | "sql", 1075 | "log", 1076 | "ini", 1077 | "pl", 1078 | "pm", 1079 | "r", 1080 | "dart", 1081 | "dockerfile", 1082 | "env", 1083 | "php", 1084 | "hs", 1085 | "hsc", 1086 | "lua", 1087 | "nginxconf", 1088 | "conf", 1089 | "m", 1090 | "mm", 1091 | "plsql", 1092 | "perl", 1093 | "rb", 1094 | "rs", 1095 | "db2", 1096 | "scala", 1097 | "bash", 1098 | "swift", 1099 | "vue", 1100 | "svelte", 1101 | "msg", 1102 | "ex", 1103 | "exs", 1104 | "erl", 1105 | "tsx", 1106 | "jsx", 1107 | "hs", 1108 | "lhs", 1109 | ] 1110 | 1111 | if ( 1112 | app.state.config.CONTENT_EXTRACTION_ENGINE == "tika" 1113 | and app.state.config.TIKA_SERVER_URL 1114 | ): 1115 | if file_ext in known_source_ext or ( 1116 | file_content_type and file_content_type.find("text/") >= 0 1117 | ): 1118 | loader = TextLoader(file_path, autodetect_encoding=True) 1119 | else: 1120 | loader = TikaLoader(file_path, file_content_type) 1121 | else: 1122 | if file_ext == "pdf": 1123 | loader = PyPDFLoader( 1124 | file_path, extract_images=app.state.config.PDF_EXTRACT_IMAGES 1125 | ) 1126 | elif file_ext == "csv": 1127 | loader = CSVLoader(file_path) 1128 | elif file_ext == "rst": 1129 | loader = UnstructuredRSTLoader(file_path, mode="elements") 1130 | elif file_ext == "xml": 1131 | loader = UnstructuredXMLLoader(file_path) 1132 | elif file_ext in ["htm", "html"]: 1133 | loader = BSHTMLLoader(file_path, open_encoding="unicode_escape") 1134 | elif file_ext == "md": 1135 | loader = UnstructuredMarkdownLoader(file_path) 1136 | elif file_content_type == "application/epub+zip": 1137 | loader = UnstructuredEPubLoader(file_path) 1138 | elif ( 1139 | file_content_type 1140 | == "application/vnd.openxmlformats-officedocument.wordprocessingml.document" 1141 | or file_ext in ["doc", "docx"] 1142 | ): 1143 | loader = Docx2txtLoader(file_path) 1144 | elif file_content_type in [ 1145 | "application/vnd.ms-excel", 1146 | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", 1147 | ] or file_ext in ["xls", "xlsx"]: 1148 | loader = UnstructuredExcelLoader(file_path) 1149 | elif file_content_type in [ 1150 | "application/vnd.ms-powerpoint", 1151 | "application/vnd.openxmlformats-officedocument.presentationml.presentation", 1152 | ] or file_ext in ["ppt", "pptx"]: 1153 | loader = UnstructuredPowerPointLoader(file_path) 1154 | elif file_ext == "msg": 1155 | loader = OutlookMessageLoader(file_path) 1156 | elif file_ext in known_source_ext or ( 1157 | file_content_type and file_content_type.find("text/") >= 0 1158 | ): 1159 | loader = TextLoader(file_path, autodetect_encoding=True) 1160 | else: 1161 | loader = TextLoader(file_path, autodetect_encoding=True) 1162 | known_type = False 1163 | 1164 | return loader, known_type 1165 | 1166 | 1167 | @app.post("/doc") 1168 | def store_doc( 1169 | collection_name: Optional[str] = Form(None), 1170 | file: UploadFile = File(...), 1171 | user=Depends(get_verified_user), 1172 | ): 1173 | # "https://www.gutenberg.org/files/1727/1727-h/1727-h.htm" 1174 | 1175 | log.info(f"file.content_type: {file.content_type}") 1176 | try: 1177 | unsanitized_filename = file.filename 1178 | filename = os.path.basename(unsanitized_filename) 1179 | 1180 | file_path = f"{UPLOAD_DIR}/{filename}" 1181 | 1182 | contents = file.file.read() 1183 | with open(file_path, "wb") as f: 1184 | f.write(contents) 1185 | f.close() 1186 | 1187 | f = open(file_path, "rb") 1188 | if collection_name == None: 1189 | collection_name = calculate_sha256(f)[:63] 1190 | f.close() 1191 | 1192 | loader, known_type = get_loader(filename, file.content_type, file_path) 1193 | data = loader.load() 1194 | 1195 | try: 1196 | result = store_data_in_vector_db(data, collection_name) 1197 | 1198 | if result: 1199 | return { 1200 | "status": True, 1201 | "collection_name": collection_name, 1202 | "filename": filename, 1203 | "known_type": known_type, 1204 | } 1205 | except Exception as e: 1206 | raise HTTPException( 1207 | status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, 1208 | detail=e, 1209 | ) 1210 | except Exception as e: 1211 | log.exception(e) 1212 | if "No pandoc was found" in str(e): 1213 | raise HTTPException( 1214 | status_code=status.HTTP_400_BAD_REQUEST, 1215 | detail=ERROR_MESSAGES.PANDOC_NOT_INSTALLED, 1216 | ) 1217 | else: 1218 | raise HTTPException( 1219 | status_code=status.HTTP_400_BAD_REQUEST, 1220 | detail=ERROR_MESSAGES.DEFAULT(e), 1221 | ) 1222 | 1223 | 1224 | class ProcessDocForm(BaseModel): 1225 | file_id: str 1226 | collection_name: Optional[str] = None 1227 | 1228 | 1229 | @app.post("/process/doc") 1230 | def process_doc( 1231 | form_data: ProcessDocForm, 1232 | user=Depends(get_verified_user), 1233 | ): 1234 | try: 1235 | file = Files.get_file_by_id(form_data.file_id) 1236 | file_path = file.meta.get("path", f"{UPLOAD_DIR}/{file.filename}") 1237 | 1238 | f = open(file_path, "rb") 1239 | 1240 | collection_name = form_data.collection_name 1241 | if collection_name == None: 1242 | collection_name = calculate_sha256(f)[:63] 1243 | f.close() 1244 | 1245 | loader, known_type = get_loader( 1246 | file.filename, file.meta.get("content_type"), file_path 1247 | ) 1248 | data = loader.load() 1249 | 1250 | try: 1251 | result = store_data_in_vector_db( 1252 | data, 1253 | collection_name, 1254 | { 1255 | "file_id": form_data.file_id, 1256 | "name": file.meta.get("name", file.filename), 1257 | }, 1258 | ) 1259 | 1260 | if result: 1261 | return { 1262 | "status": True, 1263 | "collection_name": collection_name, 1264 | "known_type": known_type, 1265 | "filename": file.meta.get("name", file.filename), 1266 | } 1267 | except Exception as e: 1268 | raise HTTPException( 1269 | status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, 1270 | detail=e, 1271 | ) 1272 | except Exception as e: 1273 | log.exception(e) 1274 | if "No pandoc was found" in str(e): 1275 | raise HTTPException( 1276 | status_code=status.HTTP_400_BAD_REQUEST, 1277 | detail=ERROR_MESSAGES.PANDOC_NOT_INSTALLED, 1278 | ) 1279 | else: 1280 | raise HTTPException( 1281 | status_code=status.HTTP_400_BAD_REQUEST, 1282 | detail=ERROR_MESSAGES.DEFAULT(e), 1283 | ) 1284 | 1285 | 1286 | class TextRAGForm(BaseModel): 1287 | name: str 1288 | content: str 1289 | collection_name: Optional[str] = None 1290 | 1291 | 1292 | @app.post("/text") 1293 | def store_text( 1294 | form_data: TextRAGForm, 1295 | user=Depends(get_verified_user), 1296 | ): 1297 | 1298 | collection_name = form_data.collection_name 1299 | if collection_name == None: 1300 | collection_name = calculate_sha256_string(form_data.content) 1301 | 1302 | result = store_text_in_vector_db( 1303 | form_data.content, 1304 | metadata={"name": form_data.name, "created_by": user.id}, 1305 | collection_name=collection_name, 1306 | ) 1307 | 1308 | if result: 1309 | return {"status": True, "collection_name": collection_name} 1310 | else: 1311 | raise HTTPException( 1312 | status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, 1313 | detail=ERROR_MESSAGES.DEFAULT(), 1314 | ) 1315 | 1316 | 1317 | @app.get("/scan") 1318 | def scan_docs_dir(user=Depends(get_admin_user)): 1319 | for path in Path(DOCS_DIR).rglob("./**/*"): 1320 | try: 1321 | if path.is_file() and not path.name.startswith("."): 1322 | tags = extract_folders_after_data_docs(path) 1323 | filename = path.name 1324 | file_content_type = mimetypes.guess_type(path) 1325 | 1326 | f = open(path, "rb") 1327 | collection_name = calculate_sha256(f)[:63] 1328 | f.close() 1329 | 1330 | loader, known_type = get_loader( 1331 | filename, file_content_type[0], str(path) 1332 | ) 1333 | data = loader.load() 1334 | 1335 | try: 1336 | result = store_data_in_vector_db(data, collection_name) 1337 | 1338 | if result: 1339 | sanitized_filename = sanitize_filename(filename) 1340 | doc = Documents.get_doc_by_name(sanitized_filename) 1341 | 1342 | if doc == None: 1343 | doc = Documents.insert_new_doc( 1344 | user.id, 1345 | DocumentForm( 1346 | **{ 1347 | "name": sanitized_filename, 1348 | "title": filename, 1349 | "collection_name": collection_name, 1350 | "filename": filename, 1351 | "content": ( 1352 | json.dumps( 1353 | { 1354 | "tags": list( 1355 | map( 1356 | lambda name: {"name": name}, 1357 | tags, 1358 | ) 1359 | ) 1360 | } 1361 | ) 1362 | if len(tags) 1363 | else "{}" 1364 | ), 1365 | } 1366 | ), 1367 | ) 1368 | except Exception as e: 1369 | log.exception(e) 1370 | pass 1371 | 1372 | except Exception as e: 1373 | log.exception(e) 1374 | 1375 | return True 1376 | 1377 | 1378 | @app.get("/reset/db") 1379 | def reset_vector_db(user=Depends(get_admin_user)): 1380 | CHROMA_CLIENT.reset() 1381 | 1382 | 1383 | @app.get("/reset/uploads") 1384 | def reset_upload_dir(user=Depends(get_admin_user)) -> bool: 1385 | folder = f"{UPLOAD_DIR}" 1386 | try: 1387 | # Check if the directory exists 1388 | if os.path.exists(folder): 1389 | # Iterate over all the files and directories in the specified directory 1390 | for filename in os.listdir(folder): 1391 | file_path = os.path.join(folder, filename) 1392 | try: 1393 | if os.path.isfile(file_path) or os.path.islink(file_path): 1394 | os.unlink(file_path) # Remove the file or link 1395 | elif os.path.isdir(file_path): 1396 | shutil.rmtree(file_path) # Remove the directory 1397 | except Exception as e: 1398 | print(f"Failed to delete {file_path}. Reason: {e}") 1399 | else: 1400 | print(f"The directory {folder} does not exist") 1401 | except Exception as e: 1402 | print(f"Failed to process the directory {folder}. Reason: {e}") 1403 | 1404 | return True 1405 | 1406 | 1407 | @app.get("/reset") 1408 | def reset(user=Depends(get_admin_user)) -> bool: 1409 | folder = f"{UPLOAD_DIR}" 1410 | for filename in os.listdir(folder): 1411 | file_path = os.path.join(folder, filename) 1412 | try: 1413 | if os.path.isfile(file_path) or os.path.islink(file_path): 1414 | os.unlink(file_path) 1415 | elif os.path.isdir(file_path): 1416 | shutil.rmtree(file_path) 1417 | except Exception as e: 1418 | log.error("Failed to delete %s. Reason: %s" % (file_path, e)) 1419 | 1420 | try: 1421 | CHROMA_CLIENT.reset() 1422 | except Exception as e: 1423 | log.exception(e) 1424 | 1425 | return True 1426 | 1427 | 1428 | class SafeWebBaseLoader(WebBaseLoader): 1429 | """WebBaseLoader with enhanced error handling for URLs.""" 1430 | 1431 | def lazy_load(self) -> Iterator[Document]: 1432 | """Lazy load text from the url(s) in web_path with error handling.""" 1433 | for path in self.web_paths: 1434 | try: 1435 | soup = self._scrape(path, bs_kwargs=self.bs_kwargs) 1436 | text = soup.get_text(**self.bs_get_text_kwargs) 1437 | 1438 | # Build metadata 1439 | metadata = {"source": path} 1440 | if title := soup.find("title"): 1441 | metadata["title"] = title.get_text() 1442 | if description := soup.find("meta", attrs={"name": "description"}): 1443 | metadata["description"] = description.get( 1444 | "content", "No description found." 1445 | ) 1446 | if html := soup.find("html"): 1447 | metadata["language"] = html.get("lang", "No language found.") 1448 | 1449 | yield Document(page_content=text, metadata=metadata) 1450 | except Exception as e: 1451 | # Log the error and continue with the next URL 1452 | log.error(f"Error loading {path}: {e}") 1453 | 1454 | 1455 | if ENV == "dev": 1456 | 1457 | @app.get("/ef") 1458 | async def get_embeddings(): 1459 | return {"result": app.state.EMBEDDING_FUNCTION("hello world")} 1460 | 1461 | @app.get("/ef/{text}") 1462 | async def get_embeddings_text(text: str): 1463 | return {"result": app.state.EMBEDDING_FUNCTION(text)} ``````` `\\?\D:\Coding\ai\backend\apps\rag\search\brave.py`: ```````py 1 | import logging 2 | from typing import List, Optional 3 | import requests 4 | 5 | from apps.rag.search.main import SearchResult, get_filtered_results 6 | from config import SRC_LOG_LEVELS 7 | 8 | log = logging.getLogger(__name__) 9 | log.setLevel(SRC_LOG_LEVELS["RAG"]) 10 | 11 | 12 | def search_brave( 13 | api_key: str, query: str, count: int, filter_list: Optional[List[str]] = None 14 | ) -> list[SearchResult]: 15 | """Search using Brave's Search API and return the results as a list of SearchResult objects. 16 | 17 | Args: 18 | api_key (str): A Brave Search API key 19 | query (str): The query to search for 20 | """ 21 | url = "https://api.search.brave.com/res/v1/web/search" 22 | headers = { 23 | "Accept": "application/json", 24 | "Accept-Encoding": "gzip", 25 | "X-Subscription-Token": api_key, 26 | } 27 | params = {"q": query, "count": count} 28 | 29 | response = requests.get(url, headers=headers, params=params) 30 | response.raise_for_status() 31 | 32 | json_response = response.json() 33 | results = json_response.get("web", {}).get("results", []) 34 | if filter_list: 35 | results = get_filtered_results(results, filter_list) 36 | 37 | return [ 38 | SearchResult( 39 | link=result["url"], title=result.get("title"), snippet=result.get("snippet") 40 | ) 41 | for result in results[:count] 42 | ] ``````` `\\?\D:\Coding\ai\backend\apps\rag\search\duckduckgo.py`: ```````py 1 | import logging 2 | from typing import List, Optional 3 | from apps.rag.search.main import SearchResult, get_filtered_results 4 | from duckduckgo_search import DDGS 5 | from config import SRC_LOG_LEVELS 6 | 7 | log = logging.getLogger(__name__) 8 | log.setLevel(SRC_LOG_LEVELS["RAG"]) 9 | 10 | 11 | def search_duckduckgo( 12 | query: str, count: int, filter_list: Optional[List[str]] = None 13 | ) -> list[SearchResult]: 14 | """ 15 | Search using DuckDuckGo's Search API and return the results as a list of SearchResult objects. 16 | Args: 17 | query (str): The query to search for 18 | count (int): The number of results to return 19 | 20 | Returns: 21 | List[SearchResult]: A list of search results 22 | """ 23 | # Use the DDGS context manager to create a DDGS object 24 | with DDGS() as ddgs: 25 | # Use the ddgs.text() method to perform the search 26 | ddgs_gen = ddgs.text( 27 | query, safesearch="moderate", max_results=count, backend="api" 28 | ) 29 | # Check if there are search results 30 | if ddgs_gen: 31 | # Convert the search results into a list 32 | search_results = [r for r in ddgs_gen] 33 | 34 | # Create an empty list to store the SearchResult objects 35 | results = [] 36 | # Iterate over each search result 37 | for result in search_results: 38 | # Create a SearchResult object and append it to the results list 39 | results.append( 40 | SearchResult( 41 | link=result["href"], 42 | title=result.get("title"), 43 | snippet=result.get("body"), 44 | ) 45 | ) 46 | if filter_list: 47 | results = get_filtered_results(results, filter_list) 48 | # Return the list of search results 49 | return results ``````` `\\?\D:\Coding\ai\backend\apps\rag\search\google_pse.py`: ```````py 1 | import json 2 | import logging 3 | from typing import List, Optional 4 | import requests 5 | 6 | from apps.rag.search.main import SearchResult, get_filtered_results 7 | from config import SRC_LOG_LEVELS 8 | 9 | log = logging.getLogger(__name__) 10 | log.setLevel(SRC_LOG_LEVELS["RAG"]) 11 | 12 | 13 | def search_google_pse( 14 | api_key: str, 15 | search_engine_id: str, 16 | query: str, 17 | count: int, 18 | filter_list: Optional[List[str]] = None, 19 | ) -> list[SearchResult]: 20 | """Search using Google's Programmable Search Engine API and return the results as a list of SearchResult objects. 21 | 22 | Args: 23 | api_key (str): A Programmable Search Engine API key 24 | search_engine_id (str): A Programmable Search Engine ID 25 | query (str): The query to search for 26 | """ 27 | url = "https://www.googleapis.com/customsearch/v1" 28 | 29 | headers = {"Content-Type": "application/json"} 30 | params = { 31 | "cx": search_engine_id, 32 | "q": query, 33 | "key": api_key, 34 | "num": count, 35 | } 36 | 37 | response = requests.request("GET", url, headers=headers, params=params) 38 | response.raise_for_status() 39 | 40 | json_response = response.json() 41 | results = json_response.get("items", []) 42 | if filter_list: 43 | results = get_filtered_results(results, filter_list) 44 | return [ 45 | SearchResult( 46 | link=result["link"], 47 | title=result.get("title"), 48 | snippet=result.get("snippet"), 49 | ) 50 | for result in results 51 | ] ``````` `\\?\D:\Coding\ai\backend\apps\rag\search\jina_search.py`: ```````py 1 | import logging 2 | import requests 3 | from yarl import URL 4 | 5 | from apps.rag.search.main import SearchResult 6 | from config import SRC_LOG_LEVELS 7 | 8 | log = logging.getLogger(__name__) 9 | log.setLevel(SRC_LOG_LEVELS["RAG"]) 10 | 11 | 12 | def search_jina(query: str, count: int) -> list[SearchResult]: 13 | """ 14 | Search using Jina's Search API and return the results as a list of SearchResult objects. 15 | Args: 16 | query (str): The query to search for 17 | count (int): The number of results to return 18 | 19 | Returns: 20 | List[SearchResult]: A list of search results 21 | """ 22 | jina_search_endpoint = "https://s.jina.ai/" 23 | headers = { 24 | "Accept": "application/json", 25 | } 26 | url = str(URL(jina_search_endpoint + query)) 27 | response = requests.get(url, headers=headers) 28 | response.raise_for_status() 29 | data = response.json() 30 | 31 | results = [] 32 | for result in data["data"][:count]: 33 | results.append( 34 | SearchResult( 35 | link=result["url"], 36 | title=result.get("title"), 37 | snippet=result.get("content"), 38 | ) 39 | ) 40 | 41 | return results ``````` `\\?\D:\Coding\ai\backend\apps\rag\search\main.py`: ```````py 1 | from typing import Optional 2 | from urllib.parse import urlparse 3 | from pydantic import BaseModel 4 | 5 | 6 | def get_filtered_results(results, filter_list): 7 | if not filter_list: 8 | return results 9 | filtered_results = [] 10 | for result in results: 11 | domain = urlparse(result["url"]).netloc 12 | if any(domain.endswith(filtered_domain) for filtered_domain in filter_list): 13 | filtered_results.append(result) 14 | return filtered_results 15 | 16 | 17 | class SearchResult(BaseModel): 18 | link: str 19 | title: Optional[str] 20 | snippet: Optional[str] ``````` `\\?\D:\Coding\ai\backend\apps\rag\search\searxng.py`: ```````py 1 | import logging 2 | import requests 3 | 4 | from typing import List, Optional 5 | 6 | from apps.rag.search.main import SearchResult, get_filtered_results 7 | from config import SRC_LOG_LEVELS 8 | 9 | log = logging.getLogger(__name__) 10 | log.setLevel(SRC_LOG_LEVELS["RAG"]) 11 | 12 | 13 | def search_searxng( 14 | query_url: str, 15 | query: str, 16 | count: int, 17 | filter_list: Optional[List[str]] = None, 18 | **kwargs, 19 | ) -> List[SearchResult]: 20 | """ 21 | Search a SearXNG instance for a given query and return the results as a list of SearchResult objects. 22 | 23 | The function allows passing additional parameters such as language or time_range to tailor the search result. 24 | 25 | Args: 26 | query_url (str): The base URL of the SearXNG server. 27 | query (str): The search term or question to find in the SearXNG database. 28 | count (int): The maximum number of results to retrieve from the search. 29 | 30 | Keyword Args: 31 | language (str): Language filter for the search results; e.g., "en-US". Defaults to an empty string. 32 | safesearch (int): Safe search filter for safer web results; 0 = off, 1 = moderate, 2 = strict. Defaults to 1 (moderate). 33 | time_range (str): Time range for filtering results by date; e.g., "2023-04-05..today" or "all-time". Defaults to ''. 34 | categories: (Optional[List[str]]): Specific categories within which the search should be performed, defaulting to an empty string if not provided. 35 | 36 | Returns: 37 | List[SearchResult]: A list of SearchResults sorted by relevance score in descending order. 38 | 39 | Raise: 40 | requests.exceptions.RequestException: If a request error occurs during the search process. 41 | """ 42 | 43 | # Default values for optional parameters are provided as empty strings or None when not specified. 44 | language = kwargs.get("language", "en-US") 45 | safesearch = kwargs.get("safesearch", "1") 46 | time_range = kwargs.get("time_range", "") 47 | categories = "".join(kwargs.get("categories", [])) 48 | 49 | params = { 50 | "q": query, 51 | "format": "json", 52 | "pageno": 1, 53 | "safesearch": safesearch, 54 | "language": language, 55 | "time_range": time_range, 56 | "categories": categories, 57 | "theme": "simple", 58 | "image_proxy": 0, 59 | } 60 | 61 | # Legacy query format 62 | if "" in query_url: 63 | # Strip all query parameters from the URL 64 | query_url = query_url.split("?")[0] 65 | 66 | log.debug(f"searching {query_url}") 67 | 68 | response = requests.get( 69 | query_url, 70 | headers={ 71 | "User-Agent": "Open WebUI (https://github.com/open-webui/open-webui) RAG Bot", 72 | "Accept": "text/html", 73 | "Accept-Encoding": "gzip, deflate", 74 | "Accept-Language": "en-US,en;q=0.5", 75 | "Connection": "keep-alive", 76 | }, 77 | params=params, 78 | ) 79 | 80 | response.raise_for_status() # Raise an exception for HTTP errors. 81 | 82 | json_response = response.json() 83 | results = json_response.get("results", []) 84 | sorted_results = sorted(results, key=lambda x: x.get("score", 0), reverse=True) 85 | if filter_list: 86 | sorted_results = get_filtered_results(sorted_results, filter_list) 87 | return [ 88 | SearchResult( 89 | link=result["url"], title=result.get("title"), snippet=result.get("content") 90 | ) 91 | for result in sorted_results[:count] 92 | ] ``````` `\\?\D:\Coding\ai\backend\apps\rag\search\serper.py`: ```````py 1 | import json 2 | import logging 3 | from typing import List, Optional 4 | import requests 5 | 6 | from apps.rag.search.main import SearchResult, get_filtered_results 7 | from config import SRC_LOG_LEVELS 8 | 9 | log = logging.getLogger(__name__) 10 | log.setLevel(SRC_LOG_LEVELS["RAG"]) 11 | 12 | 13 | def search_serper( 14 | api_key: str, query: str, count: int, filter_list: Optional[List[str]] = None 15 | ) -> list[SearchResult]: 16 | """Search using serper.dev's API and return the results as a list of SearchResult objects. 17 | 18 | Args: 19 | api_key (str): A serper.dev API key 20 | query (str): The query to search for 21 | """ 22 | url = "https://google.serper.dev/search" 23 | 24 | payload = json.dumps({"q": query}) 25 | headers = {"X-API-KEY": api_key, "Content-Type": "application/json"} 26 | 27 | response = requests.request("POST", url, headers=headers, data=payload) 28 | response.raise_for_status() 29 | 30 | json_response = response.json() 31 | results = sorted( 32 | json_response.get("organic", []), key=lambda x: x.get("position", 0) 33 | ) 34 | if filter_list: 35 | results = get_filtered_results(results, filter_list) 36 | return [ 37 | SearchResult( 38 | link=result["link"], 39 | title=result.get("title"), 40 | snippet=result.get("description"), 41 | ) 42 | for result in results[:count] 43 | ] ``````` `\\?\D:\Coding\ai\backend\apps\rag\search\serply.py`: ```````py 1 | import json 2 | import logging 3 | from typing import List, Optional 4 | import requests 5 | from urllib.parse import urlencode 6 | 7 | from apps.rag.search.main import SearchResult, get_filtered_results 8 | from config import SRC_LOG_LEVELS 9 | 10 | log = logging.getLogger(__name__) 11 | log.setLevel(SRC_LOG_LEVELS["RAG"]) 12 | 13 | 14 | def search_serply( 15 | api_key: str, 16 | query: str, 17 | count: int, 18 | hl: str = "us", 19 | limit: int = 10, 20 | device_type: str = "desktop", 21 | proxy_location: str = "US", 22 | filter_list: Optional[List[str]] = None, 23 | ) -> list[SearchResult]: 24 | """Search using serper.dev's API and return the results as a list of SearchResult objects. 25 | 26 | Args: 27 | api_key (str): A serply.io API key 28 | query (str): The query to search for 29 | hl (str): Host Language code to display results in (reference https://developers.google.com/custom-search/docs/xml_results?hl=en#wsInterfaceLanguages) 30 | limit (int): The maximum number of results to return [10-100, defaults to 10] 31 | """ 32 | log.info("Searching with Serply") 33 | 34 | url = "https://api.serply.io/v1/search/" 35 | 36 | query_payload = { 37 | "q": query, 38 | "language": "en", 39 | "num": limit, 40 | "gl": proxy_location.upper(), 41 | "hl": hl.lower(), 42 | } 43 | 44 | url = f"{url}{urlencode(query_payload)}" 45 | headers = { 46 | "X-API-KEY": api_key, 47 | "X-User-Agent": device_type, 48 | "User-Agent": "open-webui", 49 | "X-Proxy-Location": proxy_location, 50 | } 51 | 52 | response = requests.request("GET", url, headers=headers) 53 | response.raise_for_status() 54 | 55 | json_response = response.json() 56 | log.info(f"results from serply search: {json_response}") 57 | 58 | results = sorted( 59 | json_response.get("results", []), key=lambda x: x.get("realPosition", 0) 60 | ) 61 | if filter_list: 62 | results = get_filtered_results(results, filter_list) 63 | return [ 64 | SearchResult( 65 | link=result["link"], 66 | title=result.get("title"), 67 | snippet=result.get("description"), 68 | ) 69 | for result in results[:count] 70 | ] ``````` `\\?\D:\Coding\ai\backend\apps\rag\search\serpstack.py`: ```````py 1 | import json 2 | import logging 3 | from typing import List, Optional 4 | import requests 5 | 6 | from apps.rag.search.main import SearchResult, get_filtered_results 7 | from config import SRC_LOG_LEVELS 8 | 9 | log = logging.getLogger(__name__) 10 | log.setLevel(SRC_LOG_LEVELS["RAG"]) 11 | 12 | 13 | def search_serpstack( 14 | api_key: str, 15 | query: str, 16 | count: int, 17 | filter_list: Optional[List[str]] = None, 18 | https_enabled: bool = True, 19 | ) -> list[SearchResult]: 20 | """Search using serpstack.com's and return the results as a list of SearchResult objects. 21 | 22 | Args: 23 | api_key (str): A serpstack.com API key 24 | query (str): The query to search for 25 | https_enabled (bool): Whether to use HTTPS or HTTP for the API request 26 | """ 27 | url = f"{'https' if https_enabled else 'http'}://api.serpstack.com/search" 28 | 29 | headers = {"Content-Type": "application/json"} 30 | params = { 31 | "access_key": api_key, 32 | "query": query, 33 | } 34 | 35 | response = requests.request("POST", url, headers=headers, params=params) 36 | response.raise_for_status() 37 | 38 | json_response = response.json() 39 | results = sorted( 40 | json_response.get("organic_results", []), key=lambda x: x.get("position", 0) 41 | ) 42 | if filter_list: 43 | results = get_filtered_results(results, filter_list) 44 | return [ 45 | SearchResult( 46 | link=result["url"], title=result.get("title"), snippet=result.get("snippet") 47 | ) 48 | for result in results[:count] 49 | ] ``````` `\\?\D:\Coding\ai\backend\apps\rag\search\tavily.py`: ```````py 1 | import logging 2 | 3 | import requests 4 | 5 | from apps.rag.search.main import SearchResult 6 | from config import SRC_LOG_LEVELS 7 | 8 | log = logging.getLogger(__name__) 9 | log.setLevel(SRC_LOG_LEVELS["RAG"]) 10 | 11 | 12 | def search_tavily(api_key: str, query: str, count: int) -> list[SearchResult]: 13 | """Search using Tavily's Search API and return the results as a list of SearchResult objects. 14 | 15 | Args: 16 | api_key (str): A Tavily Search API key 17 | query (str): The query to search for 18 | 19 | Returns: 20 | List[SearchResult]: A list of search results 21 | """ 22 | url = "https://api.tavily.com/search" 23 | data = {"query": query, "api_key": api_key} 24 | 25 | response = requests.post(url, json=data) 26 | response.raise_for_status() 27 | 28 | json_response = response.json() 29 | 30 | raw_search_results = json_response.get("results", []) 31 | 32 | return [ 33 | SearchResult( 34 | link=result["url"], 35 | title=result.get("title", ""), 36 | snippet=result.get("content"), 37 | ) 38 | for result in raw_search_results[:count] 39 | ] ``````` `\\?\D:\Coding\ai\backend\apps\rag\search\testdata\brave.json`: ```````json 1 | { 2 | "query": { 3 | "original": "python", 4 | "show_strict_warning": false, 5 | "is_navigational": true, 6 | "is_news_breaking": false, 7 | "spellcheck_off": true, 8 | "country": "us", 9 | "bad_results": false, 10 | "should_fallback": false, 11 | "postal_code": "", 12 | "city": "", 13 | "header_country": "", 14 | "more_results_available": true, 15 | "state": "" 16 | }, 17 | "mixed": { 18 | "type": "mixed", 19 | "main": [ 20 | { 21 | "type": "web", 22 | "index": 0, 23 | "all": false 24 | }, 25 | { 26 | "type": "web", 27 | "index": 1, 28 | "all": false 29 | }, 30 | { 31 | "type": "news", 32 | "all": true 33 | }, 34 | { 35 | "type": "web", 36 | "index": 2, 37 | "all": false 38 | }, 39 | { 40 | "type": "videos", 41 | "all": true 42 | }, 43 | { 44 | "type": "web", 45 | "index": 3, 46 | "all": false 47 | }, 48 | { 49 | "type": "web", 50 | "index": 4, 51 | "all": false 52 | }, 53 | { 54 | "type": "web", 55 | "index": 5, 56 | "all": false 57 | }, 58 | { 59 | "type": "web", 60 | "index": 6, 61 | "all": false 62 | }, 63 | { 64 | "type": "web", 65 | "index": 7, 66 | "all": false 67 | }, 68 | { 69 | "type": "web", 70 | "index": 8, 71 | "all": false 72 | }, 73 | { 74 | "type": "web", 75 | "index": 9, 76 | "all": false 77 | }, 78 | { 79 | "type": "web", 80 | "index": 10, 81 | "all": false 82 | }, 83 | { 84 | "type": "web", 85 | "index": 11, 86 | "all": false 87 | }, 88 | { 89 | "type": "web", 90 | "index": 12, 91 | "all": false 92 | }, 93 | { 94 | "type": "web", 95 | "index": 13, 96 | "all": false 97 | }, 98 | { 99 | "type": "web", 100 | "index": 14, 101 | "all": false 102 | }, 103 | { 104 | "type": "web", 105 | "index": 15, 106 | "all": false 107 | }, 108 | { 109 | "type": "web", 110 | "index": 16, 111 | "all": false 112 | }, 113 | { 114 | "type": "web", 115 | "index": 17, 116 | "all": false 117 | }, 118 | { 119 | "type": "web", 120 | "index": 18, 121 | "all": false 122 | }, 123 | { 124 | "type": "web", 125 | "index": 19, 126 | "all": false 127 | } 128 | ], 129 | "top": [], 130 | "side": [] 131 | }, 132 | "news": { 133 | "type": "news", 134 | "results": [ 135 | { 136 | "title": "Google lays off staff from Flutter, Dart and Python teams weeks before its developer conference | TechCrunch", 137 | "url": "https://techcrunch.com/2024/05/01/google-lays-off-staff-from-flutter-dart-python-weeks-before-its-developer-conference/", 138 | "is_source_local": false, 139 | "is_source_both": false, 140 | "description": "Google told TechCrunch that Flutter will have new updates to share at I/O this year.", 141 | "page_age": "2024-05-02T17:40:05", 142 | "family_friendly": true, 143 | "meta_url": { 144 | "scheme": "https", 145 | "netloc": "techcrunch.com", 146 | "hostname": "techcrunch.com", 147 | "favicon": "https://imgs.search.brave.com/N6VSEVahheQOb7lqfb47dhUOB4XD-6sfQOP94sCe3Oo/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvZGI5Njk0Yzlk/YWM3ZWMwZjg1MTM1/NmIyMWEyNzBjZDZj/ZDQyNmFlNGU0NDRi/MDgyYjQwOGU0Y2Qy/ZWMwNWQ2ZC90ZWNo/Y3J1bmNoLmNvbS8", 148 | "path": "› 2024 › 05 › 01 › google-lays-off-staff-from-flutter-dart-python-weeks-before-its-developer-conference" 149 | }, 150 | "breaking": false, 151 | "thumbnail": { 152 | "src": "https://imgs.search.brave.com/gCI5UG8muOEOZDAx9vpu6L6r6R00mD7jOF08-biFoyQ/rs:fit:200:200:1/g:ce/aHR0cHM6Ly90ZWNo/Y3J1bmNoLmNvbS93/cC1jb250ZW50L3Vw/bG9hZHMvMjAxOC8x/MS9HZXR0eUltYWdl/cy0xMDAyNDg0NzQ2/LmpwZz9yZXNpemU9/MTIwMCw4MDA" 153 | }, 154 | "age": "3 days ago", 155 | "extra_snippets": [ 156 | "Ahead of Google’s annual I/O developer conference in May, the tech giant has laid off staff across key teams like Flutter, Dart, Python and others, according to reports from affected employees shared on social media. Google confirmed the layoffs to TechCrunch, but not the specific teams, roles or how many people were let go.", 157 | "In a separate post on Reddit, another commenter noted the Python team affected by the layoffs were those who managed the internal Python runtimes and toolchains and worked with OSS Python. Included in this group were “multiple current and former core devs and steering council members,” they said.", 158 | "Meanwhile, others shared on Y Combinator’s Hacker News, where a Python team member detailed their specific duties on the technical front and noted that, for years, much of the work was done with fewer than 10 people. Another Hacker News commenter said their early years on the Python team were spent paying down internal technical debt accumulated from not having a strong Python strategy.", 159 | "CNBC reports that a total of 200 people were let go across Google’s “Core” teams, which included those working on Python, app platforms, and other engineering roles. Some jobs were being shifted to India and Mexico, it said, citing internal documents." 160 | ] 161 | } 162 | ], 163 | "mutated_by_goggles": false 164 | }, 165 | "type": "search", 166 | "videos": { 167 | "type": "videos", 168 | "results": [ 169 | { 170 | "type": "video_result", 171 | "url": "https://www.youtube.com/watch?v=b093aqAZiPU", 172 | "title": "👩‍💻 Python for Beginners Tutorial - YouTube", 173 | "description": "In this step-by-step Python for beginner's tutorial, learn how you can get started programming in Python. In this video, I assume that you are completely new...", 174 | "age": "March 25, 2021", 175 | "page_age": "2021-03-25T10:00:08", 176 | "video": {}, 177 | "meta_url": { 178 | "scheme": "https", 179 | "netloc": "youtube.com", 180 | "hostname": "www.youtube.com", 181 | "favicon": "https://imgs.search.brave.com/Ux4Hee4evZhvjuTKwtapBycOGjGDci2Gvn2pbSzvbC0/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvOTkyZTZiMWU3/YzU3Nzc5YjExYzUy/N2VhZTIxOWNlYjM5/ZGVjN2MyZDY4Nzdh/ZDYzMTYxNmI5N2Rk/Y2Q3N2FkNy93d3cu/eW91dHViZS5jb20v", 182 | "path": "› watch" 183 | }, 184 | "thumbnail": { 185 | "src": "https://imgs.search.brave.com/tZI4Do4_EYcTCsD_MvE3Jx8FzjIXwIJ5ZuKhwiWTyZs/rs:fit:200:200:1/g:ce/aHR0cHM6Ly9pLnl0/aW1nLmNvbS92aS9i/MDkzYXFBWmlQVS9t/YXhyZXNkZWZhdWx0/LmpwZw" 186 | } 187 | }, 188 | { 189 | "type": "video_result", 190 | "url": "https://www.youtube.com/watch?v=rfscVS0vtbw", 191 | "title": "Learn Python - Full Course for Beginners [Tutorial] - YouTube", 192 | "description": "This course will give you a full introduction into all of the core concepts in python. Follow along with the videos and you'll be a python programmer in no t...", 193 | "age": "July 11, 2018", 194 | "page_age": "2018-07-11T18:00:42", 195 | "video": {}, 196 | "meta_url": { 197 | "scheme": "https", 198 | "netloc": "youtube.com", 199 | "hostname": "www.youtube.com", 200 | "favicon": "https://imgs.search.brave.com/Ux4Hee4evZhvjuTKwtapBycOGjGDci2Gvn2pbSzvbC0/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvOTkyZTZiMWU3/YzU3Nzc5YjExYzUy/N2VhZTIxOWNlYjM5/ZGVjN2MyZDY4Nzdh/ZDYzMTYxNmI5N2Rk/Y2Q3N2FkNy93d3cu/eW91dHViZS5jb20v", 201 | "path": "› watch" 202 | }, 203 | "thumbnail": { 204 | "src": "https://imgs.search.brave.com/65zkx_kPU_zJb-4nmvvY-q5-ZZwzceChz-N00V8cqvk/rs:fit:200:200:1/g:ce/aHR0cHM6Ly9pLnl0/aW1nLmNvbS92aS9y/ZnNjVlMwdnRidy9t/YXhyZXNkZWZhdWx0/LmpwZw" 205 | } 206 | }, 207 | { 208 | "type": "video_result", 209 | "url": "https://www.youtube.com/watch?v=_uQrJ0TkZlc", 210 | "title": "Python Tutorial - Python Full Course for Beginners - YouTube", 211 | "description": "Become a Python pro! 🚀 This comprehensive tutorial takes you from beginner to hero, covering the basics, machine learning, and web development projects.🚀 W...", 212 | "age": "February 18, 2019", 213 | "page_age": "2019-02-18T15:00:08", 214 | "video": {}, 215 | "meta_url": { 216 | "scheme": "https", 217 | "netloc": "youtube.com", 218 | "hostname": "www.youtube.com", 219 | "favicon": "https://imgs.search.brave.com/Ux4Hee4evZhvjuTKwtapBycOGjGDci2Gvn2pbSzvbC0/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvOTkyZTZiMWU3/YzU3Nzc5YjExYzUy/N2VhZTIxOWNlYjM5/ZGVjN2MyZDY4Nzdh/ZDYzMTYxNmI5N2Rk/Y2Q3N2FkNy93d3cu/eW91dHViZS5jb20v", 220 | "path": "› watch" 221 | }, 222 | "thumbnail": { 223 | "src": "https://imgs.search.brave.com/Djiv1pXLq1ClqBSE_86jQnEYR8bW8UJP6Cs7LrgyQzQ/rs:fit:200:200:1/g:ce/aHR0cHM6Ly9pLnl0/aW1nLmNvbS92aS9f/dVFySjBUa1psYy9t/YXhyZXNkZWZhdWx0/LmpwZw" 224 | } 225 | }, 226 | { 227 | "type": "video_result", 228 | "url": "https://www.youtube.com/watch?v=wRKgzC-MhIc", 229 | "title": "[] and {} vs list() and dict(), which is better?", 230 | "description": "Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.", 231 | "video": {}, 232 | "meta_url": { 233 | "scheme": "https", 234 | "netloc": "youtube.com", 235 | "hostname": "www.youtube.com", 236 | "favicon": "https://imgs.search.brave.com/Ux4Hee4evZhvjuTKwtapBycOGjGDci2Gvn2pbSzvbC0/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvOTkyZTZiMWU3/YzU3Nzc5YjExYzUy/N2VhZTIxOWNlYjM5/ZGVjN2MyZDY4Nzdh/ZDYzMTYxNmI5N2Rk/Y2Q3N2FkNy93d3cu/eW91dHViZS5jb20v", 237 | "path": "› watch" 238 | }, 239 | "thumbnail": { 240 | "src": "https://imgs.search.brave.com/Hw9ep2Pio13X1VZjRw_h9R2VH_XvZFOuGlQJVnVkeq0/rs:fit:200:200:1/g:ce/aHR0cHM6Ly9pLnl0/aW1nLmNvbS92aS93/UktnekMtTWhJYy9o/cWRlZmF1bHQuanBn" 241 | } 242 | }, 243 | { 244 | "type": "video_result", 245 | "url": "https://www.youtube.com/watch?v=LWdsF79H1Pg", 246 | "title": "print() vs. return in Python Functions - YouTube", 247 | "description": "In this video, you will learn the differences between the return statement and the print function when they are used inside Python functions. We will see an ...", 248 | "age": "June 11, 2022", 249 | "page_age": "2022-06-11T21:33:26", 250 | "video": {}, 251 | "meta_url": { 252 | "scheme": "https", 253 | "netloc": "youtube.com", 254 | "hostname": "www.youtube.com", 255 | "favicon": "https://imgs.search.brave.com/Ux4Hee4evZhvjuTKwtapBycOGjGDci2Gvn2pbSzvbC0/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvOTkyZTZiMWU3/YzU3Nzc5YjExYzUy/N2VhZTIxOWNlYjM5/ZGVjN2MyZDY4Nzdh/ZDYzMTYxNmI5N2Rk/Y2Q3N2FkNy93d3cu/eW91dHViZS5jb20v", 256 | "path": "› watch" 257 | }, 258 | "thumbnail": { 259 | "src": "https://imgs.search.brave.com/ebglnr5_jwHHpvon3WU-5hzt0eHdTZSVGg3Ts6R38xY/rs:fit:200:200:1/g:ce/aHR0cHM6Ly9pLnl0/aW1nLmNvbS92aS9M/V2RzRjc5SDFQZy9t/YXhyZXNkZWZhdWx0/LmpwZw" 260 | } 261 | }, 262 | { 263 | "type": "video_result", 264 | "url": "https://www.youtube.com/watch?v=AovxLr8jUH4", 265 | "title": "Python Tutorial for Beginners 5 - Python print() and input() Function ...", 266 | "description": "In this Video I am going to show How to use print() Function and input() Function in Python. In python The print() function is used to print the specified ...", 267 | "age": "August 28, 2018", 268 | "page_age": "2018-08-28T20:11:09", 269 | "video": {}, 270 | "meta_url": { 271 | "scheme": "https", 272 | "netloc": "youtube.com", 273 | "hostname": "www.youtube.com", 274 | "favicon": "https://imgs.search.brave.com/Ux4Hee4evZhvjuTKwtapBycOGjGDci2Gvn2pbSzvbC0/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvOTkyZTZiMWU3/YzU3Nzc5YjExYzUy/N2VhZTIxOWNlYjM5/ZGVjN2MyZDY4Nzdh/ZDYzMTYxNmI5N2Rk/Y2Q3N2FkNy93d3cu/eW91dHViZS5jb20v", 275 | "path": "› watch" 276 | }, 277 | "thumbnail": { 278 | "src": "https://imgs.search.brave.com/nCoLEcWkKtiecprWbS6nufwGCaSbPH7o0-sMeIkFmjI/rs:fit:200:200:1/g:ce/aHR0cHM6Ly9pLnl0/aW1nLmNvbS92aS9B/b3Z4THI4alVINC9o/cWRlZmF1bHQuanBn" 279 | } 280 | } 281 | ], 282 | "mutated_by_goggles": false 283 | }, 284 | "web": { 285 | "type": "search", 286 | "results": [ 287 | { 288 | "title": "Welcome to Python.org", 289 | "url": "https://www.python.org", 290 | "is_source_local": false, 291 | "is_source_both": false, 292 | "description": "The official home of the Python Programming Language", 293 | "page_age": "2023-09-09T15:55:05", 294 | "profile": { 295 | "name": "Python", 296 | "url": "https://www.python.org", 297 | "long_name": "python.org", 298 | "img": "https://imgs.search.brave.com/vBaRH-v6oPS4csO4cdvuKhZ7-xDVvydin3oe3zXYxAI/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvNTJjMzZjNDBj/MmIzODgwMGUyOTRj/Y2E5MjM3YjRkYTZj/YWI1Yzk1NTlmYTgw/ZDBjNzM0MGMxZjQz/YWFjNTczYy93d3cu/cHl0aG9uLm9yZy8" 299 | }, 300 | "language": "en", 301 | "family_friendly": true, 302 | "type": "search_result", 303 | "subtype": "generic", 304 | "meta_url": { 305 | "scheme": "https", 306 | "netloc": "python.org", 307 | "hostname": "www.python.org", 308 | "favicon": "https://imgs.search.brave.com/vBaRH-v6oPS4csO4cdvuKhZ7-xDVvydin3oe3zXYxAI/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvNTJjMzZjNDBj/MmIzODgwMGUyOTRj/Y2E5MjM3YjRkYTZj/YWI1Yzk1NTlmYTgw/ZDBjNzM0MGMxZjQz/YWFjNTczYy93d3cu/cHl0aG9uLm9yZy8", 309 | "path": "" 310 | }, 311 | "thumbnail": { 312 | "src": "https://imgs.search.brave.com/GGfNfe5rxJ8QWEoxXniSLc0-POLU3qPyTIpuqPdbmXk/rs:fit:200:200:1/g:ce/aHR0cHM6Ly93d3cu/cHl0aG9uLm9yZy9z/dGF0aWMvb3Blbmdy/YXBoLWljb24tMjAw/eDIwMC5wbmc", 313 | "original": "https://www.python.org/static/opengraph-icon-200x200.png", 314 | "logo": false 315 | }, 316 | "age": "September 9, 2023", 317 | "cluster_type": "generic", 318 | "cluster": [ 319 | { 320 | "title": "Downloads", 321 | "url": "https://www.python.org/downloads/", 322 | "is_source_local": false, 323 | "is_source_both": false, 324 | "description": "The official home of the Python Programming Language", 325 | "family_friendly": true 326 | }, 327 | { 328 | "title": "Macos", 329 | "url": "https://www.python.org/downloads/macos/", 330 | "is_source_local": false, 331 | "is_source_both": false, 332 | "description": "The official home of the Python Programming Language", 333 | "family_friendly": true 334 | }, 335 | { 336 | "title": "Windows", 337 | "url": "https://www.python.org/downloads/windows/", 338 | "is_source_local": false, 339 | "is_source_both": false, 340 | "description": "The official home of the Python Programming Language", 341 | "family_friendly": true 342 | }, 343 | { 344 | "title": "Getting Started", 345 | "url": "https://www.python.org/about/gettingstarted/", 346 | "is_source_local": false, 347 | "is_source_both": false, 348 | "description": "The official home of the Python Programming Language", 349 | "family_friendly": true 350 | } 351 | ], 352 | "extra_snippets": [ 353 | "Calculations are simple with Python, and expression syntax is straightforward: the operators +, -, * and / work as expected; parentheses () can be used for grouping. More about simple math functions in Python 3.", 354 | "The core of extensible programming is defining functions. Python allows mandatory and optional arguments, keyword arguments, and even arbitrary argument lists. More about defining functions in Python 3", 355 | "Lists (known as arrays in other languages) are one of the compound data types that Python understands. Lists can be indexed, sliced and manipulated with other built-in functions. More about lists in Python 3", 356 | "# Python 3: Simple output (with Unicode) >>> print(\"Hello, I'm Python!\") Hello, I'm Python! # Input, assignment >>> name = input('What is your name?\\n') >>> print('Hi, %s.' % name) What is your name? Python Hi, Python." 357 | ] 358 | }, 359 | { 360 | "title": "Python (programming language) - Wikipedia", 361 | "url": "https://en.wikipedia.org/wiki/Python_(programming_language)", 362 | "is_source_local": false, 363 | "is_source_both": false, 364 | "description": "Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation. Python is dynamically typed and garbage-collected. It supports multiple programming paradigms, including structured (particularly procedural), ...", 365 | "page_age": "2024-05-01T12:54:03", 366 | "profile": { 367 | "name": "Wikipedia", 368 | "url": "https://en.wikipedia.org/wiki/Python_(programming_language)", 369 | "long_name": "en.wikipedia.org", 370 | "img": "https://imgs.search.brave.com/0kxnVOiqv-faZvOJc7zpym4Zin1CTs1f1svfNZSzmfU/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvNjQwNGZhZWY0/ZTQ1YWUzYzQ3MDUw/MmMzMGY3NTQ0ZjNj/NDUwMDk5ZTI3MWRk/NWYyNTM4N2UwOTE0/NTI3ZDQzNy9lbi53/aWtpcGVkaWEub3Jn/Lw" 371 | }, 372 | "language": "en", 373 | "family_friendly": true, 374 | "type": "search_result", 375 | "subtype": "generic", 376 | "meta_url": { 377 | "scheme": "https", 378 | "netloc": "en.wikipedia.org", 379 | "hostname": "en.wikipedia.org", 380 | "favicon": "https://imgs.search.brave.com/0kxnVOiqv-faZvOJc7zpym4Zin1CTs1f1svfNZSzmfU/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvNjQwNGZhZWY0/ZTQ1YWUzYzQ3MDUw/MmMzMGY3NTQ0ZjNj/NDUwMDk5ZTI3MWRk/NWYyNTM4N2UwOTE0/NTI3ZDQzNy9lbi53/aWtpcGVkaWEub3Jn/Lw", 381 | "path": "› wiki › Python_(programming_language)" 382 | }, 383 | "age": "4 days ago", 384 | "extra_snippets": [ 385 | "Python is dynamically typed and garbage-collected. It supports multiple programming paradigms, including structured (particularly procedural), object-oriented and functional programming. It is often described as a \"batteries included\" language due to its comprehensive standard library.", 386 | "Guido van Rossum began working on Python in the late 1980s as a successor to the ABC programming language and first released it in 1991 as Python 0.9.0. Python 2.0 was released in 2000. Python 3.0, released in 2008, was a major revision not completely backward-compatible with earlier versions. Python 2.7.18, released in 2020, was the last release of Python 2.", 387 | "Python was invented in the late 1980s by Guido van Rossum at Centrum Wiskunde & Informatica (CWI) in the Netherlands as a successor to the ABC programming language, which was inspired by SETL, capable of exception handling and interfacing with the Amoeba operating system.", 388 | "Python consistently ranks as one of the most popular programming languages, and has gained widespread use in the machine learning community." 389 | ] 390 | }, 391 | { 392 | "title": "Python Tutorial", 393 | "url": "https://www.w3schools.com/python/", 394 | "is_source_local": false, 395 | "is_source_both": false, 396 | "description": "W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.", 397 | "page_age": "2017-12-07T00:00:00", 398 | "profile": { 399 | "name": "W3Schools", 400 | "url": "https://www.w3schools.com/python/", 401 | "long_name": "w3schools.com", 402 | "img": "https://imgs.search.brave.com/JwO5r7z3HTBkU29vgNH_4rrSWLf2M4-8FMWNvbxrKX8/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvYjVlMGVkZDVj/ZGMyZWRmMzAwODRi/ZDAwZGE4NWI3NmU4/MjRhNjEzOGFhZWY3/ZGViMjY1OWY2ZDYw/YTZiOGUyZS93d3cu/dzNzY2hvb2xzLmNv/bS8" 403 | }, 404 | "language": "en", 405 | "family_friendly": true, 406 | "type": "search_result", 407 | "subtype": "generic", 408 | "meta_url": { 409 | "scheme": "https", 410 | "netloc": "w3schools.com", 411 | "hostname": "www.w3schools.com", 412 | "favicon": "https://imgs.search.brave.com/JwO5r7z3HTBkU29vgNH_4rrSWLf2M4-8FMWNvbxrKX8/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvYjVlMGVkZDVj/ZGMyZWRmMzAwODRi/ZDAwZGE4NWI3NmU4/MjRhNjEzOGFhZWY3/ZGViMjY1OWY2ZDYw/YTZiOGUyZS93d3cu/dzNzY2hvb2xzLmNv/bS8", 413 | "path": "› python" 414 | }, 415 | "thumbnail": { 416 | "src": "https://imgs.search.brave.com/EMfp8dodbJehmj0yCJh8317RHuaumsddnHI4bujvFcg/rs:fit:200:200:1/g:ce/aHR0cHM6Ly93d3cu/dzNzY2hvb2xzLmNv/bS9pbWFnZXMvdzNz/Y2hvb2xzX2xvZ29f/NDM2XzIucG5n", 417 | "original": "https://www.w3schools.com/images/w3schools_logo_436_2.png", 418 | "logo": true 419 | }, 420 | "age": "December 7, 2017", 421 | "extra_snippets": [ 422 | "Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more.", 423 | "HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE", 424 | "Python Variables Variable Names Assign Multiple Values Output Variables Global Variables Variable Exercises Python Data Types Python Numbers Python Casting Python Strings", 425 | "Python Strings Slicing Strings Modify Strings Concatenate Strings Format Strings Escape Characters String Methods String Exercises Python Booleans Python Operators Python Lists" 426 | ] 427 | }, 428 | { 429 | "title": "Online Python - IDE, Editor, Compiler, Interpreter", 430 | "url": "https://www.online-python.com/", 431 | "is_source_local": false, 432 | "is_source_both": false, 433 | "description": "Build and Run your Python code instantly. Online-Python is a quick and easy tool that helps you to build, compile, test your python programs.", 434 | "profile": { 435 | "name": "Online-python", 436 | "url": "https://www.online-python.com/", 437 | "long_name": "online-python.com", 438 | "img": "https://imgs.search.brave.com/kfaEvapwHxSsRObO52-I-otYFPHpG1h7UXJyUqDM2Ec/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvZGYxODdjNWQ0/NjZjZTNiMjk5NDY1/MWI5MTgyYjU3Y2Q3/MTI3NGM5MjUzY2Fi/OGQ3MTQ4MmIxMTQx/ZTcxNWFhMC93d3cu/b25saW5lLXB5dGhv/bi5jb20v" 439 | }, 440 | "language": "en", 441 | "family_friendly": true, 442 | "type": "search_result", 443 | "subtype": "generic", 444 | "meta_url": { 445 | "scheme": "https", 446 | "netloc": "online-python.com", 447 | "hostname": "www.online-python.com", 448 | "favicon": "https://imgs.search.brave.com/kfaEvapwHxSsRObO52-I-otYFPHpG1h7UXJyUqDM2Ec/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvZGYxODdjNWQ0/NjZjZTNiMjk5NDY1/MWI5MTgyYjU3Y2Q3/MTI3NGM5MjUzY2Fi/OGQ3MTQ4MmIxMTQx/ZTcxNWFhMC93d3cu/b25saW5lLXB5dGhv/bi5jb20v", 449 | "path": "" 450 | }, 451 | "extra_snippets": [ 452 | "Build, run, and share Python code online for free with the help of online-integrated python's development environment (IDE). It is one of the most efficient, dependable, and potent online compilers for the Python programming language. It is not necessary for you to bother about establishing a Python environment in your local.", 453 | "It is one of the most efficient, dependable, and potent online compilers for the Python programming language. It is not necessary for you to bother about establishing a Python environment in your local. Now You can immediately execute the Python code in the web browser of your choice.", 454 | "It is not necessary for you to bother about establishing a Python environment in your local. Now You can immediately execute the Python code in the web browser of your choice. Using this Python editor is simple and quick to get up and running with. Simply type in the programme, and then press the RUN button!", 455 | "Now You can immediately execute the Python code in the web browser of your choice. Using this Python editor is simple and quick to get up and running with. Simply type in the programme, and then press the RUN button! The code can be saved online by choosing the SHARE option, which also gives you the ability to access your code from any location providing you have internet access." 456 | ] 457 | }, 458 | { 459 | "title": "Python · GitHub", 460 | "url": "https://github.com/python", 461 | "is_source_local": false, 462 | "is_source_both": false, 463 | "description": "Repositories related to the Python Programming language - Python", 464 | "page_age": "2023-03-06T00:00:00", 465 | "profile": { 466 | "name": "GitHub", 467 | "url": "https://github.com/python", 468 | "long_name": "github.com", 469 | "img": "https://imgs.search.brave.com/v8685zI4XInM0zxlNI2s7oE_2Sb-EL7lAy81WXbkQD8/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvYWQyNWM1NjA5/ZjZmZjNlYzI2MDNk/N2VkNmJhYjE2MzZl/MDY5ZTMxMDUzZmY1/NmU3NWIzNWVmMjk0/NTBjMjJjZi9naXRo/dWIuY29tLw" 470 | }, 471 | "language": "en", 472 | "family_friendly": true, 473 | "type": "search_result", 474 | "subtype": "generic", 475 | "meta_url": { 476 | "scheme": "https", 477 | "netloc": "github.com", 478 | "hostname": "github.com", 479 | "favicon": "https://imgs.search.brave.com/v8685zI4XInM0zxlNI2s7oE_2Sb-EL7lAy81WXbkQD8/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvYWQyNWM1NjA5/ZjZmZjNlYzI2MDNk/N2VkNmJhYjE2MzZl/MDY5ZTMxMDUzZmY1/NmU3NWIzNWVmMjk0/NTBjMjJjZi9naXRo/dWIuY29tLw", 480 | "path": "› python" 481 | }, 482 | "thumbnail": { 483 | "src": "https://imgs.search.brave.com/POoaRfu_7gfp-D_O3qMNJrwDqJNbiDu1HuBpNJ_MpVQ/rs:fit:200:200:1/g:ce/aHR0cHM6Ly9hdmF0/YXJzLmdpdGh1YnVz/ZXJjb250ZW50LmNv/bS91LzE1MjU5ODE_/cz0yMDAmYW1wO3Y9/NA", 484 | "original": "https://avatars.githubusercontent.com/u/1525981?s=200&v=4", 485 | "logo": false 486 | }, 487 | "age": "March 6, 2023", 488 | "extra_snippets": ["Configuration for Python planets (e.g. http://planetpython.org)"] 489 | }, 490 | { 491 | "title": "Online Python Compiler (Interpreter)", 492 | "url": "https://www.programiz.com/python-programming/online-compiler/", 493 | "is_source_local": false, 494 | "is_source_both": false, 495 | "description": "Write and run Python code using our online compiler (interpreter). You can use Python Shell like IDLE, and take inputs from the user in our Python compiler.", 496 | "page_age": "2020-06-02T00:00:00", 497 | "profile": { 498 | "name": "Programiz", 499 | "url": "https://www.programiz.com/python-programming/online-compiler/", 500 | "long_name": "programiz.com", 501 | "img": "https://imgs.search.brave.com/ozj4JFayZ3Fs5c9eTp7M5g12azQ_Hblgu4dpTuHRz6U/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvMGJlN2U1YjVi/Y2M3ZDU5OGMwMWNi/M2Q3YjhjOTM1ZTFk/Y2NkZjE4NGQwOGIx/MTQ4NjI2YmNhODVj/MzFkMmJhYy93d3cu/cHJvZ3JhbWl6LmNv/bS8" 502 | }, 503 | "language": "en", 504 | "family_friendly": true, 505 | "type": "search_result", 506 | "subtype": "generic", 507 | "meta_url": { 508 | "scheme": "https", 509 | "netloc": "programiz.com", 510 | "hostname": "www.programiz.com", 511 | "favicon": "https://imgs.search.brave.com/ozj4JFayZ3Fs5c9eTp7M5g12azQ_Hblgu4dpTuHRz6U/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvMGJlN2U1YjVi/Y2M3ZDU5OGMwMWNi/M2Q3YjhjOTM1ZTFk/Y2NkZjE4NGQwOGIx/MTQ4NjI2YmNhODVj/MzFkMmJhYy93d3cu/cHJvZ3JhbWl6LmNv/bS8", 512 | "path": "› python-programming › online-compiler" 513 | }, 514 | "age": "June 2, 2020", 515 | "extra_snippets": [ 516 | "Python Online Compiler Online R Compiler SQL Online Editor Online HTML/CSS Editor Online Java Compiler C Online Compiler C++ Online Compiler C# Online Compiler JavaScript Online Compiler Online GoLang Compiler Online PHP Compiler Online Swift Compiler Online Rust Compiler", 517 | "# Online Python compiler (interpreter) to run Python online. # Write Python 3 code in this online editor and run it. print(\"Try programiz.pro\")" 518 | ] 519 | }, 520 | { 521 | "title": "Python Developer", 522 | "url": "https://twitter.com/Python_Dv/status/1786763460992544791", 523 | "is_source_local": false, 524 | "is_source_both": false, 525 | "description": "Python Developer", 526 | "page_age": "2024-05-04T14:30:03", 527 | "profile": { 528 | "name": "X", 529 | "url": "https://twitter.com/Python_Dv/status/1786763460992544791", 530 | "long_name": "twitter.com", 531 | "img": "https://imgs.search.brave.com/Zq483bGX0GnSgym-1P7iyOyEDX3PkDZSNT8m56F862A/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvN2MxOTUxNzhj/OTY1ZTQ3N2I0MjJk/MTY5NGM0MTRlYWVi/MjU1YWE2NDUwYmQ2/YTA2MDFhMDlkZDEx/NTAzZGNiNi90d2l0/dGVyLmNvbS8" 532 | }, 533 | "language": "en", 534 | "family_friendly": true, 535 | "type": "search_result", 536 | "subtype": "generic", 537 | "meta_url": { 538 | "scheme": "https", 539 | "netloc": "twitter.com", 540 | "hostname": "twitter.com", 541 | "favicon": "https://imgs.search.brave.com/Zq483bGX0GnSgym-1P7iyOyEDX3PkDZSNT8m56F862A/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvN2MxOTUxNzhj/OTY1ZTQ3N2I0MjJk/MTY5NGM0MTRlYWVi/MjU1YWE2NDUwYmQ2/YTA2MDFhMDlkZDEx/NTAzZGNiNi90d2l0/dGVyLmNvbS8", 542 | "path": "› Python_Dv › status › 1786763460992544791" 543 | }, 544 | "age": "20 hours ago" 545 | }, 546 | { 547 | "title": "input table name? - python script - KNIME Extensions - KNIME Community Forum", 548 | "url": "https://forum.knime.com/t/input-table-name-python-script/78978", 549 | "is_source_local": false, 550 | "is_source_both": false, 551 | "description": "Hi, when running a python script node, I get the error seen on the screenshot Same happens with this code too: The script input is output from the csv reader node. How can I get the right name for that table? Best wishes, Dario", 552 | "page_age": "2024-05-04T09:20:44", 553 | "profile": { 554 | "name": "Knime", 555 | "url": "https://forum.knime.com/t/input-table-name-python-script/78978", 556 | "long_name": "forum.knime.com", 557 | "img": "https://imgs.search.brave.com/WQoOhAD5i6uEhJ-qXvlWMJwbGA52f2Ycc_ns36EK698/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvOTAxNzMxNjFl/MzJjNzU5NzRkOTMz/Mjg4NDU2OWUxM2Rj/YzVkOGM3MzIwNzI2/YTY1NzYxNzA1MDE5/NzQzOWU3NC9mb3J1/bS5rbmltZS5jb20v" 558 | }, 559 | "language": "en", 560 | "family_friendly": true, 561 | "type": "search_result", 562 | "subtype": "article", 563 | "meta_url": { 564 | "scheme": "https", 565 | "netloc": "forum.knime.com", 566 | "hostname": "forum.knime.com", 567 | "favicon": "https://imgs.search.brave.com/WQoOhAD5i6uEhJ-qXvlWMJwbGA52f2Ycc_ns36EK698/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvOTAxNzMxNjFl/MzJjNzU5NzRkOTMz/Mjg4NDU2OWUxM2Rj/YzVkOGM3MzIwNzI2/YTY1NzYxNzA1MDE5/NzQzOWU3NC9mb3J1/bS5rbmltZS5jb20v", 568 | "path": " › knime extensions" 569 | }, 570 | "thumbnail": { 571 | "src": "https://imgs.search.brave.com/DtEl38dcvuM1kGfhN0T5HfOrsMJcztWNyriLvtDJmKI/rs:fit:200:200:1/g:ce/aHR0cHM6Ly9mb3J1/bS1jZG4ua25pbWUu/Y29tL3VwbG9hZHMv/ZGVmYXVsdC9vcmln/aW5hbC8zWC9lLzYv/ZTY0M2M2NzFlNzAz/MDg2MjkwMWY2YzJh/OWFjOWI5ZmEwM2M3/ZjMwZi5wbmc", 572 | "original": "https://forum-cdn.knime.com/uploads/default/original/3X/e/6/e643c671e7030862901f6c2a9ac9b9fa03c7f30f.png", 573 | "logo": false 574 | }, 575 | "age": "1 day ago", 576 | "extra_snippets": [ 577 | "Hi, when running a python script node, I get the error seen on the screenshot Same happens with this code too: The script input is output from the csv reader node. How can I get the right name for that table? …" 578 | ] 579 | }, 580 | { 581 | "title": "What does the Double Star operator mean in Python? - GeeksforGeeks", 582 | "url": "https://www.geeksforgeeks.org/what-does-the-double-star-operator-mean-in-python/", 583 | "is_source_local": false, 584 | "is_source_both": false, 585 | "description": "A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.", 586 | "page_age": "2023-03-14T17:15:04", 587 | "profile": { 588 | "name": "GeeksforGeeks", 589 | "url": "https://www.geeksforgeeks.org/what-does-the-double-star-operator-mean-in-python/", 590 | "long_name": "geeksforgeeks.org", 591 | "img": "https://imgs.search.brave.com/fhzcfv5xltx6-YBvJI9RZgS7xZo0dPNaASsrB8YOsCs/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvYjBhOGQ3MmNi/ZWE5N2EwMmZjYzA1/ZTI0ZTFhMGUyMTE0/MGM0ZTBmMWZlM2Y2/Yzk2ODMxZTRhYTBi/NDdjYTE0OS93d3cu/Z2Vla3Nmb3JnZWVr/cy5vcmcv" 592 | }, 593 | "language": "en", 594 | "family_friendly": true, 595 | "type": "search_result", 596 | "subtype": "article", 597 | "meta_url": { 598 | "scheme": "https", 599 | "netloc": "geeksforgeeks.org", 600 | "hostname": "www.geeksforgeeks.org", 601 | "favicon": "https://imgs.search.brave.com/fhzcfv5xltx6-YBvJI9RZgS7xZo0dPNaASsrB8YOsCs/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvYjBhOGQ3MmNi/ZWE5N2EwMmZjYzA1/ZTI0ZTFhMGUyMTE0/MGM0ZTBmMWZlM2Y2/Yzk2ODMxZTRhYTBi/NDdjYTE0OS93d3cu/Z2Vla3Nmb3JnZWVr/cy5vcmcv", 602 | "path": "› what-does-the-double-star-operator-mean-in-python" 603 | }, 604 | "thumbnail": { 605 | "src": "https://imgs.search.brave.com/GcR-j_dLbyHkbHEI3ffLMi6xpXGhF_2Z8POIoqtokhM/rs:fit:200:200:1/g:ce/aHR0cHM6Ly9tZWRp/YS5nZWVrc2Zvcmdl/ZWtzLm9yZy93cC1j/b250ZW50L3VwbG9h/ZHMvZ2ZnXzIwMFgy/MDAtMTAweDEwMC5w/bmc", 606 | "original": "https://media.geeksforgeeks.org/wp-content/uploads/gfg_200X200-100x100.png", 607 | "logo": false 608 | }, 609 | "age": "March 14, 2023", 610 | "extra_snippets": [ 611 | "Difference between / vs. // operator in Python", 612 | "Double Star or (**) is one of the Arithmetic Operator (Like +, -, *, **, /, //, %) in Python Language. It is also known as Power Operator.", 613 | "The time complexity of the given Python program is O(n), where n is the number of key-value pairs in the input dictionary.", 614 | "Inplace Operators in Python | Set 2 (ixor(), iand(), ipow(),…)" 615 | ] 616 | }, 617 | { 618 | "title": "r/Python", 619 | "url": "https://www.reddit.com/r/Python/", 620 | "is_source_local": false, 621 | "is_source_both": false, 622 | "description": "The official Python community for Reddit! Stay up to date with the latest news, packages, and meta information relating to the Python programming language. --- If you have questions or are new to Python use r/LearnPython", 623 | "page_age": "2022-12-30T16:25:02", 624 | "profile": { 625 | "name": "Reddit", 626 | "url": "https://www.reddit.com/r/Python/", 627 | "long_name": "reddit.com", 628 | "img": "https://imgs.search.brave.com/mAZYEK9Wi13WLDUge7XZ8YuDTwm6DP6gBjvz1GdYZVY/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvN2ZiNTU0M2Nj/MTFhZjRiYWViZDlk/MjJiMjBjMzFjMDRk/Y2IzYWI0MGI0MjVk/OGY5NzQzOGQ5NzQ5/NWJhMWI0NC93d3cu/cmVkZGl0LmNvbS8" 629 | }, 630 | "language": "en", 631 | "family_friendly": true, 632 | "type": "search_result", 633 | "subtype": "generic", 634 | "meta_url": { 635 | "scheme": "https", 636 | "netloc": "reddit.com", 637 | "hostname": "www.reddit.com", 638 | "favicon": "https://imgs.search.brave.com/mAZYEK9Wi13WLDUge7XZ8YuDTwm6DP6gBjvz1GdYZVY/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvN2ZiNTU0M2Nj/MTFhZjRiYWViZDlk/MjJiMjBjMzFjMDRk/Y2IzYWI0MGI0MjVk/OGY5NzQzOGQ5NzQ5/NWJhMWI0NC93d3cu/cmVkZGl0LmNvbS8", 639 | "path": "› r › Python" 640 | }, 641 | "thumbnail": { 642 | "src": "https://imgs.search.brave.com/zWd10t3zg34ciHiAB-K5WWK3h_H4LedeDot9BVX7Ydo/rs:fit:200:200:1/g:ce/aHR0cHM6Ly9zdHls/ZXMucmVkZGl0bWVk/aWEuY29tL3Q1XzJx/aDB5L3N0eWxlcy9j/b21tdW5pdHlJY29u/X2NpZmVobDR4dDdu/YzEucG5n", 643 | "original": "https://styles.redditmedia.com/t5_2qh0y/styles/communityIcon_cifehl4xt7nc1.png", 644 | "logo": false 645 | }, 646 | "age": "December 30, 2022", 647 | "extra_snippets": [ 648 | "r/Python: The official Python community for Reddit! Stay up to date with the latest news, packages, and meta information relating to the Python…", 649 | "By default, Python allows you to import and use anything, anywhere. Over time, this results in modules that were intended to be separate getting tightly coupled together, and domain boundaries breaking down. We experienced this first-hand at a unicorn startup, where the eng team paused development for over a year in an attempt to split up packages into independent services.", 650 | "Hello r/Python! It's time to share what you've been working on! Whether it's a work-in-progress, a completed masterpiece, or just a rough idea, let us know what you're up to!", 651 | "Whether it's your job, your hobby, or your passion project, all Python-related work is welcome here." 652 | ] 653 | }, 654 | { 655 | "title": "GitHub - python/cpython: The Python programming language", 656 | "url": "https://github.com/python/cpython", 657 | "is_source_local": false, 658 | "is_source_both": false, 659 | "description": "The Python programming language. Contribute to python/cpython development by creating an account on GitHub.", 660 | "page_age": "2022-10-29T00:00:00", 661 | "profile": { 662 | "name": "GitHub", 663 | "url": "https://github.com/python/cpython", 664 | "long_name": "github.com", 665 | "img": "https://imgs.search.brave.com/v8685zI4XInM0zxlNI2s7oE_2Sb-EL7lAy81WXbkQD8/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvYWQyNWM1NjA5/ZjZmZjNlYzI2MDNk/N2VkNmJhYjE2MzZl/MDY5ZTMxMDUzZmY1/NmU3NWIzNWVmMjk0/NTBjMjJjZi9naXRo/dWIuY29tLw" 666 | }, 667 | "language": "en", 668 | "family_friendly": true, 669 | "type": "search_result", 670 | "subtype": "software", 671 | "meta_url": { 672 | "scheme": "https", 673 | "netloc": "github.com", 674 | "hostname": "github.com", 675 | "favicon": "https://imgs.search.brave.com/v8685zI4XInM0zxlNI2s7oE_2Sb-EL7lAy81WXbkQD8/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvYWQyNWM1NjA5/ZjZmZjNlYzI2MDNk/N2VkNmJhYjE2MzZl/MDY5ZTMxMDUzZmY1/NmU3NWIzNWVmMjk0/NTBjMjJjZi9naXRo/dWIuY29tLw", 676 | "path": "› python › cpython" 677 | }, 678 | "thumbnail": { 679 | "src": "https://imgs.search.brave.com/BJbWFRUqgP-tKIyGK9ByXjuYjHO2mtYigUOEFNz_gXk/rs:fit:200:200:1/g:ce/aHR0cHM6Ly9vcGVu/Z3JhcGguZ2l0aHVi/YXNzZXRzLmNvbS82/MTY5YmJkNTQ0YzAy/NDg0MGU4NDdjYTU1/YTU3ZGZmMDA2ZDAw/YWQ1NDIzOTFmYTQ3/YmJjODg3OWM0NWYw/MTZhL3B5dGhvbi9j/cHl0aG9u", 680 | "original": "https://opengraph.githubassets.com/6169bbd544c024840e847ca55a57dff006d00ad542391fa47bbc8879c45f016a/python/cpython", 681 | "logo": false 682 | }, 683 | "age": "October 29, 2022", 684 | "extra_snippets": [ 685 | "You can pass many options to the configure script; run ./configure --help to find out more. On macOS case-insensitive file systems and on Cygwin, the executable is called python.exe; elsewhere it's just python.", 686 | "Building a complete Python installation requires the use of various additional third-party libraries, depending on your build platform and configure options. Not all standard library modules are buildable or useable on all platforms. Refer to the Install dependencies section of the Developer Guide for current detailed information on dependencies for various Linux distributions and macOS.", 687 | "To get an optimized build of Python, configure --enable-optimizations before you run make. This sets the default make targets up to enable Profile Guided Optimization (PGO) and may be used to auto-enable Link Time Optimization (LTO) on some platforms. For more details, see the sections below.", 688 | "Copyright © 2001-2024 Python Software Foundation. All rights reserved." 689 | ] 690 | }, 691 | { 692 | "title": "5. Data Structures — Python 3.12.3 documentation", 693 | "url": "https://docs.python.org/3/tutorial/datastructures.html", 694 | "is_source_local": false, 695 | "is_source_both": false, 696 | "description": "This chapter describes some things you’ve learned about already in more detail, and adds some new things as well. More on Lists: The list data type has some more methods. Here are all of the method...", 697 | "page_age": "2023-07-04T00:00:00", 698 | "profile": { 699 | "name": "Python documentation", 700 | "url": "https://docs.python.org/3/tutorial/datastructures.html", 701 | "long_name": "docs.python.org", 702 | "img": "https://imgs.search.brave.com/F5Ym7eSElhGdGUFKLRxDj9Z_tc180ldpeMvQ2Q6ARbA/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvMTUzOTFjOGVi/YTcyOTVmODA3ODIy/YjE2NzFjY2ViMjhl/NzRlY2JhYTc5YjNm/ZjhmODAyZWI2OGUw/ZjU4NDVlNy9kb2Nz/LnB5dGhvbi5vcmcv" 703 | }, 704 | "language": "en", 705 | "family_friendly": true, 706 | "type": "search_result", 707 | "subtype": "generic", 708 | "meta_url": { 709 | "scheme": "https", 710 | "netloc": "docs.python.org", 711 | "hostname": "docs.python.org", 712 | "favicon": "https://imgs.search.brave.com/F5Ym7eSElhGdGUFKLRxDj9Z_tc180ldpeMvQ2Q6ARbA/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvMTUzOTFjOGVi/YTcyOTVmODA3ODIy/YjE2NzFjY2ViMjhl/NzRlY2JhYTc5YjNm/ZjhmODAyZWI2OGUw/ZjU4NDVlNy9kb2Nz/LnB5dGhvbi5vcmcv", 713 | "path": "› 3 › tutorial › datastructures.html" 714 | }, 715 | "thumbnail": { 716 | "src": "https://imgs.search.brave.com/Y7GrMRF8WorDIMLuOl97XC8ltYpoOCqNwWF2pQIIKls/rs:fit:200:200:1/g:ce/aHR0cHM6Ly9kb2Nz/LnB5dGhvbi5vcmcv/My9fc3RhdGljL29n/LWltYWdlLnBuZw", 717 | "original": "https://docs.python.org/3/_static/og-image.png", 718 | "logo": false 719 | }, 720 | "age": "July 4, 2023", 721 | "extra_snippets": [ 722 | "You might have noticed that methods like insert, remove or sort that only modify the list have no return value printed – they return the default None. [1] This is a design principle for all mutable data structures in Python.", 723 | "We saw that lists and strings have many common properties, such as indexing and slicing operations. They are two examples of sequence data types (see Sequence Types — list, tuple, range). Since Python is an evolving language, other sequence data types may be added. There is also another standard sequence data type: the tuple.", 724 | "Python also includes a data type for sets. A set is an unordered collection with no duplicate elements. Basic uses include membership testing and eliminating duplicate entries. Set objects also support mathematical operations like union, intersection, difference, and symmetric difference.", 725 | "Another useful data type built into Python is the dictionary (see Mapping Types — dict). Dictionaries are sometimes found in other languages as “associative memories” or “associative arrays”. Unlike sequences, which are indexed by a range of numbers, dictionaries are indexed by keys, which can be any immutable type; strings and numbers can always be keys." 726 | ] 727 | }, 728 | { 729 | "title": "Something wrong with python packages / AUR Issues, Discussion & PKGBUILD Requests / Arch Linux Forums", 730 | "url": "https://bbs.archlinux.org/viewtopic.php?id=295466", 731 | "is_source_local": false, 732 | "is_source_both": false, 733 | "description": "Big Python updates require Python packages to be rebuild. For some reason they didn't think a bump that made it necessary to rebuild half the official repo was a news post.", 734 | "page_age": "2024-05-04T08:30:02", 735 | "profile": { 736 | "name": "Archlinux", 737 | "url": "https://bbs.archlinux.org/viewtopic.php?id=295466", 738 | "long_name": "bbs.archlinux.org", 739 | "img": "https://imgs.search.brave.com/3au9oqkzSri_aLEec3jo-0bFgLuICkydrWfjFcC8lkI/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvNWNkODM1MWJl/ZmJhMzkzNzYzMDkz/NmEyMWMxNjI5MjNk/NGJmZjFhNTBlZDNl/Mzk5MzJjOGZkYjZl/MjNmY2IzNS9iYnMu/YXJjaGxpbnV4Lm9y/Zy8" 740 | }, 741 | "language": "en", 742 | "family_friendly": true, 743 | "type": "search_result", 744 | "subtype": "generic", 745 | "meta_url": { 746 | "scheme": "https", 747 | "netloc": "bbs.archlinux.org", 748 | "hostname": "bbs.archlinux.org", 749 | "favicon": "https://imgs.search.brave.com/3au9oqkzSri_aLEec3jo-0bFgLuICkydrWfjFcC8lkI/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvNWNkODM1MWJl/ZmJhMzkzNzYzMDkz/NmEyMWMxNjI5MjNk/NGJmZjFhNTBlZDNl/Mzk5MzJjOGZkYjZl/MjNmY2IzNS9iYnMu/YXJjaGxpbnV4Lm9y/Zy8", 750 | "path": "› viewtopic.php" 751 | }, 752 | "age": "1 day ago", 753 | "extra_snippets": [ 754 | "Traceback (most recent call last): File \"/usr/lib/python3.12/importlib/metadata/__init__.py\", line 397, in from_name return next(cls.discover(name=name)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ StopIteration During handling of the above exception, another exception occurred: Traceback (most recent call last): File \"/usr/bin/informant\", line 33, in sys.exit(load_entry_point('informant==0.5.0', 'console_scripts', 'informant')()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File \"/usr/bin/informant\", line 22, in importlib_load_entry_point for entry_point in distribution(dis" 755 | ] 756 | }, 757 | { 758 | "title": "Introduction to Python", 759 | "url": "https://www.w3schools.com/python/python_intro.asp", 760 | "is_source_local": false, 761 | "is_source_both": false, 762 | "description": "W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.", 763 | "profile": { 764 | "name": "W3Schools", 765 | "url": "https://www.w3schools.com/python/python_intro.asp", 766 | "long_name": "w3schools.com", 767 | "img": "https://imgs.search.brave.com/JwO5r7z3HTBkU29vgNH_4rrSWLf2M4-8FMWNvbxrKX8/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvYjVlMGVkZDVj/ZGMyZWRmMzAwODRi/ZDAwZGE4NWI3NmU4/MjRhNjEzOGFhZWY3/ZGViMjY1OWY2ZDYw/YTZiOGUyZS93d3cu/dzNzY2hvb2xzLmNv/bS8" 768 | }, 769 | "language": "en", 770 | "family_friendly": true, 771 | "type": "search_result", 772 | "subtype": "generic", 773 | "meta_url": { 774 | "scheme": "https", 775 | "netloc": "w3schools.com", 776 | "hostname": "www.w3schools.com", 777 | "favicon": "https://imgs.search.brave.com/JwO5r7z3HTBkU29vgNH_4rrSWLf2M4-8FMWNvbxrKX8/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvYjVlMGVkZDVj/ZGMyZWRmMzAwODRi/ZDAwZGE4NWI3NmU4/MjRhNjEzOGFhZWY3/ZGViMjY1OWY2ZDYw/YTZiOGUyZS93d3cu/dzNzY2hvb2xzLmNv/bS8", 778 | "path": "› python › python_intro.asp" 779 | }, 780 | "thumbnail": { 781 | "src": "https://imgs.search.brave.com/EMfp8dodbJehmj0yCJh8317RHuaumsddnHI4bujvFcg/rs:fit:200:200:1/g:ce/aHR0cHM6Ly93d3cu/dzNzY2hvb2xzLmNv/bS9pbWFnZXMvdzNz/Y2hvb2xzX2xvZ29f/NDM2XzIucG5n", 782 | "original": "https://www.w3schools.com/images/w3schools_logo_436_2.png", 783 | "logo": true 784 | }, 785 | "extra_snippets": [ 786 | "Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more.", 787 | "HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE", 788 | "Python Variables Variable Names Assign Multiple Values Output Variables Global Variables Variable Exercises Python Data Types Python Numbers Python Casting Python Strings", 789 | "Python Strings Slicing Strings Modify Strings Concatenate Strings Format Strings Escape Characters String Methods String Exercises Python Booleans Python Operators Python Lists" 790 | ] 791 | }, 792 | { 793 | "title": "bug: AUR package wants to use python but does not find any preset version · Issue #1740 · asdf-vm/asdf", 794 | "url": "https://github.com/asdf-vm/asdf/issues/1740", 795 | "is_source_local": false, 796 | "is_source_both": false, 797 | "description": "Describe the Bug I am not sure why this is happening, I am trying to install tlpui from AUR and it fails, here are some logs to help: ==> Making package: tlpui 2:1.6.5-1 (Mi 10 apr 2024 23:19:15 +0...", 798 | "page_age": "2024-05-04T06:45:04", 799 | "profile": { 800 | "name": "GitHub", 801 | "url": "https://github.com/asdf-vm/asdf/issues/1740", 802 | "long_name": "github.com", 803 | "img": "https://imgs.search.brave.com/v8685zI4XInM0zxlNI2s7oE_2Sb-EL7lAy81WXbkQD8/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvYWQyNWM1NjA5/ZjZmZjNlYzI2MDNk/N2VkNmJhYjE2MzZl/MDY5ZTMxMDUzZmY1/NmU3NWIzNWVmMjk0/NTBjMjJjZi9naXRo/dWIuY29tLw" 804 | }, 805 | "language": "en", 806 | "family_friendly": true, 807 | "type": "search_result", 808 | "subtype": "software", 809 | "meta_url": { 810 | "scheme": "https", 811 | "netloc": "github.com", 812 | "hostname": "github.com", 813 | "favicon": "https://imgs.search.brave.com/v8685zI4XInM0zxlNI2s7oE_2Sb-EL7lAy81WXbkQD8/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvYWQyNWM1NjA5/ZjZmZjNlYzI2MDNk/N2VkNmJhYjE2MzZl/MDY5ZTMxMDUzZmY1/NmU3NWIzNWVmMjk0/NTBjMjJjZi9naXRo/dWIuY29tLw", 814 | "path": "› asdf-vm › asdf › issues › 1740" 815 | }, 816 | "thumbnail": { 817 | "src": "https://imgs.search.brave.com/KrLW5s_2n4jyP8XLbc3ZPVBaLD963tQgWzG9EWPZlQs/rs:fit:200:200:1/g:ce/aHR0cHM6Ly9vcGVu/Z3JhcGguZ2l0aHVi/YXNzZXRzLmNvbS81/MTE0ZTdkOGIwODM2/YmQ2MTY3NzQ1ZGI4/MmZjMGE3OGUyMjcw/MGFlY2ZjMWZkODBl/MDYzZTNiN2ZjOWNj/NzYyL2FzZGYtdm0v/YXNkZi9pc3N1ZXMv/MTc0MA", 818 | "original": "https://opengraph.githubassets.com/5114e7d8b0836bd6167745db82fc0a78e22700aecfc1fd80e063e3b7fc9cc762/asdf-vm/asdf/issues/1740", 819 | "logo": false 820 | }, 821 | "age": "1 day ago", 822 | "extra_snippets": [ 823 | "==> Starting build()... No preset version installed for command python Please install a version by running one of the following: asdf install python 3.8 or add one of the following versions in your config file at /home/ferret/.tool-versions python 3.11.0 python 3.12.1 python 3.12.3 ==> ERROR: A failure occurred in build(). Aborting...", 824 | "-> error making: tlpui-exit status 4 -> Failed to install the following packages. Manual intervention is required: tlpui - exit status 4 ferret@FX505DT in ~ $ cat /home/ferret/.tool-versions nodejs 21.6.0 python 3.12.3 ferret@FX505DT in ~ $ python -V Python 3.12.3 ferret@FX505DT in ~ $ which python /home/ferret/.asdf/shims/python", 825 | "Describe the Bug I am not sure why this is happening, I am trying to install tlpui from AUR and it fails, here are some logs to help: ==> Making package: tlpui 2:1.6.5-1 (Mi 10 apr 2024 23:19:15 +0300) ==> Retrieving sources... -> Found ..." 826 | ] 827 | }, 828 | { 829 | "title": "What are python.exe and python3.exe, and why do they appear to point to App Installer? | Windows 11 Forum", 830 | "url": "https://www.elevenforum.com/t/what-are-python-exe-and-python3-exe-and-why-do-they-appear-to-point-to-app-installer.24886/", 831 | "is_source_local": false, 832 | "is_source_both": false, 833 | "description": "I was looking at App execution aliases (Settings > Apps > Advanced app settings > App execution aliases) on my new computer -- my first Windows 11 computer. Why are python.exe and python3.exe listed as App Installer? I assume that App Installer refers to installation of Microsoft Store / UWP...", 834 | "page_age": "2024-05-03T17:30:04", 835 | "profile": { 836 | "name": "Windows 11 Forum", 837 | "url": "https://www.elevenforum.com/t/what-are-python-exe-and-python3-exe-and-why-do-they-appear-to-point-to-app-installer.24886/", 838 | "long_name": "elevenforum.com", 839 | "img": "https://imgs.search.brave.com/XVRAYMEj6Im8i7jV5RxeTwpiRPtY9IWg4wRIuh-WhEw/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvZjk5MDZkMDIw/M2U1OWIwNjM5Y2U1/M2U2NzNiNzVkNTA5/NzA5OTI1ZTFmOTc4/MzU3OTlhYzU5OTVi/ZGNjNTY4MS93d3cu/ZWxldmVuZm9ydW0u/Y29tLw" 840 | }, 841 | "language": "en", 842 | "family_friendly": true, 843 | "type": "search_result", 844 | "subtype": "generic", 845 | "meta_url": { 846 | "scheme": "https", 847 | "netloc": "elevenforum.com", 848 | "hostname": "www.elevenforum.com", 849 | "favicon": "https://imgs.search.brave.com/XVRAYMEj6Im8i7jV5RxeTwpiRPtY9IWg4wRIuh-WhEw/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvZjk5MDZkMDIw/M2U1OWIwNjM5Y2U1/M2U2NzNiNzVkNTA5/NzA5OTI1ZTFmOTc4/MzU3OTlhYzU5OTVi/ZGNjNTY4MS93d3cu/ZWxldmVuZm9ydW0u/Y29tLw", 850 | "path": " › windows support forums › apps and software" 851 | }, 852 | "thumbnail": { 853 | "src": "https://imgs.search.brave.com/DVoFcE6d_-lx3BVGNS-RZK_lZzxQ8VhwZVf3AVqEJFA/rs:fit:200:200:1/g:ce/aHR0cHM6Ly93d3cu/ZWxldmVuZm9ydW0u/Y29tL2RhdGEvYXNz/ZXRzL2xvZ28vbWV0/YTEtMjAxLnBuZw", 854 | "original": "https://www.elevenforum.com/data/assets/logo/meta1-201.png", 855 | "logo": true 856 | }, 857 | "age": "2 days ago", 858 | "extra_snippets": [ 859 | "Why are python.exe and python3.exe listed as App Installer? I assume that App Installer refers to installation of Microsoft Store / UWP apps, but if that's the case, then why are they called python.exe and python3.exe? Or are python.exe and python3.exe simply serving as aliases / pointers pointing to App Installer, which is itself a Microsoft Store App?", 860 | "Or are python.exe and python3.exe simply serving as aliases / pointers pointing to App Installer, which is itself a Microsoft Store App? I wish to soon install Python, along with an integrated development editor (IDE), on my machine, so that I can code in Python.", 861 | "I wish to soon install Python, along with an integrated development editor (IDE), on my machine, so that I can code in Python. But is a Python interpreter already on my computer as suggested, if obliquely, by the presence of python.exe and python3.exe? I kind of doubt it." 862 | ] 863 | }, 864 | { 865 | "title": "How to Watermark Your Images Using Python OpenCV in ...", 866 | "url": "https://medium.com/@daily_data_prep/how-to-watermark-your-images-using-python-opencv-in-bulk-e472085389a1", 867 | "is_source_local": false, 868 | "is_source_both": false, 869 | "description": "Medium is an open platform where readers find dynamic thinking, and where expert and undiscovered voices can share their writing on any topic.", 870 | "page_age": "2024-05-03T14:05:06", 871 | "profile": { 872 | "name": "Medium", 873 | "url": "https://medium.com/@daily_data_prep/how-to-watermark-your-images-using-python-opencv-in-bulk-e472085389a1", 874 | "long_name": "medium.com", 875 | "img": "https://imgs.search.brave.com/qvE2kIQCiAsnPv2C6P9xM5J2VVWdm55g-A-2Q_yIJ0g/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvOTZhYmQ1N2Q4/NDg4ZDcyODIyMDZi/MzFmOWNhNjE3Y2E4/Y2YzMThjNjljNDIx/ZjllZmNhYTcwODhl/YTcwNDEzYy9tZWRp/dW0uY29tLw" 876 | }, 877 | "language": "en", 878 | "family_friendly": true, 879 | "type": "search_result", 880 | "subtype": "generic", 881 | "meta_url": { 882 | "scheme": "https", 883 | "netloc": "medium.com", 884 | "hostname": "medium.com", 885 | "favicon": "https://imgs.search.brave.com/qvE2kIQCiAsnPv2C6P9xM5J2VVWdm55g-A-2Q_yIJ0g/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvOTZhYmQ1N2Q4/NDg4ZDcyODIyMDZi/MzFmOWNhNjE3Y2E4/Y2YzMThjNjljNDIx/ZjllZmNhYTcwODhl/YTcwNDEzYy9tZWRp/dW0uY29tLw", 886 | "path": "› @daily_data_prep › how-to-watermark-your-images-using-python-opencv-in-bulk-e472085389a1" 887 | }, 888 | "age": "2 days ago" 889 | }, 890 | { 891 | "title": "Increment and Decrement Operators in Python?", 892 | "url": "https://www.tutorialspoint.com/increment-and-decrement-operators-in-python", 893 | "is_source_local": false, 894 | "is_source_both": false, 895 | "description": "Increment and Decrement Operators in Python - Python does not have unary increment/decrement operator (++/--). Instead to increment a value, usea += 1to decrement a value, use −a -= 1Example>>> a = 0 >>> >>> #Increment >>> a +=1 >>> >>> #Decrement >>> a -= 1 >>> >>> #value of a >>> a 0Python ...", 896 | "page_age": "2023-08-23T00:00:00", 897 | "profile": { 898 | "name": "Tutorialspoint", 899 | "url": "https://www.tutorialspoint.com/increment-and-decrement-operators-in-python", 900 | "long_name": "tutorialspoint.com", 901 | "img": "https://imgs.search.brave.com/Wt8BSkivPlFwcU5yBtf7YzuvTuRExyd_502cdABCS5c/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvYjcyYjAzYmVl/ODU4MzZiMjJiYTFh/MjJhZDNmNWE4YzA5/MDgyYTZhMDg3NTYw/M2NiY2NiZTUxN2I5/MjU1MWFmMS93d3cu/dHV0b3JpYWxzcG9p/bnQuY29tLw" 902 | }, 903 | "language": "en", 904 | "family_friendly": true, 905 | "type": "search_result", 906 | "subtype": "generic", 907 | "meta_url": { 908 | "scheme": "https", 909 | "netloc": "tutorialspoint.com", 910 | "hostname": "www.tutorialspoint.com", 911 | "favicon": "https://imgs.search.brave.com/Wt8BSkivPlFwcU5yBtf7YzuvTuRExyd_502cdABCS5c/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvYjcyYjAzYmVl/ODU4MzZiMjJiYTFh/MjJhZDNmNWE4YzA5/MDgyYTZhMDg3NTYw/M2NiY2NiZTUxN2I5/MjU1MWFmMS93d3cu/dHV0b3JpYWxzcG9p/bnQuY29tLw", 912 | "path": "› increment-and-decrement-operators-in-python" 913 | }, 914 | "thumbnail": { 915 | "src": "https://imgs.search.brave.com/ddG5vyZGLVudvecEbQJPeG8tGuaZ7g3Xz6Gyjdl5WA8/rs:fit:200:200:1/g:ce/aHR0cHM6Ly93d3cu/dHV0b3JpYWxzcG9p/bnQuY29tL2ltYWdl/cy90cF9sb2dvXzQz/Ni5wbmc", 916 | "original": "https://www.tutorialspoint.com/images/tp_logo_436.png", 917 | "logo": true 918 | }, 919 | "age": "August 23, 2023", 920 | "extra_snippets": [ 921 | "Increment and Decrement Operators in Python - Python does not have unary increment/decrement operator (++/--). Instead to increment a value, usea += 1to decrement a value, use −a -= 1Example>>> a = 0 >>> >>> #Increment >>> a +=1 >>> >>> #Decrement >>> a -= 1 >>> >>> #value of a >>> a 0Python does not provide multiple ways to do the same thing", 922 | "So what above statement means in python is: create an object of type int having value 1 and give the name a to it. The object is an instance of int having value 1 and the name a refers to it. The assigned name a and the object to which it refers are distinct.", 923 | "Python does not provide multiple ways to do the same thing .", 924 | "However, be careful if you are coming from a language like C, Python doesn’t have \"variables\" in the sense that C does, instead python uses names and objects and in python integers (int’s) are immutable." 925 | ] 926 | }, 927 | { 928 | "title": "Gumroad – How not to suck at Python / SideFX Houdini | CG Persia", 929 | "url": "https://cgpersia.com/2024/05/gumroad-how-not-to-suck-at-python-sidefx-houdini-195370.html", 930 | "is_source_local": false, 931 | "is_source_both": false, 932 | "description": "Info: This course is made for artists or TD (technical director) willing to learn Python to improve their workflows inside SideFX Houdini, get faster in production and develop all the tools you always wished you had.", 933 | "page_age": "2024-05-03T08:35:03", 934 | "profile": { 935 | "name": "Cgpersia", 936 | "url": "https://cgpersia.com/2024/05/gumroad-how-not-to-suck-at-python-sidefx-houdini-195370.html", 937 | "long_name": "cgpersia.com", 938 | "img": "https://imgs.search.brave.com/VjyaopAm-M9sWvM7n-KnGZ3T5swIOwwE80iF5QVqQPg/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvYmE0MzQ4NmI2/NjFhMTA1ZDBiN2Iw/ZWNiNDUxNjUwYjdh/MGE5ZjQ0ZjIxNzll/NmVkZDE2YzYyMDBh/NDNiMDgwMy9jZ3Bl/cnNpYS5jb20v" 939 | }, 940 | "language": "en", 941 | "family_friendly": true, 942 | "type": "search_result", 943 | "subtype": "generic", 944 | "meta_url": { 945 | "scheme": "https", 946 | "netloc": "cgpersia.com", 947 | "hostname": "cgpersia.com", 948 | "favicon": "https://imgs.search.brave.com/VjyaopAm-M9sWvM7n-KnGZ3T5swIOwwE80iF5QVqQPg/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvYmE0MzQ4NmI2/NjFhMTA1ZDBiN2Iw/ZWNiNDUxNjUwYjdh/MGE5ZjQ0ZjIxNzll/NmVkZDE2YzYyMDBh/NDNiMDgwMy9jZ3Bl/cnNpYS5jb20v", 949 | "path": "› 2024 › 05 › gumroad-how-not-to-suck-at-python-sidefx-houdini-195370.html" 950 | }, 951 | "age": "2 days ago", 952 | "extra_snippets": [ 953 | "Posted in: 2D, CG Releases, Downloads, Learning, Tutorials, Videos. Tagged: Gumroad, Python, Sidefx. Leave a Comment", 954 | "01 – Python – Fundamentals Get the Fundamentals of python before starting the fun stuff ! 02 – Python Construction Part02 digging further into python concepts 03 – Houdini – Python Basics Applying some basic python in Houdini and starting to make tools !", 955 | "02 – Python Construction Part02 digging further into python concepts 03 – Houdini – Python Basics Applying some basic python in Houdini and starting to make tools ! 04 – Houdini – Python Intermediate Applying some more advanced python in Houdini to make tools ! 05 – Houdini – Python Expert Using QtDesigner in combinaison with Houdini Python/Pyside to create advanced tools." 956 | ] 957 | }, 958 | { 959 | "title": "How to install Python: The complete Python programmer’s guide", 960 | "url": "https://www.pluralsight.com/resources/blog/software-development/python-installation-guide", 961 | "is_source_local": false, 962 | "is_source_both": false, 963 | "description": "An easy guide on how set up your operating system so you can program in Python, and how to update or uninstall it. For Linux, Windows, and macOS.", 964 | "page_age": "2024-05-02T07:30:02", 965 | "profile": { 966 | "name": "Pluralsight", 967 | "url": "https://www.pluralsight.com/resources/blog/software-development/python-installation-guide", 968 | "long_name": "pluralsight.com", 969 | "img": "https://imgs.search.brave.com/zvwQNSVu9-jR2CRlNcsTzxjaXKPlXNuh-Jo9-0yA1OE/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvMTNkNWQyNjk3/M2Q0NzYyMmUyNDc3/ZjYwMWFlZDI5YTI4/ODhmYzc2MDkzMjAy/MjNkMWY1MDE3NTQw/MzI5NWVkZS93d3cu/cGx1cmFsc2lnaHQu/Y29tLw" 970 | }, 971 | "language": "en", 972 | "family_friendly": true, 973 | "type": "search_result", 974 | "subtype": "generic", 975 | "meta_url": { 976 | "scheme": "https", 977 | "netloc": "pluralsight.com", 978 | "hostname": "www.pluralsight.com", 979 | "favicon": "https://imgs.search.brave.com/zvwQNSVu9-jR2CRlNcsTzxjaXKPlXNuh-Jo9-0yA1OE/rs:fit:32:32:1/g:ce/aHR0cDovL2Zhdmlj/b25zLnNlYXJjaC5i/cmF2ZS5jb20vaWNv/bnMvMTNkNWQyNjk3/M2Q0NzYyMmUyNDc3/ZjYwMWFlZDI5YTI4/ODhmYzc2MDkzMjAy/MjNkMWY1MDE3NTQw/MzI5NWVkZS93d3cu/cGx1cmFsc2lnaHQu/Y29tLw", 980 | "path": " › blog › blog" 981 | }, 982 | "thumbnail": { 983 | "src": "https://imgs.search.brave.com/xrv5PHH2Bzmq2rcIYzk__8h5RqCj6kS3I6SGCNw5dZM/rs:fit:200:200:1/g:ce/aHR0cHM6Ly93d3cu/cGx1cmFsc2lnaHQu/Y29tL2NvbnRlbnQv/ZGFtL3BzL2ltYWdl/cy9yZXNvdXJjZS1j/ZW50ZXIvYmxvZy9o/ZWFkZXItaGVyby1p/bWFnZXMvUHl0aG9u/LndlYnA", 984 | "original": "https://www.pluralsight.com/content/dam/ps/images/resource-center/blog/header-hero-images/Python.webp", 985 | "logo": false 986 | }, 987 | "age": "3 days ago", 988 | "extra_snippets": [ 989 | "Whether it’s your first time programming or you’re a seasoned programmer, you’ll have to install or update Python every now and then --- or if necessary, uninstall it. In this article, you'll learn how to do just that.", 990 | "Some systems come with Python, so to start off, we’ll first check to see if it’s installed on your system before we proceed. To do that, we’ll need to open a terminal. Since you might be new to programming, let’s go over how to open a terminal for Linux, Windows, and macOS.", 991 | "Before we dive into setting up your system so you can program in Python, let’s talk terminal basics and benefits.", 992 | "However, let’s focus on why we need it for working with Python. We use a terminal, or command line, to:" 993 | ] 994 | } 995 | ], 996 | "family_friendly": true 997 | } 998 | } ``````` `\\?\D:\Coding\ai\backend\apps\rag\search\testdata\google_pse.json`: ```````json 1 | { 2 | "kind": "customsearch#search", 3 | "url": { 4 | "type": "application/json", 5 | "template": "https://www.googleapis.com/customsearch/v1?q={searchTerms}&num={count?}&start={startIndex?}&lr={language?}&safe={safe?}&cx={cx?}&sort={sort?}&filter={filter?}&gl={gl?}&cr={cr?}&googlehost={googleHost?}&c2coff={disableCnTwTranslation?}&hq={hq?}&hl={hl?}&siteSearch={siteSearch?}&siteSearchFilter={siteSearchFilter?}&exactTerms={exactTerms?}&excludeTerms={excludeTerms?}&linkSite={linkSite?}&orTerms={orTerms?}&dateRestrict={dateRestrict?}&lowRange={lowRange?}&highRange={highRange?}&searchType={searchType}&fileType={fileType?}&rights={rights?}&imgSize={imgSize?}&imgType={imgType?}&imgColorType={imgColorType?}&imgDominantColor={imgDominantColor?}&alt=json" 6 | }, 7 | "queries": { 8 | "request": [ 9 | { 10 | "title": "Google Custom Search - lectures", 11 | "totalResults": "2450000000", 12 | "searchTerms": "lectures", 13 | "count": 10, 14 | "startIndex": 1, 15 | "inputEncoding": "utf8", 16 | "outputEncoding": "utf8", 17 | "safe": "off", 18 | "cx": "0473ef98502d44e18" 19 | } 20 | ], 21 | "nextPage": [ 22 | { 23 | "title": "Google Custom Search - lectures", 24 | "totalResults": "2450000000", 25 | "searchTerms": "lectures", 26 | "count": 10, 27 | "startIndex": 11, 28 | "inputEncoding": "utf8", 29 | "outputEncoding": "utf8", 30 | "safe": "off", 31 | "cx": "0473ef98502d44e18" 32 | } 33 | ] 34 | }, 35 | "context": { 36 | "title": "LLM Search" 37 | }, 38 | "searchInformation": { 39 | "searchTime": 0.445959, 40 | "formattedSearchTime": "0.45", 41 | "totalResults": "2450000000", 42 | "formattedTotalResults": "2,450,000,000" 43 | }, 44 | "items": [ 45 | { 46 | "kind": "customsearch#result", 47 | "title": "The Feynman Lectures on Physics", 48 | "htmlTitle": "The Feynman \u003cb\u003eLectures\u003c/b\u003e on Physics", 49 | "link": "https://www.feynmanlectures.caltech.edu/", 50 | "displayLink": "www.feynmanlectures.caltech.edu", 51 | "snippet": "This edition has been designed for ease of reading on devices of any size or shape; text, figures and equations can all be zoomed without degradation.", 52 | "htmlSnippet": "This edition has been designed for ease of reading on devices of any size or shape; text, figures and equations can all be zoomed without degradation.", 53 | "cacheId": "CyXMWYWs9UEJ", 54 | "formattedUrl": "https://www.feynmanlectures.caltech.edu/", 55 | "htmlFormattedUrl": "https://www.feynman\u003cb\u003electures\u003c/b\u003e.caltech.edu/", 56 | "pagemap": { 57 | "metatags": [ 58 | { 59 | "viewport": "width=device-width, initial-scale=1.0" 60 | } 61 | ] 62 | } 63 | }, 64 | { 65 | "kind": "customsearch#result", 66 | "title": "Video Lectures", 67 | "htmlTitle": "Video \u003cb\u003eLectures\u003c/b\u003e", 68 | "link": "https://www.reddit.com/r/lectures/", 69 | "displayLink": "www.reddit.com", 70 | "snippet": "r/lectures: This subreddit is all about video lectures, talks and interesting public speeches. The topics include mathematics, physics, computer…", 71 | "htmlSnippet": "r/\u003cb\u003electures\u003c/b\u003e: This subreddit is all about video \u003cb\u003electures\u003c/b\u003e, talks and interesting public speeches. The topics include mathematics, physics, computer…", 72 | "formattedUrl": "https://www.reddit.com/r/lectures/", 73 | "htmlFormattedUrl": "https://www.reddit.com/r/\u003cb\u003electures\u003c/b\u003e/", 74 | "pagemap": { 75 | "cse_thumbnail": [ 76 | { 77 | "src": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTZtOjhfkgUKQbL3DZxe5F6OVsgeDNffleObjJ7n9RllKQTSsimax7VIaY&s", 78 | "width": "192", 79 | "height": "192" 80 | } 81 | ], 82 | "metatags": [ 83 | { 84 | "og:image": "https://www.redditstatic.com/shreddit/assets/favicon/192x192.png", 85 | "theme-color": "#000000", 86 | "og:image:width": "256", 87 | "og:type": "website", 88 | "twitter:card": "summary", 89 | "twitter:title": "r/lectures", 90 | "og:site_name": "Reddit", 91 | "og:title": "r/lectures", 92 | "og:image:height": "256", 93 | "bingbot": "noarchive", 94 | "msapplication-navbutton-color": "#000000", 95 | "og:description": "This subreddit is all about video lectures, talks and interesting public speeches.\n\nThe topics include mathematics, physics, computer science, programming, engineering, biology, medicine, economics, politics, social sciences, and any other subjects!", 96 | "twitter:image": "https://www.redditstatic.com/shreddit/assets/favicon/192x192.png", 97 | "apple-mobile-web-app-status-bar-style": "black", 98 | "twitter:site": "@reddit", 99 | "viewport": "width=device-width, initial-scale=1, viewport-fit=cover", 100 | "apple-mobile-web-app-capable": "yes", 101 | "og:ttl": "600", 102 | "og:url": "https://www.reddit.com/r/lectures/" 103 | } 104 | ], 105 | "cse_image": [ 106 | { 107 | "src": "https://www.redditstatic.com/shreddit/assets/favicon/192x192.png" 108 | } 109 | ] 110 | } 111 | }, 112 | { 113 | "kind": "customsearch#result", 114 | "title": "Lectures & Discussions | Flint Institute of Arts", 115 | "htmlTitle": "\u003cb\u003eLectures\u003c/b\u003e & Discussions | Flint Institute of Arts", 116 | "link": "https://flintarts.org/events/lectures", 117 | "displayLink": "flintarts.org", 118 | "snippet": "It will trace the intricate relationship between jewelry, attire, and the expression of personal identity, social hierarchy, and spiritual belief systems that ...", 119 | "htmlSnippet": "It will trace the intricate relationship between jewelry, attire, and the expression of personal identity, social hierarchy, and spiritual belief systems that ...", 120 | "cacheId": "jvpb9DxrfxoJ", 121 | "formattedUrl": "https://flintarts.org/events/lectures", 122 | "htmlFormattedUrl": "https://flintarts.org/events/\u003cb\u003electures\u003c/b\u003e", 123 | "pagemap": { 124 | "cse_thumbnail": [ 125 | { 126 | "src": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS23tMtAeNhJbOWdGxShYsmnyzFdzOC9Hb7lRykA9Pw72z1IlKTkjTdZw&s", 127 | "width": "447", 128 | "height": "113" 129 | } 130 | ], 131 | "metatags": [ 132 | { 133 | "og:image": "https://flintarts.org/uploads/images/page-headers/_headerImage/nightshot.jpg", 134 | "og:type": "website", 135 | "viewport": "width=device-width, initial-scale=1", 136 | "og:title": "Lectures & Discussions | Flint Institute of Arts", 137 | "og:description": "The Flint Institute of Arts is the second largest art museum in Michigan and one of the largest museum art schools in the nation." 138 | } 139 | ], 140 | "cse_image": [ 141 | { 142 | "src": "https://flintarts.org/uploads/images/page-headers/_headerImage/nightshot.jpg" 143 | } 144 | ] 145 | } 146 | }, 147 | { 148 | "kind": "customsearch#result", 149 | "title": "Mandel Lectures | Mandel Center for the Humanities ... - Waltham", 150 | "htmlTitle": "Mandel \u003cb\u003eLectures\u003c/b\u003e | Mandel Center for the Humanities ... - Waltham", 151 | "link": "https://www.brandeis.edu/mandel-center-humanities/mandel-lectures.html", 152 | "displayLink": "www.brandeis.edu", 153 | "snippet": "Past Lectures · Lecture 1: \"Invisible Music: The Sonic Idea of Black Revolution From Captivity to Reconstruction\" · Lecture 2: \"Solidarity in Sound: Grassroots ...", 154 | "htmlSnippet": "Past \u003cb\u003eLectures\u003c/b\u003e · \u003cb\u003eLecture\u003c/b\u003e 1: "Invisible Music: The Sonic Idea of Black Revolution From Captivity to Reconstruction" · \u003cb\u003eLecture\u003c/b\u003e 2: "Solidarity in Sound: Grassroots ...", 155 | "cacheId": "cQLOZr0kgEEJ", 156 | "formattedUrl": "https://www.brandeis.edu/mandel-center-humanities/mandel-lectures.html", 157 | "htmlFormattedUrl": "https://www.brandeis.edu/mandel-center-humanities/mandel-\u003cb\u003electures\u003c/b\u003e.html", 158 | "pagemap": { 159 | "cse_thumbnail": [ 160 | { 161 | "src": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQWlU7bcJ5pIHk7RBCk2QKE-48ejF7hyPV0pr-20_cBt2BGdfKtiYXBuyw&s", 162 | "width": "275", 163 | "height": "183" 164 | } 165 | ], 166 | "metatags": [ 167 | { 168 | "og:image": "https://www.brandeis.edu/mandel-center-humanities/events/events-images/mlhzumba", 169 | "twitter:card": "summary_large_image", 170 | "viewport": "width=device-width,initial-scale=1,minimum-scale=1", 171 | "og:title": "Mandel Lectures in the Humanities", 172 | "og:url": "https://www.brandeis.edu/mandel-center-humanities/mandel-lectures.html", 173 | "og:description": "Annual Lecture Series", 174 | "twitter:image": "https://www.brandeis.edu/mandel-center-humanities/events/events-images/mlhzumba" 175 | } 176 | ], 177 | "cse_image": [ 178 | { 179 | "src": "https://www.brandeis.edu/mandel-center-humanities/events/events-images/mlhzumba" 180 | } 181 | ] 182 | } 183 | }, 184 | { 185 | "kind": "customsearch#result", 186 | "title": "Brian Douglas - YouTube", 187 | "htmlTitle": "Brian Douglas - YouTube", 188 | "link": "https://www.youtube.com/channel/UCq0imsn84ShAe9PBOFnoIrg", 189 | "displayLink": "www.youtube.com", 190 | "snippet": "Welcome to Control Systems Lectures! This collection of videos is intended to supplement a first year controls class, not replace it.", 191 | "htmlSnippet": "Welcome to Control Systems \u003cb\u003eLectures\u003c/b\u003e! This collection of videos is intended to supplement a first year controls class, not replace it.", 192 | "cacheId": "NEROyBHolL0J", 193 | "formattedUrl": "https://www.youtube.com/channel/UCq0imsn84ShAe9PBOFnoIrg", 194 | "htmlFormattedUrl": "https://www.youtube.com/channel/UCq0imsn84ShAe9PBOFnoIrg", 195 | "pagemap": { 196 | "hcard": [ 197 | { 198 | "fn": "Brian Douglas", 199 | "url": "https://www.youtube.com/channel/UCq0imsn84ShAe9PBOFnoIrg" 200 | } 201 | ], 202 | "cse_thumbnail": [ 203 | { 204 | "src": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR7G0CeCBz_wVTZgjnhEr2QbiKP7f3uYzKitZYn74Mi32cDmVxvsegJoLI&s", 205 | "width": "225", 206 | "height": "225" 207 | } 208 | ], 209 | "imageobject": [ 210 | { 211 | "width": "900", 212 | "url": "https://yt3.googleusercontent.com/ytc/AIdro_nLo68wetImbwGUYP3stve_iKmAEccjhqB-q4o79xdInN4=s900-c-k-c0x00ffffff-no-rj", 213 | "height": "900" 214 | } 215 | ], 216 | "person": [ 217 | { 218 | "name": "Brian Douglas", 219 | "url": "https://www.youtube.com/channel/UCq0imsn84ShAe9PBOFnoIrg" 220 | } 221 | ], 222 | "metatags": [ 223 | { 224 | "apple-itunes-app": "app-id=544007664, app-argument=https://m.youtube.com/channel/UCq0imsn84ShAe9PBOFnoIrg?referring_app=com.apple.mobilesafari-smartbanner, affiliate-data=ct=smart_app_banner_polymer&pt=9008", 225 | "og:image": "https://yt3.googleusercontent.com/ytc/AIdro_nLo68wetImbwGUYP3stve_iKmAEccjhqB-q4o79xdInN4=s900-c-k-c0x00ffffff-no-rj", 226 | "twitter:app:url:iphone": "vnd.youtube://www.youtube.com/channel/UCq0imsn84ShAe9PBOFnoIrg", 227 | "twitter:app:id:googleplay": "com.google.android.youtube", 228 | "theme-color": "rgb(255, 255, 255)", 229 | "og:image:width": "900", 230 | "twitter:card": "summary", 231 | "og:site_name": "YouTube", 232 | "twitter:url": "https://www.youtube.com/channel/UCq0imsn84ShAe9PBOFnoIrg", 233 | "twitter:app:url:ipad": "vnd.youtube://www.youtube.com/channel/UCq0imsn84ShAe9PBOFnoIrg", 234 | "al:android:package": "com.google.android.youtube", 235 | "twitter:app:name:googleplay": "YouTube", 236 | "al:ios:url": "vnd.youtube://www.youtube.com/channel/UCq0imsn84ShAe9PBOFnoIrg", 237 | "twitter:app:id:iphone": "544007664", 238 | "og:description": "Welcome to Control Systems Lectures! This collection of videos is intended to supplement a first year controls class, not replace it. My goal is to take specific concepts in controls and expand on them in order to provide an intuitive understanding which will ultimately make you a better controls engineer. \n\nI'm glad you made it to my channel and I hope you find it useful.\n\nShoot me a message at controlsystemlectures@gmail.com, leave a comment or question and I'll get back to you if I can. Don't forget to subscribe!\n \nTwitter: @BrianBDouglas for engineering tweets and announcement of new videos.\nWebpage: http://engineeringmedia.com\n\nHere is the hardware/software I use: http://www.youtube.com/watch?v=m-M5_mIyHe4\n\nHere's a list of my favorite references: http://bit.ly/2skvmWd\n\n--Brian", 239 | "al:ios:app_store_id": "544007664", 240 | "twitter:image": "https://yt3.googleusercontent.com/ytc/AIdro_nLo68wetImbwGUYP3stve_iKmAEccjhqB-q4o79xdInN4=s900-c-k-c0x00ffffff-no-rj", 241 | "twitter:site": "@youtube", 242 | "og:type": "profile", 243 | "twitter:title": "Brian Douglas", 244 | "al:ios:app_name": "YouTube", 245 | "og:title": "Brian Douglas", 246 | "og:image:height": "900", 247 | "twitter:app:id:ipad": "544007664", 248 | "al:web:url": "https://www.youtube.com/channel/UCq0imsn84ShAe9PBOFnoIrg?feature=applinks", 249 | "al:android:url": "https://www.youtube.com/channel/UCq0imsn84ShAe9PBOFnoIrg?feature=applinks", 250 | "fb:app_id": "87741124305", 251 | "twitter:app:url:googleplay": "https://www.youtube.com/channel/UCq0imsn84ShAe9PBOFnoIrg", 252 | "twitter:app:name:ipad": "YouTube", 253 | "viewport": "width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no,", 254 | "twitter:description": "Welcome to Control Systems Lectures! This collection of videos is intended to supplement a first year controls class, not replace it. My goal is to take specific concepts in controls and expand on them in order to provide an intuitive understanding which will ultimately make you a better controls engineer. \n\nI'm glad you made it to my channel and I hope you find it useful.\n\nShoot me a message at controlsystemlectures@gmail.com, leave a comment or question and I'll get back to you if I can. Don't forget to subscribe!\n \nTwitter: @BrianBDouglas for engineering tweets and announcement of new videos.\nWebpage: http://engineeringmedia.com\n\nHere is the hardware/software I use: http://www.youtube.com/watch?v=m-M5_mIyHe4\n\nHere's a list of my favorite references: http://bit.ly/2skvmWd\n\n--Brian", 255 | "og:url": "https://www.youtube.com/channel/UCq0imsn84ShAe9PBOFnoIrg", 256 | "al:android:app_name": "YouTube", 257 | "twitter:app:name:iphone": "YouTube" 258 | } 259 | ], 260 | "cse_image": [ 261 | { 262 | "src": "https://yt3.googleusercontent.com/ytc/AIdro_nLo68wetImbwGUYP3stve_iKmAEccjhqB-q4o79xdInN4=s900-c-k-c0x00ffffff-no-rj" 263 | } 264 | ] 265 | } 266 | }, 267 | { 268 | "kind": "customsearch#result", 269 | "title": "Lecture - Wikipedia", 270 | "htmlTitle": "\u003cb\u003eLecture\u003c/b\u003e - Wikipedia", 271 | "link": "https://en.wikipedia.org/wiki/Lecture", 272 | "displayLink": "en.wikipedia.org", 273 | "snippet": "Lecture ... For the academic rank, see Lecturer. A lecture (from Latin: lēctūra 'reading') is an oral presentation intended to present information or teach people ...", 274 | "htmlSnippet": "\u003cb\u003eLecture\u003c/b\u003e ... For the academic rank, see \u003cb\u003eLecturer\u003c/b\u003e. A \u003cb\u003electure\u003c/b\u003e (from Latin: lēctūra 'reading') is an oral presentation intended to present information or teach people ...", 275 | "cacheId": "d9Pjta02fmgJ", 276 | "formattedUrl": "https://en.wikipedia.org/wiki/Lecture", 277 | "htmlFormattedUrl": "https://en.wikipedia.org/wiki/Lecture", 278 | "pagemap": { 279 | "metatags": [ 280 | { 281 | "referrer": "origin", 282 | "og:image": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/26/ADFA_Lecture_Theatres.jpg/1200px-ADFA_Lecture_Theatres.jpg", 283 | "theme-color": "#eaecf0", 284 | "og:image:width": "1200", 285 | "og:type": "website", 286 | "viewport": "width=device-width, initial-scale=1.0, user-scalable=yes, minimum-scale=0.25, maximum-scale=5.0", 287 | "og:title": "Lecture - Wikipedia", 288 | "og:image:height": "799", 289 | "format-detection": "telephone=no" 290 | } 291 | ] 292 | } 293 | }, 294 | { 295 | "kind": "customsearch#result", 296 | "title": "Mount Wilson Observatory | Lectures", 297 | "htmlTitle": "Mount Wilson Observatory | \u003cb\u003eLectures\u003c/b\u003e", 298 | "link": "https://www.mtwilson.edu/lectures/", 299 | "displayLink": "www.mtwilson.edu", 300 | "snippet": "Talks & Telescopes: August 24, 2024 – Panel: The Triumph of Hubble ... Compelling talks followed by picnicking and convivial stargazing through both the big ...", 301 | "htmlSnippet": "Talks & Telescopes: August 24, 2024 – Panel: The Triumph of Hubble ... Compelling talks followed by picnicking and convivial stargazing through both the big ...", 302 | "cacheId": "wdXI0azqx5UJ", 303 | "formattedUrl": "https://www.mtwilson.edu/lectures/", 304 | "htmlFormattedUrl": "https://www.mtwilson.edu/\u003cb\u003electures\u003c/b\u003e/", 305 | "pagemap": { 306 | "metatags": [ 307 | { 308 | "viewport": "width=device-width,initial-scale=1,user-scalable=no" 309 | } 310 | ], 311 | "webpage": [ 312 | { 313 | "image": "http://www.mtwilson.edu/wp-content/uploads/2016/09/Logo.jpg", 314 | "url": "https://www.facebook.com/WilsonObs" 315 | } 316 | ] 317 | } 318 | }, 319 | { 320 | "kind": "customsearch#result", 321 | "title": "Lectures | NBER", 322 | "htmlTitle": "\u003cb\u003eLectures\u003c/b\u003e | NBER", 323 | "link": "https://www.nber.org/research/lectures", 324 | "displayLink": "www.nber.org", 325 | "snippet": "Results 1 - 50 of 354 ... Among featured events at the NBER Summer Institute are the Martin Feldstein Lecture, which examines a current issue involving economic ...", 326 | "htmlSnippet": "Results 1 - 50 of 354 \u003cb\u003e...\u003c/b\u003e Among featured events at the NBER Summer Institute are the Martin Feldstein \u003cb\u003eLecture\u003c/b\u003e, which examines a current issue involving economic ...", 327 | "cacheId": "CvvP3U3nb44J", 328 | "formattedUrl": "https://www.nber.org/research/lectures", 329 | "htmlFormattedUrl": "https://www.nber.org/research/\u003cb\u003electures\u003c/b\u003e", 330 | "pagemap": { 331 | "cse_thumbnail": [ 332 | { 333 | "src": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTmeViEZyV1YmFEFLhcA6WdgAG3v3RV6tB93ncyxSJ5JPst_p2aWrL7D1k&s", 334 | "width": "310", 335 | "height": "163" 336 | } 337 | ], 338 | "metatags": [ 339 | { 340 | "og:image": "https://www.nber.org/sites/default/files/2022-06/NBER-FB-Share-Tile-1200.jpg", 341 | "og:site_name": "NBER", 342 | "handheldfriendly": "true", 343 | "viewport": "width=device-width, initial-scale=1.0", 344 | "og:title": "Lectures", 345 | "mobileoptimized": "width", 346 | "og:url": "https://www.nber.org/research/lectures" 347 | } 348 | ], 349 | "cse_image": [ 350 | { 351 | "src": "https://www.nber.org/sites/default/files/2022-06/NBER-FB-Share-Tile-1200.jpg" 352 | } 353 | ] 354 | } 355 | }, 356 | { 357 | "kind": "customsearch#result", 358 | "title": "STUDENTS CANNOT ACCESS RECORDED LECTURES ... - Solved", 359 | "htmlTitle": "STUDENTS CANNOT ACCESS RECORDED LECTURES ... - Solved", 360 | "link": "https://community.canvaslms.com/t5/Canvas-Question-Forum/STUDENTS-CANNOT-ACCESS-RECORDED-LECTURES/td-p/190358", 361 | "displayLink": "community.canvaslms.com", 362 | "snippet": "Mar 19, 2020 ... I believe the issue is that students were not invited. Are you trying to capture your screen? If not, there is an option to just record your web ...", 363 | "htmlSnippet": "Mar 19, 2020 \u003cb\u003e...\u003c/b\u003e I believe the issue is that students were not invited. Are you trying to capture your screen? If not, there is an option to just record your web ...", 364 | "cacheId": "wqrynQXX61sJ", 365 | "formattedUrl": "https://community.canvaslms.com/t5/Canvas...LECTURES/td-p/190358", 366 | "htmlFormattedUrl": "https://community.canvaslms.com/t5/Canvas...\u003cb\u003eLECTURES\u003c/b\u003e/td-p/190358", 367 | "pagemap": { 368 | "cse_thumbnail": [ 369 | { 370 | "src": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRUqXau3N8LfKgSD7OJOvV7xzGarLKRU-ckWXy1ZQ1p4CLPsedvLKmLMhk&s", 371 | "width": "310", 372 | "height": "163" 373 | } 374 | ], 375 | "metatags": [ 376 | { 377 | "og:image": "https://community.canvaslms.com/html/@6A1FDD4D5FF35E4BBB4083A1022FA0DB/assets/CommunityPreview23.png", 378 | "og:type": "article", 379 | "article:section": "Canvas Question Forum", 380 | "article:published_time": "2020-03-19T15:50:03.409Z", 381 | "og:site_name": "Instructure Community", 382 | "article:modified_time": "2020-03-19T13:55:53-07:00", 383 | "viewport": "width=device-width, initial-scale=1.0, user-scalable=yes", 384 | "og:title": "STUDENTS CANNOT ACCESS RECORDED LECTURES", 385 | "og:url": "https://community.canvaslms.com/t5/Canvas-Question-Forum/STUDENTS-CANNOT-ACCESS-RECORDED-LECTURES/m-p/190358#M93667", 386 | "og:description": "I can access and see my recorded lectures but my students can't. They have an error message when they try to open the recorded presentation or notes.", 387 | "article:author": "https://community.canvaslms.com/t5/user/viewprofilepage/user-id/794287", 388 | "twitter:image": "https://community.canvaslms.com/html/@6A1FDD4D5FF35E4BBB4083A1022FA0DB/assets/CommunityPreview23.png" 389 | } 390 | ], 391 | "cse_image": [ 392 | { 393 | "src": "https://community.canvaslms.com/html/@6A1FDD4D5FF35E4BBB4083A1022FA0DB/assets/CommunityPreview23.png" 394 | } 395 | ] 396 | } 397 | }, 398 | { 399 | "kind": "customsearch#result", 400 | "title": "Public Lecture Series - Sam Fox School of Design & Visual Arts", 401 | "htmlTitle": "Public \u003cb\u003eLecture\u003c/b\u003e Series - Sam Fox School of Design & Visual Arts", 402 | "link": "https://samfoxschool.wustl.edu/calendar/series/2-public-lecture-series", 403 | "displayLink": "samfoxschool.wustl.edu", 404 | "snippet": "The Sam Fox School's Spring 2024 Public Lecture Series highlights design and art as catalysts for change. Renowned speakers will delve into themes like ...", 405 | "htmlSnippet": "The Sam Fox School's Spring 2024 Public \u003cb\u003eLecture\u003c/b\u003e Series highlights design and art as catalysts for change. Renowned speakers will delve into themes like ...", 406 | "cacheId": "B-cgQG0j6tUJ", 407 | "formattedUrl": "https://samfoxschool.wustl.edu/calendar/series/2-public-lecture-series", 408 | "htmlFormattedUrl": "https://samfoxschool.wustl.edu/calendar/series/2-public-lecture-series", 409 | "pagemap": { 410 | "cse_thumbnail": [ 411 | { 412 | "src": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQSmHaGianm-64m-qauYjkPK_Q0JKWe-7yom4m1ogFYTmpWArA7k6dmk0sR&s", 413 | "width": "307", 414 | "height": "164" 415 | } 416 | ], 417 | "website": [ 418 | { 419 | "name": "Public Lecture Series - Sam Fox School of Design & Visual Arts — Washington University in St. Louis" 420 | } 421 | ], 422 | "metatags": [ 423 | { 424 | "og:image": "https://dvsp0hlm0xrn3.cloudfront.net/assets/default_og_image-44e73dee4b9d1e2c6a6295901371270c8ec5899eaed48ee8167a9b12f1b0f8b3.jpg", 425 | "og:type": "website", 426 | "og:site_name": "Sam Fox School of Design & Visual Arts — Washington University in St. Louis", 427 | "viewport": "width=device-width, initial-scale=1.0", 428 | "og:title": "Public Lecture Series - Sam Fox School of Design & Visual Arts — Washington University in St. Louis", 429 | "csrf-token": "jBQsfZGY3RH8NVs0-KVDBYB-2N2kib4UYZHYdrShfTdLkvzfSvGeOaMrRKTRdYBPRKzdcGIuP7zwm9etqX_uvg", 430 | "csrf-param": "authenticity_token", 431 | "og:description": "The Sam Fox School's Spring 2024 Public Lecture Series highlights design and art as catalysts for change. Renowned speakers will delve into themes like social equity, resilient cities, and the impact of emerging technologies on contemporary life. Speakers include artists, architects, designers, and critics of the highest caliber, widely recognized for their research-based practices and multidisciplinary approaches to their fields." 432 | } 433 | ], 434 | "cse_image": [ 435 | { 436 | "src": "https://dvsp0hlm0xrn3.cloudfront.net/assets/default_og_image-44e73dee4b9d1e2c6a6295901371270c8ec5899eaed48ee8167a9b12f1b0f8b3.jpg" 437 | } 438 | ] 439 | } 440 | } 441 | ] 442 | } ``````` `\\?\D:\Coding\ai\backend\apps\rag\search\testdata\searxng.json`: ```````json 1 | { 2 | "query": "python", 3 | "number_of_results": 116000000, 4 | "results": [ 5 | { 6 | "url": "https://www.python.org/", 7 | "title": "Welcome to Python.org", 8 | "content": "Python is a versatile and powerful language that lets you work quickly and integrate systems more effectively. Learn how to get started, download the latest version, access documentation, find jobs, and join the Python community.", 9 | "engine": "bing", 10 | "parsed_url": ["https", "www.python.org", "/", "", "", ""], 11 | "template": "default.html", 12 | "engines": ["bing", "qwant", "duckduckgo"], 13 | "positions": [1, 1, 1], 14 | "score": 9.0, 15 | "category": "general" 16 | }, 17 | { 18 | "url": "https://wiki.nerdvpn.de/wiki/Python_(programming_language)", 19 | "title": "Python (programming language) - Wikipedia", 20 | "content": "Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation. Python is dynamically typed and garbage-collected. It supports multiple programming paradigms, including structured (particularly procedural), object-oriented and functional programming.", 21 | "engine": "bing", 22 | "parsed_url": ["https", "wiki.nerdvpn.de", "/wiki/Python_(programming_language)", "", "", ""], 23 | "template": "default.html", 24 | "engines": ["bing", "qwant", "duckduckgo"], 25 | "positions": [4, 3, 2], 26 | "score": 3.25, 27 | "category": "general" 28 | }, 29 | { 30 | "url": "https://docs.python.org/3/tutorial/index.html", 31 | "title": "The Python Tutorial \u2014 Python 3.12.3 documentation", 32 | "content": "3 days ago \u00b7 Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python\u2019s elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many \u2026", 33 | "engine": "bing", 34 | "parsed_url": ["https", "docs.python.org", "/3/tutorial/index.html", "", "", ""], 35 | "template": "default.html", 36 | "engines": ["bing", "qwant", "duckduckgo"], 37 | "positions": [5, 5, 3], 38 | "score": 2.2, 39 | "category": "general" 40 | }, 41 | { 42 | "url": "https://www.python.org/downloads/", 43 | "title": "Download Python | Python.org", 44 | "content": "Python is a popular programming language for various purposes. Find the latest version of Python for different operating systems, download release notes, and learn about the development process.", 45 | "engine": "bing", 46 | "parsed_url": ["https", "www.python.org", "/downloads/", "", "", ""], 47 | "template": "default.html", 48 | "engines": ["bing", "duckduckgo"], 49 | "positions": [2, 2], 50 | "score": 2.0, 51 | "category": "general" 52 | }, 53 | { 54 | "url": "https://www.python.org/about/gettingstarted/", 55 | "title": "Python For Beginners | Python.org", 56 | "content": "Learn the basics of Python, a popular and easy-to-use programming language, from installing it to using it for various purposes. Find out how to access online documentation, tutorials, books, code samples, and more resources to help you get started with Python.", 57 | "engine": "bing", 58 | "parsed_url": ["https", "www.python.org", "/about/gettingstarted/", "", "", ""], 59 | "template": "default.html", 60 | "engines": ["bing", "qwant", "duckduckgo"], 61 | "positions": [9, 4, 4], 62 | "score": 1.8333333333333333, 63 | "category": "general" 64 | }, 65 | { 66 | "url": "https://www.python.org/shell/", 67 | "title": "Welcome to Python.org", 68 | "content": "Python is a versatile and easy-to-use programming language that lets you work quickly. Learn more about Python, download the latest version, access documentation, find jobs, and join the community.", 69 | "engine": "bing", 70 | "parsed_url": ["https", "www.python.org", "/shell/", "", "", ""], 71 | "template": "default.html", 72 | "engines": ["bing", "qwant", "duckduckgo"], 73 | "positions": [3, 10, 8], 74 | "score": 1.675, 75 | "category": "general" 76 | }, 77 | { 78 | "url": "https://realpython.com/", 79 | "title": "Python Tutorials \u2013 Real Python", 80 | "content": "Real Python offers comprehensive and up-to-date tutorials, books, and courses for Python developers of all skill levels. Whether you want to learn Python basics, web development, data science, machine learning, or more, you can find clear and practical guides and code examples here.", 81 | "engine": "bing", 82 | "parsed_url": ["https", "realpython.com", "/", "", "", ""], 83 | "template": "default.html", 84 | "engines": ["bing", "qwant", "duckduckgo"], 85 | "positions": [6, 6, 5], 86 | "score": 1.6, 87 | "category": "general" 88 | }, 89 | { 90 | "url": "https://wiki.nerdvpn.de/wiki/Python", 91 | "title": "Python", 92 | "content": "Topics referred to by the same term", 93 | "engine": "wikipedia", 94 | "parsed_url": ["https", "wiki.nerdvpn.de", "/wiki/Python", "", "", ""], 95 | "template": "default.html", 96 | "engines": ["wikipedia"], 97 | "positions": [1], 98 | "score": 1.0, 99 | "category": "general" 100 | }, 101 | { 102 | "title": "Online Python - IDE, Editor, Compiler, Interpreter", 103 | "content": "Online Python IDE is a free online tool that lets you write, execute, and share Python code in the web browser. Learn about Python, its features, and its popularity as a general-purpose programming language for web development, data science, and more.", 104 | "url": "https://www.online-python.com/", 105 | "engine": "duckduckgo", 106 | "parsed_url": ["https", "www.online-python.com", "/", "", "", ""], 107 | "template": "default.html", 108 | "engines": ["qwant", "duckduckgo"], 109 | "positions": [8, 6], 110 | "score": 0.5833333333333333, 111 | "category": "general" 112 | }, 113 | { 114 | "url": "https://micropython.org/", 115 | "title": "MicroPython - Python for microcontrollers", 116 | "content": "MicroPython is a full Python compiler and runtime that runs on the bare-metal. You get an interactive prompt (the REPL) to execute commands immediately, along ...", 117 | "img_src": null, 118 | "engine": "google", 119 | "parsed_url": ["https", "micropython.org", "/", "", "", ""], 120 | "template": "default.html", 121 | "engines": ["google"], 122 | "positions": [1], 123 | "score": 1.0, 124 | "category": "general" 125 | }, 126 | { 127 | "url": "https://dictionary.cambridge.org/uk/dictionary/english/python", 128 | "title": "PYTHON | \u0417\u043d\u0430\u0447\u0435\u043d\u043d\u044f \u0432 \u0430\u043d\u0433\u043b\u0456\u0439\u0441\u044c\u043a\u0456\u0439 \u043c\u043e\u0432\u0456 - Cambridge Dictionary", 129 | "content": "Apr 17, 2024 \u2014 \u0412\u0438\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044f PYTHON: 1. a very large snake that kills animals for food by wrapping itself around them and crushing them\u2026. \u0414\u0456\u0437\u043d\u0430\u0439\u0442\u0435\u0441\u044f \u0431\u0456\u043b\u044c\u0448\u0435.", 130 | "img_src": null, 131 | "engine": "google", 132 | "parsed_url": [ 133 | "https", 134 | "dictionary.cambridge.org", 135 | "/uk/dictionary/english/python", 136 | "", 137 | "", 138 | "" 139 | ], 140 | "template": "default.html", 141 | "engines": ["google"], 142 | "positions": [2], 143 | "score": 0.5, 144 | "category": "general" 145 | }, 146 | { 147 | "url": "https://www.codetoday.co.uk/code", 148 | "title": "Web-based Python Editor (with Turtle graphics)", 149 | "content": "Quick way of starting to write Python code, including drawing with Turtle, provided by CodeToday using Trinket.io Ideal for young children to start ...", 150 | "img_src": null, 151 | "engine": "google", 152 | "parsed_url": ["https", "www.codetoday.co.uk", "/code", "", "", ""], 153 | "template": "default.html", 154 | "engines": ["google"], 155 | "positions": [3], 156 | "score": 0.3333333333333333, 157 | "category": "general" 158 | }, 159 | { 160 | "url": "https://snapcraft.io/docs/python-plugin", 161 | "title": "The python plugin | Snapcraft documentation", 162 | "content": "The python plugin can be used by either Python 2 or Python 3 based parts using a setup.py script for building the project, or using a package published to ...", 163 | "img_src": null, 164 | "engine": "google", 165 | "parsed_url": ["https", "snapcraft.io", "/docs/python-plugin", "", "", ""], 166 | "template": "default.html", 167 | "engines": ["google"], 168 | "positions": [4], 169 | "score": 0.25, 170 | "category": "general" 171 | }, 172 | { 173 | "url": "https://www.developer-tech.com/categories/developer-languages/developer-languages-python/", 174 | "title": "Latest Python Developer News", 175 | "content": "Python's status as the primary language for AI and machine learning projects, from its extensive data-handling capabilities to its flexibility and ...", 176 | "img_src": null, 177 | "engine": "google", 178 | "parsed_url": [ 179 | "https", 180 | "www.developer-tech.com", 181 | "/categories/developer-languages/developer-languages-python/", 182 | "", 183 | "", 184 | "" 185 | ], 186 | "template": "default.html", 187 | "engines": ["google"], 188 | "positions": [5], 189 | "score": 0.2, 190 | "category": "general" 191 | }, 192 | { 193 | "url": "https://subjectguides.york.ac.uk/coding/python", 194 | "title": "Coding: a Practical Guide - Python - Subject Guides", 195 | "content": "Python is a coding language used for a wide range of things, including working with data, building systems and software, and even creating games.", 196 | "img_src": null, 197 | "engine": "google", 198 | "parsed_url": ["https", "subjectguides.york.ac.uk", "/coding/python", "", "", ""], 199 | "template": "default.html", 200 | "engines": ["google"], 201 | "positions": [6], 202 | "score": 0.16666666666666666, 203 | "category": "general" 204 | }, 205 | { 206 | "url": "https://hub.salford.ac.uk/psytech/python/getting-started-python/", 207 | "title": "Getting Started - Python - Salford PsyTech Home - The Hub", 208 | "content": "Python in itself is a very friendly programming language, when we get to grips with writing code, once you grasp the logic, it will become very intuitive.", 209 | "img_src": null, 210 | "engine": "google", 211 | "parsed_url": [ 212 | "https", 213 | "hub.salford.ac.uk", 214 | "/psytech/python/getting-started-python/", 215 | "", 216 | "", 217 | "" 218 | ], 219 | "template": "default.html", 220 | "engines": ["google"], 221 | "positions": [7], 222 | "score": 0.14285714285714285, 223 | "category": "general" 224 | }, 225 | { 226 | "url": "https://snapcraft.io/docs/python-apps", 227 | "title": "Python apps | Snapcraft documentation", 228 | "content": "Snapcraft can be used to package and distribute Python applications in a way that enables convenient installation by users. The process of creating a snap ...", 229 | "img_src": null, 230 | "engine": "google", 231 | "parsed_url": ["https", "snapcraft.io", "/docs/python-apps", "", "", ""], 232 | "template": "default.html", 233 | "engines": ["google"], 234 | "positions": [8], 235 | "score": 0.125, 236 | "category": "general" 237 | }, 238 | { 239 | "url": "https://anvil.works/", 240 | "title": "Anvil | Build Web Apps with Nothing but Python", 241 | "content": "Anvil is a free Python-based drag-and-drop web app builder.\u200eSign Up \u00b7 \u200eSign in \u00b7 \u200ePricing \u00b7 \u200eForum", 242 | "img_src": null, 243 | "engine": "google", 244 | "parsed_url": ["https", "anvil.works", "/", "", "", ""], 245 | "template": "default.html", 246 | "engines": ["google"], 247 | "positions": [9], 248 | "score": 0.1111111111111111, 249 | "category": "general" 250 | }, 251 | { 252 | "url": "https://docs.python.org/", 253 | "title": "Python 3.12.3 documentation", 254 | "content": "3 days ago \u00b7 This is the official documentation for Python 3.12.3. Documentation sections: What's new in Python 3.12? Or all \"What's new\" documents since Python 2.0. Tutorial. Start here: a tour of Python's syntax and features. Library reference. Standard library and builtins. Language reference.", 255 | "engine": "bing", 256 | "parsed_url": ["https", "docs.python.org", "/", "", "", ""], 257 | "template": "default.html", 258 | "engines": ["bing", "duckduckgo"], 259 | "positions": [7, 13], 260 | "score": 0.43956043956043955, 261 | "category": "general" 262 | }, 263 | { 264 | "title": "How to Use Python: Your First Steps - Real Python", 265 | "content": "Learn the basics of Python syntax, installation, error handling, and more in this tutorial. You'll also code your first Python program and test your knowledge with a quiz.", 266 | "url": "https://realpython.com/python-first-steps/", 267 | "engine": "duckduckgo", 268 | "parsed_url": ["https", "realpython.com", "/python-first-steps/", "", "", ""], 269 | "template": "default.html", 270 | "engines": ["qwant", "duckduckgo"], 271 | "positions": [14, 7], 272 | "score": 0.42857142857142855, 273 | "category": "general" 274 | }, 275 | { 276 | "title": "The Python Tutorial \u2014 Python 3.11.8 documentation", 277 | "content": "This tutorial introduces the reader informally to the basic concepts and features of the Python language and system. It helps to have a Python interpreter handy for hands-on experience, but all examples are self-contained, so the tutorial can be read off-line as well. For a description of standard objects and modules, see The Python Standard ...", 278 | "url": "https://docs.python.org/3.11/tutorial/", 279 | "engine": "duckduckgo", 280 | "parsed_url": ["https", "docs.python.org", "/3.11/tutorial/", "", "", ""], 281 | "template": "default.html", 282 | "engines": ["duckduckgo"], 283 | "positions": [7], 284 | "score": 0.14285714285714285, 285 | "category": "general" 286 | }, 287 | { 288 | "url": "https://realpython.com/python-introduction/", 289 | "title": "Introduction to Python 3 \u2013 Real Python", 290 | "content": "Python programming language, including a brief history of the development of Python and reasons why you might select Python as your language of choice.", 291 | "engine": "bing", 292 | "parsed_url": ["https", "realpython.com", "/python-introduction/", "", "", ""], 293 | "template": "default.html", 294 | "engines": ["bing"], 295 | "positions": [8], 296 | "score": 0.125, 297 | "category": "general" 298 | }, 299 | { 300 | "title": "Our Documentation | Python.org", 301 | "content": "Find online or download Python's documentation, tutorials, and guides for beginners and advanced users. Learn how to port from Python 2 to Python 3, contribute to Python, and access Python videos and books.", 302 | "url": "https://www.python.org/doc/", 303 | "engine": "duckduckgo", 304 | "parsed_url": ["https", "www.python.org", "/doc/", "", "", ""], 305 | "template": "default.html", 306 | "engines": ["duckduckgo"], 307 | "positions": [9], 308 | "score": 0.1111111111111111, 309 | "category": "general" 310 | }, 311 | { 312 | "title": "Welcome to Python.org", 313 | "url": "http://www.get-python.org/shell/", 314 | "content": "The mission of the Python Software Foundation is to promote, protect, and advance the Python programming language, and to support and facilitate the growth of a diverse and international community of Python programmers. Learn more. Become a Member Donate to the PSF.", 315 | "engine": "qwant", 316 | "parsed_url": ["http", "www.get-python.org", "/shell/", "", "", ""], 317 | "template": "default.html", 318 | "engines": ["qwant"], 319 | "positions": [9], 320 | "score": 0.1111111111111111, 321 | "category": "general" 322 | }, 323 | { 324 | "title": "About Python\u2122 | Python.org", 325 | "content": "Python is a powerful, fast, and versatile programming language that runs on various platforms and is easy to learn. Learn how to get started, explore the applications, and join the community of Python programmers and users.", 326 | "url": "https://www.python.org/about/", 327 | "engine": "duckduckgo", 328 | "parsed_url": ["https", "www.python.org", "/about/", "", "", ""], 329 | "template": "default.html", 330 | "engines": ["duckduckgo"], 331 | "positions": [11], 332 | "score": 0.09090909090909091, 333 | "category": "general" 334 | }, 335 | { 336 | "title": "Online Python Compiler (Interpreter) - Programiz", 337 | "content": "Write and run Python code using this online tool. You can use Python Shell like IDLE, and take inputs from the user in our Python compiler.", 338 | "url": "https://www.programiz.com/python-programming/online-compiler/", 339 | "engine": "duckduckgo", 340 | "parsed_url": [ 341 | "https", 342 | "www.programiz.com", 343 | "/python-programming/online-compiler/", 344 | "", 345 | "", 346 | "" 347 | ], 348 | "template": "default.html", 349 | "engines": ["duckduckgo"], 350 | "positions": [12], 351 | "score": 0.08333333333333333, 352 | "category": "general" 353 | }, 354 | { 355 | "title": "Welcome to Python.org", 356 | "content": "Python is a versatile and powerful language that lets you work quickly and integrate systems more effectively. Download the latest version, read the documentation, find jobs, events, success stories, and more on Python.org.", 357 | "url": "https://www.python.org/?downloads", 358 | "engine": "duckduckgo", 359 | "parsed_url": ["https", "www.python.org", "/", "", "downloads", ""], 360 | "template": "default.html", 361 | "engines": ["duckduckgo"], 362 | "positions": [15], 363 | "score": 0.06666666666666667, 364 | "category": "general" 365 | }, 366 | { 367 | "url": "https://www.matillion.com/blog/the-importance-of-python-and-its-growing-influence-on-data-productivty-a-matillion-perspective", 368 | "title": "The Importance of Python and its Growing Influence on ...", 369 | "content": "Jan 30, 2024 \u2014 The synergy of low-code functionality with Python's versatility empowers data professionals to orchestrate complex transformations seamlessly.", 370 | "img_src": null, 371 | "engine": "google", 372 | "parsed_url": [ 373 | "https", 374 | "www.matillion.com", 375 | "/blog/the-importance-of-python-and-its-growing-influence-on-data-productivty-a-matillion-perspective", 376 | "", 377 | "", 378 | "" 379 | ], 380 | "template": "default.html", 381 | "engines": ["google"], 382 | "positions": [10], 383 | "score": 0.1, 384 | "category": "general" 385 | }, 386 | { 387 | "title": "BeginnersGuide - Python Wiki", 388 | "content": "This is the program that reads Python programs and carries out their instructions; you need it before you can do any Python programming. Mac and Linux distributions may include an outdated version of Python (Python 2), but you should install an updated one (Python 3). See BeginnersGuide/Download for instructions to download the correct version ...", 389 | "url": "https://wiki.python.org/moin/BeginnersGuide", 390 | "engine": "duckduckgo", 391 | "parsed_url": ["https", "wiki.python.org", "/moin/BeginnersGuide", "", "", ""], 392 | "template": "default.html", 393 | "engines": ["duckduckgo"], 394 | "positions": [16], 395 | "score": 0.0625, 396 | "category": "general" 397 | }, 398 | { 399 | "title": "Learn Python - Free Interactive Python Tutorial", 400 | "content": "Learn Python from scratch or improve your skills with this website that offers tutorials, exercises, tests and certification. Explore topics such as basics, data science, advanced features and more with DataCamp.", 401 | "url": "https://www.learnpython.org/", 402 | "engine": "duckduckgo", 403 | "parsed_url": ["https", "www.learnpython.org", "/", "", "", ""], 404 | "template": "default.html", 405 | "engines": ["duckduckgo"], 406 | "positions": [17], 407 | "score": 0.058823529411764705, 408 | "category": "general" 409 | } 410 | ], 411 | "answers": [], 412 | "corrections": [], 413 | "infoboxes": [ 414 | { 415 | "infobox": "Python", 416 | "id": "https://en.wikipedia.org/wiki/Python_(programming_language)", 417 | "content": "general-purpose programming language", 418 | "img_src": "https://upload.wikimedia.org/wikipedia/commons/thumb/6/6f/.PY_file_recreation.png/500px-.PY_file_recreation.png", 419 | "urls": [ 420 | { 421 | "title": "Official website", 422 | "url": "https://www.python.org/", 423 | "official": true 424 | }, 425 | { 426 | "title": "Wikipedia (en)", 427 | "url": "https://en.wikipedia.org/wiki/Python_(programming_language)" 428 | }, 429 | { 430 | "title": "Wikidata", 431 | "url": "http://www.wikidata.org/entity/Q28865" 432 | } 433 | ], 434 | "attributes": [ 435 | { 436 | "label": "Inception", 437 | "value": "Wednesday, February 20, 1991", 438 | "entity": "P571" 439 | }, 440 | { 441 | "label": "Developer", 442 | "value": "Python Software Foundation, Guido van Rossum", 443 | "entity": "P178" 444 | }, 445 | { 446 | "label": "Copyright license", 447 | "value": "Python Software Foundation License", 448 | "entity": "P275" 449 | }, 450 | { 451 | "label": "Programmed in", 452 | "value": "C, Python", 453 | "entity": "P277" 454 | }, 455 | { 456 | "label": "Software version identifier", 457 | "value": "3.12.3, 3.13.0a6", 458 | "entity": "P348" 459 | } 460 | ], 461 | "engine": "wikidata", 462 | "engines": ["wikidata"] 463 | } 464 | ], 465 | "suggestions": [ 466 | "python turtle", 467 | "micro python tutorial", 468 | "python docs", 469 | "python compiler", 470 | "snapcraft python", 471 | "micropython vs python", 472 | "python online", 473 | "python download" 474 | ], 475 | "unresponsive_engines": [] 476 | } ``````` `\\?\D:\Coding\ai\backend\apps\rag\search\testdata\serper.json`: ```````json 1 | { 2 | "searchParameters": { 3 | "q": "apple inc", 4 | "gl": "us", 5 | "hl": "en", 6 | "autocorrect": true, 7 | "page": 1, 8 | "type": "search" 9 | }, 10 | "knowledgeGraph": { 11 | "title": "Apple", 12 | "type": "Technology company", 13 | "website": "http://www.apple.com/", 14 | "imageUrl": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQwGQRv5TjjkycpctY66mOg_e2-npacrmjAb6_jAWhzlzkFE3OTjxyzbA&s=0", 15 | "description": "Apple Inc. is an American multinational technology company specializing in consumer electronics, software and online services headquartered in Cupertino, California, United States.", 16 | "descriptionSource": "Wikipedia", 17 | "descriptionLink": "https://en.wikipedia.org/wiki/Apple_Inc.", 18 | "attributes": { 19 | "Headquarters": "Cupertino, CA", 20 | "CEO": "Tim Cook (Aug 24, 2011–)", 21 | "Founded": "April 1, 1976, Los Altos, CA", 22 | "Sales": "1 (800) 692-7753", 23 | "Products": "iPhone, Apple Watch, iPad, and more", 24 | "Founders": "Steve Jobs, Steve Wozniak, and Ronald Wayne", 25 | "Subsidiaries": "Apple Store, Beats Electronics, Beddit, and more" 26 | } 27 | }, 28 | "organic": [ 29 | { 30 | "title": "Apple", 31 | "link": "https://www.apple.com/", 32 | "snippet": "Discover the innovative world of Apple and shop everything iPhone, iPad, Apple Watch, Mac, and Apple TV, plus explore accessories, entertainment, ...", 33 | "sitelinks": [ 34 | { 35 | "title": "Support", 36 | "link": "https://support.apple.com/" 37 | }, 38 | { 39 | "title": "iPhone", 40 | "link": "https://www.apple.com/iphone/" 41 | }, 42 | { 43 | "title": "Apple makes business better.", 44 | "link": "https://www.apple.com/business/" 45 | }, 46 | { 47 | "title": "Mac", 48 | "link": "https://www.apple.com/mac/" 49 | } 50 | ], 51 | "position": 1 52 | }, 53 | { 54 | "title": "Apple Inc. - Wikipedia", 55 | "link": "https://en.wikipedia.org/wiki/Apple_Inc.", 56 | "snippet": "Apple Inc. is an American multinational technology company specializing in consumer electronics, software and online services headquartered in Cupertino, ...", 57 | "attributes": { 58 | "Products": "AirPods; Apple Watch; iPad; iPhone; Mac", 59 | "Founders": "Steve Jobs; Steve Wozniak; Ronald Wayne", 60 | "Founded": "April 1, 1976; 46 years ago in Los Altos, California, U.S", 61 | "Industry": "Consumer electronics; Software services; Online services" 62 | }, 63 | "sitelinks": [ 64 | { 65 | "title": "History", 66 | "link": "https://en.wikipedia.org/wiki/History_of_Apple_Inc." 67 | }, 68 | { 69 | "title": "Timeline of Apple Inc. products", 70 | "link": "https://en.wikipedia.org/wiki/Timeline_of_Apple_Inc._products" 71 | }, 72 | { 73 | "title": "List of software by Apple Inc.", 74 | "link": "https://en.wikipedia.org/wiki/List_of_software_by_Apple_Inc." 75 | }, 76 | { 77 | "title": "Apple Store", 78 | "link": "https://en.wikipedia.org/wiki/Apple_Store" 79 | } 80 | ], 81 | "position": 2 82 | }, 83 | { 84 | "title": "Apple Inc. | History, Products, Headquarters, & Facts | Britannica", 85 | "link": "https://www.britannica.com/topic/Apple-Inc", 86 | "snippet": "Apple Inc., formerly Apple Computer, Inc., American manufacturer of personal computers, smartphones, tablet computers, computer peripherals, ...", 87 | "date": "Aug 31, 2022", 88 | "attributes": { 89 | "Related People": "Steve Jobs Steve Wozniak Jony Ive Tim Cook Angela Ahrendts", 90 | "Date": "1976 - present", 91 | "Areas Of Involvement": "peripheral device" 92 | }, 93 | "position": 3 94 | }, 95 | { 96 | "title": "AAPL: Apple Inc Stock Price Quote - NASDAQ GS - Bloomberg.com", 97 | "link": "https://www.bloomberg.com/quote/AAPL:US", 98 | "snippet": "Stock analysis for Apple Inc (AAPL:NASDAQ GS) including stock price, stock chart, company news, key statistics, fundamentals and company profile.", 99 | "position": 4 100 | }, 101 | { 102 | "title": "Apple Inc. (AAPL) Company Profile & Facts - Yahoo Finance", 103 | "link": "https://finance.yahoo.com/quote/AAPL/profile/", 104 | "snippet": "Apple Inc. designs, manufactures, and markets smartphones, personal computers, tablets, wearables, and accessories worldwide. It also sells various related ...", 105 | "position": 5 106 | }, 107 | { 108 | "title": "AAPL | Apple Inc. Stock Price & News - WSJ", 109 | "link": "https://www.wsj.com/market-data/quotes/AAPL", 110 | "snippet": "Apple, Inc. engages in the design, manufacture, and sale of smartphones, personal computers, tablets, wearables and accessories, and other varieties of ...", 111 | "position": 6 112 | }, 113 | { 114 | "title": "Apple Inc Company Profile - Apple Inc Overview - GlobalData", 115 | "link": "https://www.globaldata.com/company-profile/apple-inc/", 116 | "snippet": "Apple Inc (Apple) designs, manufactures, and markets smartphones, tablets, personal computers (PCs), portable and wearable devices. The company also offers ...", 117 | "position": 7 118 | }, 119 | { 120 | "title": "Apple Inc (AAPL) Stock Price & News - Google Finance", 121 | "link": "https://www.google.com/finance/quote/AAPL:NASDAQ?hl=en", 122 | "snippet": "Get the latest Apple Inc (AAPL) real-time quote, historical performance, charts, and other financial information to help you make more informed trading and ...", 123 | "position": 8 124 | } 125 | ], 126 | "peopleAlsoAsk": [ 127 | { 128 | "question": "What does Apple Inc mean?", 129 | "snippet": "Apple Inc., formerly Apple Computer, Inc., American manufacturer of personal\ncomputers, smartphones, tablet computers, computer peripherals, and computer\nsoftware. It was the first successful personal computer company and the\npopularizer of the graphical user interface.\nAug 31, 2022", 130 | "title": "Apple Inc. | History, Products, Headquarters, & Facts | Britannica", 131 | "link": "https://www.britannica.com/topic/Apple-Inc" 132 | }, 133 | { 134 | "question": "Is Apple and Apple Inc same?", 135 | "snippet": "Apple was founded as Apple Computer Company on April 1, 1976, by Steve Jobs,\nSteve Wozniak and Ronald Wayne to develop and sell Wozniak's Apple I personal\ncomputer. It was incorporated by Jobs and Wozniak as Apple Computer, Inc.", 136 | "title": "Apple Inc. - Wikipedia", 137 | "link": "https://en.wikipedia.org/wiki/Apple_Inc." 138 | }, 139 | { 140 | "question": "Who owns Apple Inc?", 141 | "snippet": "Apple Inc. is owned by two main institutional investors (Vanguard Group and\nBlackRock, Inc). While its major individual shareholders comprise people like\nArt Levinson, Tim Cook, Bruce Sewell, Al Gore, Johny Sroujli, and others.", 142 | "title": "Who Owns Apple In 2022? - FourWeekMBA", 143 | "link": "https://fourweekmba.com/who-owns-apple/" 144 | }, 145 | { 146 | "question": "What products does Apple Inc offer?", 147 | "snippet": "APPLE FOOTER\nStore.\nMac.\niPad.\niPhone.\nWatch.\nAirPods.\nTV & Home.\nAirTag.", 148 | "title": "More items...", 149 | "link": "https://www.apple.com/business/" 150 | } 151 | ], 152 | "relatedSearches": [ 153 | { 154 | "query": "Who invented the iPhone" 155 | }, 156 | { 157 | "query": "Apple Inc competitors" 158 | }, 159 | { 160 | "query": "Apple iPad" 161 | }, 162 | { 163 | "query": "iPhones" 164 | }, 165 | { 166 | "query": "Apple Inc us" 167 | }, 168 | { 169 | "query": "Apple company history" 170 | }, 171 | { 172 | "query": "Apple Store" 173 | }, 174 | { 175 | "query": "Apple customer service" 176 | }, 177 | { 178 | "query": "Apple Watch" 179 | }, 180 | { 181 | "query": "Apple Inc Industry" 182 | }, 183 | { 184 | "query": "Apple Inc registered address" 185 | }, 186 | { 187 | "query": "Apple Inc Bloomberg" 188 | } 189 | ] 190 | } ``````` `\\?\D:\Coding\ai\backend\apps\rag\search\testdata\serply.json`: ```````json 1 | { 2 | "ads": [], 3 | "ads_count": 0, 4 | "answers": [], 5 | "results": [ 6 | { 7 | "title": "Apple", 8 | "link": "https://www.apple.com/", 9 | "description": "Discover the innovative world of Apple and shop everything iPhone, iPad, Apple Watch, Mac, and Apple TV, plus explore accessories, entertainment, ...", 10 | "additional_links": [ 11 | { 12 | "text": "AppleApplehttps://www.apple.com", 13 | "href": "https://www.apple.com/" 14 | } 15 | ], 16 | "cite": {}, 17 | "subdomains": [ 18 | { 19 | "title": "Support", 20 | "link": "https://support.apple.com/", 21 | "description": "SupportContact - iPhone Support - Billing and Subscriptions - Apple Repair" 22 | }, 23 | { 24 | "title": "Store", 25 | "link": "https://www.apple.com/store", 26 | "description": "StoreShop iPhone - Shop iPad - App Store - Shop Mac - ..." 27 | }, 28 | { 29 | "title": "Mac", 30 | "link": "https://www.apple.com/mac/", 31 | "description": "MacMacBook Air - MacBook Pro - iMac - Compare Mac models - Mac mini" 32 | }, 33 | { 34 | "title": "iPad", 35 | "link": "https://www.apple.com/ipad/", 36 | "description": "iPadShop iPad - iPad Pro - iPad Air - Compare iPad models - ..." 37 | }, 38 | { 39 | "title": "Watch", 40 | "link": "https://www.apple.com/watch/", 41 | "description": "WatchShop Apple Watch - Series 9 - SE - Ultra 2 - Nike - Hermès - ..." 42 | } 43 | ], 44 | "realPosition": 1 45 | }, 46 | { 47 | "title": "Apple", 48 | "link": "https://www.apple.com/", 49 | "description": "Discover the innovative world of Apple and shop everything iPhone, iPad, Apple Watch, Mac, and Apple TV, plus explore accessories, entertainment, ...", 50 | "additional_links": [ 51 | { 52 | "text": "AppleApplehttps://www.apple.com", 53 | "href": "https://www.apple.com/" 54 | } 55 | ], 56 | "cite": {}, 57 | "realPosition": 2 58 | }, 59 | { 60 | "title": "Apple Inc.", 61 | "link": "https://en.wikipedia.org/wiki/Apple_Inc.", 62 | "description": "Apple Inc. (formerly Apple Computer, Inc.) is an American multinational corporation and technology company headquartered in Cupertino, California, ...", 63 | "additional_links": [ 64 | { 65 | "text": "Apple Inc.Wikipediahttps://en.wikipedia.org › wiki › Apple_Inc", 66 | "href": "https://en.wikipedia.org/wiki/Apple_Inc." 67 | }, 68 | { 69 | "text": "", 70 | "href": "https://en.wikipedia.org/wiki/Apple_Inc." 71 | }, 72 | { 73 | "text": "History", 74 | "href": "https://en.wikipedia.org/wiki/History_of_Apple_Inc." 75 | }, 76 | { 77 | "text": "List of Apple products", 78 | "href": "https://en.wikipedia.org/wiki/List_of_Apple_products" 79 | }, 80 | { 81 | "text": "Litigation involving Apple Inc.", 82 | "href": "https://en.wikipedia.org/wiki/Litigation_involving_Apple_Inc." 83 | }, 84 | { 85 | "text": "Apple Park", 86 | "href": "https://en.wikipedia.org/wiki/Apple_Park" 87 | } 88 | ], 89 | "cite": { 90 | "domain": "https://en.wikipedia.org › wiki › Apple_Inc", 91 | "span": " › wiki › Apple_Inc" 92 | }, 93 | "realPosition": 3 94 | }, 95 | { 96 | "title": "Apple Inc. (AAPL) Company Profile & Facts", 97 | "link": "https://finance.yahoo.com/quote/AAPL/profile/", 98 | "description": "Apple Inc. designs, manufactures, and markets smartphones, personal computers, tablets, wearables, and accessories worldwide. The company offers iPhone, a line ...", 99 | "additional_links": [ 100 | { 101 | "text": "Apple Inc. (AAPL) Company Profile & FactsYahoo Financehttps://finance.yahoo.com › quote › AAPL › profile", 102 | "href": "https://finance.yahoo.com/quote/AAPL/profile/" 103 | } 104 | ], 105 | "cite": { 106 | "domain": "https://finance.yahoo.com › quote › AAPL › profile", 107 | "span": " › quote › AAPL › profile" 108 | }, 109 | "realPosition": 4 110 | }, 111 | { 112 | "title": "Apple Inc - Company Profile and News", 113 | "link": "https://www.bloomberg.com/profile/company/AAPL:US", 114 | "description": "Apple Inc. Apple Inc. designs, manufactures, and markets smartphones, personal computers, tablets, wearables and accessories, and sells a variety of related ...", 115 | "additional_links": [ 116 | { 117 | "text": "Apple Inc - Company Profile and NewsBloomberghttps://www.bloomberg.com › company › AAPL:US", 118 | "href": "https://www.bloomberg.com/profile/company/AAPL:US" 119 | }, 120 | { 121 | "text": "", 122 | "href": "https://www.bloomberg.com/profile/company/AAPL:US" 123 | } 124 | ], 125 | "cite": { 126 | "domain": "https://www.bloomberg.com › company › AAPL:US", 127 | "span": " › company › AAPL:US" 128 | }, 129 | "realPosition": 5 130 | }, 131 | { 132 | "title": "Apple Inc. | History, Products, Headquarters, & Facts", 133 | "link": "https://www.britannica.com/money/Apple-Inc", 134 | "description": "May 22, 2024 — Apple Inc. is an American multinational technology company that revolutionized the technology sector through its innovation of computer ...", 135 | "additional_links": [ 136 | { 137 | "text": "Apple Inc. | History, Products, Headquarters, & FactsBritannicahttps://www.britannica.com › money › Apple-Inc", 138 | "href": "https://www.britannica.com/money/Apple-Inc" 139 | }, 140 | { 141 | "text": "", 142 | "href": "https://www.britannica.com/money/Apple-Inc" 143 | } 144 | ], 145 | "cite": { 146 | "domain": "https://www.britannica.com › money › Apple-Inc", 147 | "span": " › money › Apple-Inc" 148 | }, 149 | "realPosition": 6 150 | } 151 | ], 152 | "shopping_ads": [], 153 | "places": [ 154 | { 155 | "title": "Apple Inc." 156 | }, 157 | { 158 | "title": "Apple Inc" 159 | }, 160 | { 161 | "title": "Apple Inc" 162 | } 163 | ], 164 | "related_searches": { 165 | "images": [], 166 | "text": [ 167 | { 168 | "title": "apple inc full form", 169 | "link": "https://www.google.com/search?sca_esv=6b6df170a5c9891b&sca_upv=1&q=Apple+Inc+full+form&sa=X&ved=2ahUKEwjLxuSJwM-GAxUHODQIHYuJBhgQ1QJ6BAhPEAE" 170 | }, 171 | { 172 | "title": "apple company history", 173 | "link": "https://www.google.com/search?sca_esv=6b6df170a5c9891b&sca_upv=1&q=Apple+company+history&sa=X&ved=2ahUKEwjLxuSJwM-GAxUHODQIHYuJBhgQ1QJ6BAhOEAE" 174 | }, 175 | { 176 | "title": "apple store", 177 | "link": "https://www.google.com/search?sca_esv=6b6df170a5c9891b&sca_upv=1&q=Apple+Store&sa=X&ved=2ahUKEwjLxuSJwM-GAxUHODQIHYuJBhgQ1QJ6BAhQEAE" 178 | }, 179 | { 180 | "title": "apple id", 181 | "link": "https://www.google.com/search?sca_esv=6b6df170a5c9891b&sca_upv=1&q=Apple+id&sa=X&ved=2ahUKEwjLxuSJwM-GAxUHODQIHYuJBhgQ1QJ6BAhSEAE" 182 | }, 183 | { 184 | "title": "apple inc industry", 185 | "link": "https://www.google.com/search?sca_esv=6b6df170a5c9891b&sca_upv=1&q=Apple+Inc+industry&sa=X&ved=2ahUKEwjLxuSJwM-GAxUHODQIHYuJBhgQ1QJ6BAhREAE" 186 | }, 187 | { 188 | "title": "apple login", 189 | "link": "https://www.google.com/search?sca_esv=6b6df170a5c9891b&sca_upv=1&q=Apple+login&sa=X&ved=2ahUKEwjLxuSJwM-GAxUHODQIHYuJBhgQ1QJ6BAhTEAE" 190 | } 191 | ] 192 | }, 193 | "image_results": [], 194 | "carousel": [], 195 | "total": 2450000000, 196 | "knowledge_graph": "", 197 | "related_questions": [ 198 | "What does the Apple Inc do?", 199 | "Why did Apple change to Apple Inc?", 200 | "Who owns Apple Inc.?", 201 | "What is Apple Inc best known for?" 202 | ], 203 | "carousel_count": 0, 204 | "ts": 2.491065263748169, 205 | "device_type": null 206 | } ``````` `\\?\D:\Coding\ai\backend\apps\rag\search\testdata\serpstack.json`: ```````json 1 | { 2 | "request": { 3 | "success": true, 4 | "total_time_taken": 3.4, 5 | "processed_timestamp": 1714968442, 6 | "search_url": "http://www.google.com/search?q=mcdonalds\u0026gl=us\u0026hl=en\u0026safe=0\u0026num=10" 7 | }, 8 | "search_parameters": { 9 | "engine": "google", 10 | "type": "web", 11 | "device": "desktop", 12 | "auto_location": "1", 13 | "google_domain": "google.com", 14 | "gl": "us", 15 | "hl": "en", 16 | "safe": "0", 17 | "news_type": "all", 18 | "exclude_autocorrected_results": "0", 19 | "images_color": "any", 20 | "page": "1", 21 | "num": "10", 22 | "output": "json", 23 | "csv_fields": "search_parameters.query,organic_results.position,organic_results.title,organic_results.url,organic_results.domain", 24 | "query": "mcdonalds", 25 | "action": "search", 26 | "access_key": "aac48e007e15c532bb94ffb34532a4b2", 27 | "error": {} 28 | }, 29 | "search_information": { 30 | "total_results": 1170000000, 31 | "time_taken_displayed": 0.49, 32 | "detected_location": {}, 33 | "did_you_mean": {}, 34 | "no_results_for_original_query": false, 35 | "showing_results_for": {} 36 | }, 37 | "organic_results": [ 38 | { 39 | "position": 1, 40 | "title": "Our Full McDonald\u0027s Food Menu", 41 | "snippet": "", 42 | "prerender": false, 43 | "cached_page_url": {}, 44 | "related_pages_url": {}, 45 | "url": "https://www.mcdonalds.com/us/en-us/full-menu.html", 46 | "domain": "www.mcdonalds.com", 47 | "displayed_url": "https://www.mcdonalds.com \u203a en-us \u203a full-menu" 48 | }, 49 | { 50 | "position": 2, 51 | "title": "McDonald\u0027s", 52 | "snippet": "McDonald\u0027s is the world\u0027s largest fast food restaurant chain, serving over 69 million customers daily in over 100 countries in more than 40,000 outlets as of\u00a0...", 53 | "prerender": false, 54 | "cached_page_url": {}, 55 | "related_pages_url": {}, 56 | "url": "https://en.wikipedia.org/wiki/McDonald%27s", 57 | "domain": "en.wikipedia.org", 58 | "displayed_url": "https://en.wikipedia.org \u203a wiki \u203a McDonald\u0027s" 59 | }, 60 | { 61 | "position": 3, 62 | "title": "Restaurants Near Me: Nearby McDonald\u0027s Locations", 63 | "snippet": "", 64 | "prerender": false, 65 | "cached_page_url": {}, 66 | "related_pages_url": {}, 67 | "url": "https://www.mcdonalds.com/us/en-us/restaurant-locator.html", 68 | "domain": "www.mcdonalds.com", 69 | "displayed_url": "https://www.mcdonalds.com \u203a en-us \u203a restaurant-locator" 70 | }, 71 | { 72 | "position": 4, 73 | "title": "Download the McDonald\u0027s App: Deals, Promotions \u0026 ...", 74 | "snippet": "Download the McDonald\u0027s app for Mobile Order \u0026 Pay, exclusive deals and coupons, menu information and special promotions.", 75 | "prerender": false, 76 | "cached_page_url": {}, 77 | "related_pages_url": {}, 78 | "url": "https://www.mcdonalds.com/us/en-us/download-app.html", 79 | "domain": "www.mcdonalds.com", 80 | "displayed_url": "https://www.mcdonalds.com \u203a en-us \u203a download-app" 81 | }, 82 | { 83 | "position": 5, 84 | "title": "McDonald\u0027s Restaurant Careers in the US", 85 | "snippet": "McDonald\u0027s restaurant jobs are one-of-a-kind \u2013 just like you. Restaurants are hiring across all levels, from Crew team to Management. Apply today!", 86 | "prerender": false, 87 | "cached_page_url": {}, 88 | "related_pages_url": {}, 89 | "url": "https://jobs.mchire.com/", 90 | "domain": "jobs.mchire.com", 91 | "displayed_url": "https://jobs.mchire.com" 92 | } 93 | ], 94 | "inline_images": [ 95 | { 96 | "image_url": "https://serpstack-assets.apilayer.net/2418910010831954152.png", 97 | "title": "" 98 | } 99 | ], 100 | "local_results": [ 101 | { 102 | "position": 1, 103 | "title": "McDonald\u0027s", 104 | "coordinates": { 105 | "latitude": 0, 106 | "longitude": 0 107 | }, 108 | "address": "", 109 | "rating": 0, 110 | "reviews": 0, 111 | "type": "", 112 | "price": {}, 113 | "url": 0 114 | }, 115 | { 116 | "position": 2, 117 | "title": "McDonald\u0027s", 118 | "coordinates": { 119 | "latitude": 0, 120 | "longitude": 0 121 | }, 122 | "address": "", 123 | "rating": 0, 124 | "reviews": 0, 125 | "type": "", 126 | "price": {}, 127 | "url": 0 128 | }, 129 | { 130 | "position": 3, 131 | "title": "McDonald\u0027s", 132 | "coordinates": { 133 | "latitude": 0, 134 | "longitude": 0 135 | }, 136 | "address": "", 137 | "rating": 0, 138 | "reviews": 0, 139 | "type": "", 140 | "price": {}, 141 | "url": 0 142 | } 143 | ], 144 | "top_stories": [ 145 | { 146 | "block_position": 1, 147 | "title": "Menu nutrition", 148 | "url": "/search?safe=0\u0026sca_esv=c9c7fd42856085e2\u0026sca_upv=1\u0026gl=us\u0026hl=en\u0026q=mcdonald%27s+double+quarter+pounder+with+cheese\u0026stick=H4sIAAAAAAAAAONgFuLUz9U3ME-vLDBX4tVP1zc0TCsuNE0ytjTTUs5OttJPy89P0c9NzSuNLyjKL8tMSS2yAvNS80qKMlOLF7Hq5ian5Ocl5qSoFyuk5Jcm5aQqFJYmFpWkFikU5JfmATUolGeWZCgkZ6SmFqcCAM4ilJtxAAAA\u0026sa=X\u0026ved=2ahUKEwjF55alk_iFAxXlamwGHbqgAs4Qri56BAh0EAM", 149 | "source": "", 150 | "uploaded": "", 151 | "uploaded_utc": "2024-05-06T04:07:22.082Z" 152 | }, 153 | { 154 | "block_position": 2, 155 | "title": "Profiles", 156 | "url": "https://www.instagram.com/McDonalds", 157 | "source": "", 158 | "uploaded": "", 159 | "uploaded_utc": "2024-05-06T04:07:22.082Z" 160 | }, 161 | { 162 | "block_position": 3, 163 | "title": "People also search for", 164 | "url": "/search?safe=0\u0026sca_esv=c9c7fd42856085e2\u0026sca_upv=1\u0026gl=us\u0026hl=en\u0026si=ACC90nzx_D3_zUKRnpAjmO0UBLNxnt7EyN4YYdru6U3bxLI-L5Wg8IL2sxPFxxcDEhVbocy-LJPZIvZySijw0ho2hfZ-KtV-sSEEJ9lw7JuEkXHDnRK5y4Dm8aqbiLwugbLbslwjG3hO_gpDTFZK2VoUGZPy2nrmOBCy0G3PoOfoiEtct2GSZlUz0uufG-xP8emtNzQKQpvjkAm5Zmi57iVZueiD62upz7-x2N3dAbwtm6FkInAPRw1yR91zuT7F3lEaPblTW3LaRwCDC0bvaRCh9x4N9zHgY1OOQa_rzts2jf5WpXcuw4Y%3D\u0026q=Burger+King\u0026sa=X\u0026ved=2ahUKEwjF55alk_iFAxXlamwGHbqgAs4Qs9oBKAB6BAhzEAI", 165 | "source": "", 166 | "uploaded": "", 167 | "uploaded_utc": "2024-05-06T04:07:22.082Z" 168 | } 169 | ], 170 | "related_questions": [ 171 | { 172 | "question": "What\u0027s a number 7 at McDonald\u0027s?What\u0027s a number 7 at McDonald\u0027s?What\u0027s a number 7 at McDonald\u0027s?", 173 | "answer": "", 174 | "title": "", 175 | "displayed_url": "" 176 | }, 177 | { 178 | "question": "Why is McDonald\u0027s changing their name?Why is McDonald\u0027s changing their name?Why is McDonald\u0027s changing their name?", 179 | "answer": "", 180 | "title": "", 181 | "displayed_url": "" 182 | }, 183 | { 184 | "question": "What is the oldest still running Mcdonalds?What is the oldest still running Mcdonalds?What is the oldest still running Mcdonalds?", 185 | "answer": "", 186 | "title": "", 187 | "displayed_url": "" 188 | }, 189 | { 190 | "question": "Why is McDonald\u0027s now WcDonald\u0027s?Why is McDonald\u0027s now WcDonald\u0027s?Why is McDonald\u0027s now WcDonald\u0027s?", 191 | "answer": "", 192 | "title": "", 193 | "displayed_url": "" 194 | } 195 | ], 196 | "knowledge_graph": { 197 | "title": "", 198 | "type": "Fast-food restaurant company", 199 | "image_urls": ["https://serpstack-assets.apilayer.net/2418910010831954152.png"], 200 | "description": "McDonald\u0027s Corporation is an American multinational fast food chain, founded in 1940 as a restaurant operated by Richard and Maurice McDonald, in San Bernardino, California, United States.", 201 | "source": { 202 | "name": "Wikipedia", 203 | "url": "https://en.wikipedia.org/wiki/McDonald\u0027s" 204 | }, 205 | "people_also_search_for": [], 206 | "known_attributes": [ 207 | { 208 | "attribute": "kc:/business/business_operation:founder", 209 | "link": "http://www.google.com/search?safe=0\u0026sca_esv=c9c7fd42856085e2\u0026sca_upv=1\u0026gl=us\u0026hl=en\u0026q=Ray+Kroc\u0026si=ACC90nzx_D3_zUKRnpAjmO0UBLNxnt7EyN4YYdru6U3bxLI-LxARWRdbk5SkoY2sDn5Qq7yOmqYGei6qZ7sfJhsjZXBPgjMlLbS7824rpJOm69GzqVWMdoNIZiFX2T4A2td14sZOn4a1BexZLtZXHU7NZdF6VsWbGMVuiSYtXdev7uaUjEJKumiwlqTAATTebOriYTEBuSzC\u0026sa=X\u0026ved=2ahUKEwjF55alk_iFAxXlamwGHbqgAs4QmxMoAHoECHgQAg", 210 | "name": "Founder: ", 211 | "value": "Ray Kroc" 212 | }, 213 | { 214 | "attribute": "kc:/organization/organization:ceo", 215 | "link": "http://www.google.com/search?safe=0\u0026sca_esv=c9c7fd42856085e2\u0026sca_upv=1\u0026gl=us\u0026hl=en\u0026q=Chris+Kempczinski\u0026si=ACC90nwLLwns5sISZcdzuISy7t-NHozt8Cbt6G3WNQfC9ekAgKFbjdEFCDgxLbt57EDZGosYDGiZuq1AcBhA6IhTOSZxfVSySuGQ3VDwmmTA7Z93n3K3596jAuZH9VVv5h8PyvKJSuGuSsQWviJTl3eKj2UL1ZIWuDgkjyVMnC47rN7j0G9PlHRCCLdQF7VDQ1gubTiC4onXqLRBTbwAj6a--PD6Jv_NoA%3D%3D\u0026sa=X\u0026ved=2ahUKEwjF55alk_iFAxXlamwGHbqgAs4QmxMoAHoECHUQAg", 216 | "name": "CEO: ", 217 | "value": "Chris Kempczinski (Nov 1, 2019\u2013)" 218 | }, 219 | { 220 | "attribute": "kc:/business/employer:revenue", 221 | "link": "", 222 | "name": "Revenue: ", 223 | "value": "25.49\u00a0billion USD (2023)" 224 | }, 225 | { 226 | "attribute": "kc:/organization/organization:founded", 227 | "link": "http://www.google.com/search?safe=0\u0026sca_esv=c9c7fd42856085e2\u0026sca_upv=1\u0026gl=us\u0026hl=en\u0026q=Des+Plaines\u0026si=ACC90nyvvWro6QmnyY1IfSdgk5wwjB1r8BGd_IWRjXqmKPQqm_yqLtI_DBi5PXGOtg_Z3qrzzEP6mcih1nN7h5A7v6OefnEJiC7a8dBR-v9LxlRubfyR6vlMr3fZ3TmVKWwz9FRpvZb1eYNt-RM7KIDKQlwGEIgINvzhxjUrv6uxSmceduzxd8W7Pkz71XGwxF0F8OlSzHlx\u0026sa=X\u0026ved=2ahUKEwjF55alk_iFAxXlamwGHbqgAs4QmxMoAHoECG4QAg", 228 | "name": "Founded: ", 229 | "value": "April 15, 1955, Des Plaines, IL" 230 | }, 231 | { 232 | "attribute": "kc:/organization/organization:headquarters", 233 | "link": "http://www.google.com/search?safe=0\u0026sca_esv=c9c7fd42856085e2\u0026sca_upv=1\u0026gl=us\u0026hl=en\u0026q=Chicago\u0026si=ACC90nyvvWro6QmnyY1IfSdgk5wwjB1r8BGd_IWRjXqmKPQqm-46AEJ_kJbUIEvsvEEZqteiYJvXVXs2ScRNDvFFpjfeAaW3dxtpTGCgcsf5RMdi6IdzOdtjJMN3ZaFwqZOmdi7tC6r0Mh1O9bnP3HrVDB9hH02m7aA6f70dCAfTdpOFnGxDU6wVMAI5MxWBE3wTugtUDOK-\u0026sa=X\u0026ved=2ahUKEwjF55alk_iFAxXlamwGHbqgAs4QmxMoAHoECHYQAg", 234 | "name": "Headquarters: ", 235 | "value": "Chicago, IL" 236 | }, 237 | { 238 | "attribute": "kc:/organization/organization:president", 239 | "link": "http://www.google.com/search?safe=0\u0026sca_esv=c9c7fd42856085e2\u0026sca_upv=1\u0026gl=us\u0026hl=en\u0026q=Chris+Kempczinski\u0026si=ACC90nwLLwns5sISZcdzuISy7t-NHozt8Cbt6G3WNQfC9ekAgKFbjdEFCDgxLbt57EDZGosYDGiZuq1AcBhA6IhTOSZxfVSySuGQ3VDwmmTA7Z93n3K3596jAuZH9VVv5h8PyvKJSuGuSsQWviJTl3eKj2UL1ZIWuDgkjyVMnC47rN7j0G9PlHRCCLdQF7VDQ1gubTiC4onXqLRBTbwAj6a--PD6Jv_NoA%3D%3D\u0026sa=X\u0026ved=2ahUKEwjF55alk_iFAxXlamwGHbqgAs4QmxMoAHoECHEQAg", 240 | "name": "President: ", 241 | "value": "Chris Kempczinski" 242 | } 243 | ], 244 | "website": "https://www.mcdonalds.com/us/en-us.html", 245 | "profiles": [ 246 | { 247 | "name": "Instagram", 248 | "url": "https://www.instagram.com/McDonalds" 249 | }, 250 | { 251 | "name": "X (Twitter)", 252 | "url": "https://twitter.com/McDonalds" 253 | }, 254 | { 255 | "name": "Facebook", 256 | "url": "https://www.facebook.com/McDonaldsUS" 257 | }, 258 | { 259 | "name": "YouTube", 260 | "url": "https://www.youtube.com/user/McDonaldsUS" 261 | }, 262 | { 263 | "name": "Pinterest", 264 | "url": "https://www.pinterest.com/mcdonalds" 265 | } 266 | ], 267 | "founded": "April 15, 1955, Des Plaines, IL", 268 | "headquarters": "Chicago, IL", 269 | "founders": [ 270 | { 271 | "name": "Ray Kroc", 272 | "link": "http://www.google.com/search?safe=0\u0026sca_esv=c9c7fd42856085e2\u0026sca_upv=1\u0026gl=us\u0026hl=en\u0026q=Ray+Kroc\u0026si=ACC90nzx_D3_zUKRnpAjmO0UBLNxnt7EyN4YYdru6U3bxLI-LxARWRdbk5SkoY2sDn5Qq7yOmqYGei6qZ7sfJhsjZXBPgjMlLbS7824rpJOm69GzqVWMdoNIZiFX2T4A2td14sZOn4a1BexZLtZXHU7NZdF6VsWbGMVuiSYtXdev7uaUjEJKumiwlqTAATTebOriYTEBuSzC\u0026sa=X\u0026ved=2ahUKEwjF55alk_iFAxXlamwGHbqgAs4QmxMoAHoECHgQAg" 273 | } 274 | ] 275 | } 276 | } ``````` `\\?\D:\Coding\ai\backend\apps\rag\utils.py`: ```````py 1 | import os 2 | import logging 3 | import requests 4 | 5 | from typing import List, Union 6 | 7 | from apps.ollama.main import ( 8 | generate_ollama_embeddings, 9 | GenerateEmbeddingsForm, 10 | ) 11 | 12 | from huggingface_hub import snapshot_download 13 | 14 | from langchain_core.documents import Document 15 | from langchain_community.retrievers import BM25Retriever 16 | from langchain.retrievers import ( 17 | ContextualCompressionRetriever, 18 | EnsembleRetriever, 19 | ) 20 | 21 | from typing import Optional 22 | 23 | from utils.misc import get_last_user_message, add_or_update_system_message 24 | from config import SRC_LOG_LEVELS, CHROMA_CLIENT 25 | 26 | log = logging.getLogger(__name__) 27 | log.setLevel(SRC_LOG_LEVELS["RAG"]) 28 | 29 | 30 | def query_doc( 31 | collection_name: str, 32 | query: str, 33 | embedding_function, 34 | k: int, 35 | ): 36 | try: 37 | collection = CHROMA_CLIENT.get_collection(name=collection_name) 38 | query_embeddings = embedding_function(query) 39 | 40 | result = collection.query( 41 | query_embeddings=[query_embeddings], 42 | n_results=k, 43 | ) 44 | 45 | log.info(f"query_doc:result {result}") 46 | return result 47 | except Exception as e: 48 | raise e 49 | 50 | 51 | def query_doc_with_hybrid_search( 52 | collection_name: str, 53 | query: str, 54 | embedding_function, 55 | k: int, 56 | reranking_function, 57 | r: float, 58 | ): 59 | try: 60 | collection = CHROMA_CLIENT.get_collection(name=collection_name) 61 | documents = collection.get() # get all documents 62 | 63 | bm25_retriever = BM25Retriever.from_texts( 64 | texts=documents.get("documents"), 65 | metadatas=documents.get("metadatas"), 66 | ) 67 | bm25_retriever.k = k 68 | 69 | chroma_retriever = ChromaRetriever( 70 | collection=collection, 71 | embedding_function=embedding_function, 72 | top_n=k, 73 | ) 74 | 75 | ensemble_retriever = EnsembleRetriever( 76 | retrievers=[bm25_retriever, chroma_retriever], weights=[0.5, 0.5] 77 | ) 78 | 79 | compressor = RerankCompressor( 80 | embedding_function=embedding_function, 81 | top_n=k, 82 | reranking_function=reranking_function, 83 | r_score=r, 84 | ) 85 | 86 | compression_retriever = ContextualCompressionRetriever( 87 | base_compressor=compressor, base_retriever=ensemble_retriever 88 | ) 89 | 90 | result = compression_retriever.invoke(query) 91 | result = { 92 | "distances": [[d.metadata.get("score") for d in result]], 93 | "documents": [[d.page_content for d in result]], 94 | "metadatas": [[d.metadata for d in result]], 95 | } 96 | 97 | log.info(f"query_doc_with_hybrid_search:result {result}") 98 | return result 99 | except Exception as e: 100 | raise e 101 | 102 | 103 | def merge_and_sort_query_results(query_results, k, reverse=False): 104 | # Initialize lists to store combined data 105 | combined_distances = [] 106 | combined_documents = [] 107 | combined_metadatas = [] 108 | 109 | for data in query_results: 110 | combined_distances.extend(data["distances"][0]) 111 | combined_documents.extend(data["documents"][0]) 112 | combined_metadatas.extend(data["metadatas"][0]) 113 | 114 | # Create a list of tuples (distance, document, metadata) 115 | combined = list(zip(combined_distances, combined_documents, combined_metadatas)) 116 | 117 | # Sort the list based on distances 118 | combined.sort(key=lambda x: x[0], reverse=reverse) 119 | 120 | # We don't have anything :-( 121 | if not combined: 122 | sorted_distances = [] 123 | sorted_documents = [] 124 | sorted_metadatas = [] 125 | else: 126 | # Unzip the sorted list 127 | sorted_distances, sorted_documents, sorted_metadatas = zip(*combined) 128 | 129 | # Slicing the lists to include only k elements 130 | sorted_distances = list(sorted_distances)[:k] 131 | sorted_documents = list(sorted_documents)[:k] 132 | sorted_metadatas = list(sorted_metadatas)[:k] 133 | 134 | # Create the output dictionary 135 | result = { 136 | "distances": [sorted_distances], 137 | "documents": [sorted_documents], 138 | "metadatas": [sorted_metadatas], 139 | } 140 | 141 | return result 142 | 143 | 144 | def query_collection( 145 | collection_names: List[str], 146 | query: str, 147 | embedding_function, 148 | k: int, 149 | ): 150 | results = [] 151 | for collection_name in collection_names: 152 | try: 153 | result = query_doc( 154 | collection_name=collection_name, 155 | query=query, 156 | k=k, 157 | embedding_function=embedding_function, 158 | ) 159 | results.append(result) 160 | except: 161 | pass 162 | return merge_and_sort_query_results(results, k=k) 163 | 164 | 165 | def query_collection_with_hybrid_search( 166 | collection_names: List[str], 167 | query: str, 168 | embedding_function, 169 | k: int, 170 | reranking_function, 171 | r: float, 172 | ): 173 | results = [] 174 | for collection_name in collection_names: 175 | try: 176 | result = query_doc_with_hybrid_search( 177 | collection_name=collection_name, 178 | query=query, 179 | embedding_function=embedding_function, 180 | k=k, 181 | reranking_function=reranking_function, 182 | r=r, 183 | ) 184 | results.append(result) 185 | except: 186 | pass 187 | return merge_and_sort_query_results(results, k=k, reverse=True) 188 | 189 | 190 | def rag_template(template: str, context: str, query: str): 191 | template = template.replace("[context]", context) 192 | template = template.replace("[query]", query) 193 | return template 194 | 195 | 196 | def get_embedding_function( 197 | embedding_engine, 198 | embedding_model, 199 | embedding_function, 200 | openai_key, 201 | openai_url, 202 | batch_size, 203 | ): 204 | if embedding_engine == "": 205 | return lambda query: embedding_function.encode(query).tolist() 206 | elif embedding_engine in ["ollama", "openai"]: 207 | if embedding_engine == "ollama": 208 | func = lambda query: generate_ollama_embeddings( 209 | GenerateEmbeddingsForm( 210 | **{ 211 | "model": embedding_model, 212 | "prompt": query, 213 | } 214 | ) 215 | ) 216 | elif embedding_engine == "openai": 217 | func = lambda query: generate_openai_embeddings( 218 | model=embedding_model, 219 | text=query, 220 | key=openai_key, 221 | url=openai_url, 222 | ) 223 | 224 | def generate_multiple(query, f): 225 | if isinstance(query, list): 226 | if embedding_engine == "openai": 227 | embeddings = [] 228 | for i in range(0, len(query), batch_size): 229 | embeddings.extend(f(query[i : i + batch_size])) 230 | return embeddings 231 | else: 232 | return [f(q) for q in query] 233 | else: 234 | return f(query) 235 | 236 | return lambda query: generate_multiple(query, func) 237 | 238 | 239 | def get_rag_context( 240 | files, 241 | messages, 242 | embedding_function, 243 | k, 244 | reranking_function, 245 | r, 246 | hybrid_search, 247 | ): 248 | log.debug(f"files: {files} {messages} {embedding_function} {reranking_function}") 249 | query = get_last_user_message(messages) 250 | 251 | extracted_collections = [] 252 | relevant_contexts = [] 253 | 254 | for file in files: 255 | context = None 256 | 257 | collection_names = ( 258 | file["collection_names"] 259 | if file["type"] == "collection" 260 | else [file["collection_name"]] 261 | ) 262 | 263 | collection_names = set(collection_names).difference(extracted_collections) 264 | if not collection_names: 265 | log.debug(f"skipping {file} as it has already been extracted") 266 | continue 267 | 268 | try: 269 | if file["type"] == "text": 270 | context = file["content"] 271 | else: 272 | if hybrid_search: 273 | context = query_collection_with_hybrid_search( 274 | collection_names=collection_names, 275 | query=query, 276 | embedding_function=embedding_function, 277 | k=k, 278 | reranking_function=reranking_function, 279 | r=r, 280 | ) 281 | else: 282 | context = query_collection( 283 | collection_names=collection_names, 284 | query=query, 285 | embedding_function=embedding_function, 286 | k=k, 287 | ) 288 | except Exception as e: 289 | log.exception(e) 290 | context = None 291 | 292 | if context: 293 | relevant_contexts.append({**context, "source": file}) 294 | 295 | extracted_collections.extend(collection_names) 296 | 297 | contexts = [] 298 | citations = [] 299 | 300 | for context in relevant_contexts: 301 | try: 302 | if "documents" in context: 303 | contexts.append( 304 | "\n\n".join( 305 | [text for text in context["documents"][0] if text is not None] 306 | ) 307 | ) 308 | 309 | if "metadatas" in context: 310 | citations.append( 311 | { 312 | "source": context["source"], 313 | "document": context["documents"][0], 314 | "metadata": context["metadatas"][0], 315 | } 316 | ) 317 | except Exception as e: 318 | log.exception(e) 319 | 320 | return contexts, citations 321 | 322 | 323 | def get_model_path(model: str, update_model: bool = False): 324 | # Construct huggingface_hub kwargs with local_files_only to return the snapshot path 325 | cache_dir = os.getenv("SENTENCE_TRANSFORMERS_HOME") 326 | 327 | local_files_only = not update_model 328 | 329 | snapshot_kwargs = { 330 | "cache_dir": cache_dir, 331 | "local_files_only": local_files_only, 332 | } 333 | 334 | log.debug(f"model: {model}") 335 | log.debug(f"snapshot_kwargs: {snapshot_kwargs}") 336 | 337 | # Inspiration from upstream sentence_transformers 338 | if ( 339 | os.path.exists(model) 340 | or ("\\" in model or model.count("/") > 1) 341 | and local_files_only 342 | ): 343 | # If fully qualified path exists, return input, else set repo_id 344 | return model 345 | elif "/" not in model: 346 | # Set valid repo_id for model short-name 347 | model = "sentence-transformers" + "/" + model 348 | 349 | snapshot_kwargs["repo_id"] = model 350 | 351 | # Attempt to query the huggingface_hub library to determine the local path and/or to update 352 | try: 353 | model_repo_path = snapshot_download(**snapshot_kwargs) 354 | log.debug(f"model_repo_path: {model_repo_path}") 355 | return model_repo_path 356 | except Exception as e: 357 | log.exception(f"Cannot determine model snapshot path: {e}") 358 | return model 359 | 360 | 361 | def generate_openai_embeddings( 362 | model: str, 363 | text: Union[str, list[str]], 364 | key: str, 365 | url: str = "https://api.openai.com/v1", 366 | ): 367 | if isinstance(text, list): 368 | embeddings = generate_openai_batch_embeddings(model, text, key, url) 369 | else: 370 | embeddings = generate_openai_batch_embeddings(model, [text], key, url) 371 | 372 | return embeddings[0] if isinstance(text, str) else embeddings 373 | 374 | 375 | def generate_openai_batch_embeddings( 376 | model: str, texts: list[str], key: str, url: str = "https://api.openai.com/v1" 377 | ) -> Optional[list[list[float]]]: 378 | try: 379 | r = requests.post( 380 | f"{url}/embeddings", 381 | headers={ 382 | "Content-Type": "application/json", 383 | "Authorization": f"Bearer {key}", 384 | }, 385 | json={"input": texts, "model": model}, 386 | ) 387 | r.raise_for_status() 388 | data = r.json() 389 | if "data" in data: 390 | return [elem["embedding"] for elem in data["data"]] 391 | else: 392 | raise "Something went wrong :/" 393 | except Exception as e: 394 | print(e) 395 | return None 396 | 397 | 398 | from typing import Any 399 | 400 | from langchain_core.retrievers import BaseRetriever 401 | from langchain_core.callbacks import CallbackManagerForRetrieverRun 402 | 403 | 404 | class ChromaRetriever(BaseRetriever): 405 | collection: Any 406 | embedding_function: Any 407 | top_n: int 408 | 409 | def _get_relevant_documents( 410 | self, 411 | query: str, 412 | *, 413 | run_manager: CallbackManagerForRetrieverRun, 414 | ) -> List[Document]: 415 | query_embeddings = self.embedding_function(query) 416 | 417 | results = self.collection.query( 418 | query_embeddings=[query_embeddings], 419 | n_results=self.top_n, 420 | ) 421 | 422 | ids = results["ids"][0] 423 | metadatas = results["metadatas"][0] 424 | documents = results["documents"][0] 425 | 426 | results = [] 427 | for idx in range(len(ids)): 428 | results.append( 429 | Document( 430 | metadata=metadatas[idx], 431 | page_content=documents[idx], 432 | ) 433 | ) 434 | return results 435 | 436 | 437 | import operator 438 | 439 | from typing import Optional, Sequence 440 | 441 | from langchain_core.documents import BaseDocumentCompressor, Document 442 | from langchain_core.callbacks import Callbacks 443 | from langchain_core.pydantic_v1 import Extra 444 | 445 | 446 | class RerankCompressor(BaseDocumentCompressor): 447 | embedding_function: Any 448 | top_n: int 449 | reranking_function: Any 450 | r_score: float 451 | 452 | class Config: 453 | extra = Extra.forbid 454 | arbitrary_types_allowed = True 455 | 456 | def compress_documents( 457 | self, 458 | documents: Sequence[Document], 459 | query: str, 460 | callbacks: Optional[Callbacks] = None, 461 | ) -> Sequence[Document]: 462 | reranking = self.reranking_function is not None 463 | 464 | if reranking: 465 | scores = self.reranking_function.predict( 466 | [(query, doc.page_content) for doc in documents] 467 | ) 468 | else: 469 | from sentence_transformers import util 470 | 471 | query_embedding = self.embedding_function(query) 472 | document_embedding = self.embedding_function( 473 | [doc.page_content for doc in documents] 474 | ) 475 | scores = util.cos_sim(query_embedding, document_embedding)[0] 476 | 477 | docs_with_scores = list(zip(documents, scores.tolist())) 478 | if self.r_score: 479 | docs_with_scores = [ 480 | (d, s) for d, s in docs_with_scores if s >= self.r_score 481 | ] 482 | 483 | result = sorted(docs_with_scores, key=operator.itemgetter(1), reverse=True) 484 | final_results = [] 485 | for doc, doc_score in result[: self.top_n]: 486 | metadata = doc.metadata 487 | metadata["score"] = doc_score 488 | doc = Document( 489 | page_content=doc.page_content, 490 | metadata=metadata, 491 | ) 492 | final_results.append(doc) 493 | return final_results ``````` `\\?\D:\Coding\ai\backend\apps\socket\main.py`: ```````py 1 | import socketio 2 | import asyncio 3 | 4 | 5 | from apps.webui.models.users import Users 6 | from utils.utils import decode_token 7 | 8 | sio = socketio.AsyncServer(cors_allowed_origins=[], async_mode="asgi") 9 | app = socketio.ASGIApp(sio, socketio_path="/ws/socket.io") 10 | 11 | # Dictionary to maintain the user pool 12 | 13 | SESSION_POOL = {} 14 | USER_POOL = {} 15 | USAGE_POOL = {} 16 | # Timeout duration in seconds 17 | TIMEOUT_DURATION = 3 18 | 19 | 20 | @sio.event 21 | async def connect(sid, environ, auth): 22 | user = None 23 | if auth and "token" in auth: 24 | data = decode_token(auth["token"]) 25 | 26 | if data is not None and "id" in data: 27 | user = Users.get_user_by_id(data["id"]) 28 | 29 | if user: 30 | SESSION_POOL[sid] = user.id 31 | if user.id in USER_POOL: 32 | USER_POOL[user.id].append(sid) 33 | else: 34 | USER_POOL[user.id] = [sid] 35 | 36 | print(f"user {user.name}({user.id}) connected with session ID {sid}") 37 | 38 | await sio.emit("user-count", {"count": len(set(USER_POOL))}) 39 | await sio.emit("usage", {"models": get_models_in_use()}) 40 | 41 | 42 | @sio.on("user-join") 43 | async def user_join(sid, data): 44 | print("user-join", sid, data) 45 | 46 | auth = data["auth"] if "auth" in data else None 47 | 48 | if auth and "token" in auth: 49 | data = decode_token(auth["token"]) 50 | 51 | if data is not None and "id" in data: 52 | user = Users.get_user_by_id(data["id"]) 53 | 54 | if user: 55 | 56 | SESSION_POOL[sid] = user.id 57 | if user.id in USER_POOL: 58 | USER_POOL[user.id].append(sid) 59 | else: 60 | USER_POOL[user.id] = [sid] 61 | 62 | print(f"user {user.name}({user.id}) connected with session ID {sid}") 63 | 64 | await sio.emit("user-count", {"count": len(set(USER_POOL))}) 65 | 66 | 67 | @sio.on("user-count") 68 | async def user_count(sid): 69 | await sio.emit("user-count", {"count": len(set(USER_POOL))}) 70 | 71 | 72 | def get_models_in_use(): 73 | # Aggregate all models in use 74 | models_in_use = [] 75 | for model_id, data in USAGE_POOL.items(): 76 | models_in_use.append(model_id) 77 | 78 | return models_in_use 79 | 80 | 81 | @sio.on("usage") 82 | async def usage(sid, data): 83 | 84 | model_id = data["model"] 85 | 86 | # Cancel previous callback if there is one 87 | if model_id in USAGE_POOL: 88 | USAGE_POOL[model_id]["callback"].cancel() 89 | 90 | # Store the new usage data and task 91 | 92 | if model_id in USAGE_POOL: 93 | USAGE_POOL[model_id]["sids"].append(sid) 94 | USAGE_POOL[model_id]["sids"] = list(set(USAGE_POOL[model_id]["sids"])) 95 | 96 | else: 97 | USAGE_POOL[model_id] = {"sids": [sid]} 98 | 99 | # Schedule a task to remove the usage data after TIMEOUT_DURATION 100 | USAGE_POOL[model_id]["callback"] = asyncio.create_task( 101 | remove_after_timeout(sid, model_id) 102 | ) 103 | 104 | # Broadcast the usage data to all clients 105 | await sio.emit("usage", {"models": get_models_in_use()}) 106 | 107 | 108 | async def remove_after_timeout(sid, model_id): 109 | try: 110 | await asyncio.sleep(TIMEOUT_DURATION) 111 | if model_id in USAGE_POOL: 112 | print(USAGE_POOL[model_id]["sids"]) 113 | USAGE_POOL[model_id]["sids"].remove(sid) 114 | USAGE_POOL[model_id]["sids"] = list(set(USAGE_POOL[model_id]["sids"])) 115 | 116 | if len(USAGE_POOL[model_id]["sids"]) == 0: 117 | del USAGE_POOL[model_id] 118 | 119 | # Broadcast the usage data to all clients 120 | await sio.emit("usage", {"models": get_models_in_use()}) 121 | except asyncio.CancelledError: 122 | # Task was cancelled due to new 'usage' event 123 | pass 124 | 125 | 126 | @sio.event 127 | async def disconnect(sid): 128 | if sid in SESSION_POOL: 129 | user_id = SESSION_POOL[sid] 130 | del SESSION_POOL[sid] 131 | 132 | USER_POOL[user_id].remove(sid) 133 | 134 | if len(USER_POOL[user_id]) == 0: 135 | del USER_POOL[user_id] 136 | 137 | await sio.emit("user-count", {"count": len(USER_POOL)}) 138 | else: 139 | print(f"Unknown session ID {sid} disconnected") 140 | 141 | 142 | async def get_event_emitter(request_info): 143 | async def __event_emitter__(event_data): 144 | await sio.emit( 145 | "chat-events", 146 | { 147 | "chat_id": request_info["chat_id"], 148 | "message_id": request_info["message_id"], 149 | "data": event_data, 150 | }, 151 | to=request_info["session_id"], 152 | ) 153 | 154 | return __event_emitter__ 155 | 156 | 157 | async def get_event_call(request_info): 158 | async def __event_call__(event_data): 159 | response = await sio.call( 160 | "chat-events", 161 | { 162 | "chat_id": request_info["chat_id"], 163 | "message_id": request_info["message_id"], 164 | "data": event_data, 165 | }, 166 | to=request_info["session_id"], 167 | ) 168 | return response 169 | 170 | return __event_call__ ``````` `\\?\D:\Coding\ai\backend\apps\webui\internal\db.py`: ```````py 1 | import os 2 | import logging 3 | import json 4 | from contextlib import contextmanager 5 | 6 | from peewee_migrate import Router 7 | from apps.webui.internal.wrappers import register_connection 8 | 9 | from typing import Optional, Any 10 | from typing_extensions import Self 11 | 12 | from sqlalchemy import create_engine, types, Dialect 13 | from sqlalchemy.ext.declarative import declarative_base 14 | from sqlalchemy.orm import sessionmaker, scoped_session 15 | from sqlalchemy.sql.type_api import _T 16 | 17 | from config import SRC_LOG_LEVELS, DATA_DIR, DATABASE_URL, BACKEND_DIR 18 | 19 | log = logging.getLogger(__name__) 20 | log.setLevel(SRC_LOG_LEVELS["DB"]) 21 | 22 | 23 | class JSONField(types.TypeDecorator): 24 | impl = types.Text 25 | cache_ok = True 26 | 27 | def process_bind_param(self, value: Optional[_T], dialect: Dialect) -> Any: 28 | return json.dumps(value) 29 | 30 | def process_result_value(self, value: Optional[_T], dialect: Dialect) -> Any: 31 | if value is not None: 32 | return json.loads(value) 33 | 34 | def copy(self, **kw: Any) -> Self: 35 | return JSONField(self.impl.length) 36 | 37 | def db_value(self, value): 38 | return json.dumps(value) 39 | 40 | def python_value(self, value): 41 | if value is not None: 42 | return json.loads(value) 43 | 44 | 45 | # Check if the file exists 46 | if os.path.exists(f"{DATA_DIR}/ollama.db"): 47 | # Rename the file 48 | os.rename(f"{DATA_DIR}/ollama.db", f"{DATA_DIR}/webui.db") 49 | log.info("Database migrated from Ollama-WebUI successfully.") 50 | else: 51 | pass 52 | 53 | 54 | # Workaround to handle the peewee migration 55 | # This is required to ensure the peewee migration is handled before the alembic migration 56 | def handle_peewee_migration(DATABASE_URL): 57 | try: 58 | # Replace the postgresql:// with postgres:// and %40 with @ in the DATABASE_URL 59 | db = register_connection( 60 | DATABASE_URL.replace("postgresql://", "postgres://").replace("%40", "@") 61 | ) 62 | migrate_dir = BACKEND_DIR / "apps" / "webui" / "internal" / "migrations" 63 | router = Router(db, logger=log, migrate_dir=migrate_dir) 64 | router.run() 65 | db.close() 66 | 67 | # check if db connection has been closed 68 | 69 | except Exception as e: 70 | log.error(f"Failed to initialize the database connection: {e}") 71 | raise 72 | 73 | finally: 74 | # Properly closing the database connection 75 | if db and not db.is_closed(): 76 | db.close() 77 | 78 | # Assert if db connection has been closed 79 | assert db.is_closed(), "Database connection is still open." 80 | 81 | 82 | handle_peewee_migration(DATABASE_URL) 83 | 84 | 85 | SQLALCHEMY_DATABASE_URL = DATABASE_URL 86 | if "sqlite" in SQLALCHEMY_DATABASE_URL: 87 | engine = create_engine( 88 | SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False} 89 | ) 90 | else: 91 | engine = create_engine(SQLALCHEMY_DATABASE_URL, pool_pre_ping=True) 92 | 93 | 94 | SessionLocal = sessionmaker( 95 | autocommit=False, autoflush=False, bind=engine, expire_on_commit=False 96 | ) 97 | Base = declarative_base() 98 | Session = scoped_session(SessionLocal) 99 | 100 | 101 | # Dependency 102 | def get_session(): 103 | db = SessionLocal() 104 | try: 105 | yield db 106 | finally: 107 | db.close() 108 | 109 | 110 | get_db = contextmanager(get_session) ``````` `\\?\D:\Coding\ai\backend\apps\webui\internal\migrations\001_initial_schema.py`: ```````py 1 | """Peewee migrations -- 001_initial_schema.py. 2 | 3 | Some examples (model - class or model name):: 4 | 5 | > Model = migrator.orm['table_name'] # Return model in current state by name 6 | > Model = migrator.ModelClass # Return model in current state by name 7 | 8 | > migrator.sql(sql) # Run custom SQL 9 | > migrator.run(func, *args, **kwargs) # Run python function with the given args 10 | > migrator.create_model(Model) # Create a model (could be used as decorator) 11 | > migrator.remove_model(model, cascade=True) # Remove a model 12 | > migrator.add_fields(model, **fields) # Add fields to a model 13 | > migrator.change_fields(model, **fields) # Change fields 14 | > migrator.remove_fields(model, *field_names, cascade=True) 15 | > migrator.rename_field(model, old_field_name, new_field_name) 16 | > migrator.rename_table(model, new_table_name) 17 | > migrator.add_index(model, *col_names, unique=False) 18 | > migrator.add_not_null(model, *field_names) 19 | > migrator.add_default(model, field_name, default) 20 | > migrator.add_constraint(model, name, sql) 21 | > migrator.drop_index(model, *col_names) 22 | > migrator.drop_not_null(model, *field_names) 23 | > migrator.drop_constraints(model, *constraints) 24 | 25 | """ 26 | 27 | from contextlib import suppress 28 | 29 | import peewee as pw 30 | from peewee_migrate import Migrator 31 | 32 | 33 | with suppress(ImportError): 34 | import playhouse.postgres_ext as pw_pext 35 | 36 | 37 | def migrate(migrator: Migrator, database: pw.Database, *, fake=False): 38 | """Write your migrations here.""" 39 | 40 | # We perform different migrations for SQLite and other databases 41 | # This is because SQLite is very loose with enforcing its schema, and trying to migrate other databases like SQLite 42 | # will require per-database SQL queries. 43 | # Instead, we assume that because external DB support was added at a later date, it is safe to assume a newer base 44 | # schema instead of trying to migrate from an older schema. 45 | if isinstance(database, pw.SqliteDatabase): 46 | migrate_sqlite(migrator, database, fake=fake) 47 | else: 48 | migrate_external(migrator, database, fake=fake) 49 | 50 | 51 | def migrate_sqlite(migrator: Migrator, database: pw.Database, *, fake=False): 52 | @migrator.create_model 53 | class Auth(pw.Model): 54 | id = pw.CharField(max_length=255, unique=True) 55 | email = pw.CharField(max_length=255) 56 | password = pw.CharField(max_length=255) 57 | active = pw.BooleanField() 58 | 59 | class Meta: 60 | table_name = "auth" 61 | 62 | @migrator.create_model 63 | class Chat(pw.Model): 64 | id = pw.CharField(max_length=255, unique=True) 65 | user_id = pw.CharField(max_length=255) 66 | title = pw.CharField() 67 | chat = pw.TextField() 68 | timestamp = pw.BigIntegerField() 69 | 70 | class Meta: 71 | table_name = "chat" 72 | 73 | @migrator.create_model 74 | class ChatIdTag(pw.Model): 75 | id = pw.CharField(max_length=255, unique=True) 76 | tag_name = pw.CharField(max_length=255) 77 | chat_id = pw.CharField(max_length=255) 78 | user_id = pw.CharField(max_length=255) 79 | timestamp = pw.BigIntegerField() 80 | 81 | class Meta: 82 | table_name = "chatidtag" 83 | 84 | @migrator.create_model 85 | class Document(pw.Model): 86 | id = pw.AutoField() 87 | collection_name = pw.CharField(max_length=255, unique=True) 88 | name = pw.CharField(max_length=255, unique=True) 89 | title = pw.CharField() 90 | filename = pw.CharField() 91 | content = pw.TextField(null=True) 92 | user_id = pw.CharField(max_length=255) 93 | timestamp = pw.BigIntegerField() 94 | 95 | class Meta: 96 | table_name = "document" 97 | 98 | @migrator.create_model 99 | class Modelfile(pw.Model): 100 | id = pw.AutoField() 101 | tag_name = pw.CharField(max_length=255, unique=True) 102 | user_id = pw.CharField(max_length=255) 103 | modelfile = pw.TextField() 104 | timestamp = pw.BigIntegerField() 105 | 106 | class Meta: 107 | table_name = "modelfile" 108 | 109 | @migrator.create_model 110 | class Prompt(pw.Model): 111 | id = pw.AutoField() 112 | command = pw.CharField(max_length=255, unique=True) 113 | user_id = pw.CharField(max_length=255) 114 | title = pw.CharField() 115 | content = pw.TextField() 116 | timestamp = pw.BigIntegerField() 117 | 118 | class Meta: 119 | table_name = "prompt" 120 | 121 | @migrator.create_model 122 | class Tag(pw.Model): 123 | id = pw.CharField(max_length=255, unique=True) 124 | name = pw.CharField(max_length=255) 125 | user_id = pw.CharField(max_length=255) 126 | data = pw.TextField(null=True) 127 | 128 | class Meta: 129 | table_name = "tag" 130 | 131 | @migrator.create_model 132 | class User(pw.Model): 133 | id = pw.CharField(max_length=255, unique=True) 134 | name = pw.CharField(max_length=255) 135 | email = pw.CharField(max_length=255) 136 | role = pw.CharField(max_length=255) 137 | profile_image_url = pw.CharField(max_length=255) 138 | timestamp = pw.BigIntegerField() 139 | 140 | class Meta: 141 | table_name = "user" 142 | 143 | 144 | def migrate_external(migrator: Migrator, database: pw.Database, *, fake=False): 145 | @migrator.create_model 146 | class Auth(pw.Model): 147 | id = pw.CharField(max_length=255, unique=True) 148 | email = pw.CharField(max_length=255) 149 | password = pw.TextField() 150 | active = pw.BooleanField() 151 | 152 | class Meta: 153 | table_name = "auth" 154 | 155 | @migrator.create_model 156 | class Chat(pw.Model): 157 | id = pw.CharField(max_length=255, unique=True) 158 | user_id = pw.CharField(max_length=255) 159 | title = pw.TextField() 160 | chat = pw.TextField() 161 | timestamp = pw.BigIntegerField() 162 | 163 | class Meta: 164 | table_name = "chat" 165 | 166 | @migrator.create_model 167 | class ChatIdTag(pw.Model): 168 | id = pw.CharField(max_length=255, unique=True) 169 | tag_name = pw.CharField(max_length=255) 170 | chat_id = pw.CharField(max_length=255) 171 | user_id = pw.CharField(max_length=255) 172 | timestamp = pw.BigIntegerField() 173 | 174 | class Meta: 175 | table_name = "chatidtag" 176 | 177 | @migrator.create_model 178 | class Document(pw.Model): 179 | id = pw.AutoField() 180 | collection_name = pw.CharField(max_length=255, unique=True) 181 | name = pw.CharField(max_length=255, unique=True) 182 | title = pw.TextField() 183 | filename = pw.TextField() 184 | content = pw.TextField(null=True) 185 | user_id = pw.CharField(max_length=255) 186 | timestamp = pw.BigIntegerField() 187 | 188 | class Meta: 189 | table_name = "document" 190 | 191 | @migrator.create_model 192 | class Modelfile(pw.Model): 193 | id = pw.AutoField() 194 | tag_name = pw.CharField(max_length=255, unique=True) 195 | user_id = pw.CharField(max_length=255) 196 | modelfile = pw.TextField() 197 | timestamp = pw.BigIntegerField() 198 | 199 | class Meta: 200 | table_name = "modelfile" 201 | 202 | @migrator.create_model 203 | class Prompt(pw.Model): 204 | id = pw.AutoField() 205 | command = pw.CharField(max_length=255, unique=True) 206 | user_id = pw.CharField(max_length=255) 207 | title = pw.TextField() 208 | content = pw.TextField() 209 | timestamp = pw.BigIntegerField() 210 | 211 | class Meta: 212 | table_name = "prompt" 213 | 214 | @migrator.create_model 215 | class Tag(pw.Model): 216 | id = pw.CharField(max_length=255, unique=True) 217 | name = pw.CharField(max_length=255) 218 | user_id = pw.CharField(max_length=255) 219 | data = pw.TextField(null=True) 220 | 221 | class Meta: 222 | table_name = "tag" 223 | 224 | @migrator.create_model 225 | class User(pw.Model): 226 | id = pw.CharField(max_length=255, unique=True) 227 | name = pw.CharField(max_length=255) 228 | email = pw.CharField(max_length=255) 229 | role = pw.CharField(max_length=255) 230 | profile_image_url = pw.TextField() 231 | timestamp = pw.BigIntegerField() 232 | 233 | class Meta: 234 | table_name = "user" 235 | 236 | 237 | def rollback(migrator: Migrator, database: pw.Database, *, fake=False): 238 | """Write your rollback migrations here.""" 239 | 240 | migrator.remove_model("user") 241 | 242 | migrator.remove_model("tag") 243 | 244 | migrator.remove_model("prompt") 245 | 246 | migrator.remove_model("modelfile") 247 | 248 | migrator.remove_model("document") 249 | 250 | migrator.remove_model("chatidtag") 251 | 252 | migrator.remove_model("chat") 253 | 254 | migrator.remove_model("auth") ``````` `\\?\D:\Coding\ai\backend\apps\webui\internal\migrations\002_add_local_sharing.py`: ```````py 1 | """Peewee migrations -- 002_add_local_sharing.py. 2 | 3 | Some examples (model - class or model name):: 4 | 5 | > Model = migrator.orm['table_name'] # Return model in current state by name 6 | > Model = migrator.ModelClass # Return model in current state by name 7 | 8 | > migrator.sql(sql) # Run custom SQL 9 | > migrator.run(func, *args, **kwargs) # Run python function with the given args 10 | > migrator.create_model(Model) # Create a model (could be used as decorator) 11 | > migrator.remove_model(model, cascade=True) # Remove a model 12 | > migrator.add_fields(model, **fields) # Add fields to a model 13 | > migrator.change_fields(model, **fields) # Change fields 14 | > migrator.remove_fields(model, *field_names, cascade=True) 15 | > migrator.rename_field(model, old_field_name, new_field_name) 16 | > migrator.rename_table(model, new_table_name) 17 | > migrator.add_index(model, *col_names, unique=False) 18 | > migrator.add_not_null(model, *field_names) 19 | > migrator.add_default(model, field_name, default) 20 | > migrator.add_constraint(model, name, sql) 21 | > migrator.drop_index(model, *col_names) 22 | > migrator.drop_not_null(model, *field_names) 23 | > migrator.drop_constraints(model, *constraints) 24 | 25 | """ 26 | 27 | from contextlib import suppress 28 | 29 | import peewee as pw 30 | from peewee_migrate import Migrator 31 | 32 | 33 | with suppress(ImportError): 34 | import playhouse.postgres_ext as pw_pext 35 | 36 | 37 | def migrate(migrator: Migrator, database: pw.Database, *, fake=False): 38 | """Write your migrations here.""" 39 | 40 | migrator.add_fields( 41 | "chat", share_id=pw.CharField(max_length=255, null=True, unique=True) 42 | ) 43 | 44 | 45 | def rollback(migrator: Migrator, database: pw.Database, *, fake=False): 46 | """Write your rollback migrations here.""" 47 | 48 | migrator.remove_fields("chat", "share_id") ``````` `\\?\D:\Coding\ai\backend\apps\webui\internal\migrations\003_add_auth_api_key.py`: ```````py 1 | """Peewee migrations -- 002_add_local_sharing.py. 2 | 3 | Some examples (model - class or model name):: 4 | 5 | > Model = migrator.orm['table_name'] # Return model in current state by name 6 | > Model = migrator.ModelClass # Return model in current state by name 7 | 8 | > migrator.sql(sql) # Run custom SQL 9 | > migrator.run(func, *args, **kwargs) # Run python function with the given args 10 | > migrator.create_model(Model) # Create a model (could be used as decorator) 11 | > migrator.remove_model(model, cascade=True) # Remove a model 12 | > migrator.add_fields(model, **fields) # Add fields to a model 13 | > migrator.change_fields(model, **fields) # Change fields 14 | > migrator.remove_fields(model, *field_names, cascade=True) 15 | > migrator.rename_field(model, old_field_name, new_field_name) 16 | > migrator.rename_table(model, new_table_name) 17 | > migrator.add_index(model, *col_names, unique=False) 18 | > migrator.add_not_null(model, *field_names) 19 | > migrator.add_default(model, field_name, default) 20 | > migrator.add_constraint(model, name, sql) 21 | > migrator.drop_index(model, *col_names) 22 | > migrator.drop_not_null(model, *field_names) 23 | > migrator.drop_constraints(model, *constraints) 24 | 25 | """ 26 | 27 | from contextlib import suppress 28 | 29 | import peewee as pw 30 | from peewee_migrate import Migrator 31 | 32 | 33 | with suppress(ImportError): 34 | import playhouse.postgres_ext as pw_pext 35 | 36 | 37 | def migrate(migrator: Migrator, database: pw.Database, *, fake=False): 38 | """Write your migrations here.""" 39 | 40 | migrator.add_fields( 41 | "user", api_key=pw.CharField(max_length=255, null=True, unique=True) 42 | ) 43 | 44 | 45 | def rollback(migrator: Migrator, database: pw.Database, *, fake=False): 46 | """Write your rollback migrations here.""" 47 | 48 | migrator.remove_fields("user", "api_key") ``````` `\\?\D:\Coding\ai\backend\apps\webui\internal\migrations\004_add_archived.py`: ```````py 1 | """Peewee migrations -- 002_add_local_sharing.py. 2 | 3 | Some examples (model - class or model name):: 4 | 5 | > Model = migrator.orm['table_name'] # Return model in current state by name 6 | > Model = migrator.ModelClass # Return model in current state by name 7 | 8 | > migrator.sql(sql) # Run custom SQL 9 | > migrator.run(func, *args, **kwargs) # Run python function with the given args 10 | > migrator.create_model(Model) # Create a model (could be used as decorator) 11 | > migrator.remove_model(model, cascade=True) # Remove a model 12 | > migrator.add_fields(model, **fields) # Add fields to a model 13 | > migrator.change_fields(model, **fields) # Change fields 14 | > migrator.remove_fields(model, *field_names, cascade=True) 15 | > migrator.rename_field(model, old_field_name, new_field_name) 16 | > migrator.rename_table(model, new_table_name) 17 | > migrator.add_index(model, *col_names, unique=False) 18 | > migrator.add_not_null(model, *field_names) 19 | > migrator.add_default(model, field_name, default) 20 | > migrator.add_constraint(model, name, sql) 21 | > migrator.drop_index(model, *col_names) 22 | > migrator.drop_not_null(model, *field_names) 23 | > migrator.drop_constraints(model, *constraints) 24 | 25 | """ 26 | 27 | from contextlib import suppress 28 | 29 | import peewee as pw 30 | from peewee_migrate import Migrator 31 | 32 | 33 | with suppress(ImportError): 34 | import playhouse.postgres_ext as pw_pext 35 | 36 | 37 | def migrate(migrator: Migrator, database: pw.Database, *, fake=False): 38 | """Write your migrations here.""" 39 | 40 | migrator.add_fields("chat", archived=pw.BooleanField(default=False)) 41 | 42 | 43 | def rollback(migrator: Migrator, database: pw.Database, *, fake=False): 44 | """Write your rollback migrations here.""" 45 | 46 | migrator.remove_fields("chat", "archived") ``````` `\\?\D:\Coding\ai\backend\apps\webui\internal\migrations\005_add_updated_at.py`: ```````py 1 | """Peewee migrations -- 002_add_local_sharing.py. 2 | 3 | Some examples (model - class or model name):: 4 | 5 | > Model = migrator.orm['table_name'] # Return model in current state by name 6 | > Model = migrator.ModelClass # Return model in current state by name 7 | 8 | > migrator.sql(sql) # Run custom SQL 9 | > migrator.run(func, *args, **kwargs) # Run python function with the given args 10 | > migrator.create_model(Model) # Create a model (could be used as decorator) 11 | > migrator.remove_model(model, cascade=True) # Remove a model 12 | > migrator.add_fields(model, **fields) # Add fields to a model 13 | > migrator.change_fields(model, **fields) # Change fields 14 | > migrator.remove_fields(model, *field_names, cascade=True) 15 | > migrator.rename_field(model, old_field_name, new_field_name) 16 | > migrator.rename_table(model, new_table_name) 17 | > migrator.add_index(model, *col_names, unique=False) 18 | > migrator.add_not_null(model, *field_names) 19 | > migrator.add_default(model, field_name, default) 20 | > migrator.add_constraint(model, name, sql) 21 | > migrator.drop_index(model, *col_names) 22 | > migrator.drop_not_null(model, *field_names) 23 | > migrator.drop_constraints(model, *constraints) 24 | 25 | """ 26 | 27 | from contextlib import suppress 28 | 29 | import peewee as pw 30 | from peewee_migrate import Migrator 31 | 32 | 33 | with suppress(ImportError): 34 | import playhouse.postgres_ext as pw_pext 35 | 36 | 37 | def migrate(migrator: Migrator, database: pw.Database, *, fake=False): 38 | """Write your migrations here.""" 39 | 40 | if isinstance(database, pw.SqliteDatabase): 41 | migrate_sqlite(migrator, database, fake=fake) 42 | else: 43 | migrate_external(migrator, database, fake=fake) 44 | 45 | 46 | def migrate_sqlite(migrator: Migrator, database: pw.Database, *, fake=False): 47 | # Adding fields created_at and updated_at to the 'chat' table 48 | migrator.add_fields( 49 | "chat", 50 | created_at=pw.DateTimeField(null=True), # Allow null for transition 51 | updated_at=pw.DateTimeField(null=True), # Allow null for transition 52 | ) 53 | 54 | # Populate the new fields from an existing 'timestamp' field 55 | migrator.sql( 56 | "UPDATE chat SET created_at = timestamp, updated_at = timestamp WHERE timestamp IS NOT NULL" 57 | ) 58 | 59 | # Now that the data has been copied, remove the original 'timestamp' field 60 | migrator.remove_fields("chat", "timestamp") 61 | 62 | # Update the fields to be not null now that they are populated 63 | migrator.change_fields( 64 | "chat", 65 | created_at=pw.DateTimeField(null=False), 66 | updated_at=pw.DateTimeField(null=False), 67 | ) 68 | 69 | 70 | def migrate_external(migrator: Migrator, database: pw.Database, *, fake=False): 71 | # Adding fields created_at and updated_at to the 'chat' table 72 | migrator.add_fields( 73 | "chat", 74 | created_at=pw.BigIntegerField(null=True), # Allow null for transition 75 | updated_at=pw.BigIntegerField(null=True), # Allow null for transition 76 | ) 77 | 78 | # Populate the new fields from an existing 'timestamp' field 79 | migrator.sql( 80 | "UPDATE chat SET created_at = timestamp, updated_at = timestamp WHERE timestamp IS NOT NULL" 81 | ) 82 | 83 | # Now that the data has been copied, remove the original 'timestamp' field 84 | migrator.remove_fields("chat", "timestamp") 85 | 86 | # Update the fields to be not null now that they are populated 87 | migrator.change_fields( 88 | "chat", 89 | created_at=pw.BigIntegerField(null=False), 90 | updated_at=pw.BigIntegerField(null=False), 91 | ) 92 | 93 | 94 | def rollback(migrator: Migrator, database: pw.Database, *, fake=False): 95 | """Write your rollback migrations here.""" 96 | 97 | if isinstance(database, pw.SqliteDatabase): 98 | rollback_sqlite(migrator, database, fake=fake) 99 | else: 100 | rollback_external(migrator, database, fake=fake) 101 | 102 | 103 | def rollback_sqlite(migrator: Migrator, database: pw.Database, *, fake=False): 104 | # Recreate the timestamp field initially allowing null values for safe transition 105 | migrator.add_fields("chat", timestamp=pw.DateTimeField(null=True)) 106 | 107 | # Copy the earliest created_at date back into the new timestamp field 108 | # This assumes created_at was originally a copy of timestamp 109 | migrator.sql("UPDATE chat SET timestamp = created_at") 110 | 111 | # Remove the created_at and updated_at fields 112 | migrator.remove_fields("chat", "created_at", "updated_at") 113 | 114 | # Finally, alter the timestamp field to not allow nulls if that was the original setting 115 | migrator.change_fields("chat", timestamp=pw.DateTimeField(null=False)) 116 | 117 | 118 | def rollback_external(migrator: Migrator, database: pw.Database, *, fake=False): 119 | # Recreate the timestamp field initially allowing null values for safe transition 120 | migrator.add_fields("chat", timestamp=pw.BigIntegerField(null=True)) 121 | 122 | # Copy the earliest created_at date back into the new timestamp field 123 | # This assumes created_at was originally a copy of timestamp 124 | migrator.sql("UPDATE chat SET timestamp = created_at") 125 | 126 | # Remove the created_at and updated_at fields 127 | migrator.remove_fields("chat", "created_at", "updated_at") 128 | 129 | # Finally, alter the timestamp field to not allow nulls if that was the original setting 130 | migrator.change_fields("chat", timestamp=pw.BigIntegerField(null=False)) ``````` `\\?\D:\Coding\ai\backend\apps\webui\internal\migrations\006_migrate_timestamps_and_charfields.py`: ```````py 1 | """Peewee migrations -- 006_migrate_timestamps_and_charfields.py. 2 | 3 | Some examples (model - class or model name):: 4 | 5 | > Model = migrator.orm['table_name'] # Return model in current state by name 6 | > Model = migrator.ModelClass # Return model in current state by name 7 | 8 | > migrator.sql(sql) # Run custom SQL 9 | > migrator.run(func, *args, **kwargs) # Run python function with the given args 10 | > migrator.create_model(Model) # Create a model (could be used as decorator) 11 | > migrator.remove_model(model, cascade=True) # Remove a model 12 | > migrator.add_fields(model, **fields) # Add fields to a model 13 | > migrator.change_fields(model, **fields) # Change fields 14 | > migrator.remove_fields(model, *field_names, cascade=True) 15 | > migrator.rename_field(model, old_field_name, new_field_name) 16 | > migrator.rename_table(model, new_table_name) 17 | > migrator.add_index(model, *col_names, unique=False) 18 | > migrator.add_not_null(model, *field_names) 19 | > migrator.add_default(model, field_name, default) 20 | > migrator.add_constraint(model, name, sql) 21 | > migrator.drop_index(model, *col_names) 22 | > migrator.drop_not_null(model, *field_names) 23 | > migrator.drop_constraints(model, *constraints) 24 | 25 | """ 26 | 27 | from contextlib import suppress 28 | 29 | import peewee as pw 30 | from peewee_migrate import Migrator 31 | 32 | 33 | with suppress(ImportError): 34 | import playhouse.postgres_ext as pw_pext 35 | 36 | 37 | def migrate(migrator: Migrator, database: pw.Database, *, fake=False): 38 | """Write your migrations here.""" 39 | 40 | # Alter the tables with timestamps 41 | migrator.change_fields( 42 | "chatidtag", 43 | timestamp=pw.BigIntegerField(), 44 | ) 45 | migrator.change_fields( 46 | "document", 47 | timestamp=pw.BigIntegerField(), 48 | ) 49 | migrator.change_fields( 50 | "modelfile", 51 | timestamp=pw.BigIntegerField(), 52 | ) 53 | migrator.change_fields( 54 | "prompt", 55 | timestamp=pw.BigIntegerField(), 56 | ) 57 | migrator.change_fields( 58 | "user", 59 | timestamp=pw.BigIntegerField(), 60 | ) 61 | # Alter the tables with varchar to text where necessary 62 | migrator.change_fields( 63 | "auth", 64 | password=pw.TextField(), 65 | ) 66 | migrator.change_fields( 67 | "chat", 68 | title=pw.TextField(), 69 | ) 70 | migrator.change_fields( 71 | "document", 72 | title=pw.TextField(), 73 | filename=pw.TextField(), 74 | ) 75 | migrator.change_fields( 76 | "prompt", 77 | title=pw.TextField(), 78 | ) 79 | migrator.change_fields( 80 | "user", 81 | profile_image_url=pw.TextField(), 82 | ) 83 | 84 | 85 | def rollback(migrator: Migrator, database: pw.Database, *, fake=False): 86 | """Write your rollback migrations here.""" 87 | 88 | if isinstance(database, pw.SqliteDatabase): 89 | # Alter the tables with timestamps 90 | migrator.change_fields( 91 | "chatidtag", 92 | timestamp=pw.DateField(), 93 | ) 94 | migrator.change_fields( 95 | "document", 96 | timestamp=pw.DateField(), 97 | ) 98 | migrator.change_fields( 99 | "modelfile", 100 | timestamp=pw.DateField(), 101 | ) 102 | migrator.change_fields( 103 | "prompt", 104 | timestamp=pw.DateField(), 105 | ) 106 | migrator.change_fields( 107 | "user", 108 | timestamp=pw.DateField(), 109 | ) 110 | migrator.change_fields( 111 | "auth", 112 | password=pw.CharField(max_length=255), 113 | ) 114 | migrator.change_fields( 115 | "chat", 116 | title=pw.CharField(), 117 | ) 118 | migrator.change_fields( 119 | "document", 120 | title=pw.CharField(), 121 | filename=pw.CharField(), 122 | ) 123 | migrator.change_fields( 124 | "prompt", 125 | title=pw.CharField(), 126 | ) 127 | migrator.change_fields( 128 | "user", 129 | profile_image_url=pw.CharField(), 130 | ) ``````` `\\?\D:\Coding\ai\backend\apps\webui\internal\migrations\007_add_user_last_active_at.py`: ```````py 1 | """Peewee migrations -- 002_add_local_sharing.py. 2 | 3 | Some examples (model - class or model name):: 4 | 5 | > Model = migrator.orm['table_name'] # Return model in current state by name 6 | > Model = migrator.ModelClass # Return model in current state by name 7 | 8 | > migrator.sql(sql) # Run custom SQL 9 | > migrator.run(func, *args, **kwargs) # Run python function with the given args 10 | > migrator.create_model(Model) # Create a model (could be used as decorator) 11 | > migrator.remove_model(model, cascade=True) # Remove a model 12 | > migrator.add_fields(model, **fields) # Add fields to a model 13 | > migrator.change_fields(model, **fields) # Change fields 14 | > migrator.remove_fields(model, *field_names, cascade=True) 15 | > migrator.rename_field(model, old_field_name, new_field_name) 16 | > migrator.rename_table(model, new_table_name) 17 | > migrator.add_index(model, *col_names, unique=False) 18 | > migrator.add_not_null(model, *field_names) 19 | > migrator.add_default(model, field_name, default) 20 | > migrator.add_constraint(model, name, sql) 21 | > migrator.drop_index(model, *col_names) 22 | > migrator.drop_not_null(model, *field_names) 23 | > migrator.drop_constraints(model, *constraints) 24 | 25 | """ 26 | 27 | from contextlib import suppress 28 | 29 | import peewee as pw 30 | from peewee_migrate import Migrator 31 | 32 | 33 | with suppress(ImportError): 34 | import playhouse.postgres_ext as pw_pext 35 | 36 | 37 | def migrate(migrator: Migrator, database: pw.Database, *, fake=False): 38 | """Write your migrations here.""" 39 | 40 | # Adding fields created_at and updated_at to the 'user' table 41 | migrator.add_fields( 42 | "user", 43 | created_at=pw.BigIntegerField(null=True), # Allow null for transition 44 | updated_at=pw.BigIntegerField(null=True), # Allow null for transition 45 | last_active_at=pw.BigIntegerField(null=True), # Allow null for transition 46 | ) 47 | 48 | # Populate the new fields from an existing 'timestamp' field 49 | migrator.sql( 50 | 'UPDATE "user" SET created_at = timestamp, updated_at = timestamp, last_active_at = timestamp WHERE timestamp IS NOT NULL' 51 | ) 52 | 53 | # Now that the data has been copied, remove the original 'timestamp' field 54 | migrator.remove_fields("user", "timestamp") 55 | 56 | # Update the fields to be not null now that they are populated 57 | migrator.change_fields( 58 | "user", 59 | created_at=pw.BigIntegerField(null=False), 60 | updated_at=pw.BigIntegerField(null=False), 61 | last_active_at=pw.BigIntegerField(null=False), 62 | ) 63 | 64 | 65 | def rollback(migrator: Migrator, database: pw.Database, *, fake=False): 66 | """Write your rollback migrations here.""" 67 | 68 | # Recreate the timestamp field initially allowing null values for safe transition 69 | migrator.add_fields("user", timestamp=pw.BigIntegerField(null=True)) 70 | 71 | # Copy the earliest created_at date back into the new timestamp field 72 | # This assumes created_at was originally a copy of timestamp 73 | migrator.sql('UPDATE "user" SET timestamp = created_at') 74 | 75 | # Remove the created_at and updated_at fields 76 | migrator.remove_fields("user", "created_at", "updated_at", "last_active_at") 77 | 78 | # Finally, alter the timestamp field to not allow nulls if that was the original setting 79 | migrator.change_fields("user", timestamp=pw.BigIntegerField(null=False)) ``````` `\\?\D:\Coding\ai\backend\apps\webui\internal\migrations\008_add_memory.py`: ```````py 1 | """Peewee migrations -- 002_add_local_sharing.py. 2 | 3 | Some examples (model - class or model name):: 4 | 5 | > Model = migrator.orm['table_name'] # Return model in current state by name 6 | > Model = migrator.ModelClass # Return model in current state by name 7 | 8 | > migrator.sql(sql) # Run custom SQL 9 | > migrator.run(func, *args, **kwargs) # Run python function with the given args 10 | > migrator.create_model(Model) # Create a model (could be used as decorator) 11 | > migrator.remove_model(model, cascade=True) # Remove a model 12 | > migrator.add_fields(model, **fields) # Add fields to a model 13 | > migrator.change_fields(model, **fields) # Change fields 14 | > migrator.remove_fields(model, *field_names, cascade=True) 15 | > migrator.rename_field(model, old_field_name, new_field_name) 16 | > migrator.rename_table(model, new_table_name) 17 | > migrator.add_index(model, *col_names, unique=False) 18 | > migrator.add_not_null(model, *field_names) 19 | > migrator.add_default(model, field_name, default) 20 | > migrator.add_constraint(model, name, sql) 21 | > migrator.drop_index(model, *col_names) 22 | > migrator.drop_not_null(model, *field_names) 23 | > migrator.drop_constraints(model, *constraints) 24 | 25 | """ 26 | 27 | from contextlib import suppress 28 | 29 | import peewee as pw 30 | from peewee_migrate import Migrator 31 | 32 | 33 | with suppress(ImportError): 34 | import playhouse.postgres_ext as pw_pext 35 | 36 | 37 | def migrate(migrator: Migrator, database: pw.Database, *, fake=False): 38 | @migrator.create_model 39 | class Memory(pw.Model): 40 | id = pw.CharField(max_length=255, unique=True) 41 | user_id = pw.CharField(max_length=255) 42 | content = pw.TextField(null=False) 43 | updated_at = pw.BigIntegerField(null=False) 44 | created_at = pw.BigIntegerField(null=False) 45 | 46 | class Meta: 47 | table_name = "memory" 48 | 49 | 50 | def rollback(migrator: Migrator, database: pw.Database, *, fake=False): 51 | """Write your rollback migrations here.""" 52 | 53 | migrator.remove_model("memory") ``````` `\\?\D:\Coding\ai\backend\apps\webui\internal\migrations\009_add_models.py`: ```````py 1 | """Peewee migrations -- 009_add_models.py. 2 | 3 | Some examples (model - class or model name):: 4 | 5 | > Model = migrator.orm['table_name'] # Return model in current state by name 6 | > Model = migrator.ModelClass # Return model in current state by name 7 | 8 | > migrator.sql(sql) # Run custom SQL 9 | > migrator.run(func, *args, **kwargs) # Run python function with the given args 10 | > migrator.create_model(Model) # Create a model (could be used as decorator) 11 | > migrator.remove_model(model, cascade=True) # Remove a model 12 | > migrator.add_fields(model, **fields) # Add fields to a model 13 | > migrator.change_fields(model, **fields) # Change fields 14 | > migrator.remove_fields(model, *field_names, cascade=True) 15 | > migrator.rename_field(model, old_field_name, new_field_name) 16 | > migrator.rename_table(model, new_table_name) 17 | > migrator.add_index(model, *col_names, unique=False) 18 | > migrator.add_not_null(model, *field_names) 19 | > migrator.add_default(model, field_name, default) 20 | > migrator.add_constraint(model, name, sql) 21 | > migrator.drop_index(model, *col_names) 22 | > migrator.drop_not_null(model, *field_names) 23 | > migrator.drop_constraints(model, *constraints) 24 | 25 | """ 26 | 27 | from contextlib import suppress 28 | 29 | import peewee as pw 30 | from peewee_migrate import Migrator 31 | 32 | 33 | with suppress(ImportError): 34 | import playhouse.postgres_ext as pw_pext 35 | 36 | 37 | def migrate(migrator: Migrator, database: pw.Database, *, fake=False): 38 | """Write your migrations here.""" 39 | 40 | @migrator.create_model 41 | class Model(pw.Model): 42 | id = pw.TextField(unique=True) 43 | user_id = pw.TextField() 44 | base_model_id = pw.TextField(null=True) 45 | 46 | name = pw.TextField() 47 | 48 | meta = pw.TextField() 49 | params = pw.TextField() 50 | 51 | created_at = pw.BigIntegerField(null=False) 52 | updated_at = pw.BigIntegerField(null=False) 53 | 54 | class Meta: 55 | table_name = "model" 56 | 57 | 58 | def rollback(migrator: Migrator, database: pw.Database, *, fake=False): 59 | """Write your rollback migrations here.""" 60 | 61 | migrator.remove_model("model") ``````` `\\?\D:\Coding\ai\backend\apps\webui\internal\migrations\010_migrate_modelfiles_to_models.py`: ```````py 1 | """Peewee migrations -- 009_add_models.py. 2 | 3 | Some examples (model - class or model name):: 4 | 5 | > Model = migrator.orm['table_name'] # Return model in current state by name 6 | > Model = migrator.ModelClass # Return model in current state by name 7 | 8 | > migrator.sql(sql) # Run custom SQL 9 | > migrator.run(func, *args, **kwargs) # Run python function with the given args 10 | > migrator.create_model(Model) # Create a model (could be used as decorator) 11 | > migrator.remove_model(model, cascade=True) # Remove a model 12 | > migrator.add_fields(model, **fields) # Add fields to a model 13 | > migrator.change_fields(model, **fields) # Change fields 14 | > migrator.remove_fields(model, *field_names, cascade=True) 15 | > migrator.rename_field(model, old_field_name, new_field_name) 16 | > migrator.rename_table(model, new_table_name) 17 | > migrator.add_index(model, *col_names, unique=False) 18 | > migrator.add_not_null(model, *field_names) 19 | > migrator.add_default(model, field_name, default) 20 | > migrator.add_constraint(model, name, sql) 21 | > migrator.drop_index(model, *col_names) 22 | > migrator.drop_not_null(model, *field_names) 23 | > migrator.drop_constraints(model, *constraints) 24 | 25 | """ 26 | 27 | from contextlib import suppress 28 | 29 | import peewee as pw 30 | from peewee_migrate import Migrator 31 | import json 32 | 33 | from utils.misc import parse_ollama_modelfile 34 | 35 | with suppress(ImportError): 36 | import playhouse.postgres_ext as pw_pext 37 | 38 | 39 | def migrate(migrator: Migrator, database: pw.Database, *, fake=False): 40 | """Write your migrations here.""" 41 | 42 | # Fetch data from 'modelfile' table and insert into 'model' table 43 | migrate_modelfile_to_model(migrator, database) 44 | # Drop the 'modelfile' table 45 | migrator.remove_model("modelfile") 46 | 47 | 48 | def migrate_modelfile_to_model(migrator: Migrator, database: pw.Database): 49 | ModelFile = migrator.orm["modelfile"] 50 | Model = migrator.orm["model"] 51 | 52 | modelfiles = ModelFile.select() 53 | 54 | for modelfile in modelfiles: 55 | # Extract and transform data in Python 56 | 57 | modelfile.modelfile = json.loads(modelfile.modelfile) 58 | meta = json.dumps( 59 | { 60 | "description": modelfile.modelfile.get("desc"), 61 | "profile_image_url": modelfile.modelfile.get("imageUrl"), 62 | "ollama": {"modelfile": modelfile.modelfile.get("content")}, 63 | "suggestion_prompts": modelfile.modelfile.get("suggestionPrompts"), 64 | "categories": modelfile.modelfile.get("categories"), 65 | "user": {**modelfile.modelfile.get("user", {}), "community": True}, 66 | } 67 | ) 68 | 69 | info = parse_ollama_modelfile(modelfile.modelfile.get("content")) 70 | 71 | # Insert the processed data into the 'model' table 72 | Model.create( 73 | id=f"ollama-{modelfile.tag_name}", 74 | user_id=modelfile.user_id, 75 | base_model_id=info.get("base_model_id"), 76 | name=modelfile.modelfile.get("title"), 77 | meta=meta, 78 | params=json.dumps(info.get("params", {})), 79 | created_at=modelfile.timestamp, 80 | updated_at=modelfile.timestamp, 81 | ) 82 | 83 | 84 | def rollback(migrator: Migrator, database: pw.Database, *, fake=False): 85 | """Write your rollback migrations here.""" 86 | 87 | recreate_modelfile_table(migrator, database) 88 | move_data_back_to_modelfile(migrator, database) 89 | migrator.remove_model("model") 90 | 91 | 92 | def recreate_modelfile_table(migrator: Migrator, database: pw.Database): 93 | query = """ 94 | CREATE TABLE IF NOT EXISTS modelfile ( 95 | user_id TEXT, 96 | tag_name TEXT, 97 | modelfile JSON, 98 | timestamp BIGINT 99 | ) 100 | """ 101 | migrator.sql(query) 102 | 103 | 104 | def move_data_back_to_modelfile(migrator: Migrator, database: pw.Database): 105 | Model = migrator.orm["model"] 106 | Modelfile = migrator.orm["modelfile"] 107 | 108 | models = Model.select() 109 | 110 | for model in models: 111 | # Extract and transform data in Python 112 | meta = json.loads(model.meta) 113 | 114 | modelfile_data = { 115 | "title": model.name, 116 | "desc": meta.get("description"), 117 | "imageUrl": meta.get("profile_image_url"), 118 | "content": meta.get("ollama", {}).get("modelfile"), 119 | "suggestionPrompts": meta.get("suggestion_prompts"), 120 | "categories": meta.get("categories"), 121 | "user": {k: v for k, v in meta.get("user", {}).items() if k != "community"}, 122 | } 123 | 124 | # Insert the processed data back into the 'modelfile' table 125 | Modelfile.create( 126 | user_id=model.user_id, 127 | tag_name=model.id, 128 | modelfile=modelfile_data, 129 | timestamp=model.created_at, 130 | ) ``````` `\\?\D:\Coding\ai\backend\apps\webui\internal\migrations\011_add_user_settings.py`: ```````py 1 | """Peewee migrations -- 002_add_local_sharing.py. 2 | 3 | Some examples (model - class or model name):: 4 | 5 | > Model = migrator.orm['table_name'] # Return model in current state by name 6 | > Model = migrator.ModelClass # Return model in current state by name 7 | 8 | > migrator.sql(sql) # Run custom SQL 9 | > migrator.run(func, *args, **kwargs) # Run python function with the given args 10 | > migrator.create_model(Model) # Create a model (could be used as decorator) 11 | > migrator.remove_model(model, cascade=True) # Remove a model 12 | > migrator.add_fields(model, **fields) # Add fields to a model 13 | > migrator.change_fields(model, **fields) # Change fields 14 | > migrator.remove_fields(model, *field_names, cascade=True) 15 | > migrator.rename_field(model, old_field_name, new_field_name) 16 | > migrator.rename_table(model, new_table_name) 17 | > migrator.add_index(model, *col_names, unique=False) 18 | > migrator.add_not_null(model, *field_names) 19 | > migrator.add_default(model, field_name, default) 20 | > migrator.add_constraint(model, name, sql) 21 | > migrator.drop_index(model, *col_names) 22 | > migrator.drop_not_null(model, *field_names) 23 | > migrator.drop_constraints(model, *constraints) 24 | 25 | """ 26 | 27 | from contextlib import suppress 28 | 29 | import peewee as pw 30 | from peewee_migrate import Migrator 31 | 32 | 33 | with suppress(ImportError): 34 | import playhouse.postgres_ext as pw_pext 35 | 36 | 37 | def migrate(migrator: Migrator, database: pw.Database, *, fake=False): 38 | """Write your migrations here.""" 39 | 40 | # Adding fields settings to the 'user' table 41 | migrator.add_fields("user", settings=pw.TextField(null=True)) 42 | 43 | 44 | def rollback(migrator: Migrator, database: pw.Database, *, fake=False): 45 | """Write your rollback migrations here.""" 46 | 47 | # Remove the settings field 48 | migrator.remove_fields("user", "settings") ``````` `\\?\D:\Coding\ai\backend\apps\webui\internal\migrations\012_add_tools.py`: ```````py 1 | """Peewee migrations -- 009_add_models.py. 2 | 3 | Some examples (model - class or model name):: 4 | 5 | > Model = migrator.orm['table_name'] # Return model in current state by name 6 | > Model = migrator.ModelClass # Return model in current state by name 7 | 8 | > migrator.sql(sql) # Run custom SQL 9 | > migrator.run(func, *args, **kwargs) # Run python function with the given args 10 | > migrator.create_model(Model) # Create a model (could be used as decorator) 11 | > migrator.remove_model(model, cascade=True) # Remove a model 12 | > migrator.add_fields(model, **fields) # Add fields to a model 13 | > migrator.change_fields(model, **fields) # Change fields 14 | > migrator.remove_fields(model, *field_names, cascade=True) 15 | > migrator.rename_field(model, old_field_name, new_field_name) 16 | > migrator.rename_table(model, new_table_name) 17 | > migrator.add_index(model, *col_names, unique=False) 18 | > migrator.add_not_null(model, *field_names) 19 | > migrator.add_default(model, field_name, default) 20 | > migrator.add_constraint(model, name, sql) 21 | > migrator.drop_index(model, *col_names) 22 | > migrator.drop_not_null(model, *field_names) 23 | > migrator.drop_constraints(model, *constraints) 24 | 25 | """ 26 | 27 | from contextlib import suppress 28 | 29 | import peewee as pw 30 | from peewee_migrate import Migrator 31 | 32 | 33 | with suppress(ImportError): 34 | import playhouse.postgres_ext as pw_pext 35 | 36 | 37 | def migrate(migrator: Migrator, database: pw.Database, *, fake=False): 38 | """Write your migrations here.""" 39 | 40 | @migrator.create_model 41 | class Tool(pw.Model): 42 | id = pw.TextField(unique=True) 43 | user_id = pw.TextField() 44 | 45 | name = pw.TextField() 46 | content = pw.TextField() 47 | specs = pw.TextField() 48 | 49 | meta = pw.TextField() 50 | 51 | created_at = pw.BigIntegerField(null=False) 52 | updated_at = pw.BigIntegerField(null=False) 53 | 54 | class Meta: 55 | table_name = "tool" 56 | 57 | 58 | def rollback(migrator: Migrator, database: pw.Database, *, fake=False): 59 | """Write your rollback migrations here.""" 60 | 61 | migrator.remove_model("tool") ``````` `\\?\D:\Coding\ai\backend\apps\webui\internal\migrations\013_add_user_info.py`: ```````py 1 | """Peewee migrations -- 002_add_local_sharing.py. 2 | 3 | Some examples (model - class or model name):: 4 | 5 | > Model = migrator.orm['table_name'] # Return model in current state by name 6 | > Model = migrator.ModelClass # Return model in current state by name 7 | 8 | > migrator.sql(sql) # Run custom SQL 9 | > migrator.run(func, *args, **kwargs) # Run python function with the given args 10 | > migrator.create_model(Model) # Create a model (could be used as decorator) 11 | > migrator.remove_model(model, cascade=True) # Remove a model 12 | > migrator.add_fields(model, **fields) # Add fields to a model 13 | > migrator.change_fields(model, **fields) # Change fields 14 | > migrator.remove_fields(model, *field_names, cascade=True) 15 | > migrator.rename_field(model, old_field_name, new_field_name) 16 | > migrator.rename_table(model, new_table_name) 17 | > migrator.add_index(model, *col_names, unique=False) 18 | > migrator.add_not_null(model, *field_names) 19 | > migrator.add_default(model, field_name, default) 20 | > migrator.add_constraint(model, name, sql) 21 | > migrator.drop_index(model, *col_names) 22 | > migrator.drop_not_null(model, *field_names) 23 | > migrator.drop_constraints(model, *constraints) 24 | 25 | """ 26 | 27 | from contextlib import suppress 28 | 29 | import peewee as pw 30 | from peewee_migrate import Migrator 31 | 32 | 33 | with suppress(ImportError): 34 | import playhouse.postgres_ext as pw_pext 35 | 36 | 37 | def migrate(migrator: Migrator, database: pw.Database, *, fake=False): 38 | """Write your migrations here.""" 39 | 40 | # Adding fields info to the 'user' table 41 | migrator.add_fields("user", info=pw.TextField(null=True)) 42 | 43 | 44 | def rollback(migrator: Migrator, database: pw.Database, *, fake=False): 45 | """Write your rollback migrations here.""" 46 | 47 | # Remove the settings field 48 | migrator.remove_fields("user", "info") ``````` `\\?\D:\Coding\ai\backend\apps\webui\internal\migrations\014_add_files.py`: ```````py 1 | """Peewee migrations -- 009_add_models.py. 2 | 3 | Some examples (model - class or model name):: 4 | 5 | > Model = migrator.orm['table_name'] # Return model in current state by name 6 | > Model = migrator.ModelClass # Return model in current state by name 7 | 8 | > migrator.sql(sql) # Run custom SQL 9 | > migrator.run(func, *args, **kwargs) # Run python function with the given args 10 | > migrator.create_model(Model) # Create a model (could be used as decorator) 11 | > migrator.remove_model(model, cascade=True) # Remove a model 12 | > migrator.add_fields(model, **fields) # Add fields to a model 13 | > migrator.change_fields(model, **fields) # Change fields 14 | > migrator.remove_fields(model, *field_names, cascade=True) 15 | > migrator.rename_field(model, old_field_name, new_field_name) 16 | > migrator.rename_table(model, new_table_name) 17 | > migrator.add_index(model, *col_names, unique=False) 18 | > migrator.add_not_null(model, *field_names) 19 | > migrator.add_default(model, field_name, default) 20 | > migrator.add_constraint(model, name, sql) 21 | > migrator.drop_index(model, *col_names) 22 | > migrator.drop_not_null(model, *field_names) 23 | > migrator.drop_constraints(model, *constraints) 24 | 25 | """ 26 | 27 | from contextlib import suppress 28 | 29 | import peewee as pw 30 | from peewee_migrate import Migrator 31 | 32 | 33 | with suppress(ImportError): 34 | import playhouse.postgres_ext as pw_pext 35 | 36 | 37 | def migrate(migrator: Migrator, database: pw.Database, *, fake=False): 38 | """Write your migrations here.""" 39 | 40 | @migrator.create_model 41 | class File(pw.Model): 42 | id = pw.TextField(unique=True) 43 | user_id = pw.TextField() 44 | filename = pw.TextField() 45 | meta = pw.TextField() 46 | created_at = pw.BigIntegerField(null=False) 47 | 48 | class Meta: 49 | table_name = "file" 50 | 51 | 52 | def rollback(migrator: Migrator, database: pw.Database, *, fake=False): 53 | """Write your rollback migrations here.""" 54 | 55 | migrator.remove_model("file") ``````` `\\?\D:\Coding\ai\backend\apps\webui\internal\migrations\015_add_functions.py`: ```````py 1 | """Peewee migrations -- 009_add_models.py. 2 | 3 | Some examples (model - class or model name):: 4 | 5 | > Model = migrator.orm['table_name'] # Return model in current state by name 6 | > Model = migrator.ModelClass # Return model in current state by name 7 | 8 | > migrator.sql(sql) # Run custom SQL 9 | > migrator.run(func, *args, **kwargs) # Run python function with the given args 10 | > migrator.create_model(Model) # Create a model (could be used as decorator) 11 | > migrator.remove_model(model, cascade=True) # Remove a model 12 | > migrator.add_fields(model, **fields) # Add fields to a model 13 | > migrator.change_fields(model, **fields) # Change fields 14 | > migrator.remove_fields(model, *field_names, cascade=True) 15 | > migrator.rename_field(model, old_field_name, new_field_name) 16 | > migrator.rename_table(model, new_table_name) 17 | > migrator.add_index(model, *col_names, unique=False) 18 | > migrator.add_not_null(model, *field_names) 19 | > migrator.add_default(model, field_name, default) 20 | > migrator.add_constraint(model, name, sql) 21 | > migrator.drop_index(model, *col_names) 22 | > migrator.drop_not_null(model, *field_names) 23 | > migrator.drop_constraints(model, *constraints) 24 | 25 | """ 26 | 27 | from contextlib import suppress 28 | 29 | import peewee as pw 30 | from peewee_migrate import Migrator 31 | 32 | 33 | with suppress(ImportError): 34 | import playhouse.postgres_ext as pw_pext 35 | 36 | 37 | def migrate(migrator: Migrator, database: pw.Database, *, fake=False): 38 | """Write your migrations here.""" 39 | 40 | @migrator.create_model 41 | class Function(pw.Model): 42 | id = pw.TextField(unique=True) 43 | user_id = pw.TextField() 44 | 45 | name = pw.TextField() 46 | type = pw.TextField() 47 | 48 | content = pw.TextField() 49 | meta = pw.TextField() 50 | 51 | created_at = pw.BigIntegerField(null=False) 52 | updated_at = pw.BigIntegerField(null=False) 53 | 54 | class Meta: 55 | table_name = "function" 56 | 57 | 58 | def rollback(migrator: Migrator, database: pw.Database, *, fake=False): 59 | """Write your rollback migrations here.""" 60 | 61 | migrator.remove_model("function") ``````` `\\?\D:\Coding\ai\backend\apps\webui\internal\migrations\016_add_valves_and_is_active.py`: ```````py 1 | """Peewee migrations -- 009_add_models.py. 2 | 3 | Some examples (model - class or model name):: 4 | 5 | > Model = migrator.orm['table_name'] # Return model in current state by name 6 | > Model = migrator.ModelClass # Return model in current state by name 7 | 8 | > migrator.sql(sql) # Run custom SQL 9 | > migrator.run(func, *args, **kwargs) # Run python function with the given args 10 | > migrator.create_model(Model) # Create a model (could be used as decorator) 11 | > migrator.remove_model(model, cascade=True) # Remove a model 12 | > migrator.add_fields(model, **fields) # Add fields to a model 13 | > migrator.change_fields(model, **fields) # Change fields 14 | > migrator.remove_fields(model, *field_names, cascade=True) 15 | > migrator.rename_field(model, old_field_name, new_field_name) 16 | > migrator.rename_table(model, new_table_name) 17 | > migrator.add_index(model, *col_names, unique=False) 18 | > migrator.add_not_null(model, *field_names) 19 | > migrator.add_default(model, field_name, default) 20 | > migrator.add_constraint(model, name, sql) 21 | > migrator.drop_index(model, *col_names) 22 | > migrator.drop_not_null(model, *field_names) 23 | > migrator.drop_constraints(model, *constraints) 24 | 25 | """ 26 | 27 | from contextlib import suppress 28 | 29 | import peewee as pw 30 | from peewee_migrate import Migrator 31 | 32 | 33 | with suppress(ImportError): 34 | import playhouse.postgres_ext as pw_pext 35 | 36 | 37 | def migrate(migrator: Migrator, database: pw.Database, *, fake=False): 38 | """Write your migrations here.""" 39 | 40 | migrator.add_fields("tool", valves=pw.TextField(null=True)) 41 | migrator.add_fields("function", valves=pw.TextField(null=True)) 42 | migrator.add_fields("function", is_active=pw.BooleanField(default=False)) 43 | 44 | 45 | def rollback(migrator: Migrator, database: pw.Database, *, fake=False): 46 | """Write your rollback migrations here.""" 47 | 48 | migrator.remove_fields("tool", "valves") 49 | migrator.remove_fields("function", "valves") 50 | migrator.remove_fields("function", "is_active") ``````` `\\?\D:\Coding\ai\backend\apps\webui\internal\migrations\017_add_user_oauth_sub.py`: ```````py 1 | """Peewee migrations -- 017_add_user_oauth_sub.py. 2 | Some examples (model - class or model name):: 3 | > Model = migrator.orm['table_name'] # Return model in current state by name 4 | > Model = migrator.ModelClass # Return model in current state by name 5 | > migrator.sql(sql) # Run custom SQL 6 | > migrator.run(func, *args, **kwargs) # Run python function with the given args 7 | > migrator.create_model(Model) # Create a model (could be used as decorator) 8 | > migrator.remove_model(model, cascade=True) # Remove a model 9 | > migrator.add_fields(model, **fields) # Add fields to a model 10 | > migrator.change_fields(model, **fields) # Change fields 11 | > migrator.remove_fields(model, *field_names, cascade=True) 12 | > migrator.rename_field(model, old_field_name, new_field_name) 13 | > migrator.rename_table(model, new_table_name) 14 | > migrator.add_index(model, *col_names, unique=False) 15 | > migrator.add_not_null(model, *field_names) 16 | > migrator.add_default(model, field_name, default) 17 | > migrator.add_constraint(model, name, sql) 18 | > migrator.drop_index(model, *col_names) 19 | > migrator.drop_not_null(model, *field_names) 20 | > migrator.drop_constraints(model, *constraints) 21 | """ 22 | 23 | from contextlib import suppress 24 | 25 | import peewee as pw 26 | from peewee_migrate import Migrator 27 | 28 | 29 | with suppress(ImportError): 30 | import playhouse.postgres_ext as pw_pext 31 | 32 | 33 | def migrate(migrator: Migrator, database: pw.Database, *, fake=False): 34 | """Write your migrations here.""" 35 | 36 | migrator.add_fields( 37 | "user", 38 | oauth_sub=pw.TextField(null=True, unique=True), 39 | ) 40 | 41 | 42 | def rollback(migrator: Migrator, database: pw.Database, *, fake=False): 43 | """Write your rollback migrations here.""" 44 | 45 | migrator.remove_fields("user", "oauth_sub") ``````` `\\?\D:\Coding\ai\backend\apps\webui\internal\migrations\018_add_function_is_global.py`: ```````py 1 | """Peewee migrations -- 017_add_user_oauth_sub.py. 2 | 3 | Some examples (model - class or model name):: 4 | 5 | > Model = migrator.orm['table_name'] # Return model in current state by name 6 | > Model = migrator.ModelClass # Return model in current state by name 7 | 8 | > migrator.sql(sql) # Run custom SQL 9 | > migrator.run(func, *args, **kwargs) # Run python function with the given args 10 | > migrator.create_model(Model) # Create a model (could be used as decorator) 11 | > migrator.remove_model(model, cascade=True) # Remove a model 12 | > migrator.add_fields(model, **fields) # Add fields to a model 13 | > migrator.change_fields(model, **fields) # Change fields 14 | > migrator.remove_fields(model, *field_names, cascade=True) 15 | > migrator.rename_field(model, old_field_name, new_field_name) 16 | > migrator.rename_table(model, new_table_name) 17 | > migrator.add_index(model, *col_names, unique=False) 18 | > migrator.add_not_null(model, *field_names) 19 | > migrator.add_default(model, field_name, default) 20 | > migrator.add_constraint(model, name, sql) 21 | > migrator.drop_index(model, *col_names) 22 | > migrator.drop_not_null(model, *field_names) 23 | > migrator.drop_constraints(model, *constraints) 24 | 25 | """ 26 | 27 | from contextlib import suppress 28 | 29 | import peewee as pw 30 | from peewee_migrate import Migrator 31 | 32 | 33 | with suppress(ImportError): 34 | import playhouse.postgres_ext as pw_pext 35 | 36 | 37 | def migrate(migrator: Migrator, database: pw.Database, *, fake=False): 38 | """Write your migrations here.""" 39 | 40 | migrator.add_fields( 41 | "function", 42 | is_global=pw.BooleanField(default=False), 43 | ) 44 | 45 | 46 | def rollback(migrator: Migrator, database: pw.Database, *, fake=False): 47 | """Write your rollback migrations here.""" 48 | 49 | migrator.remove_fields("function", "is_global") ``````` `\\?\D:\Coding\ai\backend\apps\webui\internal\wrappers.py`: ```````py 1 | from contextvars import ContextVar 2 | from peewee import * 3 | from peewee import PostgresqlDatabase, InterfaceError as PeeWeeInterfaceError 4 | 5 | import logging 6 | from playhouse.db_url import connect, parse 7 | from playhouse.shortcuts import ReconnectMixin 8 | 9 | from config import SRC_LOG_LEVELS 10 | 11 | log = logging.getLogger(__name__) 12 | log.setLevel(SRC_LOG_LEVELS["DB"]) 13 | 14 | db_state_default = {"closed": None, "conn": None, "ctx": None, "transactions": None} 15 | db_state = ContextVar("db_state", default=db_state_default.copy()) 16 | 17 | 18 | class PeeweeConnectionState(object): 19 | def __init__(self, **kwargs): 20 | super().__setattr__("_state", db_state) 21 | super().__init__(**kwargs) 22 | 23 | def __setattr__(self, name, value): 24 | self._state.get()[name] = value 25 | 26 | def __getattr__(self, name): 27 | value = self._state.get()[name] 28 | return value 29 | 30 | 31 | class CustomReconnectMixin(ReconnectMixin): 32 | reconnect_errors = ( 33 | # psycopg2 34 | (OperationalError, "termin"), 35 | (InterfaceError, "closed"), 36 | # peewee 37 | (PeeWeeInterfaceError, "closed"), 38 | ) 39 | 40 | 41 | class ReconnectingPostgresqlDatabase(CustomReconnectMixin, PostgresqlDatabase): 42 | pass 43 | 44 | 45 | def register_connection(db_url): 46 | db = connect(db_url) 47 | if isinstance(db, PostgresqlDatabase): 48 | # Enable autoconnect for SQLite databases, managed by Peewee 49 | db.autoconnect = True 50 | db.reuse_if_open = True 51 | log.info("Connected to PostgreSQL database") 52 | 53 | # Get the connection details 54 | connection = parse(db_url) 55 | 56 | # Use our custom database class that supports reconnection 57 | db = ReconnectingPostgresqlDatabase( 58 | connection["database"], 59 | user=connection["user"], 60 | password=connection["password"], 61 | host=connection["host"], 62 | port=connection["port"], 63 | ) 64 | db.connect(reuse_if_open=True) 65 | elif isinstance(db, SqliteDatabase): 66 | # Enable autoconnect for SQLite databases, managed by Peewee 67 | db.autoconnect = True 68 | db.reuse_if_open = True 69 | log.info("Connected to SQLite database") 70 | else: 71 | raise ValueError("Unsupported database connection") 72 | return db ``````` `\\?\D:\Coding\ai\backend\apps\webui\main.py`: ```````py 1 | from fastapi import FastAPI, Depends 2 | from fastapi.routing import APIRoute 3 | from fastapi.responses import StreamingResponse 4 | from fastapi.middleware.cors import CORSMiddleware 5 | from starlette.middleware.sessions import SessionMiddleware 6 | from sqlalchemy.orm import Session 7 | from apps.webui.routers import ( 8 | auths, 9 | users, 10 | chats, 11 | documents, 12 | tools, 13 | models, 14 | prompts, 15 | configs, 16 | memories, 17 | utils, 18 | files, 19 | functions, 20 | ) 21 | from apps.webui.models.functions import Functions 22 | from apps.webui.models.models import Models 23 | from apps.webui.utils import load_function_module_by_id 24 | 25 | from utils.misc import stream_message_template 26 | from utils.task import prompt_template 27 | 28 | 29 | from config import ( 30 | WEBUI_BUILD_HASH, 31 | SHOW_ADMIN_DETAILS, 32 | ADMIN_EMAIL, 33 | WEBUI_AUTH, 34 | DEFAULT_MODELS, 35 | DEFAULT_PROMPT_SUGGESTIONS, 36 | DEFAULT_USER_ROLE, 37 | ENABLE_SIGNUP, 38 | USER_PERMISSIONS, 39 | WEBHOOK_URL, 40 | WEBUI_AUTH_TRUSTED_EMAIL_HEADER, 41 | WEBUI_AUTH_TRUSTED_NAME_HEADER, 42 | JWT_EXPIRES_IN, 43 | WEBUI_BANNERS, 44 | ENABLE_COMMUNITY_SHARING, 45 | AppConfig, 46 | OAUTH_USERNAME_CLAIM, 47 | OAUTH_PICTURE_CLAIM, 48 | ) 49 | 50 | from apps.socket.main import get_event_call, get_event_emitter 51 | 52 | import inspect 53 | import uuid 54 | import time 55 | import json 56 | 57 | from typing import Iterator, Generator, Optional 58 | from pydantic import BaseModel 59 | 60 | app = FastAPI() 61 | 62 | origins = ["*"] 63 | 64 | app.state.config = AppConfig() 65 | 66 | app.state.config.ENABLE_SIGNUP = ENABLE_SIGNUP 67 | app.state.config.JWT_EXPIRES_IN = JWT_EXPIRES_IN 68 | app.state.AUTH_TRUSTED_EMAIL_HEADER = WEBUI_AUTH_TRUSTED_EMAIL_HEADER 69 | app.state.AUTH_TRUSTED_NAME_HEADER = WEBUI_AUTH_TRUSTED_NAME_HEADER 70 | 71 | 72 | app.state.config.SHOW_ADMIN_DETAILS = SHOW_ADMIN_DETAILS 73 | app.state.config.ADMIN_EMAIL = ADMIN_EMAIL 74 | 75 | 76 | app.state.config.DEFAULT_MODELS = DEFAULT_MODELS 77 | app.state.config.DEFAULT_PROMPT_SUGGESTIONS = DEFAULT_PROMPT_SUGGESTIONS 78 | app.state.config.DEFAULT_USER_ROLE = DEFAULT_USER_ROLE 79 | app.state.config.USER_PERMISSIONS = USER_PERMISSIONS 80 | app.state.config.WEBHOOK_URL = WEBHOOK_URL 81 | app.state.config.BANNERS = WEBUI_BANNERS 82 | 83 | app.state.config.ENABLE_COMMUNITY_SHARING = ENABLE_COMMUNITY_SHARING 84 | 85 | app.state.config.OAUTH_USERNAME_CLAIM = OAUTH_USERNAME_CLAIM 86 | app.state.config.OAUTH_PICTURE_CLAIM = OAUTH_PICTURE_CLAIM 87 | 88 | app.state.MODELS = {} 89 | app.state.TOOLS = {} 90 | app.state.FUNCTIONS = {} 91 | 92 | app.add_middleware( 93 | CORSMiddleware, 94 | allow_origins=origins, 95 | allow_credentials=True, 96 | allow_methods=["*"], 97 | allow_headers=["*"], 98 | ) 99 | 100 | 101 | app.include_router(configs.router, prefix="/configs", tags=["configs"]) 102 | app.include_router(auths.router, prefix="/auths", tags=["auths"]) 103 | app.include_router(users.router, prefix="/users", tags=["users"]) 104 | app.include_router(chats.router, prefix="/chats", tags=["chats"]) 105 | 106 | app.include_router(documents.router, prefix="/documents", tags=["documents"]) 107 | app.include_router(models.router, prefix="/models", tags=["models"]) 108 | app.include_router(prompts.router, prefix="/prompts", tags=["prompts"]) 109 | 110 | app.include_router(memories.router, prefix="/memories", tags=["memories"]) 111 | app.include_router(files.router, prefix="/files", tags=["files"]) 112 | app.include_router(tools.router, prefix="/tools", tags=["tools"]) 113 | app.include_router(functions.router, prefix="/functions", tags=["functions"]) 114 | 115 | app.include_router(utils.router, prefix="/utils", tags=["utils"]) 116 | 117 | 118 | @app.get("/") 119 | async def get_status(): 120 | return { 121 | "status": True, 122 | "auth": WEBUI_AUTH, 123 | "default_models": app.state.config.DEFAULT_MODELS, 124 | "default_prompt_suggestions": app.state.config.DEFAULT_PROMPT_SUGGESTIONS, 125 | } 126 | 127 | 128 | async def get_pipe_models(): 129 | pipes = Functions.get_functions_by_type("pipe", active_only=True) 130 | pipe_models = [] 131 | 132 | for pipe in pipes: 133 | # Check if function is already loaded 134 | if pipe.id not in app.state.FUNCTIONS: 135 | function_module, function_type, frontmatter = load_function_module_by_id( 136 | pipe.id 137 | ) 138 | app.state.FUNCTIONS[pipe.id] = function_module 139 | else: 140 | function_module = app.state.FUNCTIONS[pipe.id] 141 | 142 | if hasattr(function_module, "valves") and hasattr(function_module, "Valves"): 143 | valves = Functions.get_function_valves_by_id(pipe.id) 144 | function_module.valves = function_module.Valves( 145 | **(valves if valves else {}) 146 | ) 147 | 148 | # Check if function is a manifold 149 | if hasattr(function_module, "type"): 150 | if function_module.type == "manifold": 151 | manifold_pipes = [] 152 | 153 | # Check if pipes is a function or a list 154 | if callable(function_module.pipes): 155 | manifold_pipes = function_module.pipes() 156 | else: 157 | manifold_pipes = function_module.pipes 158 | 159 | for p in manifold_pipes: 160 | manifold_pipe_id = f'{pipe.id}.{p["id"]}' 161 | manifold_pipe_name = p["name"] 162 | 163 | if hasattr(function_module, "name"): 164 | manifold_pipe_name = ( 165 | f"{function_module.name}{manifold_pipe_name}" 166 | ) 167 | 168 | pipe_flag = {"type": pipe.type} 169 | if hasattr(function_module, "ChatValves"): 170 | pipe_flag["valves_spec"] = function_module.ChatValves.schema() 171 | 172 | pipe_models.append( 173 | { 174 | "id": manifold_pipe_id, 175 | "name": manifold_pipe_name, 176 | "object": "model", 177 | "created": pipe.created_at, 178 | "owned_by": "openai", 179 | "pipe": pipe_flag, 180 | } 181 | ) 182 | else: 183 | pipe_flag = {"type": "pipe"} 184 | if hasattr(function_module, "ChatValves"): 185 | pipe_flag["valves_spec"] = function_module.ChatValves.schema() 186 | 187 | pipe_models.append( 188 | { 189 | "id": pipe.id, 190 | "name": pipe.name, 191 | "object": "model", 192 | "created": pipe.created_at, 193 | "owned_by": "openai", 194 | "pipe": pipe_flag, 195 | } 196 | ) 197 | 198 | return pipe_models 199 | 200 | 201 | async def generate_function_chat_completion(form_data, user): 202 | model_id = form_data.get("model") 203 | model_info = Models.get_model_by_id(model_id) 204 | 205 | metadata = None 206 | if "metadata" in form_data: 207 | metadata = form_data["metadata"] 208 | del form_data["metadata"] 209 | 210 | __event_emitter__ = None 211 | __event_call__ = None 212 | __task__ = None 213 | 214 | if metadata: 215 | if ( 216 | metadata.get("session_id") 217 | and metadata.get("chat_id") 218 | and metadata.get("message_id") 219 | ): 220 | __event_emitter__ = await get_event_emitter(metadata) 221 | __event_call__ = await get_event_call(metadata) 222 | 223 | if metadata.get("task"): 224 | __task__ = metadata.get("task") 225 | 226 | if model_info: 227 | if model_info.base_model_id: 228 | form_data["model"] = model_info.base_model_id 229 | 230 | model_info.params = model_info.params.model_dump() 231 | 232 | if model_info.params: 233 | if model_info.params.get("temperature", None) is not None: 234 | form_data["temperature"] = float(model_info.params.get("temperature")) 235 | 236 | if model_info.params.get("top_p", None): 237 | form_data["top_p"] = int(model_info.params.get("top_p", None)) 238 | 239 | if model_info.params.get("max_tokens", None): 240 | form_data["max_tokens"] = int(model_info.params.get("max_tokens", None)) 241 | 242 | if model_info.params.get("frequency_penalty", None): 243 | form_data["frequency_penalty"] = int( 244 | model_info.params.get("frequency_penalty", None) 245 | ) 246 | 247 | if model_info.params.get("seed", None): 248 | form_data["seed"] = model_info.params.get("seed", None) 249 | 250 | if model_info.params.get("stop", None): 251 | form_data["stop"] = ( 252 | [ 253 | bytes(stop, "utf-8").decode("unicode_escape") 254 | for stop in model_info.params["stop"] 255 | ] 256 | if model_info.params.get("stop", None) 257 | else None 258 | ) 259 | 260 | system = model_info.params.get("system", None) 261 | if system: 262 | system = prompt_template( 263 | system, 264 | **( 265 | { 266 | "user_name": user.name, 267 | "user_location": ( 268 | user.info.get("location") if user.info else None 269 | ), 270 | } 271 | if user 272 | else {} 273 | ), 274 | ) 275 | # Check if the payload already has a system message 276 | # If not, add a system message to the payload 277 | if form_data.get("messages"): 278 | for message in form_data["messages"]: 279 | if message.get("role") == "system": 280 | message["content"] = system + message["content"] 281 | break 282 | else: 283 | form_data["messages"].insert( 284 | 0, 285 | { 286 | "role": "system", 287 | "content": system, 288 | }, 289 | ) 290 | 291 | else: 292 | pass 293 | 294 | async def job(): 295 | pipe_id = form_data["model"] 296 | if "." in pipe_id: 297 | pipe_id, sub_pipe_id = pipe_id.split(".", 1) 298 | print(pipe_id) 299 | 300 | # Check if function is already loaded 301 | if pipe_id not in app.state.FUNCTIONS: 302 | function_module, function_type, frontmatter = load_function_module_by_id( 303 | pipe_id 304 | ) 305 | app.state.FUNCTIONS[pipe_id] = function_module 306 | else: 307 | function_module = app.state.FUNCTIONS[pipe_id] 308 | 309 | if hasattr(function_module, "valves") and hasattr(function_module, "Valves"): 310 | 311 | valves = Functions.get_function_valves_by_id(pipe_id) 312 | function_module.valves = function_module.Valves( 313 | **(valves if valves else {}) 314 | ) 315 | 316 | pipe = function_module.pipe 317 | 318 | # Get the signature of the function 319 | sig = inspect.signature(pipe) 320 | params = {"body": form_data} 321 | 322 | if "__user__" in sig.parameters: 323 | __user__ = { 324 | "id": user.id, 325 | "email": user.email, 326 | "name": user.name, 327 | "role": user.role, 328 | } 329 | 330 | try: 331 | if hasattr(function_module, "UserValves"): 332 | __user__["valves"] = function_module.UserValves( 333 | **Functions.get_user_valves_by_id_and_user_id(pipe_id, user.id) 334 | ) 335 | except Exception as e: 336 | print(e) 337 | 338 | params = {**params, "__user__": __user__} 339 | 340 | if "__event_emitter__" in sig.parameters: 341 | params = {**params, "__event_emitter__": __event_emitter__} 342 | 343 | if "__event_call__" in sig.parameters: 344 | params = {**params, "__event_call__": __event_call__} 345 | 346 | if "__task__" in sig.parameters: 347 | params = {**params, "__task__": __task__} 348 | 349 | if form_data["stream"]: 350 | 351 | async def stream_content(): 352 | try: 353 | if inspect.iscoroutinefunction(pipe): 354 | res = await pipe(**params) 355 | else: 356 | res = pipe(**params) 357 | 358 | # Directly return if the response is a StreamingResponse 359 | if isinstance(res, StreamingResponse): 360 | async for data in res.body_iterator: 361 | yield data 362 | return 363 | if isinstance(res, dict): 364 | yield f"data: {json.dumps(res)}\n\n" 365 | return 366 | 367 | except Exception as e: 368 | print(f"Error: {e}") 369 | yield f"data: {json.dumps({'error': {'detail':str(e)}})}\n\n" 370 | return 371 | 372 | if isinstance(res, str): 373 | message = stream_message_template(form_data["model"], res) 374 | yield f"data: {json.dumps(message)}\n\n" 375 | 376 | if isinstance(res, Iterator): 377 | for line in res: 378 | if isinstance(line, BaseModel): 379 | line = line.model_dump_json() 380 | line = f"data: {line}" 381 | if isinstance(line, dict): 382 | line = f"data: {json.dumps(line)}" 383 | 384 | try: 385 | line = line.decode("utf-8") 386 | except: 387 | pass 388 | 389 | if line.startswith("data:"): 390 | yield f"{line}\n\n" 391 | else: 392 | line = stream_message_template(form_data["model"], line) 393 | yield f"data: {json.dumps(line)}\n\n" 394 | 395 | if isinstance(res, str) or isinstance(res, Generator): 396 | finish_message = { 397 | "id": f"{form_data['model']}-{str(uuid.uuid4())}", 398 | "object": "chat.completion.chunk", 399 | "created": int(time.time()), 400 | "model": form_data["model"], 401 | "choices": [ 402 | { 403 | "index": 0, 404 | "delta": {}, 405 | "logprobs": None, 406 | "finish_reason": "stop", 407 | } 408 | ], 409 | } 410 | 411 | yield f"data: {json.dumps(finish_message)}\n\n" 412 | yield f"data: [DONE]" 413 | 414 | return StreamingResponse(stream_content(), media_type="text/event-stream") 415 | else: 416 | 417 | try: 418 | if inspect.iscoroutinefunction(pipe): 419 | res = await pipe(**params) 420 | else: 421 | res = pipe(**params) 422 | 423 | if isinstance(res, StreamingResponse): 424 | return res 425 | except Exception as e: 426 | print(f"Error: {e}") 427 | return {"error": {"detail": str(e)}} 428 | 429 | if isinstance(res, dict): 430 | return res 431 | elif isinstance(res, BaseModel): 432 | return res.model_dump() 433 | else: 434 | message = "" 435 | if isinstance(res, str): 436 | message = res 437 | if isinstance(res, Generator): 438 | for stream in res: 439 | message = f"{message}{stream}" 440 | 441 | return { 442 | "id": f"{form_data['model']}-{str(uuid.uuid4())}", 443 | "object": "chat.completion", 444 | "created": int(time.time()), 445 | "model": form_data["model"], 446 | "choices": [ 447 | { 448 | "index": 0, 449 | "message": { 450 | "role": "assistant", 451 | "content": message, 452 | }, 453 | "logprobs": None, 454 | "finish_reason": "stop", 455 | } 456 | ], 457 | } 458 | 459 | return await job() ``````` `\\?\D:\Coding\ai\backend\apps\webui\models\auths.py`: ```````py 1 | from pydantic import BaseModel 2 | from typing import Optional 3 | import uuid 4 | import logging 5 | from sqlalchemy import String, Column, Boolean, Text 6 | 7 | from apps.webui.models.users import UserModel, Users 8 | from utils.utils import verify_password 9 | 10 | from apps.webui.internal.db import Base, get_db 11 | 12 | from config import SRC_LOG_LEVELS 13 | 14 | log = logging.getLogger(__name__) 15 | log.setLevel(SRC_LOG_LEVELS["MODELS"]) 16 | 17 | #################### 18 | # DB MODEL 19 | #################### 20 | 21 | 22 | class Auth(Base): 23 | __tablename__ = "auth" 24 | 25 | id = Column(String, primary_key=True) 26 | email = Column(String) 27 | password = Column(Text) 28 | active = Column(Boolean) 29 | 30 | 31 | class AuthModel(BaseModel): 32 | id: str 33 | email: str 34 | password: str 35 | active: bool = True 36 | 37 | 38 | #################### 39 | # Forms 40 | #################### 41 | 42 | 43 | class Token(BaseModel): 44 | token: str 45 | token_type: str 46 | 47 | 48 | class ApiKey(BaseModel): 49 | api_key: Optional[str] = None 50 | 51 | 52 | class UserResponse(BaseModel): 53 | id: str 54 | email: str 55 | name: str 56 | role: str 57 | profile_image_url: str 58 | 59 | 60 | class SigninResponse(Token, UserResponse): 61 | pass 62 | 63 | 64 | class SigninForm(BaseModel): 65 | email: str 66 | password: str 67 | 68 | 69 | class ProfileImageUrlForm(BaseModel): 70 | profile_image_url: str 71 | 72 | 73 | class UpdateProfileForm(BaseModel): 74 | profile_image_url: str 75 | name: str 76 | 77 | 78 | class UpdatePasswordForm(BaseModel): 79 | password: str 80 | new_password: str 81 | 82 | 83 | class SignupForm(BaseModel): 84 | name: str 85 | email: str 86 | password: str 87 | profile_image_url: Optional[str] = "/user.png" 88 | 89 | 90 | class AddUserForm(SignupForm): 91 | role: Optional[str] = "pending" 92 | 93 | 94 | class AuthsTable: 95 | 96 | def insert_new_auth( 97 | self, 98 | email: str, 99 | password: str, 100 | name: str, 101 | profile_image_url: str = "/user.png", 102 | role: str = "pending", 103 | oauth_sub: Optional[str] = None, 104 | ) -> Optional[UserModel]: 105 | with get_db() as db: 106 | 107 | log.info("insert_new_auth") 108 | 109 | id = str(uuid.uuid4()) 110 | 111 | auth = AuthModel( 112 | **{"id": id, "email": email, "password": password, "active": True} 113 | ) 114 | result = Auth(**auth.model_dump()) 115 | db.add(result) 116 | 117 | user = Users.insert_new_user( 118 | id, name, email, profile_image_url, role, oauth_sub 119 | ) 120 | 121 | db.commit() 122 | db.refresh(result) 123 | 124 | if result and user: 125 | return user 126 | else: 127 | return None 128 | 129 | def authenticate_user(self, email: str, password: str) -> Optional[UserModel]: 130 | log.info(f"authenticate_user: {email}") 131 | try: 132 | with get_db() as db: 133 | 134 | auth = db.query(Auth).filter_by(email=email, active=True).first() 135 | if auth: 136 | if verify_password(password, auth.password): 137 | user = Users.get_user_by_id(auth.id) 138 | return user 139 | else: 140 | return None 141 | else: 142 | return None 143 | except: 144 | return None 145 | 146 | def authenticate_user_by_api_key(self, api_key: str) -> Optional[UserModel]: 147 | log.info(f"authenticate_user_by_api_key: {api_key}") 148 | # if no api_key, return None 149 | if not api_key: 150 | return None 151 | 152 | try: 153 | user = Users.get_user_by_api_key(api_key) 154 | return user if user else None 155 | except: 156 | return False 157 | 158 | def authenticate_user_by_trusted_header(self, email: str) -> Optional[UserModel]: 159 | log.info(f"authenticate_user_by_trusted_header: {email}") 160 | try: 161 | with get_db() as db: 162 | auth = db.query(Auth).filter_by(email=email, active=True).first() 163 | if auth: 164 | user = Users.get_user_by_id(auth.id) 165 | return user 166 | except: 167 | return None 168 | 169 | def update_user_password_by_id(self, id: str, new_password: str) -> bool: 170 | try: 171 | with get_db() as db: 172 | result = ( 173 | db.query(Auth).filter_by(id=id).update({"password": new_password}) 174 | ) 175 | db.commit() 176 | return True if result == 1 else False 177 | except: 178 | return False 179 | 180 | def update_email_by_id(self, id: str, email: str) -> bool: 181 | try: 182 | with get_db() as db: 183 | result = db.query(Auth).filter_by(id=id).update({"email": email}) 184 | db.commit() 185 | return True if result == 1 else False 186 | except: 187 | return False 188 | 189 | def delete_auth_by_id(self, id: str) -> bool: 190 | try: 191 | with get_db() as db: 192 | 193 | # Delete User 194 | result = Users.delete_user_by_id(id) 195 | 196 | if result: 197 | db.query(Auth).filter_by(id=id).delete() 198 | db.commit() 199 | 200 | return True 201 | else: 202 | return False 203 | except: 204 | return False 205 | 206 | 207 | Auths = AuthsTable() ``````` `\\?\D:\Coding\ai\backend\apps\webui\models\chats.py`: ```````py 1 | from pydantic import BaseModel, ConfigDict 2 | from typing import List, Union, Optional 3 | 4 | import json 5 | import uuid 6 | import time 7 | 8 | from sqlalchemy import Column, String, BigInteger, Boolean, Text 9 | 10 | from apps.webui.internal.db import Base, get_db 11 | 12 | 13 | #################### 14 | # Chat DB Schema 15 | #################### 16 | 17 | 18 | class Chat(Base): 19 | __tablename__ = "chat" 20 | 21 | id = Column(String, primary_key=True) 22 | user_id = Column(String) 23 | title = Column(Text) 24 | chat = Column(Text) # Save Chat JSON as Text 25 | 26 | created_at = Column(BigInteger) 27 | updated_at = Column(BigInteger) 28 | 29 | share_id = Column(Text, unique=True, nullable=True) 30 | archived = Column(Boolean, default=False) 31 | 32 | 33 | class ChatModel(BaseModel): 34 | model_config = ConfigDict(from_attributes=True) 35 | 36 | id: str 37 | user_id: str 38 | title: str 39 | chat: str 40 | 41 | created_at: int # timestamp in epoch 42 | updated_at: int # timestamp in epoch 43 | 44 | share_id: Optional[str] = None 45 | archived: bool = False 46 | 47 | 48 | #################### 49 | # Forms 50 | #################### 51 | 52 | 53 | class ChatForm(BaseModel): 54 | chat: dict 55 | 56 | 57 | class ChatTitleForm(BaseModel): 58 | title: str 59 | 60 | 61 | class ChatResponse(BaseModel): 62 | id: str 63 | user_id: str 64 | title: str 65 | chat: dict 66 | updated_at: int # timestamp in epoch 67 | created_at: int # timestamp in epoch 68 | share_id: Optional[str] = None # id of the chat to be shared 69 | archived: bool 70 | 71 | 72 | class ChatTitleIdResponse(BaseModel): 73 | id: str 74 | title: str 75 | updated_at: int 76 | created_at: int 77 | 78 | 79 | class ChatTable: 80 | 81 | def insert_new_chat(self, user_id: str, form_data: ChatForm) -> Optional[ChatModel]: 82 | with get_db() as db: 83 | 84 | id = str(uuid.uuid4()) 85 | chat = ChatModel( 86 | **{ 87 | "id": id, 88 | "user_id": user_id, 89 | "title": ( 90 | form_data.chat["title"] 91 | if "title" in form_data.chat 92 | else "New Chat" 93 | ), 94 | "chat": json.dumps(form_data.chat), 95 | "created_at": int(time.time()), 96 | "updated_at": int(time.time()), 97 | } 98 | ) 99 | 100 | result = Chat(**chat.model_dump()) 101 | db.add(result) 102 | db.commit() 103 | db.refresh(result) 104 | return ChatModel.model_validate(result) if result else None 105 | 106 | def update_chat_by_id(self, id: str, chat: dict) -> Optional[ChatModel]: 107 | try: 108 | with get_db() as db: 109 | 110 | chat_obj = db.get(Chat, id) 111 | chat_obj.chat = json.dumps(chat) 112 | chat_obj.title = chat["title"] if "title" in chat else "New Chat" 113 | chat_obj.updated_at = int(time.time()) 114 | db.commit() 115 | db.refresh(chat_obj) 116 | 117 | return ChatModel.model_validate(chat_obj) 118 | except Exception as e: 119 | return None 120 | 121 | def insert_shared_chat_by_chat_id(self, chat_id: str) -> Optional[ChatModel]: 122 | with get_db() as db: 123 | 124 | # Get the existing chat to share 125 | chat = db.get(Chat, chat_id) 126 | # Check if the chat is already shared 127 | if chat.share_id: 128 | return self.get_chat_by_id_and_user_id(chat.share_id, "shared") 129 | # Create a new chat with the same data, but with a new ID 130 | shared_chat = ChatModel( 131 | **{ 132 | "id": str(uuid.uuid4()), 133 | "user_id": f"shared-{chat_id}", 134 | "title": chat.title, 135 | "chat": chat.chat, 136 | "created_at": chat.created_at, 137 | "updated_at": int(time.time()), 138 | } 139 | ) 140 | shared_result = Chat(**shared_chat.model_dump()) 141 | db.add(shared_result) 142 | db.commit() 143 | db.refresh(shared_result) 144 | 145 | # Update the original chat with the share_id 146 | result = ( 147 | db.query(Chat) 148 | .filter_by(id=chat_id) 149 | .update({"share_id": shared_chat.id}) 150 | ) 151 | db.commit() 152 | return shared_chat if (shared_result and result) else None 153 | 154 | def update_shared_chat_by_chat_id(self, chat_id: str) -> Optional[ChatModel]: 155 | try: 156 | with get_db() as db: 157 | 158 | print("update_shared_chat_by_id") 159 | chat = db.get(Chat, chat_id) 160 | print(chat) 161 | chat.title = chat.title 162 | chat.chat = chat.chat 163 | db.commit() 164 | db.refresh(chat) 165 | 166 | return self.get_chat_by_id(chat.share_id) 167 | except: 168 | return None 169 | 170 | def delete_shared_chat_by_chat_id(self, chat_id: str) -> bool: 171 | try: 172 | with get_db() as db: 173 | 174 | db.query(Chat).filter_by(user_id=f"shared-{chat_id}").delete() 175 | db.commit() 176 | 177 | return True 178 | except: 179 | return False 180 | 181 | def update_chat_share_id_by_id( 182 | self, id: str, share_id: Optional[str] 183 | ) -> Optional[ChatModel]: 184 | try: 185 | with get_db() as db: 186 | 187 | chat = db.get(Chat, id) 188 | chat.share_id = share_id 189 | db.commit() 190 | db.refresh(chat) 191 | return ChatModel.model_validate(chat) 192 | except: 193 | return None 194 | 195 | def toggle_chat_archive_by_id(self, id: str) -> Optional[ChatModel]: 196 | try: 197 | with get_db() as db: 198 | 199 | chat = db.get(Chat, id) 200 | chat.archived = not chat.archived 201 | db.commit() 202 | db.refresh(chat) 203 | return ChatModel.model_validate(chat) 204 | except: 205 | return None 206 | 207 | def archive_all_chats_by_user_id(self, user_id: str) -> bool: 208 | try: 209 | with get_db() as db: 210 | db.query(Chat).filter_by(user_id=user_id).update({"archived": True}) 211 | db.commit() 212 | return True 213 | except: 214 | return False 215 | 216 | def get_archived_chat_list_by_user_id( 217 | self, user_id: str, skip: int = 0, limit: int = 50 218 | ) -> List[ChatModel]: 219 | with get_db() as db: 220 | 221 | all_chats = ( 222 | db.query(Chat) 223 | .filter_by(user_id=user_id, archived=True) 224 | .order_by(Chat.updated_at.desc()) 225 | # .limit(limit).offset(skip) 226 | .all() 227 | ) 228 | return [ChatModel.model_validate(chat) for chat in all_chats] 229 | 230 | def get_chat_list_by_user_id( 231 | self, 232 | user_id: str, 233 | include_archived: bool = False, 234 | skip: int = 0, 235 | limit: int = 50, 236 | ) -> List[ChatModel]: 237 | with get_db() as db: 238 | query = db.query(Chat).filter_by(user_id=user_id) 239 | if not include_archived: 240 | query = query.filter_by(archived=False) 241 | all_chats = ( 242 | query.order_by(Chat.updated_at.desc()) 243 | # .limit(limit).offset(skip) 244 | .all() 245 | ) 246 | return [ChatModel.model_validate(chat) for chat in all_chats] 247 | 248 | def get_chat_title_id_list_by_user_id( 249 | self, 250 | user_id: str, 251 | include_archived: bool = False, 252 | skip: int = 0, 253 | limit: int = 50, 254 | ) -> List[ChatTitleIdResponse]: 255 | with get_db() as db: 256 | query = db.query(Chat).filter_by(user_id=user_id) 257 | if not include_archived: 258 | query = query.filter_by(archived=False) 259 | 260 | all_chats = ( 261 | query.order_by(Chat.updated_at.desc()) 262 | # limit cols 263 | .with_entities( 264 | Chat.id, Chat.title, Chat.updated_at, Chat.created_at 265 | ).all() 266 | ) 267 | # result has to be destrctured from sqlalchemy `row` and mapped to a dict since the `ChatModel`is not the returned dataclass. 268 | return list( 269 | map( 270 | lambda row: ChatTitleIdResponse.model_validate( 271 | { 272 | "id": row[0], 273 | "title": row[1], 274 | "updated_at": row[2], 275 | "created_at": row[3], 276 | } 277 | ), 278 | all_chats, 279 | ) 280 | ) 281 | 282 | def get_chat_list_by_chat_ids( 283 | self, chat_ids: List[str], skip: int = 0, limit: int = 50 284 | ) -> List[ChatModel]: 285 | with get_db() as db: 286 | all_chats = ( 287 | db.query(Chat) 288 | .filter(Chat.id.in_(chat_ids)) 289 | .filter_by(archived=False) 290 | .order_by(Chat.updated_at.desc()) 291 | .all() 292 | ) 293 | return [ChatModel.model_validate(chat) for chat in all_chats] 294 | 295 | def get_chat_by_id(self, id: str) -> Optional[ChatModel]: 296 | try: 297 | with get_db() as db: 298 | 299 | chat = db.get(Chat, id) 300 | return ChatModel.model_validate(chat) 301 | except: 302 | return None 303 | 304 | def get_chat_by_share_id(self, id: str) -> Optional[ChatModel]: 305 | try: 306 | with get_db() as db: 307 | 308 | chat = db.query(Chat).filter_by(share_id=id).first() 309 | 310 | if chat: 311 | return self.get_chat_by_id(id) 312 | else: 313 | return None 314 | except Exception as e: 315 | return None 316 | 317 | def get_chat_by_id_and_user_id(self, id: str, user_id: str) -> Optional[ChatModel]: 318 | try: 319 | with get_db() as db: 320 | 321 | chat = db.query(Chat).filter_by(id=id, user_id=user_id).first() 322 | return ChatModel.model_validate(chat) 323 | except: 324 | return None 325 | 326 | def get_chats(self, skip: int = 0, limit: int = 50) -> List[ChatModel]: 327 | with get_db() as db: 328 | 329 | all_chats = ( 330 | db.query(Chat) 331 | # .limit(limit).offset(skip) 332 | .order_by(Chat.updated_at.desc()) 333 | ) 334 | return [ChatModel.model_validate(chat) for chat in all_chats] 335 | 336 | def get_chats_by_user_id(self, user_id: str) -> List[ChatModel]: 337 | with get_db() as db: 338 | 339 | all_chats = ( 340 | db.query(Chat) 341 | .filter_by(user_id=user_id) 342 | .order_by(Chat.updated_at.desc()) 343 | ) 344 | return [ChatModel.model_validate(chat) for chat in all_chats] 345 | 346 | def get_archived_chats_by_user_id(self, user_id: str) -> List[ChatModel]: 347 | with get_db() as db: 348 | 349 | all_chats = ( 350 | db.query(Chat) 351 | .filter_by(user_id=user_id, archived=True) 352 | .order_by(Chat.updated_at.desc()) 353 | ) 354 | return [ChatModel.model_validate(chat) for chat in all_chats] 355 | 356 | def delete_chat_by_id(self, id: str) -> bool: 357 | try: 358 | with get_db() as db: 359 | 360 | db.query(Chat).filter_by(id=id).delete() 361 | db.commit() 362 | 363 | return True and self.delete_shared_chat_by_chat_id(id) 364 | except: 365 | return False 366 | 367 | def delete_chat_by_id_and_user_id(self, id: str, user_id: str) -> bool: 368 | try: 369 | with get_db() as db: 370 | 371 | db.query(Chat).filter_by(id=id, user_id=user_id).delete() 372 | db.commit() 373 | 374 | return True and self.delete_shared_chat_by_chat_id(id) 375 | except: 376 | return False 377 | 378 | def delete_chats_by_user_id(self, user_id: str) -> bool: 379 | try: 380 | 381 | with get_db() as db: 382 | 383 | self.delete_shared_chats_by_user_id(user_id) 384 | 385 | db.query(Chat).filter_by(user_id=user_id).delete() 386 | db.commit() 387 | 388 | return True 389 | except: 390 | return False 391 | 392 | def delete_shared_chats_by_user_id(self, user_id: str) -> bool: 393 | try: 394 | 395 | with get_db() as db: 396 | 397 | chats_by_user = db.query(Chat).filter_by(user_id=user_id).all() 398 | shared_chat_ids = [f"shared-{chat.id}" for chat in chats_by_user] 399 | 400 | db.query(Chat).filter(Chat.user_id.in_(shared_chat_ids)).delete() 401 | db.commit() 402 | 403 | return True 404 | except: 405 | return False 406 | 407 | 408 | Chats = ChatTable() ``````` `\\?\D:\Coding\ai\backend\apps\webui\models\documents.py`: ```````py 1 | from pydantic import BaseModel, ConfigDict 2 | from typing import List, Optional 3 | import time 4 | import logging 5 | 6 | from sqlalchemy import String, Column, BigInteger, Text 7 | 8 | from apps.webui.internal.db import Base, get_db 9 | 10 | import json 11 | 12 | from config import SRC_LOG_LEVELS 13 | 14 | log = logging.getLogger(__name__) 15 | log.setLevel(SRC_LOG_LEVELS["MODELS"]) 16 | 17 | #################### 18 | # Documents DB Schema 19 | #################### 20 | 21 | 22 | class Document(Base): 23 | __tablename__ = "document" 24 | 25 | collection_name = Column(String, primary_key=True) 26 | name = Column(String, unique=True) 27 | title = Column(Text) 28 | filename = Column(Text) 29 | content = Column(Text, nullable=True) 30 | user_id = Column(String) 31 | timestamp = Column(BigInteger) 32 | 33 | 34 | class DocumentModel(BaseModel): 35 | model_config = ConfigDict(from_attributes=True) 36 | 37 | collection_name: str 38 | name: str 39 | title: str 40 | filename: str 41 | content: Optional[str] = None 42 | user_id: str 43 | timestamp: int # timestamp in epoch 44 | 45 | 46 | #################### 47 | # Forms 48 | #################### 49 | 50 | 51 | class DocumentResponse(BaseModel): 52 | collection_name: str 53 | name: str 54 | title: str 55 | filename: str 56 | content: Optional[dict] = None 57 | user_id: str 58 | timestamp: int # timestamp in epoch 59 | 60 | 61 | class DocumentUpdateForm(BaseModel): 62 | name: str 63 | title: str 64 | 65 | 66 | class DocumentForm(DocumentUpdateForm): 67 | collection_name: str 68 | filename: str 69 | content: Optional[str] = None 70 | 71 | 72 | class DocumentsTable: 73 | 74 | def insert_new_doc( 75 | self, user_id: str, form_data: DocumentForm 76 | ) -> Optional[DocumentModel]: 77 | with get_db() as db: 78 | 79 | document = DocumentModel( 80 | **{ 81 | **form_data.model_dump(), 82 | "user_id": user_id, 83 | "timestamp": int(time.time()), 84 | } 85 | ) 86 | 87 | try: 88 | result = Document(**document.model_dump()) 89 | db.add(result) 90 | db.commit() 91 | db.refresh(result) 92 | if result: 93 | return DocumentModel.model_validate(result) 94 | else: 95 | return None 96 | except: 97 | return None 98 | 99 | def get_doc_by_name(self, name: str) -> Optional[DocumentModel]: 100 | try: 101 | with get_db() as db: 102 | 103 | document = db.query(Document).filter_by(name=name).first() 104 | return DocumentModel.model_validate(document) if document else None 105 | except: 106 | return None 107 | 108 | def get_docs(self) -> List[DocumentModel]: 109 | with get_db() as db: 110 | 111 | return [ 112 | DocumentModel.model_validate(doc) for doc in db.query(Document).all() 113 | ] 114 | 115 | def update_doc_by_name( 116 | self, name: str, form_data: DocumentUpdateForm 117 | ) -> Optional[DocumentModel]: 118 | try: 119 | with get_db() as db: 120 | 121 | db.query(Document).filter_by(name=name).update( 122 | { 123 | "title": form_data.title, 124 | "name": form_data.name, 125 | "timestamp": int(time.time()), 126 | } 127 | ) 128 | db.commit() 129 | return self.get_doc_by_name(form_data.name) 130 | except Exception as e: 131 | log.exception(e) 132 | return None 133 | 134 | def update_doc_content_by_name( 135 | self, name: str, updated: dict 136 | ) -> Optional[DocumentModel]: 137 | try: 138 | doc = self.get_doc_by_name(name) 139 | doc_content = json.loads(doc.content if doc.content else "{}") 140 | doc_content = {**doc_content, **updated} 141 | 142 | with get_db() as db: 143 | 144 | db.query(Document).filter_by(name=name).update( 145 | { 146 | "content": json.dumps(doc_content), 147 | "timestamp": int(time.time()), 148 | } 149 | ) 150 | db.commit() 151 | return self.get_doc_by_name(name) 152 | except Exception as e: 153 | log.exception(e) 154 | return None 155 | 156 | def delete_doc_by_name(self, name: str) -> bool: 157 | try: 158 | with get_db() as db: 159 | 160 | db.query(Document).filter_by(name=name).delete() 161 | db.commit() 162 | return True 163 | except: 164 | return False 165 | 166 | 167 | Documents = DocumentsTable() ``````` `\\?\D:\Coding\ai\backend\apps\webui\models\files.py`: ```````py 1 | from pydantic import BaseModel, ConfigDict 2 | from typing import List, Union, Optional 3 | import time 4 | import logging 5 | 6 | from sqlalchemy import Column, String, BigInteger, Text 7 | 8 | from apps.webui.internal.db import JSONField, Base, get_db 9 | 10 | import json 11 | 12 | from config import SRC_LOG_LEVELS 13 | 14 | log = logging.getLogger(__name__) 15 | log.setLevel(SRC_LOG_LEVELS["MODELS"]) 16 | 17 | #################### 18 | # Files DB Schema 19 | #################### 20 | 21 | 22 | class File(Base): 23 | __tablename__ = "file" 24 | 25 | id = Column(String, primary_key=True) 26 | user_id = Column(String) 27 | filename = Column(Text) 28 | meta = Column(JSONField) 29 | created_at = Column(BigInteger) 30 | 31 | 32 | class FileModel(BaseModel): 33 | id: str 34 | user_id: str 35 | filename: str 36 | meta: dict 37 | created_at: int # timestamp in epoch 38 | 39 | model_config = ConfigDict(from_attributes=True) 40 | 41 | 42 | #################### 43 | # Forms 44 | #################### 45 | 46 | 47 | class FileModelResponse(BaseModel): 48 | id: str 49 | user_id: str 50 | filename: str 51 | meta: dict 52 | created_at: int # timestamp in epoch 53 | 54 | 55 | class FileForm(BaseModel): 56 | id: str 57 | filename: str 58 | meta: dict = {} 59 | 60 | 61 | class FilesTable: 62 | 63 | def insert_new_file(self, user_id: str, form_data: FileForm) -> Optional[FileModel]: 64 | with get_db() as db: 65 | 66 | file = FileModel( 67 | **{ 68 | **form_data.model_dump(), 69 | "user_id": user_id, 70 | "created_at": int(time.time()), 71 | } 72 | ) 73 | 74 | try: 75 | result = File(**file.model_dump()) 76 | db.add(result) 77 | db.commit() 78 | db.refresh(result) 79 | if result: 80 | return FileModel.model_validate(result) 81 | else: 82 | return None 83 | except Exception as e: 84 | print(f"Error creating tool: {e}") 85 | return None 86 | 87 | def get_file_by_id(self, id: str) -> Optional[FileModel]: 88 | with get_db() as db: 89 | 90 | try: 91 | file = db.get(File, id) 92 | return FileModel.model_validate(file) 93 | except: 94 | return None 95 | 96 | def get_files(self) -> List[FileModel]: 97 | with get_db() as db: 98 | 99 | return [FileModel.model_validate(file) for file in db.query(File).all()] 100 | 101 | def delete_file_by_id(self, id: str) -> bool: 102 | 103 | with get_db() as db: 104 | 105 | try: 106 | db.query(File).filter_by(id=id).delete() 107 | db.commit() 108 | 109 | return True 110 | except: 111 | return False 112 | 113 | def delete_all_files(self) -> bool: 114 | 115 | with get_db() as db: 116 | 117 | try: 118 | db.query(File).delete() 119 | db.commit() 120 | 121 | return True 122 | except: 123 | return False 124 | 125 | 126 | Files = FilesTable() ``````` `\\?\D:\Coding\ai\backend\apps\webui\models\functions.py`: ```````py 1 | from pydantic import BaseModel, ConfigDict 2 | from typing import List, Union, Optional 3 | import time 4 | import logging 5 | 6 | from sqlalchemy import Column, String, Text, BigInteger, Boolean 7 | 8 | from apps.webui.internal.db import JSONField, Base, get_db 9 | from apps.webui.models.users import Users 10 | 11 | import json 12 | import copy 13 | 14 | 15 | from config import SRC_LOG_LEVELS 16 | 17 | log = logging.getLogger(__name__) 18 | log.setLevel(SRC_LOG_LEVELS["MODELS"]) 19 | 20 | #################### 21 | # Functions DB Schema 22 | #################### 23 | 24 | 25 | class Function(Base): 26 | __tablename__ = "function" 27 | 28 | id = Column(String, primary_key=True) 29 | user_id = Column(String) 30 | name = Column(Text) 31 | type = Column(Text) 32 | content = Column(Text) 33 | meta = Column(JSONField) 34 | valves = Column(JSONField) 35 | is_active = Column(Boolean) 36 | is_global = Column(Boolean) 37 | updated_at = Column(BigInteger) 38 | created_at = Column(BigInteger) 39 | 40 | 41 | class FunctionMeta(BaseModel): 42 | description: Optional[str] = None 43 | manifest: Optional[dict] = {} 44 | 45 | 46 | class FunctionModel(BaseModel): 47 | id: str 48 | user_id: str 49 | name: str 50 | type: str 51 | content: str 52 | meta: FunctionMeta 53 | is_active: bool = False 54 | is_global: bool = False 55 | updated_at: int # timestamp in epoch 56 | created_at: int # timestamp in epoch 57 | 58 | model_config = ConfigDict(from_attributes=True) 59 | 60 | 61 | #################### 62 | # Forms 63 | #################### 64 | 65 | 66 | class FunctionResponse(BaseModel): 67 | id: str 68 | user_id: str 69 | type: str 70 | name: str 71 | meta: FunctionMeta 72 | is_active: bool 73 | is_global: bool 74 | updated_at: int # timestamp in epoch 75 | created_at: int # timestamp in epoch 76 | 77 | 78 | class FunctionForm(BaseModel): 79 | id: str 80 | name: str 81 | content: str 82 | meta: FunctionMeta 83 | 84 | 85 | class FunctionValves(BaseModel): 86 | valves: Optional[dict] = None 87 | 88 | 89 | class FunctionsTable: 90 | 91 | def insert_new_function( 92 | self, user_id: str, type: str, form_data: FunctionForm 93 | ) -> Optional[FunctionModel]: 94 | 95 | function = FunctionModel( 96 | **{ 97 | **form_data.model_dump(), 98 | "user_id": user_id, 99 | "type": type, 100 | "updated_at": int(time.time()), 101 | "created_at": int(time.time()), 102 | } 103 | ) 104 | 105 | try: 106 | with get_db() as db: 107 | result = Function(**function.model_dump()) 108 | db.add(result) 109 | db.commit() 110 | db.refresh(result) 111 | if result: 112 | return FunctionModel.model_validate(result) 113 | else: 114 | return None 115 | except Exception as e: 116 | print(f"Error creating tool: {e}") 117 | return None 118 | 119 | def get_function_by_id(self, id: str) -> Optional[FunctionModel]: 120 | try: 121 | with get_db() as db: 122 | 123 | function = db.get(Function, id) 124 | return FunctionModel.model_validate(function) 125 | except: 126 | return None 127 | 128 | def get_functions(self, active_only=False) -> List[FunctionModel]: 129 | with get_db() as db: 130 | 131 | if active_only: 132 | return [ 133 | FunctionModel.model_validate(function) 134 | for function in db.query(Function).filter_by(is_active=True).all() 135 | ] 136 | else: 137 | return [ 138 | FunctionModel.model_validate(function) 139 | for function in db.query(Function).all() 140 | ] 141 | 142 | def get_functions_by_type( 143 | self, type: str, active_only=False 144 | ) -> List[FunctionModel]: 145 | with get_db() as db: 146 | 147 | if active_only: 148 | return [ 149 | FunctionModel.model_validate(function) 150 | for function in db.query(Function) 151 | .filter_by(type=type, is_active=True) 152 | .all() 153 | ] 154 | else: 155 | return [ 156 | FunctionModel.model_validate(function) 157 | for function in db.query(Function).filter_by(type=type).all() 158 | ] 159 | 160 | def get_global_filter_functions(self) -> List[FunctionModel]: 161 | with get_db() as db: 162 | 163 | return [ 164 | FunctionModel.model_validate(function) 165 | for function in db.query(Function) 166 | .filter_by(type="filter", is_active=True, is_global=True) 167 | .all() 168 | ] 169 | 170 | def get_global_action_functions(self) -> List[FunctionModel]: 171 | with get_db() as db: 172 | return [ 173 | FunctionModel.model_validate(function) 174 | for function in db.query(Function) 175 | .filter_by(type="action", is_active=True, is_global=True) 176 | .all() 177 | ] 178 | 179 | def get_function_valves_by_id(self, id: str) -> Optional[dict]: 180 | with get_db() as db: 181 | 182 | try: 183 | function = db.get(Function, id) 184 | return function.valves if function.valves else {} 185 | except Exception as e: 186 | print(f"An error occurred: {e}") 187 | return None 188 | 189 | def update_function_valves_by_id( 190 | self, id: str, valves: dict 191 | ) -> Optional[FunctionValves]: 192 | with get_db() as db: 193 | 194 | try: 195 | function = db.get(Function, id) 196 | function.valves = valves 197 | function.updated_at = int(time.time()) 198 | db.commit() 199 | db.refresh(function) 200 | return self.get_function_by_id(id) 201 | except: 202 | return None 203 | 204 | def get_user_valves_by_id_and_user_id( 205 | self, id: str, user_id: str 206 | ) -> Optional[dict]: 207 | 208 | try: 209 | user = Users.get_user_by_id(user_id) 210 | user_settings = user.settings.model_dump() if user.settings else {} 211 | 212 | # Check if user has "functions" and "valves" settings 213 | if "functions" not in user_settings: 214 | user_settings["functions"] = {} 215 | if "valves" not in user_settings["functions"]: 216 | user_settings["functions"]["valves"] = {} 217 | 218 | return user_settings["functions"]["valves"].get(id, {}) 219 | except Exception as e: 220 | print(f"An error occurred: {e}") 221 | return None 222 | 223 | def update_user_valves_by_id_and_user_id( 224 | self, id: str, user_id: str, valves: dict 225 | ) -> Optional[dict]: 226 | 227 | try: 228 | user = Users.get_user_by_id(user_id) 229 | user_settings = user.settings.model_dump() if user.settings else {} 230 | 231 | # Check if user has "functions" and "valves" settings 232 | if "functions" not in user_settings: 233 | user_settings["functions"] = {} 234 | if "valves" not in user_settings["functions"]: 235 | user_settings["functions"]["valves"] = {} 236 | 237 | user_settings["functions"]["valves"][id] = valves 238 | 239 | # Update the user settings in the database 240 | Users.update_user_by_id(user_id, {"settings": user_settings}) 241 | 242 | return user_settings["functions"]["valves"][id] 243 | except Exception as e: 244 | print(f"An error occurred: {e}") 245 | return None 246 | 247 | def update_function_by_id(self, id: str, updated: dict) -> Optional[FunctionModel]: 248 | with get_db() as db: 249 | 250 | try: 251 | db.query(Function).filter_by(id=id).update( 252 | { 253 | **updated, 254 | "updated_at": int(time.time()), 255 | } 256 | ) 257 | db.commit() 258 | return self.get_function_by_id(id) 259 | except: 260 | return None 261 | 262 | def deactivate_all_functions(self) -> Optional[bool]: 263 | with get_db() as db: 264 | 265 | try: 266 | db.query(Function).update( 267 | { 268 | "is_active": False, 269 | "updated_at": int(time.time()), 270 | } 271 | ) 272 | db.commit() 273 | return True 274 | except: 275 | return None 276 | 277 | def delete_function_by_id(self, id: str) -> bool: 278 | with get_db() as db: 279 | try: 280 | db.query(Function).filter_by(id=id).delete() 281 | db.commit() 282 | 283 | return True 284 | except: 285 | return False 286 | 287 | 288 | Functions = FunctionsTable() ``````` `\\?\D:\Coding\ai\backend\apps\webui\models\memories.py`: ```````py 1 | from pydantic import BaseModel, ConfigDict 2 | from typing import List, Union, Optional 3 | 4 | from sqlalchemy import Column, String, BigInteger, Text 5 | 6 | from apps.webui.internal.db import Base, get_db 7 | 8 | import time 9 | import uuid 10 | 11 | #################### 12 | # Memory DB Schema 13 | #################### 14 | 15 | 16 | class Memory(Base): 17 | __tablename__ = "memory" 18 | 19 | id = Column(String, primary_key=True) 20 | user_id = Column(String) 21 | content = Column(Text) 22 | updated_at = Column(BigInteger) 23 | created_at = Column(BigInteger) 24 | 25 | 26 | class MemoryModel(BaseModel): 27 | id: str 28 | user_id: str 29 | content: str 30 | updated_at: int # timestamp in epoch 31 | created_at: int # timestamp in epoch 32 | 33 | model_config = ConfigDict(from_attributes=True) 34 | 35 | 36 | #################### 37 | # Forms 38 | #################### 39 | 40 | 41 | class MemoriesTable: 42 | 43 | def insert_new_memory( 44 | self, 45 | user_id: str, 46 | content: str, 47 | ) -> Optional[MemoryModel]: 48 | 49 | with get_db() as db: 50 | id = str(uuid.uuid4()) 51 | 52 | memory = MemoryModel( 53 | **{ 54 | "id": id, 55 | "user_id": user_id, 56 | "content": content, 57 | "created_at": int(time.time()), 58 | "updated_at": int(time.time()), 59 | } 60 | ) 61 | result = Memory(**memory.model_dump()) 62 | db.add(result) 63 | db.commit() 64 | db.refresh(result) 65 | if result: 66 | return MemoryModel.model_validate(result) 67 | else: 68 | return None 69 | 70 | def update_memory_by_id( 71 | self, 72 | id: str, 73 | content: str, 74 | ) -> Optional[MemoryModel]: 75 | with get_db() as db: 76 | 77 | try: 78 | db.query(Memory).filter_by(id=id).update( 79 | {"content": content, "updated_at": int(time.time())} 80 | ) 81 | db.commit() 82 | return self.get_memory_by_id(id) 83 | except: 84 | return None 85 | 86 | def get_memories(self) -> List[MemoryModel]: 87 | with get_db() as db: 88 | 89 | try: 90 | memories = db.query(Memory).all() 91 | return [MemoryModel.model_validate(memory) for memory in memories] 92 | except: 93 | return None 94 | 95 | def get_memories_by_user_id(self, user_id: str) -> List[MemoryModel]: 96 | with get_db() as db: 97 | 98 | try: 99 | memories = db.query(Memory).filter_by(user_id=user_id).all() 100 | return [MemoryModel.model_validate(memory) for memory in memories] 101 | except: 102 | return None 103 | 104 | def get_memory_by_id(self, id: str) -> Optional[MemoryModel]: 105 | with get_db() as db: 106 | 107 | try: 108 | memory = db.get(Memory, id) 109 | return MemoryModel.model_validate(memory) 110 | except: 111 | return None 112 | 113 | def delete_memory_by_id(self, id: str) -> bool: 114 | with get_db() as db: 115 | 116 | try: 117 | db.query(Memory).filter_by(id=id).delete() 118 | db.commit() 119 | 120 | return True 121 | 122 | except: 123 | return False 124 | 125 | def delete_memories_by_user_id(self, user_id: str) -> bool: 126 | with get_db() as db: 127 | 128 | try: 129 | db.query(Memory).filter_by(user_id=user_id).delete() 130 | db.commit() 131 | 132 | return True 133 | except: 134 | return False 135 | 136 | def delete_memory_by_id_and_user_id(self, id: str, user_id: str) -> bool: 137 | with get_db() as db: 138 | 139 | try: 140 | db.query(Memory).filter_by(id=id, user_id=user_id).delete() 141 | db.commit() 142 | 143 | return True 144 | except: 145 | return False 146 | 147 | 148 | Memories = MemoriesTable() ``````` `\\?\D:\Coding\ai\backend\apps\webui\models\models.py`: ```````py 1 | import json 2 | import logging 3 | from typing import Optional 4 | 5 | from pydantic import BaseModel, ConfigDict 6 | from sqlalchemy import String, Column, BigInteger, Text 7 | 8 | from apps.webui.internal.db import Base, JSONField, get_db 9 | 10 | from typing import List, Union, Optional 11 | from config import SRC_LOG_LEVELS 12 | 13 | import time 14 | 15 | log = logging.getLogger(__name__) 16 | log.setLevel(SRC_LOG_LEVELS["MODELS"]) 17 | 18 | 19 | #################### 20 | # Models DB Schema 21 | #################### 22 | 23 | 24 | # ModelParams is a model for the data stored in the params field of the Model table 25 | class ModelParams(BaseModel): 26 | model_config = ConfigDict(extra="allow") 27 | pass 28 | 29 | 30 | # ModelMeta is a model for the data stored in the meta field of the Model table 31 | class ModelMeta(BaseModel): 32 | profile_image_url: Optional[str] = "/static/favicon.png" 33 | 34 | description: Optional[str] = None 35 | """ 36 | User-facing description of the model. 37 | """ 38 | 39 | capabilities: Optional[dict] = None 40 | 41 | model_config = ConfigDict(extra="allow") 42 | 43 | pass 44 | 45 | 46 | class Model(Base): 47 | __tablename__ = "model" 48 | 49 | id = Column(Text, primary_key=True) 50 | """ 51 | The model's id as used in the API. If set to an existing model, it will override the model. 52 | """ 53 | user_id = Column(Text) 54 | 55 | base_model_id = Column(Text, nullable=True) 56 | """ 57 | An optional pointer to the actual model that should be used when proxying requests. 58 | """ 59 | 60 | name = Column(Text) 61 | """ 62 | The human-readable display name of the model. 63 | """ 64 | 65 | params = Column(JSONField) 66 | """ 67 | Holds a JSON encoded blob of parameters, see `ModelParams`. 68 | """ 69 | 70 | meta = Column(JSONField) 71 | """ 72 | Holds a JSON encoded blob of metadata, see `ModelMeta`. 73 | """ 74 | 75 | updated_at = Column(BigInteger) 76 | created_at = Column(BigInteger) 77 | 78 | 79 | class ModelModel(BaseModel): 80 | id: str 81 | user_id: str 82 | base_model_id: Optional[str] = None 83 | 84 | name: str 85 | params: ModelParams 86 | meta: ModelMeta 87 | 88 | updated_at: int # timestamp in epoch 89 | created_at: int # timestamp in epoch 90 | 91 | model_config = ConfigDict(from_attributes=True) 92 | 93 | 94 | #################### 95 | # Forms 96 | #################### 97 | 98 | 99 | class ModelResponse(BaseModel): 100 | id: str 101 | name: str 102 | meta: ModelMeta 103 | updated_at: int # timestamp in epoch 104 | created_at: int # timestamp in epoch 105 | 106 | 107 | class ModelForm(BaseModel): 108 | id: str 109 | base_model_id: Optional[str] = None 110 | name: str 111 | meta: ModelMeta 112 | params: ModelParams 113 | 114 | 115 | class ModelsTable: 116 | 117 | def insert_new_model( 118 | self, form_data: ModelForm, user_id: str 119 | ) -> Optional[ModelModel]: 120 | model = ModelModel( 121 | **{ 122 | **form_data.model_dump(), 123 | "user_id": user_id, 124 | "created_at": int(time.time()), 125 | "updated_at": int(time.time()), 126 | } 127 | ) 128 | try: 129 | 130 | with get_db() as db: 131 | 132 | result = Model(**model.model_dump()) 133 | db.add(result) 134 | db.commit() 135 | db.refresh(result) 136 | 137 | if result: 138 | return ModelModel.model_validate(result) 139 | else: 140 | return None 141 | except Exception as e: 142 | print(e) 143 | return None 144 | 145 | def get_all_models(self) -> List[ModelModel]: 146 | with get_db() as db: 147 | 148 | return [ModelModel.model_validate(model) for model in db.query(Model).all()] 149 | 150 | def get_model_by_id(self, id: str) -> Optional[ModelModel]: 151 | try: 152 | with get_db() as db: 153 | 154 | model = db.get(Model, id) 155 | return ModelModel.model_validate(model) 156 | except: 157 | return None 158 | 159 | def update_model_by_id(self, id: str, model: ModelForm) -> Optional[ModelModel]: 160 | try: 161 | with get_db() as db: 162 | # update only the fields that are present in the model 163 | result = ( 164 | db.query(Model) 165 | .filter_by(id=id) 166 | .update(model.model_dump(exclude={"id"}, exclude_none=True)) 167 | ) 168 | db.commit() 169 | 170 | model = db.get(Model, id) 171 | db.refresh(model) 172 | return ModelModel.model_validate(model) 173 | except Exception as e: 174 | print(e) 175 | 176 | return None 177 | 178 | def delete_model_by_id(self, id: str) -> bool: 179 | try: 180 | with get_db() as db: 181 | 182 | db.query(Model).filter_by(id=id).delete() 183 | db.commit() 184 | 185 | return True 186 | except: 187 | return False 188 | 189 | 190 | Models = ModelsTable() ``````` `\\?\D:\Coding\ai\backend\apps\webui\models\prompts.py`: ```````py 1 | from pydantic import BaseModel, ConfigDict 2 | from typing import List, Optional 3 | import time 4 | 5 | from sqlalchemy import String, Column, BigInteger, Text 6 | 7 | from apps.webui.internal.db import Base, get_db 8 | 9 | import json 10 | 11 | #################### 12 | # Prompts DB Schema 13 | #################### 14 | 15 | 16 | class Prompt(Base): 17 | __tablename__ = "prompt" 18 | 19 | command = Column(String, primary_key=True) 20 | user_id = Column(String) 21 | title = Column(Text) 22 | content = Column(Text) 23 | timestamp = Column(BigInteger) 24 | 25 | 26 | class PromptModel(BaseModel): 27 | command: str 28 | user_id: str 29 | title: str 30 | content: str 31 | timestamp: int # timestamp in epoch 32 | 33 | model_config = ConfigDict(from_attributes=True) 34 | 35 | 36 | #################### 37 | # Forms 38 | #################### 39 | 40 | 41 | class PromptForm(BaseModel): 42 | command: str 43 | title: str 44 | content: str 45 | 46 | 47 | class PromptsTable: 48 | 49 | def insert_new_prompt( 50 | self, user_id: str, form_data: PromptForm 51 | ) -> Optional[PromptModel]: 52 | prompt = PromptModel( 53 | **{ 54 | "user_id": user_id, 55 | "command": form_data.command, 56 | "title": form_data.title, 57 | "content": form_data.content, 58 | "timestamp": int(time.time()), 59 | } 60 | ) 61 | 62 | try: 63 | with get_db() as db: 64 | 65 | result = Prompt(**prompt.dict()) 66 | db.add(result) 67 | db.commit() 68 | db.refresh(result) 69 | if result: 70 | return PromptModel.model_validate(result) 71 | else: 72 | return None 73 | except Exception as e: 74 | return None 75 | 76 | def get_prompt_by_command(self, command: str) -> Optional[PromptModel]: 77 | try: 78 | with get_db() as db: 79 | 80 | prompt = db.query(Prompt).filter_by(command=command).first() 81 | return PromptModel.model_validate(prompt) 82 | except: 83 | return None 84 | 85 | def get_prompts(self) -> List[PromptModel]: 86 | with get_db() as db: 87 | 88 | return [ 89 | PromptModel.model_validate(prompt) for prompt in db.query(Prompt).all() 90 | ] 91 | 92 | def update_prompt_by_command( 93 | self, command: str, form_data: PromptForm 94 | ) -> Optional[PromptModel]: 95 | try: 96 | with get_db() as db: 97 | 98 | prompt = db.query(Prompt).filter_by(command=command).first() 99 | prompt.title = form_data.title 100 | prompt.content = form_data.content 101 | prompt.timestamp = int(time.time()) 102 | db.commit() 103 | return PromptModel.model_validate(prompt) 104 | except: 105 | return None 106 | 107 | def delete_prompt_by_command(self, command: str) -> bool: 108 | try: 109 | with get_db() as db: 110 | 111 | db.query(Prompt).filter_by(command=command).delete() 112 | db.commit() 113 | 114 | return True 115 | except: 116 | return False 117 | 118 | 119 | Prompts = PromptsTable() ``````` `\\?\D:\Coding\ai\backend\apps\webui\models\tags.py`: ```````py 1 | from pydantic import BaseModel, ConfigDict 2 | from typing import List, Optional 3 | 4 | import json 5 | import uuid 6 | import time 7 | import logging 8 | 9 | from sqlalchemy import String, Column, BigInteger, Text 10 | 11 | from apps.webui.internal.db import Base, get_db 12 | 13 | from config import SRC_LOG_LEVELS 14 | 15 | log = logging.getLogger(__name__) 16 | log.setLevel(SRC_LOG_LEVELS["MODELS"]) 17 | 18 | #################### 19 | # Tag DB Schema 20 | #################### 21 | 22 | 23 | class Tag(Base): 24 | __tablename__ = "tag" 25 | 26 | id = Column(String, primary_key=True) 27 | name = Column(String) 28 | user_id = Column(String) 29 | data = Column(Text, nullable=True) 30 | 31 | 32 | class ChatIdTag(Base): 33 | __tablename__ = "chatidtag" 34 | 35 | id = Column(String, primary_key=True) 36 | tag_name = Column(String) 37 | chat_id = Column(String) 38 | user_id = Column(String) 39 | timestamp = Column(BigInteger) 40 | 41 | 42 | class TagModel(BaseModel): 43 | id: str 44 | name: str 45 | user_id: str 46 | data: Optional[str] = None 47 | 48 | model_config = ConfigDict(from_attributes=True) 49 | 50 | 51 | class ChatIdTagModel(BaseModel): 52 | id: str 53 | tag_name: str 54 | chat_id: str 55 | user_id: str 56 | timestamp: int 57 | 58 | model_config = ConfigDict(from_attributes=True) 59 | 60 | 61 | #################### 62 | # Forms 63 | #################### 64 | 65 | 66 | class ChatIdTagForm(BaseModel): 67 | tag_name: str 68 | chat_id: str 69 | 70 | 71 | class TagChatIdsResponse(BaseModel): 72 | chat_ids: List[str] 73 | 74 | 75 | class ChatTagsResponse(BaseModel): 76 | tags: List[str] 77 | 78 | 79 | class TagTable: 80 | 81 | def insert_new_tag(self, name: str, user_id: str) -> Optional[TagModel]: 82 | with get_db() as db: 83 | 84 | id = str(uuid.uuid4()) 85 | tag = TagModel(**{"id": id, "user_id": user_id, "name": name}) 86 | try: 87 | result = Tag(**tag.model_dump()) 88 | db.add(result) 89 | db.commit() 90 | db.refresh(result) 91 | if result: 92 | return TagModel.model_validate(result) 93 | else: 94 | return None 95 | except Exception as e: 96 | return None 97 | 98 | def get_tag_by_name_and_user_id( 99 | self, name: str, user_id: str 100 | ) -> Optional[TagModel]: 101 | try: 102 | with get_db() as db: 103 | tag = db.query(Tag).filter_by(name=name, user_id=user_id).first() 104 | return TagModel.model_validate(tag) 105 | except Exception as e: 106 | return None 107 | 108 | def add_tag_to_chat( 109 | self, user_id: str, form_data: ChatIdTagForm 110 | ) -> Optional[ChatIdTagModel]: 111 | tag = self.get_tag_by_name_and_user_id(form_data.tag_name, user_id) 112 | if tag == None: 113 | tag = self.insert_new_tag(form_data.tag_name, user_id) 114 | 115 | id = str(uuid.uuid4()) 116 | chatIdTag = ChatIdTagModel( 117 | **{ 118 | "id": id, 119 | "user_id": user_id, 120 | "chat_id": form_data.chat_id, 121 | "tag_name": tag.name, 122 | "timestamp": int(time.time()), 123 | } 124 | ) 125 | try: 126 | with get_db() as db: 127 | result = ChatIdTag(**chatIdTag.model_dump()) 128 | db.add(result) 129 | db.commit() 130 | db.refresh(result) 131 | if result: 132 | return ChatIdTagModel.model_validate(result) 133 | else: 134 | return None 135 | except: 136 | return None 137 | 138 | def get_tags_by_user_id(self, user_id: str) -> List[TagModel]: 139 | with get_db() as db: 140 | tag_names = [ 141 | chat_id_tag.tag_name 142 | for chat_id_tag in ( 143 | db.query(ChatIdTag) 144 | .filter_by(user_id=user_id) 145 | .order_by(ChatIdTag.timestamp.desc()) 146 | .all() 147 | ) 148 | ] 149 | 150 | return [ 151 | TagModel.model_validate(tag) 152 | for tag in ( 153 | db.query(Tag) 154 | .filter_by(user_id=user_id) 155 | .filter(Tag.name.in_(tag_names)) 156 | .all() 157 | ) 158 | ] 159 | 160 | def get_tags_by_chat_id_and_user_id( 161 | self, chat_id: str, user_id: str 162 | ) -> List[TagModel]: 163 | with get_db() as db: 164 | 165 | tag_names = [ 166 | chat_id_tag.tag_name 167 | for chat_id_tag in ( 168 | db.query(ChatIdTag) 169 | .filter_by(user_id=user_id, chat_id=chat_id) 170 | .order_by(ChatIdTag.timestamp.desc()) 171 | .all() 172 | ) 173 | ] 174 | 175 | return [ 176 | TagModel.model_validate(tag) 177 | for tag in ( 178 | db.query(Tag) 179 | .filter_by(user_id=user_id) 180 | .filter(Tag.name.in_(tag_names)) 181 | .all() 182 | ) 183 | ] 184 | 185 | def get_chat_ids_by_tag_name_and_user_id( 186 | self, tag_name: str, user_id: str 187 | ) -> List[ChatIdTagModel]: 188 | with get_db() as db: 189 | 190 | return [ 191 | ChatIdTagModel.model_validate(chat_id_tag) 192 | for chat_id_tag in ( 193 | db.query(ChatIdTag) 194 | .filter_by(user_id=user_id, tag_name=tag_name) 195 | .order_by(ChatIdTag.timestamp.desc()) 196 | .all() 197 | ) 198 | ] 199 | 200 | def count_chat_ids_by_tag_name_and_user_id( 201 | self, tag_name: str, user_id: str 202 | ) -> int: 203 | with get_db() as db: 204 | 205 | return ( 206 | db.query(ChatIdTag) 207 | .filter_by(tag_name=tag_name, user_id=user_id) 208 | .count() 209 | ) 210 | 211 | def delete_tag_by_tag_name_and_user_id(self, tag_name: str, user_id: str) -> bool: 212 | try: 213 | with get_db() as db: 214 | res = ( 215 | db.query(ChatIdTag) 216 | .filter_by(tag_name=tag_name, user_id=user_id) 217 | .delete() 218 | ) 219 | log.debug(f"res: {res}") 220 | db.commit() 221 | 222 | tag_count = self.count_chat_ids_by_tag_name_and_user_id( 223 | tag_name, user_id 224 | ) 225 | if tag_count == 0: 226 | # Remove tag item from Tag col as well 227 | db.query(Tag).filter_by(name=tag_name, user_id=user_id).delete() 228 | db.commit() 229 | return True 230 | except Exception as e: 231 | log.error(f"delete_tag: {e}") 232 | return False 233 | 234 | def delete_tag_by_tag_name_and_chat_id_and_user_id( 235 | self, tag_name: str, chat_id: str, user_id: str 236 | ) -> bool: 237 | try: 238 | with get_db() as db: 239 | 240 | res = ( 241 | db.query(ChatIdTag) 242 | .filter_by(tag_name=tag_name, chat_id=chat_id, user_id=user_id) 243 | .delete() 244 | ) 245 | log.debug(f"res: {res}") 246 | db.commit() 247 | 248 | tag_count = self.count_chat_ids_by_tag_name_and_user_id( 249 | tag_name, user_id 250 | ) 251 | if tag_count == 0: 252 | # Remove tag item from Tag col as well 253 | db.query(Tag).filter_by(name=tag_name, user_id=user_id).delete() 254 | db.commit() 255 | 256 | return True 257 | except Exception as e: 258 | log.error(f"delete_tag: {e}") 259 | return False 260 | 261 | def delete_tags_by_chat_id_and_user_id(self, chat_id: str, user_id: str) -> bool: 262 | tags = self.get_tags_by_chat_id_and_user_id(chat_id, user_id) 263 | 264 | for tag in tags: 265 | self.delete_tag_by_tag_name_and_chat_id_and_user_id( 266 | tag.tag_name, chat_id, user_id 267 | ) 268 | 269 | return True 270 | 271 | 272 | Tags = TagTable() ``````` `\\?\D:\Coding\ai\backend\apps\webui\models\tools.py`: ```````py 1 | from pydantic import BaseModel, ConfigDict 2 | from typing import List, Optional 3 | import time 4 | import logging 5 | from sqlalchemy import String, Column, BigInteger, Text 6 | 7 | from apps.webui.internal.db import Base, JSONField, get_db 8 | from apps.webui.models.users import Users 9 | 10 | import json 11 | import copy 12 | 13 | 14 | from config import SRC_LOG_LEVELS 15 | 16 | log = logging.getLogger(__name__) 17 | log.setLevel(SRC_LOG_LEVELS["MODELS"]) 18 | 19 | #################### 20 | # Tools DB Schema 21 | #################### 22 | 23 | 24 | class Tool(Base): 25 | __tablename__ = "tool" 26 | 27 | id = Column(String, primary_key=True) 28 | user_id = Column(String) 29 | name = Column(Text) 30 | content = Column(Text) 31 | specs = Column(JSONField) 32 | meta = Column(JSONField) 33 | valves = Column(JSONField) 34 | updated_at = Column(BigInteger) 35 | created_at = Column(BigInteger) 36 | 37 | 38 | class ToolMeta(BaseModel): 39 | description: Optional[str] = None 40 | manifest: Optional[dict] = {} 41 | 42 | 43 | class ToolModel(BaseModel): 44 | id: str 45 | user_id: str 46 | name: str 47 | content: str 48 | specs: List[dict] 49 | meta: ToolMeta 50 | updated_at: int # timestamp in epoch 51 | created_at: int # timestamp in epoch 52 | 53 | model_config = ConfigDict(from_attributes=True) 54 | 55 | 56 | #################### 57 | # Forms 58 | #################### 59 | 60 | 61 | class ToolResponse(BaseModel): 62 | id: str 63 | user_id: str 64 | name: str 65 | meta: ToolMeta 66 | updated_at: int # timestamp in epoch 67 | created_at: int # timestamp in epoch 68 | 69 | 70 | class ToolForm(BaseModel): 71 | id: str 72 | name: str 73 | content: str 74 | meta: ToolMeta 75 | 76 | 77 | class ToolValves(BaseModel): 78 | valves: Optional[dict] = None 79 | 80 | 81 | class ToolsTable: 82 | 83 | def insert_new_tool( 84 | self, user_id: str, form_data: ToolForm, specs: List[dict] 85 | ) -> Optional[ToolModel]: 86 | 87 | with get_db() as db: 88 | 89 | tool = ToolModel( 90 | **{ 91 | **form_data.model_dump(), 92 | "specs": specs, 93 | "user_id": user_id, 94 | "updated_at": int(time.time()), 95 | "created_at": int(time.time()), 96 | } 97 | ) 98 | 99 | try: 100 | result = Tool(**tool.model_dump()) 101 | db.add(result) 102 | db.commit() 103 | db.refresh(result) 104 | if result: 105 | return ToolModel.model_validate(result) 106 | else: 107 | return None 108 | except Exception as e: 109 | print(f"Error creating tool: {e}") 110 | return None 111 | 112 | def get_tool_by_id(self, id: str) -> Optional[ToolModel]: 113 | try: 114 | with get_db() as db: 115 | 116 | tool = db.get(Tool, id) 117 | return ToolModel.model_validate(tool) 118 | except: 119 | return None 120 | 121 | def get_tools(self) -> List[ToolModel]: 122 | with get_db() as db: 123 | return [ToolModel.model_validate(tool) for tool in db.query(Tool).all()] 124 | 125 | def get_tool_valves_by_id(self, id: str) -> Optional[dict]: 126 | try: 127 | with get_db() as db: 128 | 129 | tool = db.get(Tool, id) 130 | return tool.valves if tool.valves else {} 131 | except Exception as e: 132 | print(f"An error occurred: {e}") 133 | return None 134 | 135 | def update_tool_valves_by_id(self, id: str, valves: dict) -> Optional[ToolValves]: 136 | try: 137 | with get_db() as db: 138 | 139 | db.query(Tool).filter_by(id=id).update( 140 | {"valves": valves, "updated_at": int(time.time())} 141 | ) 142 | db.commit() 143 | return self.get_tool_by_id(id) 144 | except: 145 | return None 146 | 147 | def get_user_valves_by_id_and_user_id( 148 | self, id: str, user_id: str 149 | ) -> Optional[dict]: 150 | try: 151 | user = Users.get_user_by_id(user_id) 152 | user_settings = user.settings.model_dump() if user.settings else {} 153 | 154 | # Check if user has "tools" and "valves" settings 155 | if "tools" not in user_settings: 156 | user_settings["tools"] = {} 157 | if "valves" not in user_settings["tools"]: 158 | user_settings["tools"]["valves"] = {} 159 | 160 | return user_settings["tools"]["valves"].get(id, {}) 161 | except Exception as e: 162 | print(f"An error occurred: {e}") 163 | return None 164 | 165 | def update_user_valves_by_id_and_user_id( 166 | self, id: str, user_id: str, valves: dict 167 | ) -> Optional[dict]: 168 | try: 169 | user = Users.get_user_by_id(user_id) 170 | user_settings = user.settings.model_dump() if user.settings else {} 171 | 172 | # Check if user has "tools" and "valves" settings 173 | if "tools" not in user_settings: 174 | user_settings["tools"] = {} 175 | if "valves" not in user_settings["tools"]: 176 | user_settings["tools"]["valves"] = {} 177 | 178 | user_settings["tools"]["valves"][id] = valves 179 | 180 | # Update the user settings in the database 181 | Users.update_user_by_id(user_id, {"settings": user_settings}) 182 | 183 | return user_settings["tools"]["valves"][id] 184 | except Exception as e: 185 | print(f"An error occurred: {e}") 186 | return None 187 | 188 | def update_tool_by_id(self, id: str, updated: dict) -> Optional[ToolModel]: 189 | try: 190 | with get_db() as db: 191 | db.query(Tool).filter_by(id=id).update( 192 | {**updated, "updated_at": int(time.time())} 193 | ) 194 | db.commit() 195 | 196 | tool = db.query(Tool).get(id) 197 | db.refresh(tool) 198 | return ToolModel.model_validate(tool) 199 | except: 200 | return None 201 | 202 | def delete_tool_by_id(self, id: str) -> bool: 203 | try: 204 | with get_db() as db: 205 | db.query(Tool).filter_by(id=id).delete() 206 | db.commit() 207 | 208 | return True 209 | except: 210 | return False 211 | 212 | 213 | Tools = ToolsTable() ``````` `\\?\D:\Coding\ai\backend\apps\webui\models\users.py`: ```````py 1 | from pydantic import BaseModel, ConfigDict, parse_obj_as 2 | from typing import List, Union, Optional 3 | import time 4 | 5 | from sqlalchemy import String, Column, BigInteger, Text 6 | 7 | from utils.misc import get_gravatar_url 8 | 9 | from apps.webui.internal.db import Base, JSONField, Session, get_db 10 | from apps.webui.models.chats import Chats 11 | 12 | #################### 13 | # User DB Schema 14 | #################### 15 | 16 | 17 | class User(Base): 18 | __tablename__ = "user" 19 | 20 | id = Column(String, primary_key=True) 21 | name = Column(String) 22 | email = Column(String) 23 | role = Column(String) 24 | profile_image_url = Column(Text) 25 | 26 | last_active_at = Column(BigInteger) 27 | updated_at = Column(BigInteger) 28 | created_at = Column(BigInteger) 29 | 30 | api_key = Column(String, nullable=True, unique=True) 31 | settings = Column(JSONField, nullable=True) 32 | info = Column(JSONField, nullable=True) 33 | 34 | oauth_sub = Column(Text, unique=True) 35 | 36 | 37 | class UserSettings(BaseModel): 38 | ui: Optional[dict] = {} 39 | model_config = ConfigDict(extra="allow") 40 | pass 41 | 42 | 43 | class UserModel(BaseModel): 44 | id: str 45 | name: str 46 | email: str 47 | role: str = "pending" 48 | profile_image_url: str 49 | 50 | last_active_at: int # timestamp in epoch 51 | updated_at: int # timestamp in epoch 52 | created_at: int # timestamp in epoch 53 | 54 | api_key: Optional[str] = None 55 | settings: Optional[UserSettings] = None 56 | info: Optional[dict] = None 57 | 58 | oauth_sub: Optional[str] = None 59 | 60 | model_config = ConfigDict(from_attributes=True) 61 | 62 | 63 | #################### 64 | # Forms 65 | #################### 66 | 67 | 68 | class UserRoleUpdateForm(BaseModel): 69 | id: str 70 | role: str 71 | 72 | 73 | class UserUpdateForm(BaseModel): 74 | name: str 75 | email: str 76 | profile_image_url: str 77 | password: Optional[str] = None 78 | 79 | 80 | class UsersTable: 81 | 82 | def insert_new_user( 83 | self, 84 | id: str, 85 | name: str, 86 | email: str, 87 | profile_image_url: str = "/user.png", 88 | role: str = "pending", 89 | oauth_sub: Optional[str] = None, 90 | ) -> Optional[UserModel]: 91 | with get_db() as db: 92 | user = UserModel( 93 | **{ 94 | "id": id, 95 | "name": name, 96 | "email": email, 97 | "role": role, 98 | "profile_image_url": profile_image_url, 99 | "last_active_at": int(time.time()), 100 | "created_at": int(time.time()), 101 | "updated_at": int(time.time()), 102 | "oauth_sub": oauth_sub, 103 | } 104 | ) 105 | result = User(**user.model_dump()) 106 | db.add(result) 107 | db.commit() 108 | db.refresh(result) 109 | if result: 110 | return user 111 | else: 112 | return None 113 | 114 | def get_user_by_id(self, id: str) -> Optional[UserModel]: 115 | try: 116 | with get_db() as db: 117 | user = db.query(User).filter_by(id=id).first() 118 | return UserModel.model_validate(user) 119 | except Exception as e: 120 | return None 121 | 122 | def get_user_by_api_key(self, api_key: str) -> Optional[UserModel]: 123 | try: 124 | with get_db() as db: 125 | 126 | user = db.query(User).filter_by(api_key=api_key).first() 127 | return UserModel.model_validate(user) 128 | except: 129 | return None 130 | 131 | def get_user_by_email(self, email: str) -> Optional[UserModel]: 132 | try: 133 | with get_db() as db: 134 | 135 | user = db.query(User).filter_by(email=email).first() 136 | return UserModel.model_validate(user) 137 | except: 138 | return None 139 | 140 | def get_user_by_oauth_sub(self, sub: str) -> Optional[UserModel]: 141 | try: 142 | with get_db() as db: 143 | 144 | user = db.query(User).filter_by(oauth_sub=sub).first() 145 | return UserModel.model_validate(user) 146 | except: 147 | return None 148 | 149 | def get_users(self, skip: int = 0, limit: int = 50) -> List[UserModel]: 150 | with get_db() as db: 151 | users = ( 152 | db.query(User) 153 | # .offset(skip).limit(limit) 154 | .all() 155 | ) 156 | return [UserModel.model_validate(user) for user in users] 157 | 158 | def get_num_users(self) -> Optional[int]: 159 | with get_db() as db: 160 | return db.query(User).count() 161 | 162 | def get_first_user(self) -> UserModel: 163 | try: 164 | with get_db() as db: 165 | user = db.query(User).order_by(User.created_at).first() 166 | return UserModel.model_validate(user) 167 | except: 168 | return None 169 | 170 | def update_user_role_by_id(self, id: str, role: str) -> Optional[UserModel]: 171 | try: 172 | with get_db() as db: 173 | db.query(User).filter_by(id=id).update({"role": role}) 174 | db.commit() 175 | user = db.query(User).filter_by(id=id).first() 176 | return UserModel.model_validate(user) 177 | except: 178 | return None 179 | 180 | def update_user_profile_image_url_by_id( 181 | self, id: str, profile_image_url: str 182 | ) -> Optional[UserModel]: 183 | try: 184 | with get_db() as db: 185 | db.query(User).filter_by(id=id).update( 186 | {"profile_image_url": profile_image_url} 187 | ) 188 | db.commit() 189 | 190 | user = db.query(User).filter_by(id=id).first() 191 | return UserModel.model_validate(user) 192 | except: 193 | return None 194 | 195 | def update_user_last_active_by_id(self, id: str) -> Optional[UserModel]: 196 | try: 197 | with get_db() as db: 198 | 199 | db.query(User).filter_by(id=id).update( 200 | {"last_active_at": int(time.time())} 201 | ) 202 | db.commit() 203 | 204 | user = db.query(User).filter_by(id=id).first() 205 | return UserModel.model_validate(user) 206 | except: 207 | return None 208 | 209 | def update_user_oauth_sub_by_id( 210 | self, id: str, oauth_sub: str 211 | ) -> Optional[UserModel]: 212 | try: 213 | with get_db() as db: 214 | db.query(User).filter_by(id=id).update({"oauth_sub": oauth_sub}) 215 | db.commit() 216 | 217 | user = db.query(User).filter_by(id=id).first() 218 | return UserModel.model_validate(user) 219 | except: 220 | return None 221 | 222 | def update_user_by_id(self, id: str, updated: dict) -> Optional[UserModel]: 223 | try: 224 | with get_db() as db: 225 | db.query(User).filter_by(id=id).update(updated) 226 | db.commit() 227 | 228 | user = db.query(User).filter_by(id=id).first() 229 | return UserModel.model_validate(user) 230 | # return UserModel(**user.dict()) 231 | except Exception as e: 232 | return None 233 | 234 | def delete_user_by_id(self, id: str) -> bool: 235 | try: 236 | # Delete User Chats 237 | result = Chats.delete_chats_by_user_id(id) 238 | 239 | if result: 240 | with get_db() as db: 241 | # Delete User 242 | db.query(User).filter_by(id=id).delete() 243 | db.commit() 244 | 245 | return True 246 | else: 247 | return False 248 | except: 249 | return False 250 | 251 | def update_user_api_key_by_id(self, id: str, api_key: str) -> str: 252 | try: 253 | with get_db() as db: 254 | result = db.query(User).filter_by(id=id).update({"api_key": api_key}) 255 | db.commit() 256 | return True if result == 1 else False 257 | except: 258 | return False 259 | 260 | def get_user_api_key_by_id(self, id: str) -> Optional[str]: 261 | try: 262 | with get_db() as db: 263 | user = db.query(User).filter_by(id=id).first() 264 | return user.api_key 265 | except Exception as e: 266 | return None 267 | 268 | 269 | Users = UsersTable() ``````` `\\?\D:\Coding\ai\backend\apps\webui\routers\auths.py`: ```````py 1 | import logging 2 | 3 | from fastapi import Request, UploadFile, File 4 | from fastapi import Depends, HTTPException, status 5 | from fastapi.responses import Response 6 | 7 | from fastapi import APIRouter 8 | from pydantic import BaseModel 9 | import re 10 | import uuid 11 | import csv 12 | 13 | from apps.webui.models.auths import ( 14 | SigninForm, 15 | SignupForm, 16 | AddUserForm, 17 | UpdateProfileForm, 18 | UpdatePasswordForm, 19 | UserResponse, 20 | SigninResponse, 21 | Auths, 22 | ApiKey, 23 | ) 24 | from apps.webui.models.users import Users 25 | 26 | from utils.utils import ( 27 | get_password_hash, 28 | get_current_user, 29 | get_admin_user, 30 | create_token, 31 | create_api_key, 32 | ) 33 | from utils.misc import parse_duration, validate_email_format 34 | from utils.webhook import post_webhook 35 | from constants import ERROR_MESSAGES, WEBHOOK_MESSAGES 36 | from config import ( 37 | WEBUI_AUTH, 38 | WEBUI_AUTH_TRUSTED_EMAIL_HEADER, 39 | WEBUI_AUTH_TRUSTED_NAME_HEADER, 40 | ) 41 | 42 | router = APIRouter() 43 | 44 | ############################ 45 | # GetSessionUser 46 | ############################ 47 | 48 | 49 | @router.get("/", response_model=UserResponse) 50 | async def get_session_user( 51 | request: Request, response: Response, user=Depends(get_current_user) 52 | ): 53 | token = create_token( 54 | data={"id": user.id}, 55 | expires_delta=parse_duration(request.app.state.config.JWT_EXPIRES_IN), 56 | ) 57 | 58 | # Set the cookie token 59 | response.set_cookie( 60 | key="token", 61 | value=token, 62 | httponly=True, # Ensures the cookie is not accessible via JavaScript 63 | ) 64 | 65 | return { 66 | "id": user.id, 67 | "email": user.email, 68 | "name": user.name, 69 | "role": user.role, 70 | "profile_image_url": user.profile_image_url, 71 | } 72 | 73 | 74 | ############################ 75 | # Update Profile 76 | ############################ 77 | 78 | 79 | @router.post("/update/profile", response_model=UserResponse) 80 | async def update_profile( 81 | form_data: UpdateProfileForm, session_user=Depends(get_current_user) 82 | ): 83 | if session_user: 84 | user = Users.update_user_by_id( 85 | session_user.id, 86 | {"profile_image_url": form_data.profile_image_url, "name": form_data.name}, 87 | ) 88 | if user: 89 | return user 90 | else: 91 | raise HTTPException(400, detail=ERROR_MESSAGES.DEFAULT()) 92 | else: 93 | raise HTTPException(400, detail=ERROR_MESSAGES.INVALID_CRED) 94 | 95 | 96 | ############################ 97 | # Update Password 98 | ############################ 99 | 100 | 101 | @router.post("/update/password", response_model=bool) 102 | async def update_password( 103 | form_data: UpdatePasswordForm, session_user=Depends(get_current_user) 104 | ): 105 | if WEBUI_AUTH_TRUSTED_EMAIL_HEADER: 106 | raise HTTPException(400, detail=ERROR_MESSAGES.ACTION_PROHIBITED) 107 | if session_user: 108 | user = Auths.authenticate_user(session_user.email, form_data.password) 109 | 110 | if user: 111 | hashed = get_password_hash(form_data.new_password) 112 | return Auths.update_user_password_by_id(user.id, hashed) 113 | else: 114 | raise HTTPException(400, detail=ERROR_MESSAGES.INVALID_PASSWORD) 115 | else: 116 | raise HTTPException(400, detail=ERROR_MESSAGES.INVALID_CRED) 117 | 118 | 119 | ############################ 120 | # SignIn 121 | ############################ 122 | 123 | 124 | @router.post("/signin", response_model=SigninResponse) 125 | async def signin(request: Request, response: Response, form_data: SigninForm): 126 | if WEBUI_AUTH_TRUSTED_EMAIL_HEADER: 127 | if WEBUI_AUTH_TRUSTED_EMAIL_HEADER not in request.headers: 128 | raise HTTPException(400, detail=ERROR_MESSAGES.INVALID_TRUSTED_HEADER) 129 | 130 | trusted_email = request.headers[WEBUI_AUTH_TRUSTED_EMAIL_HEADER].lower() 131 | trusted_name = trusted_email 132 | if WEBUI_AUTH_TRUSTED_NAME_HEADER: 133 | trusted_name = request.headers.get( 134 | WEBUI_AUTH_TRUSTED_NAME_HEADER, trusted_email 135 | ) 136 | if not Users.get_user_by_email(trusted_email.lower()): 137 | await signup( 138 | request, 139 | response, 140 | SignupForm( 141 | email=trusted_email, password=str(uuid.uuid4()), name=trusted_name 142 | ), 143 | ) 144 | user = Auths.authenticate_user_by_trusted_header(trusted_email) 145 | elif WEBUI_AUTH == False: 146 | admin_email = "admin@localhost" 147 | admin_password = "admin" 148 | 149 | if Users.get_user_by_email(admin_email.lower()): 150 | user = Auths.authenticate_user(admin_email.lower(), admin_password) 151 | else: 152 | if Users.get_num_users() != 0: 153 | raise HTTPException(400, detail=ERROR_MESSAGES.EXISTING_USERS) 154 | 155 | await signup( 156 | request, 157 | response, 158 | SignupForm(email=admin_email, password=admin_password, name="User"), 159 | ) 160 | 161 | user = Auths.authenticate_user(admin_email.lower(), admin_password) 162 | else: 163 | user = Auths.authenticate_user(form_data.email.lower(), form_data.password) 164 | 165 | if user: 166 | token = create_token( 167 | data={"id": user.id}, 168 | expires_delta=parse_duration(request.app.state.config.JWT_EXPIRES_IN), 169 | ) 170 | 171 | # Set the cookie token 172 | response.set_cookie( 173 | key="token", 174 | value=token, 175 | httponly=True, # Ensures the cookie is not accessible via JavaScript 176 | ) 177 | 178 | return { 179 | "token": token, 180 | "token_type": "Bearer", 181 | "id": user.id, 182 | "email": user.email, 183 | "name": user.name, 184 | "role": user.role, 185 | "profile_image_url": user.profile_image_url, 186 | } 187 | else: 188 | raise HTTPException(400, detail=ERROR_MESSAGES.INVALID_CRED) 189 | 190 | 191 | ############################ 192 | # SignUp 193 | ############################ 194 | 195 | 196 | @router.post("/signup", response_model=SigninResponse) 197 | async def signup(request: Request, response: Response, form_data: SignupForm): 198 | if not request.app.state.config.ENABLE_SIGNUP and WEBUI_AUTH: 199 | raise HTTPException( 200 | status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.ACCESS_PROHIBITED 201 | ) 202 | 203 | if not validate_email_format(form_data.email.lower()): 204 | raise HTTPException( 205 | status.HTTP_400_BAD_REQUEST, detail=ERROR_MESSAGES.INVALID_EMAIL_FORMAT 206 | ) 207 | 208 | if Users.get_user_by_email(form_data.email.lower()): 209 | raise HTTPException(400, detail=ERROR_MESSAGES.EMAIL_TAKEN) 210 | 211 | try: 212 | role = ( 213 | "admin" 214 | if Users.get_num_users() == 0 215 | else request.app.state.config.DEFAULT_USER_ROLE 216 | ) 217 | hashed = get_password_hash(form_data.password) 218 | user = Auths.insert_new_auth( 219 | form_data.email.lower(), 220 | hashed, 221 | form_data.name, 222 | form_data.profile_image_url, 223 | role, 224 | ) 225 | 226 | if user: 227 | token = create_token( 228 | data={"id": user.id}, 229 | expires_delta=parse_duration(request.app.state.config.JWT_EXPIRES_IN), 230 | ) 231 | # response.set_cookie(key='token', value=token, httponly=True) 232 | 233 | # Set the cookie token 234 | response.set_cookie( 235 | key="token", 236 | value=token, 237 | httponly=True, # Ensures the cookie is not accessible via JavaScript 238 | ) 239 | 240 | if request.app.state.config.WEBHOOK_URL: 241 | post_webhook( 242 | request.app.state.config.WEBHOOK_URL, 243 | WEBHOOK_MESSAGES.USER_SIGNUP(user.name), 244 | { 245 | "action": "signup", 246 | "message": WEBHOOK_MESSAGES.USER_SIGNUP(user.name), 247 | "user": user.model_dump_json(exclude_none=True), 248 | }, 249 | ) 250 | 251 | return { 252 | "token": token, 253 | "token_type": "Bearer", 254 | "id": user.id, 255 | "email": user.email, 256 | "name": user.name, 257 | "role": user.role, 258 | "profile_image_url": user.profile_image_url, 259 | } 260 | else: 261 | raise HTTPException(500, detail=ERROR_MESSAGES.CREATE_USER_ERROR) 262 | except Exception as err: 263 | raise HTTPException(500, detail=ERROR_MESSAGES.DEFAULT(err)) 264 | 265 | 266 | ############################ 267 | # AddUser 268 | ############################ 269 | 270 | 271 | @router.post("/add", response_model=SigninResponse) 272 | async def add_user(form_data: AddUserForm, user=Depends(get_admin_user)): 273 | 274 | if not validate_email_format(form_data.email.lower()): 275 | raise HTTPException( 276 | status.HTTP_400_BAD_REQUEST, detail=ERROR_MESSAGES.INVALID_EMAIL_FORMAT 277 | ) 278 | 279 | if Users.get_user_by_email(form_data.email.lower()): 280 | raise HTTPException(400, detail=ERROR_MESSAGES.EMAIL_TAKEN) 281 | 282 | try: 283 | 284 | print(form_data) 285 | hashed = get_password_hash(form_data.password) 286 | user = Auths.insert_new_auth( 287 | form_data.email.lower(), 288 | hashed, 289 | form_data.name, 290 | form_data.profile_image_url, 291 | form_data.role, 292 | ) 293 | 294 | if user: 295 | token = create_token(data={"id": user.id}) 296 | return { 297 | "token": token, 298 | "token_type": "Bearer", 299 | "id": user.id, 300 | "email": user.email, 301 | "name": user.name, 302 | "role": user.role, 303 | "profile_image_url": user.profile_image_url, 304 | } 305 | else: 306 | raise HTTPException(500, detail=ERROR_MESSAGES.CREATE_USER_ERROR) 307 | except Exception as err: 308 | raise HTTPException(500, detail=ERROR_MESSAGES.DEFAULT(err)) 309 | 310 | 311 | ############################ 312 | # GetAdminDetails 313 | ############################ 314 | 315 | 316 | @router.get("/admin/details") 317 | async def get_admin_details(request: Request, user=Depends(get_current_user)): 318 | if request.app.state.config.SHOW_ADMIN_DETAILS: 319 | admin_email = request.app.state.config.ADMIN_EMAIL 320 | admin_name = None 321 | 322 | print(admin_email, admin_name) 323 | 324 | if admin_email: 325 | admin = Users.get_user_by_email(admin_email) 326 | if admin: 327 | admin_name = admin.name 328 | else: 329 | admin = Users.get_first_user() 330 | if admin: 331 | admin_email = admin.email 332 | admin_name = admin.name 333 | 334 | return { 335 | "name": admin_name, 336 | "email": admin_email, 337 | } 338 | else: 339 | raise HTTPException(400, detail=ERROR_MESSAGES.ACTION_PROHIBITED) 340 | 341 | 342 | ############################ 343 | # ToggleSignUp 344 | ############################ 345 | 346 | 347 | @router.get("/admin/config") 348 | async def get_admin_config(request: Request, user=Depends(get_admin_user)): 349 | return { 350 | "SHOW_ADMIN_DETAILS": request.app.state.config.SHOW_ADMIN_DETAILS, 351 | "ENABLE_SIGNUP": request.app.state.config.ENABLE_SIGNUP, 352 | "DEFAULT_USER_ROLE": request.app.state.config.DEFAULT_USER_ROLE, 353 | "JWT_EXPIRES_IN": request.app.state.config.JWT_EXPIRES_IN, 354 | "ENABLE_COMMUNITY_SHARING": request.app.state.config.ENABLE_COMMUNITY_SHARING, 355 | } 356 | 357 | 358 | class AdminConfig(BaseModel): 359 | SHOW_ADMIN_DETAILS: bool 360 | ENABLE_SIGNUP: bool 361 | DEFAULT_USER_ROLE: str 362 | JWT_EXPIRES_IN: str 363 | ENABLE_COMMUNITY_SHARING: bool 364 | 365 | 366 | @router.post("/admin/config") 367 | async def update_admin_config( 368 | request: Request, form_data: AdminConfig, user=Depends(get_admin_user) 369 | ): 370 | request.app.state.config.SHOW_ADMIN_DETAILS = form_data.SHOW_ADMIN_DETAILS 371 | request.app.state.config.ENABLE_SIGNUP = form_data.ENABLE_SIGNUP 372 | 373 | if form_data.DEFAULT_USER_ROLE in ["pending", "user", "admin"]: 374 | request.app.state.config.DEFAULT_USER_ROLE = form_data.DEFAULT_USER_ROLE 375 | 376 | pattern = r"^(-1|0|(-?\d+(\.\d+)?)(ms|s|m|h|d|w))$" 377 | 378 | # Check if the input string matches the pattern 379 | if re.match(pattern, form_data.JWT_EXPIRES_IN): 380 | request.app.state.config.JWT_EXPIRES_IN = form_data.JWT_EXPIRES_IN 381 | 382 | request.app.state.config.ENABLE_COMMUNITY_SHARING = ( 383 | form_data.ENABLE_COMMUNITY_SHARING 384 | ) 385 | 386 | return { 387 | "SHOW_ADMIN_DETAILS": request.app.state.config.SHOW_ADMIN_DETAILS, 388 | "ENABLE_SIGNUP": request.app.state.config.ENABLE_SIGNUP, 389 | "DEFAULT_USER_ROLE": request.app.state.config.DEFAULT_USER_ROLE, 390 | "JWT_EXPIRES_IN": request.app.state.config.JWT_EXPIRES_IN, 391 | "ENABLE_COMMUNITY_SHARING": request.app.state.config.ENABLE_COMMUNITY_SHARING, 392 | } 393 | 394 | 395 | ############################ 396 | # API Key 397 | ############################ 398 | 399 | 400 | # create api key 401 | @router.post("/api_key", response_model=ApiKey) 402 | async def create_api_key_(user=Depends(get_current_user)): 403 | api_key = create_api_key() 404 | success = Users.update_user_api_key_by_id(user.id, api_key) 405 | if success: 406 | return { 407 | "api_key": api_key, 408 | } 409 | else: 410 | raise HTTPException(500, detail=ERROR_MESSAGES.CREATE_API_KEY_ERROR) 411 | 412 | 413 | # delete api key 414 | @router.delete("/api_key", response_model=bool) 415 | async def delete_api_key(user=Depends(get_current_user)): 416 | success = Users.update_user_api_key_by_id(user.id, None) 417 | return success 418 | 419 | 420 | # get api key 421 | @router.get("/api_key", response_model=ApiKey) 422 | async def get_api_key(user=Depends(get_current_user)): 423 | api_key = Users.get_user_api_key_by_id(user.id) 424 | if api_key: 425 | return { 426 | "api_key": api_key, 427 | } 428 | else: 429 | raise HTTPException(404, detail=ERROR_MESSAGES.API_KEY_NOT_FOUND) ``````` `\\?\D:\Coding\ai\backend\apps\webui\routers\chats.py`: ```````py 1 | from fastapi import Depends, Request, HTTPException, status 2 | from datetime import datetime, timedelta 3 | from typing import List, Union, Optional 4 | from utils.utils import get_verified_user, get_admin_user 5 | from fastapi import APIRouter 6 | from pydantic import BaseModel 7 | import json 8 | import logging 9 | 10 | from apps.webui.models.users import Users 11 | from apps.webui.models.chats import ( 12 | ChatModel, 13 | ChatResponse, 14 | ChatTitleForm, 15 | ChatForm, 16 | ChatTitleIdResponse, 17 | Chats, 18 | ) 19 | 20 | 21 | from apps.webui.models.tags import ( 22 | TagModel, 23 | ChatIdTagModel, 24 | ChatIdTagForm, 25 | ChatTagsResponse, 26 | Tags, 27 | ) 28 | 29 | from constants import ERROR_MESSAGES 30 | 31 | from config import SRC_LOG_LEVELS, ENABLE_ADMIN_EXPORT 32 | 33 | log = logging.getLogger(__name__) 34 | log.setLevel(SRC_LOG_LEVELS["MODELS"]) 35 | 36 | router = APIRouter() 37 | 38 | ############################ 39 | # GetChatList 40 | ############################ 41 | 42 | 43 | @router.get("/", response_model=List[ChatTitleIdResponse]) 44 | @router.get("/list", response_model=List[ChatTitleIdResponse]) 45 | async def get_session_user_chat_list( 46 | user=Depends(get_verified_user), skip: int = 0, limit: int = 50 47 | ): 48 | return Chats.get_chat_title_id_list_by_user_id(user.id, skip=skip, limit=limit) 49 | 50 | 51 | ############################ 52 | # DeleteAllChats 53 | ############################ 54 | 55 | 56 | @router.delete("/", response_model=bool) 57 | async def delete_all_user_chats(request: Request, user=Depends(get_verified_user)): 58 | 59 | if ( 60 | user.role == "user" 61 | and not request.app.state.config.USER_PERMISSIONS["chat"]["deletion"] 62 | ): 63 | raise HTTPException( 64 | status_code=status.HTTP_401_UNAUTHORIZED, 65 | detail=ERROR_MESSAGES.ACCESS_PROHIBITED, 66 | ) 67 | 68 | result = Chats.delete_chats_by_user_id(user.id) 69 | return result 70 | 71 | 72 | ############################ 73 | # GetUserChatList 74 | ############################ 75 | 76 | 77 | @router.get("/list/user/{user_id}", response_model=List[ChatTitleIdResponse]) 78 | async def get_user_chat_list_by_user_id( 79 | user_id: str, 80 | user=Depends(get_admin_user), 81 | skip: int = 0, 82 | limit: int = 50, 83 | ): 84 | return Chats.get_chat_list_by_user_id( 85 | user_id, include_archived=True, skip=skip, limit=limit 86 | ) 87 | 88 | 89 | ############################ 90 | # CreateNewChat 91 | ############################ 92 | 93 | 94 | @router.post("/new", response_model=Optional[ChatResponse]) 95 | async def create_new_chat(form_data: ChatForm, user=Depends(get_verified_user)): 96 | try: 97 | chat = Chats.insert_new_chat(user.id, form_data) 98 | return ChatResponse(**{**chat.model_dump(), "chat": json.loads(chat.chat)}) 99 | except Exception as e: 100 | log.exception(e) 101 | raise HTTPException( 102 | status_code=status.HTTP_400_BAD_REQUEST, detail=ERROR_MESSAGES.DEFAULT() 103 | ) 104 | 105 | 106 | ############################ 107 | # GetChats 108 | ############################ 109 | 110 | 111 | @router.get("/all", response_model=List[ChatResponse]) 112 | async def get_user_chats(user=Depends(get_verified_user)): 113 | return [ 114 | ChatResponse(**{**chat.model_dump(), "chat": json.loads(chat.chat)}) 115 | for chat in Chats.get_chats_by_user_id(user.id) 116 | ] 117 | 118 | 119 | ############################ 120 | # GetArchivedChats 121 | ############################ 122 | 123 | 124 | @router.get("/all/archived", response_model=List[ChatResponse]) 125 | async def get_user_archived_chats(user=Depends(get_verified_user)): 126 | return [ 127 | ChatResponse(**{**chat.model_dump(), "chat": json.loads(chat.chat)}) 128 | for chat in Chats.get_archived_chats_by_user_id(user.id) 129 | ] 130 | 131 | 132 | ############################ 133 | # GetAllChatsInDB 134 | ############################ 135 | 136 | 137 | @router.get("/all/db", response_model=List[ChatResponse]) 138 | async def get_all_user_chats_in_db(user=Depends(get_admin_user)): 139 | if not ENABLE_ADMIN_EXPORT: 140 | raise HTTPException( 141 | status_code=status.HTTP_401_UNAUTHORIZED, 142 | detail=ERROR_MESSAGES.ACCESS_PROHIBITED, 143 | ) 144 | return [ 145 | ChatResponse(**{**chat.model_dump(), "chat": json.loads(chat.chat)}) 146 | for chat in Chats.get_chats() 147 | ] 148 | 149 | 150 | ############################ 151 | # GetArchivedChats 152 | ############################ 153 | 154 | 155 | @router.get("/archived", response_model=List[ChatTitleIdResponse]) 156 | async def get_archived_session_user_chat_list( 157 | user=Depends(get_verified_user), skip: int = 0, limit: int = 50 158 | ): 159 | return Chats.get_archived_chat_list_by_user_id(user.id, skip, limit) 160 | 161 | 162 | ############################ 163 | # ArchiveAllChats 164 | ############################ 165 | 166 | 167 | @router.post("/archive/all", response_model=bool) 168 | async def archive_all_chats(user=Depends(get_verified_user)): 169 | return Chats.archive_all_chats_by_user_id(user.id) 170 | 171 | 172 | ############################ 173 | # GetSharedChatById 174 | ############################ 175 | 176 | 177 | @router.get("/share/{share_id}", response_model=Optional[ChatResponse]) 178 | async def get_shared_chat_by_id(share_id: str, user=Depends(get_verified_user)): 179 | if user.role == "pending": 180 | raise HTTPException( 181 | status_code=status.HTTP_401_UNAUTHORIZED, detail=ERROR_MESSAGES.NOT_FOUND 182 | ) 183 | 184 | if user.role == "user": 185 | chat = Chats.get_chat_by_share_id(share_id) 186 | elif user.role == "admin": 187 | chat = Chats.get_chat_by_id(share_id) 188 | 189 | if chat: 190 | return ChatResponse(**{**chat.model_dump(), "chat": json.loads(chat.chat)}) 191 | else: 192 | raise HTTPException( 193 | status_code=status.HTTP_401_UNAUTHORIZED, detail=ERROR_MESSAGES.NOT_FOUND 194 | ) 195 | 196 | 197 | ############################ 198 | # GetChatsByTags 199 | ############################ 200 | 201 | 202 | class TagNameForm(BaseModel): 203 | name: str 204 | skip: Optional[int] = 0 205 | limit: Optional[int] = 50 206 | 207 | 208 | @router.post("/tags", response_model=List[ChatTitleIdResponse]) 209 | async def get_user_chat_list_by_tag_name( 210 | form_data: TagNameForm, user=Depends(get_verified_user) 211 | ): 212 | 213 | chat_ids = [ 214 | chat_id_tag.chat_id 215 | for chat_id_tag in Tags.get_chat_ids_by_tag_name_and_user_id( 216 | form_data.name, user.id 217 | ) 218 | ] 219 | 220 | chats = Chats.get_chat_list_by_chat_ids(chat_ids, form_data.skip, form_data.limit) 221 | 222 | if len(chats) == 0: 223 | Tags.delete_tag_by_tag_name_and_user_id(form_data.name, user.id) 224 | 225 | return chats 226 | 227 | 228 | ############################ 229 | # GetAllTags 230 | ############################ 231 | 232 | 233 | @router.get("/tags/all", response_model=List[TagModel]) 234 | async def get_all_tags(user=Depends(get_verified_user)): 235 | try: 236 | tags = Tags.get_tags_by_user_id(user.id) 237 | return tags 238 | except Exception as e: 239 | log.exception(e) 240 | raise HTTPException( 241 | status_code=status.HTTP_400_BAD_REQUEST, detail=ERROR_MESSAGES.DEFAULT() 242 | ) 243 | 244 | 245 | ############################ 246 | # GetChatById 247 | ############################ 248 | 249 | 250 | @router.get("/{id}", response_model=Optional[ChatResponse]) 251 | async def get_chat_by_id(id: str, user=Depends(get_verified_user)): 252 | chat = Chats.get_chat_by_id_and_user_id(id, user.id) 253 | 254 | if chat: 255 | return ChatResponse(**{**chat.model_dump(), "chat": json.loads(chat.chat)}) 256 | else: 257 | raise HTTPException( 258 | status_code=status.HTTP_401_UNAUTHORIZED, detail=ERROR_MESSAGES.NOT_FOUND 259 | ) 260 | 261 | 262 | ############################ 263 | # UpdateChatById 264 | ############################ 265 | 266 | 267 | @router.post("/{id}", response_model=Optional[ChatResponse]) 268 | async def update_chat_by_id( 269 | id: str, form_data: ChatForm, user=Depends(get_verified_user) 270 | ): 271 | chat = Chats.get_chat_by_id_and_user_id(id, user.id) 272 | if chat: 273 | updated_chat = {**json.loads(chat.chat), **form_data.chat} 274 | 275 | chat = Chats.update_chat_by_id(id, updated_chat) 276 | return ChatResponse(**{**chat.model_dump(), "chat": json.loads(chat.chat)}) 277 | else: 278 | raise HTTPException( 279 | status_code=status.HTTP_401_UNAUTHORIZED, 280 | detail=ERROR_MESSAGES.ACCESS_PROHIBITED, 281 | ) 282 | 283 | 284 | ############################ 285 | # DeleteChatById 286 | ############################ 287 | 288 | 289 | @router.delete("/{id}", response_model=bool) 290 | async def delete_chat_by_id(request: Request, id: str, user=Depends(get_verified_user)): 291 | 292 | if user.role == "admin": 293 | result = Chats.delete_chat_by_id(id) 294 | return result 295 | else: 296 | if not request.app.state.config.USER_PERMISSIONS["chat"]["deletion"]: 297 | raise HTTPException( 298 | status_code=status.HTTP_401_UNAUTHORIZED, 299 | detail=ERROR_MESSAGES.ACCESS_PROHIBITED, 300 | ) 301 | 302 | result = Chats.delete_chat_by_id_and_user_id(id, user.id) 303 | return result 304 | 305 | 306 | ############################ 307 | # CloneChat 308 | ############################ 309 | 310 | 311 | @router.get("/{id}/clone", response_model=Optional[ChatResponse]) 312 | async def clone_chat_by_id(id: str, user=Depends(get_verified_user)): 313 | chat = Chats.get_chat_by_id_and_user_id(id, user.id) 314 | if chat: 315 | 316 | chat_body = json.loads(chat.chat) 317 | print(chat_body) 318 | updated_chat = { 319 | **chat_body, 320 | "originalChatId": chat.id, 321 | "branchPointMessageId": chat_body["history"]["currentId"], 322 | "title": f"Clone of {chat.title}", 323 | } 324 | chat = Chats.insert_new_chat(user.id, ChatForm(**{"chat": updated_chat})) 325 | return ChatResponse(**{**chat.model_dump(), "chat": json.loads(chat.chat)}) 326 | else: 327 | raise HTTPException( 328 | status_code=status.HTTP_401_UNAUTHORIZED, detail=ERROR_MESSAGES.DEFAULT() 329 | ) 330 | 331 | 332 | ############################ 333 | # ArchiveChat 334 | ############################ 335 | 336 | 337 | @router.get("/{id}/archive", response_model=Optional[ChatResponse]) 338 | async def archive_chat_by_id(id: str, user=Depends(get_verified_user)): 339 | chat = Chats.get_chat_by_id_and_user_id(id, user.id) 340 | if chat: 341 | chat = Chats.toggle_chat_archive_by_id(id) 342 | return ChatResponse(**{**chat.model_dump(), "chat": json.loads(chat.chat)}) 343 | else: 344 | raise HTTPException( 345 | status_code=status.HTTP_401_UNAUTHORIZED, detail=ERROR_MESSAGES.DEFAULT() 346 | ) 347 | 348 | 349 | ############################ 350 | # ShareChatById 351 | ############################ 352 | 353 | 354 | @router.post("/{id}/share", response_model=Optional[ChatResponse]) 355 | async def share_chat_by_id(id: str, user=Depends(get_verified_user)): 356 | chat = Chats.get_chat_by_id_and_user_id(id, user.id) 357 | if chat: 358 | if chat.share_id: 359 | shared_chat = Chats.update_shared_chat_by_chat_id(chat.id) 360 | return ChatResponse( 361 | **{**shared_chat.model_dump(), "chat": json.loads(shared_chat.chat)} 362 | ) 363 | 364 | shared_chat = Chats.insert_shared_chat_by_chat_id(chat.id) 365 | if not shared_chat: 366 | raise HTTPException( 367 | status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, 368 | detail=ERROR_MESSAGES.DEFAULT(), 369 | ) 370 | 371 | return ChatResponse( 372 | **{**shared_chat.model_dump(), "chat": json.loads(shared_chat.chat)} 373 | ) 374 | else: 375 | raise HTTPException( 376 | status_code=status.HTTP_401_UNAUTHORIZED, 377 | detail=ERROR_MESSAGES.ACCESS_PROHIBITED, 378 | ) 379 | 380 | 381 | ############################ 382 | # DeletedSharedChatById 383 | ############################ 384 | 385 | 386 | @router.delete("/{id}/share", response_model=Optional[bool]) 387 | async def delete_shared_chat_by_id(id: str, user=Depends(get_verified_user)): 388 | chat = Chats.get_chat_by_id_and_user_id(id, user.id) 389 | if chat: 390 | if not chat.share_id: 391 | return False 392 | 393 | result = Chats.delete_shared_chat_by_chat_id(id) 394 | update_result = Chats.update_chat_share_id_by_id(id, None) 395 | 396 | return result and update_result != None 397 | else: 398 | raise HTTPException( 399 | status_code=status.HTTP_401_UNAUTHORIZED, 400 | detail=ERROR_MESSAGES.ACCESS_PROHIBITED, 401 | ) 402 | 403 | 404 | ############################ 405 | # GetChatTagsById 406 | ############################ 407 | 408 | 409 | @router.get("/{id}/tags", response_model=List[TagModel]) 410 | async def get_chat_tags_by_id(id: str, user=Depends(get_verified_user)): 411 | tags = Tags.get_tags_by_chat_id_and_user_id(id, user.id) 412 | 413 | if tags != None: 414 | return tags 415 | else: 416 | raise HTTPException( 417 | status_code=status.HTTP_401_UNAUTHORIZED, detail=ERROR_MESSAGES.NOT_FOUND 418 | ) 419 | 420 | 421 | ############################ 422 | # AddChatTagById 423 | ############################ 424 | 425 | 426 | @router.post("/{id}/tags", response_model=Optional[ChatIdTagModel]) 427 | async def add_chat_tag_by_id( 428 | id: str, form_data: ChatIdTagForm, user=Depends(get_verified_user) 429 | ): 430 | tags = Tags.get_tags_by_chat_id_and_user_id(id, user.id) 431 | 432 | if form_data.tag_name not in tags: 433 | tag = Tags.add_tag_to_chat(user.id, form_data) 434 | 435 | if tag: 436 | return tag 437 | else: 438 | raise HTTPException( 439 | status_code=status.HTTP_401_UNAUTHORIZED, 440 | detail=ERROR_MESSAGES.NOT_FOUND, 441 | ) 442 | else: 443 | raise HTTPException( 444 | status_code=status.HTTP_401_UNAUTHORIZED, detail=ERROR_MESSAGES.DEFAULT() 445 | ) 446 | 447 | 448 | ############################ 449 | # DeleteChatTagById 450 | ############################ 451 | 452 | 453 | @router.delete("/{id}/tags", response_model=Optional[bool]) 454 | async def delete_chat_tag_by_id( 455 | id: str, form_data: ChatIdTagForm, user=Depends(get_verified_user) 456 | ): 457 | result = Tags.delete_tag_by_tag_name_and_chat_id_and_user_id( 458 | form_data.tag_name, id, user.id 459 | ) 460 | 461 | if result: 462 | return result 463 | else: 464 | raise HTTPException( 465 | status_code=status.HTTP_401_UNAUTHORIZED, detail=ERROR_MESSAGES.NOT_FOUND 466 | ) 467 | 468 | 469 | ############################ 470 | # DeleteAllChatTagsById 471 | ############################ 472 | 473 | 474 | @router.delete("/{id}/tags/all", response_model=Optional[bool]) 475 | async def delete_all_chat_tags_by_id(id: str, user=Depends(get_verified_user)): 476 | result = Tags.delete_tags_by_chat_id_and_user_id(id, user.id) 477 | 478 | if result: 479 | return result 480 | else: 481 | raise HTTPException( 482 | status_code=status.HTTP_401_UNAUTHORIZED, detail=ERROR_MESSAGES.NOT_FOUND 483 | ) ``````` `\\?\D:\Coding\ai\backend\apps\webui\routers\configs.py`: ```````py 1 | from fastapi import Response, Request 2 | from fastapi import Depends, FastAPI, HTTPException, status 3 | from datetime import datetime, timedelta 4 | from typing import List, Union 5 | 6 | from fastapi import APIRouter 7 | from pydantic import BaseModel 8 | import time 9 | import uuid 10 | 11 | from config import BannerModel 12 | 13 | from apps.webui.models.users import Users 14 | 15 | from utils.utils import ( 16 | get_password_hash, 17 | get_verified_user, 18 | get_admin_user, 19 | create_token, 20 | ) 21 | from utils.misc import get_gravatar_url, validate_email_format 22 | from constants import ERROR_MESSAGES 23 | 24 | router = APIRouter() 25 | 26 | 27 | class SetDefaultModelsForm(BaseModel): 28 | models: str 29 | 30 | 31 | class PromptSuggestion(BaseModel): 32 | title: List[str] 33 | content: str 34 | 35 | 36 | class SetDefaultSuggestionsForm(BaseModel): 37 | suggestions: List[PromptSuggestion] 38 | 39 | 40 | ############################ 41 | # SetDefaultModels 42 | ############################ 43 | 44 | 45 | @router.post("/default/models", response_model=str) 46 | async def set_global_default_models( 47 | request: Request, form_data: SetDefaultModelsForm, user=Depends(get_admin_user) 48 | ): 49 | request.app.state.config.DEFAULT_MODELS = form_data.models 50 | return request.app.state.config.DEFAULT_MODELS 51 | 52 | 53 | @router.post("/default/suggestions", response_model=List[PromptSuggestion]) 54 | async def set_global_default_suggestions( 55 | request: Request, 56 | form_data: SetDefaultSuggestionsForm, 57 | user=Depends(get_admin_user), 58 | ): 59 | data = form_data.model_dump() 60 | request.app.state.config.DEFAULT_PROMPT_SUGGESTIONS = data["suggestions"] 61 | return request.app.state.config.DEFAULT_PROMPT_SUGGESTIONS 62 | 63 | 64 | ############################ 65 | # SetBanners 66 | ############################ 67 | 68 | 69 | class SetBannersForm(BaseModel): 70 | banners: List[BannerModel] 71 | 72 | 73 | @router.post("/banners", response_model=List[BannerModel]) 74 | async def set_banners( 75 | request: Request, 76 | form_data: SetBannersForm, 77 | user=Depends(get_admin_user), 78 | ): 79 | data = form_data.model_dump() 80 | request.app.state.config.BANNERS = data["banners"] 81 | return request.app.state.config.BANNERS 82 | 83 | 84 | @router.get("/banners", response_model=List[BannerModel]) 85 | async def get_banners( 86 | request: Request, 87 | user=Depends(get_verified_user), 88 | ): 89 | return request.app.state.config.BANNERS ``````` `\\?\D:\Coding\ai\backend\apps\webui\routers\documents.py`: ```````py 1 | from fastapi import Depends, FastAPI, HTTPException, status 2 | from datetime import datetime, timedelta 3 | from typing import List, Union, Optional 4 | 5 | from fastapi import APIRouter 6 | from pydantic import BaseModel 7 | import json 8 | 9 | from apps.webui.models.documents import ( 10 | Documents, 11 | DocumentForm, 12 | DocumentUpdateForm, 13 | DocumentModel, 14 | DocumentResponse, 15 | ) 16 | 17 | from utils.utils import get_verified_user, get_admin_user 18 | from constants import ERROR_MESSAGES 19 | 20 | router = APIRouter() 21 | 22 | ############################ 23 | # GetDocuments 24 | ############################ 25 | 26 | 27 | @router.get("/", response_model=List[DocumentResponse]) 28 | async def get_documents(user=Depends(get_verified_user)): 29 | docs = [ 30 | DocumentResponse( 31 | **{ 32 | **doc.model_dump(), 33 | "content": json.loads(doc.content if doc.content else "{}"), 34 | } 35 | ) 36 | for doc in Documents.get_docs() 37 | ] 38 | return docs 39 | 40 | 41 | ############################ 42 | # CreateNewDoc 43 | ############################ 44 | 45 | 46 | @router.post("/create", response_model=Optional[DocumentResponse]) 47 | async def create_new_doc(form_data: DocumentForm, user=Depends(get_admin_user)): 48 | doc = Documents.get_doc_by_name(form_data.name) 49 | if doc == None: 50 | doc = Documents.insert_new_doc(user.id, form_data) 51 | 52 | if doc: 53 | return DocumentResponse( 54 | **{ 55 | **doc.model_dump(), 56 | "content": json.loads(doc.content if doc.content else "{}"), 57 | } 58 | ) 59 | else: 60 | raise HTTPException( 61 | status_code=status.HTTP_400_BAD_REQUEST, 62 | detail=ERROR_MESSAGES.FILE_EXISTS, 63 | ) 64 | else: 65 | raise HTTPException( 66 | status_code=status.HTTP_400_BAD_REQUEST, 67 | detail=ERROR_MESSAGES.NAME_TAG_TAKEN, 68 | ) 69 | 70 | 71 | ############################ 72 | # GetDocByName 73 | ############################ 74 | 75 | 76 | @router.get("/doc", response_model=Optional[DocumentResponse]) 77 | async def get_doc_by_name(name: str, user=Depends(get_verified_user)): 78 | doc = Documents.get_doc_by_name(name) 79 | 80 | if doc: 81 | return DocumentResponse( 82 | **{ 83 | **doc.model_dump(), 84 | "content": json.loads(doc.content if doc.content else "{}"), 85 | } 86 | ) 87 | else: 88 | raise HTTPException( 89 | status_code=status.HTTP_401_UNAUTHORIZED, 90 | detail=ERROR_MESSAGES.NOT_FOUND, 91 | ) 92 | 93 | 94 | ############################ 95 | # TagDocByName 96 | ############################ 97 | 98 | 99 | class TagItem(BaseModel): 100 | name: str 101 | 102 | 103 | class TagDocumentForm(BaseModel): 104 | name: str 105 | tags: List[dict] 106 | 107 | 108 | @router.post("/doc/tags", response_model=Optional[DocumentResponse]) 109 | async def tag_doc_by_name(form_data: TagDocumentForm, user=Depends(get_verified_user)): 110 | doc = Documents.update_doc_content_by_name(form_data.name, {"tags": form_data.tags}) 111 | 112 | if doc: 113 | return DocumentResponse( 114 | **{ 115 | **doc.model_dump(), 116 | "content": json.loads(doc.content if doc.content else "{}"), 117 | } 118 | ) 119 | else: 120 | raise HTTPException( 121 | status_code=status.HTTP_401_UNAUTHORIZED, 122 | detail=ERROR_MESSAGES.NOT_FOUND, 123 | ) 124 | 125 | 126 | ############################ 127 | # UpdateDocByName 128 | ############################ 129 | 130 | 131 | @router.post("/doc/update", response_model=Optional[DocumentResponse]) 132 | async def update_doc_by_name( 133 | name: str, 134 | form_data: DocumentUpdateForm, 135 | user=Depends(get_admin_user), 136 | ): 137 | doc = Documents.update_doc_by_name(name, form_data) 138 | if doc: 139 | return DocumentResponse( 140 | **{ 141 | **doc.model_dump(), 142 | "content": json.loads(doc.content if doc.content else "{}"), 143 | } 144 | ) 145 | else: 146 | raise HTTPException( 147 | status_code=status.HTTP_400_BAD_REQUEST, 148 | detail=ERROR_MESSAGES.NAME_TAG_TAKEN, 149 | ) 150 | 151 | 152 | ############################ 153 | # DeleteDocByName 154 | ############################ 155 | 156 | 157 | @router.delete("/doc/delete", response_model=bool) 158 | async def delete_doc_by_name(name: str, user=Depends(get_admin_user)): 159 | result = Documents.delete_doc_by_name(name) 160 | return result ``````` `\\?\D:\Coding\ai\backend\apps\webui\routers\files.py`: ```````py 1 | from fastapi import ( 2 | Depends, 3 | FastAPI, 4 | HTTPException, 5 | status, 6 | Request, 7 | UploadFile, 8 | File, 9 | Form, 10 | ) 11 | 12 | 13 | from datetime import datetime, timedelta 14 | from typing import List, Union, Optional 15 | from pathlib import Path 16 | 17 | from fastapi import APIRouter 18 | from fastapi.responses import StreamingResponse, JSONResponse, FileResponse 19 | 20 | from pydantic import BaseModel 21 | import json 22 | 23 | from apps.webui.models.files import ( 24 | Files, 25 | FileForm, 26 | FileModel, 27 | FileModelResponse, 28 | ) 29 | from utils.utils import get_verified_user, get_admin_user 30 | from constants import ERROR_MESSAGES 31 | 32 | from importlib import util 33 | import os 34 | import uuid 35 | import os, shutil, logging, re 36 | 37 | 38 | from config import SRC_LOG_LEVELS, UPLOAD_DIR 39 | 40 | 41 | log = logging.getLogger(__name__) 42 | log.setLevel(SRC_LOG_LEVELS["MODELS"]) 43 | 44 | 45 | router = APIRouter() 46 | 47 | ############################ 48 | # Upload File 49 | ############################ 50 | 51 | 52 | @router.post("/") 53 | def upload_file(file: UploadFile = File(...), user=Depends(get_verified_user)): 54 | log.info(f"file.content_type: {file.content_type}") 55 | try: 56 | unsanitized_filename = file.filename 57 | filename = os.path.basename(unsanitized_filename) 58 | 59 | # replace filename with uuid 60 | id = str(uuid.uuid4()) 61 | name = filename 62 | filename = f"{id}_{filename}" 63 | file_path = f"{UPLOAD_DIR}/{filename}" 64 | 65 | contents = file.file.read() 66 | with open(file_path, "wb") as f: 67 | f.write(contents) 68 | f.close() 69 | 70 | file = Files.insert_new_file( 71 | user.id, 72 | FileForm( 73 | **{ 74 | "id": id, 75 | "filename": filename, 76 | "meta": { 77 | "name": name, 78 | "content_type": file.content_type, 79 | "size": len(contents), 80 | "path": file_path, 81 | }, 82 | } 83 | ), 84 | ) 85 | 86 | if file: 87 | return file 88 | else: 89 | raise HTTPException( 90 | status_code=status.HTTP_400_BAD_REQUEST, 91 | detail=ERROR_MESSAGES.DEFAULT("Error uploading file"), 92 | ) 93 | 94 | except Exception as e: 95 | log.exception(e) 96 | raise HTTPException( 97 | status_code=status.HTTP_400_BAD_REQUEST, 98 | detail=ERROR_MESSAGES.DEFAULT(e), 99 | ) 100 | 101 | 102 | ############################ 103 | # List Files 104 | ############################ 105 | 106 | 107 | @router.get("/", response_model=List[FileModel]) 108 | async def list_files(user=Depends(get_verified_user)): 109 | files = Files.get_files() 110 | return files 111 | 112 | 113 | ############################ 114 | # Delete All Files 115 | ############################ 116 | 117 | 118 | @router.delete("/all") 119 | async def delete_all_files(user=Depends(get_admin_user)): 120 | result = Files.delete_all_files() 121 | 122 | if result: 123 | folder = f"{UPLOAD_DIR}" 124 | try: 125 | # Check if the directory exists 126 | if os.path.exists(folder): 127 | # Iterate over all the files and directories in the specified directory 128 | for filename in os.listdir(folder): 129 | file_path = os.path.join(folder, filename) 130 | try: 131 | if os.path.isfile(file_path) or os.path.islink(file_path): 132 | os.unlink(file_path) # Remove the file or link 133 | elif os.path.isdir(file_path): 134 | shutil.rmtree(file_path) # Remove the directory 135 | except Exception as e: 136 | print(f"Failed to delete {file_path}. Reason: {e}") 137 | else: 138 | print(f"The directory {folder} does not exist") 139 | except Exception as e: 140 | print(f"Failed to process the directory {folder}. Reason: {e}") 141 | 142 | return {"message": "All files deleted successfully"} 143 | else: 144 | raise HTTPException( 145 | status_code=status.HTTP_400_BAD_REQUEST, 146 | detail=ERROR_MESSAGES.DEFAULT("Error deleting files"), 147 | ) 148 | 149 | 150 | ############################ 151 | # Get File By Id 152 | ############################ 153 | 154 | 155 | @router.get("/{id}", response_model=Optional[FileModel]) 156 | async def get_file_by_id(id: str, user=Depends(get_verified_user)): 157 | file = Files.get_file_by_id(id) 158 | 159 | if file: 160 | return file 161 | else: 162 | raise HTTPException( 163 | status_code=status.HTTP_404_NOT_FOUND, 164 | detail=ERROR_MESSAGES.NOT_FOUND, 165 | ) 166 | 167 | 168 | ############################ 169 | # Get File Content By Id 170 | ############################ 171 | 172 | 173 | @router.get("/{id}/content", response_model=Optional[FileModel]) 174 | async def get_file_content_by_id(id: str, user=Depends(get_verified_user)): 175 | file = Files.get_file_by_id(id) 176 | 177 | if file: 178 | file_path = Path(file.meta["path"]) 179 | 180 | # Check if the file already exists in the cache 181 | if file_path.is_file(): 182 | print(f"file_path: {file_path}") 183 | return FileResponse(file_path) 184 | else: 185 | raise HTTPException( 186 | status_code=status.HTTP_404_NOT_FOUND, 187 | detail=ERROR_MESSAGES.NOT_FOUND, 188 | ) 189 | else: 190 | raise HTTPException( 191 | status_code=status.HTTP_404_NOT_FOUND, 192 | detail=ERROR_MESSAGES.NOT_FOUND, 193 | ) 194 | 195 | 196 | @router.get("/{id}/content/{file_name}", response_model=Optional[FileModel]) 197 | async def get_file_content_by_id(id: str, user=Depends(get_verified_user)): 198 | file = Files.get_file_by_id(id) 199 | 200 | if file: 201 | file_path = Path(file.meta["path"]) 202 | 203 | # Check if the file already exists in the cache 204 | if file_path.is_file(): 205 | print(f"file_path: {file_path}") 206 | return FileResponse(file_path) 207 | else: 208 | raise HTTPException( 209 | status_code=status.HTTP_404_NOT_FOUND, 210 | detail=ERROR_MESSAGES.NOT_FOUND, 211 | ) 212 | else: 213 | raise HTTPException( 214 | status_code=status.HTTP_404_NOT_FOUND, 215 | detail=ERROR_MESSAGES.NOT_FOUND, 216 | ) 217 | 218 | 219 | ############################ 220 | # Delete File By Id 221 | ############################ 222 | 223 | 224 | @router.delete("/{id}") 225 | async def delete_file_by_id(id: str, user=Depends(get_verified_user)): 226 | file = Files.get_file_by_id(id) 227 | 228 | if file: 229 | result = Files.delete_file_by_id(id) 230 | if result: 231 | return {"message": "File deleted successfully"} 232 | else: 233 | raise HTTPException( 234 | status_code=status.HTTP_400_BAD_REQUEST, 235 | detail=ERROR_MESSAGES.DEFAULT("Error deleting file"), 236 | ) 237 | else: 238 | raise HTTPException( 239 | status_code=status.HTTP_404_NOT_FOUND, 240 | detail=ERROR_MESSAGES.NOT_FOUND, 241 | ) ``````` `\\?\D:\Coding\ai\backend\apps\webui\routers\functions.py`: ```````py 1 | from fastapi import Depends, FastAPI, HTTPException, status, Request 2 | from datetime import datetime, timedelta 3 | from typing import List, Union, Optional 4 | 5 | from fastapi import APIRouter 6 | from pydantic import BaseModel 7 | import json 8 | 9 | from apps.webui.models.functions import ( 10 | Functions, 11 | FunctionForm, 12 | FunctionModel, 13 | FunctionResponse, 14 | ) 15 | from apps.webui.utils import load_function_module_by_id 16 | from utils.utils import get_verified_user, get_admin_user 17 | from constants import ERROR_MESSAGES 18 | 19 | from importlib import util 20 | import os 21 | from pathlib import Path 22 | 23 | from config import DATA_DIR, CACHE_DIR, FUNCTIONS_DIR 24 | 25 | 26 | router = APIRouter() 27 | 28 | ############################ 29 | # GetFunctions 30 | ############################ 31 | 32 | 33 | @router.get("/", response_model=List[FunctionResponse]) 34 | async def get_functions(user=Depends(get_verified_user)): 35 | return Functions.get_functions() 36 | 37 | 38 | ############################ 39 | # ExportFunctions 40 | ############################ 41 | 42 | 43 | @router.get("/export", response_model=List[FunctionModel]) 44 | async def get_functions(user=Depends(get_admin_user)): 45 | return Functions.get_functions() 46 | 47 | 48 | ############################ 49 | # CreateNewFunction 50 | ############################ 51 | 52 | 53 | @router.post("/create", response_model=Optional[FunctionResponse]) 54 | async def create_new_function( 55 | request: Request, form_data: FunctionForm, user=Depends(get_admin_user) 56 | ): 57 | if not form_data.id.isidentifier(): 58 | raise HTTPException( 59 | status_code=status.HTTP_400_BAD_REQUEST, 60 | detail="Only alphanumeric characters and underscores are allowed in the id", 61 | ) 62 | 63 | form_data.id = form_data.id.lower() 64 | 65 | function = Functions.get_function_by_id(form_data.id) 66 | if function == None: 67 | function_path = os.path.join(FUNCTIONS_DIR, f"{form_data.id}.py") 68 | try: 69 | with open(function_path, "w") as function_file: 70 | function_file.write(form_data.content) 71 | 72 | function_module, function_type, frontmatter = load_function_module_by_id( 73 | form_data.id 74 | ) 75 | form_data.meta.manifest = frontmatter 76 | 77 | FUNCTIONS = request.app.state.FUNCTIONS 78 | FUNCTIONS[form_data.id] = function_module 79 | 80 | function = Functions.insert_new_function(user.id, function_type, form_data) 81 | 82 | function_cache_dir = Path(CACHE_DIR) / "functions" / form_data.id 83 | function_cache_dir.mkdir(parents=True, exist_ok=True) 84 | 85 | if function: 86 | return function 87 | else: 88 | raise HTTPException( 89 | status_code=status.HTTP_400_BAD_REQUEST, 90 | detail=ERROR_MESSAGES.DEFAULT("Error creating function"), 91 | ) 92 | except Exception as e: 93 | print(e) 94 | raise HTTPException( 95 | status_code=status.HTTP_400_BAD_REQUEST, 96 | detail=ERROR_MESSAGES.DEFAULT(e), 97 | ) 98 | else: 99 | raise HTTPException( 100 | status_code=status.HTTP_400_BAD_REQUEST, 101 | detail=ERROR_MESSAGES.ID_TAKEN, 102 | ) 103 | 104 | 105 | ############################ 106 | # GetFunctionById 107 | ############################ 108 | 109 | 110 | @router.get("/id/{id}", response_model=Optional[FunctionModel]) 111 | async def get_function_by_id(id: str, user=Depends(get_admin_user)): 112 | function = Functions.get_function_by_id(id) 113 | 114 | if function: 115 | return function 116 | else: 117 | raise HTTPException( 118 | status_code=status.HTTP_401_UNAUTHORIZED, 119 | detail=ERROR_MESSAGES.NOT_FOUND, 120 | ) 121 | 122 | 123 | ############################ 124 | # ToggleFunctionById 125 | ############################ 126 | 127 | 128 | @router.post("/id/{id}/toggle", response_model=Optional[FunctionModel]) 129 | async def toggle_function_by_id(id: str, user=Depends(get_admin_user)): 130 | function = Functions.get_function_by_id(id) 131 | if function: 132 | function = Functions.update_function_by_id( 133 | id, {"is_active": not function.is_active} 134 | ) 135 | 136 | if function: 137 | return function 138 | else: 139 | raise HTTPException( 140 | status_code=status.HTTP_400_BAD_REQUEST, 141 | detail=ERROR_MESSAGES.DEFAULT("Error updating function"), 142 | ) 143 | else: 144 | raise HTTPException( 145 | status_code=status.HTTP_401_UNAUTHORIZED, 146 | detail=ERROR_MESSAGES.NOT_FOUND, 147 | ) 148 | 149 | 150 | ############################ 151 | # ToggleGlobalById 152 | ############################ 153 | 154 | 155 | @router.post("/id/{id}/toggle/global", response_model=Optional[FunctionModel]) 156 | async def toggle_global_by_id(id: str, user=Depends(get_admin_user)): 157 | function = Functions.get_function_by_id(id) 158 | if function: 159 | function = Functions.update_function_by_id( 160 | id, {"is_global": not function.is_global} 161 | ) 162 | 163 | if function: 164 | return function 165 | else: 166 | raise HTTPException( 167 | status_code=status.HTTP_400_BAD_REQUEST, 168 | detail=ERROR_MESSAGES.DEFAULT("Error updating function"), 169 | ) 170 | else: 171 | raise HTTPException( 172 | status_code=status.HTTP_401_UNAUTHORIZED, 173 | detail=ERROR_MESSAGES.NOT_FOUND, 174 | ) 175 | 176 | 177 | ############################ 178 | # UpdateFunctionById 179 | ############################ 180 | 181 | 182 | @router.post("/id/{id}/update", response_model=Optional[FunctionModel]) 183 | async def update_function_by_id( 184 | request: Request, id: str, form_data: FunctionForm, user=Depends(get_admin_user) 185 | ): 186 | function_path = os.path.join(FUNCTIONS_DIR, f"{id}.py") 187 | 188 | try: 189 | with open(function_path, "w") as function_file: 190 | function_file.write(form_data.content) 191 | 192 | function_module, function_type, frontmatter = load_function_module_by_id(id) 193 | form_data.meta.manifest = frontmatter 194 | 195 | FUNCTIONS = request.app.state.FUNCTIONS 196 | FUNCTIONS[id] = function_module 197 | 198 | updated = {**form_data.model_dump(exclude={"id"}), "type": function_type} 199 | print(updated) 200 | 201 | function = Functions.update_function_by_id(id, updated) 202 | 203 | if function: 204 | return function 205 | else: 206 | raise HTTPException( 207 | status_code=status.HTTP_400_BAD_REQUEST, 208 | detail=ERROR_MESSAGES.DEFAULT("Error updating function"), 209 | ) 210 | 211 | except Exception as e: 212 | raise HTTPException( 213 | status_code=status.HTTP_400_BAD_REQUEST, 214 | detail=ERROR_MESSAGES.DEFAULT(e), 215 | ) 216 | 217 | 218 | ############################ 219 | # DeleteFunctionById 220 | ############################ 221 | 222 | 223 | @router.delete("/id/{id}/delete", response_model=bool) 224 | async def delete_function_by_id( 225 | request: Request, id: str, user=Depends(get_admin_user) 226 | ): 227 | result = Functions.delete_function_by_id(id) 228 | 229 | if result: 230 | FUNCTIONS = request.app.state.FUNCTIONS 231 | if id in FUNCTIONS: 232 | del FUNCTIONS[id] 233 | 234 | # delete the function file 235 | function_path = os.path.join(FUNCTIONS_DIR, f"{id}.py") 236 | try: 237 | os.remove(function_path) 238 | except: 239 | pass 240 | 241 | return result 242 | 243 | 244 | ############################ 245 | # GetFunctionValves 246 | ############################ 247 | 248 | 249 | @router.get("/id/{id}/valves", response_model=Optional[dict]) 250 | async def get_function_valves_by_id(id: str, user=Depends(get_admin_user)): 251 | function = Functions.get_function_by_id(id) 252 | if function: 253 | try: 254 | valves = Functions.get_function_valves_by_id(id) 255 | return valves 256 | except Exception as e: 257 | raise HTTPException( 258 | status_code=status.HTTP_400_BAD_REQUEST, 259 | detail=ERROR_MESSAGES.DEFAULT(e), 260 | ) 261 | else: 262 | raise HTTPException( 263 | status_code=status.HTTP_401_UNAUTHORIZED, 264 | detail=ERROR_MESSAGES.NOT_FOUND, 265 | ) 266 | 267 | 268 | ############################ 269 | # GetFunctionValvesSpec 270 | ############################ 271 | 272 | 273 | @router.get("/id/{id}/valves/spec", response_model=Optional[dict]) 274 | async def get_function_valves_spec_by_id( 275 | request: Request, id: str, user=Depends(get_admin_user) 276 | ): 277 | function = Functions.get_function_by_id(id) 278 | if function: 279 | if id in request.app.state.FUNCTIONS: 280 | function_module = request.app.state.FUNCTIONS[id] 281 | else: 282 | function_module, function_type, frontmatter = load_function_module_by_id(id) 283 | request.app.state.FUNCTIONS[id] = function_module 284 | 285 | if hasattr(function_module, "Valves"): 286 | Valves = function_module.Valves 287 | return Valves.schema() 288 | return None 289 | else: 290 | raise HTTPException( 291 | status_code=status.HTTP_401_UNAUTHORIZED, 292 | detail=ERROR_MESSAGES.NOT_FOUND, 293 | ) 294 | 295 | 296 | ############################ 297 | # UpdateFunctionValves 298 | ############################ 299 | 300 | 301 | @router.post("/id/{id}/valves/update", response_model=Optional[dict]) 302 | async def update_function_valves_by_id( 303 | request: Request, id: str, form_data: dict, user=Depends(get_admin_user) 304 | ): 305 | function = Functions.get_function_by_id(id) 306 | if function: 307 | 308 | if id in request.app.state.FUNCTIONS: 309 | function_module = request.app.state.FUNCTIONS[id] 310 | else: 311 | function_module, function_type, frontmatter = load_function_module_by_id(id) 312 | request.app.state.FUNCTIONS[id] = function_module 313 | 314 | if hasattr(function_module, "Valves"): 315 | Valves = function_module.Valves 316 | 317 | try: 318 | form_data = {k: v for k, v in form_data.items() if v is not None} 319 | valves = Valves(**form_data) 320 | Functions.update_function_valves_by_id(id, valves.model_dump()) 321 | return valves.model_dump() 322 | except Exception as e: 323 | print(e) 324 | raise HTTPException( 325 | status_code=status.HTTP_400_BAD_REQUEST, 326 | detail=ERROR_MESSAGES.DEFAULT(e), 327 | ) 328 | else: 329 | raise HTTPException( 330 | status_code=status.HTTP_401_UNAUTHORIZED, 331 | detail=ERROR_MESSAGES.NOT_FOUND, 332 | ) 333 | 334 | else: 335 | raise HTTPException( 336 | status_code=status.HTTP_401_UNAUTHORIZED, 337 | detail=ERROR_MESSAGES.NOT_FOUND, 338 | ) 339 | 340 | 341 | ############################ 342 | # FunctionUserValves 343 | ############################ 344 | 345 | 346 | @router.get("/id/{id}/valves/user", response_model=Optional[dict]) 347 | async def get_function_user_valves_by_id(id: str, user=Depends(get_verified_user)): 348 | function = Functions.get_function_by_id(id) 349 | if function: 350 | try: 351 | user_valves = Functions.get_user_valves_by_id_and_user_id(id, user.id) 352 | return user_valves 353 | except Exception as e: 354 | raise HTTPException( 355 | status_code=status.HTTP_400_BAD_REQUEST, 356 | detail=ERROR_MESSAGES.DEFAULT(e), 357 | ) 358 | else: 359 | raise HTTPException( 360 | status_code=status.HTTP_401_UNAUTHORIZED, 361 | detail=ERROR_MESSAGES.NOT_FOUND, 362 | ) 363 | 364 | 365 | @router.get("/id/{id}/valves/user/spec", response_model=Optional[dict]) 366 | async def get_function_user_valves_spec_by_id( 367 | request: Request, id: str, user=Depends(get_verified_user) 368 | ): 369 | function = Functions.get_function_by_id(id) 370 | if function: 371 | if id in request.app.state.FUNCTIONS: 372 | function_module = request.app.state.FUNCTIONS[id] 373 | else: 374 | function_module, function_type, frontmatter = load_function_module_by_id(id) 375 | request.app.state.FUNCTIONS[id] = function_module 376 | 377 | if hasattr(function_module, "UserValves"): 378 | UserValves = function_module.UserValves 379 | return UserValves.schema() 380 | return None 381 | else: 382 | raise HTTPException( 383 | status_code=status.HTTP_401_UNAUTHORIZED, 384 | detail=ERROR_MESSAGES.NOT_FOUND, 385 | ) 386 | 387 | 388 | @router.post("/id/{id}/valves/user/update", response_model=Optional[dict]) 389 | async def update_function_user_valves_by_id( 390 | request: Request, id: str, form_data: dict, user=Depends(get_verified_user) 391 | ): 392 | function = Functions.get_function_by_id(id) 393 | 394 | if function: 395 | if id in request.app.state.FUNCTIONS: 396 | function_module = request.app.state.FUNCTIONS[id] 397 | else: 398 | function_module, function_type, frontmatter = load_function_module_by_id(id) 399 | request.app.state.FUNCTIONS[id] = function_module 400 | 401 | if hasattr(function_module, "UserValves"): 402 | UserValves = function_module.UserValves 403 | 404 | try: 405 | form_data = {k: v for k, v in form_data.items() if v is not None} 406 | user_valves = UserValves(**form_data) 407 | Functions.update_user_valves_by_id_and_user_id( 408 | id, user.id, user_valves.model_dump() 409 | ) 410 | return user_valves.model_dump() 411 | except Exception as e: 412 | print(e) 413 | raise HTTPException( 414 | status_code=status.HTTP_400_BAD_REQUEST, 415 | detail=ERROR_MESSAGES.DEFAULT(e), 416 | ) 417 | else: 418 | raise HTTPException( 419 | status_code=status.HTTP_401_UNAUTHORIZED, 420 | detail=ERROR_MESSAGES.NOT_FOUND, 421 | ) 422 | else: 423 | raise HTTPException( 424 | status_code=status.HTTP_401_UNAUTHORIZED, 425 | detail=ERROR_MESSAGES.NOT_FOUND, 426 | ) ``````` `\\?\D:\Coding\ai\backend\apps\webui\routers\memories.py`: ```````py 1 | from fastapi import Response, Request 2 | from fastapi import Depends, FastAPI, HTTPException, status 3 | from datetime import datetime, timedelta 4 | from typing import List, Union, Optional 5 | 6 | from fastapi import APIRouter 7 | from pydantic import BaseModel 8 | import logging 9 | 10 | from apps.webui.models.memories import Memories, MemoryModel 11 | 12 | from utils.utils import get_verified_user 13 | from constants import ERROR_MESSAGES 14 | 15 | from config import SRC_LOG_LEVELS, CHROMA_CLIENT 16 | 17 | log = logging.getLogger(__name__) 18 | log.setLevel(SRC_LOG_LEVELS["MODELS"]) 19 | 20 | router = APIRouter() 21 | 22 | 23 | @router.get("/ef") 24 | async def get_embeddings(request: Request): 25 | return {"result": request.app.state.EMBEDDING_FUNCTION("hello world")} 26 | 27 | 28 | ############################ 29 | # GetMemories 30 | ############################ 31 | 32 | 33 | @router.get("/", response_model=List[MemoryModel]) 34 | async def get_memories(user=Depends(get_verified_user)): 35 | return Memories.get_memories_by_user_id(user.id) 36 | 37 | 38 | ############################ 39 | # AddMemory 40 | ############################ 41 | 42 | 43 | class AddMemoryForm(BaseModel): 44 | content: str 45 | 46 | 47 | class MemoryUpdateModel(BaseModel): 48 | content: Optional[str] = None 49 | 50 | 51 | @router.post("/add", response_model=Optional[MemoryModel]) 52 | async def add_memory( 53 | request: Request, 54 | form_data: AddMemoryForm, 55 | user=Depends(get_verified_user), 56 | ): 57 | memory = Memories.insert_new_memory(user.id, form_data.content) 58 | memory_embedding = request.app.state.EMBEDDING_FUNCTION(memory.content) 59 | 60 | collection = CHROMA_CLIENT.get_or_create_collection(name=f"user-memory-{user.id}") 61 | collection.upsert( 62 | documents=[memory.content], 63 | ids=[memory.id], 64 | embeddings=[memory_embedding], 65 | metadatas=[{"created_at": memory.created_at}], 66 | ) 67 | 68 | return memory 69 | 70 | 71 | @router.post("/{memory_id}/update", response_model=Optional[MemoryModel]) 72 | async def update_memory_by_id( 73 | memory_id: str, 74 | request: Request, 75 | form_data: MemoryUpdateModel, 76 | user=Depends(get_verified_user), 77 | ): 78 | memory = Memories.update_memory_by_id(memory_id, form_data.content) 79 | if memory is None: 80 | raise HTTPException(status_code=404, detail="Memory not found") 81 | 82 | if form_data.content is not None: 83 | memory_embedding = request.app.state.EMBEDDING_FUNCTION(form_data.content) 84 | collection = CHROMA_CLIENT.get_or_create_collection( 85 | name=f"user-memory-{user.id}" 86 | ) 87 | collection.upsert( 88 | documents=[form_data.content], 89 | ids=[memory.id], 90 | embeddings=[memory_embedding], 91 | metadatas=[ 92 | {"created_at": memory.created_at, "updated_at": memory.updated_at} 93 | ], 94 | ) 95 | 96 | return memory 97 | 98 | 99 | ############################ 100 | # QueryMemory 101 | ############################ 102 | 103 | 104 | class QueryMemoryForm(BaseModel): 105 | content: str 106 | k: Optional[int] = 1 107 | 108 | 109 | @router.post("/query") 110 | async def query_memory( 111 | request: Request, form_data: QueryMemoryForm, user=Depends(get_verified_user) 112 | ): 113 | query_embedding = request.app.state.EMBEDDING_FUNCTION(form_data.content) 114 | collection = CHROMA_CLIENT.get_or_create_collection(name=f"user-memory-{user.id}") 115 | 116 | results = collection.query( 117 | query_embeddings=[query_embedding], 118 | n_results=form_data.k, # how many results to return 119 | ) 120 | 121 | return results 122 | 123 | 124 | ############################ 125 | # ResetMemoryFromVectorDB 126 | ############################ 127 | @router.get("/reset", response_model=bool) 128 | async def reset_memory_from_vector_db( 129 | request: Request, user=Depends(get_verified_user) 130 | ): 131 | CHROMA_CLIENT.delete_collection(f"user-memory-{user.id}") 132 | collection = CHROMA_CLIENT.get_or_create_collection(name=f"user-memory-{user.id}") 133 | 134 | memories = Memories.get_memories_by_user_id(user.id) 135 | for memory in memories: 136 | memory_embedding = request.app.state.EMBEDDING_FUNCTION(memory.content) 137 | collection.upsert( 138 | documents=[memory.content], 139 | ids=[memory.id], 140 | embeddings=[memory_embedding], 141 | ) 142 | return True 143 | 144 | 145 | ############################ 146 | # DeleteMemoriesByUserId 147 | ############################ 148 | 149 | 150 | @router.delete("/user", response_model=bool) 151 | async def delete_memory_by_user_id(user=Depends(get_verified_user)): 152 | result = Memories.delete_memories_by_user_id(user.id) 153 | 154 | if result: 155 | try: 156 | CHROMA_CLIENT.delete_collection(f"user-memory-{user.id}") 157 | except Exception as e: 158 | log.error(e) 159 | return True 160 | 161 | return False 162 | 163 | 164 | ############################ 165 | # DeleteMemoryById 166 | ############################ 167 | 168 | 169 | @router.delete("/{memory_id}", response_model=bool) 170 | async def delete_memory_by_id(memory_id: str, user=Depends(get_verified_user)): 171 | result = Memories.delete_memory_by_id_and_user_id(memory_id, user.id) 172 | 173 | if result: 174 | collection = CHROMA_CLIENT.get_or_create_collection( 175 | name=f"user-memory-{user.id}" 176 | ) 177 | collection.delete(ids=[memory_id]) 178 | return True 179 | 180 | return False ``````` `\\?\D:\Coding\ai\backend\apps\webui\routers\models.py`: ```````py 1 | from fastapi import Depends, FastAPI, HTTPException, status, Request 2 | from datetime import datetime, timedelta 3 | from typing import List, Union, Optional 4 | 5 | from fastapi import APIRouter 6 | from pydantic import BaseModel 7 | import json 8 | 9 | from apps.webui.models.models import Models, ModelModel, ModelForm, ModelResponse 10 | 11 | from utils.utils import get_verified_user, get_admin_user 12 | from constants import ERROR_MESSAGES 13 | 14 | router = APIRouter() 15 | 16 | ########################### 17 | # getModels 18 | ########################### 19 | 20 | 21 | @router.get("/", response_model=List[ModelResponse]) 22 | async def get_models(user=Depends(get_verified_user)): 23 | return Models.get_all_models() 24 | 25 | 26 | ############################ 27 | # AddNewModel 28 | ############################ 29 | 30 | 31 | @router.post("/add", response_model=Optional[ModelModel]) 32 | async def add_new_model( 33 | request: Request, 34 | form_data: ModelForm, 35 | user=Depends(get_admin_user), 36 | ): 37 | if form_data.id in request.app.state.MODELS: 38 | raise HTTPException( 39 | status_code=status.HTTP_401_UNAUTHORIZED, 40 | detail=ERROR_MESSAGES.MODEL_ID_TAKEN, 41 | ) 42 | else: 43 | model = Models.insert_new_model(form_data, user.id) 44 | 45 | if model: 46 | return model 47 | else: 48 | raise HTTPException( 49 | status_code=status.HTTP_401_UNAUTHORIZED, 50 | detail=ERROR_MESSAGES.DEFAULT(), 51 | ) 52 | 53 | 54 | ############################ 55 | # GetModelById 56 | ############################ 57 | 58 | 59 | @router.get("/", response_model=Optional[ModelModel]) 60 | async def get_model_by_id(id: str, user=Depends(get_verified_user)): 61 | model = Models.get_model_by_id(id) 62 | 63 | if model: 64 | return model 65 | else: 66 | raise HTTPException( 67 | status_code=status.HTTP_401_UNAUTHORIZED, 68 | detail=ERROR_MESSAGES.NOT_FOUND, 69 | ) 70 | 71 | 72 | ############################ 73 | # UpdateModelById 74 | ############################ 75 | 76 | 77 | @router.post("/update", response_model=Optional[ModelModel]) 78 | async def update_model_by_id( 79 | request: Request, 80 | id: str, 81 | form_data: ModelForm, 82 | user=Depends(get_admin_user), 83 | ): 84 | model = Models.get_model_by_id(id) 85 | if model: 86 | model = Models.update_model_by_id(id, form_data) 87 | return model 88 | else: 89 | if form_data.id in request.app.state.MODELS: 90 | model = Models.insert_new_model(form_data, user.id) 91 | if model: 92 | return model 93 | else: 94 | raise HTTPException( 95 | status_code=status.HTTP_401_UNAUTHORIZED, 96 | detail=ERROR_MESSAGES.DEFAULT(), 97 | ) 98 | else: 99 | raise HTTPException( 100 | status_code=status.HTTP_401_UNAUTHORIZED, 101 | detail=ERROR_MESSAGES.DEFAULT(), 102 | ) 103 | 104 | 105 | ############################ 106 | # DeleteModelById 107 | ############################ 108 | 109 | 110 | @router.delete("/delete", response_model=bool) 111 | async def delete_model_by_id(id: str, user=Depends(get_admin_user)): 112 | result = Models.delete_model_by_id(id) 113 | return result ``````` `\\?\D:\Coding\ai\backend\apps\webui\routers\prompts.py`: ```````py 1 | from fastapi import Depends, FastAPI, HTTPException, status 2 | from datetime import datetime, timedelta 3 | from typing import List, Union, Optional 4 | 5 | from fastapi import APIRouter 6 | from pydantic import BaseModel 7 | import json 8 | 9 | from apps.webui.models.prompts import Prompts, PromptForm, PromptModel 10 | 11 | from utils.utils import get_verified_user, get_admin_user 12 | from constants import ERROR_MESSAGES 13 | 14 | router = APIRouter() 15 | 16 | ############################ 17 | # GetPrompts 18 | ############################ 19 | 20 | 21 | @router.get("/", response_model=List[PromptModel]) 22 | async def get_prompts(user=Depends(get_verified_user)): 23 | return Prompts.get_prompts() 24 | 25 | 26 | ############################ 27 | # CreateNewPrompt 28 | ############################ 29 | 30 | 31 | @router.post("/create", response_model=Optional[PromptModel]) 32 | async def create_new_prompt(form_data: PromptForm, user=Depends(get_admin_user)): 33 | prompt = Prompts.get_prompt_by_command(form_data.command) 34 | if prompt == None: 35 | prompt = Prompts.insert_new_prompt(user.id, form_data) 36 | 37 | if prompt: 38 | return prompt 39 | raise HTTPException( 40 | status_code=status.HTTP_400_BAD_REQUEST, 41 | detail=ERROR_MESSAGES.DEFAULT(), 42 | ) 43 | raise HTTPException( 44 | status_code=status.HTTP_400_BAD_REQUEST, 45 | detail=ERROR_MESSAGES.COMMAND_TAKEN, 46 | ) 47 | 48 | 49 | ############################ 50 | # GetPromptByCommand 51 | ############################ 52 | 53 | 54 | @router.get("/command/{command}", response_model=Optional[PromptModel]) 55 | async def get_prompt_by_command(command: str, user=Depends(get_verified_user)): 56 | prompt = Prompts.get_prompt_by_command(f"/{command}") 57 | 58 | if prompt: 59 | return prompt 60 | else: 61 | raise HTTPException( 62 | status_code=status.HTTP_401_UNAUTHORIZED, 63 | detail=ERROR_MESSAGES.NOT_FOUND, 64 | ) 65 | 66 | 67 | ############################ 68 | # UpdatePromptByCommand 69 | ############################ 70 | 71 | 72 | @router.post("/command/{command}/update", response_model=Optional[PromptModel]) 73 | async def update_prompt_by_command( 74 | command: str, 75 | form_data: PromptForm, 76 | user=Depends(get_admin_user), 77 | ): 78 | prompt = Prompts.update_prompt_by_command(f"/{command}", form_data) 79 | if prompt: 80 | return prompt 81 | else: 82 | raise HTTPException( 83 | status_code=status.HTTP_401_UNAUTHORIZED, 84 | detail=ERROR_MESSAGES.ACCESS_PROHIBITED, 85 | ) 86 | 87 | 88 | ############################ 89 | # DeletePromptByCommand 90 | ############################ 91 | 92 | 93 | @router.delete("/command/{command}/delete", response_model=bool) 94 | async def delete_prompt_by_command(command: str, user=Depends(get_admin_user)): 95 | result = Prompts.delete_prompt_by_command(f"/{command}") 96 | return result ``````` `\\?\D:\Coding\ai\backend\apps\webui\routers\tools.py`: ```````py 1 | from fastapi import Depends, FastAPI, HTTPException, status, Request 2 | from datetime import datetime, timedelta 3 | from typing import List, Union, Optional 4 | 5 | from fastapi import APIRouter 6 | from pydantic import BaseModel 7 | import json 8 | 9 | from apps.webui.models.users import Users 10 | from apps.webui.models.tools import Tools, ToolForm, ToolModel, ToolResponse 11 | from apps.webui.utils import load_toolkit_module_by_id 12 | 13 | from utils.utils import get_admin_user, get_verified_user 14 | from utils.tools import get_tools_specs 15 | from constants import ERROR_MESSAGES 16 | 17 | from importlib import util 18 | import os 19 | from pathlib import Path 20 | 21 | from config import DATA_DIR, CACHE_DIR 22 | 23 | 24 | TOOLS_DIR = f"{DATA_DIR}/tools" 25 | os.makedirs(TOOLS_DIR, exist_ok=True) 26 | 27 | 28 | router = APIRouter() 29 | 30 | ############################ 31 | # GetToolkits 32 | ############################ 33 | 34 | 35 | @router.get("/", response_model=List[ToolResponse]) 36 | async def get_toolkits(user=Depends(get_verified_user)): 37 | toolkits = [toolkit for toolkit in Tools.get_tools()] 38 | return toolkits 39 | 40 | 41 | ############################ 42 | # ExportToolKits 43 | ############################ 44 | 45 | 46 | @router.get("/export", response_model=List[ToolModel]) 47 | async def get_toolkits(user=Depends(get_admin_user)): 48 | toolkits = [toolkit for toolkit in Tools.get_tools()] 49 | return toolkits 50 | 51 | 52 | ############################ 53 | # CreateNewToolKit 54 | ############################ 55 | 56 | 57 | @router.post("/create", response_model=Optional[ToolResponse]) 58 | async def create_new_toolkit( 59 | request: Request, 60 | form_data: ToolForm, 61 | user=Depends(get_admin_user), 62 | ): 63 | if not form_data.id.isidentifier(): 64 | raise HTTPException( 65 | status_code=status.HTTP_400_BAD_REQUEST, 66 | detail="Only alphanumeric characters and underscores are allowed in the id", 67 | ) 68 | 69 | form_data.id = form_data.id.lower() 70 | 71 | toolkit = Tools.get_tool_by_id(form_data.id) 72 | if toolkit == None: 73 | toolkit_path = os.path.join(TOOLS_DIR, f"{form_data.id}.py") 74 | try: 75 | with open(toolkit_path, "w") as tool_file: 76 | tool_file.write(form_data.content) 77 | 78 | toolkit_module, frontmatter = load_toolkit_module_by_id(form_data.id) 79 | form_data.meta.manifest = frontmatter 80 | 81 | TOOLS = request.app.state.TOOLS 82 | TOOLS[form_data.id] = toolkit_module 83 | 84 | specs = get_tools_specs(TOOLS[form_data.id]) 85 | toolkit = Tools.insert_new_tool(user.id, form_data, specs) 86 | 87 | tool_cache_dir = Path(CACHE_DIR) / "tools" / form_data.id 88 | tool_cache_dir.mkdir(parents=True, exist_ok=True) 89 | 90 | if toolkit: 91 | return toolkit 92 | else: 93 | raise HTTPException( 94 | status_code=status.HTTP_400_BAD_REQUEST, 95 | detail=ERROR_MESSAGES.DEFAULT("Error creating toolkit"), 96 | ) 97 | except Exception as e: 98 | print(e) 99 | raise HTTPException( 100 | status_code=status.HTTP_400_BAD_REQUEST, 101 | detail=ERROR_MESSAGES.DEFAULT(e), 102 | ) 103 | else: 104 | raise HTTPException( 105 | status_code=status.HTTP_400_BAD_REQUEST, 106 | detail=ERROR_MESSAGES.ID_TAKEN, 107 | ) 108 | 109 | 110 | ############################ 111 | # GetToolkitById 112 | ############################ 113 | 114 | 115 | @router.get("/id/{id}", response_model=Optional[ToolModel]) 116 | async def get_toolkit_by_id(id: str, user=Depends(get_admin_user)): 117 | toolkit = Tools.get_tool_by_id(id) 118 | 119 | if toolkit: 120 | return toolkit 121 | else: 122 | raise HTTPException( 123 | status_code=status.HTTP_401_UNAUTHORIZED, 124 | detail=ERROR_MESSAGES.NOT_FOUND, 125 | ) 126 | 127 | 128 | ############################ 129 | # UpdateToolkitById 130 | ############################ 131 | 132 | 133 | @router.post("/id/{id}/update", response_model=Optional[ToolModel]) 134 | async def update_toolkit_by_id( 135 | request: Request, 136 | id: str, 137 | form_data: ToolForm, 138 | user=Depends(get_admin_user), 139 | ): 140 | toolkit_path = os.path.join(TOOLS_DIR, f"{id}.py") 141 | 142 | try: 143 | with open(toolkit_path, "w") as tool_file: 144 | tool_file.write(form_data.content) 145 | 146 | toolkit_module, frontmatter = load_toolkit_module_by_id(id) 147 | form_data.meta.manifest = frontmatter 148 | 149 | TOOLS = request.app.state.TOOLS 150 | TOOLS[id] = toolkit_module 151 | 152 | specs = get_tools_specs(TOOLS[id]) 153 | 154 | updated = { 155 | **form_data.model_dump(exclude={"id"}), 156 | "specs": specs, 157 | } 158 | 159 | print(updated) 160 | toolkit = Tools.update_tool_by_id(id, updated) 161 | 162 | if toolkit: 163 | return toolkit 164 | else: 165 | raise HTTPException( 166 | status_code=status.HTTP_400_BAD_REQUEST, 167 | detail=ERROR_MESSAGES.DEFAULT("Error updating toolkit"), 168 | ) 169 | 170 | except Exception as e: 171 | raise HTTPException( 172 | status_code=status.HTTP_400_BAD_REQUEST, 173 | detail=ERROR_MESSAGES.DEFAULT(e), 174 | ) 175 | 176 | 177 | ############################ 178 | # DeleteToolkitById 179 | ############################ 180 | 181 | 182 | @router.delete("/id/{id}/delete", response_model=bool) 183 | async def delete_toolkit_by_id(request: Request, id: str, user=Depends(get_admin_user)): 184 | result = Tools.delete_tool_by_id(id) 185 | 186 | if result: 187 | TOOLS = request.app.state.TOOLS 188 | if id in TOOLS: 189 | del TOOLS[id] 190 | 191 | # delete the toolkit file 192 | toolkit_path = os.path.join(TOOLS_DIR, f"{id}.py") 193 | os.remove(toolkit_path) 194 | 195 | return result 196 | 197 | 198 | ############################ 199 | # GetToolValves 200 | ############################ 201 | 202 | 203 | @router.get("/id/{id}/valves", response_model=Optional[dict]) 204 | async def get_toolkit_valves_by_id(id: str, user=Depends(get_admin_user)): 205 | toolkit = Tools.get_tool_by_id(id) 206 | if toolkit: 207 | try: 208 | valves = Tools.get_tool_valves_by_id(id) 209 | return valves 210 | except Exception as e: 211 | raise HTTPException( 212 | status_code=status.HTTP_400_BAD_REQUEST, 213 | detail=ERROR_MESSAGES.DEFAULT(e), 214 | ) 215 | else: 216 | raise HTTPException( 217 | status_code=status.HTTP_401_UNAUTHORIZED, 218 | detail=ERROR_MESSAGES.NOT_FOUND, 219 | ) 220 | 221 | 222 | ############################ 223 | # GetToolValvesSpec 224 | ############################ 225 | 226 | 227 | @router.get("/id/{id}/valves/spec", response_model=Optional[dict]) 228 | async def get_toolkit_valves_spec_by_id( 229 | request: Request, id: str, user=Depends(get_admin_user) 230 | ): 231 | toolkit = Tools.get_tool_by_id(id) 232 | if toolkit: 233 | if id in request.app.state.TOOLS: 234 | toolkit_module = request.app.state.TOOLS[id] 235 | else: 236 | toolkit_module, frontmatter = load_toolkit_module_by_id(id) 237 | request.app.state.TOOLS[id] = toolkit_module 238 | 239 | if hasattr(toolkit_module, "Valves"): 240 | Valves = toolkit_module.Valves 241 | return Valves.schema() 242 | return None 243 | else: 244 | raise HTTPException( 245 | status_code=status.HTTP_401_UNAUTHORIZED, 246 | detail=ERROR_MESSAGES.NOT_FOUND, 247 | ) 248 | 249 | 250 | ############################ 251 | # UpdateToolValves 252 | ############################ 253 | 254 | 255 | @router.post("/id/{id}/valves/update", response_model=Optional[dict]) 256 | async def update_toolkit_valves_by_id( 257 | request: Request, id: str, form_data: dict, user=Depends(get_admin_user) 258 | ): 259 | toolkit = Tools.get_tool_by_id(id) 260 | if toolkit: 261 | if id in request.app.state.TOOLS: 262 | toolkit_module = request.app.state.TOOLS[id] 263 | else: 264 | toolkit_module, frontmatter = load_toolkit_module_by_id(id) 265 | request.app.state.TOOLS[id] = toolkit_module 266 | 267 | if hasattr(toolkit_module, "Valves"): 268 | Valves = toolkit_module.Valves 269 | 270 | try: 271 | form_data = {k: v for k, v in form_data.items() if v is not None} 272 | valves = Valves(**form_data) 273 | Tools.update_tool_valves_by_id(id, valves.model_dump()) 274 | return valves.model_dump() 275 | except Exception as e: 276 | print(e) 277 | raise HTTPException( 278 | status_code=status.HTTP_400_BAD_REQUEST, 279 | detail=ERROR_MESSAGES.DEFAULT(e), 280 | ) 281 | else: 282 | raise HTTPException( 283 | status_code=status.HTTP_401_UNAUTHORIZED, 284 | detail=ERROR_MESSAGES.NOT_FOUND, 285 | ) 286 | 287 | else: 288 | raise HTTPException( 289 | status_code=status.HTTP_401_UNAUTHORIZED, 290 | detail=ERROR_MESSAGES.NOT_FOUND, 291 | ) 292 | 293 | 294 | ############################ 295 | # ToolUserValves 296 | ############################ 297 | 298 | 299 | @router.get("/id/{id}/valves/user", response_model=Optional[dict]) 300 | async def get_toolkit_user_valves_by_id(id: str, user=Depends(get_verified_user)): 301 | toolkit = Tools.get_tool_by_id(id) 302 | if toolkit: 303 | try: 304 | user_valves = Tools.get_user_valves_by_id_and_user_id(id, user.id) 305 | return user_valves 306 | except Exception as e: 307 | raise HTTPException( 308 | status_code=status.HTTP_400_BAD_REQUEST, 309 | detail=ERROR_MESSAGES.DEFAULT(e), 310 | ) 311 | else: 312 | raise HTTPException( 313 | status_code=status.HTTP_401_UNAUTHORIZED, 314 | detail=ERROR_MESSAGES.NOT_FOUND, 315 | ) 316 | 317 | 318 | @router.get("/id/{id}/valves/user/spec", response_model=Optional[dict]) 319 | async def get_toolkit_user_valves_spec_by_id( 320 | request: Request, id: str, user=Depends(get_verified_user) 321 | ): 322 | toolkit = Tools.get_tool_by_id(id) 323 | if toolkit: 324 | if id in request.app.state.TOOLS: 325 | toolkit_module = request.app.state.TOOLS[id] 326 | else: 327 | toolkit_module, frontmatter = load_toolkit_module_by_id(id) 328 | request.app.state.TOOLS[id] = toolkit_module 329 | 330 | if hasattr(toolkit_module, "UserValves"): 331 | UserValves = toolkit_module.UserValves 332 | return UserValves.schema() 333 | return None 334 | else: 335 | raise HTTPException( 336 | status_code=status.HTTP_401_UNAUTHORIZED, 337 | detail=ERROR_MESSAGES.NOT_FOUND, 338 | ) 339 | 340 | 341 | @router.post("/id/{id}/valves/user/update", response_model=Optional[dict]) 342 | async def update_toolkit_user_valves_by_id( 343 | request: Request, id: str, form_data: dict, user=Depends(get_verified_user) 344 | ): 345 | toolkit = Tools.get_tool_by_id(id) 346 | 347 | if toolkit: 348 | if id in request.app.state.TOOLS: 349 | toolkit_module = request.app.state.TOOLS[id] 350 | else: 351 | toolkit_module, frontmatter = load_toolkit_module_by_id(id) 352 | request.app.state.TOOLS[id] = toolkit_module 353 | 354 | if hasattr(toolkit_module, "UserValves"): 355 | UserValves = toolkit_module.UserValves 356 | 357 | try: 358 | form_data = {k: v for k, v in form_data.items() if v is not None} 359 | user_valves = UserValves(**form_data) 360 | Tools.update_user_valves_by_id_and_user_id( 361 | id, user.id, user_valves.model_dump() 362 | ) 363 | return user_valves.model_dump() 364 | except Exception as e: 365 | print(e) 366 | raise HTTPException( 367 | status_code=status.HTTP_400_BAD_REQUEST, 368 | detail=ERROR_MESSAGES.DEFAULT(e), 369 | ) 370 | else: 371 | raise HTTPException( 372 | status_code=status.HTTP_401_UNAUTHORIZED, 373 | detail=ERROR_MESSAGES.NOT_FOUND, 374 | ) 375 | else: 376 | raise HTTPException( 377 | status_code=status.HTTP_401_UNAUTHORIZED, 378 | detail=ERROR_MESSAGES.NOT_FOUND, 379 | ) ``````` `\\?\D:\Coding\ai\backend\apps\webui\routers\users.py`: ```````py 1 | from fastapi import Response, Request 2 | from fastapi import Depends, FastAPI, HTTPException, status 3 | from datetime import datetime, timedelta 4 | from typing import List, Union, Optional 5 | 6 | from fastapi import APIRouter 7 | from pydantic import BaseModel 8 | import time 9 | import uuid 10 | import logging 11 | 12 | from apps.webui.models.users import ( 13 | UserModel, 14 | UserUpdateForm, 15 | UserRoleUpdateForm, 16 | UserSettings, 17 | Users, 18 | ) 19 | from apps.webui.models.auths import Auths 20 | from apps.webui.models.chats import Chats 21 | 22 | from utils.utils import ( 23 | get_verified_user, 24 | get_password_hash, 25 | get_current_user, 26 | get_admin_user, 27 | ) 28 | from constants import ERROR_MESSAGES 29 | 30 | from config import SRC_LOG_LEVELS 31 | 32 | log = logging.getLogger(__name__) 33 | log.setLevel(SRC_LOG_LEVELS["MODELS"]) 34 | 35 | router = APIRouter() 36 | 37 | ############################ 38 | # GetUsers 39 | ############################ 40 | 41 | 42 | @router.get("/", response_model=List[UserModel]) 43 | async def get_users(skip: int = 0, limit: int = 50, user=Depends(get_admin_user)): 44 | return Users.get_users(skip, limit) 45 | 46 | 47 | ############################ 48 | # User Permissions 49 | ############################ 50 | 51 | 52 | @router.get("/permissions/user") 53 | async def get_user_permissions(request: Request, user=Depends(get_admin_user)): 54 | return request.app.state.config.USER_PERMISSIONS 55 | 56 | 57 | @router.post("/permissions/user") 58 | async def update_user_permissions( 59 | request: Request, form_data: dict, user=Depends(get_admin_user) 60 | ): 61 | request.app.state.config.USER_PERMISSIONS = form_data 62 | return request.app.state.config.USER_PERMISSIONS 63 | 64 | 65 | ############################ 66 | # UpdateUserRole 67 | ############################ 68 | 69 | 70 | @router.post("/update/role", response_model=Optional[UserModel]) 71 | async def update_user_role(form_data: UserRoleUpdateForm, user=Depends(get_admin_user)): 72 | 73 | if user.id != form_data.id and form_data.id != Users.get_first_user().id: 74 | return Users.update_user_role_by_id(form_data.id, form_data.role) 75 | 76 | raise HTTPException( 77 | status_code=status.HTTP_403_FORBIDDEN, 78 | detail=ERROR_MESSAGES.ACTION_PROHIBITED, 79 | ) 80 | 81 | 82 | ############################ 83 | # GetUserSettingsBySessionUser 84 | ############################ 85 | 86 | 87 | @router.get("/user/settings", response_model=Optional[UserSettings]) 88 | async def get_user_settings_by_session_user(user=Depends(get_verified_user)): 89 | user = Users.get_user_by_id(user.id) 90 | if user: 91 | return user.settings 92 | else: 93 | raise HTTPException( 94 | status_code=status.HTTP_400_BAD_REQUEST, 95 | detail=ERROR_MESSAGES.USER_NOT_FOUND, 96 | ) 97 | 98 | 99 | ############################ 100 | # UpdateUserSettingsBySessionUser 101 | ############################ 102 | 103 | 104 | @router.post("/user/settings/update", response_model=UserSettings) 105 | async def update_user_settings_by_session_user( 106 | form_data: UserSettings, user=Depends(get_verified_user) 107 | ): 108 | user = Users.update_user_by_id(user.id, {"settings": form_data.model_dump()}) 109 | if user: 110 | return user.settings 111 | else: 112 | raise HTTPException( 113 | status_code=status.HTTP_400_BAD_REQUEST, 114 | detail=ERROR_MESSAGES.USER_NOT_FOUND, 115 | ) 116 | 117 | 118 | ############################ 119 | # GetUserInfoBySessionUser 120 | ############################ 121 | 122 | 123 | @router.get("/user/info", response_model=Optional[dict]) 124 | async def get_user_info_by_session_user(user=Depends(get_verified_user)): 125 | user = Users.get_user_by_id(user.id) 126 | if user: 127 | return user.info 128 | else: 129 | raise HTTPException( 130 | status_code=status.HTTP_400_BAD_REQUEST, 131 | detail=ERROR_MESSAGES.USER_NOT_FOUND, 132 | ) 133 | 134 | 135 | ############################ 136 | # UpdateUserInfoBySessionUser 137 | ############################ 138 | 139 | 140 | @router.post("/user/info/update", response_model=Optional[dict]) 141 | async def update_user_info_by_session_user( 142 | form_data: dict, user=Depends(get_verified_user) 143 | ): 144 | user = Users.get_user_by_id(user.id) 145 | if user: 146 | if user.info is None: 147 | user.info = {} 148 | 149 | user = Users.update_user_by_id(user.id, {"info": {**user.info, **form_data}}) 150 | if user: 151 | return user.info 152 | else: 153 | raise HTTPException( 154 | status_code=status.HTTP_400_BAD_REQUEST, 155 | detail=ERROR_MESSAGES.USER_NOT_FOUND, 156 | ) 157 | else: 158 | raise HTTPException( 159 | status_code=status.HTTP_400_BAD_REQUEST, 160 | detail=ERROR_MESSAGES.USER_NOT_FOUND, 161 | ) 162 | 163 | 164 | ############################ 165 | # GetUserById 166 | ############################ 167 | 168 | 169 | class UserResponse(BaseModel): 170 | name: str 171 | profile_image_url: str 172 | 173 | 174 | @router.get("/{user_id}", response_model=UserResponse) 175 | async def get_user_by_id(user_id: str, user=Depends(get_verified_user)): 176 | 177 | # Check if user_id is a shared chat 178 | # If it is, get the user_id from the chat 179 | if user_id.startswith("shared-"): 180 | chat_id = user_id.replace("shared-", "") 181 | chat = Chats.get_chat_by_id(chat_id) 182 | if chat: 183 | user_id = chat.user_id 184 | else: 185 | raise HTTPException( 186 | status_code=status.HTTP_400_BAD_REQUEST, 187 | detail=ERROR_MESSAGES.USER_NOT_FOUND, 188 | ) 189 | 190 | user = Users.get_user_by_id(user_id) 191 | 192 | if user: 193 | return UserResponse(name=user.name, profile_image_url=user.profile_image_url) 194 | else: 195 | raise HTTPException( 196 | status_code=status.HTTP_400_BAD_REQUEST, 197 | detail=ERROR_MESSAGES.USER_NOT_FOUND, 198 | ) 199 | 200 | 201 | ############################ 202 | # UpdateUserById 203 | ############################ 204 | 205 | 206 | @router.post("/{user_id}/update", response_model=Optional[UserModel]) 207 | async def update_user_by_id( 208 | user_id: str, 209 | form_data: UserUpdateForm, 210 | session_user=Depends(get_admin_user), 211 | ): 212 | user = Users.get_user_by_id(user_id) 213 | 214 | if user: 215 | if form_data.email.lower() != user.email: 216 | email_user = Users.get_user_by_email(form_data.email.lower()) 217 | if email_user: 218 | raise HTTPException( 219 | status_code=status.HTTP_400_BAD_REQUEST, 220 | detail=ERROR_MESSAGES.EMAIL_TAKEN, 221 | ) 222 | 223 | if form_data.password: 224 | hashed = get_password_hash(form_data.password) 225 | log.debug(f"hashed: {hashed}") 226 | Auths.update_user_password_by_id(user_id, hashed) 227 | 228 | Auths.update_email_by_id(user_id, form_data.email.lower()) 229 | updated_user = Users.update_user_by_id( 230 | user_id, 231 | { 232 | "name": form_data.name, 233 | "email": form_data.email.lower(), 234 | "profile_image_url": form_data.profile_image_url, 235 | }, 236 | ) 237 | 238 | if updated_user: 239 | return updated_user 240 | 241 | raise HTTPException( 242 | status_code=status.HTTP_400_BAD_REQUEST, 243 | detail=ERROR_MESSAGES.DEFAULT(), 244 | ) 245 | 246 | raise HTTPException( 247 | status_code=status.HTTP_400_BAD_REQUEST, 248 | detail=ERROR_MESSAGES.USER_NOT_FOUND, 249 | ) 250 | 251 | 252 | ############################ 253 | # DeleteUserById 254 | ############################ 255 | 256 | 257 | @router.delete("/{user_id}", response_model=bool) 258 | async def delete_user_by_id(user_id: str, user=Depends(get_admin_user)): 259 | if user.id != user_id: 260 | result = Auths.delete_auth_by_id(user_id) 261 | 262 | if result: 263 | return True 264 | 265 | raise HTTPException( 266 | status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, 267 | detail=ERROR_MESSAGES.DELETE_USER_ERROR, 268 | ) 269 | 270 | raise HTTPException( 271 | status_code=status.HTTP_403_FORBIDDEN, 272 | detail=ERROR_MESSAGES.ACTION_PROHIBITED, 273 | ) ``````` `\\?\D:\Coding\ai\backend\apps\webui\routers\utils.py`: ```````py 1 | from fastapi import APIRouter, UploadFile, File, Response 2 | from fastapi import Depends, HTTPException, status 3 | from starlette.responses import StreamingResponse, FileResponse 4 | from pydantic import BaseModel 5 | 6 | 7 | from fpdf import FPDF 8 | import markdown 9 | import black 10 | 11 | 12 | from utils.utils import get_admin_user 13 | from utils.misc import calculate_sha256, get_gravatar_url 14 | 15 | from config import OLLAMA_BASE_URLS, DATA_DIR, UPLOAD_DIR, ENABLE_ADMIN_EXPORT 16 | from constants import ERROR_MESSAGES 17 | from typing import List 18 | 19 | router = APIRouter() 20 | 21 | 22 | @router.get("/gravatar") 23 | async def get_gravatar( 24 | email: str, 25 | ): 26 | return get_gravatar_url(email) 27 | 28 | 29 | class CodeFormatRequest(BaseModel): 30 | code: str 31 | 32 | 33 | @router.post("/code/format") 34 | async def format_code(request: CodeFormatRequest): 35 | try: 36 | formatted_code = black.format_str(request.code, mode=black.Mode()) 37 | return {"code": formatted_code} 38 | except black.NothingChanged: 39 | return {"code": request.code} 40 | except Exception as e: 41 | raise HTTPException(status_code=400, detail=str(e)) 42 | 43 | 44 | class MarkdownForm(BaseModel): 45 | md: str 46 | 47 | 48 | @router.post("/markdown") 49 | async def get_html_from_markdown( 50 | form_data: MarkdownForm, 51 | ): 52 | return {"html": markdown.markdown(form_data.md)} 53 | 54 | 55 | class ChatForm(BaseModel): 56 | title: str 57 | messages: List[dict] 58 | 59 | 60 | @router.post("/pdf") 61 | async def download_chat_as_pdf( 62 | form_data: ChatForm, 63 | ): 64 | pdf = FPDF() 65 | pdf.add_page() 66 | 67 | STATIC_DIR = "./static" 68 | FONTS_DIR = f"{STATIC_DIR}/fonts" 69 | 70 | pdf.add_font("NotoSans", "", f"{FONTS_DIR}/NotoSans-Regular.ttf") 71 | pdf.add_font("NotoSans", "b", f"{FONTS_DIR}/NotoSans-Bold.ttf") 72 | pdf.add_font("NotoSans", "i", f"{FONTS_DIR}/NotoSans-Italic.ttf") 73 | pdf.add_font("NotoSansKR", "", f"{FONTS_DIR}/NotoSansKR-Regular.ttf") 74 | pdf.add_font("NotoSansJP", "", f"{FONTS_DIR}/NotoSansJP-Regular.ttf") 75 | 76 | pdf.set_font("NotoSans", size=12) 77 | pdf.set_fallback_fonts(["NotoSansKR", "NotoSansJP"]) 78 | 79 | pdf.set_auto_page_break(auto=True, margin=15) 80 | 81 | # Adjust the effective page width for multi_cell 82 | effective_page_width = ( 83 | pdf.w - 2 * pdf.l_margin - 10 84 | ) # Subtracted an additional 10 for extra padding 85 | 86 | # Add chat messages 87 | for message in form_data.messages: 88 | role = message["role"] 89 | content = message["content"] 90 | pdf.set_font("NotoSans", "B", size=14) # Bold for the role 91 | pdf.multi_cell(effective_page_width, 10, f"{role.upper()}", 0, "L") 92 | pdf.ln(1) # Extra space between messages 93 | 94 | pdf.set_font("NotoSans", size=10) # Regular for content 95 | pdf.multi_cell(effective_page_width, 6, content, 0, "L") 96 | pdf.ln(1.5) # Extra space between messages 97 | 98 | # Save the pdf with name .pdf 99 | pdf_bytes = pdf.output() 100 | 101 | return Response( 102 | content=bytes(pdf_bytes), 103 | media_type="application/pdf", 104 | headers={"Content-Disposition": f"attachment;filename=chat.pdf"}, 105 | ) 106 | 107 | 108 | @router.get("/db/download") 109 | async def download_db(user=Depends(get_admin_user)): 110 | if not ENABLE_ADMIN_EXPORT: 111 | raise HTTPException( 112 | status_code=status.HTTP_401_UNAUTHORIZED, 113 | detail=ERROR_MESSAGES.ACCESS_PROHIBITED, 114 | ) 115 | from apps.webui.internal.db import engine 116 | 117 | if engine.name != "sqlite": 118 | raise HTTPException( 119 | status_code=status.HTTP_400_BAD_REQUEST, 120 | detail=ERROR_MESSAGES.DB_NOT_SQLITE, 121 | ) 122 | return FileResponse( 123 | engine.url.database, 124 | media_type="application/octet-stream", 125 | filename="webui.db", 126 | ) 127 | 128 | 129 | @router.get("/litellm/config") 130 | async def download_litellm_config_yaml(user=Depends(get_admin_user)): 131 | return FileResponse( 132 | f"{DATA_DIR}/litellm/config.yaml", 133 | media_type="application/octet-stream", 134 | filename="config.yaml", 135 | ) ``````` `\\?\D:\Coding\ai\backend\apps\webui\utils.py`: ```````py 1 | from importlib import util 2 | import os 3 | import re 4 | 5 | from config import TOOLS_DIR, FUNCTIONS_DIR 6 | 7 | 8 | def extract_frontmatter(file_path): 9 | """ 10 | Extract frontmatter as a dictionary from the specified file path. 11 | """ 12 | frontmatter = {} 13 | frontmatter_started = False 14 | frontmatter_ended = False 15 | frontmatter_pattern = re.compile(r"^\s*([a-z_]+):\s*(.*)\s*$", re.IGNORECASE) 16 | 17 | try: 18 | with open(file_path, "r", encoding="utf-8") as file: 19 | first_line = file.readline() 20 | if first_line.strip() != '"""': 21 | # The file doesn't start with triple quotes 22 | return {} 23 | 24 | frontmatter_started = True 25 | 26 | for line in file: 27 | if '"""' in line: 28 | if frontmatter_started: 29 | frontmatter_ended = True 30 | break 31 | 32 | if frontmatter_started and not frontmatter_ended: 33 | match = frontmatter_pattern.match(line) 34 | if match: 35 | key, value = match.groups() 36 | frontmatter[key.strip()] = value.strip() 37 | 38 | except FileNotFoundError: 39 | print(f"Error: The file {file_path} does not exist.") 40 | return {} 41 | except Exception as e: 42 | print(f"An error occurred: {e}") 43 | return {} 44 | 45 | return frontmatter 46 | 47 | 48 | def load_toolkit_module_by_id(toolkit_id): 49 | toolkit_path = os.path.join(TOOLS_DIR, f"{toolkit_id}.py") 50 | spec = util.spec_from_file_location(toolkit_id, toolkit_path) 51 | module = util.module_from_spec(spec) 52 | frontmatter = extract_frontmatter(toolkit_path) 53 | 54 | try: 55 | spec.loader.exec_module(module) 56 | print(f"Loaded module: {module.__name__}") 57 | if hasattr(module, "Tools"): 58 | return module.Tools(), frontmatter 59 | else: 60 | raise Exception("No Tools class found") 61 | except Exception as e: 62 | print(f"Error loading module: {toolkit_id}") 63 | # Move the file to the error folder 64 | os.rename(toolkit_path, f"{toolkit_path}.error") 65 | raise e 66 | 67 | 68 | def load_function_module_by_id(function_id): 69 | function_path = os.path.join(FUNCTIONS_DIR, f"{function_id}.py") 70 | 71 | spec = util.spec_from_file_location(function_id, function_path) 72 | module = util.module_from_spec(spec) 73 | frontmatter = extract_frontmatter(function_path) 74 | 75 | try: 76 | spec.loader.exec_module(module) 77 | print(f"Loaded module: {module.__name__}") 78 | if hasattr(module, "Pipe"): 79 | return module.Pipe(), "pipe", frontmatter 80 | elif hasattr(module, "Filter"): 81 | return module.Filter(), "filter", frontmatter 82 | elif hasattr(module, "Action"): 83 | return module.Action(), "action", frontmatter 84 | else: 85 | raise Exception("No Function class found") 86 | except Exception as e: 87 | print(f"Error loading module: {function_id}") 88 | # Move the file to the error folder 89 | os.rename(function_path, f"{function_path}.error") 90 | raise e ``````` `\\?\D:\Coding\ai\backend\config.py`: ```````py 1 | import os 2 | import sys 3 | import logging 4 | import importlib.metadata 5 | import pkgutil 6 | import chromadb 7 | from chromadb import Settings 8 | from bs4 import BeautifulSoup 9 | from typing import TypeVar, Generic 10 | from pydantic import BaseModel 11 | from typing import Optional 12 | 13 | from pathlib import Path 14 | import json 15 | import yaml 16 | 17 | import markdown 18 | import requests 19 | import shutil 20 | 21 | from constants import ERROR_MESSAGES 22 | 23 | #################################### 24 | # Load .env file 25 | #################################### 26 | 27 | BACKEND_DIR = Path(__file__).parent # the path containing this file 28 | BASE_DIR = BACKEND_DIR.parent # the path containing the backend/ 29 | 30 | print(BASE_DIR) 31 | 32 | try: 33 | from dotenv import load_dotenv, find_dotenv 34 | 35 | load_dotenv(find_dotenv(str(BASE_DIR / ".env"))) 36 | except ImportError: 37 | print("dotenv not installed, skipping...") 38 | 39 | 40 | #################################### 41 | # LOGGING 42 | #################################### 43 | 44 | log_levels = ["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG"] 45 | 46 | GLOBAL_LOG_LEVEL = os.environ.get("GLOBAL_LOG_LEVEL", "").upper() 47 | if GLOBAL_LOG_LEVEL in log_levels: 48 | logging.basicConfig(stream=sys.stdout, level=GLOBAL_LOG_LEVEL, force=True) 49 | else: 50 | GLOBAL_LOG_LEVEL = "INFO" 51 | 52 | log = logging.getLogger(__name__) 53 | log.info(f"GLOBAL_LOG_LEVEL: {GLOBAL_LOG_LEVEL}") 54 | 55 | log_sources = [ 56 | "AUDIO", 57 | "COMFYUI", 58 | "CONFIG", 59 | "DB", 60 | "IMAGES", 61 | "MAIN", 62 | "MODELS", 63 | "OLLAMA", 64 | "OPENAI", 65 | "RAG", 66 | "WEBHOOK", 67 | ] 68 | 69 | SRC_LOG_LEVELS = {} 70 | 71 | for source in log_sources: 72 | log_env_var = source + "_LOG_LEVEL" 73 | SRC_LOG_LEVELS[source] = os.environ.get(log_env_var, "").upper() 74 | if SRC_LOG_LEVELS[source] not in log_levels: 75 | SRC_LOG_LEVELS[source] = GLOBAL_LOG_LEVEL 76 | log.info(f"{log_env_var}: {SRC_LOG_LEVELS[source]}") 77 | 78 | log.setLevel(SRC_LOG_LEVELS["CONFIG"]) 79 | 80 | 81 | class EndpointFilter(logging.Filter): 82 | def filter(self, record: logging.LogRecord) -> bool: 83 | return record.getMessage().find("/health") == -1 84 | 85 | 86 | # Filter out /endpoint 87 | logging.getLogger("uvicorn.access").addFilter(EndpointFilter()) 88 | 89 | 90 | WEBUI_NAME = os.environ.get("WEBUI_NAME", "Chat") 91 | # if WEBUI_NAME != "Open WebUI": 92 | # WEBUI_NAME += " (Open WebUI)" 93 | 94 | WEBUI_URL = os.environ.get("WEBUI_URL", "http://localhost:3000") 95 | 96 | WEBUI_FAVICON_URL = "https://i.ibb.co/PYgRWdH/official-siri-icon-macos-sierra-by-tracedesign-da7cihj-pre-1.png" 97 | 98 | 99 | #################################### 100 | # ENV (dev,test,prod) 101 | #################################### 102 | 103 | ENV = os.environ.get("ENV", "dev") 104 | 105 | try: 106 | PACKAGE_DATA = json.loads((BASE_DIR / "package.json").read_text()) 107 | except: 108 | try: 109 | PACKAGE_DATA = {"version": importlib.metadata.version("open-webui")} 110 | except importlib.metadata.PackageNotFoundError: 111 | PACKAGE_DATA = {"version": "0.0.0"} 112 | 113 | VERSION = PACKAGE_DATA["version"] 114 | 115 | 116 | # Function to parse each section 117 | def parse_section(section): 118 | items = [] 119 | for li in section.find_all("li"): 120 | # Extract raw HTML string 121 | raw_html = str(li) 122 | 123 | # Extract text without HTML tags 124 | text = li.get_text(separator=" ", strip=True) 125 | 126 | # Split into title and content 127 | parts = text.split(": ", 1) 128 | title = parts[0].strip() if len(parts) > 1 else "" 129 | content = parts[1].strip() if len(parts) > 1 else text 130 | 131 | items.append({"title": title, "content": content, "raw": raw_html}) 132 | return items 133 | 134 | 135 | try: 136 | changelog_path = BASE_DIR / "CHANGELOG.md" 137 | with open(str(changelog_path.absolute()), "r", encoding="utf8") as file: 138 | changelog_content = file.read() 139 | 140 | except: 141 | changelog_content = (pkgutil.get_data("open_webui", "CHANGELOG.md") or b"").decode() 142 | 143 | 144 | # Convert markdown content to HTML 145 | html_content = markdown.markdown(changelog_content) 146 | 147 | # Parse the HTML content 148 | soup = BeautifulSoup(html_content, "html.parser") 149 | 150 | # Initialize JSON structure 151 | changelog_json = {} 152 | 153 | # Iterate over each version 154 | for version in soup.find_all("h2"): 155 | version_number = version.get_text().strip().split(" - ")[0][1:-1] # Remove brackets 156 | date = version.get_text().strip().split(" - ")[1] 157 | 158 | version_data = {"date": date} 159 | 160 | # Find the next sibling that is a h3 tag (section title) 161 | current = version.find_next_sibling() 162 | 163 | while current and current.name != "h2": 164 | if current.name == "h3": 165 | section_title = current.get_text().lower() # e.g., "added", "fixed" 166 | section_items = parse_section(current.find_next_sibling("ul")) 167 | version_data[section_title] = section_items 168 | 169 | # Move to the next element 170 | current = current.find_next_sibling() 171 | 172 | changelog_json[version_number] = version_data 173 | 174 | 175 | CHANGELOG = changelog_json 176 | 177 | 178 | #################################### 179 | # SAFE_MODE 180 | #################################### 181 | 182 | SAFE_MODE = os.environ.get("SAFE_MODE", "false").lower() == "true" 183 | 184 | #################################### 185 | # WEBUI_BUILD_HASH 186 | #################################### 187 | 188 | WEBUI_BUILD_HASH = os.environ.get("WEBUI_BUILD_HASH", "dev-build") 189 | 190 | #################################### 191 | # DATA/FRONTEND BUILD DIR 192 | #################################### 193 | 194 | DATA_DIR = Path(os.getenv("DATA_DIR", BACKEND_DIR / "data")).resolve() 195 | FRONTEND_BUILD_DIR = Path(os.getenv("FRONTEND_BUILD_DIR", BASE_DIR / "build")).resolve() 196 | 197 | RESET_CONFIG_ON_START = ( 198 | os.environ.get("RESET_CONFIG_ON_START", "False").lower() == "true" 199 | ) 200 | if RESET_CONFIG_ON_START: 201 | try: 202 | os.remove(f"{DATA_DIR}/config.json") 203 | with open(f"{DATA_DIR}/config.json", "w") as f: 204 | f.write("{}") 205 | except: 206 | pass 207 | 208 | try: 209 | CONFIG_DATA = json.loads((DATA_DIR / "config.json").read_text()) 210 | except: 211 | CONFIG_DATA = {} 212 | 213 | 214 | #################################### 215 | # Config helpers 216 | #################################### 217 | 218 | 219 | def save_config(): 220 | try: 221 | with open(f"{DATA_DIR}/config.json", "w") as f: 222 | json.dump(CONFIG_DATA, f, indent="\t") 223 | except Exception as e: 224 | log.exception(e) 225 | 226 | 227 | def get_config_value(config_path: str): 228 | path_parts = config_path.split(".") 229 | cur_config = CONFIG_DATA 230 | for key in path_parts: 231 | if key in cur_config: 232 | cur_config = cur_config[key] 233 | else: 234 | return None 235 | return cur_config 236 | 237 | 238 | T = TypeVar("T") 239 | 240 | 241 | class PersistentConfig(Generic[T]): 242 | def __init__(self, env_name: str, config_path: str, env_value: T): 243 | self.env_name = env_name 244 | self.config_path = config_path 245 | self.env_value = env_value 246 | self.config_value = get_config_value(config_path) 247 | if self.config_value is not None: 248 | log.info(f"'{env_name}' loaded from config.json") 249 | self.value = self.config_value 250 | else: 251 | self.value = env_value 252 | 253 | def __str__(self): 254 | return str(self.value) 255 | 256 | @property 257 | def __dict__(self): 258 | raise TypeError( 259 | "PersistentConfig object cannot be converted to dict, use config_get or .value instead." 260 | ) 261 | 262 | def __getattribute__(self, item): 263 | if item == "__dict__": 264 | raise TypeError( 265 | "PersistentConfig object cannot be converted to dict, use config_get or .value instead." 266 | ) 267 | return super().__getattribute__(item) 268 | 269 | def save(self): 270 | # Don't save if the value is the same as the env value and the config value 271 | if self.env_value == self.value: 272 | if self.config_value == self.value: 273 | return 274 | log.info(f"Saving '{self.env_name}' to config.json") 275 | path_parts = self.config_path.split(".") 276 | config = CONFIG_DATA 277 | for key in path_parts[:-1]: 278 | if key not in config: 279 | config[key] = {} 280 | config = config[key] 281 | config[path_parts[-1]] = self.value 282 | save_config() 283 | self.config_value = self.value 284 | 285 | 286 | class AppConfig: 287 | _state: dict[str, PersistentConfig] 288 | 289 | def __init__(self): 290 | super().__setattr__("_state", {}) 291 | 292 | def __setattr__(self, key, value): 293 | if isinstance(value, PersistentConfig): 294 | self._state[key] = value 295 | else: 296 | self._state[key].value = value 297 | self._state[key].save() 298 | 299 | def __getattr__(self, key): 300 | return self._state[key].value 301 | 302 | 303 | #################################### 304 | # WEBUI_AUTH (Required for security) 305 | #################################### 306 | 307 | WEBUI_AUTH = os.environ.get("WEBUI_AUTH", "True").lower() == "true" 308 | WEBUI_AUTH_TRUSTED_EMAIL_HEADER = os.environ.get( 309 | "WEBUI_AUTH_TRUSTED_EMAIL_HEADER", None 310 | ) 311 | WEBUI_AUTH_TRUSTED_NAME_HEADER = os.environ.get("WEBUI_AUTH_TRUSTED_NAME_HEADER", None) 312 | JWT_EXPIRES_IN = PersistentConfig( 313 | "JWT_EXPIRES_IN", "auth.jwt_expiry", os.environ.get("JWT_EXPIRES_IN", "-1") 314 | ) 315 | 316 | #################################### 317 | # OAuth config 318 | #################################### 319 | 320 | ENABLE_OAUTH_SIGNUP = PersistentConfig( 321 | "ENABLE_OAUTH_SIGNUP", 322 | "oauth.enable_signup", 323 | os.environ.get("ENABLE_OAUTH_SIGNUP", "False").lower() == "true", 324 | ) 325 | 326 | OAUTH_MERGE_ACCOUNTS_BY_EMAIL = PersistentConfig( 327 | "OAUTH_MERGE_ACCOUNTS_BY_EMAIL", 328 | "oauth.merge_accounts_by_email", 329 | os.environ.get("OAUTH_MERGE_ACCOUNTS_BY_EMAIL", "False").lower() == "true", 330 | ) 331 | 332 | OAUTH_PROVIDERS = {} 333 | 334 | GOOGLE_CLIENT_ID = PersistentConfig( 335 | "GOOGLE_CLIENT_ID", 336 | "oauth.google.client_id", 337 | os.environ.get("GOOGLE_CLIENT_ID", ""), 338 | ) 339 | 340 | GOOGLE_CLIENT_SECRET = PersistentConfig( 341 | "GOOGLE_CLIENT_SECRET", 342 | "oauth.google.client_secret", 343 | os.environ.get("GOOGLE_CLIENT_SECRET", ""), 344 | ) 345 | 346 | GOOGLE_OAUTH_SCOPE = PersistentConfig( 347 | "GOOGLE_OAUTH_SCOPE", 348 | "oauth.google.scope", 349 | os.environ.get("GOOGLE_OAUTH_SCOPE", "openid email profile"), 350 | ) 351 | 352 | MICROSOFT_CLIENT_ID = PersistentConfig( 353 | "MICROSOFT_CLIENT_ID", 354 | "oauth.microsoft.client_id", 355 | os.environ.get("MICROSOFT_CLIENT_ID", ""), 356 | ) 357 | 358 | MICROSOFT_CLIENT_SECRET = PersistentConfig( 359 | "MICROSOFT_CLIENT_SECRET", 360 | "oauth.microsoft.client_secret", 361 | os.environ.get("MICROSOFT_CLIENT_SECRET", ""), 362 | ) 363 | 364 | MICROSOFT_CLIENT_TENANT_ID = PersistentConfig( 365 | "MICROSOFT_CLIENT_TENANT_ID", 366 | "oauth.microsoft.tenant_id", 367 | os.environ.get("MICROSOFT_CLIENT_TENANT_ID", ""), 368 | ) 369 | 370 | MICROSOFT_OAUTH_SCOPE = PersistentConfig( 371 | "MICROSOFT_OAUTH_SCOPE", 372 | "oauth.microsoft.scope", 373 | os.environ.get("MICROSOFT_OAUTH_SCOPE", "openid email profile"), 374 | ) 375 | 376 | OAUTH_CLIENT_ID = PersistentConfig( 377 | "OAUTH_CLIENT_ID", 378 | "oauth.oidc.client_id", 379 | os.environ.get("OAUTH_CLIENT_ID", ""), 380 | ) 381 | 382 | OAUTH_CLIENT_SECRET = PersistentConfig( 383 | "OAUTH_CLIENT_SECRET", 384 | "oauth.oidc.client_secret", 385 | os.environ.get("OAUTH_CLIENT_SECRET", ""), 386 | ) 387 | 388 | OPENID_PROVIDER_URL = PersistentConfig( 389 | "OPENID_PROVIDER_URL", 390 | "oauth.oidc.provider_url", 391 | os.environ.get("OPENID_PROVIDER_URL", ""), 392 | ) 393 | 394 | OAUTH_SCOPES = PersistentConfig( 395 | "OAUTH_SCOPES", 396 | "oauth.oidc.scopes", 397 | os.environ.get("OAUTH_SCOPES", "openid email profile"), 398 | ) 399 | 400 | OAUTH_PROVIDER_NAME = PersistentConfig( 401 | "OAUTH_PROVIDER_NAME", 402 | "oauth.oidc.provider_name", 403 | os.environ.get("OAUTH_PROVIDER_NAME", "SSO"), 404 | ) 405 | 406 | OAUTH_USERNAME_CLAIM = PersistentConfig( 407 | "OAUTH_USERNAME_CLAIM", 408 | "oauth.oidc.username_claim", 409 | os.environ.get("OAUTH_USERNAME_CLAIM", "name"), 410 | ) 411 | 412 | OAUTH_PICTURE_CLAIM = PersistentConfig( 413 | "OAUTH_USERNAME_CLAIM", 414 | "oauth.oidc.avatar_claim", 415 | os.environ.get("OAUTH_PICTURE_CLAIM", "picture"), 416 | ) 417 | 418 | 419 | def load_oauth_providers(): 420 | OAUTH_PROVIDERS.clear() 421 | if GOOGLE_CLIENT_ID.value and GOOGLE_CLIENT_SECRET.value: 422 | OAUTH_PROVIDERS["google"] = { 423 | "client_id": GOOGLE_CLIENT_ID.value, 424 | "client_secret": GOOGLE_CLIENT_SECRET.value, 425 | "server_metadata_url": "https://accounts.google.com/.well-known/openid-configuration", 426 | "scope": GOOGLE_OAUTH_SCOPE.value, 427 | } 428 | 429 | if ( 430 | MICROSOFT_CLIENT_ID.value 431 | and MICROSOFT_CLIENT_SECRET.value 432 | and MICROSOFT_CLIENT_TENANT_ID.value 433 | ): 434 | OAUTH_PROVIDERS["microsoft"] = { 435 | "client_id": MICROSOFT_CLIENT_ID.value, 436 | "client_secret": MICROSOFT_CLIENT_SECRET.value, 437 | "server_metadata_url": f"https://login.microsoftonline.com/{MICROSOFT_CLIENT_TENANT_ID.value}/v2.0/.well-known/openid-configuration", 438 | "scope": MICROSOFT_OAUTH_SCOPE.value, 439 | } 440 | 441 | if ( 442 | OAUTH_CLIENT_ID.value 443 | and OAUTH_CLIENT_SECRET.value 444 | and OPENID_PROVIDER_URL.value 445 | ): 446 | OAUTH_PROVIDERS["oidc"] = { 447 | "client_id": OAUTH_CLIENT_ID.value, 448 | "client_secret": OAUTH_CLIENT_SECRET.value, 449 | "server_metadata_url": OPENID_PROVIDER_URL.value, 450 | "scope": OAUTH_SCOPES.value, 451 | "name": OAUTH_PROVIDER_NAME.value, 452 | } 453 | 454 | 455 | load_oauth_providers() 456 | 457 | #################################### 458 | # Static DIR 459 | #################################### 460 | 461 | STATIC_DIR = Path(os.getenv("STATIC_DIR", BACKEND_DIR / "static")).resolve() 462 | 463 | frontend_favicon = FRONTEND_BUILD_DIR / "static" / "favicon.png" 464 | 465 | if frontend_favicon.exists(): 466 | try: 467 | shutil.copyfile(frontend_favicon, STATIC_DIR / "favicon.png") 468 | except Exception as e: 469 | logging.error(f"An error occurred: {e}") 470 | else: 471 | logging.warning(f"Frontend favicon not found at {frontend_favicon}") 472 | 473 | frontend_splash = FRONTEND_BUILD_DIR / "static" / "splash.png" 474 | 475 | if frontend_splash.exists(): 476 | try: 477 | shutil.copyfile(frontend_splash, STATIC_DIR / "splash.png") 478 | except Exception as e: 479 | logging.error(f"An error occurred: {e}") 480 | else: 481 | logging.warning(f"Frontend splash not found at {frontend_splash}") 482 | 483 | 484 | #################################### 485 | # CUSTOM_NAME 486 | #################################### 487 | 488 | CUSTOM_NAME = os.environ.get("CUSTOM_NAME", "") 489 | 490 | if CUSTOM_NAME: 491 | try: 492 | r = requests.get(f"https://api.openwebui.com/api/v1/custom/{CUSTOM_NAME}") 493 | data = r.json() 494 | if r.ok: 495 | if "logo" in data: 496 | WEBUI_FAVICON_URL = url = ( 497 | f"https://api.openwebui.com{data['logo']}" 498 | if data["logo"][0] == "/" 499 | else data["logo"] 500 | ) 501 | 502 | r = requests.get(url, stream=True) 503 | if r.status_code == 200: 504 | with open(f"{STATIC_DIR}/favicon.png", "wb") as f: 505 | r.raw.decode_content = True 506 | shutil.copyfileobj(r.raw, f) 507 | 508 | if "splash" in data: 509 | url = ( 510 | f"https://api.openwebui.com{data['splash']}" 511 | if data["splash"][0] == "/" 512 | else data["splash"] 513 | ) 514 | 515 | r = requests.get(url, stream=True) 516 | if r.status_code == 200: 517 | with open(f"{STATIC_DIR}/splash.png", "wb") as f: 518 | r.raw.decode_content = True 519 | shutil.copyfileobj(r.raw, f) 520 | 521 | WEBUI_NAME = data["name"] 522 | except Exception as e: 523 | log.exception(e) 524 | pass 525 | 526 | 527 | #################################### 528 | # File Upload DIR 529 | #################################### 530 | 531 | UPLOAD_DIR = f"{DATA_DIR}/uploads" 532 | Path(UPLOAD_DIR).mkdir(parents=True, exist_ok=True) 533 | 534 | 535 | #################################### 536 | # Cache DIR 537 | #################################### 538 | 539 | CACHE_DIR = f"{DATA_DIR}/cache" 540 | Path(CACHE_DIR).mkdir(parents=True, exist_ok=True) 541 | 542 | 543 | #################################### 544 | # Docs DIR 545 | #################################### 546 | 547 | DOCS_DIR = os.getenv("DOCS_DIR", f"{DATA_DIR}/docs") 548 | Path(DOCS_DIR).mkdir(parents=True, exist_ok=True) 549 | 550 | 551 | #################################### 552 | # Tools DIR 553 | #################################### 554 | 555 | TOOLS_DIR = os.getenv("TOOLS_DIR", f"{DATA_DIR}/tools") 556 | Path(TOOLS_DIR).mkdir(parents=True, exist_ok=True) 557 | 558 | 559 | #################################### 560 | # Functions DIR 561 | #################################### 562 | 563 | FUNCTIONS_DIR = os.getenv("FUNCTIONS_DIR", f"{DATA_DIR}/functions") 564 | Path(FUNCTIONS_DIR).mkdir(parents=True, exist_ok=True) 565 | 566 | 567 | #################################### 568 | # LITELLM_CONFIG 569 | #################################### 570 | 571 | 572 | def create_config_file(file_path): 573 | directory = os.path.dirname(file_path) 574 | 575 | # Check if directory exists, if not, create it 576 | if not os.path.exists(directory): 577 | os.makedirs(directory) 578 | 579 | # Data to write into the YAML file 580 | config_data = { 581 | "general_settings": {}, 582 | "litellm_settings": {}, 583 | "model_list": [], 584 | "router_settings": {}, 585 | } 586 | 587 | # Write data to YAML file 588 | with open(file_path, "w") as file: 589 | yaml.dump(config_data, file) 590 | 591 | 592 | LITELLM_CONFIG_PATH = f"{DATA_DIR}/litellm/config.yaml" 593 | 594 | # if not os.path.exists(LITELLM_CONFIG_PATH): 595 | # log.info("Config file doesn't exist. Creating...") 596 | # create_config_file(LITELLM_CONFIG_PATH) 597 | # log.info("Config file created successfully.") 598 | 599 | 600 | #################################### 601 | # OLLAMA_BASE_URL 602 | #################################### 603 | 604 | 605 | ENABLE_OLLAMA_API = PersistentConfig( 606 | "ENABLE_OLLAMA_API", 607 | "ollama.enable", 608 | os.environ.get("ENABLE_OLLAMA_API", "True").lower() == "true", 609 | ) 610 | 611 | OLLAMA_API_BASE_URL = os.environ.get( 612 | "OLLAMA_API_BASE_URL", "http://localhost:11434/api" 613 | ) 614 | 615 | OLLAMA_BASE_URL = os.environ.get("OLLAMA_BASE_URL", "") 616 | AIOHTTP_CLIENT_TIMEOUT = os.environ.get("AIOHTTP_CLIENT_TIMEOUT", "") 617 | 618 | if AIOHTTP_CLIENT_TIMEOUT == "": 619 | AIOHTTP_CLIENT_TIMEOUT = None 620 | else: 621 | try: 622 | AIOHTTP_CLIENT_TIMEOUT = int(AIOHTTP_CLIENT_TIMEOUT) 623 | except: 624 | AIOHTTP_CLIENT_TIMEOUT = 300 625 | 626 | 627 | K8S_FLAG = os.environ.get("K8S_FLAG", "") 628 | USE_OLLAMA_DOCKER = os.environ.get("USE_OLLAMA_DOCKER", "false") 629 | 630 | if OLLAMA_BASE_URL == "" and OLLAMA_API_BASE_URL != "": 631 | OLLAMA_BASE_URL = ( 632 | OLLAMA_API_BASE_URL[:-4] 633 | if OLLAMA_API_BASE_URL.endswith("/api") 634 | else OLLAMA_API_BASE_URL 635 | ) 636 | 637 | if ENV == "prod": 638 | if OLLAMA_BASE_URL == "/ollama" and not K8S_FLAG: 639 | if USE_OLLAMA_DOCKER.lower() == "true": 640 | # if you use all-in-one docker container (Open WebUI + Ollama) 641 | # with the docker build arg USE_OLLAMA=true (--build-arg="USE_OLLAMA=true") this only works with http://localhost:11434 642 | OLLAMA_BASE_URL = "http://localhost:11434" 643 | else: 644 | OLLAMA_BASE_URL = "http://host.docker.internal:11434" 645 | elif K8S_FLAG: 646 | OLLAMA_BASE_URL = "http://ollama-service.open-webui.svc.cluster.local:11434" 647 | 648 | 649 | OLLAMA_BASE_URLS = os.environ.get("OLLAMA_BASE_URLS", "") 650 | OLLAMA_BASE_URLS = OLLAMA_BASE_URLS if OLLAMA_BASE_URLS != "" else OLLAMA_BASE_URL 651 | 652 | OLLAMA_BASE_URLS = [url.strip() for url in OLLAMA_BASE_URLS.split(";")] 653 | OLLAMA_BASE_URLS = PersistentConfig( 654 | "OLLAMA_BASE_URLS", "ollama.base_urls", OLLAMA_BASE_URLS 655 | ) 656 | 657 | #################################### 658 | # OPENAI_API 659 | #################################### 660 | 661 | 662 | ENABLE_OPENAI_API = PersistentConfig( 663 | "ENABLE_OPENAI_API", 664 | "openai.enable", 665 | os.environ.get("ENABLE_OPENAI_API", "True").lower() == "true", 666 | ) 667 | 668 | 669 | OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY", "") 670 | OPENAI_API_BASE_URL = os.environ.get("OPENAI_API_BASE_URL", "") 671 | 672 | 673 | if OPENAI_API_BASE_URL == "": 674 | OPENAI_API_BASE_URL = "https://api.openai.com/v1" 675 | 676 | OPENAI_API_KEYS = os.environ.get("OPENAI_API_KEYS", "") 677 | OPENAI_API_KEYS = OPENAI_API_KEYS if OPENAI_API_KEYS != "" else OPENAI_API_KEY 678 | 679 | OPENAI_API_KEYS = [url.strip() for url in OPENAI_API_KEYS.split(";")] 680 | OPENAI_API_KEYS = PersistentConfig( 681 | "OPENAI_API_KEYS", "openai.api_keys", OPENAI_API_KEYS 682 | ) 683 | 684 | OPENAI_API_BASE_URLS = os.environ.get("OPENAI_API_BASE_URLS", "") 685 | OPENAI_API_BASE_URLS = ( 686 | OPENAI_API_BASE_URLS if OPENAI_API_BASE_URLS != "" else OPENAI_API_BASE_URL 687 | ) 688 | 689 | OPENAI_API_BASE_URLS = [ 690 | url.strip() if url != "" else "https://api.openai.com/v1" 691 | for url in OPENAI_API_BASE_URLS.split(";") 692 | ] 693 | OPENAI_API_BASE_URLS = PersistentConfig( 694 | "OPENAI_API_BASE_URLS", "openai.api_base_urls", OPENAI_API_BASE_URLS 695 | ) 696 | 697 | OPENAI_API_KEY = "" 698 | 699 | try: 700 | OPENAI_API_KEY = OPENAI_API_KEYS.value[ 701 | OPENAI_API_BASE_URLS.value.index("https://api.openai.com/v1") 702 | ] 703 | except: 704 | pass 705 | 706 | OPENAI_API_BASE_URL = "https://api.openai.com/v1" 707 | 708 | #################################### 709 | # WEBUI 710 | #################################### 711 | 712 | ENABLE_SIGNUP = PersistentConfig( 713 | "ENABLE_SIGNUP", 714 | "ui.enable_signup", 715 | ( 716 | False 717 | if not WEBUI_AUTH 718 | else os.environ.get("ENABLE_SIGNUP", "True").lower() == "true" 719 | ), 720 | ) 721 | 722 | DEFAULT_LOCALE = PersistentConfig( 723 | "DEFAULT_LOCALE", 724 | "ui.default_locale", 725 | os.environ.get("DEFAULT_LOCALE", ""), 726 | ) 727 | 728 | DEFAULT_MODELS = PersistentConfig( 729 | "DEFAULT_MODELS", "ui.default_models", os.environ.get("DEFAULT_MODELS", None) 730 | ) 731 | 732 | DEFAULT_PROMPT_SUGGESTIONS = PersistentConfig( 733 | "DEFAULT_PROMPT_SUGGESTIONS", 734 | "ui.prompt_suggestions", 735 | [ 736 | { 737 | "title": ["Help me study", "vocabulary for a college entrance exam"], 738 | "content": "Help me study vocabulary: write a sentence for me to fill in the blank, and I'll try to pick the correct option.", 739 | }, 740 | { 741 | "title": ["Give me ideas", "for what to do with my kids' art"], 742 | "content": "What are 5 creative things I could do with my kids' art? I don't want to throw them away, but it's also so much clutter.", 743 | }, 744 | { 745 | "title": ["Tell me a fun fact", "about the Roman Empire"], 746 | "content": "Tell me a random fun fact about the Roman Empire", 747 | }, 748 | { 749 | "title": ["Show me a code snippet", "of a website's sticky header"], 750 | "content": "Show me a code snippet of a website's sticky header in CSS and JavaScript.", 751 | }, 752 | { 753 | "title": [ 754 | "Explain options trading", 755 | "if I'm familiar with buying and selling stocks", 756 | ], 757 | "content": "Explain options trading in simple terms if I'm familiar with buying and selling stocks.", 758 | }, 759 | { 760 | "title": ["Overcome procrastination", "give me tips"], 761 | "content": "Could you start by asking me about instances when I procrastinate the most and then give me some suggestions to overcome it?", 762 | }, 763 | ], 764 | ) 765 | 766 | DEFAULT_USER_ROLE = PersistentConfig( 767 | "DEFAULT_USER_ROLE", 768 | "ui.default_user_role", 769 | os.getenv("DEFAULT_USER_ROLE", "pending"), 770 | ) 771 | 772 | USER_PERMISSIONS_CHAT_DELETION = ( 773 | os.environ.get("USER_PERMISSIONS_CHAT_DELETION", "True").lower() == "true" 774 | ) 775 | 776 | USER_PERMISSIONS = PersistentConfig( 777 | "USER_PERMISSIONS", 778 | "ui.user_permissions", 779 | {"chat": {"deletion": USER_PERMISSIONS_CHAT_DELETION}}, 780 | ) 781 | 782 | ENABLE_MODEL_FILTER = PersistentConfig( 783 | "ENABLE_MODEL_FILTER", 784 | "model_filter.enable", 785 | os.environ.get("ENABLE_MODEL_FILTER", "False").lower() == "true", 786 | ) 787 | MODEL_FILTER_LIST = os.environ.get("MODEL_FILTER_LIST", "") 788 | MODEL_FILTER_LIST = PersistentConfig( 789 | "MODEL_FILTER_LIST", 790 | "model_filter.list", 791 | [model.strip() for model in MODEL_FILTER_LIST.split(";")], 792 | ) 793 | 794 | WEBHOOK_URL = PersistentConfig( 795 | "WEBHOOK_URL", "webhook_url", os.environ.get("WEBHOOK_URL", "") 796 | ) 797 | 798 | ENABLE_ADMIN_EXPORT = os.environ.get("ENABLE_ADMIN_EXPORT", "True").lower() == "true" 799 | 800 | ENABLE_COMMUNITY_SHARING = PersistentConfig( 801 | "ENABLE_COMMUNITY_SHARING", 802 | "ui.enable_community_sharing", 803 | os.environ.get("ENABLE_COMMUNITY_SHARING", "True").lower() == "true", 804 | ) 805 | 806 | 807 | class BannerModel(BaseModel): 808 | id: str 809 | type: str 810 | title: Optional[str] = None 811 | content: str 812 | dismissible: bool 813 | timestamp: int 814 | 815 | 816 | try: 817 | banners = json.loads(os.environ.get("WEBUI_BANNERS", "[]")) 818 | banners = [BannerModel(**banner) for banner in banners] 819 | except Exception as e: 820 | print(f"Error loading WEBUI_BANNERS: {e}") 821 | banners = [] 822 | 823 | WEBUI_BANNERS = PersistentConfig("WEBUI_BANNERS", "ui.banners", banners) 824 | 825 | 826 | SHOW_ADMIN_DETAILS = PersistentConfig( 827 | "SHOW_ADMIN_DETAILS", 828 | "auth.admin.show", 829 | os.environ.get("SHOW_ADMIN_DETAILS", "true").lower() == "true", 830 | ) 831 | 832 | ADMIN_EMAIL = PersistentConfig( 833 | "ADMIN_EMAIL", 834 | "auth.admin.email", 835 | os.environ.get("ADMIN_EMAIL", None), 836 | ) 837 | 838 | 839 | #################################### 840 | # TASKS 841 | #################################### 842 | 843 | 844 | TASK_MODEL = PersistentConfig( 845 | "TASK_MODEL", 846 | "task.model.default", 847 | os.environ.get("TASK_MODEL", ""), 848 | ) 849 | 850 | TASK_MODEL_EXTERNAL = PersistentConfig( 851 | "TASK_MODEL_EXTERNAL", 852 | "task.model.external", 853 | os.environ.get("TASK_MODEL_EXTERNAL", ""), 854 | ) 855 | 856 | TITLE_GENERATION_PROMPT_TEMPLATE = PersistentConfig( 857 | "TITLE_GENERATION_PROMPT_TEMPLATE", 858 | "task.title.prompt_template", 859 | os.environ.get( 860 | "TITLE_GENERATION_PROMPT_TEMPLATE", 861 | """Here is the query: 862 | {{prompt:middletruncate:8000}} 863 | 864 | Create a concise, 3-5 word phrase with an emoji as a title for the previous query. Suitable Emojis for the summary can be used to enhance understanding but avoid quotation marks or special formatting. RESPOND ONLY WITH THE TITLE TEXT. 865 | 866 | Examples of titles: 867 | 📉 Stock Market Trends 868 | 🍪 Perfect Chocolate Chip Recipe 869 | Evolution of Music Streaming 870 | Remote Work Productivity Tips 871 | Artificial Intelligence in Healthcare 872 | 🎮 Video Game Development Insights""", 873 | ), 874 | ) 875 | 876 | 877 | SEARCH_QUERY_GENERATION_PROMPT_TEMPLATE = PersistentConfig( 878 | "SEARCH_QUERY_GENERATION_PROMPT_TEMPLATE", 879 | "task.search.prompt_template", 880 | os.environ.get( 881 | "SEARCH_QUERY_GENERATION_PROMPT_TEMPLATE", 882 | """You are tasked with generating web search queries. Give me an appropriate query to answer my question for google search. Answer with only the query. Today is {{CURRENT_DATE}}. 883 | 884 | Question: 885 | {{prompt:end:4000}}""", 886 | ), 887 | ) 888 | 889 | SEARCH_QUERY_PROMPT_LENGTH_THRESHOLD = PersistentConfig( 890 | "SEARCH_QUERY_PROMPT_LENGTH_THRESHOLD", 891 | "task.search.prompt_length_threshold", 892 | int( 893 | os.environ.get( 894 | "SEARCH_QUERY_PROMPT_LENGTH_THRESHOLD", 895 | 100, 896 | ) 897 | ), 898 | ) 899 | 900 | TOOLS_FUNCTION_CALLING_PROMPT_TEMPLATE = PersistentConfig( 901 | "TOOLS_FUNCTION_CALLING_PROMPT_TEMPLATE", 902 | "task.tools.prompt_template", 903 | os.environ.get( 904 | "TOOLS_FUNCTION_CALLING_PROMPT_TEMPLATE", 905 | """Tools: {{TOOLS}} 906 | If a function tool doesn't match the query, return an empty string. Else, pick a function tool, fill in the parameters from the function tool's schema, and return it in the format { "name": \"functionName\", "parameters": { "key": "value" } }. Only pick a function if the user asks. Only return the object. Do not return any other text.""", 907 | ), 908 | ) 909 | 910 | 911 | #################################### 912 | # WEBUI_SECRET_KEY 913 | #################################### 914 | 915 | WEBUI_SECRET_KEY = os.environ.get( 916 | "WEBUI_SECRET_KEY", 917 | os.environ.get( 918 | "WEBUI_JWT_SECRET_KEY", "t0p-s3cr3t" 919 | ), # DEPRECATED: remove at next major version 920 | ) 921 | 922 | WEBUI_SESSION_COOKIE_SAME_SITE = os.environ.get( 923 | "WEBUI_SESSION_COOKIE_SAME_SITE", 924 | os.environ.get("WEBUI_SESSION_COOKIE_SAME_SITE", "lax"), 925 | ) 926 | 927 | WEBUI_SESSION_COOKIE_SECURE = os.environ.get( 928 | "WEBUI_SESSION_COOKIE_SECURE", 929 | os.environ.get("WEBUI_SESSION_COOKIE_SECURE", "false").lower() == "true", 930 | ) 931 | 932 | if WEBUI_AUTH and WEBUI_SECRET_KEY == "": 933 | raise ValueError(ERROR_MESSAGES.ENV_VAR_NOT_FOUND) 934 | 935 | #################################### 936 | # RAG document content extraction 937 | #################################### 938 | 939 | CONTENT_EXTRACTION_ENGINE = PersistentConfig( 940 | "CONTENT_EXTRACTION_ENGINE", 941 | "rag.CONTENT_EXTRACTION_ENGINE", 942 | os.environ.get("CONTENT_EXTRACTION_ENGINE", "").lower(), 943 | ) 944 | 945 | TIKA_SERVER_URL = PersistentConfig( 946 | "TIKA_SERVER_URL", 947 | "rag.tika_server_url", 948 | os.getenv("TIKA_SERVER_URL", "http://tika:9998"), # Default for sidecar deployment 949 | ) 950 | 951 | #################################### 952 | # RAG 953 | #################################### 954 | 955 | CHROMA_DATA_PATH = f"{DATA_DIR}/vector_db" 956 | CHROMA_TENANT = os.environ.get("CHROMA_TENANT", chromadb.DEFAULT_TENANT) 957 | CHROMA_DATABASE = os.environ.get("CHROMA_DATABASE", chromadb.DEFAULT_DATABASE) 958 | CHROMA_HTTP_HOST = os.environ.get("CHROMA_HTTP_HOST", "") 959 | CHROMA_HTTP_PORT = int(os.environ.get("CHROMA_HTTP_PORT", "8000")) 960 | # Comma-separated list of header=value pairs 961 | CHROMA_HTTP_HEADERS = os.environ.get("CHROMA_HTTP_HEADERS", "") 962 | if CHROMA_HTTP_HEADERS: 963 | CHROMA_HTTP_HEADERS = dict( 964 | [pair.split("=") for pair in CHROMA_HTTP_HEADERS.split(",")] 965 | ) 966 | else: 967 | CHROMA_HTTP_HEADERS = None 968 | CHROMA_HTTP_SSL = os.environ.get("CHROMA_HTTP_SSL", "false").lower() == "true" 969 | # this uses the model defined in the Dockerfile ENV variable. If you dont use docker or docker based deployments such as k8s, the default embedding model will be used (sentence-transformers/all-MiniLM-L6-v2) 970 | 971 | RAG_TOP_K = PersistentConfig( 972 | "RAG_TOP_K", "rag.top_k", int(os.environ.get("RAG_TOP_K", "5")) 973 | ) 974 | RAG_RELEVANCE_THRESHOLD = PersistentConfig( 975 | "RAG_RELEVANCE_THRESHOLD", 976 | "rag.relevance_threshold", 977 | float(os.environ.get("RAG_RELEVANCE_THRESHOLD", "0.0")), 978 | ) 979 | 980 | ENABLE_RAG_HYBRID_SEARCH = PersistentConfig( 981 | "ENABLE_RAG_HYBRID_SEARCH", 982 | "rag.enable_hybrid_search", 983 | os.environ.get("ENABLE_RAG_HYBRID_SEARCH", "").lower() == "true", 984 | ) 985 | 986 | ENABLE_RAG_WEB_LOADER_SSL_VERIFICATION = PersistentConfig( 987 | "ENABLE_RAG_WEB_LOADER_SSL_VERIFICATION", 988 | "rag.enable_web_loader_ssl_verification", 989 | os.environ.get("ENABLE_RAG_WEB_LOADER_SSL_VERIFICATION", "True").lower() == "true", 990 | ) 991 | 992 | RAG_EMBEDDING_ENGINE = PersistentConfig( 993 | "RAG_EMBEDDING_ENGINE", 994 | "rag.embedding_engine", 995 | os.environ.get("RAG_EMBEDDING_ENGINE", ""), 996 | ) 997 | 998 | PDF_EXTRACT_IMAGES = PersistentConfig( 999 | "PDF_EXTRACT_IMAGES", 1000 | "rag.pdf_extract_images", 1001 | os.environ.get("PDF_EXTRACT_IMAGES", "False").lower() == "true", 1002 | ) 1003 | 1004 | RAG_EMBEDDING_MODEL = PersistentConfig( 1005 | "RAG_EMBEDDING_MODEL", 1006 | "rag.embedding_model", 1007 | os.environ.get("RAG_EMBEDDING_MODEL", "sentence-transformers/all-MiniLM-L6-v2"), 1008 | ) 1009 | log.info(f"Embedding model set: {RAG_EMBEDDING_MODEL.value}"), 1010 | 1011 | RAG_EMBEDDING_MODEL_AUTO_UPDATE = ( 1012 | os.environ.get("RAG_EMBEDDING_MODEL_AUTO_UPDATE", "").lower() == "true" 1013 | ) 1014 | 1015 | RAG_EMBEDDING_MODEL_TRUST_REMOTE_CODE = ( 1016 | os.environ.get("RAG_EMBEDDING_MODEL_TRUST_REMOTE_CODE", "").lower() == "true" 1017 | ) 1018 | 1019 | RAG_EMBEDDING_OPENAI_BATCH_SIZE = PersistentConfig( 1020 | "RAG_EMBEDDING_OPENAI_BATCH_SIZE", 1021 | "rag.embedding_openai_batch_size", 1022 | os.environ.get("RAG_EMBEDDING_OPENAI_BATCH_SIZE", 1), 1023 | ) 1024 | 1025 | RAG_RERANKING_MODEL = PersistentConfig( 1026 | "RAG_RERANKING_MODEL", 1027 | "rag.reranking_model", 1028 | os.environ.get("RAG_RERANKING_MODEL", ""), 1029 | ) 1030 | if RAG_RERANKING_MODEL.value != "": 1031 | log.info(f"Reranking model set: {RAG_RERANKING_MODEL.value}"), 1032 | 1033 | RAG_RERANKING_MODEL_AUTO_UPDATE = ( 1034 | os.environ.get("RAG_RERANKING_MODEL_AUTO_UPDATE", "").lower() == "true" 1035 | ) 1036 | 1037 | RAG_RERANKING_MODEL_TRUST_REMOTE_CODE = ( 1038 | os.environ.get("RAG_RERANKING_MODEL_TRUST_REMOTE_CODE", "").lower() == "true" 1039 | ) 1040 | 1041 | 1042 | if CHROMA_HTTP_HOST != "": 1043 | CHROMA_CLIENT = chromadb.HttpClient( 1044 | host=CHROMA_HTTP_HOST, 1045 | port=CHROMA_HTTP_PORT, 1046 | headers=CHROMA_HTTP_HEADERS, 1047 | ssl=CHROMA_HTTP_SSL, 1048 | tenant=CHROMA_TENANT, 1049 | database=CHROMA_DATABASE, 1050 | settings=Settings(allow_reset=True, anonymized_telemetry=False), 1051 | ) 1052 | else: 1053 | CHROMA_CLIENT = chromadb.PersistentClient( 1054 | path=CHROMA_DATA_PATH, 1055 | settings=Settings(allow_reset=True, anonymized_telemetry=False), 1056 | tenant=CHROMA_TENANT, 1057 | database=CHROMA_DATABASE, 1058 | ) 1059 | 1060 | 1061 | # device type embedding models - "cpu" (default), "cuda" (nvidia gpu required) or "mps" (apple silicon) - choosing this right can lead to better performance 1062 | USE_CUDA = os.environ.get("USE_CUDA_DOCKER", "false") 1063 | 1064 | if USE_CUDA.lower() == "true": 1065 | DEVICE_TYPE = "cuda" 1066 | else: 1067 | DEVICE_TYPE = "cpu" 1068 | 1069 | CHUNK_SIZE = PersistentConfig( 1070 | "CHUNK_SIZE", "rag.chunk_size", int(os.environ.get("CHUNK_SIZE", "1500")) 1071 | ) 1072 | CHUNK_OVERLAP = PersistentConfig( 1073 | "CHUNK_OVERLAP", 1074 | "rag.chunk_overlap", 1075 | int(os.environ.get("CHUNK_OVERLAP", "100")), 1076 | ) 1077 | 1078 | DEFAULT_RAG_TEMPLATE = """Use the following context as your learned knowledge, inside XML tags. 1079 | 1080 | [context] 1081 | 1082 | 1083 | When answer to user: 1084 | - If you don't know, just say that you don't know. 1085 | - If you don't know when you are not sure, ask for clarification. 1086 | Avoid mentioning that you obtained the information from the context. 1087 | And answer according to the language of the user's question. 1088 | 1089 | Given the context information, answer the query. 1090 | Query: [query]""" 1091 | 1092 | RAG_TEMPLATE = PersistentConfig( 1093 | "RAG_TEMPLATE", 1094 | "rag.template", 1095 | os.environ.get("RAG_TEMPLATE", DEFAULT_RAG_TEMPLATE), 1096 | ) 1097 | 1098 | RAG_OPENAI_API_BASE_URL = PersistentConfig( 1099 | "RAG_OPENAI_API_BASE_URL", 1100 | "rag.openai_api_base_url", 1101 | os.getenv("RAG_OPENAI_API_BASE_URL", OPENAI_API_BASE_URL), 1102 | ) 1103 | RAG_OPENAI_API_KEY = PersistentConfig( 1104 | "RAG_OPENAI_API_KEY", 1105 | "rag.openai_api_key", 1106 | os.getenv("RAG_OPENAI_API_KEY", OPENAI_API_KEY), 1107 | ) 1108 | 1109 | ENABLE_RAG_LOCAL_WEB_FETCH = ( 1110 | os.getenv("ENABLE_RAG_LOCAL_WEB_FETCH", "False").lower() == "true" 1111 | ) 1112 | 1113 | YOUTUBE_LOADER_LANGUAGE = PersistentConfig( 1114 | "YOUTUBE_LOADER_LANGUAGE", 1115 | "rag.youtube_loader_language", 1116 | os.getenv("YOUTUBE_LOADER_LANGUAGE", "en").split(","), 1117 | ) 1118 | 1119 | 1120 | ENABLE_RAG_WEB_SEARCH = PersistentConfig( 1121 | "ENABLE_RAG_WEB_SEARCH", 1122 | "rag.web.search.enable", 1123 | os.getenv("ENABLE_RAG_WEB_SEARCH", "False").lower() == "true", 1124 | ) 1125 | 1126 | RAG_WEB_SEARCH_ENGINE = PersistentConfig( 1127 | "RAG_WEB_SEARCH_ENGINE", 1128 | "rag.web.search.engine", 1129 | os.getenv("RAG_WEB_SEARCH_ENGINE", ""), 1130 | ) 1131 | 1132 | # You can provide a list of your own websites to filter after performing a web search. 1133 | # This ensures the highest level of safety and reliability of the information sources. 1134 | RAG_WEB_SEARCH_DOMAIN_FILTER_LIST = PersistentConfig( 1135 | "RAG_WEB_SEARCH_DOMAIN_FILTER_LIST", 1136 | "rag.rag.web.search.domain.filter_list", 1137 | [ 1138 | # "wikipedia.com", 1139 | # "wikimedia.org", 1140 | # "wikidata.org", 1141 | ], 1142 | ) 1143 | 1144 | SEARXNG_QUERY_URL = PersistentConfig( 1145 | "SEARXNG_QUERY_URL", 1146 | "rag.web.search.searxng_query_url", 1147 | os.getenv("SEARXNG_QUERY_URL", ""), 1148 | ) 1149 | 1150 | GOOGLE_PSE_API_KEY = PersistentConfig( 1151 | "GOOGLE_PSE_API_KEY", 1152 | "rag.web.search.google_pse_api_key", 1153 | os.getenv("GOOGLE_PSE_API_KEY", ""), 1154 | ) 1155 | 1156 | GOOGLE_PSE_ENGINE_ID = PersistentConfig( 1157 | "GOOGLE_PSE_ENGINE_ID", 1158 | "rag.web.search.google_pse_engine_id", 1159 | os.getenv("GOOGLE_PSE_ENGINE_ID", ""), 1160 | ) 1161 | 1162 | BRAVE_SEARCH_API_KEY = PersistentConfig( 1163 | "BRAVE_SEARCH_API_KEY", 1164 | "rag.web.search.brave_search_api_key", 1165 | os.getenv("BRAVE_SEARCH_API_KEY", ""), 1166 | ) 1167 | 1168 | SERPSTACK_API_KEY = PersistentConfig( 1169 | "SERPSTACK_API_KEY", 1170 | "rag.web.search.serpstack_api_key", 1171 | os.getenv("SERPSTACK_API_KEY", ""), 1172 | ) 1173 | 1174 | SERPSTACK_HTTPS = PersistentConfig( 1175 | "SERPSTACK_HTTPS", 1176 | "rag.web.search.serpstack_https", 1177 | os.getenv("SERPSTACK_HTTPS", "True").lower() == "true", 1178 | ) 1179 | 1180 | SERPER_API_KEY = PersistentConfig( 1181 | "SERPER_API_KEY", 1182 | "rag.web.search.serper_api_key", 1183 | os.getenv("SERPER_API_KEY", ""), 1184 | ) 1185 | 1186 | SERPLY_API_KEY = PersistentConfig( 1187 | "SERPLY_API_KEY", 1188 | "rag.web.search.serply_api_key", 1189 | os.getenv("SERPLY_API_KEY", ""), 1190 | ) 1191 | 1192 | TAVILY_API_KEY = PersistentConfig( 1193 | "TAVILY_API_KEY", 1194 | "rag.web.search.tavily_api_key", 1195 | os.getenv("TAVILY_API_KEY", ""), 1196 | ) 1197 | 1198 | RAG_WEB_SEARCH_RESULT_COUNT = PersistentConfig( 1199 | "RAG_WEB_SEARCH_RESULT_COUNT", 1200 | "rag.web.search.result_count", 1201 | int(os.getenv("RAG_WEB_SEARCH_RESULT_COUNT", "3")), 1202 | ) 1203 | 1204 | RAG_WEB_SEARCH_CONCURRENT_REQUESTS = PersistentConfig( 1205 | "RAG_WEB_SEARCH_CONCURRENT_REQUESTS", 1206 | "rag.web.search.concurrent_requests", 1207 | int(os.getenv("RAG_WEB_SEARCH_CONCURRENT_REQUESTS", "10")), 1208 | ) 1209 | 1210 | 1211 | #################################### 1212 | # Transcribe 1213 | #################################### 1214 | 1215 | WHISPER_MODEL = os.getenv("WHISPER_MODEL", "base") 1216 | WHISPER_MODEL_DIR = os.getenv("WHISPER_MODEL_DIR", f"{CACHE_DIR}/whisper/models") 1217 | WHISPER_MODEL_AUTO_UPDATE = ( 1218 | os.environ.get("WHISPER_MODEL_AUTO_UPDATE", "").lower() == "true" 1219 | ) 1220 | 1221 | 1222 | #################################### 1223 | # Images 1224 | #################################### 1225 | 1226 | IMAGE_GENERATION_ENGINE = PersistentConfig( 1227 | "IMAGE_GENERATION_ENGINE", 1228 | "image_generation.engine", 1229 | os.getenv("IMAGE_GENERATION_ENGINE", ""), 1230 | ) 1231 | 1232 | ENABLE_IMAGE_GENERATION = PersistentConfig( 1233 | "ENABLE_IMAGE_GENERATION", 1234 | "image_generation.enable", 1235 | os.environ.get("ENABLE_IMAGE_GENERATION", "").lower() == "true", 1236 | ) 1237 | AUTOMATIC1111_BASE_URL = PersistentConfig( 1238 | "AUTOMATIC1111_BASE_URL", 1239 | "image_generation.automatic1111.base_url", 1240 | os.getenv("AUTOMATIC1111_BASE_URL", ""), 1241 | ) 1242 | AUTOMATIC1111_API_AUTH = PersistentConfig( 1243 | "AUTOMATIC1111_API_AUTH", 1244 | "image_generation.automatic1111.api_auth", 1245 | os.getenv("AUTOMATIC1111_API_AUTH", ""), 1246 | ) 1247 | 1248 | COMFYUI_BASE_URL = PersistentConfig( 1249 | "COMFYUI_BASE_URL", 1250 | "image_generation.comfyui.base_url", 1251 | os.getenv("COMFYUI_BASE_URL", ""), 1252 | ) 1253 | 1254 | COMFYUI_CFG_SCALE = PersistentConfig( 1255 | "COMFYUI_CFG_SCALE", 1256 | "image_generation.comfyui.cfg_scale", 1257 | os.getenv("COMFYUI_CFG_SCALE", ""), 1258 | ) 1259 | 1260 | COMFYUI_SAMPLER = PersistentConfig( 1261 | "COMFYUI_SAMPLER", 1262 | "image_generation.comfyui.sampler", 1263 | os.getenv("COMFYUI_SAMPLER", ""), 1264 | ) 1265 | 1266 | COMFYUI_SCHEDULER = PersistentConfig( 1267 | "COMFYUI_SCHEDULER", 1268 | "image_generation.comfyui.scheduler", 1269 | os.getenv("COMFYUI_SCHEDULER", ""), 1270 | ) 1271 | 1272 | COMFYUI_SD3 = PersistentConfig( 1273 | "COMFYUI_SD3", 1274 | "image_generation.comfyui.sd3", 1275 | os.environ.get("COMFYUI_SD3", "").lower() == "true", 1276 | ) 1277 | 1278 | IMAGES_OPENAI_API_BASE_URL = PersistentConfig( 1279 | "IMAGES_OPENAI_API_BASE_URL", 1280 | "image_generation.openai.api_base_url", 1281 | os.getenv("IMAGES_OPENAI_API_BASE_URL", OPENAI_API_BASE_URL), 1282 | ) 1283 | IMAGES_OPENAI_API_KEY = PersistentConfig( 1284 | "IMAGES_OPENAI_API_KEY", 1285 | "image_generation.openai.api_key", 1286 | os.getenv("IMAGES_OPENAI_API_KEY", OPENAI_API_KEY), 1287 | ) 1288 | 1289 | IMAGE_SIZE = PersistentConfig( 1290 | "IMAGE_SIZE", "image_generation.size", os.getenv("IMAGE_SIZE", "512x512") 1291 | ) 1292 | 1293 | IMAGE_STEPS = PersistentConfig( 1294 | "IMAGE_STEPS", "image_generation.steps", int(os.getenv("IMAGE_STEPS", 50)) 1295 | ) 1296 | 1297 | IMAGE_GENERATION_MODEL = PersistentConfig( 1298 | "IMAGE_GENERATION_MODEL", 1299 | "image_generation.model", 1300 | os.getenv("IMAGE_GENERATION_MODEL", ""), 1301 | ) 1302 | 1303 | #################################### 1304 | # Audio 1305 | #################################### 1306 | 1307 | AUDIO_STT_OPENAI_API_BASE_URL = PersistentConfig( 1308 | "AUDIO_STT_OPENAI_API_BASE_URL", 1309 | "audio.stt.openai.api_base_url", 1310 | os.getenv("AUDIO_STT_OPENAI_API_BASE_URL", OPENAI_API_BASE_URL), 1311 | ) 1312 | 1313 | AUDIO_STT_OPENAI_API_KEY = PersistentConfig( 1314 | "AUDIO_STT_OPENAI_API_KEY", 1315 | "audio.stt.openai.api_key", 1316 | os.getenv("AUDIO_STT_OPENAI_API_KEY", OPENAI_API_KEY), 1317 | ) 1318 | 1319 | AUDIO_STT_ENGINE = PersistentConfig( 1320 | "AUDIO_STT_ENGINE", 1321 | "audio.stt.engine", 1322 | os.getenv("AUDIO_STT_ENGINE", ""), 1323 | ) 1324 | 1325 | AUDIO_STT_MODEL = PersistentConfig( 1326 | "AUDIO_STT_MODEL", 1327 | "audio.stt.model", 1328 | os.getenv("AUDIO_STT_MODEL", "whisper-1"), 1329 | ) 1330 | 1331 | AUDIO_TTS_OPENAI_API_BASE_URL = PersistentConfig( 1332 | "AUDIO_TTS_OPENAI_API_BASE_URL", 1333 | "audio.tts.openai.api_base_url", 1334 | os.getenv("AUDIO_TTS_OPENAI_API_BASE_URL", OPENAI_API_BASE_URL), 1335 | ) 1336 | AUDIO_TTS_OPENAI_API_KEY = PersistentConfig( 1337 | "AUDIO_TTS_OPENAI_API_KEY", 1338 | "audio.tts.openai.api_key", 1339 | os.getenv("AUDIO_TTS_OPENAI_API_KEY", OPENAI_API_KEY), 1340 | ) 1341 | 1342 | 1343 | AUDIO_TTS_ENGINE = PersistentConfig( 1344 | "AUDIO_TTS_ENGINE", 1345 | "audio.tts.engine", 1346 | os.getenv("AUDIO_TTS_ENGINE", ""), 1347 | ) 1348 | 1349 | 1350 | AUDIO_TTS_MODEL = PersistentConfig( 1351 | "AUDIO_TTS_MODEL", 1352 | "audio.tts.model", 1353 | os.getenv("AUDIO_TTS_MODEL", "tts-1"), 1354 | ) 1355 | 1356 | AUDIO_TTS_VOICE = PersistentConfig( 1357 | "AUDIO_TTS_VOICE", 1358 | "audio.tts.voice", 1359 | os.getenv("AUDIO_TTS_VOICE", "alloy"), 1360 | ) 1361 | 1362 | 1363 | #################################### 1364 | # Database 1365 | #################################### 1366 | 1367 | DATABASE_URL = os.environ.get("DATABASE_URL", f"sqlite:///{DATA_DIR}/webui.db") 1368 | 1369 | # Replace the postgres:// with postgresql:// 1370 | if "postgres://" in DATABASE_URL: 1371 | DATABASE_URL = DATABASE_URL.replace("postgres://", "postgresql://") ``````` `\\?\D:\Coding\ai\backend\constants.py`: ```````py 1 | from enum import Enum 2 | 3 | 4 | class MESSAGES(str, Enum): 5 | DEFAULT = lambda msg="": f"{msg if msg else ''}" 6 | MODEL_ADDED = lambda model="": f"The model '{model}' has been added successfully." 7 | MODEL_DELETED = ( 8 | lambda model="": f"The model '{model}' has been deleted successfully." 9 | ) 10 | 11 | 12 | class WEBHOOK_MESSAGES(str, Enum): 13 | DEFAULT = lambda msg="": f"{msg if msg else ''}" 14 | USER_SIGNUP = lambda username="": ( 15 | f"New user signed up: {username}" if username else "New user signed up" 16 | ) 17 | 18 | 19 | class ERROR_MESSAGES(str, Enum): 20 | def __str__(self) -> str: 21 | return super().__str__() 22 | 23 | DEFAULT = lambda err="": f"Something went wrong :/\n{err if err else ''}" 24 | ENV_VAR_NOT_FOUND = "Required environment variable not found. Terminating now." 25 | CREATE_USER_ERROR = "Oops! Something went wrong while creating your account. Please try again later. If the issue persists, contact support for assistance." 26 | DELETE_USER_ERROR = "Oops! Something went wrong. We encountered an issue while trying to delete the user. Please give it another shot." 27 | EMAIL_MISMATCH = "Uh-oh! This email does not match the email your provider is registered with. Please check your email and try again." 28 | EMAIL_TAKEN = "Uh-oh! This email is already registered. Sign in with your existing account or choose another email to start anew." 29 | USERNAME_TAKEN = ( 30 | "Uh-oh! This username is already registered. Please choose another username." 31 | ) 32 | COMMAND_TAKEN = "Uh-oh! This command is already registered. Please choose another command string." 33 | FILE_EXISTS = "Uh-oh! This file is already registered. Please choose another file." 34 | 35 | ID_TAKEN = "Uh-oh! This id is already registered. Please choose another id string." 36 | MODEL_ID_TAKEN = "Uh-oh! This model id is already registered. Please choose another model id string." 37 | 38 | NAME_TAG_TAKEN = "Uh-oh! This name tag is already registered. Please choose another name tag string." 39 | INVALID_TOKEN = ( 40 | "Your session has expired or the token is invalid. Please sign in again." 41 | ) 42 | INVALID_CRED = "The email or password provided is incorrect. Please check for typos and try logging in again." 43 | INVALID_EMAIL_FORMAT = "The email format you entered is invalid. Please double-check and make sure you're using a valid email address (e.g., yourname@example.com)." 44 | INVALID_PASSWORD = ( 45 | "The password provided is incorrect. Please check for typos and try again." 46 | ) 47 | INVALID_TRUSTED_HEADER = "Your provider has not provided a trusted header. Please contact your administrator for assistance." 48 | 49 | EXISTING_USERS = "You can't turn off authentication because there are existing users. If you want to disable WEBUI_AUTH, make sure your web interface doesn't have any existing users and is a fresh installation." 50 | 51 | UNAUTHORIZED = "401 Unauthorized" 52 | ACCESS_PROHIBITED = "You do not have permission to access this resource. Please contact your administrator for assistance." 53 | ACTION_PROHIBITED = ( 54 | "The requested action has been restricted as a security measure." 55 | ) 56 | 57 | FILE_NOT_SENT = "FILE_NOT_SENT" 58 | FILE_NOT_SUPPORTED = "Oops! It seems like the file format you're trying to upload is not supported. Please upload a file with a supported format (e.g., JPG, PNG, PDF, TXT) and try again." 59 | 60 | NOT_FOUND = "We could not find what you're looking for :/" 61 | USER_NOT_FOUND = "We could not find what you're looking for :/" 62 | API_KEY_NOT_FOUND = "Oops! It looks like there's a hiccup. The API key is missing. Please make sure to provide a valid API key to access this feature." 63 | 64 | MALICIOUS = "Unusual activities detected, please try again in a few minutes." 65 | 66 | PANDOC_NOT_INSTALLED = "Pandoc is not installed on the server. Please contact your administrator for assistance." 67 | INCORRECT_FORMAT = ( 68 | lambda err="": f"Invalid format. Please use the correct format{err}" 69 | ) 70 | RATE_LIMIT_EXCEEDED = "API rate limit exceeded" 71 | 72 | MODEL_NOT_FOUND = lambda name="": f"Model '{name}' was not found" 73 | OPENAI_NOT_FOUND = lambda name="": "OpenAI API was not found" 74 | OLLAMA_NOT_FOUND = "WebUI could not connect to Ollama" 75 | CREATE_API_KEY_ERROR = "Oops! Something went wrong while creating your API key. Please try again later. If the issue persists, contact support for assistance." 76 | 77 | EMPTY_CONTENT = "The content provided is empty. Please ensure that there is text or data present before proceeding." 78 | 79 | DB_NOT_SQLITE = "This feature is only available when running with SQLite databases." 80 | 81 | INVALID_URL = ( 82 | "Oops! The URL you provided is invalid. Please double-check and try again." 83 | ) 84 | 85 | WEB_SEARCH_ERROR = ( 86 | lambda err="": f"{err if err else 'Oops! Something went wrong while searching the web.'}" 87 | ) 88 | 89 | OLLAMA_API_DISABLED = ( 90 | "The Ollama API is disabled. Please enable it to use this feature." 91 | ) 92 | 93 | 94 | class TASKS(str, Enum): 95 | def __str__(self) -> str: 96 | return super().__str__() 97 | 98 | DEFAULT = lambda task="": f"{task if task else 'generation'}" 99 | TITLE_GENERATION = "title_generation" 100 | EMOJI_GENERATION = "emoji_generation" 101 | QUERY_GENERATION = "query_generation" 102 | FUNCTION_CALLING = "function_calling" ``````` `\\?\D:\Coding\ai\backend\data\config.json`: ```````json 1 | { 2 | "version": 0, 3 | "ui": { 4 | "default_locale": "", 5 | "prompt_suggestions": [ 6 | { 7 | "title": ["Help me study", "vocabulary for a college entrance exam"], 8 | "content": "Help me study vocabulary: write a sentence for me to fill in the blank, and I'll try to pick the correct option." 9 | }, 10 | { 11 | "title": ["Give me ideas", "for what to do with my kids' art"], 12 | "content": "What are 5 creative things I could do with my kids' art? I don't want to throw them away, but it's also so much clutter." 13 | }, 14 | { 15 | "title": ["Tell me a fun fact", "about the Roman Empire"], 16 | "content": "Tell me a random fun fact about the Roman Empire" 17 | }, 18 | { 19 | "title": ["Show me a code snippet", "of a website's sticky header"], 20 | "content": "Show me a code snippet of a website's sticky header in CSS and JavaScript." 21 | }, 22 | { 23 | "title": ["Explain options trading", "if I'm familiar with buying and selling stocks"], 24 | "content": "Explain options trading in simple terms if I'm familiar with buying and selling stocks." 25 | }, 26 | { 27 | "title": ["Overcome procrastination", "give me tips"], 28 | "content": "Could you start by asking me about instances when I procrastinate the most and then give me some suggestions to overcome it?" 29 | }, 30 | { 31 | "title": ["Grammar check", "rewrite it for better readability "], 32 | "content": "Check the following sentence for grammar and clarity: \"[sentence]\". Rewrite it for better readability while maintaining its original meaning." 33 | } 34 | ] 35 | } 36 | } ``````` `\\?\D:\Coding\ai\backend\data\litellm\config.yaml`: ```````yaml 1 | general_settings: {} 2 | litellm_settings: {} 3 | model_list: [] 4 | router_settings: {} ``````` `\\?\D:\Coding\ai\backend\dev.sh`: ```````sh 1 | PORT="${PORT:-8080}" 2 | uvicorn main:app --port $PORT --host 0.0.0.0 --forwarded-allow-ips '*' --reload ``````` `\\?\D:\Coding\ai\backend\main.py`: ```````py 1 | import base64 2 | import uuid 3 | from contextlib import asynccontextmanager 4 | 5 | from authlib.integrations.starlette_client import OAuth 6 | from authlib.oidc.core import UserInfo 7 | import json 8 | import time 9 | import os 10 | import sys 11 | import logging 12 | import aiohttp 13 | import requests 14 | import mimetypes 15 | import shutil 16 | import os 17 | import uuid 18 | import inspect 19 | import socket 20 | 21 | from fastapi import FastAPI, Request, Depends, status, UploadFile, File, Form 22 | from fastapi.staticfiles import StaticFiles 23 | from fastapi.responses import JSONResponse 24 | from fastapi import HTTPException 25 | from fastapi.middleware.cors import CORSMiddleware 26 | from sqlalchemy import text 27 | from starlette.exceptions import HTTPException as StarletteHTTPException 28 | from starlette.middleware.base import BaseHTTPMiddleware 29 | from starlette.middleware.sessions import SessionMiddleware 30 | from starlette.responses import StreamingResponse, Response, RedirectResponse 31 | 32 | 33 | from apps.socket.main import sio, app as socket_app, get_event_emitter, get_event_call 34 | from apps.ollama.main import ( 35 | app as ollama_app, 36 | get_all_models as get_ollama_models, 37 | generate_openai_chat_completion as generate_ollama_chat_completion, 38 | ) 39 | from apps.openai.main import ( 40 | app as openai_app, 41 | get_all_models as get_openai_models, 42 | generate_chat_completion as generate_openai_chat_completion, 43 | ) 44 | 45 | from apps.audio.main import app as audio_app 46 | from apps.images.main import app as images_app 47 | from apps.rag.main import app as rag_app 48 | from apps.webui.main import ( 49 | app as webui_app, 50 | get_pipe_models, 51 | generate_function_chat_completion, 52 | ) 53 | from apps.webui.internal.db import Session 54 | 55 | 56 | from pydantic import BaseModel 57 | from typing import List, Optional 58 | 59 | from apps.webui.models.auths import Auths 60 | from apps.webui.models.models import Models 61 | from apps.webui.models.tools import Tools 62 | from apps.webui.models.functions import Functions 63 | from apps.webui.models.users import Users 64 | 65 | from apps.webui.utils import load_toolkit_module_by_id, load_function_module_by_id 66 | 67 | from utils.utils import ( 68 | get_admin_user, 69 | get_verified_user, 70 | get_current_user, 71 | get_http_authorization_cred, 72 | get_password_hash, 73 | create_token, 74 | ) 75 | from utils.task import ( 76 | title_generation_template, 77 | search_query_generation_template, 78 | tools_function_calling_generation_template, 79 | ) 80 | from utils.misc import ( 81 | get_last_user_message, 82 | add_or_update_system_message, 83 | parse_duration, 84 | ) 85 | 86 | from apps.rag.utils import get_rag_context, rag_template 87 | 88 | from config import ( 89 | WEBUI_NAME, 90 | WEBUI_URL, 91 | WEBUI_AUTH, 92 | ENV, 93 | VERSION, 94 | CHANGELOG, 95 | FRONTEND_BUILD_DIR, 96 | CACHE_DIR, 97 | STATIC_DIR, 98 | DEFAULT_LOCALE, 99 | ENABLE_OPENAI_API, 100 | ENABLE_OLLAMA_API, 101 | ENABLE_MODEL_FILTER, 102 | MODEL_FILTER_LIST, 103 | GLOBAL_LOG_LEVEL, 104 | SRC_LOG_LEVELS, 105 | WEBHOOK_URL, 106 | ENABLE_ADMIN_EXPORT, 107 | WEBUI_BUILD_HASH, 108 | TASK_MODEL, 109 | TASK_MODEL_EXTERNAL, 110 | TITLE_GENERATION_PROMPT_TEMPLATE, 111 | SEARCH_QUERY_GENERATION_PROMPT_TEMPLATE, 112 | SEARCH_QUERY_PROMPT_LENGTH_THRESHOLD, 113 | TOOLS_FUNCTION_CALLING_PROMPT_TEMPLATE, 114 | SAFE_MODE, 115 | OAUTH_PROVIDERS, 116 | ENABLE_OAUTH_SIGNUP, 117 | OAUTH_MERGE_ACCOUNTS_BY_EMAIL, 118 | WEBUI_SECRET_KEY, 119 | WEBUI_SESSION_COOKIE_SAME_SITE, 120 | WEBUI_SESSION_COOKIE_SECURE, 121 | AppConfig, 122 | ) 123 | 124 | from constants import ERROR_MESSAGES, WEBHOOK_MESSAGES, TASKS 125 | from utils.webhook import post_webhook 126 | 127 | if SAFE_MODE: 128 | print("SAFE MODE ENABLED") 129 | Functions.deactivate_all_functions() 130 | 131 | 132 | logging.basicConfig(stream=sys.stdout, level=GLOBAL_LOG_LEVEL) 133 | log = logging.getLogger(__name__) 134 | log.setLevel(SRC_LOG_LEVELS["MAIN"]) 135 | 136 | 137 | class SPAStaticFiles(StaticFiles): 138 | async def get_response(self, path: str, scope): 139 | try: 140 | return await super().get_response(path, scope) 141 | except (HTTPException, StarletteHTTPException) as ex: 142 | if ex.status_code == 404: 143 | return await super().get_response("index.html", scope) 144 | else: 145 | raise ex 146 | 147 | 148 | print( 149 | rf""" 150 | ___ __ __ _ _ _ ___ 151 | / _ \ _ __ ___ _ __ \ \ / /__| |__ | | | |_ _| 152 | | | | | '_ \ / _ \ '_ \ \ \ /\ / / _ \ '_ \| | | || | 153 | | |_| | |_) | __/ | | | \ V V / __/ |_) | |_| || | 154 | \___/| .__/ \___|_| |_| \_/\_/ \___|_.__/ \___/|___| 155 | |_| 156 | 157 | 158 | v{VERSION} - building the best open-source AI user interface. 159 | {f"Commit: {WEBUI_BUILD_HASH}" if WEBUI_BUILD_HASH != "dev-build" else ""} 160 | https://github.com/open-webui/open-webui 161 | """ 162 | ) 163 | 164 | 165 | def run_migrations(): 166 | try: 167 | from alembic.config import Config 168 | from alembic import command 169 | 170 | alembic_cfg = Config("alembic.ini") 171 | command.upgrade(alembic_cfg, "head") 172 | except Exception as e: 173 | print(f"Error: {e}") 174 | 175 | 176 | @asynccontextmanager 177 | async def lifespan(app: FastAPI): 178 | run_migrations() 179 | yield 180 | 181 | 182 | app = FastAPI( 183 | docs_url="/docs" if ENV == "dev" else None, redoc_url=None, lifespan=lifespan 184 | ) 185 | 186 | from urllib.request import urlopen 187 | import re as r 188 | 189 | def getIP(): 190 | d = str(urlopen('http://checkip.dyndns.com/') 191 | .read()) 192 | 193 | return r.compile(r'Address: (\d+\.\d+\.\d+\.\d+)').search(d).group(1) 194 | 195 | def get_port_from_args(): 196 | for i, arg in enumerate(sys.argv): 197 | if arg == "--port" and i + 1 < len(sys.argv): 198 | return sys.argv[i + 1] 199 | return 8080 200 | ip_address = getIP() 201 | port = get_port_from_args() 202 | 203 | print("\033[92m" + "="*50) 204 | print(f"\nServer running at \033[1m{ip_address}:{port}/ \n") 205 | print("="*50 + "\n\n\033[0m") 206 | 207 | app.state.config = AppConfig() 208 | 209 | app.state.config.ENABLE_OPENAI_API = ENABLE_OPENAI_API 210 | app.state.config.ENABLE_OLLAMA_API = ENABLE_OLLAMA_API 211 | 212 | app.state.config.ENABLE_MODEL_FILTER = ENABLE_MODEL_FILTER 213 | app.state.config.MODEL_FILTER_LIST = MODEL_FILTER_LIST 214 | 215 | app.state.config.WEBHOOK_URL = WEBHOOK_URL 216 | 217 | 218 | app.state.config.TASK_MODEL = TASK_MODEL 219 | app.state.config.TASK_MODEL_EXTERNAL = TASK_MODEL_EXTERNAL 220 | app.state.config.TITLE_GENERATION_PROMPT_TEMPLATE = TITLE_GENERATION_PROMPT_TEMPLATE 221 | app.state.config.SEARCH_QUERY_GENERATION_PROMPT_TEMPLATE = ( 222 | SEARCH_QUERY_GENERATION_PROMPT_TEMPLATE 223 | ) 224 | app.state.config.SEARCH_QUERY_PROMPT_LENGTH_THRESHOLD = ( 225 | SEARCH_QUERY_PROMPT_LENGTH_THRESHOLD 226 | ) 227 | app.state.config.TOOLS_FUNCTION_CALLING_PROMPT_TEMPLATE = ( 228 | TOOLS_FUNCTION_CALLING_PROMPT_TEMPLATE 229 | ) 230 | 231 | app.state.MODELS = {} 232 | 233 | origins = ["*"] 234 | 235 | 236 | ################################## 237 | # 238 | # ChatCompletion Middleware 239 | # 240 | ################################## 241 | 242 | 243 | async def get_body_and_model_and_user(request): 244 | # Read the original request body 245 | body = await request.body() 246 | body_str = body.decode("utf-8") 247 | body = json.loads(body_str) if body_str else {} 248 | 249 | model_id = body["model"] 250 | if model_id not in app.state.MODELS: 251 | raise Exception("Model not found") 252 | model = app.state.MODELS[model_id] 253 | 254 | user = get_current_user( 255 | request, 256 | get_http_authorization_cred(request.headers.get("Authorization")), 257 | ) 258 | 259 | return body, model, user 260 | 261 | 262 | def get_task_model_id(default_model_id): 263 | # Set the task model 264 | task_model_id = default_model_id 265 | # Check if the user has a custom task model and use that model 266 | if app.state.MODELS[task_model_id]["owned_by"] == "ollama": 267 | if ( 268 | app.state.config.TASK_MODEL 269 | and app.state.config.TASK_MODEL in app.state.MODELS 270 | ): 271 | task_model_id = app.state.config.TASK_MODEL 272 | else: 273 | if ( 274 | app.state.config.TASK_MODEL_EXTERNAL 275 | and app.state.config.TASK_MODEL_EXTERNAL in app.state.MODELS 276 | ): 277 | task_model_id = app.state.config.TASK_MODEL_EXTERNAL 278 | 279 | return task_model_id 280 | 281 | 282 | def get_filter_function_ids(model): 283 | def get_priority(function_id): 284 | function = Functions.get_function_by_id(function_id) 285 | if function is not None and hasattr(function, "valves"): 286 | return (function.valves if function.valves else {}).get("priority", 0) 287 | return 0 288 | 289 | filter_ids = [function.id for function in Functions.get_global_filter_functions()] 290 | if "info" in model and "meta" in model["info"]: 291 | filter_ids.extend(model["info"]["meta"].get("filterIds", [])) 292 | filter_ids = list(set(filter_ids)) 293 | 294 | enabled_filter_ids = [ 295 | function.id 296 | for function in Functions.get_functions_by_type("filter", active_only=True) 297 | ] 298 | 299 | filter_ids = [ 300 | filter_id for filter_id in filter_ids if filter_id in enabled_filter_ids 301 | ] 302 | 303 | filter_ids.sort(key=get_priority) 304 | return filter_ids 305 | 306 | 307 | async def get_function_call_response( 308 | messages, 309 | files, 310 | tool_id, 311 | template, 312 | task_model_id, 313 | user, 314 | __event_emitter__=None, 315 | __event_call__=None, 316 | ): 317 | tool = Tools.get_tool_by_id(tool_id) 318 | tools_specs = json.dumps(tool.specs, indent=2) 319 | content = tools_function_calling_generation_template(template, tools_specs) 320 | 321 | user_message = get_last_user_message(messages) 322 | prompt = ( 323 | "History:\n" 324 | + "\n".join( 325 | [ 326 | f"{message['role'].upper()}: \"\"\"{message['content']}\"\"\"" 327 | for message in messages[::-1][:4] 328 | ] 329 | ) 330 | + f"\nQuery: {user_message}" 331 | ) 332 | 333 | print(prompt) 334 | 335 | payload = { 336 | "model": task_model_id, 337 | "messages": [ 338 | {"role": "system", "content": content}, 339 | {"role": "user", "content": f"Query: {prompt}"}, 340 | ], 341 | "stream": False, 342 | "task": str(TASKS.FUNCTION_CALLING), 343 | } 344 | 345 | try: 346 | payload = filter_pipeline(payload, user) 347 | except Exception as e: 348 | raise e 349 | 350 | model = app.state.MODELS[task_model_id] 351 | 352 | response = None 353 | try: 354 | response = await generate_chat_completions(form_data=payload, user=user) 355 | content = None 356 | 357 | if hasattr(response, "body_iterator"): 358 | async for chunk in response.body_iterator: 359 | data = json.loads(chunk.decode("utf-8")) 360 | content = data["choices"][0]["message"]["content"] 361 | 362 | # Cleanup any remaining background tasks if necessary 363 | if response.background is not None: 364 | await response.background() 365 | else: 366 | content = response["choices"][0]["message"]["content"] 367 | 368 | if content is None: 369 | return None, None, False 370 | 371 | # Parse the function response 372 | print(f"content: {content}") 373 | result = json.loads(content) 374 | print(result) 375 | 376 | citation = None 377 | 378 | if "name" not in result: 379 | return None, None, False 380 | 381 | # Call the function 382 | if tool_id in webui_app.state.TOOLS: 383 | toolkit_module = webui_app.state.TOOLS[tool_id] 384 | else: 385 | toolkit_module, _ = load_toolkit_module_by_id(tool_id) 386 | webui_app.state.TOOLS[tool_id] = toolkit_module 387 | 388 | file_handler = False 389 | # check if toolkit_module has file_handler self variable 390 | if hasattr(toolkit_module, "file_handler"): 391 | file_handler = True 392 | print("file_handler: ", file_handler) 393 | 394 | if hasattr(toolkit_module, "valves") and hasattr(toolkit_module, "Valves"): 395 | valves = Tools.get_tool_valves_by_id(tool_id) 396 | toolkit_module.valves = toolkit_module.Valves(**(valves if valves else {})) 397 | 398 | function = getattr(toolkit_module, result["name"]) 399 | function_result = None 400 | try: 401 | # Get the signature of the function 402 | sig = inspect.signature(function) 403 | params = result["parameters"] 404 | 405 | # Extra parameters to be passed to the function 406 | extra_params = { 407 | "__model__": model, 408 | "__id__": tool_id, 409 | "__messages__": messages, 410 | "__files__": files, 411 | "__event_emitter__": __event_emitter__, 412 | "__event_call__": __event_call__, 413 | } 414 | 415 | # Add extra params in contained in function signature 416 | for key, value in extra_params.items(): 417 | if key in sig.parameters: 418 | params[key] = value 419 | 420 | if "__user__" in sig.parameters: 421 | # Call the function with the '__user__' parameter included 422 | __user__ = { 423 | "id": user.id, 424 | "email": user.email, 425 | "name": user.name, 426 | "role": user.role, 427 | } 428 | 429 | try: 430 | if hasattr(toolkit_module, "UserValves"): 431 | __user__["valves"] = toolkit_module.UserValves( 432 | **Tools.get_user_valves_by_id_and_user_id(tool_id, user.id) 433 | ) 434 | except Exception as e: 435 | print(e) 436 | 437 | params = {**params, "__user__": __user__} 438 | 439 | if inspect.iscoroutinefunction(function): 440 | function_result = await function(**params) 441 | else: 442 | function_result = function(**params) 443 | 444 | if hasattr(toolkit_module, "citation") and toolkit_module.citation: 445 | citation = { 446 | "source": {"name": f"TOOL:{tool.name}/{result['name']}"}, 447 | "document": [function_result], 448 | "metadata": [{"source": result["name"]}], 449 | } 450 | except Exception as e: 451 | print(e) 452 | 453 | # Add the function result to the system prompt 454 | if function_result is not None: 455 | return function_result, citation, file_handler 456 | except Exception as e: 457 | print(f"Error: {e}") 458 | 459 | return None, None, False 460 | 461 | 462 | async def chat_completion_functions_handler( 463 | body, model, user, __event_emitter__, __event_call__ 464 | ): 465 | skip_files = None 466 | 467 | filter_ids = get_filter_function_ids(model) 468 | for filter_id in filter_ids: 469 | filter = Functions.get_function_by_id(filter_id) 470 | if not filter: 471 | continue 472 | 473 | if filter_id in webui_app.state.FUNCTIONS: 474 | function_module = webui_app.state.FUNCTIONS[filter_id] 475 | else: 476 | function_module, _, _ = load_function_module_by_id(filter_id) 477 | webui_app.state.FUNCTIONS[filter_id] = function_module 478 | 479 | # Check if the function has a file_handler variable 480 | if hasattr(function_module, "file_handler"): 481 | skip_files = function_module.file_handler 482 | 483 | if hasattr(function_module, "valves") and hasattr(function_module, "Valves"): 484 | valves = Functions.get_function_valves_by_id(filter_id) 485 | function_module.valves = function_module.Valves( 486 | **(valves if valves else {}) 487 | ) 488 | 489 | if not hasattr(function_module, "inlet"): 490 | continue 491 | 492 | try: 493 | inlet = function_module.inlet 494 | 495 | # Get the signature of the function 496 | sig = inspect.signature(inlet) 497 | params = {"body": body} 498 | 499 | # Extra parameters to be passed to the function 500 | extra_params = { 501 | "__model__": model, 502 | "__id__": filter_id, 503 | "__event_emitter__": __event_emitter__, 504 | "__event_call__": __event_call__, 505 | } 506 | 507 | # Add extra params in contained in function signature 508 | for key, value in extra_params.items(): 509 | if key in sig.parameters: 510 | params[key] = value 511 | 512 | if "__user__" in sig.parameters: 513 | __user__ = { 514 | "id": user.id, 515 | "email": user.email, 516 | "name": user.name, 517 | "role": user.role, 518 | } 519 | 520 | try: 521 | if hasattr(function_module, "UserValves"): 522 | __user__["valves"] = function_module.UserValves( 523 | **Functions.get_user_valves_by_id_and_user_id( 524 | filter_id, user.id 525 | ) 526 | ) 527 | except Exception as e: 528 | print(e) 529 | 530 | params = {**params, "__user__": __user__} 531 | 532 | if inspect.iscoroutinefunction(inlet): 533 | body = await inlet(**params) 534 | else: 535 | body = inlet(**params) 536 | 537 | except Exception as e: 538 | print(f"Error: {e}") 539 | raise e 540 | 541 | if skip_files: 542 | if "files" in body: 543 | del body["files"] 544 | 545 | return body, {} 546 | 547 | 548 | async def chat_completion_tools_handler(body, user, __event_emitter__, __event_call__): 549 | skip_files = None 550 | 551 | contexts = [] 552 | citations = None 553 | 554 | task_model_id = get_task_model_id(body["model"]) 555 | 556 | # If tool_ids field is present, call the functions 557 | if "tool_ids" in body: 558 | print(body["tool_ids"]) 559 | for tool_id in body["tool_ids"]: 560 | print(tool_id) 561 | try: 562 | response, citation, file_handler = await get_function_call_response( 563 | messages=body["messages"], 564 | files=body.get("files", []), 565 | tool_id=tool_id, 566 | template=app.state.config.TOOLS_FUNCTION_CALLING_PROMPT_TEMPLATE, 567 | task_model_id=task_model_id, 568 | user=user, 569 | __event_emitter__=__event_emitter__, 570 | __event_call__=__event_call__, 571 | ) 572 | 573 | print(file_handler) 574 | if isinstance(response, str): 575 | contexts.append(response) 576 | 577 | if citation: 578 | if citations is None: 579 | citations = [citation] 580 | else: 581 | citations.append(citation) 582 | 583 | if file_handler: 584 | skip_files = True 585 | 586 | except Exception as e: 587 | print(f"Error: {e}") 588 | del body["tool_ids"] 589 | print(f"tool_contexts: {contexts}") 590 | 591 | if skip_files: 592 | if "files" in body: 593 | del body["files"] 594 | 595 | return body, { 596 | **({"contexts": contexts} if contexts is not None else {}), 597 | **({"citations": citations} if citations is not None else {}), 598 | } 599 | 600 | 601 | async def chat_completion_files_handler(body): 602 | contexts = [] 603 | citations = None 604 | 605 | if "files" in body: 606 | files = body["files"] 607 | del body["files"] 608 | 609 | contexts, citations = get_rag_context( 610 | files=files, 611 | messages=body["messages"], 612 | embedding_function=rag_app.state.EMBEDDING_FUNCTION, 613 | k=rag_app.state.config.TOP_K, 614 | reranking_function=rag_app.state.sentence_transformer_rf, 615 | r=rag_app.state.config.RELEVANCE_THRESHOLD, 616 | hybrid_search=rag_app.state.config.ENABLE_RAG_HYBRID_SEARCH, 617 | ) 618 | 619 | log.debug(f"rag_contexts: {contexts}, citations: {citations}") 620 | 621 | return body, { 622 | **({"contexts": contexts} if contexts is not None else {}), 623 | **({"citations": citations} if citations is not None else {}), 624 | } 625 | 626 | 627 | class ChatCompletionMiddleware(BaseHTTPMiddleware): 628 | async def dispatch(self, request: Request, call_next): 629 | if request.method == "POST" and any( 630 | endpoint in request.url.path 631 | for endpoint in ["/ollama/api/chat", "/chat/completions"] 632 | ): 633 | log.debug(f"request.url.path: {request.url.path}") 634 | 635 | try: 636 | body, model, user = await get_body_and_model_and_user(request) 637 | except Exception as e: 638 | return JSONResponse( 639 | status_code=status.HTTP_400_BAD_REQUEST, 640 | content={"detail": str(e)}, 641 | ) 642 | 643 | # Extract valves from the request body 644 | valves = None 645 | if "valves" in body: 646 | valves = body["valves"] 647 | del body["valves"] 648 | 649 | # Extract session_id, chat_id and message_id from the request body 650 | session_id = None 651 | if "session_id" in body: 652 | session_id = body["session_id"] 653 | del body["session_id"] 654 | chat_id = None 655 | if "chat_id" in body: 656 | chat_id = body["chat_id"] 657 | del body["chat_id"] 658 | message_id = None 659 | if "id" in body: 660 | message_id = body["id"] 661 | del body["id"] 662 | 663 | __event_emitter__ = await get_event_emitter( 664 | {"chat_id": chat_id, "message_id": message_id, "session_id": session_id} 665 | ) 666 | __event_call__ = await get_event_call( 667 | {"chat_id": chat_id, "message_id": message_id, "session_id": session_id} 668 | ) 669 | 670 | # Initialize data_items to store additional data to be sent to the client 671 | data_items = [] 672 | 673 | # Initialize context, and citations 674 | contexts = [] 675 | citations = [] 676 | 677 | try: 678 | body, flags = await chat_completion_functions_handler( 679 | body, model, user, __event_emitter__, __event_call__ 680 | ) 681 | except Exception as e: 682 | return JSONResponse( 683 | status_code=status.HTTP_400_BAD_REQUEST, 684 | content={"detail": str(e)}, 685 | ) 686 | 687 | try: 688 | body, flags = await chat_completion_tools_handler( 689 | body, user, __event_emitter__, __event_call__ 690 | ) 691 | 692 | contexts.extend(flags.get("contexts", [])) 693 | citations.extend(flags.get("citations", [])) 694 | except Exception as e: 695 | print(e) 696 | pass 697 | 698 | try: 699 | body, flags = await chat_completion_files_handler(body) 700 | 701 | contexts.extend(flags.get("contexts", [])) 702 | citations.extend(flags.get("citations", [])) 703 | except Exception as e: 704 | print(e) 705 | pass 706 | 707 | # If context is not empty, insert it into the messages 708 | if len(contexts) > 0: 709 | context_string = "/n".join(contexts).strip() 710 | prompt = get_last_user_message(body["messages"]) 711 | body["messages"] = add_or_update_system_message( 712 | rag_template( 713 | rag_app.state.config.RAG_TEMPLATE, context_string, prompt 714 | ), 715 | body["messages"], 716 | ) 717 | 718 | # If there are citations, add them to the data_items 719 | if len(citations) > 0: 720 | data_items.append({"citations": citations}) 721 | 722 | body["metadata"] = { 723 | "session_id": session_id, 724 | "chat_id": chat_id, 725 | "message_id": message_id, 726 | "valves": valves, 727 | } 728 | 729 | modified_body_bytes = json.dumps(body).encode("utf-8") 730 | # Replace the request body with the modified one 731 | request._body = modified_body_bytes 732 | # Set custom header to ensure content-length matches new body length 733 | request.headers.__dict__["_list"] = [ 734 | (b"content-length", str(len(modified_body_bytes)).encode("utf-8")), 735 | *[ 736 | (k, v) 737 | for k, v in request.headers.raw 738 | if k.lower() != b"content-length" 739 | ], 740 | ] 741 | 742 | response = await call_next(request) 743 | if isinstance(response, StreamingResponse): 744 | # If it's a streaming response, inject it as SSE event or NDJSON line 745 | content_type = response.headers.get("Content-Type") 746 | if "text/event-stream" in content_type: 747 | return StreamingResponse( 748 | self.openai_stream_wrapper(response.body_iterator, data_items), 749 | ) 750 | if "application/x-ndjson" in content_type: 751 | return StreamingResponse( 752 | self.ollama_stream_wrapper(response.body_iterator, data_items), 753 | ) 754 | 755 | return response 756 | else: 757 | return response 758 | 759 | # If it's not a chat completion request, just pass it through 760 | response = await call_next(request) 761 | return response 762 | 763 | async def _receive(self, body: bytes): 764 | return {"type": "http.request", "body": body, "more_body": False} 765 | 766 | async def openai_stream_wrapper(self, original_generator, data_items): 767 | for item in data_items: 768 | yield f"data: {json.dumps(item)}\n\n" 769 | 770 | async for data in original_generator: 771 | yield data 772 | 773 | async def ollama_stream_wrapper(self, original_generator, data_items): 774 | for item in data_items: 775 | yield f"{json.dumps(item)}\n" 776 | 777 | async for data in original_generator: 778 | yield data 779 | 780 | 781 | app.add_middleware(ChatCompletionMiddleware) 782 | 783 | ################################## 784 | # 785 | # Pipeline Middleware 786 | # 787 | ################################## 788 | 789 | 790 | def get_sorted_filters(model_id): 791 | filters = [ 792 | model 793 | for model in app.state.MODELS.values() 794 | if "pipeline" in model 795 | and "type" in model["pipeline"] 796 | and model["pipeline"]["type"] == "filter" 797 | and ( 798 | model["pipeline"]["pipelines"] == ["*"] 799 | or any( 800 | model_id == target_model_id 801 | for target_model_id in model["pipeline"]["pipelines"] 802 | ) 803 | ) 804 | ] 805 | sorted_filters = sorted(filters, key=lambda x: x["pipeline"]["priority"]) 806 | return sorted_filters 807 | 808 | 809 | def filter_pipeline(payload, user): 810 | user = {"id": user.id, "email": user.email, "name": user.name, "role": user.role} 811 | model_id = payload["model"] 812 | sorted_filters = get_sorted_filters(model_id) 813 | 814 | model = app.state.MODELS[model_id] 815 | 816 | if "pipeline" in model: 817 | sorted_filters.append(model) 818 | 819 | for filter in sorted_filters: 820 | r = None 821 | try: 822 | urlIdx = filter["urlIdx"] 823 | 824 | url = openai_app.state.config.OPENAI_API_BASE_URLS[urlIdx] 825 | key = openai_app.state.config.OPENAI_API_KEYS[urlIdx] 826 | 827 | if key != "": 828 | headers = {"Authorization": f"Bearer {key}"} 829 | r = requests.post( 830 | f"{url}/{filter['id']}/filter/inlet", 831 | headers=headers, 832 | json={ 833 | "user": user, 834 | "body": payload, 835 | }, 836 | ) 837 | 838 | r.raise_for_status() 839 | payload = r.json() 840 | except Exception as e: 841 | # Handle connection error here 842 | print(f"Connection error: {e}") 843 | 844 | if r is not None: 845 | res = r.json() 846 | if "detail" in res: 847 | raise Exception(r.status_code, res["detail"]) 848 | 849 | return payload 850 | 851 | 852 | class PipelineMiddleware(BaseHTTPMiddleware): 853 | async def dispatch(self, request: Request, call_next): 854 | if request.method == "POST" and ( 855 | "/ollama/api/chat" in request.url.path 856 | or "/chat/completions" in request.url.path 857 | ): 858 | log.debug(f"request.url.path: {request.url.path}") 859 | 860 | # Read the original request body 861 | body = await request.body() 862 | # Decode body to string 863 | body_str = body.decode("utf-8") 864 | # Parse string to JSON 865 | data = json.loads(body_str) if body_str else {} 866 | 867 | user = get_current_user( 868 | request, 869 | get_http_authorization_cred(request.headers.get("Authorization")), 870 | ) 871 | 872 | try: 873 | data = filter_pipeline(data, user) 874 | except Exception as e: 875 | return JSONResponse( 876 | status_code=e.args[0], 877 | content={"detail": e.args[1]}, 878 | ) 879 | 880 | modified_body_bytes = json.dumps(data).encode("utf-8") 881 | # Replace the request body with the modified one 882 | request._body = modified_body_bytes 883 | # Set custom header to ensure content-length matches new body length 884 | request.headers.__dict__["_list"] = [ 885 | (b"content-length", str(len(modified_body_bytes)).encode("utf-8")), 886 | *[ 887 | (k, v) 888 | for k, v in request.headers.raw 889 | if k.lower() != b"content-length" 890 | ], 891 | ] 892 | 893 | response = await call_next(request) 894 | return response 895 | 896 | async def _receive(self, body: bytes): 897 | return {"type": "http.request", "body": body, "more_body": False} 898 | 899 | 900 | app.add_middleware(PipelineMiddleware) 901 | 902 | 903 | app.add_middleware( 904 | CORSMiddleware, 905 | allow_origins=origins, 906 | allow_credentials=True, 907 | allow_methods=["*"], 908 | allow_headers=["*"], 909 | ) 910 | 911 | 912 | @app.middleware("http") 913 | async def commit_session_after_request(request: Request, call_next): 914 | response = await call_next(request) 915 | log.debug("Commit session after request") 916 | Session.commit() 917 | return response 918 | 919 | 920 | @app.middleware("http") 921 | async def check_url(request: Request, call_next): 922 | if len(app.state.MODELS) == 0: 923 | await get_all_models() 924 | else: 925 | pass 926 | 927 | start_time = int(time.time()) 928 | response = await call_next(request) 929 | process_time = int(time.time()) - start_time 930 | response.headers["X-Process-Time"] = str(process_time) 931 | 932 | return response 933 | 934 | 935 | @app.middleware("http") 936 | async def update_embedding_function(request: Request, call_next): 937 | response = await call_next(request) 938 | if "/embedding/update" in request.url.path: 939 | webui_app.state.EMBEDDING_FUNCTION = rag_app.state.EMBEDDING_FUNCTION 940 | return response 941 | 942 | 943 | app.mount("/ws", socket_app) 944 | 945 | app.mount("/ollama", ollama_app) 946 | app.mount("/openai", openai_app) 947 | 948 | app.mount("/images/api/v1", images_app) 949 | app.mount("/audio/api/v1", audio_app) 950 | app.mount("/rag/api/v1", rag_app) 951 | 952 | app.mount("/api/v1", webui_app) 953 | 954 | webui_app.state.EMBEDDING_FUNCTION = rag_app.state.EMBEDDING_FUNCTION 955 | 956 | 957 | async def get_all_models(): 958 | # TODO: Optimize this function 959 | pipe_models = [] 960 | openai_models = [] 961 | ollama_models = [] 962 | 963 | pipe_models = await get_pipe_models() 964 | 965 | if app.state.config.ENABLE_OPENAI_API: 966 | openai_models = await get_openai_models() 967 | openai_models = openai_models["data"] 968 | 969 | if app.state.config.ENABLE_OLLAMA_API: 970 | ollama_models = await get_ollama_models() 971 | ollama_models = [ 972 | { 973 | "id": model["model"], 974 | "name": model["name"], 975 | "object": "model", 976 | "created": int(time.time()), 977 | "owned_by": "ollama", 978 | "ollama": model, 979 | } 980 | for model in ollama_models["models"] 981 | ] 982 | 983 | models = pipe_models + openai_models + ollama_models 984 | 985 | global_action_ids = [ 986 | function.id for function in Functions.get_global_action_functions() 987 | ] 988 | enabled_action_ids = [ 989 | function.id 990 | for function in Functions.get_functions_by_type("action", active_only=True) 991 | ] 992 | 993 | custom_models = Models.get_all_models() 994 | for custom_model in custom_models: 995 | if custom_model.base_model_id == None: 996 | for model in models: 997 | if ( 998 | custom_model.id == model["id"] 999 | or custom_model.id == model["id"].split(":")[0] 1000 | ): 1001 | model["name"] = custom_model.name 1002 | model["info"] = custom_model.model_dump() 1003 | 1004 | action_ids = [] + global_action_ids 1005 | if "info" in model and "meta" in model["info"]: 1006 | action_ids.extend(model["info"]["meta"].get("actionIds", [])) 1007 | action_ids = list(set(action_ids)) 1008 | action_ids = [ 1009 | action_id 1010 | for action_id in action_ids 1011 | if action_id in enabled_action_ids 1012 | ] 1013 | 1014 | model["actions"] = [] 1015 | for action_id in action_ids: 1016 | action = Functions.get_function_by_id(action_id) 1017 | model["actions"].append( 1018 | { 1019 | "id": action_id, 1020 | "name": action.name, 1021 | "description": action.meta.description, 1022 | "icon_url": action.meta.manifest.get("icon_url", None), 1023 | } 1024 | ) 1025 | 1026 | else: 1027 | owned_by = "openai" 1028 | pipe = None 1029 | actions = [] 1030 | 1031 | for model in models: 1032 | if ( 1033 | custom_model.base_model_id == model["id"] 1034 | or custom_model.base_model_id == model["id"].split(":")[0] 1035 | ): 1036 | owned_by = model["owned_by"] 1037 | if "pipe" in model: 1038 | pipe = model["pipe"] 1039 | 1040 | action_ids = [] + global_action_ids 1041 | if "info" in model and "meta" in model["info"]: 1042 | action_ids.extend(model["info"]["meta"].get("actionIds", [])) 1043 | action_ids = list(set(action_ids)) 1044 | action_ids = [ 1045 | action_id 1046 | for action_id in action_ids 1047 | if action_id in enabled_action_ids 1048 | ] 1049 | 1050 | actions = [ 1051 | { 1052 | "id": action_id, 1053 | "name": Functions.get_function_by_id(action_id).name, 1054 | "description": Functions.get_function_by_id( 1055 | action_id 1056 | ).meta.description, 1057 | } 1058 | for action_id in action_ids 1059 | ] 1060 | break 1061 | 1062 | models.append( 1063 | { 1064 | "id": custom_model.id, 1065 | "name": custom_model.name, 1066 | "object": "model", 1067 | "created": custom_model.created_at, 1068 | "owned_by": owned_by, 1069 | "info": custom_model.model_dump(), 1070 | "preset": True, 1071 | **({"pipe": pipe} if pipe is not None else {}), 1072 | "actions": actions, 1073 | } 1074 | ) 1075 | 1076 | app.state.MODELS = {model["id"]: model for model in models} 1077 | webui_app.state.MODELS = app.state.MODELS 1078 | 1079 | return models 1080 | 1081 | 1082 | @app.get("/api/models") 1083 | async def get_models(user=Depends(get_verified_user)): 1084 | models = await get_all_models() 1085 | 1086 | # Filter out filter pipelines 1087 | models = [ 1088 | model 1089 | for model in models 1090 | if "pipeline" not in model or model["pipeline"].get("type", None) != "filter" 1091 | ] 1092 | 1093 | if app.state.config.ENABLE_MODEL_FILTER: 1094 | if user.role == "user": 1095 | models = list( 1096 | filter( 1097 | lambda model: model["id"] in app.state.config.MODEL_FILTER_LIST, 1098 | models, 1099 | ) 1100 | ) 1101 | return {"data": models} 1102 | 1103 | return {"data": models} 1104 | 1105 | 1106 | @app.post("/api/chat/completions") 1107 | async def generate_chat_completions(form_data: dict, user=Depends(get_verified_user)): 1108 | model_id = form_data["model"] 1109 | if model_id not in app.state.MODELS: 1110 | raise HTTPException( 1111 | status_code=status.HTTP_404_NOT_FOUND, 1112 | detail="Model not found", 1113 | ) 1114 | model = app.state.MODELS[model_id] 1115 | 1116 | # `task` field is used to determine the type of the request, e.g. `title_generation`, `query_generation`, etc. 1117 | task = None 1118 | if "task" in form_data: 1119 | task = form_data["task"] 1120 | del form_data["task"] 1121 | 1122 | if task: 1123 | if "metadata" in form_data: 1124 | form_data["metadata"]["task"] = task 1125 | else: 1126 | form_data["metadata"] = {"task": task} 1127 | 1128 | if model.get("pipe"): 1129 | return await generate_function_chat_completion(form_data, user=user) 1130 | if model["owned_by"] == "ollama": 1131 | print("generate_ollama_chat_completion") 1132 | return await generate_ollama_chat_completion(form_data, user=user) 1133 | else: 1134 | return await generate_openai_chat_completion(form_data, user=user) 1135 | 1136 | 1137 | @app.post("/api/chat/completed") 1138 | async def chat_completed(form_data: dict, user=Depends(get_verified_user)): 1139 | data = form_data 1140 | model_id = data["model"] 1141 | if model_id not in app.state.MODELS: 1142 | raise HTTPException( 1143 | status_code=status.HTTP_404_NOT_FOUND, 1144 | detail="Model not found", 1145 | ) 1146 | model = app.state.MODELS[model_id] 1147 | 1148 | sorted_filters = get_sorted_filters(model_id) 1149 | if "pipeline" in model: 1150 | sorted_filters = [model] + sorted_filters 1151 | 1152 | for filter in sorted_filters: 1153 | r = None 1154 | try: 1155 | urlIdx = filter["urlIdx"] 1156 | 1157 | url = openai_app.state.config.OPENAI_API_BASE_URLS[urlIdx] 1158 | key = openai_app.state.config.OPENAI_API_KEYS[urlIdx] 1159 | 1160 | if key != "": 1161 | headers = {"Authorization": f"Bearer {key}"} 1162 | r = requests.post( 1163 | f"{url}/{filter['id']}/filter/outlet", 1164 | headers=headers, 1165 | json={ 1166 | "user": { 1167 | "id": user.id, 1168 | "name": user.name, 1169 | "email": user.email, 1170 | "role": user.role, 1171 | }, 1172 | "body": data, 1173 | }, 1174 | ) 1175 | 1176 | r.raise_for_status() 1177 | data = r.json() 1178 | except Exception as e: 1179 | # Handle connection error here 1180 | print(f"Connection error: {e}") 1181 | 1182 | if r is not None: 1183 | try: 1184 | res = r.json() 1185 | if "detail" in res: 1186 | return JSONResponse( 1187 | status_code=r.status_code, 1188 | content=res, 1189 | ) 1190 | except: 1191 | pass 1192 | 1193 | else: 1194 | pass 1195 | 1196 | __event_emitter__ = await get_event_emitter( 1197 | { 1198 | "chat_id": data["chat_id"], 1199 | "message_id": data["id"], 1200 | "session_id": data["session_id"], 1201 | } 1202 | ) 1203 | 1204 | __event_call__ = await get_event_call( 1205 | { 1206 | "chat_id": data["chat_id"], 1207 | "message_id": data["id"], 1208 | "session_id": data["session_id"], 1209 | } 1210 | ) 1211 | 1212 | def get_priority(function_id): 1213 | function = Functions.get_function_by_id(function_id) 1214 | if function is not None and hasattr(function, "valves"): 1215 | return (function.valves if function.valves else {}).get("priority", 0) 1216 | return 0 1217 | 1218 | filter_ids = [function.id for function in Functions.get_global_filter_functions()] 1219 | if "info" in model and "meta" in model["info"]: 1220 | filter_ids.extend(model["info"]["meta"].get("filterIds", [])) 1221 | filter_ids = list(set(filter_ids)) 1222 | 1223 | enabled_filter_ids = [ 1224 | function.id 1225 | for function in Functions.get_functions_by_type("filter", active_only=True) 1226 | ] 1227 | filter_ids = [ 1228 | filter_id for filter_id in filter_ids if filter_id in enabled_filter_ids 1229 | ] 1230 | 1231 | # Sort filter_ids by priority, using the get_priority function 1232 | filter_ids.sort(key=get_priority) 1233 | 1234 | for filter_id in filter_ids: 1235 | filter = Functions.get_function_by_id(filter_id) 1236 | if not filter: 1237 | continue 1238 | 1239 | if filter_id in webui_app.state.FUNCTIONS: 1240 | function_module = webui_app.state.FUNCTIONS[filter_id] 1241 | else: 1242 | function_module, _, _ = load_function_module_by_id(filter_id) 1243 | webui_app.state.FUNCTIONS[filter_id] = function_module 1244 | 1245 | if hasattr(function_module, "valves") and hasattr(function_module, "Valves"): 1246 | valves = Functions.get_function_valves_by_id(filter_id) 1247 | function_module.valves = function_module.Valves( 1248 | **(valves if valves else {}) 1249 | ) 1250 | 1251 | if not hasattr(function_module, "outlet"): 1252 | continue 1253 | try: 1254 | outlet = function_module.outlet 1255 | 1256 | # Get the signature of the function 1257 | sig = inspect.signature(outlet) 1258 | params = {"body": data} 1259 | 1260 | # Extra parameters to be passed to the function 1261 | extra_params = { 1262 | "__model__": model, 1263 | "__id__": filter_id, 1264 | "__event_emitter__": __event_emitter__, 1265 | "__event_call__": __event_call__, 1266 | } 1267 | 1268 | # Add extra params in contained in function signature 1269 | for key, value in extra_params.items(): 1270 | if key in sig.parameters: 1271 | params[key] = value 1272 | 1273 | if "__user__" in sig.parameters: 1274 | __user__ = { 1275 | "id": user.id, 1276 | "email": user.email, 1277 | "name": user.name, 1278 | "role": user.role, 1279 | } 1280 | 1281 | try: 1282 | if hasattr(function_module, "UserValves"): 1283 | __user__["valves"] = function_module.UserValves( 1284 | **Functions.get_user_valves_by_id_and_user_id( 1285 | filter_id, user.id 1286 | ) 1287 | ) 1288 | except Exception as e: 1289 | print(e) 1290 | 1291 | params = {**params, "__user__": __user__} 1292 | 1293 | if inspect.iscoroutinefunction(outlet): 1294 | data = await outlet(**params) 1295 | else: 1296 | data = outlet(**params) 1297 | 1298 | except Exception as e: 1299 | print(f"Error: {e}") 1300 | return JSONResponse( 1301 | status_code=status.HTTP_400_BAD_REQUEST, 1302 | content={"detail": str(e)}, 1303 | ) 1304 | 1305 | return data 1306 | 1307 | 1308 | @app.post("/api/chat/actions/{action_id}") 1309 | async def chat_completed( 1310 | action_id: str, form_data: dict, user=Depends(get_verified_user) 1311 | ): 1312 | action = Functions.get_function_by_id(action_id) 1313 | if not action: 1314 | raise HTTPException( 1315 | status_code=status.HTTP_404_NOT_FOUND, 1316 | detail="Action not found", 1317 | ) 1318 | 1319 | data = form_data 1320 | model_id = data["model"] 1321 | if model_id not in app.state.MODELS: 1322 | raise HTTPException( 1323 | status_code=status.HTTP_404_NOT_FOUND, 1324 | detail="Model not found", 1325 | ) 1326 | model = app.state.MODELS[model_id] 1327 | 1328 | __event_emitter__ = await get_event_emitter( 1329 | { 1330 | "chat_id": data["chat_id"], 1331 | "message_id": data["id"], 1332 | "session_id": data["session_id"], 1333 | } 1334 | ) 1335 | __event_call__ = await get_event_call( 1336 | { 1337 | "chat_id": data["chat_id"], 1338 | "message_id": data["id"], 1339 | "session_id": data["session_id"], 1340 | } 1341 | ) 1342 | 1343 | if action_id in webui_app.state.FUNCTIONS: 1344 | function_module = webui_app.state.FUNCTIONS[action_id] 1345 | else: 1346 | function_module, _, _ = load_function_module_by_id(action_id) 1347 | webui_app.state.FUNCTIONS[action_id] = function_module 1348 | 1349 | if hasattr(function_module, "valves") and hasattr(function_module, "Valves"): 1350 | valves = Functions.get_function_valves_by_id(action_id) 1351 | function_module.valves = function_module.Valves(**(valves if valves else {})) 1352 | 1353 | if hasattr(function_module, "action"): 1354 | try: 1355 | action = function_module.action 1356 | 1357 | # Get the signature of the function 1358 | sig = inspect.signature(action) 1359 | params = {"body": data} 1360 | 1361 | # Extra parameters to be passed to the function 1362 | extra_params = { 1363 | "__model__": model, 1364 | "__id__": action_id, 1365 | "__event_emitter__": __event_emitter__, 1366 | "__event_call__": __event_call__, 1367 | } 1368 | 1369 | # Add extra params in contained in function signature 1370 | for key, value in extra_params.items(): 1371 | if key in sig.parameters: 1372 | params[key] = value 1373 | 1374 | if "__user__" in sig.parameters: 1375 | __user__ = { 1376 | "id": user.id, 1377 | "email": user.email, 1378 | "name": user.name, 1379 | "role": user.role, 1380 | } 1381 | 1382 | try: 1383 | if hasattr(function_module, "UserValves"): 1384 | __user__["valves"] = function_module.UserValves( 1385 | **Functions.get_user_valves_by_id_and_user_id( 1386 | action_id, user.id 1387 | ) 1388 | ) 1389 | except Exception as e: 1390 | print(e) 1391 | 1392 | params = {**params, "__user__": __user__} 1393 | 1394 | if inspect.iscoroutinefunction(action): 1395 | data = await action(**params) 1396 | else: 1397 | data = action(**params) 1398 | 1399 | except Exception as e: 1400 | print(f"Error: {e}") 1401 | return JSONResponse( 1402 | status_code=status.HTTP_400_BAD_REQUEST, 1403 | content={"detail": str(e)}, 1404 | ) 1405 | 1406 | return data 1407 | 1408 | 1409 | ################################## 1410 | # 1411 | # Task Endpoints 1412 | # 1413 | ################################## 1414 | 1415 | 1416 | # TODO: Refactor task API endpoints below into a separate file 1417 | 1418 | 1419 | @app.get("/api/task/config") 1420 | async def get_task_config(user=Depends(get_verified_user)): 1421 | return { 1422 | "TASK_MODEL": app.state.config.TASK_MODEL, 1423 | "TASK_MODEL_EXTERNAL": app.state.config.TASK_MODEL_EXTERNAL, 1424 | "TITLE_GENERATION_PROMPT_TEMPLATE": app.state.config.TITLE_GENERATION_PROMPT_TEMPLATE, 1425 | "SEARCH_QUERY_GENERATION_PROMPT_TEMPLATE": app.state.config.SEARCH_QUERY_GENERATION_PROMPT_TEMPLATE, 1426 | "SEARCH_QUERY_PROMPT_LENGTH_THRESHOLD": app.state.config.SEARCH_QUERY_PROMPT_LENGTH_THRESHOLD, 1427 | "TOOLS_FUNCTION_CALLING_PROMPT_TEMPLATE": app.state.config.TOOLS_FUNCTION_CALLING_PROMPT_TEMPLATE, 1428 | } 1429 | 1430 | 1431 | class TaskConfigForm(BaseModel): 1432 | TASK_MODEL: Optional[str] 1433 | TASK_MODEL_EXTERNAL: Optional[str] 1434 | TITLE_GENERATION_PROMPT_TEMPLATE: str 1435 | SEARCH_QUERY_GENERATION_PROMPT_TEMPLATE: str 1436 | SEARCH_QUERY_PROMPT_LENGTH_THRESHOLD: int 1437 | TOOLS_FUNCTION_CALLING_PROMPT_TEMPLATE: str 1438 | 1439 | 1440 | @app.post("/api/task/config/update") 1441 | async def update_task_config(form_data: TaskConfigForm, user=Depends(get_admin_user)): 1442 | app.state.config.TASK_MODEL = form_data.TASK_MODEL 1443 | app.state.config.TASK_MODEL_EXTERNAL = form_data.TASK_MODEL_EXTERNAL 1444 | app.state.config.TITLE_GENERATION_PROMPT_TEMPLATE = ( 1445 | form_data.TITLE_GENERATION_PROMPT_TEMPLATE 1446 | ) 1447 | app.state.config.SEARCH_QUERY_GENERATION_PROMPT_TEMPLATE = ( 1448 | form_data.SEARCH_QUERY_GENERATION_PROMPT_TEMPLATE 1449 | ) 1450 | app.state.config.SEARCH_QUERY_PROMPT_LENGTH_THRESHOLD = ( 1451 | form_data.SEARCH_QUERY_PROMPT_LENGTH_THRESHOLD 1452 | ) 1453 | app.state.config.TOOLS_FUNCTION_CALLING_PROMPT_TEMPLATE = ( 1454 | form_data.TOOLS_FUNCTION_CALLING_PROMPT_TEMPLATE 1455 | ) 1456 | 1457 | return { 1458 | "TASK_MODEL": app.state.config.TASK_MODEL, 1459 | "TASK_MODEL_EXTERNAL": app.state.config.TASK_MODEL_EXTERNAL, 1460 | "TITLE_GENERATION_PROMPT_TEMPLATE": app.state.config.TITLE_GENERATION_PROMPT_TEMPLATE, 1461 | "SEARCH_QUERY_GENERATION_PROMPT_TEMPLATE": app.state.config.SEARCH_QUERY_GENERATION_PROMPT_TEMPLATE, 1462 | "SEARCH_QUERY_PROMPT_LENGTH_THRESHOLD": app.state.config.SEARCH_QUERY_PROMPT_LENGTH_THRESHOLD, 1463 | "TOOLS_FUNCTION_CALLING_PROMPT_TEMPLATE": app.state.config.TOOLS_FUNCTION_CALLING_PROMPT_TEMPLATE, 1464 | } 1465 | 1466 | 1467 | @app.post("/api/task/title/completions") 1468 | async def generate_title(form_data: dict, user=Depends(get_verified_user)): 1469 | print("generate_title") 1470 | 1471 | model_id = form_data["model"] 1472 | if model_id not in app.state.MODELS: 1473 | raise HTTPException( 1474 | status_code=status.HTTP_404_NOT_FOUND, 1475 | detail="Model not found", 1476 | ) 1477 | 1478 | # Check if the user has a custom task model 1479 | # If the user has a custom task model, use that model 1480 | model_id = get_task_model_id(model_id) 1481 | 1482 | print(model_id) 1483 | 1484 | template = app.state.config.TITLE_GENERATION_PROMPT_TEMPLATE 1485 | 1486 | content = title_generation_template( 1487 | template, 1488 | form_data["prompt"], 1489 | { 1490 | "name": user.name, 1491 | "location": user.info.get("location") if user.info else None, 1492 | }, 1493 | ) 1494 | 1495 | payload = { 1496 | "model": model_id, 1497 | "messages": [{"role": "user", "content": content}], 1498 | "stream": False, 1499 | "max_tokens": 50, 1500 | "chat_id": form_data.get("chat_id", None), 1501 | "task": str(TASKS.TITLE_GENERATION), 1502 | } 1503 | 1504 | log.debug(payload) 1505 | 1506 | try: 1507 | payload = filter_pipeline(payload, user) 1508 | except Exception as e: 1509 | return JSONResponse( 1510 | status_code=e.args[0], 1511 | content={"detail": e.args[1]}, 1512 | ) 1513 | 1514 | if "chat_id" in payload: 1515 | del payload["chat_id"] 1516 | 1517 | return await generate_chat_completions(form_data=payload, user=user) 1518 | 1519 | 1520 | @app.post("/api/task/query/completions") 1521 | async def generate_search_query(form_data: dict, user=Depends(get_verified_user)): 1522 | print("generate_search_query") 1523 | 1524 | if len(form_data["prompt"]) < app.state.config.SEARCH_QUERY_PROMPT_LENGTH_THRESHOLD: 1525 | raise HTTPException( 1526 | status_code=status.HTTP_400_BAD_REQUEST, 1527 | detail=f"Skip search query generation for short prompts (< {app.state.config.SEARCH_QUERY_PROMPT_LENGTH_THRESHOLD} characters)", 1528 | ) 1529 | 1530 | model_id = form_data["model"] 1531 | if model_id not in app.state.MODELS: 1532 | raise HTTPException( 1533 | status_code=status.HTTP_404_NOT_FOUND, 1534 | detail="Model not found", 1535 | ) 1536 | 1537 | # Check if the user has a custom task model 1538 | # If the user has a custom task model, use that model 1539 | model_id = get_task_model_id(model_id) 1540 | 1541 | print(model_id) 1542 | 1543 | template = app.state.config.SEARCH_QUERY_GENERATION_PROMPT_TEMPLATE 1544 | 1545 | content = search_query_generation_template( 1546 | template, form_data["prompt"], {"name": user.name} 1547 | ) 1548 | 1549 | payload = { 1550 | "model": model_id, 1551 | "messages": [{"role": "user", "content": content}], 1552 | "stream": False, 1553 | "max_tokens": 30, 1554 | "task": str(TASKS.QUERY_GENERATION), 1555 | } 1556 | 1557 | print(payload) 1558 | 1559 | try: 1560 | payload = filter_pipeline(payload, user) 1561 | except Exception as e: 1562 | return JSONResponse( 1563 | status_code=e.args[0], 1564 | content={"detail": e.args[1]}, 1565 | ) 1566 | 1567 | if "chat_id" in payload: 1568 | del payload["chat_id"] 1569 | 1570 | return await generate_chat_completions(form_data=payload, user=user) 1571 | 1572 | 1573 | @app.post("/api/task/emoji/completions") 1574 | async def generate_emoji(form_data: dict, user=Depends(get_verified_user)): 1575 | print("generate_emoji") 1576 | 1577 | model_id = form_data["model"] 1578 | if model_id not in app.state.MODELS: 1579 | raise HTTPException( 1580 | status_code=status.HTTP_404_NOT_FOUND, 1581 | detail="Model not found", 1582 | ) 1583 | 1584 | # Check if the user has a custom task model 1585 | # If the user has a custom task model, use that model 1586 | model_id = get_task_model_id(model_id) 1587 | 1588 | print(model_id) 1589 | 1590 | template = ''' 1591 | Your task is to reflect the speaker's likely facial expression through a fitting emoji. Interpret emotions from the message and reflect their facial expression using fitting, diverse emojis (e.g., 😊, 😢, 😡, 😱). 1592 | 1593 | Message: """{{prompt}}""" 1594 | ''' 1595 | 1596 | content = title_generation_template( 1597 | template, 1598 | form_data["prompt"], 1599 | { 1600 | "name": user.name, 1601 | "location": user.info.get("location") if user.info else None, 1602 | }, 1603 | ) 1604 | 1605 | payload = { 1606 | "model": model_id, 1607 | "messages": [{"role": "user", "content": content}], 1608 | "stream": False, 1609 | "max_tokens": 4, 1610 | "chat_id": form_data.get("chat_id", None), 1611 | "task": str(TASKS.EMOJI_GENERATION), 1612 | } 1613 | 1614 | log.debug(payload) 1615 | 1616 | try: 1617 | payload = filter_pipeline(payload, user) 1618 | except Exception as e: 1619 | return JSONResponse( 1620 | status_code=e.args[0], 1621 | content={"detail": e.args[1]}, 1622 | ) 1623 | 1624 | if "chat_id" in payload: 1625 | del payload["chat_id"] 1626 | 1627 | return await generate_chat_completions(form_data=payload, user=user) 1628 | 1629 | 1630 | @app.post("/api/task/tools/completions") 1631 | async def get_tools_function_calling(form_data: dict, user=Depends(get_verified_user)): 1632 | print("get_tools_function_calling") 1633 | 1634 | model_id = form_data["model"] 1635 | if model_id not in app.state.MODELS: 1636 | raise HTTPException( 1637 | status_code=status.HTTP_404_NOT_FOUND, 1638 | detail="Model not found", 1639 | ) 1640 | 1641 | # Check if the user has a custom task model 1642 | # If the user has a custom task model, use that model 1643 | model_id = get_task_model_id(model_id) 1644 | 1645 | print(model_id) 1646 | template = app.state.config.TOOLS_FUNCTION_CALLING_PROMPT_TEMPLATE 1647 | 1648 | try: 1649 | context, _, _ = await get_function_call_response( 1650 | form_data["messages"], 1651 | form_data.get("files", []), 1652 | form_data["tool_id"], 1653 | template, 1654 | model_id, 1655 | user, 1656 | ) 1657 | return context 1658 | except Exception as e: 1659 | return JSONResponse( 1660 | status_code=e.args[0], 1661 | content={"detail": e.args[1]}, 1662 | ) 1663 | 1664 | 1665 | ################################## 1666 | # 1667 | # Pipelines Endpoints 1668 | # 1669 | ################################## 1670 | 1671 | 1672 | # TODO: Refactor pipelines API endpoints below into a separate file 1673 | 1674 | 1675 | @app.get("/api/pipelines/list") 1676 | async def get_pipelines_list(user=Depends(get_admin_user)): 1677 | responses = await get_openai_models(raw=True) 1678 | 1679 | print(responses) 1680 | urlIdxs = [ 1681 | idx 1682 | for idx, response in enumerate(responses) 1683 | if response != None and "pipelines" in response 1684 | ] 1685 | 1686 | return { 1687 | "data": [ 1688 | { 1689 | "url": openai_app.state.config.OPENAI_API_BASE_URLS[urlIdx], 1690 | "idx": urlIdx, 1691 | } 1692 | for urlIdx in urlIdxs 1693 | ] 1694 | } 1695 | 1696 | 1697 | @app.post("/api/pipelines/upload") 1698 | async def upload_pipeline( 1699 | urlIdx: int = Form(...), file: UploadFile = File(...), user=Depends(get_admin_user) 1700 | ): 1701 | print("upload_pipeline", urlIdx, file.filename) 1702 | # Check if the uploaded file is a python file 1703 | if not file.filename.endswith(".py"): 1704 | raise HTTPException( 1705 | status_code=status.HTTP_400_BAD_REQUEST, 1706 | detail="Only Python (.py) files are allowed.", 1707 | ) 1708 | 1709 | upload_folder = f"{CACHE_DIR}/pipelines" 1710 | os.makedirs(upload_folder, exist_ok=True) 1711 | file_path = os.path.join(upload_folder, file.filename) 1712 | 1713 | r = None 1714 | try: 1715 | # Save the uploaded file 1716 | with open(file_path, "wb") as buffer: 1717 | shutil.copyfileobj(file.file, buffer) 1718 | 1719 | url = openai_app.state.config.OPENAI_API_BASE_URLS[urlIdx] 1720 | key = openai_app.state.config.OPENAI_API_KEYS[urlIdx] 1721 | 1722 | headers = {"Authorization": f"Bearer {key}"} 1723 | 1724 | with open(file_path, "rb") as f: 1725 | files = {"file": f} 1726 | r = requests.post(f"{url}/pipelines/upload", headers=headers, files=files) 1727 | 1728 | r.raise_for_status() 1729 | data = r.json() 1730 | 1731 | return {**data} 1732 | except Exception as e: 1733 | # Handle connection error here 1734 | print(f"Connection error: {e}") 1735 | 1736 | detail = "Pipeline not found" 1737 | status_code = status.HTTP_404_NOT_FOUND 1738 | if r is not None: 1739 | status_code = r.status_code 1740 | try: 1741 | res = r.json() 1742 | if "detail" in res: 1743 | detail = res["detail"] 1744 | except: 1745 | pass 1746 | 1747 | raise HTTPException( 1748 | status_code=status_code, 1749 | detail=detail, 1750 | ) 1751 | finally: 1752 | # Ensure the file is deleted after the upload is completed or on failure 1753 | if os.path.exists(file_path): 1754 | os.remove(file_path) 1755 | 1756 | 1757 | class AddPipelineForm(BaseModel): 1758 | url: str 1759 | urlIdx: int 1760 | 1761 | 1762 | @app.post("/api/pipelines/add") 1763 | async def add_pipeline(form_data: AddPipelineForm, user=Depends(get_admin_user)): 1764 | 1765 | r = None 1766 | try: 1767 | urlIdx = form_data.urlIdx 1768 | 1769 | url = openai_app.state.config.OPENAI_API_BASE_URLS[urlIdx] 1770 | key = openai_app.state.config.OPENAI_API_KEYS[urlIdx] 1771 | 1772 | headers = {"Authorization": f"Bearer {key}"} 1773 | r = requests.post( 1774 | f"{url}/pipelines/add", headers=headers, json={"url": form_data.url} 1775 | ) 1776 | 1777 | r.raise_for_status() 1778 | data = r.json() 1779 | 1780 | return {**data} 1781 | except Exception as e: 1782 | # Handle connection error here 1783 | print(f"Connection error: {e}") 1784 | 1785 | detail = "Pipeline not found" 1786 | if r is not None: 1787 | try: 1788 | res = r.json() 1789 | if "detail" in res: 1790 | detail = res["detail"] 1791 | except: 1792 | pass 1793 | 1794 | raise HTTPException( 1795 | status_code=(r.status_code if r is not None else status.HTTP_404_NOT_FOUND), 1796 | detail=detail, 1797 | ) 1798 | 1799 | 1800 | class DeletePipelineForm(BaseModel): 1801 | id: str 1802 | urlIdx: int 1803 | 1804 | 1805 | @app.delete("/api/pipelines/delete") 1806 | async def delete_pipeline(form_data: DeletePipelineForm, user=Depends(get_admin_user)): 1807 | 1808 | r = None 1809 | try: 1810 | urlIdx = form_data.urlIdx 1811 | 1812 | url = openai_app.state.config.OPENAI_API_BASE_URLS[urlIdx] 1813 | key = openai_app.state.config.OPENAI_API_KEYS[urlIdx] 1814 | 1815 | headers = {"Authorization": f"Bearer {key}"} 1816 | r = requests.delete( 1817 | f"{url}/pipelines/delete", headers=headers, json={"id": form_data.id} 1818 | ) 1819 | 1820 | r.raise_for_status() 1821 | data = r.json() 1822 | 1823 | return {**data} 1824 | except Exception as e: 1825 | # Handle connection error here 1826 | print(f"Connection error: {e}") 1827 | 1828 | detail = "Pipeline not found" 1829 | if r is not None: 1830 | try: 1831 | res = r.json() 1832 | if "detail" in res: 1833 | detail = res["detail"] 1834 | except: 1835 | pass 1836 | 1837 | raise HTTPException( 1838 | status_code=(r.status_code if r is not None else status.HTTP_404_NOT_FOUND), 1839 | detail=detail, 1840 | ) 1841 | 1842 | 1843 | @app.get("/api/pipelines") 1844 | async def get_pipelines(urlIdx: Optional[int] = None, user=Depends(get_admin_user)): 1845 | r = None 1846 | try: 1847 | url = openai_app.state.config.OPENAI_API_BASE_URLS[urlIdx] 1848 | key = openai_app.state.config.OPENAI_API_KEYS[urlIdx] 1849 | 1850 | headers = {"Authorization": f"Bearer {key}"} 1851 | r = requests.get(f"{url}/pipelines", headers=headers) 1852 | 1853 | r.raise_for_status() 1854 | data = r.json() 1855 | 1856 | return {**data} 1857 | except Exception as e: 1858 | # Handle connection error here 1859 | print(f"Connection error: {e}") 1860 | 1861 | detail = "Pipeline not found" 1862 | if r is not None: 1863 | try: 1864 | res = r.json() 1865 | if "detail" in res: 1866 | detail = res["detail"] 1867 | except: 1868 | pass 1869 | 1870 | raise HTTPException( 1871 | status_code=(r.status_code if r is not None else status.HTTP_404_NOT_FOUND), 1872 | detail=detail, 1873 | ) 1874 | 1875 | 1876 | @app.get("/api/pipelines/{pipeline_id}/valves") 1877 | async def get_pipeline_valves( 1878 | urlIdx: Optional[int], 1879 | pipeline_id: str, 1880 | user=Depends(get_admin_user), 1881 | ): 1882 | models = await get_all_models() 1883 | r = None 1884 | try: 1885 | 1886 | url = openai_app.state.config.OPENAI_API_BASE_URLS[urlIdx] 1887 | key = openai_app.state.config.OPENAI_API_KEYS[urlIdx] 1888 | 1889 | headers = {"Authorization": f"Bearer {key}"} 1890 | r = requests.get(f"{url}/{pipeline_id}/valves", headers=headers) 1891 | 1892 | r.raise_for_status() 1893 | data = r.json() 1894 | 1895 | return {**data} 1896 | except Exception as e: 1897 | # Handle connection error here 1898 | print(f"Connection error: {e}") 1899 | 1900 | detail = "Pipeline not found" 1901 | 1902 | if r is not None: 1903 | try: 1904 | res = r.json() 1905 | if "detail" in res: 1906 | detail = res["detail"] 1907 | except: 1908 | pass 1909 | 1910 | raise HTTPException( 1911 | status_code=(r.status_code if r is not None else status.HTTP_404_NOT_FOUND), 1912 | detail=detail, 1913 | ) 1914 | 1915 | 1916 | @app.get("/api/pipelines/{pipeline_id}/valves/spec") 1917 | async def get_pipeline_valves_spec( 1918 | urlIdx: Optional[int], 1919 | pipeline_id: str, 1920 | user=Depends(get_admin_user), 1921 | ): 1922 | models = await get_all_models() 1923 | 1924 | r = None 1925 | try: 1926 | url = openai_app.state.config.OPENAI_API_BASE_URLS[urlIdx] 1927 | key = openai_app.state.config.OPENAI_API_KEYS[urlIdx] 1928 | 1929 | headers = {"Authorization": f"Bearer {key}"} 1930 | r = requests.get(f"{url}/{pipeline_id}/valves/spec", headers=headers) 1931 | 1932 | r.raise_for_status() 1933 | data = r.json() 1934 | 1935 | return {**data} 1936 | except Exception as e: 1937 | # Handle connection error here 1938 | print(f"Connection error: {e}") 1939 | 1940 | detail = "Pipeline not found" 1941 | if r is not None: 1942 | try: 1943 | res = r.json() 1944 | if "detail" in res: 1945 | detail = res["detail"] 1946 | except: 1947 | pass 1948 | 1949 | raise HTTPException( 1950 | status_code=(r.status_code if r is not None else status.HTTP_404_NOT_FOUND), 1951 | detail=detail, 1952 | ) 1953 | 1954 | 1955 | @app.post("/api/pipelines/{pipeline_id}/valves/update") 1956 | async def update_pipeline_valves( 1957 | urlIdx: Optional[int], 1958 | pipeline_id: str, 1959 | form_data: dict, 1960 | user=Depends(get_admin_user), 1961 | ): 1962 | models = await get_all_models() 1963 | 1964 | r = None 1965 | try: 1966 | url = openai_app.state.config.OPENAI_API_BASE_URLS[urlIdx] 1967 | key = openai_app.state.config.OPENAI_API_KEYS[urlIdx] 1968 | 1969 | headers = {"Authorization": f"Bearer {key}"} 1970 | r = requests.post( 1971 | f"{url}/{pipeline_id}/valves/update", 1972 | headers=headers, 1973 | json={**form_data}, 1974 | ) 1975 | 1976 | r.raise_for_status() 1977 | data = r.json() 1978 | 1979 | return {**data} 1980 | except Exception as e: 1981 | # Handle connection error here 1982 | print(f"Connection error: {e}") 1983 | 1984 | detail = "Pipeline not found" 1985 | 1986 | if r is not None: 1987 | try: 1988 | res = r.json() 1989 | if "detail" in res: 1990 | detail = res["detail"] 1991 | except: 1992 | pass 1993 | 1994 | raise HTTPException( 1995 | status_code=(r.status_code if r is not None else status.HTTP_404_NOT_FOUND), 1996 | detail=detail, 1997 | ) 1998 | 1999 | 2000 | ################################## 2001 | # 2002 | # Config Endpoints 2003 | # 2004 | ################################## 2005 | 2006 | 2007 | @app.get("/api/config") 2008 | async def get_app_config(): 2009 | return { 2010 | "status": True, 2011 | "name": WEBUI_NAME, 2012 | "version": VERSION, 2013 | "default_locale": str(DEFAULT_LOCALE), 2014 | "default_models": webui_app.state.config.DEFAULT_MODELS, 2015 | "default_prompt_suggestions": webui_app.state.config.DEFAULT_PROMPT_SUGGESTIONS, 2016 | "features": { 2017 | "auth": WEBUI_AUTH, 2018 | "auth_trusted_header": bool(webui_app.state.AUTH_TRUSTED_EMAIL_HEADER), 2019 | "enable_signup": webui_app.state.config.ENABLE_SIGNUP, 2020 | "enable_web_search": rag_app.state.config.ENABLE_RAG_WEB_SEARCH, 2021 | "enable_image_generation": images_app.state.config.ENABLED, 2022 | "enable_community_sharing": webui_app.state.config.ENABLE_COMMUNITY_SHARING, 2023 | "enable_admin_export": ENABLE_ADMIN_EXPORT, 2024 | }, 2025 | "audio": { 2026 | "tts": { 2027 | "engine": audio_app.state.config.TTS_ENGINE, 2028 | "voice": audio_app.state.config.TTS_VOICE, 2029 | }, 2030 | "stt": { 2031 | "engine": audio_app.state.config.STT_ENGINE, 2032 | }, 2033 | }, 2034 | "oauth": { 2035 | "providers": { 2036 | name: config.get("name", name) 2037 | for name, config in OAUTH_PROVIDERS.items() 2038 | } 2039 | }, 2040 | } 2041 | 2042 | 2043 | @app.get("/api/config/model/filter") 2044 | async def get_model_filter_config(user=Depends(get_admin_user)): 2045 | return { 2046 | "enabled": app.state.config.ENABLE_MODEL_FILTER, 2047 | "models": app.state.config.MODEL_FILTER_LIST, 2048 | } 2049 | 2050 | 2051 | class ModelFilterConfigForm(BaseModel): 2052 | enabled: bool 2053 | models: List[str] 2054 | 2055 | 2056 | @app.post("/api/config/model/filter") 2057 | async def update_model_filter_config( 2058 | form_data: ModelFilterConfigForm, user=Depends(get_admin_user) 2059 | ): 2060 | app.state.config.ENABLE_MODEL_FILTER = form_data.enabled 2061 | app.state.config.MODEL_FILTER_LIST = form_data.models 2062 | 2063 | return { 2064 | "enabled": app.state.config.ENABLE_MODEL_FILTER, 2065 | "models": app.state.config.MODEL_FILTER_LIST, 2066 | } 2067 | 2068 | 2069 | # TODO: webhook endpoint should be under config endpoints 2070 | 2071 | 2072 | @app.get("/api/webhook") 2073 | async def get_webhook_url(user=Depends(get_admin_user)): 2074 | return { 2075 | "url": app.state.config.WEBHOOK_URL, 2076 | } 2077 | 2078 | 2079 | class UrlForm(BaseModel): 2080 | url: str 2081 | 2082 | 2083 | @app.post("/api/webhook") 2084 | async def update_webhook_url(form_data: UrlForm, user=Depends(get_admin_user)): 2085 | app.state.config.WEBHOOK_URL = form_data.url 2086 | webui_app.state.WEBHOOK_URL = app.state.config.WEBHOOK_URL 2087 | return {"url": app.state.config.WEBHOOK_URL} 2088 | 2089 | 2090 | @app.get("/api/version") 2091 | async def get_app_config(): 2092 | return { 2093 | "version": VERSION, 2094 | } 2095 | 2096 | 2097 | @app.get("/api/changelog") 2098 | async def get_app_changelog(): 2099 | return {key: CHANGELOG[key] for idx, key in enumerate(CHANGELOG) if idx < 5} 2100 | 2101 | 2102 | @app.get("/api/version/updates") 2103 | async def get_app_latest_release_version(): 2104 | try: 2105 | async with aiohttp.ClientSession(trust_env=True) as session: 2106 | async with session.get( 2107 | "https://api.github.com/repos/open-webui/open-webui/releases/latest" 2108 | ) as response: 2109 | response.raise_for_status() 2110 | data = await response.json() 2111 | latest_version = data["tag_name"] 2112 | 2113 | return {"current": VERSION, "latest": latest_version[1:]} 2114 | except aiohttp.ClientError as e: 2115 | raise HTTPException( 2116 | status_code=status.HTTP_503_SERVICE_UNAVAILABLE, 2117 | detail=ERROR_MESSAGES.RATE_LIMIT_EXCEEDED, 2118 | ) 2119 | 2120 | 2121 | ############################ 2122 | # OAuth Login & Callback 2123 | ############################ 2124 | 2125 | oauth = OAuth() 2126 | 2127 | for provider_name, provider_config in OAUTH_PROVIDERS.items(): 2128 | oauth.register( 2129 | name=provider_name, 2130 | client_id=provider_config["client_id"], 2131 | client_secret=provider_config["client_secret"], 2132 | server_metadata_url=provider_config["server_metadata_url"], 2133 | client_kwargs={ 2134 | "scope": provider_config["scope"], 2135 | }, 2136 | ) 2137 | 2138 | # SessionMiddleware is used by authlib for oauth 2139 | if len(OAUTH_PROVIDERS) > 0: 2140 | app.add_middleware( 2141 | SessionMiddleware, 2142 | secret_key=WEBUI_SECRET_KEY, 2143 | session_cookie="oui-session", 2144 | same_site=WEBUI_SESSION_COOKIE_SAME_SITE, 2145 | https_only=WEBUI_SESSION_COOKIE_SECURE, 2146 | ) 2147 | 2148 | 2149 | @app.get("/oauth/{provider}/login") 2150 | async def oauth_login(provider: str, request: Request): 2151 | if provider not in OAUTH_PROVIDERS: 2152 | raise HTTPException(404) 2153 | redirect_uri = request.url_for("oauth_callback", provider=provider) 2154 | return await oauth.create_client(provider).authorize_redirect(request, redirect_uri) 2155 | 2156 | 2157 | # OAuth login logic is as follows: 2158 | # 1. Attempt to find a user with matching subject ID, tied to the provider 2159 | # 2. If OAUTH_MERGE_ACCOUNTS_BY_EMAIL is true, find a user with the email address provided via OAuth 2160 | # - This is considered insecure in general, as OAuth providers do not always verify email addresses 2161 | # 3. If there is no user, and ENABLE_OAUTH_SIGNUP is true, create a user 2162 | # - Email addresses are considered unique, so we fail registration if the email address is alreayd taken 2163 | @app.get("/oauth/{provider}/callback") 2164 | async def oauth_callback(provider: str, request: Request, response: Response): 2165 | if provider not in OAUTH_PROVIDERS: 2166 | raise HTTPException(404) 2167 | client = oauth.create_client(provider) 2168 | try: 2169 | token = await client.authorize_access_token(request) 2170 | except Exception as e: 2171 | log.warning(f"OAuth callback error: {e}") 2172 | raise HTTPException(400, detail=ERROR_MESSAGES.INVALID_CRED) 2173 | user_data: UserInfo = token["userinfo"] 2174 | 2175 | sub = user_data.get("sub") 2176 | if not sub: 2177 | log.warning(f"OAuth callback failed, sub is missing: {user_data}") 2178 | raise HTTPException(400, detail=ERROR_MESSAGES.INVALID_CRED) 2179 | provider_sub = f"{provider}@{sub}" 2180 | email = user_data.get("email", "").lower() 2181 | # We currently mandate that email addresses are provided 2182 | if not email: 2183 | log.warning(f"OAuth callback failed, email is missing: {user_data}") 2184 | raise HTTPException(400, detail=ERROR_MESSAGES.INVALID_CRED) 2185 | 2186 | # Check if the user exists 2187 | user = Users.get_user_by_oauth_sub(provider_sub) 2188 | 2189 | if not user: 2190 | # If the user does not exist, check if merging is enabled 2191 | if OAUTH_MERGE_ACCOUNTS_BY_EMAIL.value: 2192 | # Check if the user exists by email 2193 | user = Users.get_user_by_email(email) 2194 | if user: 2195 | # Update the user with the new oauth sub 2196 | Users.update_user_oauth_sub_by_id(user.id, provider_sub) 2197 | 2198 | if not user: 2199 | # If the user does not exist, check if signups are enabled 2200 | if ENABLE_OAUTH_SIGNUP.value: 2201 | # Check if an existing user with the same email already exists 2202 | existing_user = Users.get_user_by_email(user_data.get("email", "").lower()) 2203 | if existing_user: 2204 | raise HTTPException(400, detail=ERROR_MESSAGES.EMAIL_TAKEN) 2205 | 2206 | picture_claim = webui_app.state.config.OAUTH_PICTURE_CLAIM 2207 | picture_url = user_data.get(picture_claim, "") 2208 | if picture_url: 2209 | # Download the profile image into a base64 string 2210 | try: 2211 | async with aiohttp.ClientSession() as session: 2212 | async with session.get(picture_url) as resp: 2213 | picture = await resp.read() 2214 | base64_encoded_picture = base64.b64encode(picture).decode( 2215 | "utf-8" 2216 | ) 2217 | guessed_mime_type = mimetypes.guess_type(picture_url)[0] 2218 | if guessed_mime_type is None: 2219 | # assume JPG, browsers are tolerant enough of image formats 2220 | guessed_mime_type = "image/jpeg" 2221 | picture_url = f"data:{guessed_mime_type};base64,{base64_encoded_picture}" 2222 | except Exception as e: 2223 | log.error(f"Error downloading profile image '{picture_url}': {e}") 2224 | picture_url = "" 2225 | if not picture_url: 2226 | picture_url = "/user.png" 2227 | username_claim = webui_app.state.config.OAUTH_USERNAME_CLAIM 2228 | role = ( 2229 | "admin" 2230 | if Users.get_num_users() == 0 2231 | else webui_app.state.config.DEFAULT_USER_ROLE 2232 | ) 2233 | user = Auths.insert_new_auth( 2234 | email=email, 2235 | password=get_password_hash( 2236 | str(uuid.uuid4()) 2237 | ), # Random password, not used 2238 | name=user_data.get(username_claim, "User"), 2239 | profile_image_url=picture_url, 2240 | role=role, 2241 | oauth_sub=provider_sub, 2242 | ) 2243 | 2244 | if webui_app.state.config.WEBHOOK_URL: 2245 | post_webhook( 2246 | webui_app.state.config.WEBHOOK_URL, 2247 | WEBHOOK_MESSAGES.USER_SIGNUP(user.name), 2248 | { 2249 | "action": "signup", 2250 | "message": WEBHOOK_MESSAGES.USER_SIGNUP(user.name), 2251 | "user": user.model_dump_json(exclude_none=True), 2252 | }, 2253 | ) 2254 | else: 2255 | raise HTTPException( 2256 | status.HTTP_403_FORBIDDEN, detail=ERROR_MESSAGES.ACCESS_PROHIBITED 2257 | ) 2258 | 2259 | jwt_token = create_token( 2260 | data={"id": user.id}, 2261 | expires_delta=parse_duration(webui_app.state.config.JWT_EXPIRES_IN), 2262 | ) 2263 | 2264 | # Set the cookie token 2265 | response.set_cookie( 2266 | key="token", 2267 | value=jwt_token, 2268 | httponly=True, # Ensures the cookie is not accessible via JavaScript 2269 | ) 2270 | 2271 | # Redirect back to the frontend with the JWT token 2272 | redirect_url = f"{request.base_url}auth#token={jwt_token}" 2273 | return RedirectResponse(url=redirect_url) 2274 | 2275 | 2276 | @app.get("/manifest.json") 2277 | async def get_manifest_json(): 2278 | return { 2279 | "name": WEBUI_NAME, 2280 | "short_name": WEBUI_NAME, 2281 | "start_url": "/", 2282 | "display": "standalone", 2283 | "background_color": "#343541", 2284 | "orientation": "portrait-primary", 2285 | "icons": [{"src": "/static/logo.png", "type": "image/png", "sizes": "500x500"}], 2286 | "display_override": ["standalone", "minimal-ui"], 2287 | "icons": [ 2288 | {"src": "pwa-64x64.png", "sizes": "64x64", "type": "image/png"}, 2289 | {"src": "pwa-192x192.png", "sizes": "192x192", "type": "image/png"}, 2290 | {"src": "pwa-512x512.png", "sizes": "512x512", "type": "image/png"}, 2291 | { 2292 | "src": "maskable-icon-512x512.png", 2293 | "sizes": "512x512", 2294 | "type": "image/png", 2295 | "purpose": "maskable", 2296 | }, 2297 | ], 2298 | } 2299 | 2300 | 2301 | @app.get("/opensearch.xml") 2302 | async def get_opensearch_xml(): 2303 | xml_content = rf""" 2304 | 2305 | {WEBUI_NAME} 2306 | Search {WEBUI_NAME} 2307 | UTF-8 2308 | {WEBUI_URL}/static/favicon.png 2309 | 2310 | {WEBUI_URL} 2311 | 2312 | """ 2313 | return Response(content=xml_content, media_type="application/xml") 2314 | 2315 | 2316 | @app.get("/health") 2317 | async def healthcheck(): 2318 | return {"status": True} 2319 | 2320 | 2321 | @app.get("/health/db") 2322 | async def healthcheck_with_db(): 2323 | Session.execute(text("SELECT 1;")).all() 2324 | return {"status": True} 2325 | 2326 | 2327 | app.mount("/static", StaticFiles(directory=STATIC_DIR), name="static") 2328 | app.mount("/cache", StaticFiles(directory=CACHE_DIR), name="cache") 2329 | 2330 | if os.path.exists(FRONTEND_BUILD_DIR): 2331 | mimetypes.add_type("text/javascript", ".js") 2332 | app.mount( 2333 | "/", 2334 | SPAStaticFiles(directory=FRONTEND_BUILD_DIR, html=True), 2335 | name="spa-static-files", 2336 | ) 2337 | else: 2338 | log.warning( 2339 | f"Frontend build directory not found at '{FRONTEND_BUILD_DIR}'. Serving API only." 2340 | ) ``````` `\\?\D:\Coding\ai\backend\migrations\env.py`: ```````py 1 | import os 2 | from logging.config import fileConfig 3 | 4 | from sqlalchemy import engine_from_config 5 | from sqlalchemy import pool 6 | 7 | from alembic import context 8 | 9 | from apps.webui.models.auths import Auth 10 | from apps.webui.models.chats import Chat 11 | from apps.webui.models.documents import Document 12 | from apps.webui.models.memories import Memory 13 | from apps.webui.models.models import Model 14 | from apps.webui.models.prompts import Prompt 15 | from apps.webui.models.tags import Tag, ChatIdTag 16 | from apps.webui.models.tools import Tool 17 | from apps.webui.models.users import User 18 | from apps.webui.models.files import File 19 | from apps.webui.models.functions import Function 20 | 21 | from config import DATABASE_URL 22 | 23 | # this is the Alembic Config object, which provides 24 | # access to the values within the .ini file in use. 25 | config = context.config 26 | 27 | # Interpret the config file for Python logging. 28 | # This line sets up loggers basically. 29 | if config.config_file_name is not None: 30 | fileConfig(config.config_file_name, disable_existing_loggers=False) 31 | 32 | # add your model's MetaData object here 33 | # for 'autogenerate' support 34 | # from myapp import mymodel 35 | # target_metadata = mymodel.Base.metadata 36 | target_metadata = Auth.metadata 37 | 38 | # other values from the config, defined by the needs of env.py, 39 | # can be acquired: 40 | # my_important_option = config.get_main_option("my_important_option") 41 | # ... etc. 42 | 43 | DB_URL = DATABASE_URL 44 | 45 | if DB_URL: 46 | config.set_main_option("sqlalchemy.url", DB_URL.replace("%", "%%")) 47 | 48 | 49 | def run_migrations_offline() -> None: 50 | """Run migrations in 'offline' mode. 51 | 52 | This configures the context with just a URL 53 | and not an Engine, though an Engine is acceptable 54 | here as well. By skipping the Engine creation 55 | we don't even need a DBAPI to be available. 56 | 57 | Calls to context.execute() here emit the given string to the 58 | script output. 59 | 60 | """ 61 | url = config.get_main_option("sqlalchemy.url") 62 | context.configure( 63 | url=url, 64 | target_metadata=target_metadata, 65 | literal_binds=True, 66 | dialect_opts={"paramstyle": "named"}, 67 | ) 68 | 69 | with context.begin_transaction(): 70 | context.run_migrations() 71 | 72 | 73 | def run_migrations_online() -> None: 74 | """Run migrations in 'online' mode. 75 | 76 | In this scenario we need to create an Engine 77 | and associate a connection with the context. 78 | 79 | """ 80 | connectable = engine_from_config( 81 | config.get_section(config.config_ini_section, {}), 82 | prefix="sqlalchemy.", 83 | poolclass=pool.NullPool, 84 | ) 85 | 86 | with connectable.connect() as connection: 87 | context.configure(connection=connection, target_metadata=target_metadata) 88 | 89 | with context.begin_transaction(): 90 | context.run_migrations() 91 | 92 | 93 | if context.is_offline_mode(): 94 | run_migrations_offline() 95 | else: 96 | run_migrations_online() ``````` `\\?\D:\Coding\ai\backend\migrations\README`: ``````` 1 | Generic single-database configuration. 2 | 3 | Create new migrations with 4 | DATABASE_URL= alembic revision --autogenerate -m "a description" ``````` `\\?\D:\Coding\ai\backend\migrations\script.py.mako`: ```````mako 1 | """${message} 2 | 3 | Revision ID: ${up_revision} 4 | Revises: ${down_revision | comma,n} 5 | Create Date: ${create_date} 6 | 7 | """ 8 | from typing import Sequence, Union 9 | 10 | from alembic import op 11 | import sqlalchemy as sa 12 | import apps.webui.internal.db 13 | ${imports if imports else ""} 14 | 15 | # revision identifiers, used by Alembic. 16 | revision: str = ${repr(up_revision)} 17 | down_revision: Union[str, None] = ${repr(down_revision)} 18 | branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)} 19 | depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)} 20 | 21 | 22 | def upgrade() -> None: 23 | ${upgrades if upgrades else "pass"} 24 | 25 | 26 | def downgrade() -> None: 27 | ${downgrades if downgrades else "pass"} ``````` `\\?\D:\Coding\ai\backend\migrations\util.py`: ```````py 1 | from alembic import op 2 | from sqlalchemy import Inspector 3 | 4 | 5 | def get_existing_tables(): 6 | con = op.get_bind() 7 | inspector = Inspector.from_engine(con) 8 | tables = set(inspector.get_table_names()) 9 | return tables ``````` `\\?\D:\Coding\ai\backend\migrations\versions\7e5b5dc7342b_init.py`: ```````py 1 | """init 2 | 3 | Revision ID: 7e5b5dc7342b 4 | Revises: 5 | Create Date: 2024-06-24 13:15:33.808998 6 | 7 | """ 8 | 9 | from typing import Sequence, Union 10 | 11 | from alembic import op 12 | import sqlalchemy as sa 13 | import apps.webui.internal.db 14 | from migrations.util import get_existing_tables 15 | 16 | # revision identifiers, used by Alembic. 17 | revision: str = "7e5b5dc7342b" 18 | down_revision: Union[str, None] = None 19 | branch_labels: Union[str, Sequence[str], None] = None 20 | depends_on: Union[str, Sequence[str], None] = None 21 | 22 | 23 | def upgrade() -> None: 24 | existing_tables = set(get_existing_tables()) 25 | 26 | # ### commands auto generated by Alembic - please adjust! ### 27 | if "auth" not in existing_tables: 28 | op.create_table( 29 | "auth", 30 | sa.Column("id", sa.String(), nullable=False), 31 | sa.Column("email", sa.String(), nullable=True), 32 | sa.Column("password", sa.Text(), nullable=True), 33 | sa.Column("active", sa.Boolean(), nullable=True), 34 | sa.PrimaryKeyConstraint("id"), 35 | ) 36 | 37 | if "chat" not in existing_tables: 38 | op.create_table( 39 | "chat", 40 | sa.Column("id", sa.String(), nullable=False), 41 | sa.Column("user_id", sa.String(), nullable=True), 42 | sa.Column("title", sa.Text(), nullable=True), 43 | sa.Column("chat", sa.Text(), nullable=True), 44 | sa.Column("created_at", sa.BigInteger(), nullable=True), 45 | sa.Column("updated_at", sa.BigInteger(), nullable=True), 46 | sa.Column("share_id", sa.Text(), nullable=True), 47 | sa.Column("archived", sa.Boolean(), nullable=True), 48 | sa.PrimaryKeyConstraint("id"), 49 | sa.UniqueConstraint("share_id"), 50 | ) 51 | 52 | if "chatidtag" not in existing_tables: 53 | op.create_table( 54 | "chatidtag", 55 | sa.Column("id", sa.String(), nullable=False), 56 | sa.Column("tag_name", sa.String(), nullable=True), 57 | sa.Column("chat_id", sa.String(), nullable=True), 58 | sa.Column("user_id", sa.String(), nullable=True), 59 | sa.Column("timestamp", sa.BigInteger(), nullable=True), 60 | sa.PrimaryKeyConstraint("id"), 61 | ) 62 | 63 | if "document" not in existing_tables: 64 | op.create_table( 65 | "document", 66 | sa.Column("collection_name", sa.String(), nullable=False), 67 | sa.Column("name", sa.String(), nullable=True), 68 | sa.Column("title", sa.Text(), nullable=True), 69 | sa.Column("filename", sa.Text(), nullable=True), 70 | sa.Column("content", sa.Text(), nullable=True), 71 | sa.Column("user_id", sa.String(), nullable=True), 72 | sa.Column("timestamp", sa.BigInteger(), nullable=True), 73 | sa.PrimaryKeyConstraint("collection_name"), 74 | sa.UniqueConstraint("name"), 75 | ) 76 | 77 | if "file" not in existing_tables: 78 | op.create_table( 79 | "file", 80 | sa.Column("id", sa.String(), nullable=False), 81 | sa.Column("user_id", sa.String(), nullable=True), 82 | sa.Column("filename", sa.Text(), nullable=True), 83 | sa.Column("meta", apps.webui.internal.db.JSONField(), nullable=True), 84 | sa.Column("created_at", sa.BigInteger(), nullable=True), 85 | sa.PrimaryKeyConstraint("id"), 86 | ) 87 | 88 | if "function" not in existing_tables: 89 | op.create_table( 90 | "function", 91 | sa.Column("id", sa.String(), nullable=False), 92 | sa.Column("user_id", sa.String(), nullable=True), 93 | sa.Column("name", sa.Text(), nullable=True), 94 | sa.Column("type", sa.Text(), nullable=True), 95 | sa.Column("content", sa.Text(), nullable=True), 96 | sa.Column("meta", apps.webui.internal.db.JSONField(), nullable=True), 97 | sa.Column("valves", apps.webui.internal.db.JSONField(), nullable=True), 98 | sa.Column("is_active", sa.Boolean(), nullable=True), 99 | sa.Column("is_global", sa.Boolean(), nullable=True), 100 | sa.Column("updated_at", sa.BigInteger(), nullable=True), 101 | sa.Column("created_at", sa.BigInteger(), nullable=True), 102 | sa.PrimaryKeyConstraint("id"), 103 | ) 104 | 105 | if "memory" not in existing_tables: 106 | op.create_table( 107 | "memory", 108 | sa.Column("id", sa.String(), nullable=False), 109 | sa.Column("user_id", sa.String(), nullable=True), 110 | sa.Column("content", sa.Text(), nullable=True), 111 | sa.Column("updated_at", sa.BigInteger(), nullable=True), 112 | sa.Column("created_at", sa.BigInteger(), nullable=True), 113 | sa.PrimaryKeyConstraint("id"), 114 | ) 115 | 116 | if "model" not in existing_tables: 117 | op.create_table( 118 | "model", 119 | sa.Column("id", sa.Text(), nullable=False), 120 | sa.Column("user_id", sa.Text(), nullable=True), 121 | sa.Column("base_model_id", sa.Text(), nullable=True), 122 | sa.Column("name", sa.Text(), nullable=True), 123 | sa.Column("params", apps.webui.internal.db.JSONField(), nullable=True), 124 | sa.Column("meta", apps.webui.internal.db.JSONField(), nullable=True), 125 | sa.Column("updated_at", sa.BigInteger(), nullable=True), 126 | sa.Column("created_at", sa.BigInteger(), nullable=True), 127 | sa.PrimaryKeyConstraint("id"), 128 | ) 129 | 130 | if "prompt" not in existing_tables: 131 | op.create_table( 132 | "prompt", 133 | sa.Column("command", sa.String(), nullable=False), 134 | sa.Column("user_id", sa.String(), nullable=True), 135 | sa.Column("title", sa.Text(), nullable=True), 136 | sa.Column("content", sa.Text(), nullable=True), 137 | sa.Column("timestamp", sa.BigInteger(), nullable=True), 138 | sa.PrimaryKeyConstraint("command"), 139 | ) 140 | 141 | if "tag" not in existing_tables: 142 | op.create_table( 143 | "tag", 144 | sa.Column("id", sa.String(), nullable=False), 145 | sa.Column("name", sa.String(), nullable=True), 146 | sa.Column("user_id", sa.String(), nullable=True), 147 | sa.Column("data", sa.Text(), nullable=True), 148 | sa.PrimaryKeyConstraint("id"), 149 | ) 150 | 151 | if "tool" not in existing_tables: 152 | op.create_table( 153 | "tool", 154 | sa.Column("id", sa.String(), nullable=False), 155 | sa.Column("user_id", sa.String(), nullable=True), 156 | sa.Column("name", sa.Text(), nullable=True), 157 | sa.Column("content", sa.Text(), nullable=True), 158 | sa.Column("specs", apps.webui.internal.db.JSONField(), nullable=True), 159 | sa.Column("meta", apps.webui.internal.db.JSONField(), nullable=True), 160 | sa.Column("valves", apps.webui.internal.db.JSONField(), nullable=True), 161 | sa.Column("updated_at", sa.BigInteger(), nullable=True), 162 | sa.Column("created_at", sa.BigInteger(), nullable=True), 163 | sa.PrimaryKeyConstraint("id"), 164 | ) 165 | 166 | if "user" not in existing_tables: 167 | op.create_table( 168 | "user", 169 | sa.Column("id", sa.String(), nullable=False), 170 | sa.Column("name", sa.String(), nullable=True), 171 | sa.Column("email", sa.String(), nullable=True), 172 | sa.Column("role", sa.String(), nullable=True), 173 | sa.Column("profile_image_url", sa.Text(), nullable=True), 174 | sa.Column("last_active_at", sa.BigInteger(), nullable=True), 175 | sa.Column("updated_at", sa.BigInteger(), nullable=True), 176 | sa.Column("created_at", sa.BigInteger(), nullable=True), 177 | sa.Column("api_key", sa.String(), nullable=True), 178 | sa.Column("settings", apps.webui.internal.db.JSONField(), nullable=True), 179 | sa.Column("info", apps.webui.internal.db.JSONField(), nullable=True), 180 | sa.Column("oauth_sub", sa.Text(), nullable=True), 181 | sa.PrimaryKeyConstraint("id"), 182 | sa.UniqueConstraint("api_key"), 183 | sa.UniqueConstraint("oauth_sub"), 184 | ) 185 | # ### end Alembic commands ### 186 | 187 | 188 | def downgrade() -> None: 189 | # ### commands auto generated by Alembic - please adjust! ### 190 | op.drop_table("user") 191 | op.drop_table("tool") 192 | op.drop_table("tag") 193 | op.drop_table("prompt") 194 | op.drop_table("model") 195 | op.drop_table("memory") 196 | op.drop_table("function") 197 | op.drop_table("file") 198 | op.drop_table("document") 199 | op.drop_table("chatidtag") 200 | op.drop_table("chat") 201 | op.drop_table("auth") 202 | # ### end Alembic commands ### ``````` `\\?\D:\Coding\ai\backend\open_webui\__init__.py`: ```````py 1 | import base64 2 | import os 3 | import random 4 | from pathlib import Path 5 | 6 | import typer 7 | import uvicorn 8 | 9 | app = typer.Typer() 10 | 11 | KEY_FILE = Path.cwd() / ".webui_secret_key" 12 | if (frontend_build_dir := Path(__file__).parent / "frontend").exists(): 13 | os.environ["FRONTEND_BUILD_DIR"] = str(frontend_build_dir) 14 | 15 | 16 | @app.command() 17 | def serve( 18 | host: str = "0.0.0.0", 19 | port: int = 8080, 20 | ): 21 | if os.getenv("WEBUI_SECRET_KEY") is None: 22 | typer.echo( 23 | "Loading WEBUI_SECRET_KEY from file, not provided as an environment variable." 24 | ) 25 | if not KEY_FILE.exists(): 26 | typer.echo(f"Generating a new secret key and saving it to {KEY_FILE}") 27 | KEY_FILE.write_bytes(base64.b64encode(random.randbytes(12))) 28 | typer.echo(f"Loading WEBUI_SECRET_KEY from {KEY_FILE}") 29 | os.environ["WEBUI_SECRET_KEY"] = KEY_FILE.read_text() 30 | 31 | if os.getenv("USE_CUDA_DOCKER", "false") == "true": 32 | typer.echo( 33 | "CUDA is enabled, appending LD_LIBRARY_PATH to include torch/cudnn & cublas libraries." 34 | ) 35 | LD_LIBRARY_PATH = os.getenv("LD_LIBRARY_PATH", "").split(":") 36 | os.environ["LD_LIBRARY_PATH"] = ":".join( 37 | LD_LIBRARY_PATH 38 | + [ 39 | "/usr/local/lib/python3.11/site-packages/torch/lib", 40 | "/usr/local/lib/python3.11/site-packages/nvidia/cudnn/lib", 41 | ] 42 | ) 43 | import main # we need set environment variables before importing main 44 | 45 | uvicorn.run(main.app, host=host, port=port, forwarded_allow_ips="*") 46 | 47 | 48 | @app.command() 49 | def dev( 50 | host: str = "0.0.0.0", 51 | port: int = 8080, 52 | reload: bool = True, 53 | ): 54 | uvicorn.run( 55 | "main:app", host=host, port=port, reload=reload, forwarded_allow_ips="*" 56 | ) 57 | 58 | 59 | if __name__ == "__main__": 60 | app() ``````` `\\?\D:\Coding\ai\backend\requirements.txt`: ```````txt 1 | fastapi==0.111.0 2 | uvicorn[standard]==0.22.0 3 | pydantic==2.8.2 4 | python-multipart==0.0.9 5 | 6 | Flask==3.0.3 7 | Flask-Cors==4.0.1 8 | 9 | python-socketio==5.11.3 10 | python-jose==3.3.0 11 | passlib[bcrypt]==1.7.4 12 | 13 | requests==2.32.3 14 | aiohttp==3.9.5 15 | sqlalchemy==2.0.31 16 | alembic==1.13.2 17 | peewee==3.17.6 18 | peewee-migrate==1.12.2 19 | psycopg2-binary==2.9.9 20 | PyMySQL==1.1.1 21 | bcrypt==4.1.3 22 | SQLAlchemy 23 | pymongo 24 | redis 25 | boto3==1.34.110 26 | 27 | argon2-cffi==23.1.0 28 | APScheduler==3.10.4 29 | 30 | # AI libraries 31 | openai 32 | anthropic 33 | google-generativeai==0.5.4 34 | tiktoken 35 | 36 | langchain==0.2.6 37 | langchain-community==0.2.6 38 | langchain-chroma==0.1.2 39 | 40 | fake-useragent==1.5.1 41 | chromadb==0.5.4 42 | sentence-transformers==3.0.1 43 | pypdf==4.2.0 44 | docx2txt==0.8 45 | python-pptx==0.6.23 46 | unstructured==0.14.10 47 | Markdown==3.6 48 | pypandoc==1.13 49 | pandas==2.2.2 50 | openpyxl==3.1.5 51 | pyxlsb==1.0.10 52 | xlrd==2.0.1 53 | validators==0.28.1 54 | psutil 55 | 56 | opencv-python-headless==4.10.0.84 57 | rapidocr-onnxruntime==1.3.22 58 | 59 | fpdf2==2.7.9 60 | rank-bm25==0.2.2 61 | 62 | faster-whisper==1.0.2 63 | 64 | PyJWT[crypto]==2.8.0 65 | authlib==1.3.1 66 | 67 | black==24.4.2 68 | langfuse==2.38.0 69 | youtube-transcript-api==0.6.2 70 | pytube==15.0.0 71 | 72 | extract_msg 73 | pydub 74 | duckduckgo-search~=6.1.12 75 | 76 | ## Tests 77 | docker~=7.1.0 78 | pytest~=8.2.2 79 | pytest-docker~=3.1.1 ``````` `\\?\D:\Coding\ai\backend\start.sh`: ```````sh 1 | #!/usr/bin/env bash 2 | 3 | SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 4 | cd "$SCRIPT_DIR" || exit 5 | 6 | KEY_FILE=.webui_secret_key 7 | 8 | PORT="${PORT:-8080}" 9 | HOST="${HOST:-0.0.0.0}" 10 | if test "$WEBUI_SECRET_KEY $WEBUI_JWT_SECRET_KEY" = " "; then 11 | echo "Loading WEBUI_SECRET_KEY from file, not provided as an environment variable." 12 | 13 | if ! [ -e "$KEY_FILE" ]; then 14 | echo "Generating WEBUI_SECRET_KEY" 15 | # Generate a random value to use as a WEBUI_SECRET_KEY in case the user didn't provide one. 16 | echo $(head -c 12 /dev/random | base64) > "$KEY_FILE" 17 | fi 18 | 19 | echo "Loading WEBUI_SECRET_KEY from $KEY_FILE" 20 | WEBUI_SECRET_KEY=$(cat "$KEY_FILE") 21 | fi 22 | 23 | if [[ "${USE_OLLAMA_DOCKER,,}" == "true" ]]; then 24 | echo "USE_OLLAMA is set to true, starting ollama serve." 25 | ollama serve & 26 | fi 27 | 28 | if [[ "${USE_CUDA_DOCKER,,}" == "true" ]]; then 29 | echo "CUDA is enabled, appending LD_LIBRARY_PATH to include torch/cudnn & cublas libraries." 30 | export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib/python3.11/site-packages/torch/lib:/usr/local/lib/python3.11/site-packages/nvidia/cudnn/lib" 31 | fi 32 | 33 | 34 | # Check if SPACE_ID is set, if so, configure for space 35 | if [ -n "$SPACE_ID" ]; then 36 | echo "Configuring for HuggingFace Space deployment" 37 | if [ -n "$ADMIN_USER_EMAIL" ] && [ -n "$ADMIN_USER_PASSWORD" ]; then 38 | echo "Admin user configured, creating" 39 | WEBUI_SECRET_KEY="$WEBUI_SECRET_KEY" uvicorn main:app --host "$HOST" --port "$PORT" --forwarded-allow-ips '*' & 40 | webui_pid=$! 41 | echo "Waiting for webui to start..." 42 | while ! curl -s http://localhost:8080/health > /dev/null; do 43 | sleep 1 44 | done 45 | echo "Creating admin user..." 46 | curl \ 47 | -X POST "http://localhost:8080/api/v1/auths/signup" \ 48 | -H "accept: application/json" \ 49 | -H "Content-Type: application/json" \ 50 | -d "{ \"email\": \"${ADMIN_USER_EMAIL}\", \"password\": \"${ADMIN_USER_PASSWORD}\", \"name\": \"Admin\" }" 51 | echo "Shutting down webui..." 52 | kill $webui_pid 53 | fi 54 | 55 | export WEBUI_URL=${SPACE_HOST} 56 | fi 57 | 58 | WEBUI_SECRET_KEY="$WEBUI_SECRET_KEY" exec uvicorn main:app --host "$HOST" --port "$PORT" --forwarded-allow-ips '*' ``````` `\\?\D:\Coding\ai\backend\start_windows.bat`: ```````bat 1 | :: This method is not recommended, and we recommend you use the `start.sh` file with WSL instead. 2 | @echo off 3 | SETLOCAL ENABLEDELAYEDEXPANSION 4 | 5 | :: Get the directory of the current script 6 | SET "SCRIPT_DIR=%~dp0" 7 | cd /d "%SCRIPT_DIR%" || exit /b 8 | 9 | SET "KEY_FILE=.webui_secret_key" 10 | IF "%PORT%"=="" SET PORT=8080 11 | IF "%HOST%"=="" SET HOST=0.0.0.0 12 | SET "WEBUI_SECRET_KEY=%WEBUI_SECRET_KEY%" 13 | SET "WEBUI_JWT_SECRET_KEY=%WEBUI_JWT_SECRET_KEY%" 14 | 15 | :: Check if WEBUI_SECRET_KEY and WEBUI_JWT_SECRET_KEY are not set 16 | IF "%WEBUI_SECRET_KEY%%WEBUI_JWT_SECRET_KEY%" == " " ( 17 | echo Loading WEBUI_SECRET_KEY from file, not provided as an environment variable. 18 | 19 | IF NOT EXIST "%KEY_FILE%" ( 20 | echo Generating WEBUI_SECRET_KEY 21 | :: Generate a random value to use as a WEBUI_SECRET_KEY in case the user didn't provide one 22 | SET /p WEBUI_SECRET_KEY=>%KEY_FILE% 24 | echo WEBUI_SECRET_KEY generated 25 | ) 26 | 27 | echo Loading WEBUI_SECRET_KEY from %KEY_FILE% 28 | SET /p WEBUI_SECRET_KEY=<%KEY_FILE% 29 | ) 30 | 31 | :: Execute uvicorn 32 | SET "WEBUI_SECRET_KEY=%WEBUI_SECRET_KEY%" 33 | uvicorn main:app --host "%HOST%" --port "%PORT%" --forwarded-allow-ips '*' ``````` `\\?\D:\Coding\ai\backend\static\user-import.csv`: ```````csv 1 | Name,Email,Password,Role ``````` `\\?\D:\Coding\ai\backend\test\apps\webui\routers\test_auths.py`: ```````py 1 | import pytest 2 | 3 | from test.util.abstract_integration_test import AbstractPostgresTest 4 | from test.util.mock_user import mock_webui_user 5 | 6 | 7 | class TestAuths(AbstractPostgresTest): 8 | BASE_PATH = "/api/v1/auths" 9 | 10 | def setup_class(cls): 11 | super().setup_class() 12 | from apps.webui.models.users import Users 13 | from apps.webui.models.auths import Auths 14 | 15 | cls.users = Users 16 | cls.auths = Auths 17 | 18 | def test_get_session_user(self): 19 | with mock_webui_user(): 20 | response = self.fast_api_client.get(self.create_url("")) 21 | assert response.status_code == 200 22 | assert response.json() == { 23 | "id": "1", 24 | "name": "John Doe", 25 | "email": "john.doe@openwebui.com", 26 | "role": "user", 27 | "profile_image_url": "/user.png", 28 | } 29 | 30 | def test_update_profile(self): 31 | from utils.utils import get_password_hash 32 | 33 | user = self.auths.insert_new_auth( 34 | email="john.doe@openwebui.com", 35 | password=get_password_hash("old_password"), 36 | name="John Doe", 37 | profile_image_url="/user.png", 38 | role="user", 39 | ) 40 | 41 | with mock_webui_user(id=user.id): 42 | response = self.fast_api_client.post( 43 | self.create_url("/update/profile"), 44 | json={"name": "John Doe 2", "profile_image_url": "/user2.png"}, 45 | ) 46 | assert response.status_code == 200 47 | db_user = self.users.get_user_by_id(user.id) 48 | assert db_user.name == "John Doe 2" 49 | assert db_user.profile_image_url == "/user2.png" 50 | 51 | def test_update_password(self): 52 | from utils.utils import get_password_hash 53 | 54 | user = self.auths.insert_new_auth( 55 | email="john.doe@openwebui.com", 56 | password=get_password_hash("old_password"), 57 | name="John Doe", 58 | profile_image_url="/user.png", 59 | role="user", 60 | ) 61 | 62 | with mock_webui_user(id=user.id): 63 | response = self.fast_api_client.post( 64 | self.create_url("/update/password"), 65 | json={"password": "old_password", "new_password": "new_password"}, 66 | ) 67 | assert response.status_code == 200 68 | 69 | old_auth = self.auths.authenticate_user( 70 | "john.doe@openwebui.com", "old_password" 71 | ) 72 | assert old_auth is None 73 | new_auth = self.auths.authenticate_user( 74 | "john.doe@openwebui.com", "new_password" 75 | ) 76 | assert new_auth is not None 77 | 78 | def test_signin(self): 79 | from utils.utils import get_password_hash 80 | 81 | user = self.auths.insert_new_auth( 82 | email="john.doe@openwebui.com", 83 | password=get_password_hash("password"), 84 | name="John Doe", 85 | profile_image_url="/user.png", 86 | role="user", 87 | ) 88 | response = self.fast_api_client.post( 89 | self.create_url("/signin"), 90 | json={"email": "john.doe@openwebui.com", "password": "password"}, 91 | ) 92 | assert response.status_code == 200 93 | data = response.json() 94 | assert data["id"] == user.id 95 | assert data["name"] == "John Doe" 96 | assert data["email"] == "john.doe@openwebui.com" 97 | assert data["role"] == "user" 98 | assert data["profile_image_url"] == "/user.png" 99 | assert data["token"] is not None and len(data["token"]) > 0 100 | assert data["token_type"] == "Bearer" 101 | 102 | def test_signup(self): 103 | response = self.fast_api_client.post( 104 | self.create_url("/signup"), 105 | json={ 106 | "name": "John Doe", 107 | "email": "john.doe@openwebui.com", 108 | "password": "password", 109 | }, 110 | ) 111 | assert response.status_code == 200 112 | data = response.json() 113 | assert data["id"] is not None and len(data["id"]) > 0 114 | assert data["name"] == "John Doe" 115 | assert data["email"] == "john.doe@openwebui.com" 116 | assert data["role"] in ["admin", "user", "pending"] 117 | assert data["profile_image_url"] == "/user.png" 118 | assert data["token"] is not None and len(data["token"]) > 0 119 | assert data["token_type"] == "Bearer" 120 | 121 | def test_add_user(self): 122 | with mock_webui_user(): 123 | response = self.fast_api_client.post( 124 | self.create_url("/add"), 125 | json={ 126 | "name": "John Doe 2", 127 | "email": "john.doe2@openwebui.com", 128 | "password": "password2", 129 | "role": "admin", 130 | }, 131 | ) 132 | assert response.status_code == 200 133 | data = response.json() 134 | assert data["id"] is not None and len(data["id"]) > 0 135 | assert data["name"] == "John Doe 2" 136 | assert data["email"] == "john.doe2@openwebui.com" 137 | assert data["role"] == "admin" 138 | assert data["profile_image_url"] == "/user.png" 139 | assert data["token"] is not None and len(data["token"]) > 0 140 | assert data["token_type"] == "Bearer" 141 | 142 | def test_get_admin_details(self): 143 | self.auths.insert_new_auth( 144 | email="john.doe@openwebui.com", 145 | password="password", 146 | name="John Doe", 147 | profile_image_url="/user.png", 148 | role="admin", 149 | ) 150 | with mock_webui_user(): 151 | response = self.fast_api_client.get(self.create_url("/admin/details")) 152 | 153 | assert response.status_code == 200 154 | assert response.json() == { 155 | "name": "John Doe", 156 | "email": "john.doe@openwebui.com", 157 | } 158 | 159 | def test_create_api_key_(self): 160 | user = self.auths.insert_new_auth( 161 | email="john.doe@openwebui.com", 162 | password="password", 163 | name="John Doe", 164 | profile_image_url="/user.png", 165 | role="admin", 166 | ) 167 | with mock_webui_user(id=user.id): 168 | response = self.fast_api_client.post(self.create_url("/api_key")) 169 | assert response.status_code == 200 170 | data = response.json() 171 | assert data["api_key"] is not None 172 | assert len(data["api_key"]) > 0 173 | 174 | def test_delete_api_key(self): 175 | user = self.auths.insert_new_auth( 176 | email="john.doe@openwebui.com", 177 | password="password", 178 | name="John Doe", 179 | profile_image_url="/user.png", 180 | role="admin", 181 | ) 182 | self.users.update_user_api_key_by_id(user.id, "abc") 183 | with mock_webui_user(id=user.id): 184 | response = self.fast_api_client.delete(self.create_url("/api_key")) 185 | assert response.status_code == 200 186 | assert response.json() == True 187 | db_user = self.users.get_user_by_id(user.id) 188 | assert db_user.api_key is None 189 | 190 | def test_get_api_key(self): 191 | user = self.auths.insert_new_auth( 192 | email="john.doe@openwebui.com", 193 | password="password", 194 | name="John Doe", 195 | profile_image_url="/user.png", 196 | role="admin", 197 | ) 198 | self.users.update_user_api_key_by_id(user.id, "abc") 199 | with mock_webui_user(id=user.id): 200 | response = self.fast_api_client.get(self.create_url("/api_key")) 201 | assert response.status_code == 200 202 | assert response.json() == {"api_key": "abc"} ``````` `\\?\D:\Coding\ai\backend\test\apps\webui\routers\test_chats.py`: ```````py 1 | import uuid 2 | 3 | from test.util.abstract_integration_test import AbstractPostgresTest 4 | from test.util.mock_user import mock_webui_user 5 | 6 | 7 | class TestChats(AbstractPostgresTest): 8 | 9 | BASE_PATH = "/api/v1/chats" 10 | 11 | def setup_class(cls): 12 | super().setup_class() 13 | 14 | def setup_method(self): 15 | super().setup_method() 16 | from apps.webui.models.chats import ChatForm 17 | from apps.webui.models.chats import Chats 18 | 19 | self.chats = Chats 20 | self.chats.insert_new_chat( 21 | "2", 22 | ChatForm( 23 | **{ 24 | "chat": { 25 | "name": "chat1", 26 | "description": "chat1 description", 27 | "tags": ["tag1", "tag2"], 28 | "history": {"currentId": "1", "messages": []}, 29 | } 30 | } 31 | ), 32 | ) 33 | 34 | def test_get_session_user_chat_list(self): 35 | with mock_webui_user(id="2"): 36 | response = self.fast_api_client.get(self.create_url("/")) 37 | assert response.status_code == 200 38 | first_chat = response.json()[0] 39 | assert first_chat["id"] is not None 40 | assert first_chat["title"] == "New Chat" 41 | assert first_chat["created_at"] is not None 42 | assert first_chat["updated_at"] is not None 43 | 44 | def test_delete_all_user_chats(self): 45 | with mock_webui_user(id="2"): 46 | response = self.fast_api_client.delete(self.create_url("/")) 47 | assert response.status_code == 200 48 | assert len(self.chats.get_chats()) == 0 49 | 50 | def test_get_user_chat_list_by_user_id(self): 51 | with mock_webui_user(id="3"): 52 | response = self.fast_api_client.get(self.create_url("/list/user/2")) 53 | assert response.status_code == 200 54 | first_chat = response.json()[0] 55 | assert first_chat["id"] is not None 56 | assert first_chat["title"] == "New Chat" 57 | assert first_chat["created_at"] is not None 58 | assert first_chat["updated_at"] is not None 59 | 60 | def test_create_new_chat(self): 61 | with mock_webui_user(id="2"): 62 | response = self.fast_api_client.post( 63 | self.create_url("/new"), 64 | json={ 65 | "chat": { 66 | "name": "chat2", 67 | "description": "chat2 description", 68 | "tags": ["tag1", "tag2"], 69 | } 70 | }, 71 | ) 72 | assert response.status_code == 200 73 | data = response.json() 74 | assert data["archived"] is False 75 | assert data["chat"] == { 76 | "name": "chat2", 77 | "description": "chat2 description", 78 | "tags": ["tag1", "tag2"], 79 | } 80 | assert data["user_id"] == "2" 81 | assert data["id"] is not None 82 | assert data["share_id"] is None 83 | assert data["title"] == "New Chat" 84 | assert data["updated_at"] is not None 85 | assert data["created_at"] is not None 86 | assert len(self.chats.get_chats()) == 2 87 | 88 | def test_get_user_chats(self): 89 | self.test_get_session_user_chat_list() 90 | 91 | def test_get_user_archived_chats(self): 92 | self.chats.archive_all_chats_by_user_id("2") 93 | from apps.webui.internal.db import Session 94 | 95 | Session.commit() 96 | with mock_webui_user(id="2"): 97 | response = self.fast_api_client.get(self.create_url("/all/archived")) 98 | assert response.status_code == 200 99 | first_chat = response.json()[0] 100 | assert first_chat["id"] is not None 101 | assert first_chat["title"] == "New Chat" 102 | assert first_chat["created_at"] is not None 103 | assert first_chat["updated_at"] is not None 104 | 105 | def test_get_all_user_chats_in_db(self): 106 | with mock_webui_user(id="4"): 107 | response = self.fast_api_client.get(self.create_url("/all/db")) 108 | assert response.status_code == 200 109 | assert len(response.json()) == 1 110 | 111 | def test_get_archived_session_user_chat_list(self): 112 | self.test_get_user_archived_chats() 113 | 114 | def test_archive_all_chats(self): 115 | with mock_webui_user(id="2"): 116 | response = self.fast_api_client.post(self.create_url("/archive/all")) 117 | assert response.status_code == 200 118 | assert len(self.chats.get_archived_chats_by_user_id("2")) == 1 119 | 120 | def test_get_shared_chat_by_id(self): 121 | chat_id = self.chats.get_chats()[0].id 122 | self.chats.update_chat_share_id_by_id(chat_id, chat_id) 123 | with mock_webui_user(id="2"): 124 | response = self.fast_api_client.get(self.create_url(f"/share/{chat_id}")) 125 | assert response.status_code == 200 126 | data = response.json() 127 | assert data["id"] == chat_id 128 | assert data["chat"] == { 129 | "name": "chat1", 130 | "description": "chat1 description", 131 | "tags": ["tag1", "tag2"], 132 | "history": {"currentId": "1", "messages": []}, 133 | } 134 | assert data["id"] == chat_id 135 | assert data["share_id"] == chat_id 136 | assert data["title"] == "New Chat" 137 | 138 | def test_get_chat_by_id(self): 139 | chat_id = self.chats.get_chats()[0].id 140 | with mock_webui_user(id="2"): 141 | response = self.fast_api_client.get(self.create_url(f"/{chat_id}")) 142 | assert response.status_code == 200 143 | data = response.json() 144 | assert data["id"] == chat_id 145 | assert data["chat"] == { 146 | "name": "chat1", 147 | "description": "chat1 description", 148 | "tags": ["tag1", "tag2"], 149 | "history": {"currentId": "1", "messages": []}, 150 | } 151 | assert data["share_id"] is None 152 | assert data["title"] == "New Chat" 153 | assert data["user_id"] == "2" 154 | 155 | def test_update_chat_by_id(self): 156 | chat_id = self.chats.get_chats()[0].id 157 | with mock_webui_user(id="2"): 158 | response = self.fast_api_client.post( 159 | self.create_url(f"/{chat_id}"), 160 | json={ 161 | "chat": { 162 | "name": "chat2", 163 | "description": "chat2 description", 164 | "tags": ["tag2", "tag4"], 165 | "title": "Just another title", 166 | } 167 | }, 168 | ) 169 | assert response.status_code == 200 170 | data = response.json() 171 | assert data["id"] == chat_id 172 | assert data["chat"] == { 173 | "name": "chat2", 174 | "title": "Just another title", 175 | "description": "chat2 description", 176 | "tags": ["tag2", "tag4"], 177 | "history": {"currentId": "1", "messages": []}, 178 | } 179 | assert data["share_id"] is None 180 | assert data["title"] == "Just another title" 181 | assert data["user_id"] == "2" 182 | 183 | def test_delete_chat_by_id(self): 184 | chat_id = self.chats.get_chats()[0].id 185 | with mock_webui_user(id="2"): 186 | response = self.fast_api_client.delete(self.create_url(f"/{chat_id}")) 187 | assert response.status_code == 200 188 | assert response.json() is True 189 | 190 | def test_clone_chat_by_id(self): 191 | chat_id = self.chats.get_chats()[0].id 192 | with mock_webui_user(id="2"): 193 | response = self.fast_api_client.get(self.create_url(f"/{chat_id}/clone")) 194 | 195 | assert response.status_code == 200 196 | data = response.json() 197 | assert data["id"] != chat_id 198 | assert data["chat"] == { 199 | "branchPointMessageId": "1", 200 | "description": "chat1 description", 201 | "history": {"currentId": "1", "messages": []}, 202 | "name": "chat1", 203 | "originalChatId": chat_id, 204 | "tags": ["tag1", "tag2"], 205 | "title": "Clone of New Chat", 206 | } 207 | assert data["share_id"] is None 208 | assert data["title"] == "Clone of New Chat" 209 | assert data["user_id"] == "2" 210 | 211 | def test_archive_chat_by_id(self): 212 | chat_id = self.chats.get_chats()[0].id 213 | with mock_webui_user(id="2"): 214 | response = self.fast_api_client.get(self.create_url(f"/{chat_id}/archive")) 215 | assert response.status_code == 200 216 | 217 | chat = self.chats.get_chat_by_id(chat_id) 218 | assert chat.archived is True 219 | 220 | def test_share_chat_by_id(self): 221 | chat_id = self.chats.get_chats()[0].id 222 | with mock_webui_user(id="2"): 223 | response = self.fast_api_client.post(self.create_url(f"/{chat_id}/share")) 224 | assert response.status_code == 200 225 | 226 | chat = self.chats.get_chat_by_id(chat_id) 227 | assert chat.share_id is not None 228 | 229 | def test_delete_shared_chat_by_id(self): 230 | chat_id = self.chats.get_chats()[0].id 231 | share_id = str(uuid.uuid4()) 232 | self.chats.update_chat_share_id_by_id(chat_id, share_id) 233 | with mock_webui_user(id="2"): 234 | response = self.fast_api_client.delete(self.create_url(f"/{chat_id}/share")) 235 | assert response.status_code 236 | 237 | chat = self.chats.get_chat_by_id(chat_id) 238 | assert chat.share_id is None ``````` `\\?\D:\Coding\ai\backend\test\apps\webui\routers\test_documents.py`: ```````py 1 | from test.util.abstract_integration_test import AbstractPostgresTest 2 | from test.util.mock_user import mock_webui_user 3 | 4 | 5 | class TestDocuments(AbstractPostgresTest): 6 | 7 | BASE_PATH = "/api/v1/documents" 8 | 9 | def setup_class(cls): 10 | super().setup_class() 11 | from apps.webui.models.documents import Documents 12 | 13 | cls.documents = Documents 14 | 15 | def test_documents(self): 16 | # Empty database 17 | assert len(self.documents.get_docs()) == 0 18 | with mock_webui_user(id="2"): 19 | response = self.fast_api_client.get(self.create_url("/")) 20 | assert response.status_code == 200 21 | assert len(response.json()) == 0 22 | 23 | # Create a new document 24 | with mock_webui_user(id="2"): 25 | response = self.fast_api_client.post( 26 | self.create_url("/create"), 27 | json={ 28 | "name": "doc_name", 29 | "title": "doc title", 30 | "collection_name": "custom collection", 31 | "filename": "doc_name.pdf", 32 | "content": "", 33 | }, 34 | ) 35 | assert response.status_code == 200 36 | assert response.json()["name"] == "doc_name" 37 | assert len(self.documents.get_docs()) == 1 38 | 39 | # Get the document 40 | with mock_webui_user(id="2"): 41 | response = self.fast_api_client.get(self.create_url("/doc?name=doc_name")) 42 | assert response.status_code == 200 43 | data = response.json() 44 | assert data["collection_name"] == "custom collection" 45 | assert data["name"] == "doc_name" 46 | assert data["title"] == "doc title" 47 | assert data["filename"] == "doc_name.pdf" 48 | assert data["content"] == {} 49 | 50 | # Create another document 51 | with mock_webui_user(id="2"): 52 | response = self.fast_api_client.post( 53 | self.create_url("/create"), 54 | json={ 55 | "name": "doc_name 2", 56 | "title": "doc title 2", 57 | "collection_name": "custom collection 2", 58 | "filename": "doc_name2.pdf", 59 | "content": "", 60 | }, 61 | ) 62 | assert response.status_code == 200 63 | assert response.json()["name"] == "doc_name 2" 64 | assert len(self.documents.get_docs()) == 2 65 | 66 | # Get all documents 67 | with mock_webui_user(id="2"): 68 | response = self.fast_api_client.get(self.create_url("/")) 69 | assert response.status_code == 200 70 | assert len(response.json()) == 2 71 | 72 | # Update the first document 73 | with mock_webui_user(id="2"): 74 | response = self.fast_api_client.post( 75 | self.create_url("/doc/update?name=doc_name"), 76 | json={"name": "doc_name rework", "title": "updated title"}, 77 | ) 78 | assert response.status_code == 200 79 | data = response.json() 80 | assert data["name"] == "doc_name rework" 81 | assert data["title"] == "updated title" 82 | 83 | # Tag the first document 84 | with mock_webui_user(id="2"): 85 | response = self.fast_api_client.post( 86 | self.create_url("/doc/tags"), 87 | json={ 88 | "name": "doc_name rework", 89 | "tags": [{"name": "testing-tag"}, {"name": "another-tag"}], 90 | }, 91 | ) 92 | assert response.status_code == 200 93 | data = response.json() 94 | assert data["name"] == "doc_name rework" 95 | assert data["content"] == { 96 | "tags": [{"name": "testing-tag"}, {"name": "another-tag"}] 97 | } 98 | assert len(self.documents.get_docs()) == 2 99 | 100 | # Delete the first document 101 | with mock_webui_user(id="2"): 102 | response = self.fast_api_client.delete( 103 | self.create_url("/doc/delete?name=doc_name rework") 104 | ) 105 | assert response.status_code == 200 106 | assert len(self.documents.get_docs()) == 1 ``````` `\\?\D:\Coding\ai\backend\test\apps\webui\routers\test_models.py`: ```````py 1 | from test.util.abstract_integration_test import AbstractPostgresTest 2 | from test.util.mock_user import mock_webui_user 3 | 4 | 5 | class TestModels(AbstractPostgresTest): 6 | 7 | BASE_PATH = "/api/v1/models" 8 | 9 | def setup_class(cls): 10 | super().setup_class() 11 | from apps.webui.models.models import Model 12 | 13 | cls.models = Model 14 | 15 | def test_models(self): 16 | with mock_webui_user(id="2"): 17 | response = self.fast_api_client.get(self.create_url("/")) 18 | assert response.status_code == 200 19 | assert len(response.json()) == 0 20 | 21 | with mock_webui_user(id="2"): 22 | response = self.fast_api_client.post( 23 | self.create_url("/add"), 24 | json={ 25 | "id": "my-model", 26 | "base_model_id": "base-model-id", 27 | "name": "Hello World", 28 | "meta": { 29 | "profile_image_url": "/static/favicon.png", 30 | "description": "description", 31 | "capabilities": None, 32 | "model_config": {}, 33 | }, 34 | "params": {}, 35 | }, 36 | ) 37 | assert response.status_code == 200 38 | 39 | with mock_webui_user(id="2"): 40 | response = self.fast_api_client.get(self.create_url("/")) 41 | assert response.status_code == 200 42 | assert len(response.json()) == 1 43 | 44 | with mock_webui_user(id="2"): 45 | response = self.fast_api_client.get( 46 | self.create_url(query_params={"id": "my-model"}) 47 | ) 48 | assert response.status_code == 200 49 | data = response.json()[0] 50 | assert data["id"] == "my-model" 51 | assert data["name"] == "Hello World" 52 | 53 | with mock_webui_user(id="2"): 54 | response = self.fast_api_client.delete( 55 | self.create_url("/delete?id=my-model") 56 | ) 57 | assert response.status_code == 200 58 | 59 | with mock_webui_user(id="2"): 60 | response = self.fast_api_client.get(self.create_url("/")) 61 | assert response.status_code == 200 62 | assert len(response.json()) == 0 ``````` `\\?\D:\Coding\ai\backend\test\apps\webui\routers\test_prompts.py`: ```````py 1 | from test.util.abstract_integration_test import AbstractPostgresTest 2 | from test.util.mock_user import mock_webui_user 3 | 4 | 5 | class TestPrompts(AbstractPostgresTest): 6 | 7 | BASE_PATH = "/api/v1/prompts" 8 | 9 | def test_prompts(self): 10 | # Get all prompts 11 | with mock_webui_user(id="2"): 12 | response = self.fast_api_client.get(self.create_url("/")) 13 | assert response.status_code == 200 14 | assert len(response.json()) == 0 15 | 16 | # Create a two new prompts 17 | with mock_webui_user(id="2"): 18 | response = self.fast_api_client.post( 19 | self.create_url("/create"), 20 | json={ 21 | "command": "/my-command", 22 | "title": "Hello World", 23 | "content": "description", 24 | }, 25 | ) 26 | assert response.status_code == 200 27 | with mock_webui_user(id="3"): 28 | response = self.fast_api_client.post( 29 | self.create_url("/create"), 30 | json={ 31 | "command": "/my-command2", 32 | "title": "Hello World 2", 33 | "content": "description 2", 34 | }, 35 | ) 36 | assert response.status_code == 200 37 | 38 | # Get all prompts 39 | with mock_webui_user(id="2"): 40 | response = self.fast_api_client.get(self.create_url("/")) 41 | assert response.status_code == 200 42 | assert len(response.json()) == 2 43 | 44 | # Get prompt by command 45 | with mock_webui_user(id="2"): 46 | response = self.fast_api_client.get(self.create_url("/command/my-command")) 47 | assert response.status_code == 200 48 | data = response.json() 49 | assert data["command"] == "/my-command" 50 | assert data["title"] == "Hello World" 51 | assert data["content"] == "description" 52 | assert data["user_id"] == "2" 53 | 54 | # Update prompt 55 | with mock_webui_user(id="2"): 56 | response = self.fast_api_client.post( 57 | self.create_url("/command/my-command2/update"), 58 | json={ 59 | "command": "irrelevant for request", 60 | "title": "Hello World Updated", 61 | "content": "description Updated", 62 | }, 63 | ) 64 | assert response.status_code == 200 65 | data = response.json() 66 | assert data["command"] == "/my-command2" 67 | assert data["title"] == "Hello World Updated" 68 | assert data["content"] == "description Updated" 69 | assert data["user_id"] == "3" 70 | 71 | # Get prompt by command 72 | with mock_webui_user(id="2"): 73 | response = self.fast_api_client.get(self.create_url("/command/my-command2")) 74 | assert response.status_code == 200 75 | data = response.json() 76 | assert data["command"] == "/my-command2" 77 | assert data["title"] == "Hello World Updated" 78 | assert data["content"] == "description Updated" 79 | assert data["user_id"] == "3" 80 | 81 | # Delete prompt 82 | with mock_webui_user(id="2"): 83 | response = self.fast_api_client.delete( 84 | self.create_url("/command/my-command/delete") 85 | ) 86 | assert response.status_code == 200 87 | 88 | # Get all prompts 89 | with mock_webui_user(id="2"): 90 | response = self.fast_api_client.get(self.create_url("/")) 91 | assert response.status_code == 200 92 | assert len(response.json()) == 1 ``````` `\\?\D:\Coding\ai\backend\test\apps\webui\routers\test_users.py`: ```````py 1 | from test.util.abstract_integration_test import AbstractPostgresTest 2 | from test.util.mock_user import mock_webui_user 3 | 4 | 5 | def _get_user_by_id(data, param): 6 | return next((item for item in data if item["id"] == param), None) 7 | 8 | 9 | def _assert_user(data, id, **kwargs): 10 | user = _get_user_by_id(data, id) 11 | assert user is not None 12 | comparison_data = { 13 | "name": f"user {id}", 14 | "email": f"user{id}@openwebui.com", 15 | "profile_image_url": f"/user{id}.png", 16 | "role": "user", 17 | **kwargs, 18 | } 19 | for key, value in comparison_data.items(): 20 | assert user[key] == value 21 | 22 | 23 | class TestUsers(AbstractPostgresTest): 24 | 25 | BASE_PATH = "/api/v1/users" 26 | 27 | def setup_class(cls): 28 | super().setup_class() 29 | from apps.webui.models.users import Users 30 | 31 | cls.users = Users 32 | 33 | def setup_method(self): 34 | super().setup_method() 35 | self.users.insert_new_user( 36 | id="1", 37 | name="user 1", 38 | email="user1@openwebui.com", 39 | profile_image_url="/user1.png", 40 | role="user", 41 | ) 42 | self.users.insert_new_user( 43 | id="2", 44 | name="user 2", 45 | email="user2@openwebui.com", 46 | profile_image_url="/user2.png", 47 | role="user", 48 | ) 49 | 50 | def test_users(self): 51 | # Get all users 52 | with mock_webui_user(id="3"): 53 | response = self.fast_api_client.get(self.create_url("")) 54 | assert response.status_code == 200 55 | assert len(response.json()) == 2 56 | data = response.json() 57 | _assert_user(data, "1") 58 | _assert_user(data, "2") 59 | 60 | # update role 61 | with mock_webui_user(id="3"): 62 | response = self.fast_api_client.post( 63 | self.create_url("/update/role"), json={"id": "2", "role": "admin"} 64 | ) 65 | assert response.status_code == 200 66 | _assert_user([response.json()], "2", role="admin") 67 | 68 | # Get all users 69 | with mock_webui_user(id="3"): 70 | response = self.fast_api_client.get(self.create_url("")) 71 | assert response.status_code == 200 72 | assert len(response.json()) == 2 73 | data = response.json() 74 | _assert_user(data, "1") 75 | _assert_user(data, "2", role="admin") 76 | 77 | # Get (empty) user settings 78 | with mock_webui_user(id="2"): 79 | response = self.fast_api_client.get(self.create_url("/user/settings")) 80 | assert response.status_code == 200 81 | assert response.json() is None 82 | 83 | # Update user settings 84 | with mock_webui_user(id="2"): 85 | response = self.fast_api_client.post( 86 | self.create_url("/user/settings/update"), 87 | json={ 88 | "ui": {"attr1": "value1", "attr2": "value2"}, 89 | "model_config": {"attr3": "value3", "attr4": "value4"}, 90 | }, 91 | ) 92 | assert response.status_code == 200 93 | 94 | # Get user settings 95 | with mock_webui_user(id="2"): 96 | response = self.fast_api_client.get(self.create_url("/user/settings")) 97 | assert response.status_code == 200 98 | assert response.json() == { 99 | "ui": {"attr1": "value1", "attr2": "value2"}, 100 | "model_config": {"attr3": "value3", "attr4": "value4"}, 101 | } 102 | 103 | # Get (empty) user info 104 | with mock_webui_user(id="1"): 105 | response = self.fast_api_client.get(self.create_url("/user/info")) 106 | assert response.status_code == 200 107 | assert response.json() is None 108 | 109 | # Update user info 110 | with mock_webui_user(id="1"): 111 | response = self.fast_api_client.post( 112 | self.create_url("/user/info/update"), 113 | json={"attr1": "value1", "attr2": "value2"}, 114 | ) 115 | assert response.status_code == 200 116 | 117 | # Get user info 118 | with mock_webui_user(id="1"): 119 | response = self.fast_api_client.get(self.create_url("/user/info")) 120 | assert response.status_code == 200 121 | assert response.json() == {"attr1": "value1", "attr2": "value2"} 122 | 123 | # Get user by id 124 | with mock_webui_user(id="1"): 125 | response = self.fast_api_client.get(self.create_url("/2")) 126 | assert response.status_code == 200 127 | assert response.json() == {"name": "user 2", "profile_image_url": "/user2.png"} 128 | 129 | # Update user by id 130 | with mock_webui_user(id="1"): 131 | response = self.fast_api_client.post( 132 | self.create_url("/2/update"), 133 | json={ 134 | "name": "user 2 updated", 135 | "email": "user2-updated@openwebui.com", 136 | "profile_image_url": "/user2-updated.png", 137 | }, 138 | ) 139 | assert response.status_code == 200 140 | 141 | # Get all users 142 | with mock_webui_user(id="3"): 143 | response = self.fast_api_client.get(self.create_url("")) 144 | assert response.status_code == 200 145 | assert len(response.json()) == 2 146 | data = response.json() 147 | _assert_user(data, "1") 148 | _assert_user( 149 | data, 150 | "2", 151 | role="admin", 152 | name="user 2 updated", 153 | email="user2-updated@openwebui.com", 154 | profile_image_url="/user2-updated.png", 155 | ) 156 | 157 | # Delete user by id 158 | with mock_webui_user(id="1"): 159 | response = self.fast_api_client.delete(self.create_url("/2")) 160 | assert response.status_code == 200 161 | 162 | # Get all users 163 | with mock_webui_user(id="3"): 164 | response = self.fast_api_client.get(self.create_url("")) 165 | assert response.status_code == 200 166 | assert len(response.json()) == 1 167 | data = response.json() 168 | _assert_user(data, "1") ``````` `\\?\D:\Coding\ai\backend\test\util\abstract_integration_test.py`: ```````py 1 | import logging 2 | import os 3 | import time 4 | 5 | import docker 6 | import pytest 7 | from docker import DockerClient 8 | from pytest_docker.plugin import get_docker_ip 9 | from fastapi.testclient import TestClient 10 | from sqlalchemy import text, create_engine 11 | 12 | 13 | log = logging.getLogger(__name__) 14 | 15 | 16 | def get_fast_api_client(): 17 | from main import app 18 | 19 | with TestClient(app) as c: 20 | return c 21 | 22 | 23 | class AbstractIntegrationTest: 24 | BASE_PATH = None 25 | 26 | def create_url(self, path="", query_params=None): 27 | if self.BASE_PATH is None: 28 | raise Exception("BASE_PATH is not set") 29 | parts = self.BASE_PATH.split("/") 30 | parts = [part.strip() for part in parts if part.strip() != ""] 31 | path_parts = path.split("/") 32 | path_parts = [part.strip() for part in path_parts if part.strip() != ""] 33 | query_parts = "" 34 | if query_params: 35 | query_parts = "&".join( 36 | [f"{key}={value}" for key, value in query_params.items()] 37 | ) 38 | query_parts = f"?{query_parts}" 39 | return "/".join(parts + path_parts) + query_parts 40 | 41 | @classmethod 42 | def setup_class(cls): 43 | pass 44 | 45 | def setup_method(self): 46 | pass 47 | 48 | @classmethod 49 | def teardown_class(cls): 50 | pass 51 | 52 | def teardown_method(self): 53 | pass 54 | 55 | 56 | class AbstractPostgresTest(AbstractIntegrationTest): 57 | DOCKER_CONTAINER_NAME = "postgres-test-container-will-get-deleted" 58 | docker_client: DockerClient 59 | 60 | @classmethod 61 | def _create_db_url(cls, env_vars_postgres: dict) -> str: 62 | host = get_docker_ip() 63 | user = env_vars_postgres["POSTGRES_USER"] 64 | pw = env_vars_postgres["POSTGRES_PASSWORD"] 65 | port = 8081 66 | db = env_vars_postgres["POSTGRES_DB"] 67 | return f"postgresql://{user}:{pw}@{host}:{port}/{db}" 68 | 69 | @classmethod 70 | def setup_class(cls): 71 | super().setup_class() 72 | try: 73 | env_vars_postgres = { 74 | "POSTGRES_USER": "user", 75 | "POSTGRES_PASSWORD": "example", 76 | "POSTGRES_DB": "openwebui", 77 | } 78 | cls.docker_client = docker.from_env() 79 | cls.docker_client.containers.run( 80 | "postgres:16.2", 81 | detach=True, 82 | environment=env_vars_postgres, 83 | name=cls.DOCKER_CONTAINER_NAME, 84 | ports={5432: ("0.0.0.0", 8081)}, 85 | command="postgres -c log_statement=all", 86 | ) 87 | time.sleep(0.5) 88 | 89 | database_url = cls._create_db_url(env_vars_postgres) 90 | os.environ["DATABASE_URL"] = database_url 91 | retries = 10 92 | db = None 93 | while retries > 0: 94 | try: 95 | from config import BACKEND_DIR 96 | 97 | db = create_engine(database_url, pool_pre_ping=True) 98 | db = db.connect() 99 | log.info("postgres is ready!") 100 | break 101 | except Exception as e: 102 | log.warning(e) 103 | time.sleep(3) 104 | retries -= 1 105 | 106 | if db: 107 | # import must be after setting env! 108 | cls.fast_api_client = get_fast_api_client() 109 | db.close() 110 | else: 111 | raise Exception("Could not connect to Postgres") 112 | except Exception as ex: 113 | log.error(ex) 114 | cls.teardown_class() 115 | pytest.fail(f"Could not setup test environment: {ex}") 116 | 117 | def _check_db_connection(self): 118 | from apps.webui.internal.db import Session 119 | 120 | retries = 10 121 | while retries > 0: 122 | try: 123 | Session.execute(text("SELECT 1")) 124 | Session.commit() 125 | break 126 | except Exception as e: 127 | Session.rollback() 128 | log.warning(e) 129 | time.sleep(3) 130 | retries -= 1 131 | 132 | def setup_method(self): 133 | super().setup_method() 134 | self._check_db_connection() 135 | 136 | @classmethod 137 | def teardown_class(cls) -> None: 138 | super().teardown_class() 139 | cls.docker_client.containers.get(cls.DOCKER_CONTAINER_NAME).remove(force=True) 140 | 141 | def teardown_method(self): 142 | from apps.webui.internal.db import Session 143 | 144 | # rollback everything not yet committed 145 | Session.commit() 146 | 147 | # truncate all tables 148 | tables = [ 149 | "auth", 150 | "chat", 151 | "chatidtag", 152 | "document", 153 | "memory", 154 | "model", 155 | "prompt", 156 | "tag", 157 | '"user"', 158 | ] 159 | for table in tables: 160 | Session.execute(text(f"TRUNCATE TABLE {table}")) 161 | Session.commit() ``````` `\\?\D:\Coding\ai\backend\test\util\mock_user.py`: ```````py 1 | from contextlib import contextmanager 2 | 3 | from fastapi import FastAPI 4 | 5 | 6 | @contextmanager 7 | def mock_webui_user(**kwargs): 8 | from apps.webui.main import app 9 | 10 | with mock_user(app, **kwargs): 11 | yield 12 | 13 | 14 | @contextmanager 15 | def mock_user(app: FastAPI, **kwargs): 16 | from utils.utils import ( 17 | get_current_user, 18 | get_verified_user, 19 | get_admin_user, 20 | get_current_user_by_api_key, 21 | ) 22 | from apps.webui.models.users import User 23 | 24 | def create_user(): 25 | user_parameters = { 26 | "id": "1", 27 | "name": "John Doe", 28 | "email": "john.doe@openwebui.com", 29 | "role": "user", 30 | "profile_image_url": "/user.png", 31 | "last_active_at": 1627351200, 32 | "updated_at": 1627351200, 33 | "created_at": 162735120, 34 | **kwargs, 35 | } 36 | return User(**user_parameters) 37 | 38 | app.dependency_overrides = { 39 | get_current_user: create_user, 40 | get_verified_user: create_user, 41 | get_admin_user: create_user, 42 | get_current_user_by_api_key: create_user, 43 | } 44 | yield 45 | app.dependency_overrides = {} ``````` `\\?\D:\Coding\ai\backend\utils\misc.py`: ```````py 1 | from pathlib import Path 2 | import hashlib 3 | import json 4 | import re 5 | from datetime import timedelta 6 | from typing import Optional, List, Tuple 7 | import uuid 8 | import time 9 | 10 | 11 | def get_last_user_message_item(messages: List[dict]) -> str: 12 | for message in reversed(messages): 13 | if message["role"] == "user": 14 | return message 15 | return None 16 | 17 | 18 | def get_last_user_message(messages: List[dict]) -> str: 19 | message = get_last_user_message_item(messages) 20 | 21 | if message is not None: 22 | if isinstance(message["content"], list): 23 | for item in message["content"]: 24 | if item["type"] == "text": 25 | return item["text"] 26 | return message["content"] 27 | return None 28 | 29 | 30 | def get_last_assistant_message(messages: List[dict]) -> str: 31 | for message in reversed(messages): 32 | if message["role"] == "assistant": 33 | if isinstance(message["content"], list): 34 | for item in message["content"]: 35 | if item["type"] == "text": 36 | return item["text"] 37 | return message["content"] 38 | return None 39 | 40 | 41 | def get_system_message(messages: List[dict]) -> dict: 42 | for message in messages: 43 | if message["role"] == "system": 44 | return message 45 | return None 46 | 47 | 48 | def remove_system_message(messages: List[dict]) -> List[dict]: 49 | return [message for message in messages if message["role"] != "system"] 50 | 51 | 52 | def pop_system_message(messages: List[dict]) -> Tuple[dict, List[dict]]: 53 | return get_system_message(messages), remove_system_message(messages) 54 | 55 | 56 | def add_or_update_system_message(content: str, messages: List[dict]): 57 | """ 58 | Adds a new system message at the beginning of the messages list 59 | or updates the existing system message at the beginning. 60 | 61 | :param msg: The message to be added or appended. 62 | :param messages: The list of message dictionaries. 63 | :return: The updated list of message dictionaries. 64 | """ 65 | 66 | if messages and messages[0].get("role") == "system": 67 | messages[0]["content"] += f"{content}\n{messages[0]['content']}" 68 | else: 69 | # Insert at the beginning 70 | messages.insert(0, {"role": "system", "content": content}) 71 | 72 | return messages 73 | 74 | 75 | def stream_message_template(model: str, message: str): 76 | return { 77 | "id": f"{model}-{str(uuid.uuid4())}", 78 | "object": "chat.completion.chunk", 79 | "created": int(time.time()), 80 | "model": model, 81 | "choices": [ 82 | { 83 | "index": 0, 84 | "delta": {"content": message}, 85 | "logprobs": None, 86 | "finish_reason": None, 87 | } 88 | ], 89 | } 90 | 91 | 92 | def get_gravatar_url(email): 93 | # Trim leading and trailing whitespace from 94 | # an email address and force all characters 95 | # to lower case 96 | address = str(email).strip().lower() 97 | 98 | # Create a SHA256 hash of the final string 99 | hash_object = hashlib.sha256(address.encode()) 100 | hash_hex = hash_object.hexdigest() 101 | 102 | # Grab the actual image URL 103 | return f"https://www.gravatar.com/avatar/{hash_hex}?d=mp" 104 | 105 | 106 | def calculate_sha256(file): 107 | sha256 = hashlib.sha256() 108 | # Read the file in chunks to efficiently handle large files 109 | for chunk in iter(lambda: file.read(8192), b""): 110 | sha256.update(chunk) 111 | return sha256.hexdigest() 112 | 113 | 114 | def calculate_sha256_string(string): 115 | # Create a new SHA-256 hash object 116 | sha256_hash = hashlib.sha256() 117 | # Update the hash object with the bytes of the input string 118 | sha256_hash.update(string.encode("utf-8")) 119 | # Get the hexadecimal representation of the hash 120 | hashed_string = sha256_hash.hexdigest() 121 | return hashed_string 122 | 123 | 124 | def validate_email_format(email: str) -> bool: 125 | if email.endswith("@localhost"): 126 | return True 127 | 128 | return bool(re.match(r"[^@]+@[^@]+\.[^@]+", email)) 129 | 130 | 131 | def sanitize_filename(file_name): 132 | # Convert to lowercase 133 | lower_case_file_name = file_name.lower() 134 | 135 | # Remove special characters using regular expression 136 | sanitized_file_name = re.sub(r"[^\w\s]", "", lower_case_file_name) 137 | 138 | # Replace spaces with dashes 139 | final_file_name = re.sub(r"\s+", "-", sanitized_file_name) 140 | 141 | return final_file_name 142 | 143 | 144 | def extract_folders_after_data_docs(path): 145 | # Convert the path to a Path object if it's not already 146 | path = Path(path) 147 | 148 | # Extract parts of the path 149 | parts = path.parts 150 | 151 | # Find the index of '/data/docs' in the path 152 | try: 153 | index_data_docs = parts.index("data") + 1 154 | index_docs = parts.index("docs", index_data_docs) + 1 155 | except ValueError: 156 | return [] 157 | 158 | # Exclude the filename and accumulate folder names 159 | tags = [] 160 | 161 | folders = parts[index_docs:-1] 162 | for idx, part in enumerate(folders): 163 | tags.append("/".join(folders[: idx + 1])) 164 | 165 | return tags 166 | 167 | 168 | def parse_duration(duration: str) -> Optional[timedelta]: 169 | if duration == "-1" or duration == "0": 170 | return None 171 | 172 | # Regular expression to find number and unit pairs 173 | pattern = r"(-?\d+(\.\d+)?)(ms|s|m|h|d|w)" 174 | matches = re.findall(pattern, duration) 175 | 176 | if not matches: 177 | raise ValueError("Invalid duration string") 178 | 179 | total_duration = timedelta() 180 | 181 | for number, _, unit in matches: 182 | number = float(number) 183 | if unit == "ms": 184 | total_duration += timedelta(milliseconds=number) 185 | elif unit == "s": 186 | total_duration += timedelta(seconds=number) 187 | elif unit == "m": 188 | total_duration += timedelta(minutes=number) 189 | elif unit == "h": 190 | total_duration += timedelta(hours=number) 191 | elif unit == "d": 192 | total_duration += timedelta(days=number) 193 | elif unit == "w": 194 | total_duration += timedelta(weeks=number) 195 | 196 | return total_duration 197 | 198 | 199 | def parse_ollama_modelfile(model_text): 200 | parameters_meta = { 201 | "mirostat": int, 202 | "mirostat_eta": float, 203 | "mirostat_tau": float, 204 | "num_ctx": int, 205 | "repeat_last_n": int, 206 | "repeat_penalty": float, 207 | "temperature": float, 208 | "seed": int, 209 | "tfs_z": float, 210 | "num_predict": int, 211 | "top_k": int, 212 | "top_p": float, 213 | "num_keep": int, 214 | "typical_p": float, 215 | "presence_penalty": float, 216 | "frequency_penalty": float, 217 | "penalize_newline": bool, 218 | "numa": bool, 219 | "num_batch": int, 220 | "num_gpu": int, 221 | "main_gpu": int, 222 | "low_vram": bool, 223 | "f16_kv": bool, 224 | "vocab_only": bool, 225 | "use_mmap": bool, 226 | "use_mlock": bool, 227 | "num_thread": int, 228 | } 229 | 230 | data = {"base_model_id": None, "params": {}} 231 | 232 | # Parse base model 233 | base_model_match = re.search( 234 | r"^FROM\s+(\w+)", model_text, re.MULTILINE | re.IGNORECASE 235 | ) 236 | if base_model_match: 237 | data["base_model_id"] = base_model_match.group(1) 238 | 239 | # Parse template 240 | template_match = re.search( 241 | r'TEMPLATE\s+"""(.+?)"""', model_text, re.DOTALL | re.IGNORECASE 242 | ) 243 | if template_match: 244 | data["params"] = {"template": template_match.group(1).strip()} 245 | 246 | # Parse stops 247 | stops = re.findall(r'PARAMETER stop "(.*?)"', model_text, re.IGNORECASE) 248 | if stops: 249 | data["params"]["stop"] = stops 250 | 251 | # Parse other parameters from the provided list 252 | for param, param_type in parameters_meta.items(): 253 | param_match = re.search(rf"PARAMETER {param} (.+)", model_text, re.IGNORECASE) 254 | if param_match: 255 | value = param_match.group(1) 256 | 257 | try: 258 | if param_type == int: 259 | value = int(value) 260 | elif param_type == float: 261 | value = float(value) 262 | elif param_type == bool: 263 | value = value.lower() == "true" 264 | except Exception as e: 265 | print(e) 266 | continue 267 | 268 | data["params"][param] = value 269 | 270 | # Parse adapter 271 | adapter_match = re.search(r"ADAPTER (.+)", model_text, re.IGNORECASE) 272 | if adapter_match: 273 | data["params"]["adapter"] = adapter_match.group(1) 274 | 275 | # Parse system description 276 | system_desc_match = re.search( 277 | r'SYSTEM\s+"""(.+?)"""', model_text, re.DOTALL | re.IGNORECASE 278 | ) 279 | system_desc_match_single = re.search( 280 | r"SYSTEM\s+([^\n]+)", model_text, re.IGNORECASE 281 | ) 282 | 283 | if system_desc_match: 284 | data["params"]["system"] = system_desc_match.group(1).strip() 285 | elif system_desc_match_single: 286 | data["params"]["system"] = system_desc_match_single.group(1).strip() 287 | 288 | # Parse messages 289 | messages = [] 290 | message_matches = re.findall(r"MESSAGE (\w+) (.+)", model_text, re.IGNORECASE) 291 | for role, content in message_matches: 292 | messages.append({"role": role, "content": content}) 293 | 294 | if messages: 295 | data["params"]["messages"] = messages 296 | 297 | return data ``````` `\\?\D:\Coding\ai\backend\utils\task.py`: ```````py 1 | import re 2 | import math 3 | 4 | from datetime import datetime 5 | from typing import Optional 6 | 7 | 8 | def prompt_template( 9 | template: str, user_name: str = None, user_location: str = None 10 | ) -> str: 11 | # Get the current date 12 | current_date = datetime.now() 13 | 14 | # Format the date to YYYY-MM-DD 15 | formatted_date = current_date.strftime("%Y-%m-%d") 16 | formatted_time = current_date.strftime("%I:%M:%S %p") 17 | 18 | template = template.replace("{{CURRENT_DATE}}", formatted_date) 19 | template = template.replace("{{CURRENT_TIME}}", formatted_time) 20 | template = template.replace( 21 | "{{CURRENT_DATETIME}}", f"{formatted_date} {formatted_time}" 22 | ) 23 | 24 | if user_name: 25 | # Replace {{USER_NAME}} in the template with the user's name 26 | template = template.replace("{{USER_NAME}}", user_name) 27 | else: 28 | # Replace {{USER_NAME}} in the template with "Unknown" 29 | template = template.replace("{{USER_NAME}}", "Unknown") 30 | 31 | if user_location: 32 | # Replace {{USER_LOCATION}} in the template with the current location 33 | template = template.replace("{{USER_LOCATION}}", user_location) 34 | else: 35 | # Replace {{USER_LOCATION}} in the template with "Unknown" 36 | template = template.replace("{{USER_LOCATION}}", "Unknown") 37 | 38 | return template 39 | 40 | 41 | def title_generation_template( 42 | template: str, prompt: str, user: Optional[dict] = None 43 | ) -> str: 44 | def replacement_function(match): 45 | full_match = match.group(0) 46 | start_length = match.group(1) 47 | end_length = match.group(2) 48 | middle_length = match.group(3) 49 | 50 | if full_match == "{{prompt}}": 51 | return prompt 52 | elif start_length is not None: 53 | return prompt[: int(start_length)] 54 | elif end_length is not None: 55 | return prompt[-int(end_length) :] 56 | elif middle_length is not None: 57 | middle_length = int(middle_length) 58 | if len(prompt) <= middle_length: 59 | return prompt 60 | start = prompt[: math.ceil(middle_length / 2)] 61 | end = prompt[-math.floor(middle_length / 2) :] 62 | return f"{start}...{end}" 63 | return "" 64 | 65 | template = re.sub( 66 | r"{{prompt}}|{{prompt:start:(\d+)}}|{{prompt:end:(\d+)}}|{{prompt:middletruncate:(\d+)}}", 67 | replacement_function, 68 | template, 69 | ) 70 | 71 | template = prompt_template( 72 | template, 73 | **( 74 | {"user_name": user.get("name"), "user_location": user.get("location")} 75 | if user 76 | else {} 77 | ), 78 | ) 79 | 80 | return template 81 | 82 | 83 | def search_query_generation_template( 84 | template: str, prompt: str, user: Optional[dict] = None 85 | ) -> str: 86 | 87 | def replacement_function(match): 88 | full_match = match.group(0) 89 | start_length = match.group(1) 90 | end_length = match.group(2) 91 | middle_length = match.group(3) 92 | 93 | if full_match == "{{prompt}}": 94 | return prompt 95 | elif start_length is not None: 96 | return prompt[: int(start_length)] 97 | elif end_length is not None: 98 | return prompt[-int(end_length) :] 99 | elif middle_length is not None: 100 | middle_length = int(middle_length) 101 | if len(prompt) <= middle_length: 102 | return prompt 103 | start = prompt[: math.ceil(middle_length / 2)] 104 | end = prompt[-math.floor(middle_length / 2) :] 105 | return f"{start}...{end}" 106 | return "" 107 | 108 | template = re.sub( 109 | r"{{prompt}}|{{prompt:start:(\d+)}}|{{prompt:end:(\d+)}}|{{prompt:middletruncate:(\d+)}}", 110 | replacement_function, 111 | template, 112 | ) 113 | 114 | template = prompt_template( 115 | template, 116 | **( 117 | {"user_name": user.get("name"), "user_location": user.get("location")} 118 | if user 119 | else {} 120 | ), 121 | ) 122 | return template 123 | 124 | 125 | def tools_function_calling_generation_template(template: str, tools_specs: str) -> str: 126 | template = template.replace("{{TOOLS}}", tools_specs) 127 | return template ``````` `\\?\D:\Coding\ai\backend\utils\tools.py`: ```````py 1 | import inspect 2 | from typing import get_type_hints, List, Dict, Any 3 | 4 | 5 | def doc_to_dict(docstring): 6 | lines = docstring.split("\n") 7 | description = lines[1].strip() 8 | param_dict = {} 9 | 10 | for line in lines: 11 | if ":param" in line: 12 | line = line.replace(":param", "").strip() 13 | param, desc = line.split(":", 1) 14 | param_dict[param.strip()] = desc.strip() 15 | ret_dict = {"description": description, "params": param_dict} 16 | return ret_dict 17 | 18 | 19 | def get_tools_specs(tools) -> List[dict]: 20 | function_list = [ 21 | {"name": func, "function": getattr(tools, func)} 22 | for func in dir(tools) 23 | if callable(getattr(tools, func)) 24 | and not func.startswith("__") 25 | and not inspect.isclass(getattr(tools, func)) 26 | ] 27 | 28 | specs = [] 29 | for function_item in function_list: 30 | function_name = function_item["name"] 31 | function = function_item["function"] 32 | 33 | function_doc = doc_to_dict(function.__doc__ or function_name) 34 | specs.append( 35 | { 36 | "name": function_name, 37 | # TODO: multi-line desc? 38 | "description": function_doc.get("description", function_name), 39 | "parameters": { 40 | "type": "object", 41 | "properties": { 42 | param_name: { 43 | "type": param_annotation.__name__.lower(), 44 | **( 45 | { 46 | "enum": ( 47 | str(param_annotation.__args__) 48 | if hasattr(param_annotation, "__args__") 49 | else None 50 | ) 51 | } 52 | if hasattr(param_annotation, "__args__") 53 | else {} 54 | ), 55 | "description": function_doc.get("params", {}).get( 56 | param_name, param_name 57 | ), 58 | } 59 | for param_name, param_annotation in get_type_hints( 60 | function 61 | ).items() 62 | if param_name != "return" 63 | and not ( 64 | param_name.startswith("__") and param_name.endswith("__") 65 | ) 66 | }, 67 | "required": [ 68 | name 69 | for name, param in inspect.signature( 70 | function 71 | ).parameters.items() 72 | if param.default is param.empty 73 | and not (name.startswith("__") and name.endswith("__")) 74 | ], 75 | }, 76 | } 77 | ) 78 | 79 | return specs ``````` `\\?\D:\Coding\ai\backend\utils\utils.py`: ```````py 1 | from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials 2 | from fastapi import HTTPException, status, Depends, Request 3 | from sqlalchemy.orm import Session 4 | 5 | from apps.webui.models.users import Users 6 | 7 | from pydantic import BaseModel 8 | from typing import Union, Optional 9 | from constants import ERROR_MESSAGES 10 | from passlib.context import CryptContext 11 | from datetime import datetime, timedelta 12 | import requests 13 | import jwt 14 | import uuid 15 | import logging 16 | import config 17 | 18 | logging.getLogger("passlib").setLevel(logging.ERROR) 19 | 20 | 21 | SESSION_SECRET = config.WEBUI_SECRET_KEY 22 | ALGORITHM = "HS256" 23 | 24 | ############## 25 | # Auth Utils 26 | ############## 27 | 28 | bearer_security = HTTPBearer(auto_error=False) 29 | pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto") 30 | 31 | 32 | def verify_password(plain_password, hashed_password): 33 | return ( 34 | pwd_context.verify(plain_password, hashed_password) if hashed_password else None 35 | ) 36 | 37 | 38 | def get_password_hash(password): 39 | return pwd_context.hash(password) 40 | 41 | 42 | def create_token(data: dict, expires_delta: Union[timedelta, None] = None) -> str: 43 | payload = data.copy() 44 | 45 | if expires_delta: 46 | expire = datetime.utcnow() + expires_delta 47 | payload.update({"exp": expire}) 48 | 49 | encoded_jwt = jwt.encode(payload, SESSION_SECRET, algorithm=ALGORITHM) 50 | return encoded_jwt 51 | 52 | 53 | def decode_token(token: str) -> Optional[dict]: 54 | try: 55 | decoded = jwt.decode(token, SESSION_SECRET, algorithms=[ALGORITHM]) 56 | return decoded 57 | except Exception as e: 58 | return None 59 | 60 | 61 | def extract_token_from_auth_header(auth_header: str): 62 | return auth_header[len("Bearer ") :] 63 | 64 | 65 | def create_api_key(): 66 | key = str(uuid.uuid4()).replace("-", "") 67 | return f"sk-{key}" 68 | 69 | 70 | def get_http_authorization_cred(auth_header: str): 71 | try: 72 | scheme, credentials = auth_header.split(" ") 73 | return HTTPAuthorizationCredentials(scheme=scheme, credentials=credentials) 74 | except: 75 | raise ValueError(ERROR_MESSAGES.INVALID_TOKEN) 76 | 77 | 78 | def get_current_user( 79 | request: Request, 80 | auth_token: HTTPAuthorizationCredentials = Depends(bearer_security), 81 | ): 82 | token = None 83 | 84 | if auth_token is not None: 85 | token = auth_token.credentials 86 | 87 | if token is None and "token" in request.cookies: 88 | token = request.cookies.get("token") 89 | 90 | if token is None: 91 | raise HTTPException(status_code=403, detail="Not authenticated") 92 | 93 | # auth by api key 94 | if token.startswith("sk-"): 95 | return get_current_user_by_api_key(token) 96 | 97 | # auth by jwt token 98 | data = decode_token(token) 99 | if data != None and "id" in data: 100 | user = Users.get_user_by_id(data["id"]) 101 | if user is None: 102 | raise HTTPException( 103 | status_code=status.HTTP_401_UNAUTHORIZED, 104 | detail=ERROR_MESSAGES.INVALID_TOKEN, 105 | ) 106 | else: 107 | Users.update_user_last_active_by_id(user.id) 108 | return user 109 | else: 110 | raise HTTPException( 111 | status_code=status.HTTP_401_UNAUTHORIZED, 112 | detail=ERROR_MESSAGES.UNAUTHORIZED, 113 | ) 114 | 115 | 116 | def get_current_user_by_api_key(api_key: str): 117 | user = Users.get_user_by_api_key(api_key) 118 | 119 | if user is None: 120 | raise HTTPException( 121 | status_code=status.HTTP_401_UNAUTHORIZED, 122 | detail=ERROR_MESSAGES.INVALID_TOKEN, 123 | ) 124 | else: 125 | Users.update_user_last_active_by_id(user.id) 126 | 127 | return user 128 | 129 | 130 | def get_verified_user(user=Depends(get_current_user)): 131 | if user.role not in {"user", "admin"}: 132 | raise HTTPException( 133 | status_code=status.HTTP_401_UNAUTHORIZED, 134 | detail=ERROR_MESSAGES.ACCESS_PROHIBITED, 135 | ) 136 | return user 137 | 138 | 139 | def get_admin_user(user=Depends(get_current_user)): 140 | if user.role != "admin": 141 | raise HTTPException( 142 | status_code=status.HTTP_401_UNAUTHORIZED, 143 | detail=ERROR_MESSAGES.ACCESS_PROHIBITED, 144 | ) 145 | return user ``````` `\\?\D:\Coding\ai\backend\utils\webhook.py`: ```````py 1 | import json 2 | import requests 3 | import logging 4 | 5 | from config import SRC_LOG_LEVELS, VERSION, WEBUI_FAVICON_URL, WEBUI_NAME 6 | 7 | log = logging.getLogger(__name__) 8 | log.setLevel(SRC_LOG_LEVELS["WEBHOOK"]) 9 | 10 | 11 | def post_webhook(url: str, message: str, event_data: dict) -> bool: 12 | try: 13 | payload = {} 14 | 15 | # Slack and Google Chat Webhooks 16 | if "https://hooks.slack.com" in url or "https://chat.googleapis.com" in url: 17 | payload["text"] = message 18 | # Discord Webhooks 19 | elif "https://discord.com/api/webhooks" in url: 20 | payload["content"] = message 21 | # Microsoft Teams Webhooks 22 | elif "webhook.office.com" in url: 23 | action = event_data.get("action", "undefined") 24 | facts = [ 25 | {"name": name, "value": value} 26 | for name, value in json.loads(event_data.get("user", {})).items() 27 | ] 28 | payload = { 29 | "@type": "MessageCard", 30 | "@context": "http://schema.org/extensions", 31 | "themeColor": "0076D7", 32 | "summary": message, 33 | "sections": [ 34 | { 35 | "activityTitle": message, 36 | "activitySubtitle": f"{WEBUI_NAME} ({VERSION}) - {action}", 37 | "activityImage": WEBUI_FAVICON_URL, 38 | "facts": facts, 39 | "markdown": True, 40 | } 41 | ], 42 | } 43 | # Default Payload 44 | else: 45 | payload = {**event_data} 46 | 47 | log.debug(f"payload: {payload}") 48 | r = requests.post(url, json=payload) 49 | r.raise_for_status() 50 | log.debug(f"r.text: {r.text}") 51 | return True 52 | except Exception as e: 53 | log.exception(e) 54 | return False ``````` `\\?\D:\Coding\ai\Caddyfile.localhost`: ```````localhost 1 | # Run with 2 | # caddy run --envfile ./example.env --config ./Caddyfile.localhost 3 | # 4 | # This is configured for 5 | # - Automatic HTTPS (even for localhost) 6 | # - Reverse Proxying to Ollama API Base URL (http://localhost:11434/api) 7 | # - CORS 8 | # - HTTP Basic Auth API Tokens (uncomment basicauth section) 9 | 10 | 11 | # CORS Preflight (OPTIONS) + Request (GET, POST, PATCH, PUT, DELETE) 12 | (cors-api) { 13 | @match-cors-api-preflight method OPTIONS 14 | handle @match-cors-api-preflight { 15 | header { 16 | Access-Control-Allow-Origin "{http.request.header.origin}" 17 | Access-Control-Allow-Methods "GET, POST, PUT, PATCH, DELETE, OPTIONS" 18 | Access-Control-Allow-Headers "Origin, Accept, Authorization, Content-Type, X-Requested-With" 19 | Access-Control-Allow-Credentials "true" 20 | Access-Control-Max-Age "3600" 21 | defer 22 | } 23 | respond "" 204 24 | } 25 | 26 | @match-cors-api-request { 27 | not { 28 | header Origin "{http.request.scheme}://{http.request.host}" 29 | } 30 | header Origin "{http.request.header.origin}" 31 | } 32 | handle @match-cors-api-request { 33 | header { 34 | Access-Control-Allow-Origin "{http.request.header.origin}" 35 | Access-Control-Allow-Methods "GET, POST, PUT, PATCH, DELETE, OPTIONS" 36 | Access-Control-Allow-Headers "Origin, Accept, Authorization, Content-Type, X-Requested-With" 37 | Access-Control-Allow-Credentials "true" 38 | Access-Control-Max-Age "3600" 39 | defer 40 | } 41 | } 42 | } 43 | 44 | # replace localhost with example.com or whatever 45 | localhost { 46 | ## HTTP Basic Auth 47 | ## (uncomment to enable) 48 | # basicauth { 49 | # # see .example.env for how to generate tokens 50 | # {env.OLLAMA_API_ID} {env.OLLAMA_API_TOKEN_DIGEST} 51 | # } 52 | 53 | handle /api/* { 54 | # Comment to disable CORS 55 | import cors-api 56 | 57 | reverse_proxy localhost:11434 58 | } 59 | 60 | # Same-Origin Static Web Server 61 | file_server { 62 | root ./build/ 63 | } 64 | } ``````` `\\?\D:\Coding\ai\CHANGELOG.md`: ```````md 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 | 8 | ## [0.3.10] - 2024-07-17 9 | 10 | ### Fixed 11 | 12 | - **🔄 Improved File Upload**: Addressed the issue where file uploads lacked animation. 13 | - **💬 Chat Continuity**: Fixed a problem where existing chats were not functioning properly in some instances. 14 | - **🗂️ Chat File Reset**: Resolved the issue of chat files not resetting for new conversations, now ensuring a clean slate for each chat session. 15 | - **📁 Document Workspace Uploads**: Corrected the handling of document uploads in the workspace using the Files API. 16 | 17 | ## [0.3.9] - 2024-07-17 18 | 19 | ### Added 20 | 21 | - **📁 Files Chat Controls**: We've reverted to the old file handling behavior where uploaded files are always included. You can now manage files directly within the chat controls section, giving you the ability to remove files as needed. 22 | - **🔧 "Action" Function Support**: Introducing a new "Action" function to write custom buttons to the message toolbar. This feature enables more interactive messaging, with documentation coming soon. 23 | - **📜 Citations Handling**: For newly uploaded files in documents workspace, citations will now display the actual filename. Additionally, you can click on these filenames to open the file in a new tab for easier access. 24 | - **🛠️ Event Emitter and Call Updates**: Enhanced 'event_emitter' to allow message replacement and 'event_call' to support text input for Tools and Functions. Detailed documentation will be provided shortly. 25 | - **🎨 Styling Refactor**: Various styling updates for a cleaner and more cohesive user interface. 26 | - **🌐 Enhanced Translations**: Improved translations for Catalan, Ukrainian, and Brazilian Portuguese. 27 | 28 | ### Fixed 29 | 30 | - **🔧 Chat Controls Priority**: Resolved an issue where Chat Controls values were being overridden by model information parameters. The priority is now Chat Controls, followed by Global Settings, then Model Settings. 31 | - **🪲 Debug Logs**: Fixed an issue where debug logs were not being logged properly. 32 | - **🔑 Automatic1111 Auth Key**: The auth key for Automatic1111 is no longer required. 33 | - **📝 Title Generation**: Ensured that the title generation runs only once, even when multiple models are in a chat. 34 | - **✅ Boolean Values in Params**: Added support for boolean values in parameters. 35 | - **🖼️ Files Overlay Styling**: Fixed the styling issue with the files overlay. 36 | 37 | ### Changed 38 | 39 | - **⬆️ Dependency Updates** 40 | - Upgraded 'pydantic' from version 2.7.1 to 2.8.2. 41 | - Upgraded 'sqlalchemy' from version 2.0.30 to 2.0.31. 42 | - Upgraded 'unstructured' from version 0.14.9 to 0.14.10. 43 | - Upgraded 'chromadb' from version 0.5.3 to 0.5.4. 44 | 45 | ## [0.3.8] - 2024-07-09 46 | 47 | ### Added 48 | 49 | - **💬 Chat Controls**: Easily adjust parameters for each chat session, offering more precise control over your interactions. 50 | - **📌 Pinned Chats**: Support for pinned chats, allowing you to keep important conversations easily accessible. 51 | - **📄 Apache Tika Integration**: Added support for using Apache Tika as a document loader, enhancing document processing capabilities. 52 | - **🛠️ Custom Environment for OpenID Claims**: Allows setting custom claims for OpenID, providing more flexibility in user authentication. 53 | - **🔧 Enhanced Tools & Functions API**: Introduced 'event_emitter' and 'event_call', now you can also add citations for better documentation and tracking. Detailed documentation will be provided on our documentation website. 54 | - **↔️ Sideways Scrolling in Settings**: Settings tabs container now supports horizontal scrolling for easier navigation. 55 | - **🌑 Darker OLED Theme**: Includes a new, darker OLED theme and improved styling for the light theme, enhancing visual appeal. 56 | - **🌐 Language Updates**: Updated translations for Indonesian, German, French, and Catalan languages, expanding accessibility. 57 | 58 | ### Fixed 59 | 60 | - **⏰ OpenAI Streaming Timeout**: Resolved issues with OpenAI streaming response using the 'AIOHTTP_CLIENT_TIMEOUT' setting, ensuring reliable performance. 61 | - **💡 User Valves**: Fixed malfunctioning user valves, ensuring proper functionality. 62 | - **🔄 Collapsible Components**: Addressed issues with collapsible components not working, restoring expected behavior. 63 | 64 | ### Changed 65 | 66 | - **🗃️ Database Backend**: Switched from Peewee to SQLAlchemy for improved concurrency support, enhancing database performance. 67 | - **⬆️ ChromaDB Update**: Upgraded to version 0.5.3. Ensure your remote ChromaDB instance matches this version. 68 | - **🔤 Primary Font Styling**: Updated primary font to Archivo for better visual consistency. 69 | - **🔄 Font Change for Windows**: Replaced Arimo with Inter font for Windows users, improving readability. 70 | - **🚀 Lazy Loading**: Implemented lazy loading for 'faster_whisper' and 'sentence_transformers' to reduce startup memory usage. 71 | - **📋 Task Generation Payload**: Task generations now include only the "task" field in the body instead of "title". 72 | 73 | ## [0.3.7] - 2024-06-29 74 | 75 | ### Added 76 | 77 | - **🌐 Enhanced Internationalization (i18n)**: Newly introduced Indonesian translation, and updated translations for Turkish, Chinese, and Catalan languages to improve user accessibility. 78 | 79 | ### Fixed 80 | 81 | - **🕵️‍♂️ Browser Language Detection**: Corrected the issue where the application was not properly detecting and adapting to the browser's language settings. 82 | - **🔐 OIDC Admin Role Assignment**: Fixed a bug where the admin role was not being assigned to the first user who signed up via OpenID Connect (OIDC). 83 | - **💬 Chat/Completions Endpoint**: Resolved an issue where the chat/completions endpoint was non-functional when the stream option was set to False. 84 | - **🚫 'WEBUI_AUTH' Configuration**: Addressed the problem where setting 'WEBUI_AUTH' to False was not being applied correctly. 85 | 86 | ### Changed 87 | 88 | - **📦 Dependency Update**: Upgraded 'authlib' from version 1.3.0 to 1.3.1 to ensure better security and performance enhancements. 89 | 90 | ## [0.3.6] - 2024-06-27 91 | 92 | ### Added 93 | 94 | - **✨ "Functions" Feature**: You can now utilize "Functions" like filters (middleware) and pipe (model) functions directly within the WebUI. While largely compatible with Pipelines, these native functions can be executed easily within Open WebUI. Example use cases for filter functions include usage monitoring, real-time translation, moderation, and automemory. For pipe functions, the scope ranges from Cohere and Anthropic integration directly within Open WebUI, enabling "Valves" for per-user OpenAI API key usage, and much more. If you encounter issues, SAFE_MODE has been introduced. 95 | - **📁 Files API**: Compatible with OpenAI, this feature allows for custom Retrieval-Augmented Generation (RAG) in conjunction with the Filter Function. More examples will be shared on our community platform and official documentation website. 96 | - **🛠️ Tool Enhancements**: Tools now support citations and "Valves". Documentation will be available shortly. 97 | - **🔗 Iframe Support via Files API**: Enables rendering HTML directly into your chat interface using functions and tools. Use cases include playing games like DOOM and Snake, displaying a weather applet, and implementing Anthropic "artifacts"-like features. Stay tuned for updates on our community platform and documentation. 98 | - **🔒 Experimental OAuth Support**: New experimental OAuth support. Check our documentation for more details. 99 | - **🖼️ Custom Background Support**: Set a custom background from Settings > Interface to personalize your experience. 100 | - **🔑 AUTOMATIC1111_API_AUTH Support**: Enhanced security for the AUTOMATIC1111 API. 101 | - **🎨 Code Highlight Optimization**: Improved code highlighting features. 102 | - **🎙️ Voice Interruption Feature**: Reintroduced and now toggleable from Settings > Interface. 103 | - **💤 Wakelock API**: Now in use to prevent screen dimming during important tasks. 104 | - **🔐 API Key Privacy**: All API keys are now hidden by default for better security. 105 | - **🔍 New Web Search Provider**: Added jina_search as a new option. 106 | - **🌐 Enhanced Internationalization (i18n)**: Improved Korean translation and updated Chinese and Ukrainian translations. 107 | 108 | ### Fixed 109 | 110 | - **🔧 Conversation Mode Issue**: Fixed the issue where Conversation Mode remained active after being removed from settings. 111 | - **📏 Scroll Button Obstruction**: Resolved the issue where the scrollToBottom button container obstructed clicks on buttons beneath it. 112 | 113 | ### Changed 114 | 115 | - **⏲️ AIOHTTP_CLIENT_TIMEOUT**: Now set to 'None' by default for improved configuration flexibility. 116 | - **📞 Voice Call Enhancements**: Improved by skipping code blocks and expressions during calls. 117 | - **🚫 Error Message Handling**: Disabled the continuation of operations with error messages. 118 | - **🗂️ Playground Relocation**: Moved the Playground from the workspace to the user menu for better user experience. 119 | 120 | ## [0.3.5] - 2024-06-16 121 | 122 | ### Added 123 | 124 | - **📞 Enhanced Voice Call**: Text-to-speech (TTS) callback now operates in real-time for each sentence, reducing latency by not waiting for full completion. 125 | - **👆 Tap to Interrupt**: During a call, you can now stop the assistant from speaking by simply tapping, instead of using voice. This resolves the issue of the speaker's voice being mistakenly registered as input. 126 | - **😊 Emoji Call**: Toggle this feature on from the Settings > Interface, allowing LLMs to express emotions using emojis during voice calls for a more dynamic interaction. 127 | - **🖱️ Quick Archive/Delete**: Use the Shift key + mouseover on the chat list to swiftly archive or delete items. 128 | - **📝 Markdown Support in Model Descriptions**: You can now format model descriptions with markdown, enabling bold text, links, etc. 129 | - **🧠 Editable Memories**: Adds the capability to modify memories. 130 | - **📋 Admin Panel Sorting**: Introduces the ability to sort users/chats within the admin panel. 131 | - **🌑 Dark Mode for Quick Selectors**: Dark mode now available for chat quick selectors (prompts, models, documents). 132 | - **🔧 Advanced Parameters**: Adds 'num_keep' and 'num_batch' to advanced parameters for customization. 133 | - **📅 Dynamic System Prompts**: New variables '{{CURRENT_DATETIME}}', '{{CURRENT_TIME}}', '{{USER_LOCATION}}' added for system prompts. Ensure '{{USER_LOCATION}}' is toggled on from Settings > Interface. 134 | - **🌐 Tavily Web Search**: Includes Tavily as a web search provider option. 135 | - **🖊️ Federated Auth Usernames**: Ability to set user names for federated authentication. 136 | - **🔗 Auto Clean URLs**: When adding connection URLs, trailing slashes are now automatically removed. 137 | - **🌐 Enhanced Translations**: Improved Chinese and Swedish translations. 138 | 139 | ### Fixed 140 | 141 | - **⏳ AIOHTTP_CLIENT_TIMEOUT**: Introduced a new environment variable 'AIOHTTP_CLIENT_TIMEOUT' for requests to Ollama lasting longer than 5 minutes. Default is 300 seconds; set to blank ('') for no timeout. 142 | - **❌ Message Delete Freeze**: Resolved an issue where message deletion would sometimes cause the web UI to freeze. 143 | 144 | ## [0.3.4] - 2024-06-12 145 | 146 | ### Fixed 147 | 148 | - **🔒 Mixed Content with HTTPS Issue**: Resolved a problem where mixed content (HTTP and HTTPS) was causing security warnings and blocking resources on HTTPS sites. 149 | - **🔍 Web Search Issue**: Addressed the problem where web search functionality was not working correctly. The 'ENABLE_RAG_LOCAL_WEB_FETCH' option has been reintroduced to restore proper web searching capabilities. 150 | - **💾 RAG Template Not Being Saved**: Fixed an issue where the RAG template was not being saved correctly, ensuring your custom templates are now preserved as expected. 151 | 152 | ## [0.3.3] - 2024-06-12 153 | 154 | ### Added 155 | 156 | - **🛠️ Native Python Function Calling**: Introducing native Python function calling within Open WebUI. We’ve also included a built-in code editor to seamlessly develop and integrate function code within the 'Tools' workspace. With this, you can significantly enhance your LLM’s capabilities by creating custom RAG pipelines, web search tools, and even agent-like features such as sending Discord messages. 157 | - **🌐 DuckDuckGo Integration**: Added DuckDuckGo as a web search provider, giving you more search options. 158 | - **🌏 Enhanced Translations**: Improved translations for Vietnamese and Chinese languages, making the interface more accessible. 159 | 160 | ### Fixed 161 | 162 | - **🔗 Web Search URL Error Handling**: Fixed the issue where a single URL error would disrupt the data loading process in Web Search mode. Now, such errors will be handled gracefully to ensure uninterrupted data loading. 163 | - **🖥️ Frontend Responsiveness**: Resolved the problem where the frontend would stop responding if the backend encounters an error while downloading a model. Improved error handling to maintain frontend stability. 164 | - **🔧 Dependency Issues in pip**: Fixed issues related to pip installations, ensuring all dependencies are correctly managed to prevent installation errors. 165 | 166 | ## [0.3.2] - 2024-06-10 167 | 168 | ### Added 169 | 170 | - **🔍 Web Search Query Status**: The web search query will now persist in the results section to aid in easier debugging and tracking of search queries. 171 | - **🌐 New Web Search Provider**: We have added Serply as a new option for web search providers, giving you more choices for your search needs. 172 | - **🌏 Improved Translations**: We've enhanced translations for Chinese and Portuguese. 173 | 174 | ### Fixed 175 | 176 | - **🎤 Audio File Upload Issue**: The bug that prevented audio files from being uploaded in chat input has been fixed, ensuring smooth communication. 177 | - **💬 Message Input Handling**: Improved the handling of message inputs by instantly clearing images and text after sending, along with immediate visual indications when a response message is loading, enhancing user feedback. 178 | - **⚙️ Parameter Registration and Validation**: Fixed the issue where parameters were not registering in certain cases and addressed the problem where users were unable to save due to invalid input errors. 179 | 180 | ## [0.3.1] - 2024-06-09 181 | 182 | ### Fixed 183 | 184 | - **💬 Chat Functionality**: Resolved the issue where chat functionality was not working for specific models. 185 | 186 | ## [0.3.0] - 2024-06-09 187 | 188 | ### Added 189 | 190 | - **📚 Knowledge Support for Models**: Attach documents directly to models from the models workspace, enhancing the information available to each model. 191 | - **🎙️ Hands-Free Voice Call Feature**: Initiate voice calls without needing to use your hands, making interactions more seamless. 192 | - **📹 Video Call Feature**: Enable video calls with supported vision models like Llava and GPT-4o, adding a visual dimension to your communications. 193 | - **🎛️ Enhanced UI for Voice Recording**: Improved user interface for the voice recording feature, making it more intuitive and user-friendly. 194 | - **🌐 External STT Support**: Now support for external Speech-To-Text services, providing more flexibility in choosing your STT provider. 195 | - **⚙️ Unified Settings**: Consolidated settings including document settings under a new admin settings section for easier management. 196 | - **🌑 Dark Mode Splash Screen**: A new splash screen for dark mode, ensuring a consistent and visually appealing experience for dark mode users. 197 | - **📥 Upload Pipeline**: Directly upload pipelines from the admin settings > pipelines section, streamlining the pipeline management process. 198 | - **🌍 Improved Language Support**: Enhanced support for Chinese and Ukrainian languages, better catering to a global user base. 199 | 200 | ### Fixed 201 | 202 | - **🛠️ Playground Issue**: Fixed the playground not functioning properly, ensuring a smoother user experience. 203 | - **🔥 Temperature Parameter Issue**: Corrected the issue where the temperature value '0' was not being passed correctly. 204 | - **📝 Prompt Input Clearing**: Resolved prompt input textarea not being cleared right away, ensuring a clean slate for new inputs. 205 | - **✨ Various UI Styling Issues**: Fixed numerous user interface styling problems for a more cohesive look. 206 | - **👥 Active Users Display**: Fixed active users showing active sessions instead of actual users, now reflecting accurate user activity. 207 | - **🌐 Community Platform Compatibility**: The Community Platform is back online and fully compatible with Open WebUI. 208 | 209 | ### Changed 210 | 211 | - **📝 RAG Implementation**: Updated the RAG (Retrieval-Augmented Generation) implementation to use a system prompt for context, instead of overriding the user's prompt. 212 | - **🔄 Settings Relocation**: Moved Models, Connections, Audio, and Images settings to the admin settings for better organization. 213 | - **✍️ Improved Title Generation**: Enhanced the default prompt for title generation, yielding better results. 214 | - **🔧 Backend Task Management**: Tasks like title generation and search query generation are now managed on the backend side and controlled only by the admin. 215 | - **🔍 Editable Search Query Prompt**: You can now edit the search query generation prompt, offering more control over how queries are generated. 216 | - **📏 Prompt Length Threshold**: Set the prompt length threshold for search query generation from the admin settings, giving more customization options. 217 | - **📣 Settings Consolidation**: Merged the Banners admin setting with the Interface admin setting for a more streamlined settings area. 218 | 219 | ## [0.2.5] - 2024-06-05 220 | 221 | ### Added 222 | 223 | - **👥 Active Users Indicator**: Now you can see how many people are currently active and what they are running. This helps you gauge when performance might slow down due to a high number of users. 224 | - **🗂️ Create Ollama Modelfile**: The option to create a modelfile for Ollama has been reintroduced in the Settings > Models section, making it easier to manage your models. 225 | - **⚙️ Default Model Setting**: Added an option to set the default model from Settings > Interface. This feature is now easily accessible, especially convenient for mobile users as it was previously hidden. 226 | - **🌐 Enhanced Translations**: We've improved the Chinese translations and added support for Turkmen and Norwegian languages to make the interface more accessible globally. 227 | 228 | ### Fixed 229 | 230 | - **📱 Mobile View Improvements**: The UI now uses dvh (dynamic viewport height) instead of vh (viewport height), providing a better and more responsive experience for mobile users. 231 | 232 | ## [0.2.4] - 2024-06-03 233 | 234 | ### Added 235 | 236 | - **👤 Improved Account Pending Page**: The account pending page now displays admin details by default to avoid confusion. You can disable this feature in the admin settings if needed. 237 | - **🌐 HTTP Proxy Support**: We have enabled the use of the 'http_proxy' environment variable in OpenAI and Ollama API calls, making it easier to configure network settings. 238 | - **❓ Quick Access to Documentation**: You can now easily access Open WebUI documents via a question mark button located at the bottom right corner of the screen (available on larger screens like PCs). 239 | - **🌍 Enhanced Translation**: Improvements have been made to translations. 240 | 241 | ### Fixed 242 | 243 | - **🔍 SearxNG Web Search**: Fixed the issue where the SearxNG web search functionality was not working properly. 244 | 245 | ## [0.2.3] - 2024-06-03 246 | 247 | ### Added 248 | 249 | - **📁 Export Chat as JSON**: You can now export individual chats as JSON files from the navbar menu by navigating to 'Download > Export Chat'. This makes sharing specific conversations easier. 250 | - **✏️ Edit Titles with Double Click**: Double-click on titles to rename them quickly and efficiently. 251 | - **🧩 Batch Multiple Embeddings**: Introduced 'RAG_EMBEDDING_OPENAI_BATCH_SIZE' to process multiple embeddings in a batch, enhancing performance for large datasets. 252 | - **🌍 Improved Translations**: Enhanced the translation quality across various languages for a better user experience. 253 | 254 | ### Fixed 255 | 256 | - **🛠️ Modelfile Migration Script**: Fixed an issue where the modelfile migration script would fail if an invalid modelfile was encountered. 257 | - **💬 Zhuyin Input Method on Mac**: Resolved an issue where using the Zhuyin input method in the Web UI on a Mac caused text to send immediately upon pressing the enter key, leading to incorrect input. 258 | - **🔊 Local TTS Voice Selection**: Fixed the issue where the selected local Text-to-Speech (TTS) voice was not being displayed in settings. 259 | 260 | ## [0.2.2] - 2024-06-02 261 | 262 | ### Added 263 | 264 | - **🌊 Mermaid Rendering Support**: We've included support for Mermaid rendering. This allows you to create beautiful diagrams and flowcharts directly within Open WebUI. 265 | - **🔄 New Environment Variable 'RESET_CONFIG_ON_START'**: Introducing a new environment variable: 'RESET_CONFIG_ON_START'. Set this variable to reset your configuration settings upon starting the application, making it easier to revert to default settings. 266 | 267 | ### Fixed 268 | 269 | - **🔧 Pipelines Filter Issue**: We've addressed an issue with the pipelines where filters were not functioning as expected. 270 | 271 | ## [0.2.1] - 2024-06-02 272 | 273 | ### Added 274 | 275 | - **🖱️ Single Model Export Button**: Easily export models with just one click using the new single model export button. 276 | - **🖥️ Advanced Parameters Support**: Added support for 'num_thread', 'use_mmap', and 'use_mlock' parameters for Ollama. 277 | - **🌐 Improved Vietnamese Translation**: Enhanced Vietnamese language support for a better user experience for our Vietnamese-speaking community. 278 | 279 | ### Fixed 280 | 281 | - **🔧 OpenAI URL API Save Issue**: Corrected a problem preventing the saving of OpenAI URL API settings. 282 | - **🚫 Display Issue with Disabled Ollama API**: Fixed the display bug causing models to appear in settings when the Ollama API was disabled. 283 | 284 | ### Changed 285 | 286 | - **💡 Versioning Update**: As a reminder from our previous update, version 0.2.y will focus primarily on bug fixes, while major updates will be designated as 0.x from now on for better version tracking. 287 | 288 | ## [0.2.0] - 2024-06-01 289 | 290 | ### Added 291 | 292 | - **🔧 Pipelines Support**: Open WebUI now includes a plugin framework for enhanced customization and functionality (https://github.com/open-webui/pipelines). Easily add custom logic and integrate Python libraries, from AI agents to home automation APIs. 293 | - **🔗 Function Calling via Pipelines**: Integrate function calling seamlessly through Pipelines. 294 | - **⚖️ User Rate Limiting via Pipelines**: Implement user-specific rate limits to manage API usage efficiently. 295 | - **📊 Usage Monitoring with Langfuse**: Track and analyze usage statistics with Langfuse integration through Pipelines. 296 | - **🕒 Conversation Turn Limits**: Set limits on conversation turns to manage interactions better through Pipelines. 297 | - **🛡️ Toxic Message Filtering**: Automatically filter out toxic messages to maintain a safe environment using Pipelines. 298 | - **🔍 Web Search Support**: Introducing built-in web search capabilities via RAG API, allowing users to search using SearXNG, Google Programmatic Search Engine, Brave Search, serpstack, and serper. Activate it effortlessly by adding necessary variables from Document settings > Web Params. 299 | - **🗂️ Models Workspace**: Create and manage model presets for both Ollama/OpenAI API. Note: The old Modelfiles workspace is deprecated. 300 | - **🛠️ Model Builder Feature**: Build and edit all models with persistent builder mode. 301 | - **🏷️ Model Tagging Support**: Organize models with tagging features in the models workspace. 302 | - **📋 Model Ordering Support**: Effortlessly organize models by dragging and dropping them into the desired positions within the models workspace. 303 | - **📈 OpenAI Generation Stats**: Access detailed generation statistics for OpenAI models. 304 | - **📅 System Prompt Variables**: New variables added: '{{CURRENT_DATE}}' and '{{USER_NAME}}' for dynamic prompts. 305 | - **📢 Global Banner Support**: Manage global banners from admin settings > banners. 306 | - **🗃️ Enhanced Archived Chats Modal**: Search and export archived chats easily. 307 | - **📂 Archive All Button**: Quickly archive all chats from settings > chats. 308 | - **🌐 Improved Translations**: Added and improved translations for French, Croatian, Cebuano, and Vietnamese. 309 | 310 | ### Fixed 311 | 312 | - **🔍 Archived Chats Visibility**: Resolved issue with archived chats not showing in the admin panel. 313 | - **💬 Message Styling**: Fixed styling issues affecting message appearance. 314 | - **🔗 Shared Chat Responses**: Corrected the issue where shared chat response messages were not readonly. 315 | - **🖥️ UI Enhancement**: Fixed the scrollbar overlapping issue with the message box in the user interface. 316 | 317 | ### Changed 318 | 319 | - **💾 User Settings Storage**: User settings are now saved on the backend, ensuring consistency across all devices. 320 | - **📡 Unified API Requests**: The API request for getting models is now unified to '/api/models' for easier usage. 321 | - **🔄 Versioning Update**: Our versioning will now follow the format 0.x for major updates and 0.x.y for patches. 322 | - **📦 Export All Chats (All Users)**: Moved this functionality to the Admin Panel settings for better organization and accessibility. 323 | 324 | ### Removed 325 | 326 | - **🚫 Bundled LiteLLM Support Deprecated**: Migrate your LiteLLM config.yaml to a self-hosted LiteLLM instance. LiteLLM can still be added via OpenAI Connections. Download the LiteLLM config.yaml from admin settings > database > export LiteLLM config.yaml. 327 | 328 | ## [0.1.125] - 2024-05-19 329 | 330 | ### Added 331 | 332 | - **🔄 Updated UI**: Chat interface revamped with chat bubbles. Easily switch back to the old style via settings > interface > chat bubble UI. 333 | - **📂 Enhanced Sidebar UI**: Model files, documents, prompts, and playground merged into Workspace for streamlined access. 334 | - **🚀 Improved Many Model Interaction**: All responses now displayed simultaneously for a smoother experience. 335 | - **🐍 Python Code Execution**: Execute Python code locally in the browser with libraries like 'requests', 'beautifulsoup4', 'numpy', 'pandas', 'seaborn', 'matplotlib', 'scikit-learn', 'scipy', 'regex'. 336 | - **🧠 Experimental Memory Feature**: Manually input personal information you want LLMs to remember via settings > personalization > memory. 337 | - **💾 Persistent Settings**: Settings now saved as config.json for convenience. 338 | - **🩺 Health Check Endpoint**: Added for Docker deployment. 339 | - **↕️ RTL Support**: Toggle chat direction via settings > interface > chat direction. 340 | - **🖥️ PowerPoint Support**: RAG pipeline now supports PowerPoint documents. 341 | - **🌐 Language Updates**: Ukrainian, Turkish, Arabic, Chinese, Serbian, Vietnamese updated; Punjabi added. 342 | 343 | ### Changed 344 | 345 | - **👤 Shared Chat Update**: Shared chat now includes creator user information. 346 | 347 | ## [0.1.124] - 2024-05-08 348 | 349 | ### Added 350 | 351 | - **🖼️ Improved Chat Sidebar**: Now conveniently displays time ranges and organizes chats by today, yesterday, and more. 352 | - **📜 Citations in RAG Feature**: Easily track the context fed to the LLM with added citations in the RAG feature. 353 | - **🔒 Auth Disable Option**: Introducing the ability to disable authentication. Set 'WEBUI_AUTH' to False to disable authentication. Note: Only applicable for fresh installations without existing users. 354 | - **📹 Enhanced YouTube RAG Pipeline**: Now supports non-English videos for an enriched experience. 355 | - **🔊 Specify OpenAI TTS Models**: Customize your TTS experience by specifying OpenAI TTS models. 356 | - **🔧 Additional Environment Variables**: Discover more environment variables in our comprehensive documentation at Open WebUI Documentation (https://docs.openwebui.com). 357 | - **🌐 Language Support**: Arabic, Finnish, and Hindi added; Improved support for German, Vietnamese, and Chinese. 358 | 359 | ### Fixed 360 | 361 | - **🛠️ Model Selector Styling**: Addressed styling issues for improved user experience. 362 | - **⚠️ Warning Messages**: Resolved backend warning messages. 363 | 364 | ### Changed 365 | 366 | - **📝 Title Generation**: Limited output to 50 tokens. 367 | - **📦 Helm Charts**: Removed Helm charts, now available in a separate repository (https://github.com/open-webui/helm-charts). 368 | 369 | ## [0.1.123] - 2024-05-02 370 | 371 | ### Added 372 | 373 | - **🎨 New Landing Page Design**: Refreshed design for a more modern look and optimized use of screen space. 374 | - **📹 Youtube RAG Pipeline**: Introduces dedicated RAG pipeline for Youtube videos, enabling interaction with video transcriptions directly. 375 | - **🔧 Enhanced Admin Panel**: Streamlined user management with options to add users directly or in bulk via CSV import. 376 | - **👥 '@' Model Integration**: Easily switch to specific models during conversations; old collaborative chat feature phased out. 377 | - **🌐 Language Enhancements**: Swedish translation added, plus improvements to German, Spanish, and the addition of Doge translation. 378 | 379 | ### Fixed 380 | 381 | - **🗑️ Delete Chat Shortcut**: Addressed issue where shortcut wasn't functioning. 382 | - **🖼️ Modal Closing Bug**: Resolved unexpected closure of modal when dragging from within. 383 | - **✏️ Edit Button Styling**: Fixed styling inconsistency with edit buttons. 384 | - **🌐 Image Generation Compatibility Issue**: Rectified image generation compatibility issue with third-party APIs. 385 | - **📱 iOS PWA Icon Fix**: Corrected iOS PWA home screen icon shape. 386 | - **🔍 Scroll Gesture Bug**: Adjusted gesture sensitivity to prevent accidental activation when scrolling through code on mobile; now requires scrolling from the leftmost side to open the sidebar. 387 | 388 | ### Changed 389 | 390 | - **🔄 Unlimited Context Length**: Advanced settings now allow unlimited max context length (previously limited to 16000). 391 | - **👑 Super Admin Assignment**: The first signup is automatically assigned a super admin role, unchangeable by other admins. 392 | - **🛡️ Admin User Restrictions**: User action buttons from the admin panel are now disabled for users with admin roles. 393 | - **🔝 Default Model Selector**: Set as default model option now exclusively available on the landing page. 394 | 395 | ## [0.1.122] - 2024-04-27 396 | 397 | ### Added 398 | 399 | - **🌟 Enhanced RAG Pipeline**: Now with hybrid searching via 'BM25', reranking powered by 'CrossEncoder', and configurable relevance score thresholds. 400 | - **🛢️ External Database Support**: Seamlessly connect to custom SQLite or Postgres databases using the 'DATABASE_URL' environment variable. 401 | - **🌐 Remote ChromaDB Support**: Introducing the capability to connect to remote ChromaDB servers. 402 | - **👨‍💼 Improved Admin Panel**: Admins can now conveniently check users' chat lists and last active status directly from the admin panel. 403 | - **🎨 Splash Screen**: Introducing a loading splash screen for a smoother user experience. 404 | - **🌍 Language Support Expansion**: Added support for Bangla (bn-BD), along with enhancements to Chinese, Spanish, and Ukrainian translations. 405 | - **💻 Improved LaTeX Rendering Performance**: Enjoy faster rendering times for LaTeX equations. 406 | - **🔧 More Environment Variables**: Explore additional environment variables in our documentation (https://docs.openwebui.com), including the 'ENABLE_LITELLM' option to manage memory usage. 407 | 408 | ### Fixed 409 | 410 | - **🔧 Ollama Compatibility**: Resolved errors occurring when Ollama server version isn't an integer, such as SHA builds or RCs. 411 | - **🐛 Various OpenAI API Issues**: Addressed several issues related to the OpenAI API. 412 | - **🛑 Stop Sequence Issue**: Fixed the problem where the stop sequence with a backslash '\' was not functioning. 413 | - **🔤 Font Fallback**: Corrected font fallback issue. 414 | 415 | ### Changed 416 | 417 | - **⌨️ Prompt Input Behavior on Mobile**: Enter key prompt submission disabled on mobile devices for improved user experience. 418 | 419 | ## [0.1.121] - 2024-04-24 420 | 421 | ### Fixed 422 | 423 | - **🔧 Translation Issues**: Addressed various translation discrepancies. 424 | - **🔒 LiteLLM Security Fix**: Updated LiteLLM version to resolve a security vulnerability. 425 | - **🖥️ HTML Tag Display**: Rectified the issue where the '< br >' tag wasn't displaying correctly. 426 | - **🔗 WebSocket Connection**: Resolved the failure of WebSocket connection under HTTPS security for ComfyUI server. 427 | - **📜 FileReader Optimization**: Implemented FileReader initialization per image in multi-file drag & drop to ensure reusability. 428 | - **🏷️ Tag Display**: Corrected tag display inconsistencies. 429 | - **📦 Archived Chat Styling**: Fixed styling issues in archived chat. 430 | - **🔖 Safari Copy Button Bug**: Addressed the bug where the copy button failed to copy links in Safari. 431 | 432 | ## [0.1.120] - 2024-04-20 433 | 434 | ### Added 435 | 436 | - **📦 Archive Chat Feature**: Easily archive chats with a new sidebar button, and access archived chats via the profile button > archived chats. 437 | - **🔊 Configurable Text-to-Speech Endpoint**: Customize your Text-to-Speech experience with configurable OpenAI endpoints. 438 | - **🛠️ Improved Error Handling**: Enhanced error message handling for connection failures. 439 | - **⌨️ Enhanced Shortcut**: When editing messages, use ctrl/cmd+enter to save and submit, and esc to close. 440 | - **🌐 Language Support**: Added support for Georgian and enhanced translations for Portuguese and Vietnamese. 441 | 442 | ### Fixed 443 | 444 | - **🔧 Model Selector**: Resolved issue where default model selection was not saving. 445 | - **🔗 Share Link Copy Button**: Fixed bug where the copy button wasn't copying links in Safari. 446 | - **🎨 Light Theme Styling**: Addressed styling issue with the light theme. 447 | 448 | ## [0.1.119] - 2024-04-16 449 | 450 | ### Added 451 | 452 | - **🌟 Enhanced RAG Embedding Support**: Ollama, and OpenAI models can now be used for RAG embedding model. 453 | - **🔄 Seamless Integration**: Copy 'ollama run ' directly from Ollama page to easily select and pull models. 454 | - **🏷️ Tagging Feature**: Add tags to chats directly via the sidebar chat menu. 455 | - **📱 Mobile Accessibility**: Swipe left and right on mobile to effortlessly open and close the sidebar. 456 | - **🔍 Improved Navigation**: Admin panel now supports pagination for user list. 457 | - **🌍 Additional Language Support**: Added Polish language support. 458 | 459 | ### Fixed 460 | 461 | - **🌍 Language Enhancements**: Vietnamese and Spanish translations have been improved. 462 | - **🔧 Helm Fixes**: Resolved issues with Helm trailing slash and manifest.json. 463 | 464 | ### Changed 465 | 466 | - **🐳 Docker Optimization**: Updated docker image build process to utilize 'uv' for significantly faster builds compared to 'pip3'. 467 | 468 | ## [0.1.118] - 2024-04-10 469 | 470 | ### Added 471 | 472 | - **🦙 Ollama and CUDA Images**: Added support for ':ollama' and ':cuda' tagged images. 473 | - **👍 Enhanced Response Rating**: Now you can annotate your ratings for better feedback. 474 | - **👤 User Initials Profile Photo**: User initials are now the default profile photo. 475 | - **🔍 Update RAG Embedding Model**: Customize RAG embedding model directly in document settings. 476 | - **🌍 Additional Language Support**: Added Turkish language support. 477 | 478 | ### Fixed 479 | 480 | - **🔒 Share Chat Permission**: Resolved issue with chat sharing permissions. 481 | - **🛠 Modal Close**: Modals can now be closed using the Esc key. 482 | 483 | ### Changed 484 | 485 | - **🎨 Admin Panel Styling**: Refreshed styling for the admin panel. 486 | - **🐳 Docker Image Build**: Updated docker image build process for improved efficiency. 487 | 488 | ## [0.1.117] - 2024-04-03 489 | 490 | ### Added 491 | 492 | - 🗨️ **Local Chat Sharing**: Share chat links seamlessly between users. 493 | - 🔑 **API Key Generation Support**: Generate secret keys to leverage Open WebUI with OpenAI libraries. 494 | - 📄 **Chat Download as PDF**: Easily download chats in PDF format. 495 | - 📝 **Improved Logging**: Enhancements to logging functionality. 496 | - 📧 **Trusted Email Authentication**: Authenticate using a trusted email header. 497 | 498 | ### Fixed 499 | 500 | - 🌷 **Enhanced Dutch Translation**: Improved translation for Dutch users. 501 | - ⚪ **White Theme Styling**: Resolved styling issue with the white theme. 502 | - 📜 **LaTeX Chat Screen Overflow**: Fixed screen overflow issue with LaTeX rendering. 503 | - 🔒 **Security Patches**: Applied necessary security patches. 504 | 505 | ## [0.1.116] - 2024-03-31 506 | 507 | ### Added 508 | 509 | - **🔄 Enhanced UI**: Model selector now conveniently located in the navbar, enabling seamless switching between multiple models during conversations. 510 | - **🔍 Improved Model Selector**: Directly pull a model from the selector/Models now display detailed information for better understanding. 511 | - **💬 Webhook Support**: Now compatible with Google Chat and Microsoft Teams. 512 | - **🌐 Localization**: Korean translation (I18n) now available. 513 | - **🌑 Dark Theme**: OLED dark theme introduced for reduced strain during prolonged usage. 514 | - **🏷️ Tag Autocomplete**: Dropdown feature added for effortless chat tagging. 515 | 516 | ### Fixed 517 | 518 | - **🔽 Auto-Scrolling**: Addressed OpenAI auto-scrolling issue. 519 | - **🏷️ Tag Validation**: Implemented tag validation to prevent empty string tags. 520 | - **🚫 Model Whitelisting**: Resolved LiteLLM model whitelisting issue. 521 | - **✅ Spelling**: Corrected various spelling issues for improved readability. 522 | 523 | ## [0.1.115] - 2024-03-24 524 | 525 | ### Added 526 | 527 | - **🔍 Custom Model Selector**: Easily find and select custom models with the new search filter feature. 528 | - **🛑 Cancel Model Download**: Added the ability to cancel model downloads. 529 | - **🎨 Image Generation ComfyUI**: Image generation now supports ComfyUI. 530 | - **🌟 Updated Light Theme**: Updated the light theme for a fresh look. 531 | - **🌍 Additional Language Support**: Now supporting Bulgarian, Italian, Portuguese, Japanese, and Dutch. 532 | 533 | ### Fixed 534 | 535 | - **🔧 Fixed Broken Experimental GGUF Upload**: Resolved issues with experimental GGUF upload functionality. 536 | 537 | ### Changed 538 | 539 | - **🔄 Vector Storage Reset Button**: Moved the reset vector storage button to document settings. 540 | 541 | ## [0.1.114] - 2024-03-20 542 | 543 | ### Added 544 | 545 | - **🔗 Webhook Integration**: Now you can subscribe to new user sign-up events via webhook. Simply navigate to the admin panel > admin settings > webhook URL. 546 | - **🛡️ Enhanced Model Filtering**: Alongside Ollama, OpenAI proxy model whitelisting, we've added model filtering functionality for LiteLLM proxy. 547 | - **🌍 Expanded Language Support**: Spanish, Catalan, and Vietnamese languages are now available, with improvements made to others. 548 | 549 | ### Fixed 550 | 551 | - **🔧 Input Field Spelling**: Resolved issue with spelling mistakes in input fields. 552 | - **🖊️ Light Mode Styling**: Fixed styling issue with light mode in document adding. 553 | 554 | ### Changed 555 | 556 | - **🔄 Language Sorting**: Languages are now sorted alphabetically by their code for improved organization. 557 | 558 | ## [0.1.113] - 2024-03-18 559 | 560 | ### Added 561 | 562 | - 🌍 **Localization**: You can now change the UI language in Settings > General. We support Ukrainian, German, Farsi (Persian), Traditional and Simplified Chinese and French translations. You can help us to translate the UI into your language! More info in our [CONTRIBUTION.md](https://github.com/open-webui/open-webui/blob/main/docs/CONTRIBUTING.md#-translations-and-internationalization). 563 | - 🎨 **System-wide Theme**: Introducing a new system-wide theme for enhanced visual experience. 564 | 565 | ### Fixed 566 | 567 | - 🌑 **Dark Background on Select Fields**: Improved readability by adding a dark background to select fields, addressing issues on certain browsers/devices. 568 | - **Multiple OPENAI_API_BASE_URLS Issue**: Resolved issue where multiple base URLs caused conflicts when one wasn't functioning. 569 | - **RAG Encoding Issue**: Fixed encoding problem in RAG. 570 | - **npm Audit Fix**: Addressed npm audit findings. 571 | - **Reduced Scroll Threshold**: Improved auto-scroll experience by reducing the scroll threshold from 50px to 5px. 572 | 573 | ### Changed 574 | 575 | - 🔄 **Sidebar UI Update**: Updated sidebar UI to feature a chat menu dropdown, replacing two icons for improved navigation. 576 | 577 | ## [0.1.112] - 2024-03-15 578 | 579 | ### Fixed 580 | 581 | - 🗨️ Resolved chat malfunction after image generation. 582 | - 🎨 Fixed various RAG issues. 583 | - 🧪 Rectified experimental broken GGUF upload logic. 584 | 585 | ## [0.1.111] - 2024-03-10 586 | 587 | ### Added 588 | 589 | - 🛡️ **Model Whitelisting**: Admins now have the ability to whitelist models for users with the 'user' role. 590 | - 🔄 **Update All Models**: Added a convenient button to update all models at once. 591 | - 📄 **Toggle PDF OCR**: Users can now toggle PDF OCR option for improved parsing performance. 592 | - 🎨 **DALL-E Integration**: Introduced DALL-E integration for image generation alongside automatic1111. 593 | - 🛠️ **RAG API Refactoring**: Refactored RAG logic and exposed its API, with additional documentation to follow. 594 | 595 | ### Fixed 596 | 597 | - 🔒 **Max Token Settings**: Added max token settings for anthropic/claude-3-sonnet-20240229 (Issue #1094). 598 | - 🔧 **Misalignment Issue**: Corrected misalignment of Edit and Delete Icons when Chat Title is Empty (Issue #1104). 599 | - 🔄 **Context Loss Fix**: Resolved RAG losing context on model response regeneration with Groq models via API key (Issue #1105). 600 | - 📁 **File Handling Bug**: Addressed File Not Found Notification when Dropping a Conversation Element (Issue #1098). 601 | - 🖱️ **Dragged File Styling**: Fixed dragged file layover styling issue. 602 | 603 | ## [0.1.110] - 2024-03-06 604 | 605 | ### Added 606 | 607 | - **🌐 Multiple OpenAI Servers Support**: Enjoy seamless integration with multiple OpenAI-compatible APIs, now supported natively. 608 | 609 | ### Fixed 610 | 611 | - **🔍 OCR Issue**: Resolved PDF parsing issue caused by OCR malfunction. 612 | - **🚫 RAG Issue**: Fixed the RAG functionality, ensuring it operates smoothly. 613 | - **📄 "Add Docs" Model Button**: Addressed the non-functional behavior of the "Add Docs" model button. 614 | 615 | ## [0.1.109] - 2024-03-06 616 | 617 | ### Added 618 | 619 | - **🔄 Multiple Ollama Servers Support**: Enjoy enhanced scalability and performance with support for multiple Ollama servers in a single WebUI. Load balancing features are now available, providing improved efficiency (#788, #278). 620 | - **🔧 Support for Claude 3 and Gemini**: Responding to user requests, we've expanded our toolset to include Claude 3 and Gemini, offering a wider range of functionalities within our platform (#1064). 621 | - **🔍 OCR Functionality for PDF Loader**: We've augmented our PDF loader with Optical Character Recognition (OCR) capabilities. Now, extract text from scanned documents and images within PDFs, broadening the scope of content processing (#1050). 622 | 623 | ### Fixed 624 | 625 | - **🛠️ RAG Collection**: Implemented a dynamic mechanism to recreate RAG collections, ensuring users have up-to-date and accurate data (#1031). 626 | - **📝 User Agent Headers**: Fixed issue of RAG web requests being sent with empty user_agent headers, reducing rejections from certain websites. Realistic headers are now utilized for these requests (#1024). 627 | - **⏹️ Playground Cancel Functionality**: Introducing a new "Cancel" option for stopping Ollama generation in the Playground, enhancing user control and usability (#1006). 628 | - **🔤 Typographical Error in 'ASSISTANT' Field**: Corrected a typographical error in the 'ASSISTANT' field within the GGUF model upload template for accuracy and consistency (#1061). 629 | 630 | ### Changed 631 | 632 | - **🔄 Refactored Message Deletion Logic**: Streamlined message deletion process for improved efficiency and user experience, simplifying interactions within the platform (#1004). 633 | - **⚠️ Deprecation of `OLLAMA_API_BASE_URL`**: Deprecated `OLLAMA_API_BASE_URL` environment variable; recommend using `OLLAMA_BASE_URL` instead. Refer to our documentation for further details. 634 | 635 | ## [0.1.108] - 2024-03-02 636 | 637 | ### Added 638 | 639 | - **🎮 Playground Feature (Beta)**: Explore the full potential of the raw API through an intuitive UI with our new playground feature, accessible to admins. Simply click on the bottom name area of the sidebar to access it. The playground feature offers two modes text completion (notebook) and chat completion. As it's in beta, please report any issues you encounter. 640 | - **🛠️ Direct Database Download for Admins**: Admins can now download the database directly from the WebUI via the admin settings. 641 | - **🎨 Additional RAG Settings**: Customize your RAG process with the ability to edit the TOP K value. Navigate to Documents > Settings > General to make changes. 642 | - **🖥️ UI Improvements**: Tooltips now available in the input area and sidebar handle. More tooltips will be added across other parts of the UI. 643 | 644 | ### Fixed 645 | 646 | - Resolved input autofocus issue on mobile when the sidebar is open, making it easier to use. 647 | - Corrected numbered list display issue in Safari (#963). 648 | - Restricted user ability to delete chats without proper permissions (#993). 649 | 650 | ### Changed 651 | 652 | - **Simplified Ollama Settings**: Ollama settings now don't require the `/api` suffix. You can now utilize the Ollama base URL directly, e.g., `http://localhost:11434`. Also, an `OLLAMA_BASE_URL` environment variable has been added. 653 | - **Database Renaming**: Starting from this release, `ollama.db` will be automatically renamed to `webui.db`. 654 | 655 | ## [0.1.107] - 2024-03-01 656 | 657 | ### Added 658 | 659 | - **🚀 Makefile and LLM Update Script**: Included Makefile and a script for LLM updates in the repository. 660 | 661 | ### Fixed 662 | 663 | - Corrected issue where links in the settings modal didn't appear clickable (#960). 664 | - Fixed problem with web UI port not taking effect due to incorrect environment variable name in run-compose.sh (#996). 665 | - Enhanced user experience by displaying chat in browser title and enabling automatic scrolling to the bottom (#992). 666 | 667 | ### Changed 668 | 669 | - Upgraded toast library from `svelte-french-toast` to `svelte-sonner` for a more polished UI. 670 | - Enhanced accessibility with the addition of dark mode on the authentication page. 671 | 672 | ## [0.1.106] - 2024-02-27 673 | 674 | ### Added 675 | 676 | - **🎯 Auto-focus Feature**: The input area now automatically focuses when initiating or opening a chat conversation. 677 | 678 | ### Fixed 679 | 680 | - Corrected typo from "HuggingFace" to "Hugging Face" (Issue #924). 681 | - Resolved bug causing errors in chat completion API calls to OpenAI due to missing "num_ctx" parameter (Issue #927). 682 | - Fixed issues preventing text editing, selection, and cursor retention in the input field (Issue #940). 683 | - Fixed a bug where defining an OpenAI-compatible API server using 'OPENAI_API_BASE_URL' containing 'openai' string resulted in hiding models not containing 'gpt' string from the model menu. (Issue #930) 684 | 685 | ## [0.1.105] - 2024-02-25 686 | 687 | ### Added 688 | 689 | - **📄 Document Selection**: Now you can select and delete multiple documents at once for easier management. 690 | 691 | ### Changed 692 | 693 | - **🏷️ Document Pre-tagging**: Simply click the "+" button at the top, enter tag names in the popup window, or select from a list of existing tags. Then, upload files with the added tags for streamlined organization. 694 | 695 | ## [0.1.104] - 2024-02-25 696 | 697 | ### Added 698 | 699 | - **🔄 Check for Updates**: Keep your system current by checking for updates conveniently located in Settings > About. 700 | - **🗑️ Automatic Tag Deletion**: Unused tags on the sidebar will now be deleted automatically with just a click. 701 | 702 | ### Changed 703 | 704 | - **🎨 Modernized Styling**: Enjoy a refreshed look with updated styling for a more contemporary experience. 705 | 706 | ## [0.1.103] - 2024-02-25 707 | 708 | ### Added 709 | 710 | - **🔗 Built-in LiteLLM Proxy**: Now includes LiteLLM proxy within Open WebUI for enhanced functionality. 711 | 712 | - Easily integrate existing LiteLLM configurations using `-v /path/to/config.yaml:/app/backend/data/litellm/config.yaml` flag. 713 | - When utilizing Docker container to run Open WebUI, ensure connections to localhost use `host.docker.internal`. 714 | 715 | - **🖼️ Image Generation Enhancements**: Introducing Advanced Settings with Image Preview Feature. 716 | - Customize image generation by setting the number of steps; defaults to A1111 value. 717 | 718 | ### Fixed 719 | 720 | - Resolved issue with RAG scan halting document loading upon encountering unsupported MIME types or exceptions (Issue #866). 721 | 722 | ### Changed 723 | 724 | - Ollama is no longer required to run Open WebUI. 725 | - Access our comprehensive documentation at [Open WebUI Documentation](https://docs.openwebui.com/). 726 | 727 | ## [0.1.102] - 2024-02-22 728 | 729 | ### Added 730 | 731 | - **🖼️ Image Generation**: Generate Images using the AUTOMATIC1111/stable-diffusion-webui API. You can set this up in Settings > Images. 732 | - **📝 Change title generation prompt**: Change the prompt used to generate titles for your chats. You can set this up in the Settings > Interface. 733 | - **🤖 Change embedding model**: Change the embedding model used to generate embeddings for your chats in the Dockerfile. Use any sentence transformer model from huggingface.co. 734 | - **📢 CHANGELOG.md/Popup**: This popup will show you the latest changes. 735 | 736 | ## [0.1.101] - 2024-02-22 737 | 738 | ### Fixed 739 | 740 | - LaTex output formatting issue (#828) 741 | 742 | ### Changed 743 | 744 | - Instead of having the previous 1.0.0-alpha.101, we switched to semantic versioning as a way to respect global conventions. ``````` `\\?\D:\Coding\ai\CODE_OF_CONDUCT.md`: ```````md 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. 13 | 14 | ## Our Standards 15 | 16 | Examples of behavior that contribute to a positive environment for our community include: 17 | 18 | - Demonstrating empathy and kindness toward other people 19 | - Being respectful of differing opinions, viewpoints, and experiences 20 | - Giving and gracefully accepting constructive feedback 21 | - Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience 22 | - Focusing on what is best not just for us as individuals, but for the overall community 23 | 24 | Examples of unacceptable behavior include: 25 | 26 | - The use of sexualized language or imagery, and sexual attention or advances of any kind 27 | - Trolling, insulting or derogatory comments, and personal or political attacks 28 | - Public or private harassment 29 | - Publishing others' private information, such as a physical or email address, without their explicit permission 30 | - **Spamming of any kind** 31 | - Aggressive sales tactics targeting our community members are strictly prohibited. You can mention your product if it's relevant to the discussion, but under no circumstances should you push it forcefully 32 | - Other conduct which could reasonably be considered inappropriate in a professional setting 33 | 34 | ## Enforcement Responsibilities 35 | 36 | Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. 37 | 38 | ## Scope 39 | 40 | This Code of Conduct applies within all community spaces and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. 41 | 42 | ## Enforcement 43 | 44 | Instances of abusive, harassing, spamming, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at hello@openwebui.com. All complaints will be reviewed and investigated promptly and fairly. 45 | 46 | All community leaders are obligated to respect the privacy and security of the reporter of any incident. 47 | 48 | ## Enforcement Guidelines 49 | 50 | Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: 51 | 52 | ### 1. Temporary Ban 53 | 54 | **Community Impact**: Any violation of community standards, including but not limited to inappropriate language, unprofessional behavior, harassment, or spamming. 55 | 56 | **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. 57 | 58 | ### 2. Permanent Ban 59 | 60 | **Community Impact**: Repeated or severe violations of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. 61 | 62 | **Consequence**: A permanent ban from any sort of public interaction within the community. 63 | 64 | ## Attribution 65 | 66 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 67 | version 2.0, available at 68 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 69 | 70 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 71 | enforcement ladder](https://github.com/mozilla/diversity). 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see the FAQ at 76 | https://www.contributor-covenant.org/faq. Translations are available at 77 | https://www.contributor-covenant.org/translations. ``````` `\\?\D:\Coding\ai\confirm_remove.sh`: ```````sh 1 | #!/bin/bash 2 | echo "Warning: This will remove all containers and volumes, including persistent data. Do you want to continue? [Y/N]" 3 | read ans 4 | if [ "$ans" == "Y" ] || [ "$ans" == "y" ]; then 5 | command docker-compose 2>/dev/null 6 | if [ "$?" == "0" ]; then 7 | docker-compose down -v 8 | else 9 | docker compose down -v 10 | fi 11 | else 12 | echo "Operation cancelled." 13 | fi ``````` `\\?\D:\Coding\ai\cypress\data\example-doc.txt`: ```````txt 1 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pellentesque elit eget gravida cum sociis natoque. Morbi tristique senectus et netus et malesuada. Sapien nec sagittis aliquam malesuada bibendum. Amet consectetur adipiscing elit duis tristique sollicitudin. Non pulvinar neque laoreet suspendisse interdum consectetur libero. Arcu cursus vitae congue mauris rhoncus aenean vel elit scelerisque. Nec feugiat nisl pretium fusce id velit. Imperdiet proin fermentum leo vel. Arcu dui vivamus arcu felis bibendum ut tristique et egestas. Pellentesque sit amet porttitor eget dolor morbi non arcu risus. Egestas tellus rutrum tellus pellentesque eu tincidunt tortor aliquam. Et ultrices neque ornare aenean euismod. 2 | 3 | Enim nulla aliquet porttitor lacus luctus accumsan tortor posuere ac. Viverra nibh cras pulvinar mattis nunc. Lacinia at quis risus sed vulputate. Ac tortor vitae purus faucibus ornare suspendisse sed nisi lacus. Bibendum arcu vitae elementum curabitur vitae nunc. Consectetur adipiscing elit duis tristique sollicitudin nibh sit amet commodo. Velit egestas dui id ornare arcu odio ut. Et malesuada fames ac turpis egestas integer eget aliquet. Lacus suspendisse faucibus interdum posuere lorem ipsum dolor sit. Morbi tristique senectus et netus. Pretium viverra suspendisse potenti nullam ac tortor vitae. Parturient montes nascetur ridiculus mus mauris vitae. Quis viverra nibh cras pulvinar mattis nunc sed blandit libero. Euismod nisi porta lorem mollis aliquam ut porttitor leo. Mauris in aliquam sem fringilla ut morbi. Faucibus pulvinar elementum integer enim neque. Neque sodales ut etiam sit. Consectetur a erat nam at. 4 | 5 | Sed nisi lacus sed viverra tellus in hac habitasse. Proin sagittis nisl rhoncus mattis rhoncus. Risus commodo viverra maecenas accumsan lacus. Morbi quis commodo odio aenean sed adipiscing. Mollis nunc sed id semper risus in. Ultricies mi eget mauris pharetra et ultrices neque. Amet luctus venenatis lectus magna fringilla urna porttitor rhoncus. Eget magna fermentum iaculis eu non diam phasellus. Id diam maecenas ultricies mi eget mauris pharetra et ultrices. Id donec ultrices tincidunt arcu non sodales. Sed cras ornare arcu dui vivamus arcu felis bibendum ut. Urna duis convallis convallis tellus id interdum velit. Rhoncus mattis rhoncus urna neque viverra justo nec. Purus semper eget duis at tellus at urna condimentum. Et odio pellentesque diam volutpat commodo sed egestas. Blandit volutpat maecenas volutpat blandit. In egestas erat imperdiet sed euismod nisi porta lorem mollis. Est ullamcorper eget nulla facilisi etiam dignissim. 6 | 7 | Justo nec ultrices dui sapien eget mi proin sed. Purus gravida quis blandit turpis cursus in hac. Placerat orci nulla pellentesque dignissim enim sit. Morbi tristique senectus et netus et malesuada fames ac. Consequat mauris nunc congue nisi. Eu lobortis elementum nibh tellus molestie nunc non blandit. Viverra justo nec ultrices dui. Morbi non arcu risus quis. Elementum sagittis vitae et leo duis. Lectus mauris ultrices eros in cursus. Neque laoreet suspendisse interdum consectetur. 8 | 9 | Facilisis gravida neque convallis a cras. Nisl rhoncus mattis rhoncus urna neque viverra justo. Faucibus purus in massa tempor. Lacus laoreet non curabitur gravida arcu ac tortor. Tincidunt eget nullam non nisi est sit amet. Ornare lectus sit amet est placerat in egestas. Sollicitudin tempor id eu nisl nunc mi. Scelerisque viverra mauris in aliquam sem fringilla ut. Ullamcorper sit amet risus nullam. Mauris rhoncus aenean vel elit scelerisque mauris pellentesque pulvinar. Velit euismod in pellentesque massa placerat duis ultricies lacus. Pharetra magna ac placerat vestibulum lectus mauris ultrices eros in. Lorem ipsum dolor sit amet. Sit amet mauris commodo quis imperdiet. Quam pellentesque nec nam aliquam sem et tortor. Amet nisl purus in mollis nunc. Sed risus pretium quam vulputate dignissim suspendisse in est. Nisl condimentum id venenatis a condimentum. Velit euismod in pellentesque massa. Quam id leo in vitae turpis massa sed. ``````` `\\?\D:\Coding\ai\cypress\e2e\chat.cy.ts`: ```````ts 1 | // eslint-disable-next-line @typescript-eslint/triple-slash-reference 2 | /// 3 | 4 | // These tests run through the chat flow. 5 | describe('Settings', () => { 6 | // Wait for 2 seconds after all tests to fix an issue with Cypress's video recording missing the last few frames 7 | after(() => { 8 | // eslint-disable-next-line cypress/no-unnecessary-waiting 9 | cy.wait(2000); 10 | }); 11 | 12 | beforeEach(() => { 13 | // Login as the admin user 14 | cy.loginAdmin(); 15 | // Visit the home page 16 | cy.visit('/'); 17 | }); 18 | 19 | context('Ollama', () => { 20 | it('user can select a model', () => { 21 | // Click on the model selector 22 | cy.get('button[aria-label="Select a model"]').click(); 23 | // Select the first model 24 | cy.get('button[aria-label="model-item"]').first().click(); 25 | }); 26 | 27 | it('user can perform text chat', () => { 28 | // Click on the model selector 29 | cy.get('button[aria-label="Select a model"]').click(); 30 | // Select the first model 31 | cy.get('button[aria-label="model-item"]').first().click(); 32 | // Type a message 33 | cy.get('#chat-textarea').type('Hi, what can you do? A single sentence only please.', { 34 | force: true 35 | }); 36 | // Send the message 37 | cy.get('button[type="submit"]').click(); 38 | // User's message should be visible 39 | cy.get('.chat-user').should('exist'); 40 | // Wait for the response 41 | cy.get('.chat-assistant', { timeout: 120_000 }) // .chat-assistant is created after the first token is received 42 | .find('div[aria-label="Generation Info"]', { timeout: 120_000 }) // Generation Info is created after the stop token is received 43 | .should('exist'); 44 | }); 45 | 46 | it('user can share chat', () => { 47 | // Click on the model selector 48 | cy.get('button[aria-label="Select a model"]').click(); 49 | // Select the first model 50 | cy.get('button[aria-label="model-item"]').first().click(); 51 | // Type a message 52 | cy.get('#chat-textarea').type('Hi, what can you do? A single sentence only please.', { 53 | force: true 54 | }); 55 | // Send the message 56 | cy.get('button[type="submit"]').click(); 57 | // User's message should be visible 58 | cy.get('.chat-user').should('exist'); 59 | // Wait for the response 60 | cy.get('.chat-assistant', { timeout: 120_000 }) // .chat-assistant is created after the first token is received 61 | .find('div[aria-label="Generation Info"]', { timeout: 120_000 }) // Generation Info is created after the stop token is received 62 | .should('exist'); 63 | // spy on requests 64 | const spy = cy.spy(); 65 | cy.intercept('GET', '/api/v1/chats/*', spy); 66 | // Open context menu 67 | cy.get('#chat-context-menu-button').click(); 68 | // Click share button 69 | cy.get('#chat-share-button').click(); 70 | // Check if the share dialog is visible 71 | cy.get('#copy-and-share-chat-button').should('exist'); 72 | cy.wrap({}, { timeout: 5000 }).should(() => { 73 | // Check if the request was made twice (once for to replace chat object and once more due to change event) 74 | expect(spy).to.be.callCount(2); 75 | }); 76 | }); 77 | 78 | it('user can generate image', () => { 79 | // Click on the model selector 80 | cy.get('button[aria-label="Select a model"]').click(); 81 | // Select the first model 82 | cy.get('button[aria-label="model-item"]').first().click(); 83 | // Type a message 84 | cy.get('#chat-textarea').type('Hi, what can you do? A single sentence only please.', { 85 | force: true 86 | }); 87 | // Send the message 88 | cy.get('button[type="submit"]').click(); 89 | // User's message should be visible 90 | cy.get('.chat-user').should('exist'); 91 | // Wait for the response 92 | cy.get('.chat-assistant', { timeout: 120_000 }) // .chat-assistant is created after the first token is received 93 | .find('div[aria-label="Generation Info"]', { timeout: 120_000 }) // Generation Info is created after the stop token is received 94 | .should('exist'); 95 | // Click on the generate image button 96 | cy.get('[aria-label="Generate Image"]').click(); 97 | // Wait for image to be visible 98 | cy.get('img[data-cy="image"]', { timeout: 60_000 }).should('be.visible'); 99 | }); 100 | }); 101 | }); ``````` `\\?\D:\Coding\ai\cypress\e2e\documents.cy.ts`: ```````ts 1 | // eslint-disable-next-line @typescript-eslint/triple-slash-reference 2 | /// 3 | 4 | describe('Documents', () => { 5 | const timestamp = Date.now(); 6 | 7 | before(() => { 8 | cy.uploadTestDocument(timestamp); 9 | }); 10 | 11 | after(() => { 12 | cy.deleteTestDocument(timestamp); 13 | }); 14 | 15 | context('Admin', () => { 16 | beforeEach(() => { 17 | // Login as the admin user 18 | cy.loginAdmin(); 19 | // Visit the home page 20 | cy.visit('/workspace/documents'); 21 | cy.get('button').contains('#cypress-test').click(); 22 | }); 23 | 24 | it('can see documents', () => { 25 | cy.get('div').contains(`document-test-initial-${timestamp}.txt`).should('have.length', 1); 26 | }); 27 | 28 | it('can see edit button', () => { 29 | cy.get('div') 30 | .contains(`document-test-initial-${timestamp}.txt`) 31 | .get("button[aria-label='Edit Doc']") 32 | .should('exist'); 33 | }); 34 | 35 | it('can see delete button', () => { 36 | cy.get('div') 37 | .contains(`document-test-initial-${timestamp}.txt`) 38 | .get("button[aria-label='Delete Doc']") 39 | .should('exist'); 40 | }); 41 | 42 | it('can see upload button', () => { 43 | cy.get("button[aria-label='Add Docs']").should('exist'); 44 | }); 45 | }); 46 | }); ``````` `\\?\D:\Coding\ai\cypress\e2e\registration.cy.ts`: ```````ts 1 | // eslint-disable-next-line @typescript-eslint/triple-slash-reference 2 | /// 3 | import { adminUser } from '../support/e2e'; 4 | 5 | // These tests assume the following defaults: 6 | // 1. No users exist in the database or that the test admin user is an admin 7 | // 2. Language is set to English 8 | // 3. The default role for new users is 'pending' 9 | describe('Registration and Login', () => { 10 | // Wait for 2 seconds after all tests to fix an issue with Cypress's video recording missing the last few frames 11 | after(() => { 12 | // eslint-disable-next-line cypress/no-unnecessary-waiting 13 | cy.wait(2000); 14 | }); 15 | 16 | beforeEach(() => { 17 | cy.visit('/'); 18 | }); 19 | 20 | it('should register a new user as pending', () => { 21 | const userName = `Test User - ${Date.now()}`; 22 | const userEmail = `cypress-${Date.now()}@example.com`; 23 | // Toggle from sign in to sign up 24 | cy.contains('Sign up').click(); 25 | // Fill out the form 26 | cy.get('input[autocomplete="name"]').type(userName); 27 | cy.get('input[autocomplete="email"]').type(userEmail); 28 | cy.get('input[type="password"]').type('password'); 29 | // Submit the form 30 | cy.get('button[type="submit"]').click(); 31 | // Wait until the user is redirected to the home page 32 | cy.contains(userName); 33 | // Expect the user to be pending 34 | cy.contains('Check Again'); 35 | }); 36 | 37 | it('can login with the admin user', () => { 38 | // Fill out the form 39 | cy.get('input[autocomplete="email"]').type(adminUser.email); 40 | cy.get('input[type="password"]').type(adminUser.password); 41 | // Submit the form 42 | cy.get('button[type="submit"]').click(); 43 | // Wait until the user is redirected to the home page 44 | cy.contains(adminUser.name); 45 | // Dismiss the changelog dialog if it is visible 46 | cy.getAllLocalStorage().then((ls) => { 47 | if (!ls['version']) { 48 | cy.get('button').contains("Okay, Let's Go!").click(); 49 | } 50 | }); 51 | }); 52 | }); ``````` `\\?\D:\Coding\ai\cypress\e2e\settings.cy.ts`: ```````ts 1 | // eslint-disable-next-line @typescript-eslint/triple-slash-reference 2 | /// 3 | import { adminUser } from '../support/e2e'; 4 | 5 | // These tests run through the various settings pages, ensuring that the user can interact with them as expected 6 | describe('Settings', () => { 7 | // Wait for 2 seconds after all tests to fix an issue with Cypress's video recording missing the last few frames 8 | after(() => { 9 | // eslint-disable-next-line cypress/no-unnecessary-waiting 10 | cy.wait(2000); 11 | }); 12 | 13 | beforeEach(() => { 14 | // Login as the admin user 15 | cy.loginAdmin(); 16 | // Visit the home page 17 | cy.visit('/'); 18 | // Click on the user menu 19 | cy.get('button[aria-label="User Menu"]').click(); 20 | // Click on the settings link 21 | cy.get('button').contains('Settings').click(); 22 | }); 23 | 24 | context('General', () => { 25 | it('user can open the General modal and hit save', () => { 26 | cy.get('button').contains('General').click(); 27 | cy.get('button').contains('Save').click(); 28 | }); 29 | }); 30 | 31 | context('Interface', () => { 32 | it('user can open the Interface modal and hit save', () => { 33 | cy.get('button').contains('Interface').click(); 34 | cy.get('button').contains('Save').click(); 35 | }); 36 | }); 37 | 38 | context('Audio', () => { 39 | it('user can open the Audio modal and hit save', () => { 40 | cy.get('button').contains('Audio').click(); 41 | cy.get('button').contains('Save').click(); 42 | }); 43 | }); 44 | 45 | context('Chats', () => { 46 | it('user can open the Chats modal', () => { 47 | cy.get('button').contains('Chats').click(); 48 | }); 49 | }); 50 | 51 | context('Account', () => { 52 | it('user can open the Account modal and hit save', () => { 53 | cy.get('button').contains('Account').click(); 54 | cy.get('button').contains('Save').click(); 55 | }); 56 | }); 57 | 58 | context('About', () => { 59 | it('user can open the About modal', () => { 60 | cy.get('button').contains('About').click(); 61 | }); 62 | }); 63 | }); ``````` `\\?\D:\Coding\ai\cypress\support\e2e.ts`: ```````ts 1 | /// 2 | // eslint-disable-next-line @typescript-eslint/triple-slash-reference 3 | /// 4 | 5 | export const adminUser = { 6 | name: 'Admin User', 7 | email: 'admin@example.com', 8 | password: 'password' 9 | }; 10 | 11 | const login = (email: string, password: string) => { 12 | return cy.session( 13 | email, 14 | () => { 15 | // Make sure to test against us english to have stable tests, 16 | // regardless on local language preferences 17 | localStorage.setItem('locale', 'en-US'); 18 | // Visit auth page 19 | cy.visit('/auth'); 20 | // Fill out the form 21 | cy.get('input[autocomplete="email"]').type(email); 22 | cy.get('input[type="password"]').type(password); 23 | // Submit the form 24 | cy.get('button[type="submit"]').click(); 25 | // Wait until the user is redirected to the home page 26 | cy.get('#chat-search').should('exist'); 27 | // Get the current version to skip the changelog dialog 28 | if (localStorage.getItem('version') === null) { 29 | cy.get('button').contains("Okay, Let's Go!").click(); 30 | } 31 | }, 32 | { 33 | validate: () => { 34 | cy.request({ 35 | method: 'GET', 36 | url: '/api/v1/auths/', 37 | headers: { 38 | Authorization: 'Bearer ' + localStorage.getItem('token') 39 | } 40 | }); 41 | } 42 | } 43 | ); 44 | }; 45 | 46 | const register = (name: string, email: string, password: string) => { 47 | return cy 48 | .request({ 49 | method: 'POST', 50 | url: '/api/v1/auths/signup', 51 | body: { 52 | name: name, 53 | email: email, 54 | password: password 55 | }, 56 | failOnStatusCode: false 57 | }) 58 | .then((response) => { 59 | expect(response.status).to.be.oneOf([200, 400]); 60 | }); 61 | }; 62 | 63 | const registerAdmin = () => { 64 | return register(adminUser.name, adminUser.email, adminUser.password); 65 | }; 66 | 67 | const loginAdmin = () => { 68 | return login(adminUser.email, adminUser.password); 69 | }; 70 | 71 | Cypress.Commands.add('login', (email, password) => login(email, password)); 72 | Cypress.Commands.add('register', (name, email, password) => register(name, email, password)); 73 | Cypress.Commands.add('registerAdmin', () => registerAdmin()); 74 | Cypress.Commands.add('loginAdmin', () => loginAdmin()); 75 | 76 | Cypress.Commands.add('uploadTestDocument', (suffix: any) => { 77 | // Login as admin 78 | cy.loginAdmin(); 79 | // upload example document 80 | cy.visit('/workspace/documents'); 81 | // Create a document 82 | cy.get("button[aria-label='Add Docs']").click(); 83 | cy.readFile('cypress/data/example-doc.txt').then((text) => { 84 | // select file 85 | cy.get('#upload-doc-input').selectFile( 86 | { 87 | contents: Cypress.Buffer.from(text + Date.now()), 88 | fileName: `document-test-initial-${suffix}.txt`, 89 | mimeType: 'text/plain', 90 | lastModified: Date.now() 91 | }, 92 | { 93 | force: true 94 | } 95 | ); 96 | // open tag input 97 | cy.get("button[aria-label='Add Tag']").click(); 98 | cy.get("input[placeholder='Add a tag']").type('cypress-test'); 99 | cy.get("button[aria-label='Save Tag']").click(); 100 | 101 | // submit to upload 102 | cy.get("button[type='submit']").click(); 103 | 104 | // wait for upload to finish 105 | cy.get('button').contains('#cypress-test').should('exist'); 106 | cy.get('div').contains(`document-test-initial-${suffix}.txt`).should('exist'); 107 | }); 108 | }); 109 | 110 | Cypress.Commands.add('deleteTestDocument', (suffix: any) => { 111 | cy.loginAdmin(); 112 | cy.visit('/workspace/documents'); 113 | // clean up uploaded documents 114 | cy.get('div') 115 | .contains(`document-test-initial-${suffix}.txt`) 116 | .find("button[aria-label='Delete Doc']") 117 | .click(); 118 | }); 119 | 120 | before(() => { 121 | cy.registerAdmin(); 122 | }); ``````` `\\?\D:\Coding\ai\cypress\support\index.d.ts`: ```````ts 1 | // load the global Cypress types 2 | /// 3 | 4 | declare namespace Cypress { 5 | interface Chainable { 6 | login(email: string, password: string): Chainable; 7 | register(name: string, email: string, password: string): Chainable; 8 | registerAdmin(): Chainable; 9 | loginAdmin(): Chainable; 10 | uploadTestDocument(suffix: any): Chainable; 11 | deleteTestDocument(suffix: any): Chainable; 12 | } 13 | } ``````` `\\?\D:\Coding\ai\cypress\tsconfig.json`: ```````json 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "inlineSourceMap": true, 5 | "sourceMap": false 6 | } 7 | } ``````` `\\?\D:\Coding\ai\cypress.config.ts`: ```````ts 1 | import { defineConfig } from 'cypress'; 2 | 3 | export default defineConfig({ 4 | e2e: { 5 | baseUrl: 'http://localhost:8080' 6 | }, 7 | video: true 8 | }); ``````` `\\?\D:\Coding\ai\docker-compose.a1111-test.yaml`: ```````yaml 1 | # This is an overlay that spins up stable-diffusion-webui for integration testing 2 | # This is not designed to be used in production 3 | services: 4 | stable-diffusion-webui: 5 | # Not built for ARM64 6 | platform: linux/amd64 7 | image: ghcr.io/neggles/sd-webui-docker:latest 8 | restart: unless-stopped 9 | environment: 10 | CLI_ARGS: "--api --use-cpu all --precision full --no-half --skip-torch-cuda-test --ckpt /empty.pt --do-not-download-clip --disable-nan-check --disable-opt-split-attention" 11 | PYTHONUNBUFFERED: "1" 12 | TERM: "vt100" 13 | SD_WEBUI_VARIANT: "default" 14 | # Hack to get container working on Apple Silicon 15 | # Rosetta creates a conflict ${HOME}/.cache folder 16 | entrypoint: /bin/bash 17 | command: 18 | - -c 19 | - | 20 | export HOME=/root-home 21 | rm -rf $${HOME}/.cache 22 | /docker/entrypoint.sh python -u webui.py --listen --port $${WEBUI_PORT} --skip-version-check $${CLI_ARGS} 23 | volumes: 24 | - ./test/test_files/image_gen/sd-empty.pt:/empty.pt 25 | 26 | open-webui: 27 | environment: 28 | ENABLE_IMAGE_GENERATION: "true" 29 | AUTOMATIC1111_BASE_URL: http://stable-diffusion-webui:7860 30 | IMAGE_SIZE: "64x64" 31 | IMAGE_STEPS: "3" ``````` `\\?\D:\Coding\ai\docker-compose.amdgpu.yaml`: ```````yaml 1 | services: 2 | ollama: 3 | devices: 4 | - /dev/kfd:/dev/kfd 5 | - /dev/dri:/dev/dri 6 | image: ollama/ollama:${OLLAMA_DOCKER_TAG-rocm} 7 | environment: 8 | - 'HSA_OVERRIDE_GFX_VERSION=${HSA_OVERRIDE_GFX_VERSION-11.0.0}' ``````` `\\?\D:\Coding\ai\docker-compose.api.yaml`: ```````yaml 1 | services: 2 | ollama: 3 | # Expose Ollama API outside the container stack 4 | ports: 5 | - ${OLLAMA_WEBAPI_PORT-11434}:11434 ``````` `\\?\D:\Coding\ai\docker-compose.data.yaml`: ```````yaml 1 | services: 2 | ollama: 3 | volumes: 4 | - ${OLLAMA_DATA_DIR-./ollama-data}:/root/.ollama ``````` `\\?\D:\Coding\ai\docker-compose.gpu.yaml`: ```````yaml 1 | services: 2 | ollama: 3 | # GPU support 4 | deploy: 5 | resources: 6 | reservations: 7 | devices: 8 | - driver: ${OLLAMA_GPU_DRIVER-nvidia} 9 | count: ${OLLAMA_GPU_COUNT-1} 10 | capabilities: 11 | - gpu ``````` `\\?\D:\Coding\ai\docker-compose.yaml`: ```````yaml 1 | services: 2 | ollama: 3 | volumes: 4 | - ollama:/root/.ollama 5 | container_name: ollama 6 | pull_policy: always 7 | tty: true 8 | restart: unless-stopped 9 | image: ollama/ollama:${OLLAMA_DOCKER_TAG-latest} 10 | 11 | open-webui: 12 | build: 13 | context: . 14 | args: 15 | OLLAMA_BASE_URL: '/ollama' 16 | dockerfile: Dockerfile 17 | image: ghcr.io/open-webui/open-webui:${WEBUI_DOCKER_TAG-main} 18 | container_name: open-webui 19 | volumes: 20 | - open-webui:/app/backend/data 21 | depends_on: 22 | - ollama 23 | ports: 24 | - ${OPEN_WEBUI_PORT-3000}:8080 25 | environment: 26 | - 'OLLAMA_BASE_URL=http://ollama:11434' 27 | - 'WEBUI_SECRET_KEY=' 28 | extra_hosts: 29 | - host.docker.internal:host-gateway 30 | restart: unless-stopped 31 | 32 | volumes: 33 | ollama: {} 34 | open-webui: {} ``````` `\\?\D:\Coding\ai\Dockerfile`: ``````` 1 | # syntax=docker/dockerfile:1 2 | # Initialize device type args 3 | # use build args in the docker build commmand with --build-arg="BUILDARG=true" 4 | ARG USE_CUDA=false 5 | ARG USE_OLLAMA=false 6 | # Tested with cu117 for CUDA 11 and cu121 for CUDA 12 (default) 7 | ARG USE_CUDA_VER=cu121 8 | # any sentence transformer model; models to use can be found at https://huggingface.co/models?library=sentence-transformers 9 | # Leaderboard: https://huggingface.co/spaces/mteb/leaderboard 10 | # for better performance and multilangauge support use "intfloat/multilingual-e5-large" (~2.5GB) or "intfloat/multilingual-e5-base" (~1.5GB) 11 | # IMPORTANT: If you change the embedding model (sentence-transformers/all-MiniLM-L6-v2) and vice versa, you aren't able to use RAG Chat with your previous documents loaded in the WebUI! You need to re-embed them. 12 | ARG USE_EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2 13 | ARG USE_RERANKING_MODEL="" 14 | ARG BUILD_HASH=dev-build 15 | # Override at your own risk - non-root configurations are untested 16 | ARG UID=0 17 | ARG GID=0 18 | 19 | ######## WebUI frontend ######## 20 | FROM --platform=$BUILDPLATFORM node:21-alpine3.19 as build 21 | ARG BUILD_HASH 22 | 23 | WORKDIR /app 24 | 25 | COPY package.json package-lock.json ./ 26 | RUN npm ci 27 | 28 | COPY . . 29 | ENV APP_BUILD_HASH=${BUILD_HASH} 30 | RUN npm run build 31 | 32 | ######## WebUI backend ######## 33 | FROM python:3.11-slim-bookworm as base 34 | 35 | # Use args 36 | ARG USE_CUDA 37 | ARG USE_OLLAMA 38 | ARG USE_CUDA_VER 39 | ARG USE_EMBEDDING_MODEL 40 | ARG USE_RERANKING_MODEL 41 | ARG UID 42 | ARG GID 43 | 44 | ## Basis ## 45 | ENV ENV=prod \ 46 | PORT=8080 \ 47 | # pass build args to the build 48 | USE_OLLAMA_DOCKER=${USE_OLLAMA} \ 49 | USE_CUDA_DOCKER=${USE_CUDA} \ 50 | USE_CUDA_DOCKER_VER=${USE_CUDA_VER} \ 51 | USE_EMBEDDING_MODEL_DOCKER=${USE_EMBEDDING_MODEL} \ 52 | USE_RERANKING_MODEL_DOCKER=${USE_RERANKING_MODEL} 53 | 54 | ## Basis URL Config ## 55 | ENV OLLAMA_BASE_URL="/ollama" \ 56 | OPENAI_API_BASE_URL="" 57 | 58 | ## API Key and Security Config ## 59 | ENV OPENAI_API_KEY="" \ 60 | WEBUI_SECRET_KEY="" \ 61 | SCARF_NO_ANALYTICS=true \ 62 | DO_NOT_TRACK=true \ 63 | ANONYMIZED_TELEMETRY=false 64 | 65 | #### Other models ######################################################### 66 | ## whisper TTS model settings ## 67 | ENV WHISPER_MODEL="base" \ 68 | WHISPER_MODEL_DIR="/app/backend/data/cache/whisper/models" 69 | 70 | ## RAG Embedding model settings ## 71 | ENV RAG_EMBEDDING_MODEL="$USE_EMBEDDING_MODEL_DOCKER" \ 72 | RAG_RERANKING_MODEL="$USE_RERANKING_MODEL_DOCKER" \ 73 | SENTENCE_TRANSFORMERS_HOME="/app/backend/data/cache/embedding/models" 74 | 75 | ## Hugging Face download cache ## 76 | ENV HF_HOME="/app/backend/data/cache/embedding/models" 77 | #### Other models ########################################################## 78 | 79 | WORKDIR /app/backend 80 | 81 | ENV HOME /root 82 | # Create user and group if not root 83 | RUN if [ $UID -ne 0 ]; then \ 84 | if [ $GID -ne 0 ]; then \ 85 | addgroup --gid $GID app; \ 86 | fi; \ 87 | adduser --uid $UID --gid $GID --home $HOME --disabled-password --no-create-home app; \ 88 | fi 89 | 90 | RUN mkdir -p $HOME/.cache/chroma 91 | RUN echo -n 00000000-0000-0000-0000-000000000000 > $HOME/.cache/chroma/telemetry_user_id 92 | 93 | # Make sure the user has access to the app and root directory 94 | RUN chown -R $UID:$GID /app $HOME 95 | 96 | RUN if [ "$USE_OLLAMA" = "true" ]; then \ 97 | apt-get update && \ 98 | # Install pandoc and netcat 99 | apt-get install -y --no-install-recommends pandoc netcat-openbsd curl && \ 100 | apt-get install -y --no-install-recommends gcc python3-dev && \ 101 | # for RAG OCR 102 | apt-get install -y --no-install-recommends ffmpeg libsm6 libxext6 && \ 103 | # install helper tools 104 | apt-get install -y --no-install-recommends curl jq && \ 105 | # install ollama 106 | curl -fsSL https://ollama.com/install.sh | sh && \ 107 | # cleanup 108 | rm -rf /var/lib/apt/lists/*; \ 109 | else \ 110 | apt-get update && \ 111 | # Install pandoc, netcat and gcc 112 | apt-get install -y --no-install-recommends pandoc gcc netcat-openbsd curl jq && \ 113 | apt-get install -y --no-install-recommends gcc python3-dev && \ 114 | # for RAG OCR 115 | apt-get install -y --no-install-recommends ffmpeg libsm6 libxext6 && \ 116 | # cleanup 117 | rm -rf /var/lib/apt/lists/*; \ 118 | fi 119 | 120 | # install python dependencies 121 | COPY --chown=$UID:$GID ./backend/requirements.txt ./requirements.txt 122 | 123 | RUN pip3 install uv && \ 124 | if [ "$USE_CUDA" = "true" ]; then \ 125 | # If you use CUDA the whisper and embedding model will be downloaded on first use 126 | pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/$USE_CUDA_DOCKER_VER --no-cache-dir && \ 127 | uv pip install --system -r requirements.txt --no-cache-dir && \ 128 | python -c "import os; from sentence_transformers import SentenceTransformer; SentenceTransformer(os.environ['RAG_EMBEDDING_MODEL'], device='cpu')" && \ 129 | python -c "import os; from faster_whisper import WhisperModel; WhisperModel(os.environ['WHISPER_MODEL'], device='cpu', compute_type='int8', download_root=os.environ['WHISPER_MODEL_DIR'])"; \ 130 | else \ 131 | pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu --no-cache-dir && \ 132 | uv pip install --system -r requirements.txt --no-cache-dir && \ 133 | python -c "import os; from sentence_transformers import SentenceTransformer; SentenceTransformer(os.environ['RAG_EMBEDDING_MODEL'], device='cpu')" && \ 134 | python -c "import os; from faster_whisper import WhisperModel; WhisperModel(os.environ['WHISPER_MODEL'], device='cpu', compute_type='int8', download_root=os.environ['WHISPER_MODEL_DIR'])"; \ 135 | fi; \ 136 | chown -R $UID:$GID /app/backend/data/ 137 | 138 | 139 | 140 | # copy embedding weight from build 141 | # RUN mkdir -p /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2 142 | # COPY --from=build /app/onnx /root/.cache/chroma/onnx_models/all-MiniLM-L6-v2/onnx 143 | 144 | # copy built frontend files 145 | COPY --chown=$UID:$GID --from=build /app/build /app/build 146 | COPY --chown=$UID:$GID --from=build /app/CHANGELOG.md /app/CHANGELOG.md 147 | COPY --chown=$UID:$GID --from=build /app/package.json /app/package.json 148 | 149 | # copy backend files 150 | COPY --chown=$UID:$GID ./backend . 151 | 152 | EXPOSE 8080 153 | 154 | HEALTHCHECK CMD curl --silent --fail http://localhost:8080/health | jq -e '.status == true' || exit 1 155 | 156 | USER $UID:$GID 157 | 158 | ARG BUILD_HASH 159 | ENV WEBUI_BUILD_VERSION=${BUILD_HASH} 160 | 161 | CMD [ "bash", "start.sh"] ``````` `\\?\D:\Coding\ai\docs\apache.md`: ```````md 1 | # Hosting UI and Models separately 2 | 3 | Sometimes, its beneficial to host Ollama, separate from the UI, but retain the RAG and RBAC support features shared across users: 4 | 5 | # Open WebUI Configuration 6 | 7 | ## UI Configuration 8 | 9 | For the UI configuration, you can set up the Apache VirtualHost as follows: 10 | 11 | ``` 12 | # Assuming you have a website hosting this UI at "server.com" 13 | 14 | ServerName server.com 15 | DocumentRoot /home/server/public_html 16 | 17 | ProxyPass / http://server.com:3000/ nocanon 18 | ProxyPassReverse / http://server.com:3000/ 19 | 20 | 21 | ``` 22 | 23 | Enable the site first before you can request SSL: 24 | 25 | `a2ensite server.com.conf` # this will enable the site. a2ensite is short for "Apache 2 Enable Site" 26 | 27 | ``` 28 | # For SSL 29 | 30 | ServerName server.com 31 | DocumentRoot /home/server/public_html 32 | 33 | ProxyPass / http://server.com:3000/ nocanon 34 | ProxyPassReverse / http://server.com:3000/ 35 | 36 | SSLEngine on 37 | SSLCertificateFile /etc/ssl/virtualmin/170514456861234/ssl.cert 38 | SSLCertificateKeyFile /etc/ssl/virtualmin/170514456861234/ssl.key 39 | SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1 40 | 41 | SSLProxyEngine on 42 | SSLCACertificateFile /etc/ssl/virtualmin/170514456865864/ssl.ca 43 | 44 | 45 | ``` 46 | 47 | I'm using virtualmin here for my SSL clusters, but you can also use certbot directly or your preferred SSL method. To use SSL: 48 | 49 | ### Prerequisites. 50 | 51 | Run the following commands: 52 | 53 | `snap install certbot --classic` 54 | `snap apt install python3-certbot-apache` (this will install the apache plugin). 55 | 56 | Navigate to the apache sites-available directory: 57 | 58 | `cd /etc/apache2/sites-available/` 59 | 60 | Create server.com.conf if it is not yet already created, containing the above `` configuration (it should match your case. Modify as necessary). Use the one without the SSL: 61 | 62 | Once it's created, run `certbot --apache -d server.com`, this will request and add/create an SSL keys for you as well as create the server.com.le-ssl.conf 63 | 64 | # Configuring Ollama Server 65 | 66 | On your latest installation of Ollama, make sure that you have setup your api server from the official Ollama reference: 67 | 68 | [Ollama FAQ](https://github.com/jmorganca/ollama/blob/main/docs/faq.md) 69 | 70 | ### TL;DR 71 | 72 | The guide doesn't seem to match the current updated service file on linux. So, we will address it here: 73 | 74 | Unless when you're compiling Ollama from source, installing with the standard install `curl https://ollama.com/install.sh | sh` creates a file called `ollama.service` in /etc/systemd/system. You can use nano to edit the file: 75 | 76 | ``` 77 | sudo nano /etc/systemd/system/ollama.service 78 | ``` 79 | 80 | Add the following lines: 81 | 82 | ``` 83 | Environment="OLLAMA_HOST=0.0.0.0:11434" # this line is mandatory. You can also specify 84 | ``` 85 | 86 | For instance: 87 | 88 | ``` 89 | [Unit] 90 | Description=Ollama Service 91 | After=network-online.target 92 | 93 | [Service] 94 | ExecStart=/usr/local/bin/ollama serve 95 | Environment="OLLAMA_HOST=0.0.0.0:11434" # this line is mandatory. You can also specify 192.168.254.109:DIFFERENT_PORT, format 96 | Environment="OLLAMA_ORIGINS=http://192.168.254.106:11434,https://models.server.city" # this line is optional 97 | User=ollama 98 | Group=ollama 99 | Restart=always 100 | RestartSec=3 101 | Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/s> 102 | 103 | [Install] 104 | WantedBy=default.target 105 | ``` 106 | 107 | Save the file by pressing CTRL+S, then press CTRL+X 108 | 109 | When your computer restarts, the Ollama server will now be listening on the IP:PORT you specified, in this case 0.0.0.0:11434, or 192.168.254.106:11434 (whatever your local IP address is). Make sure that your router is correctly configured to serve pages from that local IP by forwarding 11434 to your local IP server. 110 | 111 | # Ollama Model Configuration 112 | 113 | ## For the Ollama model configuration, use the following Apache VirtualHost setup: 114 | 115 | Navigate to the apache sites-available directory: 116 | 117 | `cd /etc/apache2/sites-available/` 118 | 119 | `nano models.server.city.conf` # match this with your ollama server domain 120 | 121 | Add the folloing virtualhost containing this example (modify as needed): 122 | 123 | ``` 124 | 125 | # Assuming you have a website hosting this UI at "models.server.city" 126 | 127 | 128 | DocumentRoot "/var/www/html/" 129 | ServerName models.server.city 130 | 131 | Options None 132 | Require all granted 133 | 134 | 135 | ProxyRequests Off 136 | ProxyPreserveHost On 137 | ProxyAddHeaders On 138 | SSLProxyEngine on 139 | 140 | ProxyPass / http://server.city:1000/ nocanon # or port 11434 141 | ProxyPassReverse / http://server.city:1000/ # or port 11434 142 | 143 | SSLCertificateFile /etc/letsencrypt/live/models.server.city/fullchain.pem 144 | SSLCertificateKeyFile /etc/letsencrypt/live/models.server.city/privkey.pem 145 | Include /etc/letsencrypt/options-ssl-apache.conf 146 | 147 | 148 | ``` 149 | 150 | You may need to enable the site first (if you haven't done so yet) before you can request SSL: 151 | 152 | `a2ensite models.server.city.conf` 153 | 154 | #### For the SSL part of Ollama server 155 | 156 | Run the following commands: 157 | 158 | Navigate to the apache sites-available directory: 159 | 160 | `cd /etc/apache2/sites-available/` 161 | `certbot --apache -d server.com` 162 | 163 | ``` 164 | 165 | DocumentRoot "/var/www/html/" 166 | ServerName models.server.city 167 | 168 | Options None 169 | Require all granted 170 | 171 | 172 | ProxyRequests Off 173 | ProxyPreserveHost On 174 | ProxyAddHeaders On 175 | SSLProxyEngine on 176 | 177 | ProxyPass / http://server.city:1000/ nocanon # or port 11434 178 | ProxyPassReverse / http://server.city:1000/ # or port 11434 179 | 180 | RewriteEngine on 181 | RewriteCond %{SERVER_NAME} =models.server.city 182 | RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] 183 | 184 | 185 | ``` 186 | 187 | Don't forget to restart/reload Apache with `systemctl reload apache2` 188 | 189 | Open your site at https://server.com! 190 | 191 | **Congratulations**, your _**Open-AI-like Chat-GPT style UI**_ is now serving AI with RAG, RBAC and multimodal features! Download Ollama models if you haven't yet done so! 192 | 193 | If you encounter any misconfiguration or errors, please file an issue or engage with our discussion. There are a lot of friendly developers here to assist you. 194 | 195 | Let's make this UI much more user friendly for everyone! 196 | 197 | Thanks for making open-webui your UI Choice for AI! 198 | 199 | This doc is made by **Bob Reyes**, your **Open-WebUI** fan from the Philippines. ``````` `\\?\D:\Coding\ai\docs\CONTRIBUTING.md`: ```````md 1 | # Contributing to Open WebUI 2 | 3 | 🚀 **Welcome, Contributors!** 🚀 4 | 5 | Your interest in contributing to Open WebUI is greatly appreciated. This document is here to guide you through the process, ensuring your contributions enhance the project effectively. Let's make Open WebUI even better, together! 6 | 7 | ## 📌 Key Points 8 | 9 | ### 🦙 Ollama vs. Open WebUI 10 | 11 | It's crucial to distinguish between Ollama and Open WebUI: 12 | 13 | - **Open WebUI** focuses on providing an intuitive and responsive web interface for chat interactions. 14 | - **Ollama** is the underlying technology that powers these interactions. 15 | 16 | If your issue or contribution pertains directly to the core Ollama technology, please direct it to the appropriate [Ollama project repository](https://ollama.com/). Open WebUI's repository is dedicated to the web interface aspect only. 17 | 18 | ### 🚨 Reporting Issues 19 | 20 | Noticed something off? Have an idea? Check our [Issues tab](https://github.com/open-webui/open-webui/issues) to see if it's already been reported or suggested. If not, feel free to open a new issue. When reporting an issue, please follow our issue templates. These templates are designed to ensure that all necessary details are provided from the start, enabling us to address your concerns more efficiently. 21 | 22 | > [!IMPORTANT] 23 | > 24 | > - **Template Compliance:** Please be aware that failure to follow the provided issue template, or not providing the requested information at all, will likely result in your issue being closed without further consideration. This approach is critical for maintaining the manageability and integrity of issue tracking. 25 | > 26 | > - **Detail is Key:** To ensure your issue is understood and can be effectively addressed, it's imperative to include comprehensive details. Descriptions should be clear, including steps to reproduce, expected outcomes, and actual results. Lack of sufficient detail may hinder our ability to resolve your issue. 27 | 28 | ### 🧭 Scope of Support 29 | 30 | We've noticed an uptick in issues not directly related to Open WebUI but rather to the environment it's run in, especially Docker setups. While we strive to support Docker deployment, understanding Docker fundamentals is crucial for a smooth experience. 31 | 32 | - **Docker Deployment Support**: Open WebUI supports Docker deployment. Familiarity with Docker is assumed. For Docker basics, please refer to the [official Docker documentation](https://docs.docker.com/get-started/overview/). 33 | 34 | - **Advanced Configurations**: Setting up reverse proxies for HTTPS and managing Docker deployments requires foundational knowledge. There are numerous online resources available to learn these skills. Ensuring you have this knowledge will greatly enhance your experience with Open WebUI and similar projects. 35 | 36 | ## 💡 Contributing 37 | 38 | Looking to contribute? Great! Here's how you can help: 39 | 40 | ### 🛠 Pull Requests 41 | 42 | We welcome pull requests. Before submitting one, please: 43 | 44 | 1. Open a discussion regarding your ideas [here](https://github.com/open-webui/open-webui/discussions/new/choose). 45 | 2. Follow the project's coding standards and include tests for new features. 46 | 3. Update documentation as necessary. 47 | 4. Write clear, descriptive commit messages. 48 | 5. It's essential to complete your pull request in a timely manner. We move fast, and having PRs hang around too long is not feasible. If you can't get it done within a reasonable time frame, we may have to close it to keep the project moving forward. 49 | 50 | ### 📚 Documentation & Tutorials 51 | 52 | Help us make Open WebUI more accessible by improving documentation, writing tutorials, or creating guides on setting up and optimizing the web UI. 53 | 54 | ### 🌐 Translations and Internationalization 55 | 56 | Help us make Open WebUI available to a wider audience. In this section, we'll guide you through the process of adding new translations to the project. 57 | 58 | We use JSON files to store translations. You can find the existing translation files in the `src/lib/i18n/locales` directory. Each directory corresponds to a specific language, for example, `en-US` for English (US), `fr-FR` for French (France) and so on. You can refer to [ISO 639 Language Codes](http://www.lingoes.net/en/translator/langcode.htm) to find the appropriate code for a specific language. 59 | 60 | To add a new language: 61 | 62 | - Create a new directory in the `src/lib/i18n/locales` path with the appropriate language code as its name. For instance, if you're adding translations for Spanish (Spain), create a new directory named `es-ES`. 63 | - Copy the American English translation file(s) (from `en-US` directory in `src/lib/i18n/locale`) to this new directory and update the string values in JSON format according to your language. Make sure to preserve the structure of the JSON object. 64 | - Add the language code and its respective title to languages file at `src/lib/i18n/locales/languages.json`. 65 | 66 | ### 🤔 Questions & Feedback 67 | 68 | Got questions or feedback? Join our [Discord community](https://discord.gg/5rJgQTnV4s) or open an issue. We're here to help! 69 | 70 | ## 🙏 Thank You! 71 | 72 | Your contributions, big or small, make a significant impact on Open WebUI. We're excited to see what you bring to the project! 73 | 74 | Together, let's create an even more powerful tool for the community. 🌟 ``````` `\\?\D:\Coding\ai\docs\README.md`: ```````md 1 | # Project workflow 2 | 3 | [![](https://mermaid.ink/img/pako:eNq1k01rAjEQhv_KkFNLFe1N9iAUevFSRVl6Cci4Gd1ANtlmsmtF_O_N7iqtHxR76ClhMu87zwyZvcicIpEIpo-KbEavGjceC2lL9EFnukQbIGXygNye5y9TY7DAZTpZLsjXXVYXg3dapRM4hh9mu5A7-3hTfSXtAtJK21Tsj8dPl3USmJZkGVbebWNKD2rNOjAYl6HJHYdkNBwNpb3U9aNZvzFNYE6h8tFiSyZzBUGJG4K1dwVwTSYQrCptlLRvLt5dA5i2la5Ruk51Ux0VKQjuxPVbAwuyiuFlNgHfzJ5DoxtgqQf1813gnZRLZ5lAYcD7WT1lpGtiQKug9C4jZrrp-Fd-1-Y1bdzo4dvnZDLz7lPHyj8sOgfg4x84E7RTuEaZt8yRZqtDfgT_rwG2u3Dv_ERPFOQL1Cqu2F5aAClCTgVJkcSrojVWJkgh7SGmYhXcYmczkQRfUU9UZfQ4baRI1miYDl_QqlPg?type=png)](https://mermaid.live/edit#pako:eNq1k01rAjEQhv_KkFNLFe1N9iAUevFSRVl6Cci4Gd1ANtlmsmtF_O_N7iqtHxR76ClhMu87zwyZvcicIpEIpo-KbEavGjceC2lL9EFnukQbIGXygNye5y9TY7DAZTpZLsjXXVYXg3dapRM4hh9mu5A7-3hTfSXtAtJK21Tsj8dPl3USmJZkGVbebWNKD2rNOjAYl6HJHYdkNBwNpb3U9aNZvzFNYE6h8tFiSyZzBUGJG4K1dwVwTSYQrCptlLRvLt5dA5i2la5Ruk51Ux0VKQjuxPVbAwuyiuFlNgHfzJ5DoxtgqQf1813gnZRLZ5lAYcD7WT1lpGtiQKug9C4jZrrp-Fd-1-Y1bdzo4dvnZDLz7lPHyj8sOgfg4x84E7RTuEaZt8yRZqtDfgT_rwG2u3Dv_ERPFOQL1Cqu2F5aAClCTgVJkcSrojVWJkgh7SGmYhXcYmczkQRfUU9UZfQ4baRI1miYDl_QqlPg) ``````` `\\?\D:\Coding\ai\docs\SECURITY.md`: ```````md 1 | # Security Policy 2 | 3 | Our primary goal is to ensure the protection and confidentiality of sensitive data stored by users on open-webui. 4 | 5 | ## Supported Versions 6 | 7 | | Version | Supported | 8 | | ------- | ------------------ | 9 | | main | :white_check_mark: | 10 | | others | :x: | 11 | 12 | ## Reporting a Vulnerability 13 | 14 | If you discover a security issue within our system, please notify us immediately via a pull request or contact us on discord. 15 | 16 | ## Product Security 17 | 18 | We regularly audit our internal processes and system's architecture for vulnerabilities using a combination of automated and manual testing techniques. 19 | 20 | We are planning on implementing SAST and SCA scans in our project soon. ``````` `\\?\D:\Coding\ai\hatch_build.py`: ```````py 1 | # noqa: INP001 2 | import os 3 | import shutil 4 | import subprocess 5 | from sys import stderr 6 | 7 | from hatchling.builders.hooks.plugin.interface import BuildHookInterface 8 | 9 | 10 | class CustomBuildHook(BuildHookInterface): 11 | def initialize(self, version, build_data): 12 | super().initialize(version, build_data) 13 | stderr.write(">>> Building Open Webui frontend\n") 14 | npm = shutil.which("npm") 15 | if npm is None: 16 | raise RuntimeError( 17 | "NodeJS `npm` is required for building Open Webui but it was not found" 18 | ) 19 | stderr.write("### npm install\n") 20 | subprocess.run([npm, "install"], check=True) # noqa: S603 21 | stderr.write("\n### npm run build\n") 22 | os.environ["APP_BUILD_HASH"] = version 23 | subprocess.run([npm, "run", "build"], check=True) # noqa: S603 ``````` `\\?\D:\Coding\ai\i18next-parser.config.ts`: ```````ts 1 | // i18next-parser.config.ts 2 | import { getLanguages } from './src/lib/i18n/index.ts'; 3 | 4 | const getLangCodes = async () => { 5 | const languages = await getLanguages(); 6 | return languages.map((l) => l.code); 7 | }; 8 | 9 | export default { 10 | contextSeparator: '_', 11 | createOldCatalogs: false, 12 | defaultNamespace: 'translation', 13 | defaultValue: '', 14 | indentation: 2, 15 | keepRemoved: false, 16 | keySeparator: false, 17 | lexers: { 18 | svelte: ['JavascriptLexer'], 19 | js: ['JavascriptLexer'], 20 | ts: ['JavascriptLexer'], 21 | 22 | default: ['JavascriptLexer'] 23 | }, 24 | lineEnding: 'auto', 25 | locales: await getLangCodes(), 26 | namespaceSeparator: false, 27 | output: 'src/lib/i18n/locales/$LOCALE/$NAMESPACE.json', 28 | pluralSeparator: '_', 29 | input: 'src/**/*.{js,svelte}', 30 | sort: true, 31 | verbose: true, 32 | failOnWarnings: false, 33 | failOnUpdate: false, 34 | customValueTemplate: null, 35 | resetDefaultValueLocale: null, 36 | i18nextOptions: null, 37 | yamlOptions: null 38 | }; ``````` `\\?\D:\Coding\ai\INSTALLATION.md`: ```````md 1 | ### Installing Both Ollama and Open WebUI Using Kustomize 2 | 3 | For cpu-only pod 4 | 5 | ```bash 6 | kubectl apply -f ./kubernetes/manifest/base 7 | ``` 8 | 9 | For gpu-enabled pod 10 | 11 | ```bash 12 | kubectl apply -k ./kubernetes/manifest 13 | ``` 14 | 15 | ### Installing Both Ollama and Open WebUI Using Helm 16 | 17 | Package Helm file first 18 | 19 | ```bash 20 | helm package ./kubernetes/helm/ 21 | ``` 22 | 23 | For cpu-only pod 24 | 25 | ```bash 26 | helm install ollama-webui ./ollama-webui-*.tgz 27 | ``` 28 | 29 | For gpu-enabled pod 30 | 31 | ```bash 32 | helm install ollama-webui ./ollama-webui-*.tgz --set ollama.resources.limits.nvidia.com/gpu="1" 33 | ``` 34 | 35 | Check the `kubernetes/helm/values.yaml` file to know which parameters are available for customization ``````` `\\?\D:\Coding\ai\kubernetes\helm\README.md`: ```````md 1 | # Helm Charts 2 | Open WebUI Helm Charts are now hosted in a separate repo, which can be found here: https://github.com/open-webui/helm-charts 3 | 4 | The charts are released at https://helm.openwebui.com. ``````` `\\?\D:\Coding\ai\kubernetes\manifest\base\ollama-service.yaml`: ```````yaml 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: ollama-service 5 | namespace: open-webui 6 | spec: 7 | selector: 8 | app: ollama 9 | ports: 10 | - protocol: TCP 11 | port: 11434 12 | targetPort: 11434 ``````` `\\?\D:\Coding\ai\kubernetes\manifest\base\ollama-statefulset.yaml`: ```````yaml 1 | apiVersion: apps/v1 2 | kind: StatefulSet 3 | metadata: 4 | name: ollama 5 | namespace: open-webui 6 | spec: 7 | serviceName: "ollama" 8 | replicas: 1 9 | selector: 10 | matchLabels: 11 | app: ollama 12 | template: 13 | metadata: 14 | labels: 15 | app: ollama 16 | spec: 17 | containers: 18 | - name: ollama 19 | image: ollama/ollama:latest 20 | ports: 21 | - containerPort: 11434 22 | resources: 23 | requests: 24 | cpu: "2000m" 25 | memory: "2Gi" 26 | limits: 27 | cpu: "4000m" 28 | memory: "4Gi" 29 | nvidia.com/gpu: "0" 30 | volumeMounts: 31 | - name: ollama-volume 32 | mountPath: /root/.ollama 33 | tty: true 34 | volumeClaimTemplates: 35 | - metadata: 36 | name: ollama-volume 37 | spec: 38 | accessModes: [ "ReadWriteOnce" ] 39 | resources: 40 | requests: 41 | storage: 30Gi ``````` `\\?\D:\Coding\ai\kubernetes\manifest\base\open-webui.yaml`: ```````yaml 1 | apiVersion: v1 2 | kind: Namespace 3 | metadata: 4 | name: open-webui ``````` `\\?\D:\Coding\ai\kubernetes\manifest\base\webui-deployment.yaml`: ```````yaml 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: open-webui-deployment 5 | namespace: open-webui 6 | spec: 7 | replicas: 1 8 | selector: 9 | matchLabels: 10 | app: open-webui 11 | template: 12 | metadata: 13 | labels: 14 | app: open-webui 15 | spec: 16 | containers: 17 | - name: open-webui 18 | image: ghcr.io/open-webui/open-webui:main 19 | ports: 20 | - containerPort: 8080 21 | resources: 22 | requests: 23 | cpu: "500m" 24 | memory: "500Mi" 25 | limits: 26 | cpu: "1000m" 27 | memory: "1Gi" 28 | env: 29 | - name: OLLAMA_BASE_URL 30 | value: "http://ollama-service.open-webui.svc.cluster.local:11434" 31 | tty: true 32 | volumeMounts: 33 | - name: webui-volume 34 | mountPath: /app/backend/data 35 | volumes: 36 | - name: webui-volume 37 | persistentVolumeClaim: 38 | claimName: open-webui-pvc ``````` `\\?\D:\Coding\ai\kubernetes\manifest\base\webui-ingress.yaml`: ```````yaml 1 | apiVersion: networking.k8s.io/v1 2 | kind: Ingress 3 | metadata: 4 | name: open-webui-ingress 5 | namespace: open-webui 6 | #annotations: 7 | # Use appropriate annotations for your Ingress controller, e.g., for NGINX: 8 | # nginx.ingress.kubernetes.io/rewrite-target: / 9 | spec: 10 | rules: 11 | - host: open-webui.minikube.local 12 | http: 13 | paths: 14 | - path: / 15 | pathType: Prefix 16 | backend: 17 | service: 18 | name: open-webui-service 19 | port: 20 | number: 8080 ``````` `\\?\D:\Coding\ai\kubernetes\manifest\base\webui-pvc.yaml`: ```````yaml 1 | apiVersion: v1 2 | kind: PersistentVolumeClaim 3 | metadata: 4 | labels: 5 | app: open-webui 6 | name: open-webui-pvc 7 | namespace: open-webui 8 | spec: 9 | accessModes: ["ReadWriteOnce"] 10 | resources: 11 | requests: 12 | storage: 2Gi ``````` `\\?\D:\Coding\ai\kubernetes\manifest\base\webui-service.yaml`: ```````yaml 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: open-webui-service 5 | namespace: open-webui 6 | spec: 7 | type: NodePort # Use LoadBalancer if you're on a cloud that supports it 8 | selector: 9 | app: open-webui 10 | ports: 11 | - protocol: TCP 12 | port: 8080 13 | targetPort: 8080 14 | # If using NodePort, you can optionally specify the nodePort: 15 | # nodePort: 30000 ``````` `\\?\D:\Coding\ai\kubernetes\manifest\kustomization.yaml`: ```````yaml 1 | resources: 2 | - base/open-webui.yaml 3 | - base/ollama-service.yaml 4 | - base/ollama-statefulset.yaml 5 | - base/webui-deployment.yaml 6 | - base/webui-service.yaml 7 | - base/webui-ingress.yaml 8 | - base/webui-pvc.yaml 9 | 10 | apiVersion: kustomize.config.k8s.io/v1beta1 11 | kind: Kustomization 12 | patches: 13 | - path: patches/ollama-statefulset-gpu.yaml ``````` `\\?\D:\Coding\ai\kubernetes\manifest\patches\ollama-statefulset-gpu.yaml`: ```````yaml 1 | apiVersion: apps/v1 2 | kind: StatefulSet 3 | metadata: 4 | name: ollama 5 | namespace: open-webui 6 | spec: 7 | selector: 8 | matchLabels: 9 | app: ollama 10 | serviceName: "ollama" 11 | template: 12 | spec: 13 | containers: 14 | - name: ollama 15 | resources: 16 | limits: 17 | nvidia.com/gpu: "1" ``````` `\\?\D:\Coding\ai\LICENSE`: ``````` 1 | MIT License 2 | 3 | Copyright (c) 2023 Timothy Jaeryang Baek 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. ``````` `\\?\D:\Coding\ai\Makefile`: ``````` 1 | 2 | ifneq ($(shell which docker-compose 2>/dev/null),) 3 | DOCKER_COMPOSE := docker-compose 4 | else 5 | DOCKER_COMPOSE := docker compose 6 | endif 7 | 8 | install: 9 | $(DOCKER_COMPOSE) up -d 10 | 11 | remove: 12 | @chmod +x confirm_remove.sh 13 | @./confirm_remove.sh 14 | 15 | start: 16 | $(DOCKER_COMPOSE) start 17 | startAndBuild: 18 | $(DOCKER_COMPOSE) up -d --build 19 | 20 | stop: 21 | $(DOCKER_COMPOSE) stop 22 | 23 | update: 24 | # Calls the LLM update script 25 | chmod +x update_ollama_models.sh 26 | @./update_ollama_models.sh 27 | @git pull 28 | $(DOCKER_COMPOSE) down 29 | # Make sure the ollama-webui container is stopped before rebuilding 30 | @docker stop open-webui || true 31 | $(DOCKER_COMPOSE) up --build -d 32 | $(DOCKER_COMPOSE) start 33 | ``````` `\\?\D:\Coding\ai\package-lock.json`: ```````json 1 | { 2 | "name": "open-webui", 3 | "version": "0.3.10", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "open-webui", 9 | "version": "0.3.10", 10 | "dependencies": { 11 | "@codemirror/lang-javascript": "^6.2.2", 12 | "@codemirror/lang-python": "^6.1.6", 13 | "@codemirror/theme-one-dark": "^6.1.2", 14 | "@pyscript/core": "^0.4.32", 15 | "@sveltejs/adapter-node": "^1.3.1", 16 | "async": "^3.2.5", 17 | "bits-ui": "^0.19.7", 18 | "codemirror": "^6.0.1", 19 | "crc-32": "^1.2.2", 20 | "dayjs": "^1.11.10", 21 | "eventsource-parser": "^1.1.2", 22 | "file-saver": "^2.0.5", 23 | "highlight.js": "^11.9.0", 24 | "i18next": "^23.10.0", 25 | "i18next-browser-languagedetector": "^7.2.0", 26 | "i18next-resources-to-backend": "^1.2.0", 27 | "idb": "^7.1.1", 28 | "js-sha256": "^0.10.1", 29 | "katex": "^0.16.9", 30 | "marked": "^9.1.0", 31 | "mermaid": "^10.9.1", 32 | "pyodide": "^0.26.1", 33 | "socket.io-client": "^4.2.0", 34 | "sortablejs": "^1.15.2", 35 | "svelte-sonner": "^0.3.19", 36 | "tippy.js": "^6.3.7", 37 | "turndown": "^7.2.0", 38 | "uuid": "^9.0.1" 39 | }, 40 | "devDependencies": { 41 | "@sveltejs/adapter-auto": "^2.0.0", 42 | "@sveltejs/adapter-static": "^2.0.3", 43 | "@sveltejs/kit": "^1.30.0", 44 | "@tailwindcss/typography": "^0.5.10", 45 | "@types/bun": "latest", 46 | "@typescript-eslint/eslint-plugin": "^6.17.0", 47 | "@typescript-eslint/parser": "^6.17.0", 48 | "autoprefixer": "^10.4.16", 49 | "cypress": "^13.8.1", 50 | "eslint": "^8.56.0", 51 | "eslint-config-prettier": "^8.5.0", 52 | "eslint-plugin-cypress": "^3.0.2", 53 | "eslint-plugin-svelte": "^2.30.0", 54 | "i18next-parser": "^8.13.0", 55 | "postcss": "^8.4.31", 56 | "prettier": "^2.8.0", 57 | "prettier-plugin-svelte": "^2.10.1", 58 | "svelte": "^4.0.5", 59 | "svelte-check": "^3.4.3", 60 | "svelte-confetti": "^1.3.2", 61 | "tailwindcss": "^3.3.3", 62 | "tslib": "^2.4.1", 63 | "typescript": "^5.0.0", 64 | "vite": "^4.4.2", 65 | "vitest": "^1.6.0" 66 | } 67 | }, 68 | "node_modules/@aashutoshrathi/word-wrap": { 69 | "version": "1.2.6", 70 | "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", 71 | "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", 72 | "dev": true, 73 | "engines": { 74 | "node": ">=0.10.0" 75 | } 76 | }, 77 | "node_modules/@alloc/quick-lru": { 78 | "version": "5.2.0", 79 | "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz", 80 | "integrity": "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==", 81 | "dev": true, 82 | "engines": { 83 | "node": ">=10" 84 | }, 85 | "funding": { 86 | "url": "https://github.com/sponsors/sindresorhus" 87 | } 88 | }, 89 | "node_modules/@ampproject/remapping": { 90 | "version": "2.3.0", 91 | "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", 92 | "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", 93 | "dependencies": { 94 | "@jridgewell/gen-mapping": "^0.3.5", 95 | "@jridgewell/trace-mapping": "^0.3.24" 96 | }, 97 | "engines": { 98 | "node": ">=6.0.0" 99 | } 100 | }, 101 | "node_modules/@babel/runtime": { 102 | "version": "7.24.1", 103 | "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.1.tgz", 104 | "integrity": "sha512-+BIznRzyqBf+2wCTxcKE3wDjfGeCoVE61KSHGpkzqrLi8qxqFwBeUFyId2cxkTmm55fzDGnm0+yCxaxygrLUnQ==", 105 | "dependencies": { 106 | "regenerator-runtime": "^0.14.0" 107 | }, 108 | "engines": { 109 | "node": ">=6.9.0" 110 | } 111 | }, 112 | "node_modules/@braintree/sanitize-url": { 113 | "version": "6.0.4", 114 | "resolved": "https://registry.npmjs.org/@braintree/sanitize-url/-/sanitize-url-6.0.4.tgz", 115 | "integrity": "sha512-s3jaWicZd0pkP0jf5ysyHUI/RE7MHos6qlToFcGWXVp+ykHOy77OUMrfbgJ9it2C5bow7OIQwYYaHjk9XlBQ2A==" 116 | }, 117 | "node_modules/@codemirror/autocomplete": { 118 | "version": "6.16.2", 119 | "resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.16.2.tgz", 120 | "integrity": "sha512-MjfDrHy0gHKlPWsvSsikhO1+BOh+eBHNgfH1OXs1+DAf30IonQldgMM3kxLDTG9ktE7kDLaA1j/l7KMPA4KNfw==", 121 | "dependencies": { 122 | "@codemirror/language": "^6.0.0", 123 | "@codemirror/state": "^6.0.0", 124 | "@codemirror/view": "^6.17.0", 125 | "@lezer/common": "^1.0.0" 126 | }, 127 | "peerDependencies": { 128 | "@codemirror/language": "^6.0.0", 129 | "@codemirror/state": "^6.0.0", 130 | "@codemirror/view": "^6.0.0", 131 | "@lezer/common": "^1.0.0" 132 | } 133 | }, 134 | "node_modules/@codemirror/commands": { 135 | "version": "6.6.0", 136 | "resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-6.6.0.tgz", 137 | "integrity": "sha512-qnY+b7j1UNcTS31Eenuc/5YJB6gQOzkUoNmJQc0rznwqSRpeaWWpjkWy2C/MPTcePpsKJEM26hXrOXl1+nceXg==", 138 | "dependencies": { 139 | "@codemirror/language": "^6.0.0", 140 | "@codemirror/state": "^6.4.0", 141 | "@codemirror/view": "^6.27.0", 142 | "@lezer/common": "^1.1.0" 143 | } 144 | }, 145 | "node_modules/@codemirror/lang-javascript": { 146 | "version": "6.2.2", 147 | "resolved": "https://registry.npmjs.org/@codemirror/lang-javascript/-/lang-javascript-6.2.2.tgz", 148 | "integrity": "sha512-VGQfY+FCc285AhWuwjYxQyUQcYurWlxdKYT4bqwr3Twnd5wP5WSeu52t4tvvuWmljT4EmgEgZCqSieokhtY8hg==", 149 | "dependencies": { 150 | "@codemirror/autocomplete": "^6.0.0", 151 | "@codemirror/language": "^6.6.0", 152 | "@codemirror/lint": "^6.0.0", 153 | "@codemirror/state": "^6.0.0", 154 | "@codemirror/view": "^6.17.0", 155 | "@lezer/common": "^1.0.0", 156 | "@lezer/javascript": "^1.0.0" 157 | } 158 | }, 159 | "node_modules/@codemirror/lang-python": { 160 | "version": "6.1.6", 161 | "resolved": "https://registry.npmjs.org/@codemirror/lang-python/-/lang-python-6.1.6.tgz", 162 | "integrity": "sha512-ai+01WfZhWqM92UqjnvorkxosZ2aq2u28kHvr+N3gu012XqY2CThD67JPMHnGceRfXPDBmn1HnyqowdpF57bNg==", 163 | "dependencies": { 164 | "@codemirror/autocomplete": "^6.3.2", 165 | "@codemirror/language": "^6.8.0", 166 | "@codemirror/state": "^6.0.0", 167 | "@lezer/common": "^1.2.1", 168 | "@lezer/python": "^1.1.4" 169 | } 170 | }, 171 | "node_modules/@codemirror/language": { 172 | "version": "6.10.2", 173 | "resolved": "https://registry.npmjs.org/@codemirror/language/-/language-6.10.2.tgz", 174 | "integrity": "sha512-kgbTYTo0Au6dCSc/TFy7fK3fpJmgHDv1sG1KNQKJXVi+xBTEeBPY/M30YXiU6mMXeH+YIDLsbrT4ZwNRdtF+SA==", 175 | "dependencies": { 176 | "@codemirror/state": "^6.0.0", 177 | "@codemirror/view": "^6.23.0", 178 | "@lezer/common": "^1.1.0", 179 | "@lezer/highlight": "^1.0.0", 180 | "@lezer/lr": "^1.0.0", 181 | "style-mod": "^4.0.0" 182 | } 183 | }, 184 | "node_modules/@codemirror/lint": { 185 | "version": "6.8.0", 186 | "resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-6.8.0.tgz", 187 | "integrity": "sha512-lsFofvaw0lnPRJlQylNsC4IRt/1lI4OD/yYslrSGVndOJfStc58v+8p9dgGiD90ktOfL7OhBWns1ZETYgz0EJA==", 188 | "dependencies": { 189 | "@codemirror/state": "^6.0.0", 190 | "@codemirror/view": "^6.0.0", 191 | "crelt": "^1.0.5" 192 | } 193 | }, 194 | "node_modules/@codemirror/search": { 195 | "version": "6.5.6", 196 | "resolved": "https://registry.npmjs.org/@codemirror/search/-/search-6.5.6.tgz", 197 | "integrity": "sha512-rpMgcsh7o0GuCDUXKPvww+muLA1pDJaFrpq/CCHtpQJYz8xopu4D1hPcKRoDD0YlF8gZaqTNIRa4VRBWyhyy7Q==", 198 | "dependencies": { 199 | "@codemirror/state": "^6.0.0", 200 | "@codemirror/view": "^6.0.0", 201 | "crelt": "^1.0.5" 202 | } 203 | }, 204 | "node_modules/@codemirror/state": { 205 | "version": "6.4.1", 206 | "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.4.1.tgz", 207 | "integrity": "sha512-QkEyUiLhsJoZkbumGZlswmAhA7CBU02Wrz7zvH4SrcifbsqwlXShVXg65f3v/ts57W3dqyamEriMhij1Z3Zz4A==" 208 | }, 209 | "node_modules/@codemirror/theme-one-dark": { 210 | "version": "6.1.2", 211 | "resolved": "https://registry.npmjs.org/@codemirror/theme-one-dark/-/theme-one-dark-6.1.2.tgz", 212 | "integrity": "sha512-F+sH0X16j/qFLMAfbciKTxVOwkdAS336b7AXTKOZhy8BR3eH/RelsnLgLFINrpST63mmN2OuwUt0W2ndUgYwUA==", 213 | "dependencies": { 214 | "@codemirror/language": "^6.0.0", 215 | "@codemirror/state": "^6.0.0", 216 | "@codemirror/view": "^6.0.0", 217 | "@lezer/highlight": "^1.0.0" 218 | } 219 | }, 220 | "node_modules/@codemirror/view": { 221 | "version": "6.28.0", 222 | "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.28.0.tgz", 223 | "integrity": "sha512-fo7CelaUDKWIyemw4b+J57cWuRkOu4SWCCPfNDkPvfWkGjM9D5racHQXr4EQeYCD6zEBIBxGCeaKkQo+ysl0gA==", 224 | "dependencies": { 225 | "@codemirror/state": "^6.4.0", 226 | "style-mod": "^4.1.0", 227 | "w3c-keyname": "^2.2.4" 228 | } 229 | }, 230 | "node_modules/@colors/colors": { 231 | "version": "1.5.0", 232 | "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", 233 | "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", 234 | "dev": true, 235 | "optional": true, 236 | "engines": { 237 | "node": ">=0.1.90" 238 | } 239 | }, 240 | "node_modules/@cypress/request": { 241 | "version": "3.0.1", 242 | "resolved": "https://registry.npmjs.org/@cypress/request/-/request-3.0.1.tgz", 243 | "integrity": "sha512-TWivJlJi8ZDx2wGOw1dbLuHJKUYX7bWySw377nlnGOW3hP9/MUKIsEdXT/YngWxVdgNCHRBmFlBipE+5/2ZZlQ==", 244 | "dev": true, 245 | "dependencies": { 246 | "aws-sign2": "~0.7.0", 247 | "aws4": "^1.8.0", 248 | "caseless": "~0.12.0", 249 | "combined-stream": "~1.0.6", 250 | "extend": "~3.0.2", 251 | "forever-agent": "~0.6.1", 252 | "form-data": "~2.3.2", 253 | "http-signature": "~1.3.6", 254 | "is-typedarray": "~1.0.0", 255 | "isstream": "~0.1.2", 256 | "json-stringify-safe": "~5.0.1", 257 | "mime-types": "~2.1.19", 258 | "performance-now": "^2.1.0", 259 | "qs": "6.10.4", 260 | "safe-buffer": "^5.1.2", 261 | "tough-cookie": "^4.1.3", 262 | "tunnel-agent": "^0.6.0", 263 | "uuid": "^8.3.2" 264 | }, 265 | "engines": { 266 | "node": ">= 6" 267 | } 268 | }, 269 | "node_modules/@cypress/request/node_modules/uuid": { 270 | "version": "8.3.2", 271 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", 272 | "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", 273 | "dev": true, 274 | "bin": { 275 | "uuid": "dist/bin/uuid" 276 | } 277 | }, 278 | "node_modules/@cypress/xvfb": { 279 | "version": "1.2.4", 280 | "resolved": "https://registry.npmjs.org/@cypress/xvfb/-/xvfb-1.2.4.tgz", 281 | "integrity": "sha512-skbBzPggOVYCbnGgV+0dmBdW/s77ZkAOXIC1knS8NagwDjBrNC1LuXtQJeiN6l+m7lzmHtaoUw/ctJKdqkG57Q==", 282 | "dev": true, 283 | "dependencies": { 284 | "debug": "^3.1.0", 285 | "lodash.once": "^4.1.1" 286 | } 287 | }, 288 | "node_modules/@cypress/xvfb/node_modules/debug": { 289 | "version": "3.2.7", 290 | "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", 291 | "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", 292 | "dev": true, 293 | "dependencies": { 294 | "ms": "^2.1.1" 295 | } 296 | }, 297 | "node_modules/@esbuild/aix-ppc64": { 298 | "version": "0.20.2", 299 | "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.20.2.tgz", 300 | "integrity": "sha512-D+EBOJHXdNZcLJRBkhENNG8Wji2kgc9AZ9KiPr1JuZjsNtyHzrsfLRrY0tk2H2aoFu6RANO1y1iPPUCDYWkb5g==", 301 | "cpu": [ 302 | "ppc64" 303 | ], 304 | "dev": true, 305 | "optional": true, 306 | "os": [ 307 | "aix" 308 | ], 309 | "engines": { 310 | "node": ">=12" 311 | } 312 | }, 313 | "node_modules/@esbuild/android-arm": { 314 | "version": "0.20.2", 315 | "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.20.2.tgz", 316 | "integrity": "sha512-t98Ra6pw2VaDhqNWO2Oph2LXbz/EJcnLmKLGBJwEwXX/JAN83Fym1rU8l0JUWK6HkIbWONCSSatf4sf2NBRx/w==", 317 | "cpu": [ 318 | "arm" 319 | ], 320 | "dev": true, 321 | "optional": true, 322 | "os": [ 323 | "android" 324 | ], 325 | "engines": { 326 | "node": ">=12" 327 | } 328 | }, 329 | "node_modules/@esbuild/android-arm64": { 330 | "version": "0.20.2", 331 | "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.20.2.tgz", 332 | "integrity": "sha512-mRzjLacRtl/tWU0SvD8lUEwb61yP9cqQo6noDZP/O8VkwafSYwZ4yWy24kan8jE/IMERpYncRt2dw438LP3Xmg==", 333 | "cpu": [ 334 | "arm64" 335 | ], 336 | "dev": true, 337 | "optional": true, 338 | "os": [ 339 | "android" 340 | ], 341 | "engines": { 342 | "node": ">=12" 343 | } 344 | }, 345 | "node_modules/@esbuild/android-x64": { 346 | "version": "0.20.2", 347 | "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.20.2.tgz", 348 | "integrity": "sha512-btzExgV+/lMGDDa194CcUQm53ncxzeBrWJcncOBxuC6ndBkKxnHdFJn86mCIgTELsooUmwUm9FkhSp5HYu00Rg==", 349 | "cpu": [ 350 | "x64" 351 | ], 352 | "dev": true, 353 | "optional": true, 354 | "os": [ 355 | "android" 356 | ], 357 | "engines": { 358 | "node": ">=12" 359 | } 360 | }, 361 | "node_modules/@esbuild/darwin-arm64": { 362 | "version": "0.20.2", 363 | "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.20.2.tgz", 364 | "integrity": "sha512-4J6IRT+10J3aJH3l1yzEg9y3wkTDgDk7TSDFX+wKFiWjqWp/iCfLIYzGyasx9l0SAFPT1HwSCR+0w/h1ES/MjA==", 365 | "cpu": [ 366 | "arm64" 367 | ], 368 | "dev": true, 369 | "optional": true, 370 | "os": [ 371 | "darwin" 372 | ], 373 | "engines": { 374 | "node": ">=12" 375 | } 376 | }, 377 | "node_modules/@esbuild/darwin-x64": { 378 | "version": "0.20.2", 379 | "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.20.2.tgz", 380 | "integrity": "sha512-tBcXp9KNphnNH0dfhv8KYkZhjc+H3XBkF5DKtswJblV7KlT9EI2+jeA8DgBjp908WEuYll6pF+UStUCfEpdysA==", 381 | "cpu": [ 382 | "x64" 383 | ], 384 | "dev": true, 385 | "optional": true, 386 | "os": [ 387 | "darwin" 388 | ], 389 | "engines": { 390 | "node": ">=12" 391 | } 392 | }, 393 | "node_modules/@esbuild/freebsd-arm64": { 394 | "version": "0.20.2", 395 | "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.2.tgz", 396 | "integrity": "sha512-d3qI41G4SuLiCGCFGUrKsSeTXyWG6yem1KcGZVS+3FYlYhtNoNgYrWcvkOoaqMhwXSMrZRl69ArHsGJ9mYdbbw==", 397 | "cpu": [ 398 | "arm64" 399 | ], 400 | "dev": true, 401 | "optional": true, 402 | "os": [ 403 | "freebsd" 404 | ], 405 | "engines": { 406 | "node": ">=12" 407 | } 408 | }, 409 | "node_modules/@esbuild/freebsd-x64": { 410 | "version": "0.20.2", 411 | "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.20.2.tgz", 412 | "integrity": "sha512-d+DipyvHRuqEeM5zDivKV1KuXn9WeRX6vqSqIDgwIfPQtwMP4jaDsQsDncjTDDsExT4lR/91OLjRo8bmC1e+Cw==", 413 | "cpu": [ 414 | "x64" 415 | ], 416 | "dev": true, 417 | "optional": true, 418 | "os": [ 419 | "freebsd" 420 | ], 421 | "engines": { 422 | "node": ">=12" 423 | } 424 | }, 425 | "node_modules/@esbuild/linux-arm": { 426 | "version": "0.20.2", 427 | "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.20.2.tgz", 428 | "integrity": "sha512-VhLPeR8HTMPccbuWWcEUD1Az68TqaTYyj6nfE4QByZIQEQVWBB8vup8PpR7y1QHL3CpcF6xd5WVBU/+SBEvGTg==", 429 | "cpu": [ 430 | "arm" 431 | ], 432 | "dev": true, 433 | "optional": true, 434 | "os": [ 435 | "linux" 436 | ], 437 | "engines": { 438 | "node": ">=12" 439 | } 440 | }, 441 | "node_modules/@esbuild/linux-arm64": { 442 | "version": "0.20.2", 443 | "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.20.2.tgz", 444 | "integrity": "sha512-9pb6rBjGvTFNira2FLIWqDk/uaf42sSyLE8j1rnUpuzsODBq7FvpwHYZxQ/It/8b+QOS1RYfqgGFNLRI+qlq2A==", 445 | "cpu": [ 446 | "arm64" 447 | ], 448 | "dev": true, 449 | "optional": true, 450 | "os": [ 451 | "linux" 452 | ], 453 | "engines": { 454 | "node": ">=12" 455 | } 456 | }, 457 | "node_modules/@esbuild/linux-ia32": { 458 | "version": "0.20.2", 459 | "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.20.2.tgz", 460 | "integrity": "sha512-o10utieEkNPFDZFQm9CoP7Tvb33UutoJqg3qKf1PWVeeJhJw0Q347PxMvBgVVFgouYLGIhFYG0UGdBumROyiig==", 461 | "cpu": [ 462 | "ia32" 463 | ], 464 | "dev": true, 465 | "optional": true, 466 | "os": [ 467 | "linux" 468 | ], 469 | "engines": { 470 | "node": ">=12" 471 | } 472 | }, 473 | "node_modules/@esbuild/linux-loong64": { 474 | "version": "0.20.2", 475 | "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.20.2.tgz", 476 | "integrity": "sha512-PR7sp6R/UC4CFVomVINKJ80pMFlfDfMQMYynX7t1tNTeivQ6XdX5r2XovMmha/VjR1YN/HgHWsVcTRIMkymrgQ==", 477 | "cpu": [ 478 | "loong64" 479 | ], 480 | "dev": true, 481 | "optional": true, 482 | "os": [ 483 | "linux" 484 | ], 485 | "engines": { 486 | "node": ">=12" 487 | } 488 | }, 489 | "node_modules/@esbuild/linux-mips64el": { 490 | "version": "0.20.2", 491 | "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.20.2.tgz", 492 | "integrity": "sha512-4BlTqeutE/KnOiTG5Y6Sb/Hw6hsBOZapOVF6njAESHInhlQAghVVZL1ZpIctBOoTFbQyGW+LsVYZ8lSSB3wkjA==", 493 | "cpu": [ 494 | "mips64el" 495 | ], 496 | "dev": true, 497 | "optional": true, 498 | "os": [ 499 | "linux" 500 | ], 501 | "engines": { 502 | "node": ">=12" 503 | } 504 | }, 505 | "node_modules/@esbuild/linux-ppc64": { 506 | "version": "0.20.2", 507 | "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.20.2.tgz", 508 | "integrity": "sha512-rD3KsaDprDcfajSKdn25ooz5J5/fWBylaaXkuotBDGnMnDP1Uv5DLAN/45qfnf3JDYyJv/ytGHQaziHUdyzaAg==", 509 | "cpu": [ 510 | "ppc64" 511 | ], 512 | "dev": true, 513 | "optional": true, 514 | "os": [ 515 | "linux" 516 | ], 517 | "engines": { 518 | "node": ">=12" 519 | } 520 | }, 521 | "node_modules/@esbuild/linux-riscv64": { 522 | "version": "0.20.2", 523 | "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.20.2.tgz", 524 | "integrity": "sha512-snwmBKacKmwTMmhLlz/3aH1Q9T8v45bKYGE3j26TsaOVtjIag4wLfWSiZykXzXuE1kbCE+zJRmwp+ZbIHinnVg==", 525 | "cpu": [ 526 | "riscv64" 527 | ], 528 | "dev": true, 529 | "optional": true, 530 | "os": [ 531 | "linux" 532 | ], 533 | "engines": { 534 | "node": ">=12" 535 | } 536 | }, 537 | "node_modules/@esbuild/linux-s390x": { 538 | "version": "0.20.2", 539 | "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.20.2.tgz", 540 | "integrity": "sha512-wcWISOobRWNm3cezm5HOZcYz1sKoHLd8VL1dl309DiixxVFoFe/o8HnwuIwn6sXre88Nwj+VwZUvJf4AFxkyrQ==", 541 | "cpu": [ 542 | "s390x" 543 | ], 544 | "dev": true, 545 | "optional": true, 546 | "os": [ 547 | "linux" 548 | ], 549 | "engines": { 550 | "node": ">=12" 551 | } 552 | }, 553 | "node_modules/@esbuild/linux-x64": { 554 | "version": "0.20.2", 555 | "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.20.2.tgz", 556 | "integrity": "sha512-1MdwI6OOTsfQfek8sLwgyjOXAu+wKhLEoaOLTjbijk6E2WONYpH9ZU2mNtR+lZ2B4uwr+usqGuVfFT9tMtGvGw==", 557 | "cpu": [ 558 | "x64" 559 | ], 560 | "dev": true, 561 | "optional": true, 562 | "os": [ 563 | "linux" 564 | ], 565 | "engines": { 566 | "node": ">=12" 567 | } 568 | }, 569 | "node_modules/@esbuild/netbsd-x64": { 570 | "version": "0.20.2", 571 | "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.20.2.tgz", 572 | "integrity": "sha512-K8/DhBxcVQkzYc43yJXDSyjlFeHQJBiowJ0uVL6Tor3jGQfSGHNNJcWxNbOI8v5k82prYqzPuwkzHt3J1T1iZQ==", 573 | "cpu": [ 574 | "x64" 575 | ], 576 | "dev": true, 577 | "optional": true, 578 | "os": [ 579 | "netbsd" 580 | ], 581 | "engines": { 582 | "node": ">=12" 583 | } 584 | }, 585 | "node_modules/@esbuild/openbsd-x64": { 586 | "version": "0.20.2", 587 | "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.2.tgz", 588 | "integrity": "sha512-eMpKlV0SThJmmJgiVyN9jTPJ2VBPquf6Kt/nAoo6DgHAoN57K15ZghiHaMvqjCye/uU4X5u3YSMgVBI1h3vKrQ==", 589 | "cpu": [ 590 | "x64" 591 | ], 592 | "dev": true, 593 | "optional": true, 594 | "os": [ 595 | "openbsd" 596 | ], 597 | "engines": { 598 | "node": ">=12" 599 | } 600 | }, 601 | "node_modules/@esbuild/sunos-x64": { 602 | "version": "0.20.2", 603 | "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.20.2.tgz", 604 | "integrity": "sha512-2UyFtRC6cXLyejf/YEld4Hajo7UHILetzE1vsRcGL3earZEW77JxrFjH4Ez2qaTiEfMgAXxfAZCm1fvM/G/o8w==", 605 | "cpu": [ 606 | "x64" 607 | ], 608 | "dev": true, 609 | "optional": true, 610 | "os": [ 611 | "sunos" 612 | ], 613 | "engines": { 614 | "node": ">=12" 615 | } 616 | }, 617 | "node_modules/@esbuild/win32-arm64": { 618 | "version": "0.20.2", 619 | "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.20.2.tgz", 620 | "integrity": "sha512-GRibxoawM9ZCnDxnP3usoUDO9vUkpAxIIZ6GQI+IlVmr5kP3zUq+l17xELTHMWTWzjxa2guPNyrpq1GWmPvcGQ==", 621 | "cpu": [ 622 | "arm64" 623 | ], 624 | "dev": true, 625 | "optional": true, 626 | "os": [ 627 | "win32" 628 | ], 629 | "engines": { 630 | "node": ">=12" 631 | } 632 | }, 633 | "node_modules/@esbuild/win32-ia32": { 634 | "version": "0.20.2", 635 | "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.20.2.tgz", 636 | "integrity": "sha512-HfLOfn9YWmkSKRQqovpnITazdtquEW8/SoHW7pWpuEeguaZI4QnCRW6b+oZTztdBnZOS2hqJ6im/D5cPzBTTlQ==", 637 | "cpu": [ 638 | "ia32" 639 | ], 640 | "dev": true, 641 | "optional": true, 642 | "os": [ 643 | "win32" 644 | ], 645 | "engines": { 646 | "node": ">=12" 647 | } 648 | }, 649 | "node_modules/@esbuild/win32-x64": { 650 | "version": "0.20.2", 651 | "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.20.2.tgz", 652 | "integrity": "sha512-N49X4lJX27+l9jbLKSqZ6bKNjzQvHaT8IIFUy+YIqmXQdjYCToGWwOItDrfby14c78aDd5NHQl29xingXfCdLQ==", 653 | "cpu": [ 654 | "x64" 655 | ], 656 | "dev": true, 657 | "optional": true, 658 | "os": [ 659 | "win32" 660 | ], 661 | "engines": { 662 | "node": ">=12" 663 | } 664 | }, 665 | "node_modules/@eslint-community/eslint-utils": { 666 | "version": "4.4.0", 667 | "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", 668 | "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", 669 | "dev": true, 670 | "dependencies": { 671 | "eslint-visitor-keys": "^3.3.0" 672 | }, 673 | "engines": { 674 | "node": "^12.22.0 || ^14.17.0 || >=16.0.0" 675 | }, 676 | "peerDependencies": { 677 | "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" 678 | } 679 | }, 680 | "node_modules/@eslint-community/regexpp": { 681 | "version": "4.10.0", 682 | "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", 683 | "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", 684 | "dev": true, 685 | "engines": { 686 | "node": "^12.0.0 || ^14.0.0 || >=16.0.0" 687 | } 688 | }, 689 | "node_modules/@eslint/eslintrc": { 690 | "version": "2.1.4", 691 | "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", 692 | "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", 693 | "dev": true, 694 | "dependencies": { 695 | "ajv": "^6.12.4", 696 | "debug": "^4.3.2", 697 | "espree": "^9.6.0", 698 | "globals": "^13.19.0", 699 | "ignore": "^5.2.0", 700 | "import-fresh": "^3.2.1", 701 | "js-yaml": "^4.1.0", 702 | "minimatch": "^3.1.2", 703 | "strip-json-comments": "^3.1.1" 704 | }, 705 | "engines": { 706 | "node": "^12.22.0 || ^14.17.0 || >=16.0.0" 707 | }, 708 | "funding": { 709 | "url": "https://opencollective.com/eslint" 710 | } 711 | }, 712 | "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { 713 | "version": "1.1.11", 714 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 715 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 716 | "dev": true, 717 | "dependencies": { 718 | "balanced-match": "^1.0.0", 719 | "concat-map": "0.0.1" 720 | } 721 | }, 722 | "node_modules/@eslint/eslintrc/node_modules/minimatch": { 723 | "version": "3.1.2", 724 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", 725 | "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", 726 | "dev": true, 727 | "dependencies": { 728 | "brace-expansion": "^1.1.7" 729 | }, 730 | "engines": { 731 | "node": "*" 732 | } 733 | }, 734 | "node_modules/@eslint/js": { 735 | "version": "8.57.0", 736 | "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", 737 | "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", 738 | "dev": true, 739 | "engines": { 740 | "node": "^12.22.0 || ^14.17.0 || >=16.0.0" 741 | } 742 | }, 743 | "node_modules/@fastify/busboy": { 744 | "version": "2.1.1", 745 | "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", 746 | "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", 747 | "engines": { 748 | "node": ">=14" 749 | } 750 | }, 751 | "node_modules/@floating-ui/core": { 752 | "version": "1.6.0", 753 | "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.6.0.tgz", 754 | "integrity": "sha512-PcF++MykgmTj3CIyOQbKA/hDzOAiqI3mhuoN44WRCopIs1sgoDoU4oty4Jtqaj/y3oDU6fnVSm4QG0a3t5i0+g==", 755 | "dependencies": { 756 | "@floating-ui/utils": "^0.2.1" 757 | } 758 | }, 759 | "node_modules/@floating-ui/dom": { 760 | "version": "1.6.3", 761 | "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.6.3.tgz", 762 | "integrity": "sha512-RnDthu3mzPlQ31Ss/BTwQ1zjzIhr3lk1gZB1OC56h/1vEtaXkESrOqL5fQVMfXpwGtRwX+YsZBdyHtJMQnkArw==", 763 | "dependencies": { 764 | "@floating-ui/core": "^1.0.0", 765 | "@floating-ui/utils": "^0.2.0" 766 | } 767 | }, 768 | "node_modules/@floating-ui/utils": { 769 | "version": "0.2.1", 770 | "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.1.tgz", 771 | "integrity": "sha512-9TANp6GPoMtYzQdt54kfAyMmz1+osLlXdg2ENroU7zzrtflTLrrC/lgrIfaSe+Wu0b89GKccT7vxXA0MoAIO+Q==" 772 | }, 773 | "node_modules/@gulpjs/to-absolute-glob": { 774 | "version": "4.0.0", 775 | "resolved": "https://registry.npmjs.org/@gulpjs/to-absolute-glob/-/to-absolute-glob-4.0.0.tgz", 776 | "integrity": "sha512-kjotm7XJrJ6v+7knhPaRgaT6q8F8K2jiafwYdNHLzmV0uGLuZY43FK6smNSHUPrhq5kX2slCUy+RGG/xGqmIKA==", 777 | "dev": true, 778 | "dependencies": { 779 | "is-negated-glob": "^1.0.0" 780 | }, 781 | "engines": { 782 | "node": ">=10.13.0" 783 | } 784 | }, 785 | "node_modules/@humanwhocodes/config-array": { 786 | "version": "0.11.14", 787 | "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", 788 | "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", 789 | "dev": true, 790 | "dependencies": { 791 | "@humanwhocodes/object-schema": "^2.0.2", 792 | "debug": "^4.3.1", 793 | "minimatch": "^3.0.5" 794 | }, 795 | "engines": { 796 | "node": ">=10.10.0" 797 | } 798 | }, 799 | "node_modules/@humanwhocodes/config-array/node_modules/brace-expansion": { 800 | "version": "1.1.11", 801 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 802 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 803 | "dev": true, 804 | "dependencies": { 805 | "balanced-match": "^1.0.0", 806 | "concat-map": "0.0.1" 807 | } 808 | }, 809 | "node_modules/@humanwhocodes/config-array/node_modules/minimatch": { 810 | "version": "3.1.2", 811 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", 812 | "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", 813 | "dev": true, 814 | "dependencies": { 815 | "brace-expansion": "^1.1.7" 816 | }, 817 | "engines": { 818 | "node": "*" 819 | } 820 | }, 821 | "node_modules/@humanwhocodes/module-importer": { 822 | "version": "1.0.1", 823 | "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", 824 | "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", 825 | "dev": true, 826 | "engines": { 827 | "node": ">=12.22" 828 | }, 829 | "funding": { 830 | "type": "github", 831 | "url": "https://github.com/sponsors/nzakas" 832 | } 833 | }, 834 | "node_modules/@humanwhocodes/object-schema": { 835 | "version": "2.0.2", 836 | "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", 837 | "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==", 838 | "dev": true 839 | }, 840 | "node_modules/@internationalized/date": { 841 | "version": "3.5.2", 842 | "resolved": "https://registry.npmjs.org/@internationalized/date/-/date-3.5.2.tgz", 843 | "integrity": "sha512-vo1yOMUt2hzp63IutEaTUxROdvQg1qlMRsbCvbay2AK2Gai7wIgCyK5weEX3nHkiLgo4qCXHijFNC/ILhlRpOQ==", 844 | "dependencies": { 845 | "@swc/helpers": "^0.5.0" 846 | } 847 | }, 848 | "node_modules/@isaacs/cliui": { 849 | "version": "8.0.2", 850 | "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", 851 | "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", 852 | "dev": true, 853 | "dependencies": { 854 | "string-width": "^5.1.2", 855 | "string-width-cjs": "npm:string-width@^4.2.0", 856 | "strip-ansi": "^7.0.1", 857 | "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", 858 | "wrap-ansi": "^8.1.0", 859 | "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" 860 | }, 861 | "engines": { 862 | "node": ">=12" 863 | } 864 | }, 865 | "node_modules/@isaacs/cliui/node_modules/ansi-regex": { 866 | "version": "6.0.1", 867 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", 868 | "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", 869 | "dev": true, 870 | "engines": { 871 | "node": ">=12" 872 | }, 873 | "funding": { 874 | "url": "https://github.com/chalk/ansi-regex?sponsor=1" 875 | } 876 | }, 877 | "node_modules/@isaacs/cliui/node_modules/strip-ansi": { 878 | "version": "7.1.0", 879 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", 880 | "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", 881 | "dev": true, 882 | "dependencies": { 883 | "ansi-regex": "^6.0.1" 884 | }, 885 | "engines": { 886 | "node": ">=12" 887 | }, 888 | "funding": { 889 | "url": "https://github.com/chalk/strip-ansi?sponsor=1" 890 | } 891 | }, 892 | "node_modules/@jest/schemas": { 893 | "version": "29.6.3", 894 | "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", 895 | "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", 896 | "dev": true, 897 | "dependencies": { 898 | "@sinclair/typebox": "^0.27.8" 899 | }, 900 | "engines": { 901 | "node": "^14.15.0 || ^16.10.0 || >=18.0.0" 902 | } 903 | }, 904 | "node_modules/@jridgewell/gen-mapping": { 905 | "version": "0.3.5", 906 | "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", 907 | "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", 908 | "dependencies": { 909 | "@jridgewell/set-array": "^1.2.1", 910 | "@jridgewell/sourcemap-codec": "^1.4.10", 911 | "@jridgewell/trace-mapping": "^0.3.24" 912 | }, 913 | "engines": { 914 | "node": ">=6.0.0" 915 | } 916 | }, 917 | "node_modules/@jridgewell/resolve-uri": { 918 | "version": "3.1.2", 919 | "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", 920 | "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", 921 | "engines": { 922 | "node": ">=6.0.0" 923 | } 924 | }, 925 | "node_modules/@jridgewell/set-array": { 926 | "version": "1.2.1", 927 | "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", 928 | "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", 929 | "engines": { 930 | "node": ">=6.0.0" 931 | } 932 | }, 933 | "node_modules/@jridgewell/sourcemap-codec": { 934 | "version": "1.4.15", 935 | "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", 936 | "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" 937 | }, 938 | "node_modules/@jridgewell/trace-mapping": { 939 | "version": "0.3.25", 940 | "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", 941 | "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", 942 | "dependencies": { 943 | "@jridgewell/resolve-uri": "^3.1.0", 944 | "@jridgewell/sourcemap-codec": "^1.4.14" 945 | } 946 | }, 947 | "node_modules/@lezer/common": { 948 | "version": "1.2.1", 949 | "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.2.1.tgz", 950 | "integrity": "sha512-yemX0ZD2xS/73llMZIK6KplkjIjf2EvAHcinDi/TfJ9hS25G0388+ClHt6/3but0oOxinTcQHJLDXh6w1crzFQ==" 951 | }, 952 | "node_modules/@lezer/highlight": { 953 | "version": "1.2.0", 954 | "resolved": "https://registry.npmjs.org/@lezer/highlight/-/highlight-1.2.0.tgz", 955 | "integrity": "sha512-WrS5Mw51sGrpqjlh3d4/fOwpEV2Hd3YOkp9DBt4k8XZQcoTHZFB7sx030A6OcahF4J1nDQAa3jXlTVVYH50IFA==", 956 | "dependencies": { 957 | "@lezer/common": "^1.0.0" 958 | } 959 | }, 960 | "node_modules/@lezer/javascript": { 961 | "version": "1.4.16", 962 | "resolved": "https://registry.npmjs.org/@lezer/javascript/-/javascript-1.4.16.tgz", 963 | "integrity": "sha512-84UXR3N7s11MPQHWgMnjb9571fr19MmXnr5zTv2XX0gHXXUvW3uPJ8GCjKrfTXmSdfktjRK0ayKklw+A13rk4g==", 964 | "dependencies": { 965 | "@lezer/common": "^1.2.0", 966 | "@lezer/highlight": "^1.1.3", 967 | "@lezer/lr": "^1.3.0" 968 | } 969 | }, 970 | "node_modules/@lezer/lr": { 971 | "version": "1.4.1", 972 | "resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-1.4.1.tgz", 973 | "integrity": "sha512-CHsKq8DMKBf9b3yXPDIU4DbH+ZJd/sJdYOW2llbW/HudP5u0VS6Bfq1hLYfgU7uAYGFIyGGQIsSOXGPEErZiJw==", 974 | "dependencies": { 975 | "@lezer/common": "^1.0.0" 976 | } 977 | }, 978 | "node_modules/@lezer/python": { 979 | "version": "1.1.14", 980 | "resolved": "https://registry.npmjs.org/@lezer/python/-/python-1.1.14.tgz", 981 | "integrity": "sha512-ykDOb2Ti24n76PJsSa4ZoDF0zH12BSw1LGfQXCYJhJyOGiFTfGaX0Du66Ze72R+u/P35U+O6I9m8TFXov1JzsA==", 982 | "dependencies": { 983 | "@lezer/common": "^1.2.0", 984 | "@lezer/highlight": "^1.0.0", 985 | "@lezer/lr": "^1.0.0" 986 | } 987 | }, 988 | "node_modules/@melt-ui/svelte": { 989 | "version": "0.76.0", 990 | "resolved": "https://registry.npmjs.org/@melt-ui/svelte/-/svelte-0.76.0.tgz", 991 | "integrity": "sha512-X1ktxKujjLjOBt8LBvfckHGDMrkHWceRt1jdsUTf0EH76ikNPP1ofSoiV0IhlduDoCBV+2YchJ8kXCDfDXfC9Q==", 992 | "dependencies": { 993 | "@floating-ui/core": "^1.3.1", 994 | "@floating-ui/dom": "^1.4.5", 995 | "@internationalized/date": "^3.5.0", 996 | "dequal": "^2.0.3", 997 | "focus-trap": "^7.5.2", 998 | "nanoid": "^5.0.4" 999 | }, 1000 | "peerDependencies": { 1001 | "svelte": ">=3 <5" 1002 | } 1003 | }, 1004 | "node_modules/@mixmark-io/domino": { 1005 | "version": "2.2.0", 1006 | "resolved": "https://registry.npmjs.org/@mixmark-io/domino/-/domino-2.2.0.tgz", 1007 | "integrity": "sha512-Y28PR25bHXUg88kCV7nivXrP2Nj2RueZ3/l/jdx6J9f8J4nsEGcgX0Qe6lt7Pa+J79+kPiJU3LguR6O/6zrLOw==" 1008 | }, 1009 | "node_modules/@nodelib/fs.scandir": { 1010 | "version": "2.1.5", 1011 | "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", 1012 | "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", 1013 | "dev": true, 1014 | "dependencies": { 1015 | "@nodelib/fs.stat": "2.0.5", 1016 | "run-parallel": "^1.1.9" 1017 | }, 1018 | "engines": { 1019 | "node": ">= 8" 1020 | } 1021 | }, 1022 | "node_modules/@nodelib/fs.stat": { 1023 | "version": "2.0.5", 1024 | "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", 1025 | "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", 1026 | "dev": true, 1027 | "engines": { 1028 | "node": ">= 8" 1029 | } 1030 | }, 1031 | "node_modules/@nodelib/fs.walk": { 1032 | "version": "1.2.8", 1033 | "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", 1034 | "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", 1035 | "dev": true, 1036 | "dependencies": { 1037 | "@nodelib/fs.scandir": "2.1.5", 1038 | "fastq": "^1.6.0" 1039 | }, 1040 | "engines": { 1041 | "node": ">= 8" 1042 | } 1043 | }, 1044 | "node_modules/@pkgjs/parseargs": { 1045 | "version": "0.11.0", 1046 | "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", 1047 | "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", 1048 | "dev": true, 1049 | "optional": true, 1050 | "engines": { 1051 | "node": ">=14" 1052 | } 1053 | }, 1054 | "node_modules/@polka/url": { 1055 | "version": "1.0.0-next.25", 1056 | "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.25.tgz", 1057 | "integrity": "sha512-j7P6Rgr3mmtdkeDGTe0E/aYyWEWVtc5yFXtHCRHs28/jptDEWfaVOc5T7cblqy1XKPPfCxJc/8DwQ5YgLOZOVQ==" 1058 | }, 1059 | "node_modules/@popperjs/core": { 1060 | "version": "2.11.8", 1061 | "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz", 1062 | "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==", 1063 | "funding": { 1064 | "type": "opencollective", 1065 | "url": "https://opencollective.com/popperjs" 1066 | } 1067 | }, 1068 | "node_modules/@pyscript/core": { 1069 | "version": "0.4.32", 1070 | "resolved": "https://registry.npmjs.org/@pyscript/core/-/core-0.4.32.tgz", 1071 | "integrity": "sha512-WQATzPp1ggf871+PukCmTypzScXkEB1EWD/vg5GNxpM96N6rDPqQ13msuA5XvwU01ZVhL8HHSFDLk4IfaXNGWg==", 1072 | "dependencies": { 1073 | "@ungap/with-resolvers": "^0.1.0", 1074 | "basic-devtools": "^0.1.6", 1075 | "polyscript": "^0.12.8", 1076 | "sticky-module": "^0.1.1", 1077 | "to-json-callback": "^0.1.1", 1078 | "type-checked-collections": "^0.1.7" 1079 | } 1080 | }, 1081 | "node_modules/@rollup/plugin-commonjs": { 1082 | "version": "25.0.7", 1083 | "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-25.0.7.tgz", 1084 | "integrity": "sha512-nEvcR+LRjEjsaSsc4x3XZfCCvZIaSMenZu/OiwOKGN2UhQpAYI7ru7czFvyWbErlpoGjnSX3D5Ch5FcMA3kRWQ==", 1085 | "dependencies": { 1086 | "@rollup/pluginutils": "^5.0.1", 1087 | "commondir": "^1.0.1", 1088 | "estree-walker": "^2.0.2", 1089 | "glob": "^8.0.3", 1090 | "is-reference": "1.2.1", 1091 | "magic-string": "^0.30.3" 1092 | }, 1093 | "engines": { 1094 | "node": ">=14.0.0" 1095 | }, 1096 | "peerDependencies": { 1097 | "rollup": "^2.68.0||^3.0.0||^4.0.0" 1098 | }, 1099 | "peerDependenciesMeta": { 1100 | "rollup": { 1101 | "optional": true 1102 | } 1103 | } 1104 | }, 1105 | "node_modules/@rollup/plugin-json": { 1106 | "version": "6.1.0", 1107 | "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-6.1.0.tgz", 1108 | "integrity": "sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==", 1109 | "dependencies": { 1110 | "@rollup/pluginutils": "^5.1.0" 1111 | }, 1112 | "engines": { 1113 | "node": ">=14.0.0" 1114 | }, 1115 | "peerDependencies": { 1116 | "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" 1117 | }, 1118 | "peerDependenciesMeta": { 1119 | "rollup": { 1120 | "optional": true 1121 | } 1122 | } 1123 | }, 1124 | "node_modules/@rollup/plugin-node-resolve": { 1125 | "version": "15.2.3", 1126 | "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.2.3.tgz", 1127 | "integrity": "sha512-j/lym8nf5E21LwBT4Df1VD6hRO2L2iwUeUmP7litikRsVp1H6NWx20NEp0Y7su+7XGc476GnXXc4kFeZNGmaSQ==", 1128 | "dependencies": { 1129 | "@rollup/pluginutils": "^5.0.1", 1130 | "@types/resolve": "1.20.2", 1131 | "deepmerge": "^4.2.2", 1132 | "is-builtin-module": "^3.2.1", 1133 | "is-module": "^1.0.0", 1134 | "resolve": "^1.22.1" 1135 | }, 1136 | "engines": { 1137 | "node": ">=14.0.0" 1138 | }, 1139 | "peerDependencies": { 1140 | "rollup": "^2.78.0||^3.0.0||^4.0.0" 1141 | }, 1142 | "peerDependenciesMeta": { 1143 | "rollup": { 1144 | "optional": true 1145 | } 1146 | } 1147 | }, 1148 | "node_modules/@rollup/pluginutils": { 1149 | "version": "5.1.0", 1150 | "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.1.0.tgz", 1151 | "integrity": "sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==", 1152 | "dependencies": { 1153 | "@types/estree": "^1.0.0", 1154 | "estree-walker": "^2.0.2", 1155 | "picomatch": "^2.3.1" 1156 | }, 1157 | "engines": { 1158 | "node": ">=14.0.0" 1159 | }, 1160 | "peerDependencies": { 1161 | "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" 1162 | }, 1163 | "peerDependenciesMeta": { 1164 | "rollup": { 1165 | "optional": true 1166 | } 1167 | } 1168 | }, 1169 | "node_modules/@rollup/rollup-android-arm-eabi": { 1170 | "version": "4.17.2", 1171 | "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.17.2.tgz", 1172 | "integrity": "sha512-NM0jFxY8bB8QLkoKxIQeObCaDlJKewVlIEkuyYKm5An1tdVZ966w2+MPQ2l8LBZLjR+SgyV+nRkTIunzOYBMLQ==", 1173 | "cpu": [ 1174 | "arm" 1175 | ], 1176 | "dev": true, 1177 | "optional": true, 1178 | "os": [ 1179 | "android" 1180 | ] 1181 | }, 1182 | "node_modules/@rollup/rollup-android-arm64": { 1183 | "version": "4.17.2", 1184 | "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.17.2.tgz", 1185 | "integrity": "sha512-yeX/Usk7daNIVwkq2uGoq2BYJKZY1JfyLTaHO/jaiSwi/lsf8fTFoQW/n6IdAsx5tx+iotu2zCJwz8MxI6D/Bw==", 1186 | "cpu": [ 1187 | "arm64" 1188 | ], 1189 | "dev": true, 1190 | "optional": true, 1191 | "os": [ 1192 | "android" 1193 | ] 1194 | }, 1195 | "node_modules/@rollup/rollup-darwin-arm64": { 1196 | "version": "4.17.2", 1197 | "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.17.2.tgz", 1198 | "integrity": "sha512-kcMLpE6uCwls023+kknm71ug7MZOrtXo+y5p/tsg6jltpDtgQY1Eq5sGfHcQfb+lfuKwhBmEURDga9N0ol4YPw==", 1199 | "cpu": [ 1200 | "arm64" 1201 | ], 1202 | "dev": true, 1203 | "optional": true, 1204 | "os": [ 1205 | "darwin" 1206 | ] 1207 | }, 1208 | "node_modules/@rollup/rollup-darwin-x64": { 1209 | "version": "4.17.2", 1210 | "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.17.2.tgz", 1211 | "integrity": "sha512-AtKwD0VEx0zWkL0ZjixEkp5tbNLzX+FCqGG1SvOu993HnSz4qDI6S4kGzubrEJAljpVkhRSlg5bzpV//E6ysTQ==", 1212 | "cpu": [ 1213 | "x64" 1214 | ], 1215 | "dev": true, 1216 | "optional": true, 1217 | "os": [ 1218 | "darwin" 1219 | ] 1220 | }, 1221 | "node_modules/@rollup/rollup-linux-arm-gnueabihf": { 1222 | "version": "4.17.2", 1223 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.17.2.tgz", 1224 | "integrity": "sha512-3reX2fUHqN7sffBNqmEyMQVj/CKhIHZd4y631duy0hZqI8Qoqf6lTtmAKvJFYa6bhU95B1D0WgzHkmTg33In0A==", 1225 | "cpu": [ 1226 | "arm" 1227 | ], 1228 | "dev": true, 1229 | "optional": true, 1230 | "os": [ 1231 | "linux" 1232 | ] 1233 | }, 1234 | "node_modules/@rollup/rollup-linux-arm-musleabihf": { 1235 | "version": "4.17.2", 1236 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.17.2.tgz", 1237 | "integrity": "sha512-uSqpsp91mheRgw96xtyAGP9FW5ChctTFEoXP0r5FAzj/3ZRv3Uxjtc7taRQSaQM/q85KEKjKsZuiZM3GyUivRg==", 1238 | "cpu": [ 1239 | "arm" 1240 | ], 1241 | "dev": true, 1242 | "optional": true, 1243 | "os": [ 1244 | "linux" 1245 | ] 1246 | }, 1247 | "node_modules/@rollup/rollup-linux-arm64-gnu": { 1248 | "version": "4.17.2", 1249 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.17.2.tgz", 1250 | "integrity": "sha512-EMMPHkiCRtE8Wdk3Qhtciq6BndLtstqZIroHiiGzB3C5LDJmIZcSzVtLRbwuXuUft1Cnv+9fxuDtDxz3k3EW2A==", 1251 | "cpu": [ 1252 | "arm64" 1253 | ], 1254 | "dev": true, 1255 | "optional": true, 1256 | "os": [ 1257 | "linux" 1258 | ] 1259 | }, 1260 | "node_modules/@rollup/rollup-linux-arm64-musl": { 1261 | "version": "4.17.2", 1262 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.17.2.tgz", 1263 | "integrity": "sha512-NMPylUUZ1i0z/xJUIx6VUhISZDRT+uTWpBcjdv0/zkp7b/bQDF+NfnfdzuTiB1G6HTodgoFa93hp0O1xl+/UbA==", 1264 | "cpu": [ 1265 | "arm64" 1266 | ], 1267 | "dev": true, 1268 | "optional": true, 1269 | "os": [ 1270 | "linux" 1271 | ] 1272 | }, 1273 | "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { 1274 | "version": "4.17.2", 1275 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.17.2.tgz", 1276 | "integrity": "sha512-T19My13y8uYXPw/L/k0JYaX1fJKFT/PWdXiHr8mTbXWxjVF1t+8Xl31DgBBvEKclw+1b00Chg0hxE2O7bTG7GQ==", 1277 | "cpu": [ 1278 | "ppc64" 1279 | ], 1280 | "dev": true, 1281 | "optional": true, 1282 | "os": [ 1283 | "linux" 1284 | ] 1285 | }, 1286 | "node_modules/@rollup/rollup-linux-riscv64-gnu": { 1287 | "version": "4.17.2", 1288 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.17.2.tgz", 1289 | "integrity": "sha512-BOaNfthf3X3fOWAB+IJ9kxTgPmMqPPH5f5k2DcCsRrBIbWnaJCgX2ll77dV1TdSy9SaXTR5iDXRL8n7AnoP5cg==", 1290 | "cpu": [ 1291 | "riscv64" 1292 | ], 1293 | "dev": true, 1294 | "optional": true, 1295 | "os": [ 1296 | "linux" 1297 | ] 1298 | }, 1299 | "node_modules/@rollup/rollup-linux-s390x-gnu": { 1300 | "version": "4.17.2", 1301 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.17.2.tgz", 1302 | "integrity": "sha512-W0UP/x7bnn3xN2eYMql2T/+wpASLE5SjObXILTMPUBDB/Fg/FxC+gX4nvCfPBCbNhz51C+HcqQp2qQ4u25ok6g==", 1303 | "cpu": [ 1304 | "s390x" 1305 | ], 1306 | "dev": true, 1307 | "optional": true, 1308 | "os": [ 1309 | "linux" 1310 | ] 1311 | }, 1312 | "node_modules/@rollup/rollup-linux-x64-gnu": { 1313 | "version": "4.17.2", 1314 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.17.2.tgz", 1315 | "integrity": "sha512-Hy7pLwByUOuyaFC6mAr7m+oMC+V7qyifzs/nW2OJfC8H4hbCzOX07Ov0VFk/zP3kBsELWNFi7rJtgbKYsav9QQ==", 1316 | "cpu": [ 1317 | "x64" 1318 | ], 1319 | "dev": true, 1320 | "optional": true, 1321 | "os": [ 1322 | "linux" 1323 | ] 1324 | }, 1325 | "node_modules/@rollup/rollup-linux-x64-musl": { 1326 | "version": "4.17.2", 1327 | "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.17.2.tgz", 1328 | "integrity": "sha512-h1+yTWeYbRdAyJ/jMiVw0l6fOOm/0D1vNLui9iPuqgRGnXA0u21gAqOyB5iHjlM9MMfNOm9RHCQ7zLIzT0x11Q==", 1329 | "cpu": [ 1330 | "x64" 1331 | ], 1332 | "dev": true, 1333 | "optional": true, 1334 | "os": [ 1335 | "linux" 1336 | ] 1337 | }, 1338 | "node_modules/@rollup/rollup-win32-arm64-msvc": { 1339 | "version": "4.17.2", 1340 | "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.17.2.tgz", 1341 | "integrity": "sha512-tmdtXMfKAjy5+IQsVtDiCfqbynAQE/TQRpWdVataHmhMb9DCoJxp9vLcCBjEQWMiUYxO1QprH/HbY9ragCEFLA==", 1342 | "cpu": [ 1343 | "arm64" 1344 | ], 1345 | "dev": true, 1346 | "optional": true, 1347 | "os": [ 1348 | "win32" 1349 | ] 1350 | }, 1351 | "node_modules/@rollup/rollup-win32-ia32-msvc": { 1352 | "version": "4.17.2", 1353 | "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.17.2.tgz", 1354 | "integrity": "sha512-7II/QCSTAHuE5vdZaQEwJq2ZACkBpQDOmQsE6D6XUbnBHW8IAhm4eTufL6msLJorzrHDFv3CF8oCA/hSIRuZeQ==", 1355 | "cpu": [ 1356 | "ia32" 1357 | ], 1358 | "dev": true, 1359 | "optional": true, 1360 | "os": [ 1361 | "win32" 1362 | ] 1363 | }, 1364 | "node_modules/@rollup/rollup-win32-x64-msvc": { 1365 | "version": "4.17.2", 1366 | "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.17.2.tgz", 1367 | "integrity": "sha512-TGGO7v7qOq4CYmSBVEYpI1Y5xDuCEnbVC5Vth8mOsW0gDSzxNrVERPc790IGHsrT2dQSimgMr9Ub3Y1Jci5/8w==", 1368 | "cpu": [ 1369 | "x64" 1370 | ], 1371 | "dev": true, 1372 | "optional": true, 1373 | "os": [ 1374 | "win32" 1375 | ] 1376 | }, 1377 | "node_modules/@sinclair/typebox": { 1378 | "version": "0.27.8", 1379 | "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", 1380 | "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", 1381 | "dev": true 1382 | }, 1383 | "node_modules/@socket.io/component-emitter": { 1384 | "version": "3.1.2", 1385 | "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz", 1386 | "integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==" 1387 | }, 1388 | "node_modules/@sveltejs/adapter-auto": { 1389 | "version": "2.1.1", 1390 | "resolved": "https://registry.npmjs.org/@sveltejs/adapter-auto/-/adapter-auto-2.1.1.tgz", 1391 | "integrity": "sha512-nzi6x/7/3Axh5VKQ8Eed3pYxastxoa06Y/bFhWb7h3Nu+nGRVxKAy3+hBJgmPCwWScy8n0TsstZjSVKfyrIHkg==", 1392 | "dev": true, 1393 | "dependencies": { 1394 | "import-meta-resolve": "^4.0.0" 1395 | }, 1396 | "peerDependencies": { 1397 | "@sveltejs/kit": "^1.0.0" 1398 | } 1399 | }, 1400 | "node_modules/@sveltejs/adapter-node": { 1401 | "version": "1.3.1", 1402 | "resolved": "https://registry.npmjs.org/@sveltejs/adapter-node/-/adapter-node-1.3.1.tgz", 1403 | "integrity": "sha512-A0VgRQDCDPzdLNoiAbcOxGw4zT1Mc+n1LwT1OmO350R7WxrEqdMUChPPOd1iMfIDWlP4ie6E2d/WQf5es2d4Zw==", 1404 | "dependencies": { 1405 | "@rollup/plugin-commonjs": "^25.0.0", 1406 | "@rollup/plugin-json": "^6.0.0", 1407 | "@rollup/plugin-node-resolve": "^15.0.1", 1408 | "rollup": "^3.7.0" 1409 | }, 1410 | "peerDependencies": { 1411 | "@sveltejs/kit": "^1.0.0" 1412 | } 1413 | }, 1414 | "node_modules/@sveltejs/adapter-static": { 1415 | "version": "2.0.3", 1416 | "resolved": "https://registry.npmjs.org/@sveltejs/adapter-static/-/adapter-static-2.0.3.tgz", 1417 | "integrity": "sha512-VUqTfXsxYGugCpMqQv1U0LIdbR3S5nBkMMDmpjGVJyM6Q2jHVMFtdWJCkeHMySc6mZxJ+0eZK3T7IgmUCDrcUQ==", 1418 | "dev": true, 1419 | "peerDependencies": { 1420 | "@sveltejs/kit": "^1.5.0" 1421 | } 1422 | }, 1423 | "node_modules/@sveltejs/kit": { 1424 | "version": "1.30.4", 1425 | "resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-1.30.4.tgz", 1426 | "integrity": "sha512-JSQIQT6XvdchCRQEm7BABxPC56WP5RYVONAi+09S8tmzeP43fBsRlr95bFmsTQM2RHBldfgQk+jgdnsKI75daA==", 1427 | "hasInstallScript": true, 1428 | "dependencies": { 1429 | "@sveltejs/vite-plugin-svelte": "^2.5.0", 1430 | "@types/cookie": "^0.5.1", 1431 | "cookie": "^0.5.0", 1432 | "devalue": "^4.3.1", 1433 | "esm-env": "^1.0.0", 1434 | "kleur": "^4.1.5", 1435 | "magic-string": "^0.30.0", 1436 | "mrmime": "^1.0.1", 1437 | "sade": "^1.8.1", 1438 | "set-cookie-parser": "^2.6.0", 1439 | "sirv": "^2.0.2", 1440 | "tiny-glob": "^0.2.9", 1441 | "undici": "^5.28.3" 1442 | }, 1443 | "bin": { 1444 | "svelte-kit": "svelte-kit.js" 1445 | }, 1446 | "engines": { 1447 | "node": "^16.14 || >=18" 1448 | }, 1449 | "peerDependencies": { 1450 | "svelte": "^3.54.0 || ^4.0.0-next.0 || ^5.0.0-next.0", 1451 | "vite": "^4.0.0" 1452 | } 1453 | }, 1454 | "node_modules/@sveltejs/vite-plugin-svelte": { 1455 | "version": "2.5.3", 1456 | "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-2.5.3.tgz", 1457 | "integrity": "sha512-erhNtXxE5/6xGZz/M9eXsmI7Pxa6MS7jyTy06zN3Ck++ldrppOnOlJwHHTsMC7DHDQdgUp4NAc4cDNQ9eGdB/w==", 1458 | "dependencies": { 1459 | "@sveltejs/vite-plugin-svelte-inspector": "^1.0.4", 1460 | "debug": "^4.3.4", 1461 | "deepmerge": "^4.3.1", 1462 | "kleur": "^4.1.5", 1463 | "magic-string": "^0.30.3", 1464 | "svelte-hmr": "^0.15.3", 1465 | "vitefu": "^0.2.4" 1466 | }, 1467 | "engines": { 1468 | "node": "^14.18.0 || >= 16" 1469 | }, 1470 | "peerDependencies": { 1471 | "svelte": "^3.54.0 || ^4.0.0 || ^5.0.0-next.0", 1472 | "vite": "^4.0.0" 1473 | } 1474 | }, 1475 | "node_modules/@sveltejs/vite-plugin-svelte-inspector": { 1476 | "version": "1.0.4", 1477 | "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte-inspector/-/vite-plugin-svelte-inspector-1.0.4.tgz", 1478 | "integrity": "sha512-zjiuZ3yydBtwpF3bj0kQNV0YXe+iKE545QGZVTaylW3eAzFr+pJ/cwK8lZEaRp4JtaJXhD5DyWAV4AxLh6DgaQ==", 1479 | "dependencies": { 1480 | "debug": "^4.3.4" 1481 | }, 1482 | "engines": { 1483 | "node": "^14.18.0 || >= 16" 1484 | }, 1485 | "peerDependencies": { 1486 | "@sveltejs/vite-plugin-svelte": "^2.2.0", 1487 | "svelte": "^3.54.0 || ^4.0.0", 1488 | "vite": "^4.0.0" 1489 | } 1490 | }, 1491 | "node_modules/@swc/helpers": { 1492 | "version": "0.5.7", 1493 | "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.7.tgz", 1494 | "integrity": "sha512-BVvNZhx362+l2tSwSuyEUV4h7+jk9raNdoTSdLfwTshXJSaGmYKluGRJznziCI3KX02Z19DdsQrdfrpXAU3Hfg==", 1495 | "dependencies": { 1496 | "tslib": "^2.4.0" 1497 | } 1498 | }, 1499 | "node_modules/@tailwindcss/typography": { 1500 | "version": "0.5.10", 1501 | "resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.10.tgz", 1502 | "integrity": "sha512-Pe8BuPJQJd3FfRnm6H0ulKIGoMEQS+Vq01R6M5aCrFB/ccR/shT+0kXLjouGC1gFLm9hopTFN+DMP0pfwRWzPw==", 1503 | "dev": true, 1504 | "dependencies": { 1505 | "lodash.castarray": "^4.4.0", 1506 | "lodash.isplainobject": "^4.0.6", 1507 | "lodash.merge": "^4.6.2", 1508 | "postcss-selector-parser": "6.0.10" 1509 | }, 1510 | "peerDependencies": { 1511 | "tailwindcss": ">=3.0.0 || insiders" 1512 | } 1513 | }, 1514 | "node_modules/@types/bun": { 1515 | "version": "1.0.10", 1516 | "resolved": "https://registry.npmjs.org/@types/bun/-/bun-1.0.10.tgz", 1517 | "integrity": "sha512-Jaz6YYAdm1u3NVlgSyEK+qGmrlLQ20sbWeEoXD64b9w6z/YKYNWlfaphu+xF2Kiy5Tpykm5Q9jIquLegwXx4ng==", 1518 | "dev": true, 1519 | "dependencies": { 1520 | "bun-types": "1.0.33" 1521 | } 1522 | }, 1523 | "node_modules/@types/cookie": { 1524 | "version": "0.5.4", 1525 | "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.5.4.tgz", 1526 | "integrity": "sha512-7z/eR6O859gyWIAjuvBWFzNURmf2oPBmJlfVWkwehU5nzIyjwBsTh7WMmEEV4JFnHuQ3ex4oyTvfKzcyJVDBNA==" 1527 | }, 1528 | "node_modules/@types/d3-scale": { 1529 | "version": "4.0.8", 1530 | "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.8.tgz", 1531 | "integrity": "sha512-gkK1VVTr5iNiYJ7vWDI+yUFFlszhNMtVeneJ6lUTKPjprsvLLI9/tgEGiXJOnlINJA8FyA88gfnQsHbybVZrYQ==", 1532 | "dependencies": { 1533 | "@types/d3-time": "*" 1534 | } 1535 | }, 1536 | "node_modules/@types/d3-scale-chromatic": { 1537 | "version": "3.0.3", 1538 | "resolved": "https://registry.npmjs.org/@types/d3-scale-chromatic/-/d3-scale-chromatic-3.0.3.tgz", 1539 | "integrity": "sha512-laXM4+1o5ImZv3RpFAsTRn3TEkzqkytiOY0Dz0sq5cnd1dtNlk6sHLon4OvqaiJb28T0S/TdsBI3Sjsy+keJrw==" 1540 | }, 1541 | "node_modules/@types/d3-time": { 1542 | "version": "3.0.3", 1543 | "resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.3.tgz", 1544 | "integrity": "sha512-2p6olUZ4w3s+07q3Tm2dbiMZy5pCDfYwtLXXHUnVzXgQlZ/OyPtUz6OL382BkOuGlLXqfT+wqv8Fw2v8/0geBw==" 1545 | }, 1546 | "node_modules/@types/debug": { 1547 | "version": "4.1.12", 1548 | "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", 1549 | "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", 1550 | "dependencies": { 1551 | "@types/ms": "*" 1552 | } 1553 | }, 1554 | "node_modules/@types/estree": { 1555 | "version": "1.0.5", 1556 | "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", 1557 | "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==" 1558 | }, 1559 | "node_modules/@types/json-schema": { 1560 | "version": "7.0.15", 1561 | "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", 1562 | "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", 1563 | "dev": true 1564 | }, 1565 | "node_modules/@types/mdast": { 1566 | "version": "3.0.15", 1567 | "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-3.0.15.tgz", 1568 | "integrity": "sha512-LnwD+mUEfxWMa1QpDraczIn6k0Ee3SMicuYSSzS6ZYl2gKS09EClnJYGd8Du6rfc5r/GZEk5o1mRb8TaTj03sQ==", 1569 | "dependencies": { 1570 | "@types/unist": "^2" 1571 | } 1572 | }, 1573 | "node_modules/@types/minimatch": { 1574 | "version": "3.0.5", 1575 | "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", 1576 | "integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==", 1577 | "dev": true 1578 | }, 1579 | "node_modules/@types/ms": { 1580 | "version": "0.7.34", 1581 | "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.34.tgz", 1582 | "integrity": "sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==" 1583 | }, 1584 | "node_modules/@types/node": { 1585 | "version": "20.11.30", 1586 | "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.30.tgz", 1587 | "integrity": "sha512-dHM6ZxwlmuZaRmUPfv1p+KrdD1Dci04FbdEm/9wEMouFqxYoFl5aMkt0VMAUtYRQDyYvD41WJLukhq/ha3YuTw==", 1588 | "devOptional": true, 1589 | "dependencies": { 1590 | "undici-types": "~5.26.4" 1591 | } 1592 | }, 1593 | "node_modules/@types/pug": { 1594 | "version": "2.0.10", 1595 | "resolved": "https://registry.npmjs.org/@types/pug/-/pug-2.0.10.tgz", 1596 | "integrity": "sha512-Sk/uYFOBAB7mb74XcpizmH0KOR2Pv3D2Hmrh1Dmy5BmK3MpdSa5kqZcg6EKBdklU0bFXX9gCfzvpnyUehrPIuA==", 1597 | "dev": true 1598 | }, 1599 | "node_modules/@types/resolve": { 1600 | "version": "1.20.2", 1601 | "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.2.tgz", 1602 | "integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==" 1603 | }, 1604 | "node_modules/@types/semver": { 1605 | "version": "7.5.8", 1606 | "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", 1607 | "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==", 1608 | "dev": true 1609 | }, 1610 | "node_modules/@types/sinonjs__fake-timers": { 1611 | "version": "8.1.1", 1612 | "resolved": "https://registry.npmjs.org/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-8.1.1.tgz", 1613 | "integrity": "sha512-0kSuKjAS0TrGLJ0M/+8MaFkGsQhZpB6pxOmvS3K8FYI72K//YmdfoW9X2qPsAKh1mkwxGD5zib9s1FIFed6E8g==", 1614 | "dev": true 1615 | }, 1616 | "node_modules/@types/sizzle": { 1617 | "version": "2.3.8", 1618 | "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.8.tgz", 1619 | "integrity": "sha512-0vWLNK2D5MT9dg0iOo8GlKguPAU02QjmZitPEsXRuJXU/OGIOt9vT9Fc26wtYuavLxtO45v9PGleoL9Z0k1LHg==", 1620 | "dev": true 1621 | }, 1622 | "node_modules/@types/symlink-or-copy": { 1623 | "version": "1.2.2", 1624 | "resolved": "https://registry.npmjs.org/@types/symlink-or-copy/-/symlink-or-copy-1.2.2.tgz", 1625 | "integrity": "sha512-MQ1AnmTLOncwEf9IVU+B2e4Hchrku5N67NkgcAHW0p3sdzPe0FNMANxEm6OJUzPniEQGkeT3OROLlCwZJLWFZA==", 1626 | "dev": true 1627 | }, 1628 | "node_modules/@types/unist": { 1629 | "version": "2.0.10", 1630 | "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", 1631 | "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==" 1632 | }, 1633 | "node_modules/@types/ws": { 1634 | "version": "8.5.10", 1635 | "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.10.tgz", 1636 | "integrity": "sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==", 1637 | "dev": true, 1638 | "dependencies": { 1639 | "@types/node": "*" 1640 | } 1641 | }, 1642 | "node_modules/@types/yauzl": { 1643 | "version": "2.10.3", 1644 | "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", 1645 | "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", 1646 | "dev": true, 1647 | "optional": true, 1648 | "dependencies": { 1649 | "@types/node": "*" 1650 | } 1651 | }, 1652 | "node_modules/@typescript-eslint/eslint-plugin": { 1653 | "version": "6.21.0", 1654 | "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.21.0.tgz", 1655 | "integrity": "sha512-oy9+hTPCUFpngkEZUSzbf9MxI65wbKFoQYsgPdILTfbUldp5ovUuphZVe4i30emU9M/kP+T64Di0mxl7dSw3MA==", 1656 | "dev": true, 1657 | "dependencies": { 1658 | "@eslint-community/regexpp": "^4.5.1", 1659 | "@typescript-eslint/scope-manager": "6.21.0", 1660 | "@typescript-eslint/type-utils": "6.21.0", 1661 | "@typescript-eslint/utils": "6.21.0", 1662 | "@typescript-eslint/visitor-keys": "6.21.0", 1663 | "debug": "^4.3.4", 1664 | "graphemer": "^1.4.0", 1665 | "ignore": "^5.2.4", 1666 | "natural-compare": "^1.4.0", 1667 | "semver": "^7.5.4", 1668 | "ts-api-utils": "^1.0.1" 1669 | }, 1670 | "engines": { 1671 | "node": "^16.0.0 || >=18.0.0" 1672 | }, 1673 | "funding": { 1674 | "type": "opencollective", 1675 | "url": "https://opencollective.com/typescript-eslint" 1676 | }, 1677 | "peerDependencies": { 1678 | "@typescript-eslint/parser": "^6.0.0 || ^6.0.0-alpha", 1679 | "eslint": "^7.0.0 || ^8.0.0" 1680 | }, 1681 | "peerDependenciesMeta": { 1682 | "typescript": { 1683 | "optional": true 1684 | } 1685 | } 1686 | }, 1687 | "node_modules/@typescript-eslint/parser": { 1688 | "version": "6.21.0", 1689 | "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.21.0.tgz", 1690 | "integrity": "sha512-tbsV1jPne5CkFQCgPBcDOt30ItF7aJoZL997JSF7MhGQqOeT3svWRYxiqlfA5RUdlHN6Fi+EI9bxqbdyAUZjYQ==", 1691 | "dev": true, 1692 | "dependencies": { 1693 | "@typescript-eslint/scope-manager": "6.21.0", 1694 | "@typescript-eslint/types": "6.21.0", 1695 | "@typescript-eslint/typescript-estree": "6.21.0", 1696 | "@typescript-eslint/visitor-keys": "6.21.0", 1697 | "debug": "^4.3.4" 1698 | }, 1699 | "engines": { 1700 | "node": "^16.0.0 || >=18.0.0" 1701 | }, 1702 | "funding": { 1703 | "type": "opencollective", 1704 | "url": "https://opencollective.com/typescript-eslint" 1705 | }, 1706 | "peerDependencies": { 1707 | "eslint": "^7.0.0 || ^8.0.0" 1708 | }, 1709 | "peerDependenciesMeta": { 1710 | "typescript": { 1711 | "optional": true 1712 | } 1713 | } 1714 | }, 1715 | "node_modules/@typescript-eslint/scope-manager": { 1716 | "version": "6.21.0", 1717 | "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.21.0.tgz", 1718 | "integrity": "sha512-OwLUIWZJry80O99zvqXVEioyniJMa+d2GrqpUTqi5/v5D5rOrppJVBPa0yKCblcigC0/aYAzxxqQ1B+DS2RYsg==", 1719 | "dev": true, 1720 | "dependencies": { 1721 | "@typescript-eslint/types": "6.21.0", 1722 | "@typescript-eslint/visitor-keys": "6.21.0" 1723 | }, 1724 | "engines": { 1725 | "node": "^16.0.0 || >=18.0.0" 1726 | }, 1727 | "funding": { 1728 | "type": "opencollective", 1729 | "url": "https://opencollective.com/typescript-eslint" 1730 | } 1731 | }, 1732 | "node_modules/@typescript-eslint/type-utils": { 1733 | "version": "6.21.0", 1734 | "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.21.0.tgz", 1735 | "integrity": "sha512-rZQI7wHfao8qMX3Rd3xqeYSMCL3SoiSQLBATSiVKARdFGCYSRvmViieZjqc58jKgs8Y8i9YvVVhRbHSTA4VBag==", 1736 | "dev": true, 1737 | "dependencies": { 1738 | "@typescript-eslint/typescript-estree": "6.21.0", 1739 | "@typescript-eslint/utils": "6.21.0", 1740 | "debug": "^4.3.4", 1741 | "ts-api-utils": "^1.0.1" 1742 | }, 1743 | "engines": { 1744 | "node": "^16.0.0 || >=18.0.0" 1745 | }, 1746 | "funding": { 1747 | "type": "opencollective", 1748 | "url": "https://opencollective.com/typescript-eslint" 1749 | }, 1750 | "peerDependencies": { 1751 | "eslint": "^7.0.0 || ^8.0.0" 1752 | }, 1753 | "peerDependenciesMeta": { 1754 | "typescript": { 1755 | "optional": true 1756 | } 1757 | } 1758 | }, 1759 | "node_modules/@typescript-eslint/types": { 1760 | "version": "6.21.0", 1761 | "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.21.0.tgz", 1762 | "integrity": "sha512-1kFmZ1rOm5epu9NZEZm1kckCDGj5UJEf7P1kliH4LKu/RkwpsfqqGmY2OOcUs18lSlQBKLDYBOGxRVtrMN5lpg==", 1763 | "dev": true, 1764 | "engines": { 1765 | "node": "^16.0.0 || >=18.0.0" 1766 | }, 1767 | "funding": { 1768 | "type": "opencollective", 1769 | "url": "https://opencollective.com/typescript-eslint" 1770 | } 1771 | }, 1772 | "node_modules/@typescript-eslint/typescript-estree": { 1773 | "version": "6.21.0", 1774 | "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.21.0.tgz", 1775 | "integrity": "sha512-6npJTkZcO+y2/kr+z0hc4HwNfrrP4kNYh57ek7yCNlrBjWQ1Y0OS7jiZTkgumrvkX5HkEKXFZkkdFNkaW2wmUQ==", 1776 | "dev": true, 1777 | "dependencies": { 1778 | "@typescript-eslint/types": "6.21.0", 1779 | "@typescript-eslint/visitor-keys": "6.21.0", 1780 | "debug": "^4.3.4", 1781 | "globby": "^11.1.0", 1782 | "is-glob": "^4.0.3", 1783 | "minimatch": "9.0.3", 1784 | "semver": "^7.5.4", 1785 | "ts-api-utils": "^1.0.1" 1786 | }, 1787 | "engines": { 1788 | "node": "^16.0.0 || >=18.0.0" 1789 | }, 1790 | "funding": { 1791 | "type": "opencollective", 1792 | "url": "https://opencollective.com/typescript-eslint" 1793 | }, 1794 | "peerDependenciesMeta": { 1795 | "typescript": { 1796 | "optional": true 1797 | } 1798 | } 1799 | }, 1800 | "node_modules/@typescript-eslint/utils": { 1801 | "version": "6.21.0", 1802 | "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.21.0.tgz", 1803 | "integrity": "sha512-NfWVaC8HP9T8cbKQxHcsJBY5YE1O33+jpMwN45qzWWaPDZgLIbo12toGMWnmhvCpd3sIxkpDw3Wv1B3dYrbDQQ==", 1804 | "dev": true, 1805 | "dependencies": { 1806 | "@eslint-community/eslint-utils": "^4.4.0", 1807 | "@types/json-schema": "^7.0.12", 1808 | "@types/semver": "^7.5.0", 1809 | "@typescript-eslint/scope-manager": "6.21.0", 1810 | "@typescript-eslint/types": "6.21.0", 1811 | "@typescript-eslint/typescript-estree": "6.21.0", 1812 | "semver": "^7.5.4" 1813 | }, 1814 | "engines": { 1815 | "node": "^16.0.0 || >=18.0.0" 1816 | }, 1817 | "funding": { 1818 | "type": "opencollective", 1819 | "url": "https://opencollective.com/typescript-eslint" 1820 | }, 1821 | "peerDependencies": { 1822 | "eslint": "^7.0.0 || ^8.0.0" 1823 | } 1824 | }, 1825 | "node_modules/@typescript-eslint/visitor-keys": { 1826 | "version": "6.21.0", 1827 | "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.21.0.tgz", 1828 | "integrity": "sha512-JJtkDduxLi9bivAB+cYOVMtbkqdPOhZ+ZI5LC47MIRrDV4Yn2o+ZnW10Nkmr28xRpSpdJ6Sm42Hjf2+REYXm0A==", 1829 | "dev": true, 1830 | "dependencies": { 1831 | "@typescript-eslint/types": "6.21.0", 1832 | "eslint-visitor-keys": "^3.4.1" 1833 | }, 1834 | "engines": { 1835 | "node": "^16.0.0 || >=18.0.0" 1836 | }, 1837 | "funding": { 1838 | "type": "opencollective", 1839 | "url": "https://opencollective.com/typescript-eslint" 1840 | } 1841 | }, 1842 | "node_modules/@ungap/structured-clone": { 1843 | "version": "1.2.0", 1844 | "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", 1845 | "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==" 1846 | }, 1847 | "node_modules/@ungap/with-resolvers": { 1848 | "version": "0.1.0", 1849 | "resolved": "https://registry.npmjs.org/@ungap/with-resolvers/-/with-resolvers-0.1.0.tgz", 1850 | "integrity": "sha512-g7f0IkJdPW2xhY7H4iE72DAsIyfuwEFc6JWc2tYFwKDMWWAF699vGjrM348cwQuOXgHpe1gWFe+Eiyjx/ewvvw==" 1851 | }, 1852 | "node_modules/@vitest/expect": { 1853 | "version": "1.6.0", 1854 | "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-1.6.0.tgz", 1855 | "integrity": "sha512-ixEvFVQjycy/oNgHjqsL6AZCDduC+tflRluaHIzKIsdbzkLn2U/iBnVeJwB6HsIjQBdfMR8Z0tRxKUsvFJEeWQ==", 1856 | "dev": true, 1857 | "dependencies": { 1858 | "@vitest/spy": "1.6.0", 1859 | "@vitest/utils": "1.6.0", 1860 | "chai": "^4.3.10" 1861 | }, 1862 | "funding": { 1863 | "url": "https://opencollective.com/vitest" 1864 | } 1865 | }, 1866 | "node_modules/@vitest/runner": { 1867 | "version": "1.6.0", 1868 | "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.6.0.tgz", 1869 | "integrity": "sha512-P4xgwPjwesuBiHisAVz/LSSZtDjOTPYZVmNAnpHHSR6ONrf8eCJOFRvUwdHn30F5M1fxhqtl7QZQUk2dprIXAg==", 1870 | "dev": true, 1871 | "dependencies": { 1872 | "@vitest/utils": "1.6.0", 1873 | "p-limit": "^5.0.0", 1874 | "pathe": "^1.1.1" 1875 | }, 1876 | "funding": { 1877 | "url": "https://opencollective.com/vitest" 1878 | } 1879 | }, 1880 | "node_modules/@vitest/runner/node_modules/p-limit": { 1881 | "version": "5.0.0", 1882 | "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-5.0.0.tgz", 1883 | "integrity": "sha512-/Eaoq+QyLSiXQ4lyYV23f14mZRQcXnxfHrN0vCai+ak9G0pp9iEQukIIZq5NccEvwRB8PUnZT0KsOoDCINS1qQ==", 1884 | "dev": true, 1885 | "dependencies": { 1886 | "yocto-queue": "^1.0.0" 1887 | }, 1888 | "engines": { 1889 | "node": ">=18" 1890 | }, 1891 | "funding": { 1892 | "url": "https://github.com/sponsors/sindresorhus" 1893 | } 1894 | }, 1895 | "node_modules/@vitest/runner/node_modules/yocto-queue": { 1896 | "version": "1.0.0", 1897 | "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz", 1898 | "integrity": "sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==", 1899 | "dev": true, 1900 | "engines": { 1901 | "node": ">=12.20" 1902 | }, 1903 | "funding": { 1904 | "url": "https://github.com/sponsors/sindresorhus" 1905 | } 1906 | }, 1907 | "node_modules/@vitest/snapshot": { 1908 | "version": "1.6.0", 1909 | "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-1.6.0.tgz", 1910 | "integrity": "sha512-+Hx43f8Chus+DCmygqqfetcAZrDJwvTj0ymqjQq4CvmpKFSTVteEOBzCusu1x2tt4OJcvBflyHUE0DZSLgEMtQ==", 1911 | "dev": true, 1912 | "dependencies": { 1913 | "magic-string": "^0.30.5", 1914 | "pathe": "^1.1.1", 1915 | "pretty-format": "^29.7.0" 1916 | }, 1917 | "funding": { 1918 | "url": "https://opencollective.com/vitest" 1919 | } 1920 | }, 1921 | "node_modules/@vitest/spy": { 1922 | "version": "1.6.0", 1923 | "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-1.6.0.tgz", 1924 | "integrity": "sha512-leUTap6B/cqi/bQkXUu6bQV5TZPx7pmMBKBQiI0rJA8c3pB56ZsaTbREnF7CJfmvAS4V2cXIBAh/3rVwrrCYgw==", 1925 | "dev": true, 1926 | "dependencies": { 1927 | "tinyspy": "^2.2.0" 1928 | }, 1929 | "funding": { 1930 | "url": "https://opencollective.com/vitest" 1931 | } 1932 | }, 1933 | "node_modules/@vitest/utils": { 1934 | "version": "1.6.0", 1935 | "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.6.0.tgz", 1936 | "integrity": "sha512-21cPiuGMoMZwiOHa2i4LXkMkMkCGzA+MVFV70jRwHo95dL4x/ts5GZhML1QWuy7yfp3WzK3lRvZi3JnXTYqrBw==", 1937 | "dev": true, 1938 | "dependencies": { 1939 | "diff-sequences": "^29.6.3", 1940 | "estree-walker": "^3.0.3", 1941 | "loupe": "^2.3.7", 1942 | "pretty-format": "^29.7.0" 1943 | }, 1944 | "funding": { 1945 | "url": "https://opencollective.com/vitest" 1946 | } 1947 | }, 1948 | "node_modules/@vitest/utils/node_modules/estree-walker": { 1949 | "version": "3.0.3", 1950 | "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", 1951 | "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", 1952 | "dev": true, 1953 | "dependencies": { 1954 | "@types/estree": "^1.0.0" 1955 | } 1956 | }, 1957 | "node_modules/@webreflection/fetch": { 1958 | "version": "0.1.5", 1959 | "resolved": "https://registry.npmjs.org/@webreflection/fetch/-/fetch-0.1.5.tgz", 1960 | "integrity": "sha512-zCcqCJoNLvdeF41asAK71XPlwSPieeRDsE09albBunJEksuYPYNillKNQjf8p5BqSoTKTuKrW3lUm3MNodUC4g==" 1961 | }, 1962 | "node_modules/acorn": { 1963 | "version": "8.11.3", 1964 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", 1965 | "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", 1966 | "bin": { 1967 | "acorn": "bin/acorn" 1968 | }, 1969 | "engines": { 1970 | "node": ">=0.4.0" 1971 | } 1972 | }, 1973 | "node_modules/acorn-jsx": { 1974 | "version": "5.3.2", 1975 | "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", 1976 | "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", 1977 | "dev": true, 1978 | "peerDependencies": { 1979 | "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" 1980 | } 1981 | }, 1982 | "node_modules/acorn-walk": { 1983 | "version": "8.3.2", 1984 | "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz", 1985 | "integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==", 1986 | "dev": true, 1987 | "engines": { 1988 | "node": ">=0.4.0" 1989 | } 1990 | }, 1991 | "node_modules/aggregate-error": { 1992 | "version": "3.1.0", 1993 | "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", 1994 | "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", 1995 | "dev": true, 1996 | "dependencies": { 1997 | "clean-stack": "^2.0.0", 1998 | "indent-string": "^4.0.0" 1999 | }, 2000 | "engines": { 2001 | "node": ">=8" 2002 | } 2003 | }, 2004 | "node_modules/ajv": { 2005 | "version": "6.12.6", 2006 | "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", 2007 | "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", 2008 | "dev": true, 2009 | "dependencies": { 2010 | "fast-deep-equal": "^3.1.1", 2011 | "fast-json-stable-stringify": "^2.0.0", 2012 | "json-schema-traverse": "^0.4.1", 2013 | "uri-js": "^4.2.2" 2014 | }, 2015 | "funding": { 2016 | "type": "github", 2017 | "url": "https://github.com/sponsors/epoberezkin" 2018 | } 2019 | }, 2020 | "node_modules/ansi-colors": { 2021 | "version": "4.1.3", 2022 | "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", 2023 | "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", 2024 | "dev": true, 2025 | "engines": { 2026 | "node": ">=6" 2027 | } 2028 | }, 2029 | "node_modules/ansi-escapes": { 2030 | "version": "4.3.2", 2031 | "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", 2032 | "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", 2033 | "dev": true, 2034 | "dependencies": { 2035 | "type-fest": "^0.21.3" 2036 | }, 2037 | "engines": { 2038 | "node": ">=8" 2039 | }, 2040 | "funding": { 2041 | "url": "https://github.com/sponsors/sindresorhus" 2042 | } 2043 | }, 2044 | "node_modules/ansi-escapes/node_modules/type-fest": { 2045 | "version": "0.21.3", 2046 | "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", 2047 | "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", 2048 | "dev": true, 2049 | "engines": { 2050 | "node": ">=10" 2051 | }, 2052 | "funding": { 2053 | "url": "https://github.com/sponsors/sindresorhus" 2054 | } 2055 | }, 2056 | "node_modules/ansi-regex": { 2057 | "version": "5.0.1", 2058 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", 2059 | "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", 2060 | "dev": true, 2061 | "engines": { 2062 | "node": ">=8" 2063 | } 2064 | }, 2065 | "node_modules/ansi-styles": { 2066 | "version": "4.3.0", 2067 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", 2068 | "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", 2069 | "dev": true, 2070 | "dependencies": { 2071 | "color-convert": "^2.0.1" 2072 | }, 2073 | "engines": { 2074 | "node": ">=8" 2075 | }, 2076 | "funding": { 2077 | "url": "https://github.com/chalk/ansi-styles?sponsor=1" 2078 | } 2079 | }, 2080 | "node_modules/any-promise": { 2081 | "version": "1.3.0", 2082 | "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", 2083 | "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", 2084 | "dev": true 2085 | }, 2086 | "node_modules/anymatch": { 2087 | "version": "3.1.3", 2088 | "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", 2089 | "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", 2090 | "dev": true, 2091 | "dependencies": { 2092 | "normalize-path": "^3.0.0", 2093 | "picomatch": "^2.0.4" 2094 | }, 2095 | "engines": { 2096 | "node": ">= 8" 2097 | } 2098 | }, 2099 | "node_modules/arch": { 2100 | "version": "2.2.0", 2101 | "resolved": "https://registry.npmjs.org/arch/-/arch-2.2.0.tgz", 2102 | "integrity": "sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ==", 2103 | "dev": true, 2104 | "funding": [ 2105 | { 2106 | "type": "github", 2107 | "url": "https://github.com/sponsors/feross" 2108 | }, 2109 | { 2110 | "type": "patreon", 2111 | "url": "https://www.patreon.com/feross" 2112 | }, 2113 | { 2114 | "type": "consulting", 2115 | "url": "https://feross.org/support" 2116 | } 2117 | ] 2118 | }, 2119 | "node_modules/arg": { 2120 | "version": "5.0.2", 2121 | "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", 2122 | "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", 2123 | "dev": true 2124 | }, 2125 | "node_modules/argparse": { 2126 | "version": "2.0.1", 2127 | "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", 2128 | "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", 2129 | "dev": true 2130 | }, 2131 | "node_modules/aria-query": { 2132 | "version": "5.3.0", 2133 | "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", 2134 | "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", 2135 | "dependencies": { 2136 | "dequal": "^2.0.3" 2137 | } 2138 | }, 2139 | "node_modules/array-union": { 2140 | "version": "2.1.0", 2141 | "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", 2142 | "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", 2143 | "dev": true, 2144 | "engines": { 2145 | "node": ">=8" 2146 | } 2147 | }, 2148 | "node_modules/asn1": { 2149 | "version": "0.2.6", 2150 | "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", 2151 | "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", 2152 | "dev": true, 2153 | "dependencies": { 2154 | "safer-buffer": "~2.1.0" 2155 | } 2156 | }, 2157 | "node_modules/assert-plus": { 2158 | "version": "1.0.0", 2159 | "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", 2160 | "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", 2161 | "dev": true, 2162 | "engines": { 2163 | "node": ">=0.8" 2164 | } 2165 | }, 2166 | "node_modules/assertion-error": { 2167 | "version": "1.1.0", 2168 | "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", 2169 | "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", 2170 | "dev": true, 2171 | "engines": { 2172 | "node": "*" 2173 | } 2174 | }, 2175 | "node_modules/astral-regex": { 2176 | "version": "2.0.0", 2177 | "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", 2178 | "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", 2179 | "dev": true, 2180 | "engines": { 2181 | "node": ">=8" 2182 | } 2183 | }, 2184 | "node_modules/async": { 2185 | "version": "3.2.5", 2186 | "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz", 2187 | "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==" 2188 | }, 2189 | "node_modules/asynckit": { 2190 | "version": "0.4.0", 2191 | "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", 2192 | "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", 2193 | "dev": true 2194 | }, 2195 | "node_modules/at-least-node": { 2196 | "version": "1.0.0", 2197 | "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", 2198 | "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", 2199 | "dev": true, 2200 | "engines": { 2201 | "node": ">= 4.0.0" 2202 | } 2203 | }, 2204 | "node_modules/autoprefixer": { 2205 | "version": "10.4.19", 2206 | "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.19.tgz", 2207 | "integrity": "sha512-BaENR2+zBZ8xXhM4pUaKUxlVdxZ0EZhjvbopwnXmxRUfqDmwSpC2lAi/QXvx7NRdPCo1WKEcEF6mV64si1z4Ew==", 2208 | "dev": true, 2209 | "funding": [ 2210 | { 2211 | "type": "opencollective", 2212 | "url": "https://opencollective.com/postcss/" 2213 | }, 2214 | { 2215 | "type": "tidelift", 2216 | "url": "https://tidelift.com/funding/github/npm/autoprefixer" 2217 | }, 2218 | { 2219 | "type": "github", 2220 | "url": "https://github.com/sponsors/ai" 2221 | } 2222 | ], 2223 | "dependencies": { 2224 | "browserslist": "^4.23.0", 2225 | "caniuse-lite": "^1.0.30001599", 2226 | "fraction.js": "^4.3.7", 2227 | "normalize-range": "^0.1.2", 2228 | "picocolors": "^1.0.0", 2229 | "postcss-value-parser": "^4.2.0" 2230 | }, 2231 | "bin": { 2232 | "autoprefixer": "bin/autoprefixer" 2233 | }, 2234 | "engines": { 2235 | "node": "^10 || ^12 || >=14" 2236 | }, 2237 | "peerDependencies": { 2238 | "postcss": "^8.1.0" 2239 | } 2240 | }, 2241 | "node_modules/aws-sign2": { 2242 | "version": "0.7.0", 2243 | "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", 2244 | "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==", 2245 | "dev": true, 2246 | "engines": { 2247 | "node": "*" 2248 | } 2249 | }, 2250 | "node_modules/aws4": { 2251 | "version": "1.12.0", 2252 | "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz", 2253 | "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==", 2254 | "dev": true 2255 | }, 2256 | "node_modules/axobject-query": { 2257 | "version": "4.0.0", 2258 | "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.0.0.tgz", 2259 | "integrity": "sha512-+60uv1hiVFhHZeO+Lz0RYzsVHy5Wr1ayX0mwda9KPDVLNJgZ1T9Ny7VmFbLDzxsH0D87I86vgj3gFrjTJUYznw==", 2260 | "dependencies": { 2261 | "dequal": "^2.0.3" 2262 | } 2263 | }, 2264 | "node_modules/balanced-match": { 2265 | "version": "1.0.2", 2266 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", 2267 | "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" 2268 | }, 2269 | "node_modules/bare-events": { 2270 | "version": "2.2.2", 2271 | "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.2.2.tgz", 2272 | "integrity": "sha512-h7z00dWdG0PYOQEvChhOSWvOfkIKsdZGkWr083FgN/HyoQuebSew/cgirYqh9SCuy/hRvxc5Vy6Fw8xAmYHLkQ==", 2273 | "dev": true, 2274 | "optional": true 2275 | }, 2276 | "node_modules/base64-js": { 2277 | "version": "1.5.1", 2278 | "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", 2279 | "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", 2280 | "dev": true, 2281 | "funding": [ 2282 | { 2283 | "type": "github", 2284 | "url": "https://github.com/sponsors/feross" 2285 | }, 2286 | { 2287 | "type": "patreon", 2288 | "url": "https://www.patreon.com/feross" 2289 | }, 2290 | { 2291 | "type": "consulting", 2292 | "url": "https://feross.org/support" 2293 | } 2294 | ] 2295 | }, 2296 | "node_modules/basic-devtools": { 2297 | "version": "0.1.6", 2298 | "resolved": "https://registry.npmjs.org/basic-devtools/-/basic-devtools-0.1.6.tgz", 2299 | "integrity": "sha512-g9zJ63GmdUesS3/Fwv0B5SYX6nR56TQXmGr+wE5PRTNCnGQMYWhUx/nZB/mMWnQJVLPPAp89oxDNlasdtNkW5Q==" 2300 | }, 2301 | "node_modules/bcrypt-pbkdf": { 2302 | "version": "1.0.2", 2303 | "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", 2304 | "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", 2305 | "dev": true, 2306 | "dependencies": { 2307 | "tweetnacl": "^0.14.3" 2308 | } 2309 | }, 2310 | "node_modules/binary-extensions": { 2311 | "version": "2.3.0", 2312 | "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", 2313 | "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", 2314 | "dev": true, 2315 | "engines": { 2316 | "node": ">=8" 2317 | }, 2318 | "funding": { 2319 | "url": "https://github.com/sponsors/sindresorhus" 2320 | } 2321 | }, 2322 | "node_modules/bits-ui": { 2323 | "version": "0.19.7", 2324 | "resolved": "https://registry.npmjs.org/bits-ui/-/bits-ui-0.19.7.tgz", 2325 | "integrity": "sha512-GHUpKvN7QyazhnZNkUy0lxg6W1M6KJHWSZ4a/UGCjPE6nQgk6vKbGysY67PkDtQMknZTZAzVoMj1Eic4IKeCRQ==", 2326 | "dependencies": { 2327 | "@internationalized/date": "^3.5.1", 2328 | "@melt-ui/svelte": "0.76.0", 2329 | "nanoid": "^5.0.5" 2330 | }, 2331 | "peerDependencies": { 2332 | "svelte": "^4.0.0" 2333 | } 2334 | }, 2335 | "node_modules/bl": { 2336 | "version": "5.1.0", 2337 | "resolved": "https://registry.npmjs.org/bl/-/bl-5.1.0.tgz", 2338 | "integrity": "sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==", 2339 | "dev": true, 2340 | "dependencies": { 2341 | "buffer": "^6.0.3", 2342 | "inherits": "^2.0.4", 2343 | "readable-stream": "^3.4.0" 2344 | } 2345 | }, 2346 | "node_modules/bl/node_modules/readable-stream": { 2347 | "version": "3.6.2", 2348 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", 2349 | "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", 2350 | "dev": true, 2351 | "dependencies": { 2352 | "inherits": "^2.0.3", 2353 | "string_decoder": "^1.1.1", 2354 | "util-deprecate": "^1.0.1" 2355 | }, 2356 | "engines": { 2357 | "node": ">= 6" 2358 | } 2359 | }, 2360 | "node_modules/blob-util": { 2361 | "version": "2.0.2", 2362 | "resolved": "https://registry.npmjs.org/blob-util/-/blob-util-2.0.2.tgz", 2363 | "integrity": "sha512-T7JQa+zsXXEa6/8ZhHcQEW1UFfVM49Ts65uBkFL6fz2QmrElqmbajIDJvuA0tEhRe5eIjpV9ZF+0RfZR9voJFQ==", 2364 | "dev": true 2365 | }, 2366 | "node_modules/bluebird": { 2367 | "version": "3.7.2", 2368 | "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", 2369 | "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", 2370 | "dev": true 2371 | }, 2372 | "node_modules/boolbase": { 2373 | "version": "1.0.0", 2374 | "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", 2375 | "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", 2376 | "dev": true 2377 | }, 2378 | "node_modules/brace-expansion": { 2379 | "version": "2.0.1", 2380 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", 2381 | "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", 2382 | "dependencies": { 2383 | "balanced-match": "^1.0.0" 2384 | } 2385 | }, 2386 | "node_modules/braces": { 2387 | "version": "3.0.3", 2388 | "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", 2389 | "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", 2390 | "dev": true, 2391 | "dependencies": { 2392 | "fill-range": "^7.1.1" 2393 | }, 2394 | "engines": { 2395 | "node": ">=8" 2396 | } 2397 | }, 2398 | "node_modules/broccoli-node-api": { 2399 | "version": "1.7.0", 2400 | "resolved": "https://registry.npmjs.org/broccoli-node-api/-/broccoli-node-api-1.7.0.tgz", 2401 | "integrity": "sha512-QIqLSVJWJUVOhclmkmypJJH9u9s/aWH4+FH6Q6Ju5l+Io4dtwqdPUNmDfw40o6sxhbZHhqGujDJuHTML1wG8Yw==", 2402 | "dev": true 2403 | }, 2404 | "node_modules/broccoli-node-info": { 2405 | "version": "2.2.0", 2406 | "resolved": "https://registry.npmjs.org/broccoli-node-info/-/broccoli-node-info-2.2.0.tgz", 2407 | "integrity": "sha512-VabSGRpKIzpmC+r+tJueCE5h8k6vON7EIMMWu6d/FyPdtijwLQ7QvzShEw+m3mHoDzUaj/kiZsDYrS8X2adsBg==", 2408 | "dev": true, 2409 | "engines": { 2410 | "node": "8.* || >= 10.*" 2411 | } 2412 | }, 2413 | "node_modules/broccoli-output-wrapper": { 2414 | "version": "3.2.5", 2415 | "resolved": "https://registry.npmjs.org/broccoli-output-wrapper/-/broccoli-output-wrapper-3.2.5.tgz", 2416 | "integrity": "sha512-bQAtwjSrF4Nu0CK0JOy5OZqw9t5U0zzv2555EA/cF8/a8SLDTIetk9UgrtMVw7qKLKdSpOZ2liZNeZZDaKgayw==", 2417 | "dev": true, 2418 | "dependencies": { 2419 | "fs-extra": "^8.1.0", 2420 | "heimdalljs-logger": "^0.1.10", 2421 | "symlink-or-copy": "^1.2.0" 2422 | }, 2423 | "engines": { 2424 | "node": "10.* || >= 12.*" 2425 | } 2426 | }, 2427 | "node_modules/broccoli-output-wrapper/node_modules/fs-extra": { 2428 | "version": "8.1.0", 2429 | "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", 2430 | "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", 2431 | "dev": true, 2432 | "dependencies": { 2433 | "graceful-fs": "^4.2.0", 2434 | "jsonfile": "^4.0.0", 2435 | "universalify": "^0.1.0" 2436 | }, 2437 | "engines": { 2438 | "node": ">=6 <7 || >=8" 2439 | } 2440 | }, 2441 | "node_modules/broccoli-output-wrapper/node_modules/jsonfile": { 2442 | "version": "4.0.0", 2443 | "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", 2444 | "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", 2445 | "dev": true, 2446 | "optionalDependencies": { 2447 | "graceful-fs": "^4.1.6" 2448 | } 2449 | }, 2450 | "node_modules/broccoli-output-wrapper/node_modules/universalify": { 2451 | "version": "0.1.2", 2452 | "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", 2453 | "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", 2454 | "dev": true, 2455 | "engines": { 2456 | "node": ">= 4.0.0" 2457 | } 2458 | }, 2459 | "node_modules/broccoli-plugin": { 2460 | "version": "4.0.7", 2461 | "resolved": "https://registry.npmjs.org/broccoli-plugin/-/broccoli-plugin-4.0.7.tgz", 2462 | "integrity": "sha512-a4zUsWtA1uns1K7p9rExYVYG99rdKeGRymW0qOCNkvDPHQxVi3yVyJHhQbM3EZwdt2E0mnhr5e0c/bPpJ7p3Wg==", 2463 | "dev": true, 2464 | "dependencies": { 2465 | "broccoli-node-api": "^1.7.0", 2466 | "broccoli-output-wrapper": "^3.2.5", 2467 | "fs-merger": "^3.2.1", 2468 | "promise-map-series": "^0.3.0", 2469 | "quick-temp": "^0.1.8", 2470 | "rimraf": "^3.0.2", 2471 | "symlink-or-copy": "^1.3.1" 2472 | }, 2473 | "engines": { 2474 | "node": "10.* || >= 12.*" 2475 | } 2476 | }, 2477 | "node_modules/browserslist": { 2478 | "version": "4.23.0", 2479 | "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.0.tgz", 2480 | "integrity": "sha512-QW8HiM1shhT2GuzkvklfjcKDiWFXHOeFCIA/huJPwHsslwcydgk7X+z2zXpEijP98UCY7HbubZt5J2Zgvf0CaQ==", 2481 | "dev": true, 2482 | "funding": [ 2483 | { 2484 | "type": "opencollective", 2485 | "url": "https://opencollective.com/browserslist" 2486 | }, 2487 | { 2488 | "type": "tidelift", 2489 | "url": "https://tidelift.com/funding/github/npm/browserslist" 2490 | }, 2491 | { 2492 | "type": "github", 2493 | "url": "https://github.com/sponsors/ai" 2494 | } 2495 | ], 2496 | "dependencies": { 2497 | "caniuse-lite": "^1.0.30001587", 2498 | "electron-to-chromium": "^1.4.668", 2499 | "node-releases": "^2.0.14", 2500 | "update-browserslist-db": "^1.0.13" 2501 | }, 2502 | "bin": { 2503 | "browserslist": "cli.js" 2504 | }, 2505 | "engines": { 2506 | "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" 2507 | } 2508 | }, 2509 | "node_modules/buffer": { 2510 | "version": "6.0.3", 2511 | "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", 2512 | "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", 2513 | "dev": true, 2514 | "funding": [ 2515 | { 2516 | "type": "github", 2517 | "url": "https://github.com/sponsors/feross" 2518 | }, 2519 | { 2520 | "type": "patreon", 2521 | "url": "https://www.patreon.com/feross" 2522 | }, 2523 | { 2524 | "type": "consulting", 2525 | "url": "https://feross.org/support" 2526 | } 2527 | ], 2528 | "dependencies": { 2529 | "base64-js": "^1.3.1", 2530 | "ieee754": "^1.2.1" 2531 | } 2532 | }, 2533 | "node_modules/buffer-crc32": { 2534 | "version": "0.2.13", 2535 | "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", 2536 | "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", 2537 | "dev": true, 2538 | "engines": { 2539 | "node": "*" 2540 | } 2541 | }, 2542 | "node_modules/builtin-modules": { 2543 | "version": "3.3.0", 2544 | "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", 2545 | "integrity": "sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==", 2546 | "engines": { 2547 | "node": ">=6" 2548 | }, 2549 | "funding": { 2550 | "url": "https://github.com/sponsors/sindresorhus" 2551 | } 2552 | }, 2553 | "node_modules/bun-types": { 2554 | "version": "1.0.33", 2555 | "resolved": "https://registry.npmjs.org/bun-types/-/bun-types-1.0.33.tgz", 2556 | "integrity": "sha512-L5tBIf9g6rBBkvshqysi5NoLQ9NnhSPU1pfJ9FzqoSfofYdyac3WLUnOIuQ+M5za/sooVUOP2ko+E6Tco0OLIA==", 2557 | "dev": true, 2558 | "dependencies": { 2559 | "@types/node": "~20.11.3", 2560 | "@types/ws": "~8.5.10" 2561 | } 2562 | }, 2563 | "node_modules/cac": { 2564 | "version": "6.7.14", 2565 | "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", 2566 | "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", 2567 | "dev": true, 2568 | "engines": { 2569 | "node": ">=8" 2570 | } 2571 | }, 2572 | "node_modules/cachedir": { 2573 | "version": "2.4.0", 2574 | "resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.4.0.tgz", 2575 | "integrity": "sha512-9EtFOZR8g22CL7BWjJ9BUx1+A/djkofnyW3aOXZORNW2kxoUpx2h+uN2cOqwPmFhnpVmxg+KW2OjOSgChTEvsQ==", 2576 | "dev": true, 2577 | "engines": { 2578 | "node": ">=6" 2579 | } 2580 | }, 2581 | "node_modules/call-bind": { 2582 | "version": "1.0.7", 2583 | "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", 2584 | "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", 2585 | "dev": true, 2586 | "dependencies": { 2587 | "es-define-property": "^1.0.0", 2588 | "es-errors": "^1.3.0", 2589 | "function-bind": "^1.1.2", 2590 | "get-intrinsic": "^1.2.4", 2591 | "set-function-length": "^1.2.1" 2592 | }, 2593 | "engines": { 2594 | "node": ">= 0.4" 2595 | }, 2596 | "funding": { 2597 | "url": "https://github.com/sponsors/ljharb" 2598 | } 2599 | }, 2600 | "node_modules/callsites": { 2601 | "version": "3.1.0", 2602 | "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", 2603 | "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", 2604 | "dev": true, 2605 | "engines": { 2606 | "node": ">=6" 2607 | } 2608 | }, 2609 | "node_modules/camelcase-css": { 2610 | "version": "2.0.1", 2611 | "resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz", 2612 | "integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==", 2613 | "dev": true, 2614 | "engines": { 2615 | "node": ">= 6" 2616 | } 2617 | }, 2618 | "node_modules/caniuse-lite": { 2619 | "version": "1.0.30001600", 2620 | "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001600.tgz", 2621 | "integrity": "sha512-+2S9/2JFhYmYaDpZvo0lKkfvuKIglrx68MwOBqMGHhQsNkLjB5xtc/TGoEPs+MxjSyN/72qer2g97nzR641mOQ==", 2622 | "dev": true, 2623 | "funding": [ 2624 | { 2625 | "type": "opencollective", 2626 | "url": "https://opencollective.com/browserslist" 2627 | }, 2628 | { 2629 | "type": "tidelift", 2630 | "url": "https://tidelift.com/funding/github/npm/caniuse-lite" 2631 | }, 2632 | { 2633 | "type": "github", 2634 | "url": "https://github.com/sponsors/ai" 2635 | } 2636 | ] 2637 | }, 2638 | "node_modules/caseless": { 2639 | "version": "0.12.0", 2640 | "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", 2641 | "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==", 2642 | "dev": true 2643 | }, 2644 | "node_modules/chai": { 2645 | "version": "4.4.1", 2646 | "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.1.tgz", 2647 | "integrity": "sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==", 2648 | "dev": true, 2649 | "dependencies": { 2650 | "assertion-error": "^1.1.0", 2651 | "check-error": "^1.0.3", 2652 | "deep-eql": "^4.1.3", 2653 | "get-func-name": "^2.0.2", 2654 | "loupe": "^2.3.6", 2655 | "pathval": "^1.1.1", 2656 | "type-detect": "^4.0.8" 2657 | }, 2658 | "engines": { 2659 | "node": ">=4" 2660 | } 2661 | }, 2662 | "node_modules/chalk": { 2663 | "version": "4.1.2", 2664 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", 2665 | "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", 2666 | "dev": true, 2667 | "dependencies": { 2668 | "ansi-styles": "^4.1.0", 2669 | "supports-color": "^7.1.0" 2670 | }, 2671 | "engines": { 2672 | "node": ">=10" 2673 | }, 2674 | "funding": { 2675 | "url": "https://github.com/chalk/chalk?sponsor=1" 2676 | } 2677 | }, 2678 | "node_modules/character-entities": { 2679 | "version": "2.0.2", 2680 | "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", 2681 | "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==", 2682 | "funding": { 2683 | "type": "github", 2684 | "url": "https://github.com/sponsors/wooorm" 2685 | } 2686 | }, 2687 | "node_modules/check-error": { 2688 | "version": "1.0.3", 2689 | "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz", 2690 | "integrity": "sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==", 2691 | "dev": true, 2692 | "dependencies": { 2693 | "get-func-name": "^2.0.2" 2694 | }, 2695 | "engines": { 2696 | "node": "*" 2697 | } 2698 | }, 2699 | "node_modules/check-more-types": { 2700 | "version": "2.24.0", 2701 | "resolved": "https://registry.npmjs.org/check-more-types/-/check-more-types-2.24.0.tgz", 2702 | "integrity": "sha512-Pj779qHxV2tuapviy1bSZNEL1maXr13bPYpsvSDB68HlYcYuhlDrmGd63i0JHMCLKzc7rUSNIrpdJlhVlNwrxA==", 2703 | "dev": true, 2704 | "engines": { 2705 | "node": ">= 0.8.0" 2706 | } 2707 | }, 2708 | "node_modules/cheerio": { 2709 | "version": "1.0.0-rc.12", 2710 | "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.12.tgz", 2711 | "integrity": "sha512-VqR8m68vM46BNnuZ5NtnGBKIE/DfN0cRIzg9n40EIq9NOv90ayxLBXA8fXC5gquFRGJSTRqBq25Jt2ECLR431Q==", 2712 | "dev": true, 2713 | "dependencies": { 2714 | "cheerio-select": "^2.1.0", 2715 | "dom-serializer": "^2.0.0", 2716 | "domhandler": "^5.0.3", 2717 | "domutils": "^3.0.1", 2718 | "htmlparser2": "^8.0.1", 2719 | "parse5": "^7.0.0", 2720 | "parse5-htmlparser2-tree-adapter": "^7.0.0" 2721 | }, 2722 | "engines": { 2723 | "node": ">= 6" 2724 | }, 2725 | "funding": { 2726 | "url": "https://github.com/cheeriojs/cheerio?sponsor=1" 2727 | } 2728 | }, 2729 | "node_modules/cheerio-select": { 2730 | "version": "2.1.0", 2731 | "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-2.1.0.tgz", 2732 | "integrity": "sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g==", 2733 | "dev": true, 2734 | "dependencies": { 2735 | "boolbase": "^1.0.0", 2736 | "css-select": "^5.1.0", 2737 | "css-what": "^6.1.0", 2738 | "domelementtype": "^2.3.0", 2739 | "domhandler": "^5.0.3", 2740 | "domutils": "^3.0.1" 2741 | }, 2742 | "funding": { 2743 | "url": "https://github.com/sponsors/fb55" 2744 | } 2745 | }, 2746 | "node_modules/chokidar": { 2747 | "version": "3.6.0", 2748 | "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", 2749 | "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", 2750 | "dev": true, 2751 | "dependencies": { 2752 | "anymatch": "~3.1.2", 2753 | "braces": "~3.0.2", 2754 | "glob-parent": "~5.1.2", 2755 | "is-binary-path": "~2.1.0", 2756 | "is-glob": "~4.0.1", 2757 | "normalize-path": "~3.0.0", 2758 | "readdirp": "~3.6.0" 2759 | }, 2760 | "engines": { 2761 | "node": ">= 8.10.0" 2762 | }, 2763 | "funding": { 2764 | "url": "https://paulmillr.com/funding/" 2765 | }, 2766 | "optionalDependencies": { 2767 | "fsevents": "~2.3.2" 2768 | } 2769 | }, 2770 | "node_modules/chokidar/node_modules/glob-parent": { 2771 | "version": "5.1.2", 2772 | "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", 2773 | "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", 2774 | "dev": true, 2775 | "dependencies": { 2776 | "is-glob": "^4.0.1" 2777 | }, 2778 | "engines": { 2779 | "node": ">= 6" 2780 | } 2781 | }, 2782 | "node_modules/ci-info": { 2783 | "version": "3.9.0", 2784 | "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", 2785 | "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", 2786 | "dev": true, 2787 | "funding": [ 2788 | { 2789 | "type": "github", 2790 | "url": "https://github.com/sponsors/sibiraj-s" 2791 | } 2792 | ], 2793 | "engines": { 2794 | "node": ">=8" 2795 | } 2796 | }, 2797 | "node_modules/clean-stack": { 2798 | "version": "2.2.0", 2799 | "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", 2800 | "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", 2801 | "dev": true, 2802 | "engines": { 2803 | "node": ">=6" 2804 | } 2805 | }, 2806 | "node_modules/cli-cursor": { 2807 | "version": "3.1.0", 2808 | "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", 2809 | "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", 2810 | "dev": true, 2811 | "dependencies": { 2812 | "restore-cursor": "^3.1.0" 2813 | }, 2814 | "engines": { 2815 | "node": ">=8" 2816 | } 2817 | }, 2818 | "node_modules/cli-table3": { 2819 | "version": "0.6.4", 2820 | "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.4.tgz", 2821 | "integrity": "sha512-Lm3L0p+/npIQWNIiyF/nAn7T5dnOwR3xNTHXYEBFBFVPXzCVNZ5lqEC/1eo/EVfpDsQ1I+TX4ORPQgp+UI0CRw==", 2822 | "dev": true, 2823 | "dependencies": { 2824 | "string-width": "^4.2.0" 2825 | }, 2826 | "engines": { 2827 | "node": "10.* || >= 12.*" 2828 | }, 2829 | "optionalDependencies": { 2830 | "@colors/colors": "1.5.0" 2831 | } 2832 | }, 2833 | "node_modules/cli-table3/node_modules/emoji-regex": { 2834 | "version": "8.0.0", 2835 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", 2836 | "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", 2837 | "dev": true 2838 | }, 2839 | "node_modules/cli-table3/node_modules/string-width": { 2840 | "version": "4.2.3", 2841 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", 2842 | "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", 2843 | "dev": true, 2844 | "dependencies": { 2845 | "emoji-regex": "^8.0.0", 2846 | "is-fullwidth-code-point": "^3.0.0", 2847 | "strip-ansi": "^6.0.1" 2848 | }, 2849 | "engines": { 2850 | "node": ">=8" 2851 | } 2852 | }, 2853 | "node_modules/cli-truncate": { 2854 | "version": "2.1.0", 2855 | "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz", 2856 | "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", 2857 | "dev": true, 2858 | "dependencies": { 2859 | "slice-ansi": "^3.0.0", 2860 | "string-width": "^4.2.0" 2861 | }, 2862 | "engines": { 2863 | "node": ">=8" 2864 | }, 2865 | "funding": { 2866 | "url": "https://github.com/sponsors/sindresorhus" 2867 | } 2868 | }, 2869 | "node_modules/cli-truncate/node_modules/emoji-regex": { 2870 | "version": "8.0.0", 2871 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", 2872 | "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", 2873 | "dev": true 2874 | }, 2875 | "node_modules/cli-truncate/node_modules/string-width": { 2876 | "version": "4.2.3", 2877 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", 2878 | "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", 2879 | "dev": true, 2880 | "dependencies": { 2881 | "emoji-regex": "^8.0.0", 2882 | "is-fullwidth-code-point": "^3.0.0", 2883 | "strip-ansi": "^6.0.1" 2884 | }, 2885 | "engines": { 2886 | "node": ">=8" 2887 | } 2888 | }, 2889 | "node_modules/clone": { 2890 | "version": "2.1.2", 2891 | "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", 2892 | "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==", 2893 | "dev": true, 2894 | "engines": { 2895 | "node": ">=0.8" 2896 | } 2897 | }, 2898 | "node_modules/clone-stats": { 2899 | "version": "1.0.0", 2900 | "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-1.0.0.tgz", 2901 | "integrity": "sha512-au6ydSpg6nsrigcZ4m8Bc9hxjeW+GJ8xh5G3BJCMt4WXe1H10UNaVOamqQTmrx1kjVuxAHIQSNU6hY4Nsn9/ag==", 2902 | "dev": true 2903 | }, 2904 | "node_modules/code-red": { 2905 | "version": "1.0.4", 2906 | "resolved": "https://registry.npmjs.org/code-red/-/code-red-1.0.4.tgz", 2907 | "integrity": "sha512-7qJWqItLA8/VPVlKJlFXU+NBlo/qyfs39aJcuMT/2ere32ZqvF5OSxgdM5xOfJJ7O429gg2HM47y8v9P+9wrNw==", 2908 | "dependencies": { 2909 | "@jridgewell/sourcemap-codec": "^1.4.15", 2910 | "@types/estree": "^1.0.1", 2911 | "acorn": "^8.10.0", 2912 | "estree-walker": "^3.0.3", 2913 | "periscopic": "^3.1.0" 2914 | } 2915 | }, 2916 | "node_modules/code-red/node_modules/estree-walker": { 2917 | "version": "3.0.3", 2918 | "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", 2919 | "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", 2920 | "dependencies": { 2921 | "@types/estree": "^1.0.0" 2922 | } 2923 | }, 2924 | "node_modules/codedent": { 2925 | "version": "0.1.2", 2926 | "resolved": "https://registry.npmjs.org/codedent/-/codedent-0.1.2.tgz", 2927 | "integrity": "sha512-qEqzcy5viM3UoCN0jYHZeXZoyd4NZQzYFg0kOBj8O1CgoGG9WYYTF+VeQRsN0OSKFjF3G1u4WDUOtOsWEx6N2w==", 2928 | "dependencies": { 2929 | "plain-tag": "^0.1.3" 2930 | } 2931 | }, 2932 | "node_modules/codemirror": { 2933 | "version": "6.0.1", 2934 | "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-6.0.1.tgz", 2935 | "integrity": "sha512-J8j+nZ+CdWmIeFIGXEFbFPtpiYacFMDR8GlHK3IyHQJMCaVRfGx9NT+Hxivv1ckLWPvNdZqndbr/7lVhrf/Svg==", 2936 | "dependencies": { 2937 | "@codemirror/autocomplete": "^6.0.0", 2938 | "@codemirror/commands": "^6.0.0", 2939 | "@codemirror/language": "^6.0.0", 2940 | "@codemirror/lint": "^6.0.0", 2941 | "@codemirror/search": "^6.0.0", 2942 | "@codemirror/state": "^6.0.0", 2943 | "@codemirror/view": "^6.0.0" 2944 | } 2945 | }, 2946 | "node_modules/coincident": { 2947 | "version": "1.2.3", 2948 | "resolved": "https://registry.npmjs.org/coincident/-/coincident-1.2.3.tgz", 2949 | "integrity": "sha512-Uxz3BMTWIslzeWjuQnizGWVg0j6khbvHUQ8+5BdM7WuJEm4ALXwq3wluYoB+uF68uPBz/oUOeJnYURKyfjexlA==", 2950 | "dependencies": { 2951 | "@ungap/structured-clone": "^1.2.0", 2952 | "@ungap/with-resolvers": "^0.1.0", 2953 | "gc-hook": "^0.3.1", 2954 | "proxy-target": "^3.0.2" 2955 | }, 2956 | "optionalDependencies": { 2957 | "ws": "^8.16.0" 2958 | } 2959 | }, 2960 | "node_modules/color-convert": { 2961 | "version": "2.0.1", 2962 | "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", 2963 | "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", 2964 | "dev": true, 2965 | "dependencies": { 2966 | "color-name": "~1.1.4" 2967 | }, 2968 | "engines": { 2969 | "node": ">=7.0.0" 2970 | } 2971 | }, 2972 | "node_modules/color-name": { 2973 | "version": "1.1.4", 2974 | "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", 2975 | "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", 2976 | "dev": true 2977 | }, 2978 | "node_modules/colorette": { 2979 | "version": "2.0.20", 2980 | "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", 2981 | "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", 2982 | "dev": true 2983 | }, 2984 | "node_modules/colors": { 2985 | "version": "1.4.0", 2986 | "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", 2987 | "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", 2988 | "dev": true, 2989 | "engines": { 2990 | "node": ">=0.1.90" 2991 | } 2992 | }, 2993 | "node_modules/combined-stream": { 2994 | "version": "1.0.8", 2995 | "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", 2996 | "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", 2997 | "dev": true, 2998 | "dependencies": { 2999 | "delayed-stream": "~1.0.0" 3000 | }, 3001 | "engines": { 3002 | "node": ">= 0.8" 3003 | } 3004 | }, 3005 | "node_modules/commander": { 3006 | "version": "11.1.0", 3007 | "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz", 3008 | "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==", 3009 | "dev": true, 3010 | "engines": { 3011 | "node": ">=16" 3012 | } 3013 | }, 3014 | "node_modules/common-tags": { 3015 | "version": "1.8.2", 3016 | "resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.8.2.tgz", 3017 | "integrity": "sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA==", 3018 | "dev": true, 3019 | "engines": { 3020 | "node": ">=4.0.0" 3021 | } 3022 | }, 3023 | "node_modules/commondir": { 3024 | "version": "1.0.1", 3025 | "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", 3026 | "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==" 3027 | }, 3028 | "node_modules/concat-map": { 3029 | "version": "0.0.1", 3030 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 3031 | "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", 3032 | "dev": true 3033 | }, 3034 | "node_modules/confbox": { 3035 | "version": "0.1.7", 3036 | "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.7.tgz", 3037 | "integrity": "sha512-uJcB/FKZtBMCJpK8MQji6bJHgu1tixKPxRLeGkNzBoOZzpnZUJm0jm2/sBDWcuBx1dYgxV4JU+g5hmNxCyAmdA==", 3038 | "dev": true 3039 | }, 3040 | "node_modules/convert-source-map": { 3041 | "version": "2.0.0", 3042 | "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", 3043 | "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", 3044 | "dev": true 3045 | }, 3046 | "node_modules/cookie": { 3047 | "version": "0.5.0", 3048 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", 3049 | "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==", 3050 | "engines": { 3051 | "node": ">= 0.6" 3052 | } 3053 | }, 3054 | "node_modules/core-util-is": { 3055 | "version": "1.0.3", 3056 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", 3057 | "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", 3058 | "dev": true 3059 | }, 3060 | "node_modules/cose-base": { 3061 | "version": "1.0.3", 3062 | "resolved": "https://registry.npmjs.org/cose-base/-/cose-base-1.0.3.tgz", 3063 | "integrity": "sha512-s9whTXInMSgAp/NVXVNuVxVKzGH2qck3aQlVHxDCdAEPgtMKwc4Wq6/QKhgdEdgbLSi9rBTAcPoRa6JpiG4ksg==", 3064 | "dependencies": { 3065 | "layout-base": "^1.0.0" 3066 | } 3067 | }, 3068 | "node_modules/crc-32": { 3069 | "version": "1.2.2", 3070 | "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", 3071 | "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", 3072 | "bin": { 3073 | "crc32": "bin/crc32.njs" 3074 | }, 3075 | "engines": { 3076 | "node": ">=0.8" 3077 | } 3078 | }, 3079 | "node_modules/crelt": { 3080 | "version": "1.0.6", 3081 | "resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.6.tgz", 3082 | "integrity": "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==" 3083 | }, 3084 | "node_modules/cross-spawn": { 3085 | "version": "7.0.3", 3086 | "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", 3087 | "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", 3088 | "dev": true, 3089 | "dependencies": { 3090 | "path-key": "^3.1.0", 3091 | "shebang-command": "^2.0.0", 3092 | "which": "^2.0.1" 3093 | }, 3094 | "engines": { 3095 | "node": ">= 8" 3096 | } 3097 | }, 3098 | "node_modules/css-select": { 3099 | "version": "5.1.0", 3100 | "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", 3101 | "integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==", 3102 | "dev": true, 3103 | "dependencies": { 3104 | "boolbase": "^1.0.0", 3105 | "css-what": "^6.1.0", 3106 | "domhandler": "^5.0.2", 3107 | "domutils": "^3.0.1", 3108 | "nth-check": "^2.0.1" 3109 | }, 3110 | "funding": { 3111 | "url": "https://github.com/sponsors/fb55" 3112 | } 3113 | }, 3114 | "node_modules/css-tree": { 3115 | "version": "2.3.1", 3116 | "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz", 3117 | "integrity": "sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==", 3118 | "dependencies": { 3119 | "mdn-data": "2.0.30", 3120 | "source-map-js": "^1.0.1" 3121 | }, 3122 | "engines": { 3123 | "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" 3124 | } 3125 | }, 3126 | "node_modules/css-what": { 3127 | "version": "6.1.0", 3128 | "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz", 3129 | "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==", 3130 | "dev": true, 3131 | "engines": { 3132 | "node": ">= 6" 3133 | }, 3134 | "funding": { 3135 | "url": "https://github.com/sponsors/fb55" 3136 | } 3137 | }, 3138 | "node_modules/cssesc": { 3139 | "version": "3.0.0", 3140 | "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", 3141 | "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", 3142 | "dev": true, 3143 | "bin": { 3144 | "cssesc": "bin/cssesc" 3145 | }, 3146 | "engines": { 3147 | "node": ">=4" 3148 | } 3149 | }, 3150 | "node_modules/cypress": { 3151 | "version": "13.8.1", 3152 | "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.8.1.tgz", 3153 | "integrity": "sha512-Uk6ovhRbTg6FmXjeZW/TkbRM07KPtvM5gah1BIMp4Y2s+i/NMxgaLw0+PbYTOdw1+egE0FP3mWRiGcRkjjmhzA==", 3154 | "dev": true, 3155 | "hasInstallScript": true, 3156 | "dependencies": { 3157 | "@cypress/request": "^3.0.0", 3158 | "@cypress/xvfb": "^1.2.4", 3159 | "@types/sinonjs__fake-timers": "8.1.1", 3160 | "@types/sizzle": "^2.3.2", 3161 | "arch": "^2.2.0", 3162 | "blob-util": "^2.0.2", 3163 | "bluebird": "^3.7.2", 3164 | "buffer": "^5.7.1", 3165 | "cachedir": "^2.3.0", 3166 | "chalk": "^4.1.0", 3167 | "check-more-types": "^2.24.0", 3168 | "cli-cursor": "^3.1.0", 3169 | "cli-table3": "~0.6.1", 3170 | "commander": "^6.2.1", 3171 | "common-tags": "^1.8.0", 3172 | "dayjs": "^1.10.4", 3173 | "debug": "^4.3.4", 3174 | "enquirer": "^2.3.6", 3175 | "eventemitter2": "6.4.7", 3176 | "execa": "4.1.0", 3177 | "executable": "^4.1.1", 3178 | "extract-zip": "2.0.1", 3179 | "figures": "^3.2.0", 3180 | "fs-extra": "^9.1.0", 3181 | "getos": "^3.2.1", 3182 | "is-ci": "^3.0.1", 3183 | "is-installed-globally": "~0.4.0", 3184 | "lazy-ass": "^1.6.0", 3185 | "listr2": "^3.8.3", 3186 | "lodash": "^4.17.21", 3187 | "log-symbols": "^4.0.0", 3188 | "minimist": "^1.2.8", 3189 | "ospath": "^1.2.2", 3190 | "pretty-bytes": "^5.6.0", 3191 | "process": "^0.11.10", 3192 | "proxy-from-env": "1.0.0", 3193 | "request-progress": "^3.0.0", 3194 | "semver": "^7.5.3", 3195 | "supports-color": "^8.1.1", 3196 | "tmp": "~0.2.1", 3197 | "untildify": "^4.0.0", 3198 | "yauzl": "^2.10.0" 3199 | }, 3200 | "bin": { 3201 | "cypress": "bin/cypress" 3202 | }, 3203 | "engines": { 3204 | "node": "^16.0.0 || ^18.0.0 || >=20.0.0" 3205 | } 3206 | }, 3207 | "node_modules/cypress/node_modules/buffer": { 3208 | "version": "5.7.1", 3209 | "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", 3210 | "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", 3211 | "dev": true, 3212 | "funding": [ 3213 | { 3214 | "type": "github", 3215 | "url": "https://github.com/sponsors/feross" 3216 | }, 3217 | { 3218 | "type": "patreon", 3219 | "url": "https://www.patreon.com/feross" 3220 | }, 3221 | { 3222 | "type": "consulting", 3223 | "url": "https://feross.org/support" 3224 | } 3225 | ], 3226 | "dependencies": { 3227 | "base64-js": "^1.3.1", 3228 | "ieee754": "^1.1.13" 3229 | } 3230 | }, 3231 | "node_modules/cypress/node_modules/commander": { 3232 | "version": "6.2.1", 3233 | "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", 3234 | "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", 3235 | "dev": true, 3236 | "engines": { 3237 | "node": ">= 6" 3238 | } 3239 | }, 3240 | "node_modules/cypress/node_modules/fs-extra": { 3241 | "version": "9.1.0", 3242 | "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", 3243 | "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", 3244 | "dev": true, 3245 | "dependencies": { 3246 | "at-least-node": "^1.0.0", 3247 | "graceful-fs": "^4.2.0", 3248 | "jsonfile": "^6.0.1", 3249 | "universalify": "^2.0.0" 3250 | }, 3251 | "engines": { 3252 | "node": ">=10" 3253 | } 3254 | }, 3255 | "node_modules/cypress/node_modules/supports-color": { 3256 | "version": "8.1.1", 3257 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", 3258 | "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", 3259 | "dev": true, 3260 | "dependencies": { 3261 | "has-flag": "^4.0.0" 3262 | }, 3263 | "engines": { 3264 | "node": ">=10" 3265 | }, 3266 | "funding": { 3267 | "url": "https://github.com/chalk/supports-color?sponsor=1" 3268 | } 3269 | }, 3270 | "node_modules/cytoscape": { 3271 | "version": "3.29.2", 3272 | "resolved": "https://registry.npmjs.org/cytoscape/-/cytoscape-3.29.2.tgz", 3273 | "integrity": "sha512-2G1ycU28Nh7OHT9rkXRLpCDP30MKH1dXJORZuBhtEhEW7pKwgPi77ImqlCWinouyE1PNepIOGZBOrE84DG7LyQ==", 3274 | "engines": { 3275 | "node": ">=0.10" 3276 | } 3277 | }, 3278 | "node_modules/cytoscape-cose-bilkent": { 3279 | "version": "4.1.0", 3280 | "resolved": "https://registry.npmjs.org/cytoscape-cose-bilkent/-/cytoscape-cose-bilkent-4.1.0.tgz", 3281 | "integrity": "sha512-wgQlVIUJF13Quxiv5e1gstZ08rnZj2XaLHGoFMYXz7SkNfCDOOteKBE6SYRfA9WxxI/iBc3ajfDoc6hb/MRAHQ==", 3282 | "dependencies": { 3283 | "cose-base": "^1.0.0" 3284 | }, 3285 | "peerDependencies": { 3286 | "cytoscape": "^3.2.0" 3287 | } 3288 | }, 3289 | "node_modules/d3": { 3290 | "version": "7.9.0", 3291 | "resolved": "https://registry.npmjs.org/d3/-/d3-7.9.0.tgz", 3292 | "integrity": "sha512-e1U46jVP+w7Iut8Jt8ri1YsPOvFpg46k+K8TpCb0P+zjCkjkPnV7WzfDJzMHy1LnA+wj5pLT1wjO901gLXeEhA==", 3293 | "dependencies": { 3294 | "d3-array": "3", 3295 | "d3-axis": "3", 3296 | "d3-brush": "3", 3297 | "d3-chord": "3", 3298 | "d3-color": "3", 3299 | "d3-contour": "4", 3300 | "d3-delaunay": "6", 3301 | "d3-dispatch": "3", 3302 | "d3-drag": "3", 3303 | "d3-dsv": "3", 3304 | "d3-ease": "3", 3305 | "d3-fetch": "3", 3306 | "d3-force": "3", 3307 | "d3-format": "3", 3308 | "d3-geo": "3", 3309 | "d3-hierarchy": "3", 3310 | "d3-interpolate": "3", 3311 | "d3-path": "3", 3312 | "d3-polygon": "3", 3313 | "d3-quadtree": "3", 3314 | "d3-random": "3", 3315 | "d3-scale": "4", 3316 | "d3-scale-chromatic": "3", 3317 | "d3-selection": "3", 3318 | "d3-shape": "3", 3319 | "d3-time": "3", 3320 | "d3-time-format": "4", 3321 | "d3-timer": "3", 3322 | "d3-transition": "3", 3323 | "d3-zoom": "3" 3324 | }, 3325 | "engines": { 3326 | "node": ">=12" 3327 | } 3328 | }, 3329 | "node_modules/d3-array": { 3330 | "version": "3.2.4", 3331 | "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz", 3332 | "integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==", 3333 | "dependencies": { 3334 | "internmap": "1 - 2" 3335 | }, 3336 | "engines": { 3337 | "node": ">=12" 3338 | } 3339 | }, 3340 | "node_modules/d3-axis": { 3341 | "version": "3.0.0", 3342 | "resolved": "https://registry.npmjs.org/d3-axis/-/d3-axis-3.0.0.tgz", 3343 | "integrity": "sha512-IH5tgjV4jE/GhHkRV0HiVYPDtvfjHQlQfJHs0usq7M30XcSBvOotpmH1IgkcXsO/5gEQZD43B//fc7SRT5S+xw==", 3344 | "engines": { 3345 | "node": ">=12" 3346 | } 3347 | }, 3348 | "node_modules/d3-brush": { 3349 | "version": "3.0.0", 3350 | "resolved": "https://registry.npmjs.org/d3-brush/-/d3-brush-3.0.0.tgz", 3351 | "integrity": "sha512-ALnjWlVYkXsVIGlOsuWH1+3udkYFI48Ljihfnh8FZPF2QS9o+PzGLBslO0PjzVoHLZ2KCVgAM8NVkXPJB2aNnQ==", 3352 | "dependencies": { 3353 | "d3-dispatch": "1 - 3", 3354 | "d3-drag": "2 - 3", 3355 | "d3-interpolate": "1 - 3", 3356 | "d3-selection": "3", 3357 | "d3-transition": "3" 3358 | }, 3359 | "engines": { 3360 | "node": ">=12" 3361 | } 3362 | }, 3363 | "node_modules/d3-chord": { 3364 | "version": "3.0.1", 3365 | "resolved": "https://registry.npmjs.org/d3-chord/-/d3-chord-3.0.1.tgz", 3366 | "integrity": "sha512-VE5S6TNa+j8msksl7HwjxMHDM2yNK3XCkusIlpX5kwauBfXuyLAtNg9jCp/iHH61tgI4sb6R/EIMWCqEIdjT/g==", 3367 | "dependencies": { 3368 | "d3-path": "1 - 3" 3369 | }, 3370 | "engines": { 3371 | "node": ">=12" 3372 | } 3373 | }, 3374 | "node_modules/d3-color": { 3375 | "version": "3.1.0", 3376 | "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz", 3377 | "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==", 3378 | "engines": { 3379 | "node": ">=12" 3380 | } 3381 | }, 3382 | "node_modules/d3-contour": { 3383 | "version": "4.0.2", 3384 | "resolved": "https://registry.npmjs.org/d3-contour/-/d3-contour-4.0.2.tgz", 3385 | "integrity": "sha512-4EzFTRIikzs47RGmdxbeUvLWtGedDUNkTcmzoeyg4sP/dvCexO47AaQL7VKy/gul85TOxw+IBgA8US2xwbToNA==", 3386 | "dependencies": { 3387 | "d3-array": "^3.2.0" 3388 | }, 3389 | "engines": { 3390 | "node": ">=12" 3391 | } 3392 | }, 3393 | "node_modules/d3-delaunay": { 3394 | "version": "6.0.4", 3395 | "resolved": "https://registry.npmjs.org/d3-delaunay/-/d3-delaunay-6.0.4.tgz", 3396 | "integrity": "sha512-mdjtIZ1XLAM8bm/hx3WwjfHt6Sggek7qH043O8KEjDXN40xi3vx/6pYSVTwLjEgiXQTbvaouWKynLBiUZ6SK6A==", 3397 | "dependencies": { 3398 | "delaunator": "5" 3399 | }, 3400 | "engines": { 3401 | "node": ">=12" 3402 | } 3403 | }, 3404 | "node_modules/d3-dispatch": { 3405 | "version": "3.0.1", 3406 | "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-3.0.1.tgz", 3407 | "integrity": "sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==", 3408 | "engines": { 3409 | "node": ">=12" 3410 | } 3411 | }, 3412 | "node_modules/d3-drag": { 3413 | "version": "3.0.0", 3414 | "resolved": "https://registry.npmjs.org/d3-drag/-/d3-drag-3.0.0.tgz", 3415 | "integrity": "sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg==", 3416 | "dependencies": { 3417 | "d3-dispatch": "1 - 3", 3418 | "d3-selection": "3" 3419 | }, 3420 | "engines": { 3421 | "node": ">=12" 3422 | } 3423 | }, 3424 | "node_modules/d3-dsv": { 3425 | "version": "3.0.1", 3426 | "resolved": "https://registry.npmjs.org/d3-dsv/-/d3-dsv-3.0.1.tgz", 3427 | "integrity": "sha512-UG6OvdI5afDIFP9w4G0mNq50dSOsXHJaRE8arAS5o9ApWnIElp8GZw1Dun8vP8OyHOZ/QJUKUJwxiiCCnUwm+Q==", 3428 | "dependencies": { 3429 | "commander": "7", 3430 | "iconv-lite": "0.6", 3431 | "rw": "1" 3432 | }, 3433 | "bin": { 3434 | "csv2json": "bin/dsv2json.js", 3435 | "csv2tsv": "bin/dsv2dsv.js", 3436 | "dsv2dsv": "bin/dsv2dsv.js", 3437 | "dsv2json": "bin/dsv2json.js", 3438 | "json2csv": "bin/json2dsv.js", 3439 | "json2dsv": "bin/json2dsv.js", 3440 | "json2tsv": "bin/json2dsv.js", 3441 | "tsv2csv": "bin/dsv2dsv.js", 3442 | "tsv2json": "bin/dsv2json.js" 3443 | }, 3444 | "engines": { 3445 | "node": ">=12" 3446 | } 3447 | }, 3448 | "node_modules/d3-dsv/node_modules/commander": { 3449 | "version": "7.2.0", 3450 | "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", 3451 | "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", 3452 | "engines": { 3453 | "node": ">= 10" 3454 | } 3455 | }, 3456 | "node_modules/d3-ease": { 3457 | "version": "3.0.1", 3458 | "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz", 3459 | "integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==", 3460 | "engines": { 3461 | "node": ">=12" 3462 | } 3463 | }, 3464 | "node_modules/d3-fetch": { 3465 | "version": "3.0.1", 3466 | "resolved": "https://registry.npmjs.org/d3-fetch/-/d3-fetch-3.0.1.tgz", 3467 | "integrity": "sha512-kpkQIM20n3oLVBKGg6oHrUchHM3xODkTzjMoj7aWQFq5QEM+R6E4WkzT5+tojDY7yjez8KgCBRoj4aEr99Fdqw==", 3468 | "dependencies": { 3469 | "d3-dsv": "1 - 3" 3470 | }, 3471 | "engines": { 3472 | "node": ">=12" 3473 | } 3474 | }, 3475 | "node_modules/d3-force": { 3476 | "version": "3.0.0", 3477 | "resolved": "https://registry.npmjs.org/d3-force/-/d3-force-3.0.0.tgz", 3478 | "integrity": "sha512-zxV/SsA+U4yte8051P4ECydjD/S+qeYtnaIyAs9tgHCqfguma/aAQDjo85A9Z6EKhBirHRJHXIgJUlffT4wdLg==", 3479 | "dependencies": { 3480 | "d3-dispatch": "1 - 3", 3481 | "d3-quadtree": "1 - 3", 3482 | "d3-timer": "1 - 3" 3483 | }, 3484 | "engines": { 3485 | "node": ">=12" 3486 | } 3487 | }, 3488 | "node_modules/d3-format": { 3489 | "version": "3.1.0", 3490 | "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.0.tgz", 3491 | "integrity": "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==", 3492 | "engines": { 3493 | "node": ">=12" 3494 | } 3495 | }, 3496 | "node_modules/d3-geo": { 3497 | "version": "3.1.1", 3498 | "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-3.1.1.tgz", 3499 | "integrity": "sha512-637ln3gXKXOwhalDzinUgY83KzNWZRKbYubaG+fGVuc/dxO64RRljtCTnf5ecMyE1RIdtqpkVcq0IbtU2S8j2Q==", 3500 | "dependencies": { 3501 | "d3-array": "2.5.0 - 3" 3502 | }, 3503 | "engines": { 3504 | "node": ">=12" 3505 | } 3506 | }, 3507 | "node_modules/d3-hierarchy": { 3508 | "version": "3.1.2", 3509 | "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-3.1.2.tgz", 3510 | "integrity": "sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA==", 3511 | "engines": { 3512 | "node": ">=12" 3513 | } 3514 | }, 3515 | "node_modules/d3-interpolate": { 3516 | "version": "3.0.1", 3517 | "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz", 3518 | "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==", 3519 | "dependencies": { 3520 | "d3-color": "1 - 3" 3521 | }, 3522 | "engines": { 3523 | "node": ">=12" 3524 | } 3525 | }, 3526 | "node_modules/d3-path": { 3527 | "version": "3.1.0", 3528 | "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz", 3529 | "integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==", 3530 | "engines": { 3531 | "node": ">=12" 3532 | } 3533 | }, 3534 | "node_modules/d3-polygon": { 3535 | "version": "3.0.1", 3536 | "resolved": "https://registry.npmjs.org/d3-polygon/-/d3-polygon-3.0.1.tgz", 3537 | "integrity": "sha512-3vbA7vXYwfe1SYhED++fPUQlWSYTTGmFmQiany/gdbiWgU/iEyQzyymwL9SkJjFFuCS4902BSzewVGsHHmHtXg==", 3538 | "engines": { 3539 | "node": ">=12" 3540 | } 3541 | }, 3542 | "node_modules/d3-quadtree": { 3543 | "version": "3.0.1", 3544 | "resolved": "https://registry.npmjs.org/d3-quadtree/-/d3-quadtree-3.0.1.tgz", 3545 | "integrity": "sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw==", 3546 | "engines": { 3547 | "node": ">=12" 3548 | } 3549 | }, 3550 | "node_modules/d3-random": { 3551 | "version": "3.0.1", 3552 | "resolved": "https://registry.npmjs.org/d3-random/-/d3-random-3.0.1.tgz", 3553 | "integrity": "sha512-FXMe9GfxTxqd5D6jFsQ+DJ8BJS4E/fT5mqqdjovykEB2oFbTMDVdg1MGFxfQW+FBOGoB++k8swBrgwSHT1cUXQ==", 3554 | "engines": { 3555 | "node": ">=12" 3556 | } 3557 | }, 3558 | "node_modules/d3-sankey": { 3559 | "version": "0.12.3", 3560 | "resolved": "https://registry.npmjs.org/d3-sankey/-/d3-sankey-0.12.3.tgz", 3561 | "integrity": "sha512-nQhsBRmM19Ax5xEIPLMY9ZmJ/cDvd1BG3UVvt5h3WRxKg5zGRbvnteTyWAbzeSvlh3tW7ZEmq4VwR5mB3tutmQ==", 3562 | "dependencies": { 3563 | "d3-array": "1 - 2", 3564 | "d3-shape": "^1.2.0" 3565 | } 3566 | }, 3567 | "node_modules/d3-sankey/node_modules/d3-array": { 3568 | "version": "2.12.1", 3569 | "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.12.1.tgz", 3570 | "integrity": "sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ==", 3571 | "dependencies": { 3572 | "internmap": "^1.0.0" 3573 | } 3574 | }, 3575 | "node_modules/d3-sankey/node_modules/d3-path": { 3576 | "version": "1.0.9", 3577 | "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-1.0.9.tgz", 3578 | "integrity": "sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg==" 3579 | }, 3580 | "node_modules/d3-sankey/node_modules/d3-shape": { 3581 | "version": "1.3.7", 3582 | "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-1.3.7.tgz", 3583 | "integrity": "sha512-EUkvKjqPFUAZyOlhY5gzCxCeI0Aep04LwIRpsZ/mLFelJiUfnK56jo5JMDSE7yyP2kLSb6LtF+S5chMk7uqPqw==", 3584 | "dependencies": { 3585 | "d3-path": "1" 3586 | } 3587 | }, 3588 | "node_modules/d3-sankey/node_modules/internmap": { 3589 | "version": "1.0.1", 3590 | "resolved": "https://registry.npmjs.org/internmap/-/internmap-1.0.1.tgz", 3591 | "integrity": "sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw==" 3592 | }, 3593 | "node_modules/d3-scale": { 3594 | "version": "4.0.2", 3595 | "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz", 3596 | "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==", 3597 | "dependencies": { 3598 | "d3-array": "2.10.0 - 3", 3599 | "d3-format": "1 - 3", 3600 | "d3-interpolate": "1.2.0 - 3", 3601 | "d3-time": "2.1.1 - 3", 3602 | "d3-time-format": "2 - 4" 3603 | }, 3604 | "engines": { 3605 | "node": ">=12" 3606 | } 3607 | }, 3608 | "node_modules/d3-scale-chromatic": { 3609 | "version": "3.1.0", 3610 | "resolved": "https://registry.npmjs.org/d3-scale-chromatic/-/d3-scale-chromatic-3.1.0.tgz", 3611 | "integrity": "sha512-A3s5PWiZ9YCXFye1o246KoscMWqf8BsD9eRiJ3He7C9OBaxKhAd5TFCdEx/7VbKtxxTsu//1mMJFrEt572cEyQ==", 3612 | "dependencies": { 3613 | "d3-color": "1 - 3", 3614 | "d3-interpolate": "1 - 3" 3615 | }, 3616 | "engines": { 3617 | "node": ">=12" 3618 | } 3619 | }, 3620 | "node_modules/d3-selection": { 3621 | "version": "3.0.0", 3622 | "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz", 3623 | "integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==", 3624 | "engines": { 3625 | "node": ">=12" 3626 | } 3627 | }, 3628 | "node_modules/d3-shape": { 3629 | "version": "3.2.0", 3630 | "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz", 3631 | "integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==", 3632 | "dependencies": { 3633 | "d3-path": "^3.1.0" 3634 | }, 3635 | "engines": { 3636 | "node": ">=12" 3637 | } 3638 | }, 3639 | "node_modules/d3-time": { 3640 | "version": "3.1.0", 3641 | "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz", 3642 | "integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==", 3643 | "dependencies": { 3644 | "d3-array": "2 - 3" 3645 | }, 3646 | "engines": { 3647 | "node": ">=12" 3648 | } 3649 | }, 3650 | "node_modules/d3-time-format": { 3651 | "version": "4.1.0", 3652 | "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz", 3653 | "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==", 3654 | "dependencies": { 3655 | "d3-time": "1 - 3" 3656 | }, 3657 | "engines": { 3658 | "node": ">=12" 3659 | } 3660 | }, 3661 | "node_modules/d3-timer": { 3662 | "version": "3.0.1", 3663 | "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz", 3664 | "integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==", 3665 | "engines": { 3666 | "node": ">=12" 3667 | } 3668 | }, 3669 | "node_modules/d3-transition": { 3670 | "version": "3.0.1", 3671 | "resolved": "https://registry.npmjs.org/d3-transition/-/d3-transition-3.0.1.tgz", 3672 | "integrity": "sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w==", 3673 | "dependencies": { 3674 | "d3-color": "1 - 3", 3675 | "d3-dispatch": "1 - 3", 3676 | "d3-ease": "1 - 3", 3677 | "d3-interpolate": "1 - 3", 3678 | "d3-timer": "1 - 3" 3679 | }, 3680 | "engines": { 3681 | "node": ">=12" 3682 | }, 3683 | "peerDependencies": { 3684 | "d3-selection": "2 - 3" 3685 | } 3686 | }, 3687 | "node_modules/d3-zoom": { 3688 | "version": "3.0.0", 3689 | "resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-3.0.0.tgz", 3690 | "integrity": "sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw==", 3691 | "dependencies": { 3692 | "d3-dispatch": "1 - 3", 3693 | "d3-drag": "2 - 3", 3694 | "d3-interpolate": "1 - 3", 3695 | "d3-selection": "2 - 3", 3696 | "d3-transition": "2 - 3" 3697 | }, 3698 | "engines": { 3699 | "node": ">=12" 3700 | } 3701 | }, 3702 | "node_modules/dagre-d3-es": { 3703 | "version": "7.0.10", 3704 | "resolved": "https://registry.npmjs.org/dagre-d3-es/-/dagre-d3-es-7.0.10.tgz", 3705 | "integrity": "sha512-qTCQmEhcynucuaZgY5/+ti3X/rnszKZhEQH/ZdWdtP1tA/y3VoHJzcVrO9pjjJCNpigfscAtoUB5ONcd2wNn0A==", 3706 | "dependencies": { 3707 | "d3": "^7.8.2", 3708 | "lodash-es": "^4.17.21" 3709 | } 3710 | }, 3711 | "node_modules/dashdash": { 3712 | "version": "1.14.1", 3713 | "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", 3714 | "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", 3715 | "dev": true, 3716 | "dependencies": { 3717 | "assert-plus": "^1.0.0" 3718 | }, 3719 | "engines": { 3720 | "node": ">=0.10" 3721 | } 3722 | }, 3723 | "node_modules/dayjs": { 3724 | "version": "1.11.10", 3725 | "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz", 3726 | "integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==" 3727 | }, 3728 | "node_modules/de-indent": { 3729 | "version": "1.0.2", 3730 | "resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz", 3731 | "integrity": "sha512-e/1zu3xH5MQryN2zdVaF0OrdNLUbvWxzMbi+iNA6Bky7l1RoP8a2fIbRocyHclXt/arDrrR6lL3TqFD9pMQTsg==", 3732 | "dev": true 3733 | }, 3734 | "node_modules/debug": { 3735 | "version": "4.3.4", 3736 | "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", 3737 | "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", 3738 | "dependencies": { 3739 | "ms": "2.1.2" 3740 | }, 3741 | "engines": { 3742 | "node": ">=6.0" 3743 | }, 3744 | "peerDependenciesMeta": { 3745 | "supports-color": { 3746 | "optional": true 3747 | } 3748 | } 3749 | }, 3750 | "node_modules/decode-named-character-reference": { 3751 | "version": "1.0.2", 3752 | "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz", 3753 | "integrity": "sha512-O8x12RzrUF8xyVcY0KJowWsmaJxQbmy0/EtnNtHRpsOcT7dFk5W598coHqBVpmWo1oQQfsCqfCmkZN5DJrZVdg==", 3754 | "dependencies": { 3755 | "character-entities": "^2.0.0" 3756 | }, 3757 | "funding": { 3758 | "type": "github", 3759 | "url": "https://github.com/sponsors/wooorm" 3760 | } 3761 | }, 3762 | "node_modules/deep-eql": { 3763 | "version": "4.1.3", 3764 | "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", 3765 | "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", 3766 | "dev": true, 3767 | "dependencies": { 3768 | "type-detect": "^4.0.0" 3769 | }, 3770 | "engines": { 3771 | "node": ">=6" 3772 | } 3773 | }, 3774 | "node_modules/deep-is": { 3775 | "version": "0.1.4", 3776 | "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", 3777 | "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", 3778 | "dev": true 3779 | }, 3780 | "node_modules/deepmerge": { 3781 | "version": "4.3.1", 3782 | "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", 3783 | "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", 3784 | "engines": { 3785 | "node": ">=0.10.0" 3786 | } 3787 | }, 3788 | "node_modules/define-data-property": { 3789 | "version": "1.1.4", 3790 | "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", 3791 | "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", 3792 | "dev": true, 3793 | "dependencies": { 3794 | "es-define-property": "^1.0.0", 3795 | "es-errors": "^1.3.0", 3796 | "gopd": "^1.0.1" 3797 | }, 3798 | "engines": { 3799 | "node": ">= 0.4" 3800 | }, 3801 | "funding": { 3802 | "url": "https://github.com/sponsors/ljharb" 3803 | } 3804 | }, 3805 | "node_modules/delaunator": { 3806 | "version": "5.0.1", 3807 | "resolved": "https://registry.npmjs.org/delaunator/-/delaunator-5.0.1.tgz", 3808 | "integrity": "sha512-8nvh+XBe96aCESrGOqMp/84b13H9cdKbG5P2ejQCh4d4sK9RL4371qou9drQjMhvnPmhWl5hnmqbEE0fXr9Xnw==", 3809 | "dependencies": { 3810 | "robust-predicates": "^3.0.2" 3811 | } 3812 | }, 3813 | "node_modules/delayed-stream": { 3814 | "version": "1.0.0", 3815 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", 3816 | "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", 3817 | "dev": true, 3818 | "engines": { 3819 | "node": ">=0.4.0" 3820 | } 3821 | }, 3822 | "node_modules/dequal": { 3823 | "version": "2.0.3", 3824 | "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", 3825 | "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", 3826 | "engines": { 3827 | "node": ">=6" 3828 | } 3829 | }, 3830 | "node_modules/detect-indent": { 3831 | "version": "6.1.0", 3832 | "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-6.1.0.tgz", 3833 | "integrity": "sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==", 3834 | "dev": true, 3835 | "engines": { 3836 | "node": ">=8" 3837 | } 3838 | }, 3839 | "node_modules/devalue": { 3840 | "version": "4.3.2", 3841 | "resolved": "https://registry.npmjs.org/devalue/-/devalue-4.3.2.tgz", 3842 | "integrity": "sha512-KqFl6pOgOW+Y6wJgu80rHpo2/3H07vr8ntR9rkkFIRETewbf5GaYYcakYfiKz89K+sLsuPkQIZaXDMjUObZwWg==" 3843 | }, 3844 | "node_modules/didyoumean": { 3845 | "version": "1.2.2", 3846 | "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", 3847 | "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", 3848 | "dev": true 3849 | }, 3850 | "node_modules/diff": { 3851 | "version": "5.2.0", 3852 | "resolved": "https://registry.npmjs.org/diff/-/diff-5.2.0.tgz", 3853 | "integrity": "sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==", 3854 | "engines": { 3855 | "node": ">=0.3.1" 3856 | } 3857 | }, 3858 | "node_modules/diff-sequences": { 3859 | "version": "29.6.3", 3860 | "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", 3861 | "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", 3862 | "dev": true, 3863 | "engines": { 3864 | "node": "^14.15.0 || ^16.10.0 || >=18.0.0" 3865 | } 3866 | }, 3867 | "node_modules/dir-glob": { 3868 | "version": "3.0.1", 3869 | "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", 3870 | "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", 3871 | "dev": true, 3872 | "dependencies": { 3873 | "path-type": "^4.0.0" 3874 | }, 3875 | "engines": { 3876 | "node": ">=8" 3877 | } 3878 | }, 3879 | "node_modules/dlv": { 3880 | "version": "1.1.3", 3881 | "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", 3882 | "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", 3883 | "dev": true 3884 | }, 3885 | "node_modules/doctrine": { 3886 | "version": "3.0.0", 3887 | "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", 3888 | "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", 3889 | "dev": true, 3890 | "dependencies": { 3891 | "esutils": "^2.0.2" 3892 | }, 3893 | "engines": { 3894 | "node": ">=6.0.0" 3895 | } 3896 | }, 3897 | "node_modules/dom-serializer": { 3898 | "version": "2.0.0", 3899 | "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", 3900 | "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", 3901 | "dev": true, 3902 | "dependencies": { 3903 | "domelementtype": "^2.3.0", 3904 | "domhandler": "^5.0.2", 3905 | "entities": "^4.2.0" 3906 | }, 3907 | "funding": { 3908 | "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" 3909 | } 3910 | }, 3911 | "node_modules/domelementtype": { 3912 | "version": "2.3.0", 3913 | "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", 3914 | "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", 3915 | "dev": true, 3916 | "funding": [ 3917 | { 3918 | "type": "github", 3919 | "url": "https://github.com/sponsors/fb55" 3920 | } 3921 | ] 3922 | }, 3923 | "node_modules/domhandler": { 3924 | "version": "5.0.3", 3925 | "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", 3926 | "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", 3927 | "dev": true, 3928 | "dependencies": { 3929 | "domelementtype": "^2.3.0" 3930 | }, 3931 | "engines": { 3932 | "node": ">= 4" 3933 | }, 3934 | "funding": { 3935 | "url": "https://github.com/fb55/domhandler?sponsor=1" 3936 | } 3937 | }, 3938 | "node_modules/dompurify": { 3939 | "version": "3.1.5", 3940 | "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.5.tgz", 3941 | "integrity": "sha512-lwG+n5h8QNpxtyrJW/gJWckL+1/DQiYMX8f7t8Z2AZTPw1esVrqjI63i7Zc2Gz0aKzLVMYC1V1PL/ky+aY/NgA==" 3942 | }, 3943 | "node_modules/domutils": { 3944 | "version": "3.1.0", 3945 | "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz", 3946 | "integrity": "sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==", 3947 | "dev": true, 3948 | "dependencies": { 3949 | "dom-serializer": "^2.0.0", 3950 | "domelementtype": "^2.3.0", 3951 | "domhandler": "^5.0.3" 3952 | }, 3953 | "funding": { 3954 | "url": "https://github.com/fb55/domutils?sponsor=1" 3955 | } 3956 | }, 3957 | "node_modules/eastasianwidth": { 3958 | "version": "0.2.0", 3959 | "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", 3960 | "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", 3961 | "dev": true 3962 | }, 3963 | "node_modules/ecc-jsbn": { 3964 | "version": "0.1.2", 3965 | "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", 3966 | "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", 3967 | "dev": true, 3968 | "dependencies": { 3969 | "jsbn": "~0.1.0", 3970 | "safer-buffer": "^2.1.0" 3971 | } 3972 | }, 3973 | "node_modules/electron-to-chromium": { 3974 | "version": "1.4.715", 3975 | "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.715.tgz", 3976 | "integrity": "sha512-XzWNH4ZSa9BwVUQSDorPWAUQ5WGuYz7zJUNpNif40zFCiCl20t8zgylmreNmn26h5kiyw2lg7RfTmeMBsDklqg==", 3977 | "dev": true 3978 | }, 3979 | "node_modules/elkjs": { 3980 | "version": "0.9.3", 3981 | "resolved": "https://registry.npmjs.org/elkjs/-/elkjs-0.9.3.tgz", 3982 | "integrity": "sha512-f/ZeWvW/BCXbhGEf1Ujp29EASo/lk1FDnETgNKwJrsVvGZhUWCZyg3xLJjAsxfOmt8KjswHmI5EwCQcPMpOYhQ==" 3983 | }, 3984 | "node_modules/emoji-regex": { 3985 | "version": "9.2.2", 3986 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", 3987 | "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", 3988 | "dev": true 3989 | }, 3990 | "node_modules/end-of-stream": { 3991 | "version": "1.4.4", 3992 | "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", 3993 | "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", 3994 | "dev": true, 3995 | "dependencies": { 3996 | "once": "^1.4.0" 3997 | } 3998 | }, 3999 | "node_modules/engine.io-client": { 4000 | "version": "6.5.4", 4001 | "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.5.4.tgz", 4002 | "integrity": "sha512-GeZeeRjpD2qf49cZQ0Wvh/8NJNfeXkXXcoGh+F77oEAgo9gUHwT1fCRxSNU+YEEaysOJTnsFHmM5oAcPy4ntvQ==", 4003 | "dependencies": { 4004 | "@socket.io/component-emitter": "~3.1.0", 4005 | "debug": "~4.3.1", 4006 | "engine.io-parser": "~5.2.1", 4007 | "ws": "~8.17.1", 4008 | "xmlhttprequest-ssl": "~2.0.0" 4009 | } 4010 | }, 4011 | "node_modules/engine.io-parser": { 4012 | "version": "5.2.2", 4013 | "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.2.tgz", 4014 | "integrity": "sha512-RcyUFKA93/CXH20l4SoVvzZfrSDMOTUS3bWVpTt2FuFP+XYrL8i8oonHP7WInRyVHXh0n/ORtoeiE1os+8qkSw==", 4015 | "engines": { 4016 | "node": ">=10.0.0" 4017 | } 4018 | }, 4019 | "node_modules/enquirer": { 4020 | "version": "2.4.1", 4021 | "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.4.1.tgz", 4022 | "integrity": "sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==", 4023 | "dev": true, 4024 | "dependencies": { 4025 | "ansi-colors": "^4.1.1", 4026 | "strip-ansi": "^6.0.1" 4027 | }, 4028 | "engines": { 4029 | "node": ">=8.6" 4030 | } 4031 | }, 4032 | "node_modules/ensure-posix-path": { 4033 | "version": "1.1.1", 4034 | "resolved": "https://registry.npmjs.org/ensure-posix-path/-/ensure-posix-path-1.1.1.tgz", 4035 | "integrity": "sha512-VWU0/zXzVbeJNXvME/5EmLuEj2TauvoaTz6aFYK1Z92JCBlDlZ3Gu0tuGR42kpW1754ywTs+QB0g5TP0oj9Zaw==", 4036 | "dev": true 4037 | }, 4038 | "node_modules/entities": { 4039 | "version": "4.5.0", 4040 | "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", 4041 | "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", 4042 | "dev": true, 4043 | "engines": { 4044 | "node": ">=0.12" 4045 | }, 4046 | "funding": { 4047 | "url": "https://github.com/fb55/entities?sponsor=1" 4048 | } 4049 | }, 4050 | "node_modules/eol": { 4051 | "version": "0.9.1", 4052 | "resolved": "https://registry.npmjs.org/eol/-/eol-0.9.1.tgz", 4053 | "integrity": "sha512-Ds/TEoZjwggRoz/Q2O7SE3i4Jm66mqTDfmdHdq/7DKVk3bro9Q8h6WdXKdPqFLMoqxrDK5SVRzHVPOS6uuGtrg==", 4054 | "dev": true 4055 | }, 4056 | "node_modules/es-define-property": { 4057 | "version": "1.0.0", 4058 | "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", 4059 | "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", 4060 | "dev": true, 4061 | "dependencies": { 4062 | "get-intrinsic": "^1.2.4" 4063 | }, 4064 | "engines": { 4065 | "node": ">= 0.4" 4066 | } 4067 | }, 4068 | "node_modules/es-errors": { 4069 | "version": "1.3.0", 4070 | "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", 4071 | "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", 4072 | "dev": true, 4073 | "engines": { 4074 | "node": ">= 0.4" 4075 | } 4076 | }, 4077 | "node_modules/es6-promise": { 4078 | "version": "3.3.1", 4079 | "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", 4080 | "integrity": "sha512-SOp9Phqvqn7jtEUxPWdWfWoLmyt2VaJ6MpvP9Comy1MceMXqE6bxvaTu4iaxpYYPzhny28Lc+M87/c2cPK6lDg==", 4081 | "dev": true 4082 | }, 4083 | "node_modules/esbuild": { 4084 | "version": "0.20.2", 4085 | "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.20.2.tgz", 4086 | "integrity": "sha512-WdOOppmUNU+IbZ0PaDiTst80zjnrOkyJNHoKupIcVyU8Lvla3Ugx94VzkQ32Ijqd7UhHJy75gNWDMUekcrSJ6g==", 4087 | "dev": true, 4088 | "hasInstallScript": true, 4089 | "bin": { 4090 | "esbuild": "bin/esbuild" 4091 | }, 4092 | "engines": { 4093 | "node": ">=12" 4094 | }, 4095 | "optionalDependencies": { 4096 | "@esbuild/aix-ppc64": "0.20.2", 4097 | "@esbuild/android-arm": "0.20.2", 4098 | "@esbuild/android-arm64": "0.20.2", 4099 | "@esbuild/android-x64": "0.20.2", 4100 | "@esbuild/darwin-arm64": "0.20.2", 4101 | "@esbuild/darwin-x64": "0.20.2", 4102 | "@esbuild/freebsd-arm64": "0.20.2", 4103 | "@esbuild/freebsd-x64": "0.20.2", 4104 | "@esbuild/linux-arm": "0.20.2", 4105 | "@esbuild/linux-arm64": "0.20.2", 4106 | "@esbuild/linux-ia32": "0.20.2", 4107 | "@esbuild/linux-loong64": "0.20.2", 4108 | "@esbuild/linux-mips64el": "0.20.2", 4109 | "@esbuild/linux-ppc64": "0.20.2", 4110 | "@esbuild/linux-riscv64": "0.20.2", 4111 | "@esbuild/linux-s390x": "0.20.2", 4112 | "@esbuild/linux-x64": "0.20.2", 4113 | "@esbuild/netbsd-x64": "0.20.2", 4114 | "@esbuild/openbsd-x64": "0.20.2", 4115 | "@esbuild/sunos-x64": "0.20.2", 4116 | "@esbuild/win32-arm64": "0.20.2", 4117 | "@esbuild/win32-ia32": "0.20.2", 4118 | "@esbuild/win32-x64": "0.20.2" 4119 | } 4120 | }, 4121 | "node_modules/escalade": { 4122 | "version": "3.1.2", 4123 | "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", 4124 | "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", 4125 | "dev": true, 4126 | "engines": { 4127 | "node": ">=6" 4128 | } 4129 | }, 4130 | "node_modules/escape-string-regexp": { 4131 | "version": "4.0.0", 4132 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", 4133 | "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", 4134 | "dev": true, 4135 | "engines": { 4136 | "node": ">=10" 4137 | }, 4138 | "funding": { 4139 | "url": "https://github.com/sponsors/sindresorhus" 4140 | } 4141 | }, 4142 | "node_modules/eslint": { 4143 | "version": "8.57.0", 4144 | "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", 4145 | "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", 4146 | "dev": true, 4147 | "dependencies": { 4148 | "@eslint-community/eslint-utils": "^4.2.0", 4149 | "@eslint-community/regexpp": "^4.6.1", 4150 | "@eslint/eslintrc": "^2.1.4", 4151 | "@eslint/js": "8.57.0", 4152 | "@humanwhocodes/config-array": "^0.11.14", 4153 | "@humanwhocodes/module-importer": "^1.0.1", 4154 | "@nodelib/fs.walk": "^1.2.8", 4155 | "@ungap/structured-clone": "^1.2.0", 4156 | "ajv": "^6.12.4", 4157 | "chalk": "^4.0.0", 4158 | "cross-spawn": "^7.0.2", 4159 | "debug": "^4.3.2", 4160 | "doctrine": "^3.0.0", 4161 | "escape-string-regexp": "^4.0.0", 4162 | "eslint-scope": "^7.2.2", 4163 | "eslint-visitor-keys": "^3.4.3", 4164 | "espree": "^9.6.1", 4165 | "esquery": "^1.4.2", 4166 | "esutils": "^2.0.2", 4167 | "fast-deep-equal": "^3.1.3", 4168 | "file-entry-cache": "^6.0.1", 4169 | "find-up": "^5.0.0", 4170 | "glob-parent": "^6.0.2", 4171 | "globals": "^13.19.0", 4172 | "graphemer": "^1.4.0", 4173 | "ignore": "^5.2.0", 4174 | "imurmurhash": "^0.1.4", 4175 | "is-glob": "^4.0.0", 4176 | "is-path-inside": "^3.0.3", 4177 | "js-yaml": "^4.1.0", 4178 | "json-stable-stringify-without-jsonify": "^1.0.1", 4179 | "levn": "^0.4.1", 4180 | "lodash.merge": "^4.6.2", 4181 | "minimatch": "^3.1.2", 4182 | "natural-compare": "^1.4.0", 4183 | "optionator": "^0.9.3", 4184 | "strip-ansi": "^6.0.1", 4185 | "text-table": "^0.2.0" 4186 | }, 4187 | "bin": { 4188 | "eslint": "bin/eslint.js" 4189 | }, 4190 | "engines": { 4191 | "node": "^12.22.0 || ^14.17.0 || >=16.0.0" 4192 | }, 4193 | "funding": { 4194 | "url": "https://opencollective.com/eslint" 4195 | } 4196 | }, 4197 | "node_modules/eslint-compat-utils": { 4198 | "version": "0.1.2", 4199 | "resolved": "https://registry.npmjs.org/eslint-compat-utils/-/eslint-compat-utils-0.1.2.tgz", 4200 | "integrity": "sha512-Jia4JDldWnFNIru1Ehx1H5s9/yxiRHY/TimCuUc0jNexew3cF1gI6CYZil1ociakfWO3rRqFjl1mskBblB3RYg==", 4201 | "dev": true, 4202 | "engines": { 4203 | "node": ">=12" 4204 | }, 4205 | "peerDependencies": { 4206 | "eslint": ">=6.0.0" 4207 | } 4208 | }, 4209 | "node_modules/eslint-config-prettier": { 4210 | "version": "8.10.0", 4211 | "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.10.0.tgz", 4212 | "integrity": "sha512-SM8AMJdeQqRYT9O9zguiruQZaN7+z+E4eAP9oiLNGKMtomwaB1E9dcgUD6ZAn/eQAb52USbvezbiljfZUhbJcg==", 4213 | "dev": true, 4214 | "bin": { 4215 | "eslint-config-prettier": "bin/cli.js" 4216 | }, 4217 | "peerDependencies": { 4218 | "eslint": ">=7.0.0" 4219 | } 4220 | }, 4221 | "node_modules/eslint-plugin-cypress": { 4222 | "version": "3.0.2", 4223 | "resolved": "https://registry.npmjs.org/eslint-plugin-cypress/-/eslint-plugin-cypress-3.0.2.tgz", 4224 | "integrity": "sha512-5hIWc3SqXSuR+Sd7gmNMzx8yJ3LWQQS0e+qLvEVF4C1JfFtu1s9imtEm1KxlCBCcKb7+6CyR9KQYs0GiI02AlA==", 4225 | "dev": true, 4226 | "dependencies": { 4227 | "globals": "^13.20.0" 4228 | }, 4229 | "peerDependencies": { 4230 | "eslint": ">=7 <9" 4231 | } 4232 | }, 4233 | "node_modules/eslint-plugin-svelte": { 4234 | "version": "2.35.1", 4235 | "resolved": "https://registry.npmjs.org/eslint-plugin-svelte/-/eslint-plugin-svelte-2.35.1.tgz", 4236 | "integrity": "sha512-IF8TpLnROSGy98Z3NrsKXWDSCbNY2ReHDcrYTuXZMbfX7VmESISR78TWgO9zdg4Dht1X8coub5jKwHzP0ExRug==", 4237 | "dev": true, 4238 | "dependencies": { 4239 | "@eslint-community/eslint-utils": "^4.2.0", 4240 | "@jridgewell/sourcemap-codec": "^1.4.14", 4241 | "debug": "^4.3.1", 4242 | "eslint-compat-utils": "^0.1.2", 4243 | "esutils": "^2.0.3", 4244 | "known-css-properties": "^0.29.0", 4245 | "postcss": "^8.4.5", 4246 | "postcss-load-config": "^3.1.4", 4247 | "postcss-safe-parser": "^6.0.0", 4248 | "postcss-selector-parser": "^6.0.11", 4249 | "semver": "^7.5.3", 4250 | "svelte-eslint-parser": ">=0.33.0 <1.0.0" 4251 | }, 4252 | "engines": { 4253 | "node": "^14.17.0 || >=16.0.0" 4254 | }, 4255 | "funding": { 4256 | "url": "https://github.com/sponsors/ota-meshi" 4257 | }, 4258 | "peerDependencies": { 4259 | "eslint": "^7.0.0 || ^8.0.0-0", 4260 | "svelte": "^3.37.0 || ^4.0.0" 4261 | }, 4262 | "peerDependenciesMeta": { 4263 | "svelte": { 4264 | "optional": true 4265 | } 4266 | } 4267 | }, 4268 | "node_modules/eslint-plugin-svelte/node_modules/postcss-selector-parser": { 4269 | "version": "6.0.16", 4270 | "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.16.tgz", 4271 | "integrity": "sha512-A0RVJrX+IUkVZbW3ClroRWurercFhieevHB38sr2+l9eUClMqome3LmEmnhlNy+5Mr2EYN6B2Kaw9wYdd+VHiw==", 4272 | "dev": true, 4273 | "dependencies": { 4274 | "cssesc": "^3.0.0", 4275 | "util-deprecate": "^1.0.2" 4276 | }, 4277 | "engines": { 4278 | "node": ">=4" 4279 | } 4280 | }, 4281 | "node_modules/eslint-scope": { 4282 | "version": "7.2.2", 4283 | "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", 4284 | "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", 4285 | "dev": true, 4286 | "dependencies": { 4287 | "esrecurse": "^4.3.0", 4288 | "estraverse": "^5.2.0" 4289 | }, 4290 | "engines": { 4291 | "node": "^12.22.0 || ^14.17.0 || >=16.0.0" 4292 | }, 4293 | "funding": { 4294 | "url": "https://opencollective.com/eslint" 4295 | } 4296 | }, 4297 | "node_modules/eslint-visitor-keys": { 4298 | "version": "3.4.3", 4299 | "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", 4300 | "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", 4301 | "dev": true, 4302 | "engines": { 4303 | "node": "^12.22.0 || ^14.17.0 || >=16.0.0" 4304 | }, 4305 | "funding": { 4306 | "url": "https://opencollective.com/eslint" 4307 | } 4308 | }, 4309 | "node_modules/eslint/node_modules/brace-expansion": { 4310 | "version": "1.1.11", 4311 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 4312 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 4313 | "dev": true, 4314 | "dependencies": { 4315 | "balanced-match": "^1.0.0", 4316 | "concat-map": "0.0.1" 4317 | } 4318 | }, 4319 | "node_modules/eslint/node_modules/minimatch": { 4320 | "version": "3.1.2", 4321 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", 4322 | "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", 4323 | "dev": true, 4324 | "dependencies": { 4325 | "brace-expansion": "^1.1.7" 4326 | }, 4327 | "engines": { 4328 | "node": "*" 4329 | } 4330 | }, 4331 | "node_modules/esm-env": { 4332 | "version": "1.0.0", 4333 | "resolved": "https://registry.npmjs.org/esm-env/-/esm-env-1.0.0.tgz", 4334 | "integrity": "sha512-Cf6VksWPsTuW01vU9Mk/3vRue91Zevka5SjyNf3nEpokFRuqt/KjUQoGAwq9qMmhpLTHmXzSIrFRw8zxWzmFBA==" 4335 | }, 4336 | "node_modules/espree": { 4337 | "version": "9.6.1", 4338 | "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", 4339 | "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", 4340 | "dev": true, 4341 | "dependencies": { 4342 | "acorn": "^8.9.0", 4343 | "acorn-jsx": "^5.3.2", 4344 | "eslint-visitor-keys": "^3.4.1" 4345 | }, 4346 | "engines": { 4347 | "node": "^12.22.0 || ^14.17.0 || >=16.0.0" 4348 | }, 4349 | "funding": { 4350 | "url": "https://opencollective.com/eslint" 4351 | } 4352 | }, 4353 | "node_modules/esquery": { 4354 | "version": "1.5.0", 4355 | "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.5.0.tgz", 4356 | "integrity": "sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==", 4357 | "dev": true, 4358 | "dependencies": { 4359 | "estraverse": "^5.1.0" 4360 | }, 4361 | "engines": { 4362 | "node": ">=0.10" 4363 | } 4364 | }, 4365 | "node_modules/esrecurse": { 4366 | "version": "4.3.0", 4367 | "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", 4368 | "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", 4369 | "dev": true, 4370 | "dependencies": { 4371 | "estraverse": "^5.2.0" 4372 | }, 4373 | "engines": { 4374 | "node": ">=4.0" 4375 | } 4376 | }, 4377 | "node_modules/estraverse": { 4378 | "version": "5.3.0", 4379 | "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", 4380 | "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", 4381 | "dev": true, 4382 | "engines": { 4383 | "node": ">=4.0" 4384 | } 4385 | }, 4386 | "node_modules/estree-walker": { 4387 | "version": "2.0.2", 4388 | "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", 4389 | "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==" 4390 | }, 4391 | "node_modules/esutils": { 4392 | "version": "2.0.3", 4393 | "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", 4394 | "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", 4395 | "dev": true, 4396 | "engines": { 4397 | "node": ">=0.10.0" 4398 | } 4399 | }, 4400 | "node_modules/eventemitter2": { 4401 | "version": "6.4.7", 4402 | "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.7.tgz", 4403 | "integrity": "sha512-tYUSVOGeQPKt/eC1ABfhHy5Xd96N3oIijJvN3O9+TsC28T5V9yX9oEfEK5faP0EFSNVOG97qtAS68GBrQB2hDg==", 4404 | "dev": true 4405 | }, 4406 | "node_modules/eventsource-parser": { 4407 | "version": "1.1.2", 4408 | "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-1.1.2.tgz", 4409 | "integrity": "sha512-v0eOBUbiaFojBu2s2NPBfYUoRR9GjcDNvCXVaqEf5vVfpIAh9f8RCo4vXTP8c63QRKCFwoLpMpTdPwwhEKVgzA==", 4410 | "engines": { 4411 | "node": ">=14.18" 4412 | } 4413 | }, 4414 | "node_modules/execa": { 4415 | "version": "4.1.0", 4416 | "resolved": "https://registry.npmjs.org/execa/-/execa-4.1.0.tgz", 4417 | "integrity": "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==", 4418 | "dev": true, 4419 | "dependencies": { 4420 | "cross-spawn": "^7.0.0", 4421 | "get-stream": "^5.0.0", 4422 | "human-signals": "^1.1.1", 4423 | "is-stream": "^2.0.0", 4424 | "merge-stream": "^2.0.0", 4425 | "npm-run-path": "^4.0.0", 4426 | "onetime": "^5.1.0", 4427 | "signal-exit": "^3.0.2", 4428 | "strip-final-newline": "^2.0.0" 4429 | }, 4430 | "engines": { 4431 | "node": ">=10" 4432 | }, 4433 | "funding": { 4434 | "url": "https://github.com/sindresorhus/execa?sponsor=1" 4435 | } 4436 | }, 4437 | "node_modules/execa/node_modules/signal-exit": { 4438 | "version": "3.0.7", 4439 | "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", 4440 | "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", 4441 | "dev": true 4442 | }, 4443 | "node_modules/executable": { 4444 | "version": "4.1.1", 4445 | "resolved": "https://registry.npmjs.org/executable/-/executable-4.1.1.tgz", 4446 | "integrity": "sha512-8iA79xD3uAch729dUG8xaaBBFGaEa0wdD2VkYLFHwlqosEj/jT66AzcreRDSgV7ehnNLBW2WR5jIXwGKjVdTLg==", 4447 | "dev": true, 4448 | "dependencies": { 4449 | "pify": "^2.2.0" 4450 | }, 4451 | "engines": { 4452 | "node": ">=4" 4453 | } 4454 | }, 4455 | "node_modules/extend": { 4456 | "version": "3.0.2", 4457 | "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", 4458 | "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", 4459 | "dev": true 4460 | }, 4461 | "node_modules/extract-zip": { 4462 | "version": "2.0.1", 4463 | "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", 4464 | "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", 4465 | "dev": true, 4466 | "dependencies": { 4467 | "debug": "^4.1.1", 4468 | "get-stream": "^5.1.0", 4469 | "yauzl": "^2.10.0" 4470 | }, 4471 | "bin": { 4472 | "extract-zip": "cli.js" 4473 | }, 4474 | "engines": { 4475 | "node": ">= 10.17.0" 4476 | }, 4477 | "optionalDependencies": { 4478 | "@types/yauzl": "^2.9.1" 4479 | } 4480 | }, 4481 | "node_modules/extsprintf": { 4482 | "version": "1.3.0", 4483 | "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", 4484 | "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==", 4485 | "dev": true, 4486 | "engines": [ 4487 | "node >=0.6.0" 4488 | ] 4489 | }, 4490 | "node_modules/fast-deep-equal": { 4491 | "version": "3.1.3", 4492 | "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", 4493 | "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", 4494 | "dev": true 4495 | }, 4496 | "node_modules/fast-fifo": { 4497 | "version": "1.3.2", 4498 | "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", 4499 | "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==", 4500 | "dev": true 4501 | }, 4502 | "node_modules/fast-glob": { 4503 | "version": "3.3.2", 4504 | "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", 4505 | "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", 4506 | "dev": true, 4507 | "dependencies": { 4508 | "@nodelib/fs.stat": "^2.0.2", 4509 | "@nodelib/fs.walk": "^1.2.3", 4510 | "glob-parent": "^5.1.2", 4511 | "merge2": "^1.3.0", 4512 | "micromatch": "^4.0.4" 4513 | }, 4514 | "engines": { 4515 | "node": ">=8.6.0" 4516 | } 4517 | }, 4518 | "node_modules/fast-glob/node_modules/glob-parent": { 4519 | "version": "5.1.2", 4520 | "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", 4521 | "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", 4522 | "dev": true, 4523 | "dependencies": { 4524 | "is-glob": "^4.0.1" 4525 | }, 4526 | "engines": { 4527 | "node": ">= 6" 4528 | } 4529 | }, 4530 | "node_modules/fast-json-stable-stringify": { 4531 | "version": "2.1.0", 4532 | "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", 4533 | "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", 4534 | "dev": true 4535 | }, 4536 | "node_modules/fast-levenshtein": { 4537 | "version": "2.0.6", 4538 | "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", 4539 | "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", 4540 | "dev": true 4541 | }, 4542 | "node_modules/fastq": { 4543 | "version": "1.17.1", 4544 | "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.17.1.tgz", 4545 | "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", 4546 | "dev": true, 4547 | "dependencies": { 4548 | "reusify": "^1.0.4" 4549 | } 4550 | }, 4551 | "node_modules/fd-slicer": { 4552 | "version": "1.1.0", 4553 | "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", 4554 | "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", 4555 | "dev": true, 4556 | "dependencies": { 4557 | "pend": "~1.2.0" 4558 | } 4559 | }, 4560 | "node_modules/figures": { 4561 | "version": "3.2.0", 4562 | "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", 4563 | "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", 4564 | "dev": true, 4565 | "dependencies": { 4566 | "escape-string-regexp": "^1.0.5" 4567 | }, 4568 | "engines": { 4569 | "node": ">=8" 4570 | }, 4571 | "funding": { 4572 | "url": "https://github.com/sponsors/sindresorhus" 4573 | } 4574 | }, 4575 | "node_modules/figures/node_modules/escape-string-regexp": { 4576 | "version": "1.0.5", 4577 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", 4578 | "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", 4579 | "dev": true, 4580 | "engines": { 4581 | "node": ">=0.8.0" 4582 | } 4583 | }, 4584 | "node_modules/file-entry-cache": { 4585 | "version": "6.0.1", 4586 | "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", 4587 | "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", 4588 | "dev": true, 4589 | "dependencies": { 4590 | "flat-cache": "^3.0.4" 4591 | }, 4592 | "engines": { 4593 | "node": "^10.12.0 || >=12.0.0" 4594 | } 4595 | }, 4596 | "node_modules/file-saver": { 4597 | "version": "2.0.5", 4598 | "resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.5.tgz", 4599 | "integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA==" 4600 | }, 4601 | "node_modules/fill-range": { 4602 | "version": "7.1.1", 4603 | "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", 4604 | "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", 4605 | "dev": true, 4606 | "dependencies": { 4607 | "to-regex-range": "^5.0.1" 4608 | }, 4609 | "engines": { 4610 | "node": ">=8" 4611 | } 4612 | }, 4613 | "node_modules/find-up": { 4614 | "version": "5.0.0", 4615 | "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", 4616 | "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", 4617 | "dev": true, 4618 | "dependencies": { 4619 | "locate-path": "^6.0.0", 4620 | "path-exists": "^4.0.0" 4621 | }, 4622 | "engines": { 4623 | "node": ">=10" 4624 | }, 4625 | "funding": { 4626 | "url": "https://github.com/sponsors/sindresorhus" 4627 | } 4628 | }, 4629 | "node_modules/flat-cache": { 4630 | "version": "3.2.0", 4631 | "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", 4632 | "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", 4633 | "dev": true, 4634 | "dependencies": { 4635 | "flatted": "^3.2.9", 4636 | "keyv": "^4.5.3", 4637 | "rimraf": "^3.0.2" 4638 | }, 4639 | "engines": { 4640 | "node": "^10.12.0 || >=12.0.0" 4641 | } 4642 | }, 4643 | "node_modules/flatted": { 4644 | "version": "3.3.1", 4645 | "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", 4646 | "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", 4647 | "dev": true 4648 | }, 4649 | "node_modules/focus-trap": { 4650 | "version": "7.5.4", 4651 | "resolved": "https://registry.npmjs.org/focus-trap/-/focus-trap-7.5.4.tgz", 4652 | "integrity": "sha512-N7kHdlgsO/v+iD/dMoJKtsSqs5Dz/dXZVebRgJw23LDk+jMi/974zyiOYDziY2JPp8xivq9BmUGwIJMiuSBi7w==", 4653 | "dependencies": { 4654 | "tabbable": "^6.2.0" 4655 | } 4656 | }, 4657 | "node_modules/foreground-child": { 4658 | "version": "3.1.1", 4659 | "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", 4660 | "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", 4661 | "dev": true, 4662 | "dependencies": { 4663 | "cross-spawn": "^7.0.0", 4664 | "signal-exit": "^4.0.1" 4665 | }, 4666 | "engines": { 4667 | "node": ">=14" 4668 | }, 4669 | "funding": { 4670 | "url": "https://github.com/sponsors/isaacs" 4671 | } 4672 | }, 4673 | "node_modules/forever-agent": { 4674 | "version": "0.6.1", 4675 | "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", 4676 | "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", 4677 | "dev": true, 4678 | "engines": { 4679 | "node": "*" 4680 | } 4681 | }, 4682 | "node_modules/form-data": { 4683 | "version": "2.3.3", 4684 | "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", 4685 | "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", 4686 | "dev": true, 4687 | "dependencies": { 4688 | "asynckit": "^0.4.0", 4689 | "combined-stream": "^1.0.6", 4690 | "mime-types": "^2.1.12" 4691 | }, 4692 | "engines": { 4693 | "node": ">= 0.12" 4694 | } 4695 | }, 4696 | "node_modules/fraction.js": { 4697 | "version": "4.3.7", 4698 | "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.7.tgz", 4699 | "integrity": "sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==", 4700 | "dev": true, 4701 | "engines": { 4702 | "node": "*" 4703 | }, 4704 | "funding": { 4705 | "type": "patreon", 4706 | "url": "https://github.com/sponsors/rawify" 4707 | } 4708 | }, 4709 | "node_modules/fs-extra": { 4710 | "version": "11.2.0", 4711 | "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", 4712 | "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", 4713 | "dev": true, 4714 | "dependencies": { 4715 | "graceful-fs": "^4.2.0", 4716 | "jsonfile": "^6.0.1", 4717 | "universalify": "^2.0.0" 4718 | }, 4719 | "engines": { 4720 | "node": ">=14.14" 4721 | } 4722 | }, 4723 | "node_modules/fs-merger": { 4724 | "version": "3.2.1", 4725 | "resolved": "https://registry.npmjs.org/fs-merger/-/fs-merger-3.2.1.tgz", 4726 | "integrity": "sha512-AN6sX12liy0JE7C2evclwoo0aCG3PFulLjrTLsJpWh/2mM+DinhpSGqYLbHBBbIW1PLRNcFhJG8Axtz8mQW3ug==", 4727 | "dev": true, 4728 | "dependencies": { 4729 | "broccoli-node-api": "^1.7.0", 4730 | "broccoli-node-info": "^2.1.0", 4731 | "fs-extra": "^8.0.1", 4732 | "fs-tree-diff": "^2.0.1", 4733 | "walk-sync": "^2.2.0" 4734 | } 4735 | }, 4736 | "node_modules/fs-merger/node_modules/fs-extra": { 4737 | "version": "8.1.0", 4738 | "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", 4739 | "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", 4740 | "dev": true, 4741 | "dependencies": { 4742 | "graceful-fs": "^4.2.0", 4743 | "jsonfile": "^4.0.0", 4744 | "universalify": "^0.1.0" 4745 | }, 4746 | "engines": { 4747 | "node": ">=6 <7 || >=8" 4748 | } 4749 | }, 4750 | "node_modules/fs-merger/node_modules/jsonfile": { 4751 | "version": "4.0.0", 4752 | "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", 4753 | "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", 4754 | "dev": true, 4755 | "optionalDependencies": { 4756 | "graceful-fs": "^4.1.6" 4757 | } 4758 | }, 4759 | "node_modules/fs-merger/node_modules/universalify": { 4760 | "version": "0.1.2", 4761 | "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", 4762 | "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", 4763 | "dev": true, 4764 | "engines": { 4765 | "node": ">= 4.0.0" 4766 | } 4767 | }, 4768 | "node_modules/fs-mkdirp-stream": { 4769 | "version": "2.0.1", 4770 | "resolved": "https://registry.npmjs.org/fs-mkdirp-stream/-/fs-mkdirp-stream-2.0.1.tgz", 4771 | "integrity": "sha512-UTOY+59K6IA94tec8Wjqm0FSh5OVudGNB0NL/P6fB3HiE3bYOY3VYBGijsnOHNkQSwC1FKkU77pmq7xp9CskLw==", 4772 | "dev": true, 4773 | "dependencies": { 4774 | "graceful-fs": "^4.2.8", 4775 | "streamx": "^2.12.0" 4776 | }, 4777 | "engines": { 4778 | "node": ">=10.13.0" 4779 | } 4780 | }, 4781 | "node_modules/fs-tree-diff": { 4782 | "version": "2.0.1", 4783 | "resolved": "https://registry.npmjs.org/fs-tree-diff/-/fs-tree-diff-2.0.1.tgz", 4784 | "integrity": "sha512-x+CfAZ/lJHQqwlD64pYM5QxWjzWhSjroaVsr8PW831zOApL55qPibed0c+xebaLWVr2BnHFoHdrwOv8pzt8R5A==", 4785 | "dev": true, 4786 | "dependencies": { 4787 | "@types/symlink-or-copy": "^1.2.0", 4788 | "heimdalljs-logger": "^0.1.7", 4789 | "object-assign": "^4.1.0", 4790 | "path-posix": "^1.0.0", 4791 | "symlink-or-copy": "^1.1.8" 4792 | }, 4793 | "engines": { 4794 | "node": "6.* || 8.* || >= 10.*" 4795 | } 4796 | }, 4797 | "node_modules/fs.realpath": { 4798 | "version": "1.0.0", 4799 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 4800 | "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" 4801 | }, 4802 | "node_modules/fsevents": { 4803 | "version": "2.3.3", 4804 | "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", 4805 | "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", 4806 | "hasInstallScript": true, 4807 | "optional": true, 4808 | "os": [ 4809 | "darwin" 4810 | ], 4811 | "engines": { 4812 | "node": "^8.16.0 || ^10.6.0 || >=11.0.0" 4813 | } 4814 | }, 4815 | "node_modules/function-bind": { 4816 | "version": "1.1.2", 4817 | "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", 4818 | "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", 4819 | "funding": { 4820 | "url": "https://github.com/sponsors/ljharb" 4821 | } 4822 | }, 4823 | "node_modules/gc-hook": { 4824 | "version": "0.3.1", 4825 | "resolved": "https://registry.npmjs.org/gc-hook/-/gc-hook-0.3.1.tgz", 4826 | "integrity": "sha512-E5M+O/h2o7eZzGhzRZGex6hbB3k4NWqO0eA+OzLRLXxhdbYPajZnynPwAtphnh+cRHPwsj5Z80dqZlfI4eK55A==" 4827 | }, 4828 | "node_modules/get-func-name": { 4829 | "version": "2.0.2", 4830 | "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", 4831 | "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", 4832 | "dev": true, 4833 | "engines": { 4834 | "node": "*" 4835 | } 4836 | }, 4837 | "node_modules/get-intrinsic": { 4838 | "version": "1.2.4", 4839 | "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", 4840 | "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", 4841 | "dev": true, 4842 | "dependencies": { 4843 | "es-errors": "^1.3.0", 4844 | "function-bind": "^1.1.2", 4845 | "has-proto": "^1.0.1", 4846 | "has-symbols": "^1.0.3", 4847 | "hasown": "^2.0.0" 4848 | }, 4849 | "engines": { 4850 | "node": ">= 0.4" 4851 | }, 4852 | "funding": { 4853 | "url": "https://github.com/sponsors/ljharb" 4854 | } 4855 | }, 4856 | "node_modules/get-stream": { 4857 | "version": "5.2.0", 4858 | "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", 4859 | "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", 4860 | "dev": true, 4861 | "dependencies": { 4862 | "pump": "^3.0.0" 4863 | }, 4864 | "engines": { 4865 | "node": ">=8" 4866 | }, 4867 | "funding": { 4868 | "url": "https://github.com/sponsors/sindresorhus" 4869 | } 4870 | }, 4871 | "node_modules/getos": { 4872 | "version": "3.2.1", 4873 | "resolved": "https://registry.npmjs.org/getos/-/getos-3.2.1.tgz", 4874 | "integrity": "sha512-U56CfOK17OKgTVqozZjUKNdkfEv6jk5WISBJ8SHoagjE6L69zOwl3Z+O8myjY9MEW3i2HPWQBt/LTbCgcC973Q==", 4875 | "dev": true, 4876 | "dependencies": { 4877 | "async": "^3.2.0" 4878 | } 4879 | }, 4880 | "node_modules/getpass": { 4881 | "version": "0.1.7", 4882 | "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", 4883 | "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", 4884 | "dev": true, 4885 | "dependencies": { 4886 | "assert-plus": "^1.0.0" 4887 | } 4888 | }, 4889 | "node_modules/glob": { 4890 | "version": "8.1.0", 4891 | "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", 4892 | "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", 4893 | "dependencies": { 4894 | "fs.realpath": "^1.0.0", 4895 | "inflight": "^1.0.4", 4896 | "inherits": "2", 4897 | "minimatch": "^5.0.1", 4898 | "once": "^1.3.0" 4899 | }, 4900 | "engines": { 4901 | "node": ">=12" 4902 | }, 4903 | "funding": { 4904 | "url": "https://github.com/sponsors/isaacs" 4905 | } 4906 | }, 4907 | "node_modules/glob-parent": { 4908 | "version": "6.0.2", 4909 | "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", 4910 | "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", 4911 | "dev": true, 4912 | "dependencies": { 4913 | "is-glob": "^4.0.3" 4914 | }, 4915 | "engines": { 4916 | "node": ">=10.13.0" 4917 | } 4918 | }, 4919 | "node_modules/glob-stream": { 4920 | "version": "8.0.0", 4921 | "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-8.0.0.tgz", 4922 | "integrity": "sha512-CdIUuwOkYNv9ZadR3jJvap8CMooKziQZ/QCSPhEb7zqfsEI5YnPmvca7IvbaVE3z58ZdUYD2JsU6AUWjL8WZJA==", 4923 | "dev": true, 4924 | "dependencies": { 4925 | "@gulpjs/to-absolute-glob": "^4.0.0", 4926 | "anymatch": "^3.1.3", 4927 | "fastq": "^1.13.0", 4928 | "glob-parent": "^6.0.2", 4929 | "is-glob": "^4.0.3", 4930 | "is-negated-glob": "^1.0.0", 4931 | "normalize-path": "^3.0.0", 4932 | "streamx": "^2.12.5" 4933 | }, 4934 | "engines": { 4935 | "node": ">=10.13.0" 4936 | } 4937 | }, 4938 | "node_modules/glob/node_modules/minimatch": { 4939 | "version": "5.1.6", 4940 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", 4941 | "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", 4942 | "dependencies": { 4943 | "brace-expansion": "^2.0.1" 4944 | }, 4945 | "engines": { 4946 | "node": ">=10" 4947 | } 4948 | }, 4949 | "node_modules/global-dirs": { 4950 | "version": "3.0.1", 4951 | "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.1.tgz", 4952 | "integrity": "sha512-NBcGGFbBA9s1VzD41QXDG+3++t9Mn5t1FpLdhESY6oKY4gYTFpX4wO3sqGUa0Srjtbfj3szX0RnemmrVRUdULA==", 4953 | "dev": true, 4954 | "dependencies": { 4955 | "ini": "2.0.0" 4956 | }, 4957 | "engines": { 4958 | "node": ">=10" 4959 | }, 4960 | "funding": { 4961 | "url": "https://github.com/sponsors/sindresorhus" 4962 | } 4963 | }, 4964 | "node_modules/globals": { 4965 | "version": "13.24.0", 4966 | "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", 4967 | "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", 4968 | "dev": true, 4969 | "dependencies": { 4970 | "type-fest": "^0.20.2" 4971 | }, 4972 | "engines": { 4973 | "node": ">=8" 4974 | }, 4975 | "funding": { 4976 | "url": "https://github.com/sponsors/sindresorhus" 4977 | } 4978 | }, 4979 | "node_modules/globalyzer": { 4980 | "version": "0.1.0", 4981 | "resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz", 4982 | "integrity": "sha512-40oNTM9UfG6aBmuKxk/giHn5nQ8RVz/SS4Ir6zgzOv9/qC3kKZ9v4etGTcJbEl/NyVQH7FGU7d+X1egr57Md2Q==" 4983 | }, 4984 | "node_modules/globby": { 4985 | "version": "11.1.0", 4986 | "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", 4987 | "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", 4988 | "dev": true, 4989 | "dependencies": { 4990 | "array-union": "^2.1.0", 4991 | "dir-glob": "^3.0.1", 4992 | "fast-glob": "^3.2.9", 4993 | "ignore": "^5.2.0", 4994 | "merge2": "^1.4.1", 4995 | "slash": "^3.0.0" 4996 | }, 4997 | "engines": { 4998 | "node": ">=10" 4999 | }, 5000 | "funding": { 5001 | "url": "https://github.com/sponsors/sindresorhus" 5002 | } 5003 | }, 5004 | "node_modules/globrex": { 5005 | "version": "0.1.2", 5006 | "resolved": "https://registry.npmjs.org/globrex/-/globrex-0.1.2.tgz", 5007 | "integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==" 5008 | }, 5009 | "node_modules/gopd": { 5010 | "version": "1.0.1", 5011 | "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", 5012 | "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", 5013 | "dev": true, 5014 | "dependencies": { 5015 | "get-intrinsic": "^1.1.3" 5016 | }, 5017 | "funding": { 5018 | "url": "https://github.com/sponsors/ljharb" 5019 | } 5020 | }, 5021 | "node_modules/graceful-fs": { 5022 | "version": "4.2.11", 5023 | "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", 5024 | "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", 5025 | "dev": true 5026 | }, 5027 | "node_modules/graphemer": { 5028 | "version": "1.4.0", 5029 | "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", 5030 | "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", 5031 | "dev": true 5032 | }, 5033 | "node_modules/gulp-sort": { 5034 | "version": "2.0.0", 5035 | "resolved": "https://registry.npmjs.org/gulp-sort/-/gulp-sort-2.0.0.tgz", 5036 | "integrity": "sha512-MyTel3FXOdh1qhw1yKhpimQrAmur9q1X0ZigLmCOxouQD+BD3za9/89O+HfbgBQvvh4igEbp0/PUWO+VqGYG1g==", 5037 | "dev": true, 5038 | "dependencies": { 5039 | "through2": "^2.0.1" 5040 | } 5041 | }, 5042 | "node_modules/has-flag": { 5043 | "version": "4.0.0", 5044 | "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", 5045 | "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", 5046 | "dev": true, 5047 | "engines": { 5048 | "node": ">=8" 5049 | } 5050 | }, 5051 | "node_modules/has-property-descriptors": { 5052 | "version": "1.0.2", 5053 | "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", 5054 | "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", 5055 | "dev": true, 5056 | "dependencies": { 5057 | "es-define-property": "^1.0.0" 5058 | }, 5059 | "funding": { 5060 | "url": "https://github.com/sponsors/ljharb" 5061 | } 5062 | }, 5063 | "node_modules/has-proto": { 5064 | "version": "1.0.3", 5065 | "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", 5066 | "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", 5067 | "dev": true, 5068 | "engines": { 5069 | "node": ">= 0.4" 5070 | }, 5071 | "funding": { 5072 | "url": "https://github.com/sponsors/ljharb" 5073 | } 5074 | }, 5075 | "node_modules/has-symbols": { 5076 | "version": "1.0.3", 5077 | "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", 5078 | "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", 5079 | "dev": true, 5080 | "engines": { 5081 | "node": ">= 0.4" 5082 | }, 5083 | "funding": { 5084 | "url": "https://github.com/sponsors/ljharb" 5085 | } 5086 | }, 5087 | "node_modules/hasown": { 5088 | "version": "2.0.2", 5089 | "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", 5090 | "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", 5091 | "dependencies": { 5092 | "function-bind": "^1.1.2" 5093 | }, 5094 | "engines": { 5095 | "node": ">= 0.4" 5096 | } 5097 | }, 5098 | "node_modules/he": { 5099 | "version": "1.2.0", 5100 | "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", 5101 | "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", 5102 | "dev": true, 5103 | "bin": { 5104 | "he": "bin/he" 5105 | } 5106 | }, 5107 | "node_modules/heimdalljs": { 5108 | "version": "0.2.6", 5109 | "resolved": "https://registry.npmjs.org/heimdalljs/-/heimdalljs-0.2.6.tgz", 5110 | "integrity": "sha512-o9bd30+5vLBvBtzCPwwGqpry2+n0Hi6H1+qwt6y+0kwRHGGF8TFIhJPmnuM0xO97zaKrDZMwO/V56fAnn8m/tA==", 5111 | "dev": true, 5112 | "dependencies": { 5113 | "rsvp": "~3.2.1" 5114 | } 5115 | }, 5116 | "node_modules/heimdalljs-logger": { 5117 | "version": "0.1.10", 5118 | "resolved": "https://registry.npmjs.org/heimdalljs-logger/-/heimdalljs-logger-0.1.10.tgz", 5119 | "integrity": "sha512-pO++cJbhIufVI/fmB/u2Yty3KJD0TqNPecehFae0/eps0hkZ3b4Zc/PezUMOpYuHFQbA7FxHZxa305EhmjLj4g==", 5120 | "dev": true, 5121 | "dependencies": { 5122 | "debug": "^2.2.0", 5123 | "heimdalljs": "^0.2.6" 5124 | } 5125 | }, 5126 | "node_modules/heimdalljs-logger/node_modules/debug": { 5127 | "version": "2.6.9", 5128 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 5129 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 5130 | "dev": true, 5131 | "dependencies": { 5132 | "ms": "2.0.0" 5133 | } 5134 | }, 5135 | "node_modules/heimdalljs-logger/node_modules/ms": { 5136 | "version": "2.0.0", 5137 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 5138 | "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", 5139 | "dev": true 5140 | }, 5141 | "node_modules/heimdalljs/node_modules/rsvp": { 5142 | "version": "3.2.1", 5143 | "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-3.2.1.tgz", 5144 | "integrity": "sha512-Rf4YVNYpKjZ6ASAmibcwTNciQ5Co5Ztq6iZPEykHpkoflnD/K5ryE/rHehFsTm4NJj8nKDhbi3eKBWGogmNnkg==", 5145 | "dev": true 5146 | }, 5147 | "node_modules/highlight.js": { 5148 | "version": "11.9.0", 5149 | "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.9.0.tgz", 5150 | "integrity": "sha512-fJ7cW7fQGCYAkgv4CPfwFHrfd/cLS4Hau96JuJ+ZTOWhjnhoeN1ub1tFmALm/+lW5z4WCAuAV9bm05AP0mS6Gw==", 5151 | "engines": { 5152 | "node": ">=12.0.0" 5153 | } 5154 | }, 5155 | "node_modules/html-escaper": { 5156 | "version": "3.0.3", 5157 | "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-3.0.3.tgz", 5158 | "integrity": "sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ==" 5159 | }, 5160 | "node_modules/htmlparser2": { 5161 | "version": "8.0.2", 5162 | "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz", 5163 | "integrity": "sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==", 5164 | "dev": true, 5165 | "funding": [ 5166 | "https://github.com/fb55/htmlparser2?sponsor=1", 5167 | { 5168 | "type": "github", 5169 | "url": "https://github.com/sponsors/fb55" 5170 | } 5171 | ], 5172 | "dependencies": { 5173 | "domelementtype": "^2.3.0", 5174 | "domhandler": "^5.0.3", 5175 | "domutils": "^3.0.1", 5176 | "entities": "^4.4.0" 5177 | } 5178 | }, 5179 | "node_modules/http-signature": { 5180 | "version": "1.3.6", 5181 | "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.3.6.tgz", 5182 | "integrity": "sha512-3adrsD6zqo4GsTqtO7FyrejHNv+NgiIfAfv68+jVlFmSr9OGy7zrxONceFRLKvnnZA5jbxQBX1u9PpB6Wi32Gw==", 5183 | "dev": true, 5184 | "dependencies": { 5185 | "assert-plus": "^1.0.0", 5186 | "jsprim": "^2.0.2", 5187 | "sshpk": "^1.14.1" 5188 | }, 5189 | "engines": { 5190 | "node": ">=0.10" 5191 | } 5192 | }, 5193 | "node_modules/human-signals": { 5194 | "version": "1.1.1", 5195 | "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", 5196 | "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", 5197 | "dev": true, 5198 | "engines": { 5199 | "node": ">=8.12.0" 5200 | } 5201 | }, 5202 | "node_modules/i18next": { 5203 | "version": "23.10.1", 5204 | "resolved": "https://registry.npmjs.org/i18next/-/i18next-23.10.1.tgz", 5205 | "integrity": "sha512-NDiIzFbcs3O9PXpfhkjyf7WdqFn5Vq6mhzhtkXzj51aOcNuPNcTwuYNuXCpHsanZGHlHKL35G7huoFeVic1hng==", 5206 | "funding": [ 5207 | { 5208 | "type": "individual", 5209 | "url": "https://locize.com" 5210 | }, 5211 | { 5212 | "type": "individual", 5213 | "url": "https://locize.com/i18next.html" 5214 | }, 5215 | { 5216 | "type": "individual", 5217 | "url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project" 5218 | } 5219 | ], 5220 | "dependencies": { 5221 | "@babel/runtime": "^7.23.2" 5222 | } 5223 | }, 5224 | "node_modules/i18next-browser-languagedetector": { 5225 | "version": "7.2.0", 5226 | "resolved": "https://registry.npmjs.org/i18next-browser-languagedetector/-/i18next-browser-languagedetector-7.2.0.tgz", 5227 | "integrity": "sha512-U00DbDtFIYD3wkWsr2aVGfXGAj2TgnELzOX9qv8bT0aJtvPV9CRO77h+vgmHFBMe7LAxdwvT/7VkCWGya6L3tA==", 5228 | "dependencies": { 5229 | "@babel/runtime": "^7.23.2" 5230 | } 5231 | }, 5232 | "node_modules/i18next-parser": { 5233 | "version": "8.13.0", 5234 | "resolved": "https://registry.npmjs.org/i18next-parser/-/i18next-parser-8.13.0.tgz", 5235 | "integrity": "sha512-XU7resoeNcpJazh29OncQQUH6HsgCxk06RqBBDAmLHldafxopfCHY1vElyG/o3EY0Sn7XjelAmPTV0SgddJEww==", 5236 | "dev": true, 5237 | "dependencies": { 5238 | "@babel/runtime": "^7.23.2", 5239 | "broccoli-plugin": "^4.0.7", 5240 | "cheerio": "^1.0.0-rc.2", 5241 | "colors": "1.4.0", 5242 | "commander": "~11.1.0", 5243 | "eol": "^0.9.1", 5244 | "esbuild": "^0.20.1", 5245 | "fs-extra": "^11.1.0", 5246 | "gulp-sort": "^2.0.0", 5247 | "i18next": "^23.5.1", 5248 | "js-yaml": "4.1.0", 5249 | "lilconfig": "^3.0.0", 5250 | "rsvp": "^4.8.2", 5251 | "sort-keys": "^5.0.0", 5252 | "typescript": "^5.0.4", 5253 | "vinyl": "~3.0.0", 5254 | "vinyl-fs": "^4.0.0", 5255 | "vue-template-compiler": "^2.6.11" 5256 | }, 5257 | "bin": { 5258 | "i18next": "bin/cli.js" 5259 | }, 5260 | "engines": { 5261 | "node": ">=16.0.0 || >=18.0.0 || >=20.0.0", 5262 | "npm": ">=6", 5263 | "yarn": ">=1" 5264 | } 5265 | }, 5266 | "node_modules/i18next-resources-to-backend": { 5267 | "version": "1.2.0", 5268 | "resolved": "https://registry.npmjs.org/i18next-resources-to-backend/-/i18next-resources-to-backend-1.2.0.tgz", 5269 | "integrity": "sha512-8f1l03s+QxDmCfpSXCh9V+AFcxAwIp0UaroWuyOx+hmmv8484GcELHs+lnu54FrNij8cDBEXvEwhzZoXsKcVpg==", 5270 | "dependencies": { 5271 | "@babel/runtime": "^7.23.2" 5272 | } 5273 | }, 5274 | "node_modules/iconv-lite": { 5275 | "version": "0.6.3", 5276 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", 5277 | "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", 5278 | "dependencies": { 5279 | "safer-buffer": ">= 2.1.2 < 3.0.0" 5280 | }, 5281 | "engines": { 5282 | "node": ">=0.10.0" 5283 | } 5284 | }, 5285 | "node_modules/idb": { 5286 | "version": "7.1.1", 5287 | "resolved": "https://registry.npmjs.org/idb/-/idb-7.1.1.tgz", 5288 | "integrity": "sha512-gchesWBzyvGHRO9W8tzUWFDycow5gwjvFKfyV9FF32Y7F50yZMp7mP+T2mJIWFx49zicqyC4uefHM17o6xKIVQ==" 5289 | }, 5290 | "node_modules/ieee754": { 5291 | "version": "1.2.1", 5292 | "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", 5293 | "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", 5294 | "dev": true, 5295 | "funding": [ 5296 | { 5297 | "type": "github", 5298 | "url": "https://github.com/sponsors/feross" 5299 | }, 5300 | { 5301 | "type": "patreon", 5302 | "url": "https://www.patreon.com/feross" 5303 | }, 5304 | { 5305 | "type": "consulting", 5306 | "url": "https://feross.org/support" 5307 | } 5308 | ] 5309 | }, 5310 | "node_modules/ignore": { 5311 | "version": "5.3.1", 5312 | "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", 5313 | "integrity": "sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==", 5314 | "dev": true, 5315 | "engines": { 5316 | "node": ">= 4" 5317 | } 5318 | }, 5319 | "node_modules/import-fresh": { 5320 | "version": "3.3.0", 5321 | "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", 5322 | "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", 5323 | "dev": true, 5324 | "dependencies": { 5325 | "parent-module": "^1.0.0", 5326 | "resolve-from": "^4.0.0" 5327 | }, 5328 | "engines": { 5329 | "node": ">=6" 5330 | }, 5331 | "funding": { 5332 | "url": "https://github.com/sponsors/sindresorhus" 5333 | } 5334 | }, 5335 | "node_modules/import-meta-resolve": { 5336 | "version": "4.0.0", 5337 | "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.0.0.tgz", 5338 | "integrity": "sha512-okYUR7ZQPH+efeuMJGlq4f8ubUgO50kByRPyt/Cy1Io4PSRsPjxME+YlVaCOx+NIToW7hCsZNFJyTPFFKepRSA==", 5339 | "dev": true, 5340 | "funding": { 5341 | "type": "github", 5342 | "url": "https://github.com/sponsors/wooorm" 5343 | } 5344 | }, 5345 | "node_modules/imurmurhash": { 5346 | "version": "0.1.4", 5347 | "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", 5348 | "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", 5349 | "dev": true, 5350 | "engines": { 5351 | "node": ">=0.8.19" 5352 | } 5353 | }, 5354 | "node_modules/indent-string": { 5355 | "version": "4.0.0", 5356 | "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", 5357 | "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", 5358 | "dev": true, 5359 | "engines": { 5360 | "node": ">=8" 5361 | } 5362 | }, 5363 | "node_modules/inflight": { 5364 | "version": "1.0.6", 5365 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 5366 | "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", 5367 | "dependencies": { 5368 | "once": "^1.3.0", 5369 | "wrappy": "1" 5370 | } 5371 | }, 5372 | "node_modules/inherits": { 5373 | "version": "2.0.4", 5374 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 5375 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 5376 | }, 5377 | "node_modules/ini": { 5378 | "version": "2.0.0", 5379 | "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", 5380 | "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", 5381 | "dev": true, 5382 | "engines": { 5383 | "node": ">=10" 5384 | } 5385 | }, 5386 | "node_modules/internmap": { 5387 | "version": "2.0.3", 5388 | "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz", 5389 | "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==", 5390 | "engines": { 5391 | "node": ">=12" 5392 | } 5393 | }, 5394 | "node_modules/is-binary-path": { 5395 | "version": "2.1.0", 5396 | "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", 5397 | "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", 5398 | "dev": true, 5399 | "dependencies": { 5400 | "binary-extensions": "^2.0.0" 5401 | }, 5402 | "engines": { 5403 | "node": ">=8" 5404 | } 5405 | }, 5406 | "node_modules/is-builtin-module": { 5407 | "version": "3.2.1", 5408 | "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.2.1.tgz", 5409 | "integrity": "sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==", 5410 | "dependencies": { 5411 | "builtin-modules": "^3.3.0" 5412 | }, 5413 | "engines": { 5414 | "node": ">=6" 5415 | }, 5416 | "funding": { 5417 | "url": "https://github.com/sponsors/sindresorhus" 5418 | } 5419 | }, 5420 | "node_modules/is-ci": { 5421 | "version": "3.0.1", 5422 | "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-3.0.1.tgz", 5423 | "integrity": "sha512-ZYvCgrefwqoQ6yTyYUbQu64HsITZ3NfKX1lzaEYdkTDcfKzzCI/wthRRYKkdjHKFVgNiXKAKm65Zo1pk2as/QQ==", 5424 | "dev": true, 5425 | "dependencies": { 5426 | "ci-info": "^3.2.0" 5427 | }, 5428 | "bin": { 5429 | "is-ci": "bin.js" 5430 | } 5431 | }, 5432 | "node_modules/is-core-module": { 5433 | "version": "2.13.1", 5434 | "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", 5435 | "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", 5436 | "dependencies": { 5437 | "hasown": "^2.0.0" 5438 | }, 5439 | "funding": { 5440 | "url": "https://github.com/sponsors/ljharb" 5441 | } 5442 | }, 5443 | "node_modules/is-extglob": { 5444 | "version": "2.1.1", 5445 | "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", 5446 | "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", 5447 | "dev": true, 5448 | "engines": { 5449 | "node": ">=0.10.0" 5450 | } 5451 | }, 5452 | "node_modules/is-fullwidth-code-point": { 5453 | "version": "3.0.0", 5454 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", 5455 | "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", 5456 | "dev": true, 5457 | "engines": { 5458 | "node": ">=8" 5459 | } 5460 | }, 5461 | "node_modules/is-glob": { 5462 | "version": "4.0.3", 5463 | "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", 5464 | "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", 5465 | "dev": true, 5466 | "dependencies": { 5467 | "is-extglob": "^2.1.1" 5468 | }, 5469 | "engines": { 5470 | "node": ">=0.10.0" 5471 | } 5472 | }, 5473 | "node_modules/is-installed-globally": { 5474 | "version": "0.4.0", 5475 | "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", 5476 | "integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==", 5477 | "dev": true, 5478 | "dependencies": { 5479 | "global-dirs": "^3.0.0", 5480 | "is-path-inside": "^3.0.2" 5481 | }, 5482 | "engines": { 5483 | "node": ">=10" 5484 | }, 5485 | "funding": { 5486 | "url": "https://github.com/sponsors/sindresorhus" 5487 | } 5488 | }, 5489 | "node_modules/is-module": { 5490 | "version": "1.0.0", 5491 | "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", 5492 | "integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==" 5493 | }, 5494 | "node_modules/is-negated-glob": { 5495 | "version": "1.0.0", 5496 | "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", 5497 | "integrity": "sha512-czXVVn/QEmgvej1f50BZ648vUI+em0xqMq2Sn+QncCLN4zj1UAxlT+kw/6ggQTOaZPd1HqKQGEqbpQVtJucWug==", 5498 | "dev": true, 5499 | "engines": { 5500 | "node": ">=0.10.0" 5501 | } 5502 | }, 5503 | "node_modules/is-number": { 5504 | "version": "7.0.0", 5505 | "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", 5506 | "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", 5507 | "dev": true, 5508 | "engines": { 5509 | "node": ">=0.12.0" 5510 | } 5511 | }, 5512 | "node_modules/is-path-inside": { 5513 | "version": "3.0.3", 5514 | "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", 5515 | "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", 5516 | "dev": true, 5517 | "engines": { 5518 | "node": ">=8" 5519 | } 5520 | }, 5521 | "node_modules/is-plain-obj": { 5522 | "version": "4.1.0", 5523 | "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", 5524 | "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", 5525 | "dev": true, 5526 | "engines": { 5527 | "node": ">=12" 5528 | }, 5529 | "funding": { 5530 | "url": "https://github.com/sponsors/sindresorhus" 5531 | } 5532 | }, 5533 | "node_modules/is-reference": { 5534 | "version": "1.2.1", 5535 | "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", 5536 | "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", 5537 | "dependencies": { 5538 | "@types/estree": "*" 5539 | } 5540 | }, 5541 | "node_modules/is-stream": { 5542 | "version": "2.0.1", 5543 | "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", 5544 | "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", 5545 | "dev": true, 5546 | "engines": { 5547 | "node": ">=8" 5548 | }, 5549 | "funding": { 5550 | "url": "https://github.com/sponsors/sindresorhus" 5551 | } 5552 | }, 5553 | "node_modules/is-typedarray": { 5554 | "version": "1.0.0", 5555 | "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", 5556 | "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", 5557 | "dev": true 5558 | }, 5559 | "node_modules/is-unicode-supported": { 5560 | "version": "0.1.0", 5561 | "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", 5562 | "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", 5563 | "dev": true, 5564 | "engines": { 5565 | "node": ">=10" 5566 | }, 5567 | "funding": { 5568 | "url": "https://github.com/sponsors/sindresorhus" 5569 | } 5570 | }, 5571 | "node_modules/is-valid-glob": { 5572 | "version": "1.0.0", 5573 | "resolved": "https://registry.npmjs.org/is-valid-glob/-/is-valid-glob-1.0.0.tgz", 5574 | "integrity": "sha512-AhiROmoEFDSsjx8hW+5sGwgKVIORcXnrlAx/R0ZSeaPw70Vw0CqkGBBhHGL58Uox2eXnU1AnvXJl1XlyedO5bA==", 5575 | "dev": true, 5576 | "engines": { 5577 | "node": ">=0.10.0" 5578 | } 5579 | }, 5580 | "node_modules/isarray": { 5581 | "version": "1.0.0", 5582 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 5583 | "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", 5584 | "dev": true 5585 | }, 5586 | "node_modules/isexe": { 5587 | "version": "2.0.0", 5588 | "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", 5589 | "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", 5590 | "dev": true 5591 | }, 5592 | "node_modules/isstream": { 5593 | "version": "0.1.2", 5594 | "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", 5595 | "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==", 5596 | "dev": true 5597 | }, 5598 | "node_modules/jackspeak": { 5599 | "version": "2.3.6", 5600 | "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", 5601 | "integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==", 5602 | "dev": true, 5603 | "dependencies": { 5604 | "@isaacs/cliui": "^8.0.2" 5605 | }, 5606 | "engines": { 5607 | "node": ">=14" 5608 | }, 5609 | "funding": { 5610 | "url": "https://github.com/sponsors/isaacs" 5611 | }, 5612 | "optionalDependencies": { 5613 | "@pkgjs/parseargs": "^0.11.0" 5614 | } 5615 | }, 5616 | "node_modules/jiti": { 5617 | "version": "1.21.0", 5618 | "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.0.tgz", 5619 | "integrity": "sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==", 5620 | "dev": true, 5621 | "bin": { 5622 | "jiti": "bin/jiti.js" 5623 | } 5624 | }, 5625 | "node_modules/js-sha256": { 5626 | "version": "0.10.1", 5627 | "resolved": "https://registry.npmjs.org/js-sha256/-/js-sha256-0.10.1.tgz", 5628 | "integrity": "sha512-5obBtsz9301ULlsgggLg542s/jqtddfOpV5KJc4hajc9JV8GeY2gZHSVpYBn4nWqAUTJ9v+xwtbJ1mIBgIH5Vw==" 5629 | }, 5630 | "node_modules/js-tokens": { 5631 | "version": "9.0.0", 5632 | "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-9.0.0.tgz", 5633 | "integrity": "sha512-WriZw1luRMlmV3LGJaR6QOJjWwgLUTf89OwT2lUOyjX2dJGBwgmIkbcz+7WFZjrZM635JOIR517++e/67CP9dQ==", 5634 | "dev": true 5635 | }, 5636 | "node_modules/js-yaml": { 5637 | "version": "4.1.0", 5638 | "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", 5639 | "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", 5640 | "dev": true, 5641 | "dependencies": { 5642 | "argparse": "^2.0.1" 5643 | }, 5644 | "bin": { 5645 | "js-yaml": "bin/js-yaml.js" 5646 | } 5647 | }, 5648 | "node_modules/jsbn": { 5649 | "version": "0.1.1", 5650 | "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", 5651 | "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==", 5652 | "dev": true 5653 | }, 5654 | "node_modules/json-buffer": { 5655 | "version": "3.0.1", 5656 | "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", 5657 | "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", 5658 | "dev": true 5659 | }, 5660 | "node_modules/json-schema": { 5661 | "version": "0.4.0", 5662 | "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", 5663 | "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", 5664 | "dev": true 5665 | }, 5666 | "node_modules/json-schema-traverse": { 5667 | "version": "0.4.1", 5668 | "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", 5669 | "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", 5670 | "dev": true 5671 | }, 5672 | "node_modules/json-stable-stringify-without-jsonify": { 5673 | "version": "1.0.1", 5674 | "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", 5675 | "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", 5676 | "dev": true 5677 | }, 5678 | "node_modules/json-stringify-safe": { 5679 | "version": "5.0.1", 5680 | "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", 5681 | "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", 5682 | "dev": true 5683 | }, 5684 | "node_modules/jsonfile": { 5685 | "version": "6.1.0", 5686 | "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", 5687 | "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", 5688 | "dev": true, 5689 | "dependencies": { 5690 | "universalify": "^2.0.0" 5691 | }, 5692 | "optionalDependencies": { 5693 | "graceful-fs": "^4.1.6" 5694 | } 5695 | }, 5696 | "node_modules/jsprim": { 5697 | "version": "2.0.2", 5698 | "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-2.0.2.tgz", 5699 | "integrity": "sha512-gqXddjPqQ6G40VdnI6T6yObEC+pDNvyP95wdQhkWkg7crHH3km5qP1FsOXEkzEQwnz6gz5qGTn1c2Y52wP3OyQ==", 5700 | "dev": true, 5701 | "engines": [ 5702 | "node >=0.6.0" 5703 | ], 5704 | "dependencies": { 5705 | "assert-plus": "1.0.0", 5706 | "extsprintf": "1.3.0", 5707 | "json-schema": "0.4.0", 5708 | "verror": "1.10.0" 5709 | } 5710 | }, 5711 | "node_modules/katex": { 5712 | "version": "0.16.10", 5713 | "resolved": "https://registry.npmjs.org/katex/-/katex-0.16.10.tgz", 5714 | "integrity": "sha512-ZiqaC04tp2O5utMsl2TEZTXxa6WSC4yo0fv5ML++D3QZv/vx2Mct0mTlRx3O+uUkjfuAgOkzsCmq5MiUEsDDdA==", 5715 | "funding": [ 5716 | "https://opencollective.com/katex", 5717 | "https://github.com/sponsors/katex" 5718 | ], 5719 | "dependencies": { 5720 | "commander": "^8.3.0" 5721 | }, 5722 | "bin": { 5723 | "katex": "cli.js" 5724 | } 5725 | }, 5726 | "node_modules/katex/node_modules/commander": { 5727 | "version": "8.3.0", 5728 | "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", 5729 | "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", 5730 | "engines": { 5731 | "node": ">= 12" 5732 | } 5733 | }, 5734 | "node_modules/keyv": { 5735 | "version": "4.5.4", 5736 | "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", 5737 | "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", 5738 | "dev": true, 5739 | "dependencies": { 5740 | "json-buffer": "3.0.1" 5741 | } 5742 | }, 5743 | "node_modules/khroma": { 5744 | "version": "2.1.0", 5745 | "resolved": "https://registry.npmjs.org/khroma/-/khroma-2.1.0.tgz", 5746 | "integrity": "sha512-Ls993zuzfayK269Svk9hzpeGUKob/sIgZzyHYdjQoAdQetRKpOLj+k/QQQ/6Qi0Yz65mlROrfd+Ev+1+7dz9Kw==" 5747 | }, 5748 | "node_modules/kleur": { 5749 | "version": "4.1.5", 5750 | "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", 5751 | "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", 5752 | "engines": { 5753 | "node": ">=6" 5754 | } 5755 | }, 5756 | "node_modules/known-css-properties": { 5757 | "version": "0.29.0", 5758 | "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.29.0.tgz", 5759 | "integrity": "sha512-Ne7wqW7/9Cz54PDt4I3tcV+hAyat8ypyOGzYRJQfdxnnjeWsTxt1cy8pjvvKeI5kfXuyvULyeeAvwvvtAX3ayQ==", 5760 | "dev": true 5761 | }, 5762 | "node_modules/layout-base": { 5763 | "version": "1.0.2", 5764 | "resolved": "https://registry.npmjs.org/layout-base/-/layout-base-1.0.2.tgz", 5765 | "integrity": "sha512-8h2oVEZNktL4BH2JCOI90iD1yXwL6iNW7KcCKT2QZgQJR2vbqDsldCTPRU9NifTCqHZci57XvQQ15YTu+sTYPg==" 5766 | }, 5767 | "node_modules/lazy-ass": { 5768 | "version": "1.6.0", 5769 | "resolved": "https://registry.npmjs.org/lazy-ass/-/lazy-ass-1.6.0.tgz", 5770 | "integrity": "sha512-cc8oEVoctTvsFZ/Oje/kGnHbpWHYBe8IAJe4C0QNc3t8uM/0Y8+erSz/7Y1ALuXTEZTMvxXwO6YbX1ey3ujiZw==", 5771 | "dev": true, 5772 | "engines": { 5773 | "node": "> 0.8" 5774 | } 5775 | }, 5776 | "node_modules/lead": { 5777 | "version": "4.0.0", 5778 | "resolved": "https://registry.npmjs.org/lead/-/lead-4.0.0.tgz", 5779 | "integrity": "sha512-DpMa59o5uGUWWjruMp71e6knmwKU3jRBBn1kjuLWN9EeIOxNeSAwvHf03WIl8g/ZMR2oSQC9ej3yeLBwdDc/pg==", 5780 | "dev": true, 5781 | "engines": { 5782 | "node": ">=10.13.0" 5783 | } 5784 | }, 5785 | "node_modules/levn": { 5786 | "version": "0.4.1", 5787 | "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", 5788 | "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", 5789 | "dev": true, 5790 | "dependencies": { 5791 | "prelude-ls": "^1.2.1", 5792 | "type-check": "~0.4.0" 5793 | }, 5794 | "engines": { 5795 | "node": ">= 0.8.0" 5796 | } 5797 | }, 5798 | "node_modules/lilconfig": { 5799 | "version": "3.1.1", 5800 | "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.1.tgz", 5801 | "integrity": "sha512-O18pf7nyvHTckunPWCV1XUNXU1piu01y2b7ATJ0ppkUkk8ocqVWBrYjJBCwHDjD/ZWcfyrA0P4gKhzWGi5EINQ==", 5802 | "dev": true, 5803 | "engines": { 5804 | "node": ">=14" 5805 | }, 5806 | "funding": { 5807 | "url": "https://github.com/sponsors/antonk52" 5808 | } 5809 | }, 5810 | "node_modules/lines-and-columns": { 5811 | "version": "1.2.4", 5812 | "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", 5813 | "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", 5814 | "dev": true 5815 | }, 5816 | "node_modules/listr2": { 5817 | "version": "3.14.0", 5818 | "resolved": "https://registry.npmjs.org/listr2/-/listr2-3.14.0.tgz", 5819 | "integrity": "sha512-TyWI8G99GX9GjE54cJ+RrNMcIFBfwMPxc3XTFiAYGN4s10hWROGtOg7+O6u6LE3mNkyld7RSLE6nrKBvTfcs3g==", 5820 | "dev": true, 5821 | "dependencies": { 5822 | "cli-truncate": "^2.1.0", 5823 | "colorette": "^2.0.16", 5824 | "log-update": "^4.0.0", 5825 | "p-map": "^4.0.0", 5826 | "rfdc": "^1.3.0", 5827 | "rxjs": "^7.5.1", 5828 | "through": "^2.3.8", 5829 | "wrap-ansi": "^7.0.0" 5830 | }, 5831 | "engines": { 5832 | "node": ">=10.0.0" 5833 | }, 5834 | "peerDependencies": { 5835 | "enquirer": ">= 2.3.0 < 3" 5836 | }, 5837 | "peerDependenciesMeta": { 5838 | "enquirer": { 5839 | "optional": true 5840 | } 5841 | } 5842 | }, 5843 | "node_modules/listr2/node_modules/emoji-regex": { 5844 | "version": "8.0.0", 5845 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", 5846 | "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", 5847 | "dev": true 5848 | }, 5849 | "node_modules/listr2/node_modules/string-width": { 5850 | "version": "4.2.3", 5851 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", 5852 | "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", 5853 | "dev": true, 5854 | "dependencies": { 5855 | "emoji-regex": "^8.0.0", 5856 | "is-fullwidth-code-point": "^3.0.0", 5857 | "strip-ansi": "^6.0.1" 5858 | }, 5859 | "engines": { 5860 | "node": ">=8" 5861 | } 5862 | }, 5863 | "node_modules/listr2/node_modules/wrap-ansi": { 5864 | "version": "7.0.0", 5865 | "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", 5866 | "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", 5867 | "dev": true, 5868 | "dependencies": { 5869 | "ansi-styles": "^4.0.0", 5870 | "string-width": "^4.1.0", 5871 | "strip-ansi": "^6.0.0" 5872 | }, 5873 | "engines": { 5874 | "node": ">=10" 5875 | }, 5876 | "funding": { 5877 | "url": "https://github.com/chalk/wrap-ansi?sponsor=1" 5878 | } 5879 | }, 5880 | "node_modules/local-pkg": { 5881 | "version": "0.5.0", 5882 | "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.5.0.tgz", 5883 | "integrity": "sha512-ok6z3qlYyCDS4ZEU27HaU6x/xZa9Whf8jD4ptH5UZTQYZVYeb9bnZ3ojVhiJNLiXK1Hfc0GNbLXcmZ5plLDDBg==", 5884 | "dev": true, 5885 | "dependencies": { 5886 | "mlly": "^1.4.2", 5887 | "pkg-types": "^1.0.3" 5888 | }, 5889 | "engines": { 5890 | "node": ">=14" 5891 | }, 5892 | "funding": { 5893 | "url": "https://github.com/sponsors/antfu" 5894 | } 5895 | }, 5896 | "node_modules/locate-character": { 5897 | "version": "3.0.0", 5898 | "resolved": "https://registry.npmjs.org/locate-character/-/locate-character-3.0.0.tgz", 5899 | "integrity": "sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==" 5900 | }, 5901 | "node_modules/locate-path": { 5902 | "version": "6.0.0", 5903 | "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", 5904 | "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", 5905 | "dev": true, 5906 | "dependencies": { 5907 | "p-locate": "^5.0.0" 5908 | }, 5909 | "engines": { 5910 | "node": ">=10" 5911 | }, 5912 | "funding": { 5913 | "url": "https://github.com/sponsors/sindresorhus" 5914 | } 5915 | }, 5916 | "node_modules/lodash": { 5917 | "version": "4.17.21", 5918 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", 5919 | "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", 5920 | "dev": true 5921 | }, 5922 | "node_modules/lodash-es": { 5923 | "version": "4.17.21", 5924 | "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", 5925 | "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==" 5926 | }, 5927 | "node_modules/lodash.castarray": { 5928 | "version": "4.4.0", 5929 | "resolved": "https://registry.npmjs.org/lodash.castarray/-/lodash.castarray-4.4.0.tgz", 5930 | "integrity": "sha512-aVx8ztPv7/2ULbArGJ2Y42bG1mEQ5mGjpdvrbJcJFU3TbYybe+QlLS4pst9zV52ymy2in1KpFPiZnAOATxD4+Q==", 5931 | "dev": true 5932 | }, 5933 | "node_modules/lodash.isplainobject": { 5934 | "version": "4.0.6", 5935 | "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", 5936 | "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", 5937 | "dev": true 5938 | }, 5939 | "node_modules/lodash.merge": { 5940 | "version": "4.6.2", 5941 | "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", 5942 | "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", 5943 | "dev": true 5944 | }, 5945 | "node_modules/lodash.once": { 5946 | "version": "4.1.1", 5947 | "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", 5948 | "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", 5949 | "dev": true 5950 | }, 5951 | "node_modules/log-symbols": { 5952 | "version": "4.1.0", 5953 | "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", 5954 | "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", 5955 | "dev": true, 5956 | "dependencies": { 5957 | "chalk": "^4.1.0", 5958 | "is-unicode-supported": "^0.1.0" 5959 | }, 5960 | "engines": { 5961 | "node": ">=10" 5962 | }, 5963 | "funding": { 5964 | "url": "https://github.com/sponsors/sindresorhus" 5965 | } 5966 | }, 5967 | "node_modules/log-update": { 5968 | "version": "4.0.0", 5969 | "resolved": "https://registry.npmjs.org/log-update/-/log-update-4.0.0.tgz", 5970 | "integrity": "sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg==", 5971 | "dev": true, 5972 | "dependencies": { 5973 | "ansi-escapes": "^4.3.0", 5974 | "cli-cursor": "^3.1.0", 5975 | "slice-ansi": "^4.0.0", 5976 | "wrap-ansi": "^6.2.0" 5977 | }, 5978 | "engines": { 5979 | "node": ">=10" 5980 | }, 5981 | "funding": { 5982 | "url": "https://github.com/sponsors/sindresorhus" 5983 | } 5984 | }, 5985 | "node_modules/log-update/node_modules/emoji-regex": { 5986 | "version": "8.0.0", 5987 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", 5988 | "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", 5989 | "dev": true 5990 | }, 5991 | "node_modules/log-update/node_modules/slice-ansi": { 5992 | "version": "4.0.0", 5993 | "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-4.0.0.tgz", 5994 | "integrity": "sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ==", 5995 | "dev": true, 5996 | "dependencies": { 5997 | "ansi-styles": "^4.0.0", 5998 | "astral-regex": "^2.0.0", 5999 | "is-fullwidth-code-point": "^3.0.0" 6000 | }, 6001 | "engines": { 6002 | "node": ">=10" 6003 | }, 6004 | "funding": { 6005 | "url": "https://github.com/chalk/slice-ansi?sponsor=1" 6006 | } 6007 | }, 6008 | "node_modules/log-update/node_modules/string-width": { 6009 | "version": "4.2.3", 6010 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", 6011 | "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", 6012 | "dev": true, 6013 | "dependencies": { 6014 | "emoji-regex": "^8.0.0", 6015 | "is-fullwidth-code-point": "^3.0.0", 6016 | "strip-ansi": "^6.0.1" 6017 | }, 6018 | "engines": { 6019 | "node": ">=8" 6020 | } 6021 | }, 6022 | "node_modules/log-update/node_modules/wrap-ansi": { 6023 | "version": "6.2.0", 6024 | "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", 6025 | "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", 6026 | "dev": true, 6027 | "dependencies": { 6028 | "ansi-styles": "^4.0.0", 6029 | "string-width": "^4.1.0", 6030 | "strip-ansi": "^6.0.0" 6031 | }, 6032 | "engines": { 6033 | "node": ">=8" 6034 | } 6035 | }, 6036 | "node_modules/loupe": { 6037 | "version": "2.3.7", 6038 | "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.7.tgz", 6039 | "integrity": "sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==", 6040 | "dev": true, 6041 | "dependencies": { 6042 | "get-func-name": "^2.0.1" 6043 | } 6044 | }, 6045 | "node_modules/lru-cache": { 6046 | "version": "6.0.0", 6047 | "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", 6048 | "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", 6049 | "dev": true, 6050 | "dependencies": { 6051 | "yallist": "^4.0.0" 6052 | }, 6053 | "engines": { 6054 | "node": ">=10" 6055 | } 6056 | }, 6057 | "node_modules/magic-string": { 6058 | "version": "0.30.8", 6059 | "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.8.tgz", 6060 | "integrity": "sha512-ISQTe55T2ao7XtlAStud6qwYPZjE4GK1S/BeVPus4jrq6JuOnQ00YKQC581RWhR122W7msZV263KzVeLoqidyQ==", 6061 | "dependencies": { 6062 | "@jridgewell/sourcemap-codec": "^1.4.15" 6063 | }, 6064 | "engines": { 6065 | "node": ">=12" 6066 | } 6067 | }, 6068 | "node_modules/marked": { 6069 | "version": "9.1.6", 6070 | "resolved": "https://registry.npmjs.org/marked/-/marked-9.1.6.tgz", 6071 | "integrity": "sha512-jcByLnIFkd5gSXZmjNvS1TlmRhCXZjIzHYlaGkPlLIekG55JDR2Z4va9tZwCiP+/RDERiNhMOFu01xd6O5ct1Q==", 6072 | "bin": { 6073 | "marked": "bin/marked.js" 6074 | }, 6075 | "engines": { 6076 | "node": ">= 16" 6077 | } 6078 | }, 6079 | "node_modules/matcher-collection": { 6080 | "version": "2.0.1", 6081 | "resolved": "https://registry.npmjs.org/matcher-collection/-/matcher-collection-2.0.1.tgz", 6082 | "integrity": "sha512-daE62nS2ZQsDg9raM0IlZzLmI2u+7ZapXBwdoeBUKAYERPDDIc0qNqA8E0Rp2D+gspKR7BgIFP52GeujaGXWeQ==", 6083 | "dev": true, 6084 | "dependencies": { 6085 | "@types/minimatch": "^3.0.3", 6086 | "minimatch": "^3.0.2" 6087 | }, 6088 | "engines": { 6089 | "node": "6.* || 8.* || >= 10.*" 6090 | } 6091 | }, 6092 | "node_modules/matcher-collection/node_modules/brace-expansion": { 6093 | "version": "1.1.11", 6094 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 6095 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 6096 | "dev": true, 6097 | "dependencies": { 6098 | "balanced-match": "^1.0.0", 6099 | "concat-map": "0.0.1" 6100 | } 6101 | }, 6102 | "node_modules/matcher-collection/node_modules/minimatch": { 6103 | "version": "3.1.2", 6104 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", 6105 | "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", 6106 | "dev": true, 6107 | "dependencies": { 6108 | "brace-expansion": "^1.1.7" 6109 | }, 6110 | "engines": { 6111 | "node": "*" 6112 | } 6113 | }, 6114 | "node_modules/mdast-util-from-markdown": { 6115 | "version": "1.3.1", 6116 | "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-1.3.1.tgz", 6117 | "integrity": "sha512-4xTO/M8c82qBcnQc1tgpNtubGUW/Y1tBQ1B0i5CtSoelOLKFYlElIr3bvgREYYO5iRqbMY1YuqZng0GVOI8Qww==", 6118 | "dependencies": { 6119 | "@types/mdast": "^3.0.0", 6120 | "@types/unist": "^2.0.0", 6121 | "decode-named-character-reference": "^1.0.0", 6122 | "mdast-util-to-string": "^3.1.0", 6123 | "micromark": "^3.0.0", 6124 | "micromark-util-decode-numeric-character-reference": "^1.0.0", 6125 | "micromark-util-decode-string": "^1.0.0", 6126 | "micromark-util-normalize-identifier": "^1.0.0", 6127 | "micromark-util-symbol": "^1.0.0", 6128 | "micromark-util-types": "^1.0.0", 6129 | "unist-util-stringify-position": "^3.0.0", 6130 | "uvu": "^0.5.0" 6131 | }, 6132 | "funding": { 6133 | "type": "opencollective", 6134 | "url": "https://opencollective.com/unified" 6135 | } 6136 | }, 6137 | "node_modules/mdast-util-to-string": { 6138 | "version": "3.2.0", 6139 | "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-3.2.0.tgz", 6140 | "integrity": "sha512-V4Zn/ncyN1QNSqSBxTrMOLpjr+IKdHl2v3KVLoWmDPscP4r9GcCi71gjgvUV1SFSKh92AjAG4peFuBl2/YgCJg==", 6141 | "dependencies": { 6142 | "@types/mdast": "^3.0.0" 6143 | }, 6144 | "funding": { 6145 | "type": "opencollective", 6146 | "url": "https://opencollective.com/unified" 6147 | } 6148 | }, 6149 | "node_modules/mdn-data": { 6150 | "version": "2.0.30", 6151 | "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz", 6152 | "integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==" 6153 | }, 6154 | "node_modules/merge-stream": { 6155 | "version": "2.0.0", 6156 | "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", 6157 | "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", 6158 | "dev": true 6159 | }, 6160 | "node_modules/merge2": { 6161 | "version": "1.4.1", 6162 | "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", 6163 | "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", 6164 | "dev": true, 6165 | "engines": { 6166 | "node": ">= 8" 6167 | } 6168 | }, 6169 | "node_modules/mermaid": { 6170 | "version": "10.9.1", 6171 | "resolved": "https://registry.npmjs.org/mermaid/-/mermaid-10.9.1.tgz", 6172 | "integrity": "sha512-Mx45Obds5W1UkW1nv/7dHRsbfMM1aOKA2+Pxs/IGHNonygDHwmng8xTHyS9z4KWVi0rbko8gjiBmuwwXQ7tiNA==", 6173 | "dependencies": { 6174 | "@braintree/sanitize-url": "^6.0.1", 6175 | "@types/d3-scale": "^4.0.3", 6176 | "@types/d3-scale-chromatic": "^3.0.0", 6177 | "cytoscape": "^3.28.1", 6178 | "cytoscape-cose-bilkent": "^4.1.0", 6179 | "d3": "^7.4.0", 6180 | "d3-sankey": "^0.12.3", 6181 | "dagre-d3-es": "7.0.10", 6182 | "dayjs": "^1.11.7", 6183 | "dompurify": "^3.0.5", 6184 | "elkjs": "^0.9.0", 6185 | "katex": "^0.16.9", 6186 | "khroma": "^2.0.0", 6187 | "lodash-es": "^4.17.21", 6188 | "mdast-util-from-markdown": "^1.3.0", 6189 | "non-layered-tidy-tree-layout": "^2.0.2", 6190 | "stylis": "^4.1.3", 6191 | "ts-dedent": "^2.2.0", 6192 | "uuid": "^9.0.0", 6193 | "web-worker": "^1.2.0" 6194 | } 6195 | }, 6196 | "node_modules/micromark": { 6197 | "version": "3.2.0", 6198 | "resolved": "https://registry.npmjs.org/micromark/-/micromark-3.2.0.tgz", 6199 | "integrity": "sha512-uD66tJj54JLYq0De10AhWycZWGQNUvDI55xPgk2sQM5kn1JYlhbCMTtEeT27+vAhW2FBQxLlOmS3pmA7/2z4aA==", 6200 | "funding": [ 6201 | { 6202 | "type": "GitHub Sponsors", 6203 | "url": "https://github.com/sponsors/unifiedjs" 6204 | }, 6205 | { 6206 | "type": "OpenCollective", 6207 | "url": "https://opencollective.com/unified" 6208 | } 6209 | ], 6210 | "dependencies": { 6211 | "@types/debug": "^4.0.0", 6212 | "debug": "^4.0.0", 6213 | "decode-named-character-reference": "^1.0.0", 6214 | "micromark-core-commonmark": "^1.0.1", 6215 | "micromark-factory-space": "^1.0.0", 6216 | "micromark-util-character": "^1.0.0", 6217 | "micromark-util-chunked": "^1.0.0", 6218 | "micromark-util-combine-extensions": "^1.0.0", 6219 | "micromark-util-decode-numeric-character-reference": "^1.0.0", 6220 | "micromark-util-encode": "^1.0.0", 6221 | "micromark-util-normalize-identifier": "^1.0.0", 6222 | "micromark-util-resolve-all": "^1.0.0", 6223 | "micromark-util-sanitize-uri": "^1.0.0", 6224 | "micromark-util-subtokenize": "^1.0.0", 6225 | "micromark-util-symbol": "^1.0.0", 6226 | "micromark-util-types": "^1.0.1", 6227 | "uvu": "^0.5.0" 6228 | } 6229 | }, 6230 | "node_modules/micromark-core-commonmark": { 6231 | "version": "1.1.0", 6232 | "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-1.1.0.tgz", 6233 | "integrity": "sha512-BgHO1aRbolh2hcrzL2d1La37V0Aoz73ymF8rAcKnohLy93titmv62E0gP8Hrx9PKcKrqCZ1BbLGbP3bEhoXYlw==", 6234 | "funding": [ 6235 | { 6236 | "type": "GitHub Sponsors", 6237 | "url": "https://github.com/sponsors/unifiedjs" 6238 | }, 6239 | { 6240 | "type": "OpenCollective", 6241 | "url": "https://opencollective.com/unified" 6242 | } 6243 | ], 6244 | "dependencies": { 6245 | "decode-named-character-reference": "^1.0.0", 6246 | "micromark-factory-destination": "^1.0.0", 6247 | "micromark-factory-label": "^1.0.0", 6248 | "micromark-factory-space": "^1.0.0", 6249 | "micromark-factory-title": "^1.0.0", 6250 | "micromark-factory-whitespace": "^1.0.0", 6251 | "micromark-util-character": "^1.0.0", 6252 | "micromark-util-chunked": "^1.0.0", 6253 | "micromark-util-classify-character": "^1.0.0", 6254 | "micromark-util-html-tag-name": "^1.0.0", 6255 | "micromark-util-normalize-identifier": "^1.0.0", 6256 | "micromark-util-resolve-all": "^1.0.0", 6257 | "micromark-util-subtokenize": "^1.0.0", 6258 | "micromark-util-symbol": "^1.0.0", 6259 | "micromark-util-types": "^1.0.1", 6260 | "uvu": "^0.5.0" 6261 | } 6262 | }, 6263 | "node_modules/micromark-factory-destination": { 6264 | "version": "1.1.0", 6265 | "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-1.1.0.tgz", 6266 | "integrity": "sha512-XaNDROBgx9SgSChd69pjiGKbV+nfHGDPVYFs5dOoDd7ZnMAE+Cuu91BCpsY8RT2NP9vo/B8pds2VQNCLiu0zhg==", 6267 | "funding": [ 6268 | { 6269 | "type": "GitHub Sponsors", 6270 | "url": "https://github.com/sponsors/unifiedjs" 6271 | }, 6272 | { 6273 | "type": "OpenCollective", 6274 | "url": "https://opencollective.com/unified" 6275 | } 6276 | ], 6277 | "dependencies": { 6278 | "micromark-util-character": "^1.0.0", 6279 | "micromark-util-symbol": "^1.0.0", 6280 | "micromark-util-types": "^1.0.0" 6281 | } 6282 | }, 6283 | "node_modules/micromark-factory-label": { 6284 | "version": "1.1.0", 6285 | "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-1.1.0.tgz", 6286 | "integrity": "sha512-OLtyez4vZo/1NjxGhcpDSbHQ+m0IIGnT8BoPamh+7jVlzLJBH98zzuCoUeMxvM6WsNeh8wx8cKvqLiPHEACn0w==", 6287 | "funding": [ 6288 | { 6289 | "type": "GitHub Sponsors", 6290 | "url": "https://github.com/sponsors/unifiedjs" 6291 | }, 6292 | { 6293 | "type": "OpenCollective", 6294 | "url": "https://opencollective.com/unified" 6295 | } 6296 | ], 6297 | "dependencies": { 6298 | "micromark-util-character": "^1.0.0", 6299 | "micromark-util-symbol": "^1.0.0", 6300 | "micromark-util-types": "^1.0.0", 6301 | "uvu": "^0.5.0" 6302 | } 6303 | }, 6304 | "node_modules/micromark-factory-space": { 6305 | "version": "1.1.0", 6306 | "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-1.1.0.tgz", 6307 | "integrity": "sha512-cRzEj7c0OL4Mw2v6nwzttyOZe8XY/Z8G0rzmWQZTBi/jjwyw/U4uqKtUORXQrR5bAZZnbTI/feRV/R7hc4jQYQ==", 6308 | "funding": [ 6309 | { 6310 | "type": "GitHub Sponsors", 6311 | "url": "https://github.com/sponsors/unifiedjs" 6312 | }, 6313 | { 6314 | "type": "OpenCollective", 6315 | "url": "https://opencollective.com/unified" 6316 | } 6317 | ], 6318 | "dependencies": { 6319 | "micromark-util-character": "^1.0.0", 6320 | "micromark-util-types": "^1.0.0" 6321 | } 6322 | }, 6323 | "node_modules/micromark-factory-title": { 6324 | "version": "1.1.0", 6325 | "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-1.1.0.tgz", 6326 | "integrity": "sha512-J7n9R3vMmgjDOCY8NPw55jiyaQnH5kBdV2/UXCtZIpnHH3P6nHUKaH7XXEYuWwx/xUJcawa8plLBEjMPU24HzQ==", 6327 | "funding": [ 6328 | { 6329 | "type": "GitHub Sponsors", 6330 | "url": "https://github.com/sponsors/unifiedjs" 6331 | }, 6332 | { 6333 | "type": "OpenCollective", 6334 | "url": "https://opencollective.com/unified" 6335 | } 6336 | ], 6337 | "dependencies": { 6338 | "micromark-factory-space": "^1.0.0", 6339 | "micromark-util-character": "^1.0.0", 6340 | "micromark-util-symbol": "^1.0.0", 6341 | "micromark-util-types": "^1.0.0" 6342 | } 6343 | }, 6344 | "node_modules/micromark-factory-whitespace": { 6345 | "version": "1.1.0", 6346 | "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-1.1.0.tgz", 6347 | "integrity": "sha512-v2WlmiymVSp5oMg+1Q0N1Lxmt6pMhIHD457whWM7/GUlEks1hI9xj5w3zbc4uuMKXGisksZk8DzP2UyGbGqNsQ==", 6348 | "funding": [ 6349 | { 6350 | "type": "GitHub Sponsors", 6351 | "url": "https://github.com/sponsors/unifiedjs" 6352 | }, 6353 | { 6354 | "type": "OpenCollective", 6355 | "url": "https://opencollective.com/unified" 6356 | } 6357 | ], 6358 | "dependencies": { 6359 | "micromark-factory-space": "^1.0.0", 6360 | "micromark-util-character": "^1.0.0", 6361 | "micromark-util-symbol": "^1.0.0", 6362 | "micromark-util-types": "^1.0.0" 6363 | } 6364 | }, 6365 | "node_modules/micromark-util-character": { 6366 | "version": "1.2.0", 6367 | "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-1.2.0.tgz", 6368 | "integrity": "sha512-lXraTwcX3yH/vMDaFWCQJP1uIszLVebzUa3ZHdrgxr7KEU/9mL4mVgCpGbyhvNLNlauROiNUq7WN5u7ndbY6xg==", 6369 | "funding": [ 6370 | { 6371 | "type": "GitHub Sponsors", 6372 | "url": "https://github.com/sponsors/unifiedjs" 6373 | }, 6374 | { 6375 | "type": "OpenCollective", 6376 | "url": "https://opencollective.com/unified" 6377 | } 6378 | ], 6379 | "dependencies": { 6380 | "micromark-util-symbol": "^1.0.0", 6381 | "micromark-util-types": "^1.0.0" 6382 | } 6383 | }, 6384 | "node_modules/micromark-util-chunked": { 6385 | "version": "1.1.0", 6386 | "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-1.1.0.tgz", 6387 | "integrity": "sha512-Ye01HXpkZPNcV6FiyoW2fGZDUw4Yc7vT0E9Sad83+bEDiCJ1uXu0S3mr8WLpsz3HaG3x2q0HM6CTuPdcZcluFQ==", 6388 | "funding": [ 6389 | { 6390 | "type": "GitHub Sponsors", 6391 | "url": "https://github.com/sponsors/unifiedjs" 6392 | }, 6393 | { 6394 | "type": "OpenCollective", 6395 | "url": "https://opencollective.com/unified" 6396 | } 6397 | ], 6398 | "dependencies": { 6399 | "micromark-util-symbol": "^1.0.0" 6400 | } 6401 | }, 6402 | "node_modules/micromark-util-classify-character": { 6403 | "version": "1.1.0", 6404 | "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-1.1.0.tgz", 6405 | "integrity": "sha512-SL0wLxtKSnklKSUplok1WQFoGhUdWYKggKUiqhX+Swala+BtptGCu5iPRc+xvzJ4PXE/hwM3FNXsfEVgoZsWbw==", 6406 | "funding": [ 6407 | { 6408 | "type": "GitHub Sponsors", 6409 | "url": "https://github.com/sponsors/unifiedjs" 6410 | }, 6411 | { 6412 | "type": "OpenCollective", 6413 | "url": "https://opencollective.com/unified" 6414 | } 6415 | ], 6416 | "dependencies": { 6417 | "micromark-util-character": "^1.0.0", 6418 | "micromark-util-symbol": "^1.0.0", 6419 | "micromark-util-types": "^1.0.0" 6420 | } 6421 | }, 6422 | "node_modules/micromark-util-combine-extensions": { 6423 | "version": "1.1.0", 6424 | "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-1.1.0.tgz", 6425 | "integrity": "sha512-Q20sp4mfNf9yEqDL50WwuWZHUrCO4fEyeDCnMGmG5Pr0Cz15Uo7KBs6jq+dq0EgX4DPwwrh9m0X+zPV1ypFvUA==", 6426 | "funding": [ 6427 | { 6428 | "type": "GitHub Sponsors", 6429 | "url": "https://github.com/sponsors/unifiedjs" 6430 | }, 6431 | { 6432 | "type": "OpenCollective", 6433 | "url": "https://opencollective.com/unified" 6434 | } 6435 | ], 6436 | "dependencies": { 6437 | "micromark-util-chunked": "^1.0.0", 6438 | "micromark-util-types": "^1.0.0" 6439 | } 6440 | }, 6441 | "node_modules/micromark-util-decode-numeric-character-reference": { 6442 | "version": "1.1.0", 6443 | "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-1.1.0.tgz", 6444 | "integrity": "sha512-m9V0ExGv0jB1OT21mrWcuf4QhP46pH1KkfWy9ZEezqHKAxkj4mPCy3nIH1rkbdMlChLHX531eOrymlwyZIf2iw==", 6445 | "funding": [ 6446 | { 6447 | "type": "GitHub Sponsors", 6448 | "url": "https://github.com/sponsors/unifiedjs" 6449 | }, 6450 | { 6451 | "type": "OpenCollective", 6452 | "url": "https://opencollective.com/unified" 6453 | } 6454 | ], 6455 | "dependencies": { 6456 | "micromark-util-symbol": "^1.0.0" 6457 | } 6458 | }, 6459 | "node_modules/micromark-util-decode-string": { 6460 | "version": "1.1.0", 6461 | "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-1.1.0.tgz", 6462 | "integrity": "sha512-YphLGCK8gM1tG1bd54azwyrQRjCFcmgj2S2GoJDNnh4vYtnL38JS8M4gpxzOPNyHdNEpheyWXCTnnTDY3N+NVQ==", 6463 | "funding": [ 6464 | { 6465 | "type": "GitHub Sponsors", 6466 | "url": "https://github.com/sponsors/unifiedjs" 6467 | }, 6468 | { 6469 | "type": "OpenCollective", 6470 | "url": "https://opencollective.com/unified" 6471 | } 6472 | ], 6473 | "dependencies": { 6474 | "decode-named-character-reference": "^1.0.0", 6475 | "micromark-util-character": "^1.0.0", 6476 | "micromark-util-decode-numeric-character-reference": "^1.0.0", 6477 | "micromark-util-symbol": "^1.0.0" 6478 | } 6479 | }, 6480 | "node_modules/micromark-util-encode": { 6481 | "version": "1.1.0", 6482 | "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-1.1.0.tgz", 6483 | "integrity": "sha512-EuEzTWSTAj9PA5GOAs992GzNh2dGQO52UvAbtSOMvXTxv3Criqb6IOzJUBCmEqrrXSblJIJBbFFv6zPxpreiJw==", 6484 | "funding": [ 6485 | { 6486 | "type": "GitHub Sponsors", 6487 | "url": "https://github.com/sponsors/unifiedjs" 6488 | }, 6489 | { 6490 | "type": "OpenCollective", 6491 | "url": "https://opencollective.com/unified" 6492 | } 6493 | ] 6494 | }, 6495 | "node_modules/micromark-util-html-tag-name": { 6496 | "version": "1.2.0", 6497 | "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-1.2.0.tgz", 6498 | "integrity": "sha512-VTQzcuQgFUD7yYztuQFKXT49KghjtETQ+Wv/zUjGSGBioZnkA4P1XXZPT1FHeJA6RwRXSF47yvJ1tsJdoxwO+Q==", 6499 | "funding": [ 6500 | { 6501 | "type": "GitHub Sponsors", 6502 | "url": "https://github.com/sponsors/unifiedjs" 6503 | }, 6504 | { 6505 | "type": "OpenCollective", 6506 | "url": "https://opencollective.com/unified" 6507 | } 6508 | ] 6509 | }, 6510 | "node_modules/micromark-util-normalize-identifier": { 6511 | "version": "1.1.0", 6512 | "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-1.1.0.tgz", 6513 | "integrity": "sha512-N+w5vhqrBihhjdpM8+5Xsxy71QWqGn7HYNUvch71iV2PM7+E3uWGox1Qp90loa1ephtCxG2ftRV/Conitc6P2Q==", 6514 | "funding": [ 6515 | { 6516 | "type": "GitHub Sponsors", 6517 | "url": "https://github.com/sponsors/unifiedjs" 6518 | }, 6519 | { 6520 | "type": "OpenCollective", 6521 | "url": "https://opencollective.com/unified" 6522 | } 6523 | ], 6524 | "dependencies": { 6525 | "micromark-util-symbol": "^1.0.0" 6526 | } 6527 | }, 6528 | "node_modules/micromark-util-resolve-all": { 6529 | "version": "1.1.0", 6530 | "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-1.1.0.tgz", 6531 | "integrity": "sha512-b/G6BTMSg+bX+xVCshPTPyAu2tmA0E4X98NSR7eIbeC6ycCqCeE7wjfDIgzEbkzdEVJXRtOG4FbEm/uGbCRouA==", 6532 | "funding": [ 6533 | { 6534 | "type": "GitHub Sponsors", 6535 | "url": "https://github.com/sponsors/unifiedjs" 6536 | }, 6537 | { 6538 | "type": "OpenCollective", 6539 | "url": "https://opencollective.com/unified" 6540 | } 6541 | ], 6542 | "dependencies": { 6543 | "micromark-util-types": "^1.0.0" 6544 | } 6545 | }, 6546 | "node_modules/micromark-util-sanitize-uri": { 6547 | "version": "1.2.0", 6548 | "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-1.2.0.tgz", 6549 | "integrity": "sha512-QO4GXv0XZfWey4pYFndLUKEAktKkG5kZTdUNaTAkzbuJxn2tNBOr+QtxR2XpWaMhbImT2dPzyLrPXLlPhph34A==", 6550 | "funding": [ 6551 | { 6552 | "type": "GitHub Sponsors", 6553 | "url": "https://github.com/sponsors/unifiedjs" 6554 | }, 6555 | { 6556 | "type": "OpenCollective", 6557 | "url": "https://opencollective.com/unified" 6558 | } 6559 | ], 6560 | "dependencies": { 6561 | "micromark-util-character": "^1.0.0", 6562 | "micromark-util-encode": "^1.0.0", 6563 | "micromark-util-symbol": "^1.0.0" 6564 | } 6565 | }, 6566 | "node_modules/micromark-util-subtokenize": { 6567 | "version": "1.1.0", 6568 | "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-1.1.0.tgz", 6569 | "integrity": "sha512-kUQHyzRoxvZO2PuLzMt2P/dwVsTiivCK8icYTeR+3WgbuPqfHgPPy7nFKbeqRivBvn/3N3GBiNC+JRTMSxEC7A==", 6570 | "funding": [ 6571 | { 6572 | "type": "GitHub Sponsors", 6573 | "url": "https://github.com/sponsors/unifiedjs" 6574 | }, 6575 | { 6576 | "type": "OpenCollective", 6577 | "url": "https://opencollective.com/unified" 6578 | } 6579 | ], 6580 | "dependencies": { 6581 | "micromark-util-chunked": "^1.0.0", 6582 | "micromark-util-symbol": "^1.0.0", 6583 | "micromark-util-types": "^1.0.0", 6584 | "uvu": "^0.5.0" 6585 | } 6586 | }, 6587 | "node_modules/micromark-util-symbol": { 6588 | "version": "1.1.0", 6589 | "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-1.1.0.tgz", 6590 | "integrity": "sha512-uEjpEYY6KMs1g7QfJ2eX1SQEV+ZT4rUD3UcF6l57acZvLNK7PBZL+ty82Z1qhK1/yXIY4bdx04FKMgR0g4IAag==", 6591 | "funding": [ 6592 | { 6593 | "type": "GitHub Sponsors", 6594 | "url": "https://github.com/sponsors/unifiedjs" 6595 | }, 6596 | { 6597 | "type": "OpenCollective", 6598 | "url": "https://opencollective.com/unified" 6599 | } 6600 | ] 6601 | }, 6602 | "node_modules/micromark-util-types": { 6603 | "version": "1.1.0", 6604 | "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-1.1.0.tgz", 6605 | "integrity": "sha512-ukRBgie8TIAcacscVHSiddHjO4k/q3pnedmzMQ4iwDcK0FtFCohKOlFbaOL/mPgfnPsL3C1ZyxJa4sbWrBl3jg==", 6606 | "funding": [ 6607 | { 6608 | "type": "GitHub Sponsors", 6609 | "url": "https://github.com/sponsors/unifiedjs" 6610 | }, 6611 | { 6612 | "type": "OpenCollective", 6613 | "url": "https://opencollective.com/unified" 6614 | } 6615 | ] 6616 | }, 6617 | "node_modules/micromatch": { 6618 | "version": "4.0.5", 6619 | "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", 6620 | "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", 6621 | "dev": true, 6622 | "dependencies": { 6623 | "braces": "^3.0.2", 6624 | "picomatch": "^2.3.1" 6625 | }, 6626 | "engines": { 6627 | "node": ">=8.6" 6628 | } 6629 | }, 6630 | "node_modules/mime-db": { 6631 | "version": "1.52.0", 6632 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", 6633 | "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", 6634 | "dev": true, 6635 | "engines": { 6636 | "node": ">= 0.6" 6637 | } 6638 | }, 6639 | "node_modules/mime-types": { 6640 | "version": "2.1.35", 6641 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", 6642 | "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", 6643 | "dev": true, 6644 | "dependencies": { 6645 | "mime-db": "1.52.0" 6646 | }, 6647 | "engines": { 6648 | "node": ">= 0.6" 6649 | } 6650 | }, 6651 | "node_modules/mimic-fn": { 6652 | "version": "2.1.0", 6653 | "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", 6654 | "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", 6655 | "dev": true, 6656 | "engines": { 6657 | "node": ">=6" 6658 | } 6659 | }, 6660 | "node_modules/min-indent": { 6661 | "version": "1.0.1", 6662 | "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", 6663 | "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", 6664 | "dev": true, 6665 | "engines": { 6666 | "node": ">=4" 6667 | } 6668 | }, 6669 | "node_modules/minimatch": { 6670 | "version": "9.0.3", 6671 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", 6672 | "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", 6673 | "dev": true, 6674 | "dependencies": { 6675 | "brace-expansion": "^2.0.1" 6676 | }, 6677 | "engines": { 6678 | "node": ">=16 || 14 >=14.17" 6679 | }, 6680 | "funding": { 6681 | "url": "https://github.com/sponsors/isaacs" 6682 | } 6683 | }, 6684 | "node_modules/minimist": { 6685 | "version": "1.2.8", 6686 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", 6687 | "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", 6688 | "dev": true, 6689 | "funding": { 6690 | "url": "https://github.com/sponsors/ljharb" 6691 | } 6692 | }, 6693 | "node_modules/minipass": { 6694 | "version": "7.0.4", 6695 | "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", 6696 | "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", 6697 | "dev": true, 6698 | "engines": { 6699 | "node": ">=16 || 14 >=14.17" 6700 | } 6701 | }, 6702 | "node_modules/mkdirp": { 6703 | "version": "0.5.6", 6704 | "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", 6705 | "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", 6706 | "dev": true, 6707 | "dependencies": { 6708 | "minimist": "^1.2.6" 6709 | }, 6710 | "bin": { 6711 | "mkdirp": "bin/cmd.js" 6712 | } 6713 | }, 6714 | "node_modules/mktemp": { 6715 | "version": "0.4.0", 6716 | "resolved": "https://registry.npmjs.org/mktemp/-/mktemp-0.4.0.tgz", 6717 | "integrity": "sha512-IXnMcJ6ZyTuhRmJSjzvHSRhlVPiN9Jwc6e59V0bEJ0ba6OBeX2L0E+mRN1QseeOF4mM+F1Rit6Nh7o+rl2Yn/A==", 6718 | "dev": true, 6719 | "engines": { 6720 | "node": ">0.9" 6721 | } 6722 | }, 6723 | "node_modules/mlly": { 6724 | "version": "1.7.0", 6725 | "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.7.0.tgz", 6726 | "integrity": "sha512-U9SDaXGEREBYQgfejV97coK0UL1r+qnF2SyO9A3qcI8MzKnsIFKHNVEkrDyNncQTKQQumsasmeq84eNMdBfsNQ==", 6727 | "dev": true, 6728 | "dependencies": { 6729 | "acorn": "^8.11.3", 6730 | "pathe": "^1.1.2", 6731 | "pkg-types": "^1.1.0", 6732 | "ufo": "^1.5.3" 6733 | } 6734 | }, 6735 | "node_modules/mri": { 6736 | "version": "1.2.0", 6737 | "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", 6738 | "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", 6739 | "engines": { 6740 | "node": ">=4" 6741 | } 6742 | }, 6743 | "node_modules/mrmime": { 6744 | "version": "1.0.1", 6745 | "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-1.0.1.tgz", 6746 | "integrity": "sha512-hzzEagAgDyoU1Q6yg5uI+AorQgdvMCur3FcKf7NhMKWsaYg+RnbTyHRa/9IlLF9rf455MOCtcqqrQQ83pPP7Uw==", 6747 | "engines": { 6748 | "node": ">=10" 6749 | } 6750 | }, 6751 | "node_modules/ms": { 6752 | "version": "2.1.2", 6753 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", 6754 | "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" 6755 | }, 6756 | "node_modules/mz": { 6757 | "version": "2.7.0", 6758 | "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", 6759 | "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", 6760 | "dev": true, 6761 | "dependencies": { 6762 | "any-promise": "^1.0.0", 6763 | "object-assign": "^4.0.1", 6764 | "thenify-all": "^1.0.0" 6765 | } 6766 | }, 6767 | "node_modules/nanoid": { 6768 | "version": "5.0.6", 6769 | "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.0.6.tgz", 6770 | "integrity": "sha512-rRq0eMHoGZxlvaFOUdK1Ev83Bd1IgzzR+WJ3IbDJ7QOSdAxYjlurSPqFs9s4lJg29RT6nPwizFtJhQS6V5xgiA==", 6771 | "funding": [ 6772 | { 6773 | "type": "github", 6774 | "url": "https://github.com/sponsors/ai" 6775 | } 6776 | ], 6777 | "bin": { 6778 | "nanoid": "bin/nanoid.js" 6779 | }, 6780 | "engines": { 6781 | "node": "^18 || >=20" 6782 | } 6783 | }, 6784 | "node_modules/natural-compare": { 6785 | "version": "1.4.0", 6786 | "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", 6787 | "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", 6788 | "dev": true 6789 | }, 6790 | "node_modules/node-releases": { 6791 | "version": "2.0.14", 6792 | "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", 6793 | "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==", 6794 | "dev": true 6795 | }, 6796 | "node_modules/non-layered-tidy-tree-layout": { 6797 | "version": "2.0.2", 6798 | "resolved": "https://registry.npmjs.org/non-layered-tidy-tree-layout/-/non-layered-tidy-tree-layout-2.0.2.tgz", 6799 | "integrity": "sha512-gkXMxRzUH+PB0ax9dUN0yYF0S25BqeAYqhgMaLUFmpXLEk7Fcu8f4emJuOAY0V8kjDICxROIKsTAKsV/v355xw==" 6800 | }, 6801 | "node_modules/normalize-path": { 6802 | "version": "3.0.0", 6803 | "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", 6804 | "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", 6805 | "dev": true, 6806 | "engines": { 6807 | "node": ">=0.10.0" 6808 | } 6809 | }, 6810 | "node_modules/normalize-range": { 6811 | "version": "0.1.2", 6812 | "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", 6813 | "integrity": "sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==", 6814 | "dev": true, 6815 | "engines": { 6816 | "node": ">=0.10.0" 6817 | } 6818 | }, 6819 | "node_modules/now-and-later": { 6820 | "version": "3.0.0", 6821 | "resolved": "https://registry.npmjs.org/now-and-later/-/now-and-later-3.0.0.tgz", 6822 | "integrity": "sha512-pGO4pzSdaxhWTGkfSfHx3hVzJVslFPwBp2Myq9MYN/ChfJZF87ochMAXnvz6/58RJSf5ik2q9tXprBBrk2cpcg==", 6823 | "dev": true, 6824 | "dependencies": { 6825 | "once": "^1.4.0" 6826 | }, 6827 | "engines": { 6828 | "node": ">= 10.13.0" 6829 | } 6830 | }, 6831 | "node_modules/npm-run-path": { 6832 | "version": "4.0.1", 6833 | "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", 6834 | "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", 6835 | "dev": true, 6836 | "dependencies": { 6837 | "path-key": "^3.0.0" 6838 | }, 6839 | "engines": { 6840 | "node": ">=8" 6841 | } 6842 | }, 6843 | "node_modules/nth-check": { 6844 | "version": "2.1.1", 6845 | "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", 6846 | "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", 6847 | "dev": true, 6848 | "dependencies": { 6849 | "boolbase": "^1.0.0" 6850 | }, 6851 | "funding": { 6852 | "url": "https://github.com/fb55/nth-check?sponsor=1" 6853 | } 6854 | }, 6855 | "node_modules/object-assign": { 6856 | "version": "4.1.1", 6857 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", 6858 | "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", 6859 | "dev": true, 6860 | "engines": { 6861 | "node": ">=0.10.0" 6862 | } 6863 | }, 6864 | "node_modules/object-hash": { 6865 | "version": "3.0.0", 6866 | "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz", 6867 | "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==", 6868 | "dev": true, 6869 | "engines": { 6870 | "node": ">= 6" 6871 | } 6872 | }, 6873 | "node_modules/object-inspect": { 6874 | "version": "1.13.1", 6875 | "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", 6876 | "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", 6877 | "dev": true, 6878 | "funding": { 6879 | "url": "https://github.com/sponsors/ljharb" 6880 | } 6881 | }, 6882 | "node_modules/once": { 6883 | "version": "1.4.0", 6884 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 6885 | "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", 6886 | "dependencies": { 6887 | "wrappy": "1" 6888 | } 6889 | }, 6890 | "node_modules/onetime": { 6891 | "version": "5.1.2", 6892 | "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", 6893 | "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", 6894 | "dev": true, 6895 | "dependencies": { 6896 | "mimic-fn": "^2.1.0" 6897 | }, 6898 | "engines": { 6899 | "node": ">=6" 6900 | }, 6901 | "funding": { 6902 | "url": "https://github.com/sponsors/sindresorhus" 6903 | } 6904 | }, 6905 | "node_modules/optionator": { 6906 | "version": "0.9.3", 6907 | "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.3.tgz", 6908 | "integrity": "sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==", 6909 | "dev": true, 6910 | "dependencies": { 6911 | "@aashutoshrathi/word-wrap": "^1.2.3", 6912 | "deep-is": "^0.1.3", 6913 | "fast-levenshtein": "^2.0.6", 6914 | "levn": "^0.4.1", 6915 | "prelude-ls": "^1.2.1", 6916 | "type-check": "^0.4.0" 6917 | }, 6918 | "engines": { 6919 | "node": ">= 0.8.0" 6920 | } 6921 | }, 6922 | "node_modules/ospath": { 6923 | "version": "1.2.2", 6924 | "resolved": "https://registry.npmjs.org/ospath/-/ospath-1.2.2.tgz", 6925 | "integrity": "sha512-o6E5qJV5zkAbIDNhGSIlyOhScKXgQrSRMilfph0clDfM0nEnBOlKlH4sWDmG95BW/CvwNz0vmm7dJVtU2KlMiA==", 6926 | "dev": true 6927 | }, 6928 | "node_modules/p-limit": { 6929 | "version": "3.1.0", 6930 | "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", 6931 | "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", 6932 | "dev": true, 6933 | "dependencies": { 6934 | "yocto-queue": "^0.1.0" 6935 | }, 6936 | "engines": { 6937 | "node": ">=10" 6938 | }, 6939 | "funding": { 6940 | "url": "https://github.com/sponsors/sindresorhus" 6941 | } 6942 | }, 6943 | "node_modules/p-locate": { 6944 | "version": "5.0.0", 6945 | "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", 6946 | "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", 6947 | "dev": true, 6948 | "dependencies": { 6949 | "p-limit": "^3.0.2" 6950 | }, 6951 | "engines": { 6952 | "node": ">=10" 6953 | }, 6954 | "funding": { 6955 | "url": "https://github.com/sponsors/sindresorhus" 6956 | } 6957 | }, 6958 | "node_modules/p-map": { 6959 | "version": "4.0.0", 6960 | "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", 6961 | "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", 6962 | "dev": true, 6963 | "dependencies": { 6964 | "aggregate-error": "^3.0.0" 6965 | }, 6966 | "engines": { 6967 | "node": ">=10" 6968 | }, 6969 | "funding": { 6970 | "url": "https://github.com/sponsors/sindresorhus" 6971 | } 6972 | }, 6973 | "node_modules/parent-module": { 6974 | "version": "1.0.1", 6975 | "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", 6976 | "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", 6977 | "dev": true, 6978 | "dependencies": { 6979 | "callsites": "^3.0.0" 6980 | }, 6981 | "engines": { 6982 | "node": ">=6" 6983 | } 6984 | }, 6985 | "node_modules/parse5": { 6986 | "version": "7.1.2", 6987 | "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", 6988 | "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", 6989 | "dev": true, 6990 | "dependencies": { 6991 | "entities": "^4.4.0" 6992 | }, 6993 | "funding": { 6994 | "url": "https://github.com/inikulin/parse5?sponsor=1" 6995 | } 6996 | }, 6997 | "node_modules/parse5-htmlparser2-tree-adapter": { 6998 | "version": "7.0.0", 6999 | "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-7.0.0.tgz", 7000 | "integrity": "sha512-B77tOZrqqfUfnVcOrUvfdLbz4pu4RopLD/4vmu3HUPswwTA8OH0EMW9BlWR2B0RCoiZRAHEUu7IxeP1Pd1UU+g==", 7001 | "dev": true, 7002 | "dependencies": { 7003 | "domhandler": "^5.0.2", 7004 | "parse5": "^7.0.0" 7005 | }, 7006 | "funding": { 7007 | "url": "https://github.com/inikulin/parse5?sponsor=1" 7008 | } 7009 | }, 7010 | "node_modules/path-exists": { 7011 | "version": "4.0.0", 7012 | "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", 7013 | "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", 7014 | "dev": true, 7015 | "engines": { 7016 | "node": ">=8" 7017 | } 7018 | }, 7019 | "node_modules/path-is-absolute": { 7020 | "version": "1.0.1", 7021 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 7022 | "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", 7023 | "dev": true, 7024 | "engines": { 7025 | "node": ">=0.10.0" 7026 | } 7027 | }, 7028 | "node_modules/path-key": { 7029 | "version": "3.1.1", 7030 | "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", 7031 | "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", 7032 | "dev": true, 7033 | "engines": { 7034 | "node": ">=8" 7035 | } 7036 | }, 7037 | "node_modules/path-parse": { 7038 | "version": "1.0.7", 7039 | "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", 7040 | "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" 7041 | }, 7042 | "node_modules/path-posix": { 7043 | "version": "1.0.0", 7044 | "resolved": "https://registry.npmjs.org/path-posix/-/path-posix-1.0.0.tgz", 7045 | "integrity": "sha512-1gJ0WpNIiYcQydgg3Ed8KzvIqTsDpNwq+cjBCssvBtuTWjEqY1AW+i+OepiEMqDCzyro9B2sLAe4RBPajMYFiA==", 7046 | "dev": true 7047 | }, 7048 | "node_modules/path-scurry": { 7049 | "version": "1.10.1", 7050 | "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", 7051 | "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", 7052 | "dev": true, 7053 | "dependencies": { 7054 | "lru-cache": "^9.1.1 || ^10.0.0", 7055 | "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" 7056 | }, 7057 | "engines": { 7058 | "node": ">=16 || 14 >=14.17" 7059 | }, 7060 | "funding": { 7061 | "url": "https://github.com/sponsors/isaacs" 7062 | } 7063 | }, 7064 | "node_modules/path-scurry/node_modules/lru-cache": { 7065 | "version": "10.2.0", 7066 | "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.2.0.tgz", 7067 | "integrity": "sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==", 7068 | "dev": true, 7069 | "engines": { 7070 | "node": "14 || >=16.14" 7071 | } 7072 | }, 7073 | "node_modules/path-type": { 7074 | "version": "4.0.0", 7075 | "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", 7076 | "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", 7077 | "dev": true, 7078 | "engines": { 7079 | "node": ">=8" 7080 | } 7081 | }, 7082 | "node_modules/pathe": { 7083 | "version": "1.1.2", 7084 | "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", 7085 | "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==", 7086 | "dev": true 7087 | }, 7088 | "node_modules/pathval": { 7089 | "version": "1.1.1", 7090 | "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", 7091 | "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", 7092 | "dev": true, 7093 | "engines": { 7094 | "node": "*" 7095 | } 7096 | }, 7097 | "node_modules/pend": { 7098 | "version": "1.2.0", 7099 | "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", 7100 | "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", 7101 | "dev": true 7102 | }, 7103 | "node_modules/performance-now": { 7104 | "version": "2.1.0", 7105 | "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", 7106 | "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==", 7107 | "dev": true 7108 | }, 7109 | "node_modules/periscopic": { 7110 | "version": "3.1.0", 7111 | "resolved": "https://registry.npmjs.org/periscopic/-/periscopic-3.1.0.tgz", 7112 | "integrity": "sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw==", 7113 | "dependencies": { 7114 | "@types/estree": "^1.0.0", 7115 | "estree-walker": "^3.0.0", 7116 | "is-reference": "^3.0.0" 7117 | } 7118 | }, 7119 | "node_modules/periscopic/node_modules/estree-walker": { 7120 | "version": "3.0.3", 7121 | "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", 7122 | "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", 7123 | "dependencies": { 7124 | "@types/estree": "^1.0.0" 7125 | } 7126 | }, 7127 | "node_modules/periscopic/node_modules/is-reference": { 7128 | "version": "3.0.2", 7129 | "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-3.0.2.tgz", 7130 | "integrity": "sha512-v3rht/LgVcsdZa3O2Nqs+NMowLOxeOm7Ay9+/ARQ2F+qEoANRcqrjAZKGN0v8ymUetZGgkp26LTnGT7H0Qo9Pg==", 7131 | "dependencies": { 7132 | "@types/estree": "*" 7133 | } 7134 | }, 7135 | "node_modules/picocolors": { 7136 | "version": "1.0.0", 7137 | "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", 7138 | "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" 7139 | }, 7140 | "node_modules/picomatch": { 7141 | "version": "2.3.1", 7142 | "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", 7143 | "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", 7144 | "engines": { 7145 | "node": ">=8.6" 7146 | }, 7147 | "funding": { 7148 | "url": "https://github.com/sponsors/jonschlinkert" 7149 | } 7150 | }, 7151 | "node_modules/pify": { 7152 | "version": "2.3.0", 7153 | "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", 7154 | "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", 7155 | "dev": true, 7156 | "engines": { 7157 | "node": ">=0.10.0" 7158 | } 7159 | }, 7160 | "node_modules/pirates": { 7161 | "version": "4.0.6", 7162 | "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", 7163 | "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", 7164 | "dev": true, 7165 | "engines": { 7166 | "node": ">= 6" 7167 | } 7168 | }, 7169 | "node_modules/pkg-types": { 7170 | "version": "1.1.1", 7171 | "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.1.1.tgz", 7172 | "integrity": "sha512-ko14TjmDuQJ14zsotODv7dBlwxKhUKQEhuhmbqo1uCi9BB0Z2alo/wAXg6q1dTR5TyuqYyWhjtfe/Tsh+X28jQ==", 7173 | "dev": true, 7174 | "dependencies": { 7175 | "confbox": "^0.1.7", 7176 | "mlly": "^1.7.0", 7177 | "pathe": "^1.1.2" 7178 | } 7179 | }, 7180 | "node_modules/plain-tag": { 7181 | "version": "0.1.3", 7182 | "resolved": "https://registry.npmjs.org/plain-tag/-/plain-tag-0.1.3.tgz", 7183 | "integrity": "sha512-yyVAOFKTAElc7KdLt2+UKGExNYwYb/Y/WE9i+1ezCQsJE8gbKSjewfpRqK2nQgZ4d4hhAAGgDCOcIZVilqE5UA==" 7184 | }, 7185 | "node_modules/polyscript": { 7186 | "version": "0.12.8", 7187 | "resolved": "https://registry.npmjs.org/polyscript/-/polyscript-0.12.8.tgz", 7188 | "integrity": "sha512-kcG3W9jU/s1sYjWOTAa2jAh5D2jm3zJRi+glSTsC+lA3D1b/Sd67pEIGpyL9bWNKYSimqAx4se6jAhQjJZ7+jQ==", 7189 | "dependencies": { 7190 | "@ungap/structured-clone": "^1.2.0", 7191 | "@ungap/with-resolvers": "^0.1.0", 7192 | "@webreflection/fetch": "^0.1.5", 7193 | "basic-devtools": "^0.1.6", 7194 | "codedent": "^0.1.2", 7195 | "coincident": "^1.2.3", 7196 | "gc-hook": "^0.3.1", 7197 | "html-escaper": "^3.0.3", 7198 | "proxy-target": "^3.0.2", 7199 | "sticky-module": "^0.1.1", 7200 | "to-json-callback": "^0.1.1" 7201 | } 7202 | }, 7203 | "node_modules/postcss": { 7204 | "version": "8.4.38", 7205 | "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz", 7206 | "integrity": "sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==", 7207 | "funding": [ 7208 | { 7209 | "type": "opencollective", 7210 | "url": "https://opencollective.com/postcss/" 7211 | }, 7212 | { 7213 | "type": "tidelift", 7214 | "url": "https://tidelift.com/funding/github/npm/postcss" 7215 | }, 7216 | { 7217 | "type": "github", 7218 | "url": "https://github.com/sponsors/ai" 7219 | } 7220 | ], 7221 | "dependencies": { 7222 | "nanoid": "^3.3.7", 7223 | "picocolors": "^1.0.0", 7224 | "source-map-js": "^1.2.0" 7225 | }, 7226 | "engines": { 7227 | "node": "^10 || ^12 || >=14" 7228 | } 7229 | }, 7230 | "node_modules/postcss-import": { 7231 | "version": "15.1.0", 7232 | "resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-15.1.0.tgz", 7233 | "integrity": "sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==", 7234 | "dev": true, 7235 | "dependencies": { 7236 | "postcss-value-parser": "^4.0.0", 7237 | "read-cache": "^1.0.0", 7238 | "resolve": "^1.1.7" 7239 | }, 7240 | "engines": { 7241 | "node": ">=14.0.0" 7242 | }, 7243 | "peerDependencies": { 7244 | "postcss": "^8.0.0" 7245 | } 7246 | }, 7247 | "node_modules/postcss-js": { 7248 | "version": "4.0.1", 7249 | "resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-4.0.1.tgz", 7250 | "integrity": "sha512-dDLF8pEO191hJMtlHFPRa8xsizHaM82MLfNkUHdUtVEV3tgTp5oj+8qbEqYM57SLfc74KSbw//4SeJma2LRVIw==", 7251 | "dev": true, 7252 | "dependencies": { 7253 | "camelcase-css": "^2.0.1" 7254 | }, 7255 | "engines": { 7256 | "node": "^12 || ^14 || >= 16" 7257 | }, 7258 | "funding": { 7259 | "type": "opencollective", 7260 | "url": "https://opencollective.com/postcss/" 7261 | }, 7262 | "peerDependencies": { 7263 | "postcss": "^8.4.21" 7264 | } 7265 | }, 7266 | "node_modules/postcss-load-config": { 7267 | "version": "3.1.4", 7268 | "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-3.1.4.tgz", 7269 | "integrity": "sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==", 7270 | "dev": true, 7271 | "dependencies": { 7272 | "lilconfig": "^2.0.5", 7273 | "yaml": "^1.10.2" 7274 | }, 7275 | "engines": { 7276 | "node": ">= 10" 7277 | }, 7278 | "funding": { 7279 | "type": "opencollective", 7280 | "url": "https://opencollective.com/postcss/" 7281 | }, 7282 | "peerDependencies": { 7283 | "postcss": ">=8.0.9", 7284 | "ts-node": ">=9.0.0" 7285 | }, 7286 | "peerDependenciesMeta": { 7287 | "postcss": { 7288 | "optional": true 7289 | }, 7290 | "ts-node": { 7291 | "optional": true 7292 | } 7293 | } 7294 | }, 7295 | "node_modules/postcss-load-config/node_modules/lilconfig": { 7296 | "version": "2.1.0", 7297 | "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", 7298 | "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", 7299 | "dev": true, 7300 | "engines": { 7301 | "node": ">=10" 7302 | } 7303 | }, 7304 | "node_modules/postcss-nested": { 7305 | "version": "6.0.1", 7306 | "resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-6.0.1.tgz", 7307 | "integrity": "sha512-mEp4xPMi5bSWiMbsgoPfcP74lsWLHkQbZc3sY+jWYd65CUwXrUaTp0fmNpa01ZcETKlIgUdFN/MpS2xZtqL9dQ==", 7308 | "dev": true, 7309 | "dependencies": { 7310 | "postcss-selector-parser": "^6.0.11" 7311 | }, 7312 | "engines": { 7313 | "node": ">=12.0" 7314 | }, 7315 | "funding": { 7316 | "type": "opencollective", 7317 | "url": "https://opencollective.com/postcss/" 7318 | }, 7319 | "peerDependencies": { 7320 | "postcss": "^8.2.14" 7321 | } 7322 | }, 7323 | "node_modules/postcss-nested/node_modules/postcss-selector-parser": { 7324 | "version": "6.0.16", 7325 | "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.16.tgz", 7326 | "integrity": "sha512-A0RVJrX+IUkVZbW3ClroRWurercFhieevHB38sr2+l9eUClMqome3LmEmnhlNy+5Mr2EYN6B2Kaw9wYdd+VHiw==", 7327 | "dev": true, 7328 | "dependencies": { 7329 | "cssesc": "^3.0.0", 7330 | "util-deprecate": "^1.0.2" 7331 | }, 7332 | "engines": { 7333 | "node": ">=4" 7334 | } 7335 | }, 7336 | "node_modules/postcss-safe-parser": { 7337 | "version": "6.0.0", 7338 | "resolved": "https://registry.npmjs.org/postcss-safe-parser/-/postcss-safe-parser-6.0.0.tgz", 7339 | "integrity": "sha512-FARHN8pwH+WiS2OPCxJI8FuRJpTVnn6ZNFiqAM2aeW2LwTHWWmWgIyKC6cUo0L8aeKiF/14MNvnpls6R2PBeMQ==", 7340 | "dev": true, 7341 | "engines": { 7342 | "node": ">=12.0" 7343 | }, 7344 | "funding": { 7345 | "type": "opencollective", 7346 | "url": "https://opencollective.com/postcss/" 7347 | }, 7348 | "peerDependencies": { 7349 | "postcss": "^8.3.3" 7350 | } 7351 | }, 7352 | "node_modules/postcss-scss": { 7353 | "version": "4.0.9", 7354 | "resolved": "https://registry.npmjs.org/postcss-scss/-/postcss-scss-4.0.9.tgz", 7355 | "integrity": "sha512-AjKOeiwAitL/MXxQW2DliT28EKukvvbEWx3LBmJIRN8KfBGZbRTxNYW0kSqi1COiTZ57nZ9NW06S6ux//N1c9A==", 7356 | "dev": true, 7357 | "funding": [ 7358 | { 7359 | "type": "opencollective", 7360 | "url": "https://opencollective.com/postcss/" 7361 | }, 7362 | { 7363 | "type": "tidelift", 7364 | "url": "https://tidelift.com/funding/github/npm/postcss-scss" 7365 | }, 7366 | { 7367 | "type": "github", 7368 | "url": "https://github.com/sponsors/ai" 7369 | } 7370 | ], 7371 | "engines": { 7372 | "node": ">=12.0" 7373 | }, 7374 | "peerDependencies": { 7375 | "postcss": "^8.4.29" 7376 | } 7377 | }, 7378 | "node_modules/postcss-selector-parser": { 7379 | "version": "6.0.10", 7380 | "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz", 7381 | "integrity": "sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==", 7382 | "dev": true, 7383 | "dependencies": { 7384 | "cssesc": "^3.0.0", 7385 | "util-deprecate": "^1.0.2" 7386 | }, 7387 | "engines": { 7388 | "node": ">=4" 7389 | } 7390 | }, 7391 | "node_modules/postcss-value-parser": { 7392 | "version": "4.2.0", 7393 | "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", 7394 | "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", 7395 | "dev": true 7396 | }, 7397 | "node_modules/postcss/node_modules/nanoid": { 7398 | "version": "3.3.7", 7399 | "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", 7400 | "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", 7401 | "funding": [ 7402 | { 7403 | "type": "github", 7404 | "url": "https://github.com/sponsors/ai" 7405 | } 7406 | ], 7407 | "bin": { 7408 | "nanoid": "bin/nanoid.cjs" 7409 | }, 7410 | "engines": { 7411 | "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" 7412 | } 7413 | }, 7414 | "node_modules/prelude-ls": { 7415 | "version": "1.2.1", 7416 | "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", 7417 | "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", 7418 | "dev": true, 7419 | "engines": { 7420 | "node": ">= 0.8.0" 7421 | } 7422 | }, 7423 | "node_modules/prettier": { 7424 | "version": "2.8.8", 7425 | "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", 7426 | "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", 7427 | "dev": true, 7428 | "bin": { 7429 | "prettier": "bin-prettier.js" 7430 | }, 7431 | "engines": { 7432 | "node": ">=10.13.0" 7433 | }, 7434 | "funding": { 7435 | "url": "https://github.com/prettier/prettier?sponsor=1" 7436 | } 7437 | }, 7438 | "node_modules/prettier-plugin-svelte": { 7439 | "version": "2.10.1", 7440 | "resolved": "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-2.10.1.tgz", 7441 | "integrity": "sha512-Wlq7Z5v2ueCubWo0TZzKc9XHcm7TDxqcuzRuGd0gcENfzfT4JZ9yDlCbEgxWgiPmLHkBjfOtpAWkcT28MCDpUQ==", 7442 | "dev": true, 7443 | "peerDependencies": { 7444 | "prettier": "^1.16.4 || ^2.0.0", 7445 | "svelte": "^3.2.0 || ^4.0.0-next.0" 7446 | } 7447 | }, 7448 | "node_modules/pretty-bytes": { 7449 | "version": "5.6.0", 7450 | "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", 7451 | "integrity": "sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==", 7452 | "dev": true, 7453 | "engines": { 7454 | "node": ">=6" 7455 | }, 7456 | "funding": { 7457 | "url": "https://github.com/sponsors/sindresorhus" 7458 | } 7459 | }, 7460 | "node_modules/pretty-format": { 7461 | "version": "29.7.0", 7462 | "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", 7463 | "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", 7464 | "dev": true, 7465 | "dependencies": { 7466 | "@jest/schemas": "^29.6.3", 7467 | "ansi-styles": "^5.0.0", 7468 | "react-is": "^18.0.0" 7469 | }, 7470 | "engines": { 7471 | "node": "^14.15.0 || ^16.10.0 || >=18.0.0" 7472 | } 7473 | }, 7474 | "node_modules/pretty-format/node_modules/ansi-styles": { 7475 | "version": "5.2.0", 7476 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", 7477 | "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", 7478 | "dev": true, 7479 | "engines": { 7480 | "node": ">=10" 7481 | }, 7482 | "funding": { 7483 | "url": "https://github.com/chalk/ansi-styles?sponsor=1" 7484 | } 7485 | }, 7486 | "node_modules/process": { 7487 | "version": "0.11.10", 7488 | "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", 7489 | "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", 7490 | "dev": true, 7491 | "engines": { 7492 | "node": ">= 0.6.0" 7493 | } 7494 | }, 7495 | "node_modules/process-nextick-args": { 7496 | "version": "2.0.1", 7497 | "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", 7498 | "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", 7499 | "dev": true 7500 | }, 7501 | "node_modules/promise-map-series": { 7502 | "version": "0.3.0", 7503 | "resolved": "https://registry.npmjs.org/promise-map-series/-/promise-map-series-0.3.0.tgz", 7504 | "integrity": "sha512-3npG2NGhTc8BWBolLLf8l/92OxMGaRLbqvIh9wjCHhDXNvk4zsxaTaCpiCunW09qWPrN2zeNSNwRLVBrQQtutA==", 7505 | "dev": true, 7506 | "engines": { 7507 | "node": "10.* || >= 12.*" 7508 | } 7509 | }, 7510 | "node_modules/proxy-from-env": { 7511 | "version": "1.0.0", 7512 | "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.0.0.tgz", 7513 | "integrity": "sha512-F2JHgJQ1iqwnHDcQjVBsq3n/uoaFL+iPW/eAeL7kVxy/2RrWaN4WroKjjvbsoRtv0ftelNyC01bjRhn/bhcf4A==", 7514 | "dev": true 7515 | }, 7516 | "node_modules/proxy-target": { 7517 | "version": "3.0.2", 7518 | "resolved": "https://registry.npmjs.org/proxy-target/-/proxy-target-3.0.2.tgz", 7519 | "integrity": "sha512-FFE1XNwXX/FNC3/P8HiKaJSy/Qk68RitG/QEcLy/bVnTAPlgTAWPZKh0pARLAnpfXQPKyalBhk009NRTgsk8vQ==" 7520 | }, 7521 | "node_modules/psl": { 7522 | "version": "1.9.0", 7523 | "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", 7524 | "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==", 7525 | "dev": true 7526 | }, 7527 | "node_modules/pump": { 7528 | "version": "3.0.0", 7529 | "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", 7530 | "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", 7531 | "dev": true, 7532 | "dependencies": { 7533 | "end-of-stream": "^1.1.0", 7534 | "once": "^1.3.1" 7535 | } 7536 | }, 7537 | "node_modules/punycode": { 7538 | "version": "2.3.1", 7539 | "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", 7540 | "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", 7541 | "dev": true, 7542 | "engines": { 7543 | "node": ">=6" 7544 | } 7545 | }, 7546 | "node_modules/pyodide": { 7547 | "version": "0.26.1", 7548 | "resolved": "https://registry.npmjs.org/pyodide/-/pyodide-0.26.1.tgz", 7549 | "integrity": "sha512-P+Gm88nwZqY7uBgjbQH8CqqU6Ei/rDn7pS1t02sNZsbyLJMyE2OVXjgNuqVT3KqYWnyGREUN0DbBUCJqk8R0ew==", 7550 | "dependencies": { 7551 | "ws": "^8.5.0" 7552 | }, 7553 | "engines": { 7554 | "node": ">=18.0.0" 7555 | } 7556 | }, 7557 | "node_modules/qs": { 7558 | "version": "6.10.4", 7559 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.4.tgz", 7560 | "integrity": "sha512-OQiU+C+Ds5qiH91qh/mg0w+8nwQuLjM4F4M/PbmhDOoYehPh+Fb0bDjtR1sOvy7YKxvj28Y/M0PhP5uVX0kB+g==", 7561 | "dev": true, 7562 | "dependencies": { 7563 | "side-channel": "^1.0.4" 7564 | }, 7565 | "engines": { 7566 | "node": ">=0.6" 7567 | }, 7568 | "funding": { 7569 | "url": "https://github.com/sponsors/ljharb" 7570 | } 7571 | }, 7572 | "node_modules/querystringify": { 7573 | "version": "2.2.0", 7574 | "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", 7575 | "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==", 7576 | "dev": true 7577 | }, 7578 | "node_modules/queue-microtask": { 7579 | "version": "1.2.3", 7580 | "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", 7581 | "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", 7582 | "dev": true, 7583 | "funding": [ 7584 | { 7585 | "type": "github", 7586 | "url": "https://github.com/sponsors/feross" 7587 | }, 7588 | { 7589 | "type": "patreon", 7590 | "url": "https://www.patreon.com/feross" 7591 | }, 7592 | { 7593 | "type": "consulting", 7594 | "url": "https://feross.org/support" 7595 | } 7596 | ] 7597 | }, 7598 | "node_modules/queue-tick": { 7599 | "version": "1.0.1", 7600 | "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz", 7601 | "integrity": "sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==", 7602 | "dev": true 7603 | }, 7604 | "node_modules/quick-temp": { 7605 | "version": "0.1.8", 7606 | "resolved": "https://registry.npmjs.org/quick-temp/-/quick-temp-0.1.8.tgz", 7607 | "integrity": "sha512-YsmIFfD9j2zaFwJkzI6eMG7y0lQP7YeWzgtFgNl38pGWZBSXJooZbOWwkcRot7Vt0Fg9L23pX0tqWU3VvLDsiA==", 7608 | "dev": true, 7609 | "dependencies": { 7610 | "mktemp": "~0.4.0", 7611 | "rimraf": "^2.5.4", 7612 | "underscore.string": "~3.3.4" 7613 | } 7614 | }, 7615 | "node_modules/quick-temp/node_modules/brace-expansion": { 7616 | "version": "1.1.11", 7617 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 7618 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 7619 | "dev": true, 7620 | "dependencies": { 7621 | "balanced-match": "^1.0.0", 7622 | "concat-map": "0.0.1" 7623 | } 7624 | }, 7625 | "node_modules/quick-temp/node_modules/glob": { 7626 | "version": "7.2.3", 7627 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", 7628 | "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", 7629 | "dev": true, 7630 | "dependencies": { 7631 | "fs.realpath": "^1.0.0", 7632 | "inflight": "^1.0.4", 7633 | "inherits": "2", 7634 | "minimatch": "^3.1.1", 7635 | "once": "^1.3.0", 7636 | "path-is-absolute": "^1.0.0" 7637 | }, 7638 | "engines": { 7639 | "node": "*" 7640 | }, 7641 | "funding": { 7642 | "url": "https://github.com/sponsors/isaacs" 7643 | } 7644 | }, 7645 | "node_modules/quick-temp/node_modules/minimatch": { 7646 | "version": "3.1.2", 7647 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", 7648 | "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", 7649 | "dev": true, 7650 | "dependencies": { 7651 | "brace-expansion": "^1.1.7" 7652 | }, 7653 | "engines": { 7654 | "node": "*" 7655 | } 7656 | }, 7657 | "node_modules/quick-temp/node_modules/rimraf": { 7658 | "version": "2.7.1", 7659 | "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", 7660 | "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", 7661 | "dev": true, 7662 | "dependencies": { 7663 | "glob": "^7.1.3" 7664 | }, 7665 | "bin": { 7666 | "rimraf": "bin.js" 7667 | } 7668 | }, 7669 | "node_modules/react-is": { 7670 | "version": "18.3.1", 7671 | "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", 7672 | "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", 7673 | "dev": true 7674 | }, 7675 | "node_modules/read-cache": { 7676 | "version": "1.0.0", 7677 | "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", 7678 | "integrity": "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==", 7679 | "dev": true, 7680 | "dependencies": { 7681 | "pify": "^2.3.0" 7682 | } 7683 | }, 7684 | "node_modules/readable-stream": { 7685 | "version": "2.3.8", 7686 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", 7687 | "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", 7688 | "dev": true, 7689 | "dependencies": { 7690 | "core-util-is": "~1.0.0", 7691 | "inherits": "~2.0.3", 7692 | "isarray": "~1.0.0", 7693 | "process-nextick-args": "~2.0.0", 7694 | "safe-buffer": "~5.1.1", 7695 | "string_decoder": "~1.1.1", 7696 | "util-deprecate": "~1.0.1" 7697 | } 7698 | }, 7699 | "node_modules/readdirp": { 7700 | "version": "3.6.0", 7701 | "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", 7702 | "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", 7703 | "dev": true, 7704 | "dependencies": { 7705 | "picomatch": "^2.2.1" 7706 | }, 7707 | "engines": { 7708 | "node": ">=8.10.0" 7709 | } 7710 | }, 7711 | "node_modules/regenerator-runtime": { 7712 | "version": "0.14.1", 7713 | "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", 7714 | "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" 7715 | }, 7716 | "node_modules/remove-trailing-separator": { 7717 | "version": "1.1.0", 7718 | "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", 7719 | "integrity": "sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw==", 7720 | "dev": true 7721 | }, 7722 | "node_modules/replace-ext": { 7723 | "version": "2.0.0", 7724 | "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-2.0.0.tgz", 7725 | "integrity": "sha512-UszKE5KVK6JvyD92nzMn9cDapSk6w/CaFZ96CnmDMUqH9oowfxF/ZjRITD25H4DnOQClLA4/j7jLGXXLVKxAug==", 7726 | "dev": true, 7727 | "engines": { 7728 | "node": ">= 10" 7729 | } 7730 | }, 7731 | "node_modules/request-progress": { 7732 | "version": "3.0.0", 7733 | "resolved": "https://registry.npmjs.org/request-progress/-/request-progress-3.0.0.tgz", 7734 | "integrity": "sha512-MnWzEHHaxHO2iWiQuHrUPBi/1WeBf5PkxQqNyNvLl9VAYSdXkP8tQ3pBSeCPD+yw0v0Aq1zosWLz0BdeXpWwZg==", 7735 | "dev": true, 7736 | "dependencies": { 7737 | "throttleit": "^1.0.0" 7738 | } 7739 | }, 7740 | "node_modules/requires-port": { 7741 | "version": "1.0.0", 7742 | "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", 7743 | "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", 7744 | "dev": true 7745 | }, 7746 | "node_modules/resolve": { 7747 | "version": "1.22.8", 7748 | "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", 7749 | "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", 7750 | "dependencies": { 7751 | "is-core-module": "^2.13.0", 7752 | "path-parse": "^1.0.7", 7753 | "supports-preserve-symlinks-flag": "^1.0.0" 7754 | }, 7755 | "bin": { 7756 | "resolve": "bin/resolve" 7757 | }, 7758 | "funding": { 7759 | "url": "https://github.com/sponsors/ljharb" 7760 | } 7761 | }, 7762 | "node_modules/resolve-from": { 7763 | "version": "4.0.0", 7764 | "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", 7765 | "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", 7766 | "dev": true, 7767 | "engines": { 7768 | "node": ">=4" 7769 | } 7770 | }, 7771 | "node_modules/resolve-options": { 7772 | "version": "2.0.0", 7773 | "resolved": "https://registry.npmjs.org/resolve-options/-/resolve-options-2.0.0.tgz", 7774 | "integrity": "sha512-/FopbmmFOQCfsCx77BRFdKOniglTiHumLgwvd6IDPihy1GKkadZbgQJBcTb2lMzSR1pndzd96b1nZrreZ7+9/A==", 7775 | "dev": true, 7776 | "dependencies": { 7777 | "value-or-function": "^4.0.0" 7778 | }, 7779 | "engines": { 7780 | "node": ">= 10.13.0" 7781 | } 7782 | }, 7783 | "node_modules/restore-cursor": { 7784 | "version": "3.1.0", 7785 | "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", 7786 | "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", 7787 | "dev": true, 7788 | "dependencies": { 7789 | "onetime": "^5.1.0", 7790 | "signal-exit": "^3.0.2" 7791 | }, 7792 | "engines": { 7793 | "node": ">=8" 7794 | } 7795 | }, 7796 | "node_modules/restore-cursor/node_modules/signal-exit": { 7797 | "version": "3.0.7", 7798 | "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", 7799 | "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", 7800 | "dev": true 7801 | }, 7802 | "node_modules/reusify": { 7803 | "version": "1.0.4", 7804 | "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", 7805 | "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", 7806 | "dev": true, 7807 | "engines": { 7808 | "iojs": ">=1.0.0", 7809 | "node": ">=0.10.0" 7810 | } 7811 | }, 7812 | "node_modules/rfdc": { 7813 | "version": "1.3.1", 7814 | "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.1.tgz", 7815 | "integrity": "sha512-r5a3l5HzYlIC68TpmYKlxWjmOP6wiPJ1vWv2HeLhNsRZMrCkxeqxiHlQ21oXmQ4F3SiryXBHhAD7JZqvOJjFmg==", 7816 | "dev": true 7817 | }, 7818 | "node_modules/rimraf": { 7819 | "version": "3.0.2", 7820 | "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", 7821 | "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", 7822 | "dev": true, 7823 | "dependencies": { 7824 | "glob": "^7.1.3" 7825 | }, 7826 | "bin": { 7827 | "rimraf": "bin.js" 7828 | }, 7829 | "funding": { 7830 | "url": "https://github.com/sponsors/isaacs" 7831 | } 7832 | }, 7833 | "node_modules/rimraf/node_modules/brace-expansion": { 7834 | "version": "1.1.11", 7835 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 7836 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 7837 | "dev": true, 7838 | "dependencies": { 7839 | "balanced-match": "^1.0.0", 7840 | "concat-map": "0.0.1" 7841 | } 7842 | }, 7843 | "node_modules/rimraf/node_modules/glob": { 7844 | "version": "7.2.3", 7845 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", 7846 | "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", 7847 | "dev": true, 7848 | "dependencies": { 7849 | "fs.realpath": "^1.0.0", 7850 | "inflight": "^1.0.4", 7851 | "inherits": "2", 7852 | "minimatch": "^3.1.1", 7853 | "once": "^1.3.0", 7854 | "path-is-absolute": "^1.0.0" 7855 | }, 7856 | "engines": { 7857 | "node": "*" 7858 | }, 7859 | "funding": { 7860 | "url": "https://github.com/sponsors/isaacs" 7861 | } 7862 | }, 7863 | "node_modules/rimraf/node_modules/minimatch": { 7864 | "version": "3.1.2", 7865 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", 7866 | "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", 7867 | "dev": true, 7868 | "dependencies": { 7869 | "brace-expansion": "^1.1.7" 7870 | }, 7871 | "engines": { 7872 | "node": "*" 7873 | } 7874 | }, 7875 | "node_modules/robust-predicates": { 7876 | "version": "3.0.2", 7877 | "resolved": "https://registry.npmjs.org/robust-predicates/-/robust-predicates-3.0.2.tgz", 7878 | "integrity": "sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg==" 7879 | }, 7880 | "node_modules/rollup": { 7881 | "version": "3.29.4", 7882 | "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.4.tgz", 7883 | "integrity": "sha512-oWzmBZwvYrU0iJHtDmhsm662rC15FRXmcjCk1xD771dFDx5jJ02ufAQQTn0etB2emNk4J9EZg/yWKpsn9BWGRw==", 7884 | "bin": { 7885 | "rollup": "dist/bin/rollup" 7886 | }, 7887 | "engines": { 7888 | "node": ">=14.18.0", 7889 | "npm": ">=8.0.0" 7890 | }, 7891 | "optionalDependencies": { 7892 | "fsevents": "~2.3.2" 7893 | } 7894 | }, 7895 | "node_modules/rsvp": { 7896 | "version": "4.8.5", 7897 | "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz", 7898 | "integrity": "sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA==", 7899 | "dev": true, 7900 | "engines": { 7901 | "node": "6.* || >= 7.*" 7902 | } 7903 | }, 7904 | "node_modules/run-parallel": { 7905 | "version": "1.2.0", 7906 | "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", 7907 | "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", 7908 | "dev": true, 7909 | "funding": [ 7910 | { 7911 | "type": "github", 7912 | "url": "https://github.com/sponsors/feross" 7913 | }, 7914 | { 7915 | "type": "patreon", 7916 | "url": "https://www.patreon.com/feross" 7917 | }, 7918 | { 7919 | "type": "consulting", 7920 | "url": "https://feross.org/support" 7921 | } 7922 | ], 7923 | "dependencies": { 7924 | "queue-microtask": "^1.2.2" 7925 | } 7926 | }, 7927 | "node_modules/rw": { 7928 | "version": "1.3.3", 7929 | "resolved": "https://registry.npmjs.org/rw/-/rw-1.3.3.tgz", 7930 | "integrity": "sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==" 7931 | }, 7932 | "node_modules/rxjs": { 7933 | "version": "7.8.1", 7934 | "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", 7935 | "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", 7936 | "dev": true, 7937 | "dependencies": { 7938 | "tslib": "^2.1.0" 7939 | } 7940 | }, 7941 | "node_modules/sade": { 7942 | "version": "1.8.1", 7943 | "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz", 7944 | "integrity": "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==", 7945 | "dependencies": { 7946 | "mri": "^1.1.0" 7947 | }, 7948 | "engines": { 7949 | "node": ">=6" 7950 | } 7951 | }, 7952 | "node_modules/safe-buffer": { 7953 | "version": "5.1.2", 7954 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 7955 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", 7956 | "dev": true 7957 | }, 7958 | "node_modules/safer-buffer": { 7959 | "version": "2.1.2", 7960 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 7961 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 7962 | }, 7963 | "node_modules/sander": { 7964 | "version": "0.5.1", 7965 | "resolved": "https://registry.npmjs.org/sander/-/sander-0.5.1.tgz", 7966 | "integrity": "sha512-3lVqBir7WuKDHGrKRDn/1Ye3kwpXaDOMsiRP1wd6wpZW56gJhsbp5RqQpA6JG/P+pkXizygnr1dKR8vzWaVsfA==", 7967 | "dev": true, 7968 | "dependencies": { 7969 | "es6-promise": "^3.1.2", 7970 | "graceful-fs": "^4.1.3", 7971 | "mkdirp": "^0.5.1", 7972 | "rimraf": "^2.5.2" 7973 | } 7974 | }, 7975 | "node_modules/sander/node_modules/brace-expansion": { 7976 | "version": "1.1.11", 7977 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 7978 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 7979 | "dev": true, 7980 | "dependencies": { 7981 | "balanced-match": "^1.0.0", 7982 | "concat-map": "0.0.1" 7983 | } 7984 | }, 7985 | "node_modules/sander/node_modules/glob": { 7986 | "version": "7.2.3", 7987 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", 7988 | "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", 7989 | "dev": true, 7990 | "dependencies": { 7991 | "fs.realpath": "^1.0.0", 7992 | "inflight": "^1.0.4", 7993 | "inherits": "2", 7994 | "minimatch": "^3.1.1", 7995 | "once": "^1.3.0", 7996 | "path-is-absolute": "^1.0.0" 7997 | }, 7998 | "engines": { 7999 | "node": "*" 8000 | }, 8001 | "funding": { 8002 | "url": "https://github.com/sponsors/isaacs" 8003 | } 8004 | }, 8005 | "node_modules/sander/node_modules/minimatch": { 8006 | "version": "3.1.2", 8007 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", 8008 | "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", 8009 | "dev": true, 8010 | "dependencies": { 8011 | "brace-expansion": "^1.1.7" 8012 | }, 8013 | "engines": { 8014 | "node": "*" 8015 | } 8016 | }, 8017 | "node_modules/sander/node_modules/rimraf": { 8018 | "version": "2.7.1", 8019 | "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", 8020 | "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", 8021 | "dev": true, 8022 | "dependencies": { 8023 | "glob": "^7.1.3" 8024 | }, 8025 | "bin": { 8026 | "rimraf": "bin.js" 8027 | } 8028 | }, 8029 | "node_modules/semver": { 8030 | "version": "7.6.0", 8031 | "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", 8032 | "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", 8033 | "dev": true, 8034 | "dependencies": { 8035 | "lru-cache": "^6.0.0" 8036 | }, 8037 | "bin": { 8038 | "semver": "bin/semver.js" 8039 | }, 8040 | "engines": { 8041 | "node": ">=10" 8042 | } 8043 | }, 8044 | "node_modules/set-cookie-parser": { 8045 | "version": "2.6.0", 8046 | "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz", 8047 | "integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==" 8048 | }, 8049 | "node_modules/set-function-length": { 8050 | "version": "1.2.2", 8051 | "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", 8052 | "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", 8053 | "dev": true, 8054 | "dependencies": { 8055 | "define-data-property": "^1.1.4", 8056 | "es-errors": "^1.3.0", 8057 | "function-bind": "^1.1.2", 8058 | "get-intrinsic": "^1.2.4", 8059 | "gopd": "^1.0.1", 8060 | "has-property-descriptors": "^1.0.2" 8061 | }, 8062 | "engines": { 8063 | "node": ">= 0.4" 8064 | } 8065 | }, 8066 | "node_modules/shebang-command": { 8067 | "version": "2.0.0", 8068 | "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", 8069 | "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", 8070 | "dev": true, 8071 | "dependencies": { 8072 | "shebang-regex": "^3.0.0" 8073 | }, 8074 | "engines": { 8075 | "node": ">=8" 8076 | } 8077 | }, 8078 | "node_modules/shebang-regex": { 8079 | "version": "3.0.0", 8080 | "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", 8081 | "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", 8082 | "dev": true, 8083 | "engines": { 8084 | "node": ">=8" 8085 | } 8086 | }, 8087 | "node_modules/side-channel": { 8088 | "version": "1.0.6", 8089 | "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", 8090 | "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", 8091 | "dev": true, 8092 | "dependencies": { 8093 | "call-bind": "^1.0.7", 8094 | "es-errors": "^1.3.0", 8095 | "get-intrinsic": "^1.2.4", 8096 | "object-inspect": "^1.13.1" 8097 | }, 8098 | "engines": { 8099 | "node": ">= 0.4" 8100 | }, 8101 | "funding": { 8102 | "url": "https://github.com/sponsors/ljharb" 8103 | } 8104 | }, 8105 | "node_modules/siginfo": { 8106 | "version": "2.0.0", 8107 | "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", 8108 | "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", 8109 | "dev": true 8110 | }, 8111 | "node_modules/signal-exit": { 8112 | "version": "4.1.0", 8113 | "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", 8114 | "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", 8115 | "dev": true, 8116 | "engines": { 8117 | "node": ">=14" 8118 | }, 8119 | "funding": { 8120 | "url": "https://github.com/sponsors/isaacs" 8121 | } 8122 | }, 8123 | "node_modules/sirv": { 8124 | "version": "2.0.4", 8125 | "resolved": "https://registry.npmjs.org/sirv/-/sirv-2.0.4.tgz", 8126 | "integrity": "sha512-94Bdh3cC2PKrbgSOUqTiGPWVZeSiXfKOVZNJniWoqrWrRkB1CJzBU3NEbiTsPcYy1lDsANA/THzS+9WBiy5nfQ==", 8127 | "dependencies": { 8128 | "@polka/url": "^1.0.0-next.24", 8129 | "mrmime": "^2.0.0", 8130 | "totalist": "^3.0.0" 8131 | }, 8132 | "engines": { 8133 | "node": ">= 10" 8134 | } 8135 | }, 8136 | "node_modules/sirv/node_modules/mrmime": { 8137 | "version": "2.0.0", 8138 | "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.0.tgz", 8139 | "integrity": "sha512-eu38+hdgojoyq63s+yTpN4XMBdt5l8HhMhc4VKLO9KM5caLIBvUm4thi7fFaxyTmCKeNnXZ5pAlBwCUnhA09uw==", 8140 | "engines": { 8141 | "node": ">=10" 8142 | } 8143 | }, 8144 | "node_modules/slash": { 8145 | "version": "3.0.0", 8146 | "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", 8147 | "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", 8148 | "dev": true, 8149 | "engines": { 8150 | "node": ">=8" 8151 | } 8152 | }, 8153 | "node_modules/slice-ansi": { 8154 | "version": "3.0.0", 8155 | "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", 8156 | "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", 8157 | "dev": true, 8158 | "dependencies": { 8159 | "ansi-styles": "^4.0.0", 8160 | "astral-regex": "^2.0.0", 8161 | "is-fullwidth-code-point": "^3.0.0" 8162 | }, 8163 | "engines": { 8164 | "node": ">=8" 8165 | } 8166 | }, 8167 | "node_modules/socket.io-client": { 8168 | "version": "4.7.5", 8169 | "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.7.5.tgz", 8170 | "integrity": "sha512-sJ/tqHOCe7Z50JCBCXrsY3I2k03iOiUe+tj1OmKeD2lXPiGH/RUCdTZFoqVyN7l1MnpIzPrGtLcijffmeouNlQ==", 8171 | "dependencies": { 8172 | "@socket.io/component-emitter": "~3.1.0", 8173 | "debug": "~4.3.2", 8174 | "engine.io-client": "~6.5.2", 8175 | "socket.io-parser": "~4.2.4" 8176 | }, 8177 | "engines": { 8178 | "node": ">=10.0.0" 8179 | } 8180 | }, 8181 | "node_modules/socket.io-parser": { 8182 | "version": "4.2.4", 8183 | "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz", 8184 | "integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==", 8185 | "dependencies": { 8186 | "@socket.io/component-emitter": "~3.1.0", 8187 | "debug": "~4.3.1" 8188 | }, 8189 | "engines": { 8190 | "node": ">=10.0.0" 8191 | } 8192 | }, 8193 | "node_modules/sorcery": { 8194 | "version": "0.11.0", 8195 | "resolved": "https://registry.npmjs.org/sorcery/-/sorcery-0.11.0.tgz", 8196 | "integrity": "sha512-J69LQ22xrQB1cIFJhPfgtLuI6BpWRiWu1Y3vSsIwK/eAScqJxd/+CJlUuHQRdX2C9NGFamq+KqNywGgaThwfHw==", 8197 | "dev": true, 8198 | "dependencies": { 8199 | "@jridgewell/sourcemap-codec": "^1.4.14", 8200 | "buffer-crc32": "^0.2.5", 8201 | "minimist": "^1.2.0", 8202 | "sander": "^0.5.0" 8203 | }, 8204 | "bin": { 8205 | "sorcery": "bin/sorcery" 8206 | } 8207 | }, 8208 | "node_modules/sort-keys": { 8209 | "version": "5.0.0", 8210 | "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-5.0.0.tgz", 8211 | "integrity": "sha512-Pdz01AvCAottHTPQGzndktFNdbRA75BgOfeT1hH+AMnJFv8lynkPi42rfeEhpx1saTEI3YNMWxfqu0sFD1G8pw==", 8212 | "dev": true, 8213 | "dependencies": { 8214 | "is-plain-obj": "^4.0.0" 8215 | }, 8216 | "engines": { 8217 | "node": ">=12" 8218 | }, 8219 | "funding": { 8220 | "url": "https://github.com/sponsors/sindresorhus" 8221 | } 8222 | }, 8223 | "node_modules/sortablejs": { 8224 | "version": "1.15.2", 8225 | "resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.15.2.tgz", 8226 | "integrity": "sha512-FJF5jgdfvoKn1MAKSdGs33bIqLi3LmsgVTliuX6iITj834F+JRQZN90Z93yql8h0K2t0RwDPBmxwlbZfDcxNZA==" 8227 | }, 8228 | "node_modules/source-map-js": { 8229 | "version": "1.2.0", 8230 | "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz", 8231 | "integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==", 8232 | "engines": { 8233 | "node": ">=0.10.0" 8234 | } 8235 | }, 8236 | "node_modules/sprintf-js": { 8237 | "version": "1.1.3", 8238 | "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", 8239 | "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", 8240 | "dev": true 8241 | }, 8242 | "node_modules/sshpk": { 8243 | "version": "1.18.0", 8244 | "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.18.0.tgz", 8245 | "integrity": "sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ==", 8246 | "dev": true, 8247 | "dependencies": { 8248 | "asn1": "~0.2.3", 8249 | "assert-plus": "^1.0.0", 8250 | "bcrypt-pbkdf": "^1.0.0", 8251 | "dashdash": "^1.12.0", 8252 | "ecc-jsbn": "~0.1.1", 8253 | "getpass": "^0.1.1", 8254 | "jsbn": "~0.1.0", 8255 | "safer-buffer": "^2.0.2", 8256 | "tweetnacl": "~0.14.0" 8257 | }, 8258 | "bin": { 8259 | "sshpk-conv": "bin/sshpk-conv", 8260 | "sshpk-sign": "bin/sshpk-sign", 8261 | "sshpk-verify": "bin/sshpk-verify" 8262 | }, 8263 | "engines": { 8264 | "node": ">=0.10.0" 8265 | } 8266 | }, 8267 | "node_modules/stackback": { 8268 | "version": "0.0.2", 8269 | "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", 8270 | "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", 8271 | "dev": true 8272 | }, 8273 | "node_modules/std-env": { 8274 | "version": "3.7.0", 8275 | "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.7.0.tgz", 8276 | "integrity": "sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==", 8277 | "dev": true 8278 | }, 8279 | "node_modules/sticky-module": { 8280 | "version": "0.1.1", 8281 | "resolved": "https://registry.npmjs.org/sticky-module/-/sticky-module-0.1.1.tgz", 8282 | "integrity": "sha512-IuYgnyIMUx/m6rtu14l/LR2MaqOLtpXcWkxPmtPsiScRHEo+S4Tojk+DWFHOncSdFX/OsoLOM4+T92yOmI1AMw==" 8283 | }, 8284 | "node_modules/stream-composer": { 8285 | "version": "1.0.2", 8286 | "resolved": "https://registry.npmjs.org/stream-composer/-/stream-composer-1.0.2.tgz", 8287 | "integrity": "sha512-bnBselmwfX5K10AH6L4c8+S5lgZMWI7ZYrz2rvYjCPB2DIMC4Ig8OpxGpNJSxRZ58oti7y1IcNvjBAz9vW5m4w==", 8288 | "dev": true, 8289 | "dependencies": { 8290 | "streamx": "^2.13.2" 8291 | } 8292 | }, 8293 | "node_modules/streamx": { 8294 | "version": "2.16.1", 8295 | "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.16.1.tgz", 8296 | "integrity": "sha512-m9QYj6WygWyWa3H1YY69amr4nVgy61xfjys7xO7kviL5rfIEc2naf+ewFiOA+aEJD7y0JO3h2GoiUv4TDwEGzQ==", 8297 | "dev": true, 8298 | "dependencies": { 8299 | "fast-fifo": "^1.1.0", 8300 | "queue-tick": "^1.0.1" 8301 | }, 8302 | "optionalDependencies": { 8303 | "bare-events": "^2.2.0" 8304 | } 8305 | }, 8306 | "node_modules/string_decoder": { 8307 | "version": "1.1.1", 8308 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", 8309 | "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", 8310 | "dev": true, 8311 | "dependencies": { 8312 | "safe-buffer": "~5.1.0" 8313 | } 8314 | }, 8315 | "node_modules/string-width": { 8316 | "version": "5.1.2", 8317 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", 8318 | "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", 8319 | "dev": true, 8320 | "dependencies": { 8321 | "eastasianwidth": "^0.2.0", 8322 | "emoji-regex": "^9.2.2", 8323 | "strip-ansi": "^7.0.1" 8324 | }, 8325 | "engines": { 8326 | "node": ">=12" 8327 | }, 8328 | "funding": { 8329 | "url": "https://github.com/sponsors/sindresorhus" 8330 | } 8331 | }, 8332 | "node_modules/string-width-cjs": { 8333 | "name": "string-width", 8334 | "version": "4.2.3", 8335 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", 8336 | "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", 8337 | "dev": true, 8338 | "dependencies": { 8339 | "emoji-regex": "^8.0.0", 8340 | "is-fullwidth-code-point": "^3.0.0", 8341 | "strip-ansi": "^6.0.1" 8342 | }, 8343 | "engines": { 8344 | "node": ">=8" 8345 | } 8346 | }, 8347 | "node_modules/string-width-cjs/node_modules/emoji-regex": { 8348 | "version": "8.0.0", 8349 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", 8350 | "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", 8351 | "dev": true 8352 | }, 8353 | "node_modules/string-width/node_modules/ansi-regex": { 8354 | "version": "6.0.1", 8355 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", 8356 | "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", 8357 | "dev": true, 8358 | "engines": { 8359 | "node": ">=12" 8360 | }, 8361 | "funding": { 8362 | "url": "https://github.com/chalk/ansi-regex?sponsor=1" 8363 | } 8364 | }, 8365 | "node_modules/string-width/node_modules/strip-ansi": { 8366 | "version": "7.1.0", 8367 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", 8368 | "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", 8369 | "dev": true, 8370 | "dependencies": { 8371 | "ansi-regex": "^6.0.1" 8372 | }, 8373 | "engines": { 8374 | "node": ">=12" 8375 | }, 8376 | "funding": { 8377 | "url": "https://github.com/chalk/strip-ansi?sponsor=1" 8378 | } 8379 | }, 8380 | "node_modules/strip-ansi": { 8381 | "version": "6.0.1", 8382 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", 8383 | "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", 8384 | "dev": true, 8385 | "dependencies": { 8386 | "ansi-regex": "^5.0.1" 8387 | }, 8388 | "engines": { 8389 | "node": ">=8" 8390 | } 8391 | }, 8392 | "node_modules/strip-ansi-cjs": { 8393 | "name": "strip-ansi", 8394 | "version": "6.0.1", 8395 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", 8396 | "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", 8397 | "dev": true, 8398 | "dependencies": { 8399 | "ansi-regex": "^5.0.1" 8400 | }, 8401 | "engines": { 8402 | "node": ">=8" 8403 | } 8404 | }, 8405 | "node_modules/strip-final-newline": { 8406 | "version": "2.0.0", 8407 | "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", 8408 | "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", 8409 | "dev": true, 8410 | "engines": { 8411 | "node": ">=6" 8412 | } 8413 | }, 8414 | "node_modules/strip-indent": { 8415 | "version": "3.0.0", 8416 | "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", 8417 | "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", 8418 | "dev": true, 8419 | "dependencies": { 8420 | "min-indent": "^1.0.0" 8421 | }, 8422 | "engines": { 8423 | "node": ">=8" 8424 | } 8425 | }, 8426 | "node_modules/strip-json-comments": { 8427 | "version": "3.1.1", 8428 | "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", 8429 | "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", 8430 | "dev": true, 8431 | "engines": { 8432 | "node": ">=8" 8433 | }, 8434 | "funding": { 8435 | "url": "https://github.com/sponsors/sindresorhus" 8436 | } 8437 | }, 8438 | "node_modules/strip-literal": { 8439 | "version": "2.1.0", 8440 | "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-2.1.0.tgz", 8441 | "integrity": "sha512-Op+UycaUt/8FbN/Z2TWPBLge3jWrP3xj10f3fnYxf052bKuS3EKs1ZQcVGjnEMdsNVAM+plXRdmjrZ/KgG3Skw==", 8442 | "dev": true, 8443 | "dependencies": { 8444 | "js-tokens": "^9.0.0" 8445 | }, 8446 | "funding": { 8447 | "url": "https://github.com/sponsors/antfu" 8448 | } 8449 | }, 8450 | "node_modules/style-mod": { 8451 | "version": "4.1.2", 8452 | "resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.1.2.tgz", 8453 | "integrity": "sha512-wnD1HyVqpJUI2+eKZ+eo1UwghftP6yuFheBqqe+bWCotBjC2K1YnteJILRMs3SM4V/0dLEW1SC27MWP5y+mwmw==" 8454 | }, 8455 | "node_modules/stylis": { 8456 | "version": "4.3.2", 8457 | "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.3.2.tgz", 8458 | "integrity": "sha512-bhtUjWd/z6ltJiQwg0dUfxEJ+W+jdqQd8TbWLWyeIJHlnsqmGLRFFd8e5mA0AZi/zx90smXRlN66YMTcaSFifg==" 8459 | }, 8460 | "node_modules/sucrase": { 8461 | "version": "3.35.0", 8462 | "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.0.tgz", 8463 | "integrity": "sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==", 8464 | "dev": true, 8465 | "dependencies": { 8466 | "@jridgewell/gen-mapping": "^0.3.2", 8467 | "commander": "^4.0.0", 8468 | "glob": "^10.3.10", 8469 | "lines-and-columns": "^1.1.6", 8470 | "mz": "^2.7.0", 8471 | "pirates": "^4.0.1", 8472 | "ts-interface-checker": "^0.1.9" 8473 | }, 8474 | "bin": { 8475 | "sucrase": "bin/sucrase", 8476 | "sucrase-node": "bin/sucrase-node" 8477 | }, 8478 | "engines": { 8479 | "node": ">=16 || 14 >=14.17" 8480 | } 8481 | }, 8482 | "node_modules/sucrase/node_modules/commander": { 8483 | "version": "4.1.1", 8484 | "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", 8485 | "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", 8486 | "dev": true, 8487 | "engines": { 8488 | "node": ">= 6" 8489 | } 8490 | }, 8491 | "node_modules/sucrase/node_modules/glob": { 8492 | "version": "10.3.10", 8493 | "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", 8494 | "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", 8495 | "dev": true, 8496 | "dependencies": { 8497 | "foreground-child": "^3.1.0", 8498 | "jackspeak": "^2.3.5", 8499 | "minimatch": "^9.0.1", 8500 | "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", 8501 | "path-scurry": "^1.10.1" 8502 | }, 8503 | "bin": { 8504 | "glob": "dist/esm/bin.mjs" 8505 | }, 8506 | "engines": { 8507 | "node": ">=16 || 14 >=14.17" 8508 | }, 8509 | "funding": { 8510 | "url": "https://github.com/sponsors/isaacs" 8511 | } 8512 | }, 8513 | "node_modules/supports-color": { 8514 | "version": "7.2.0", 8515 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", 8516 | "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", 8517 | "dev": true, 8518 | "dependencies": { 8519 | "has-flag": "^4.0.0" 8520 | }, 8521 | "engines": { 8522 | "node": ">=8" 8523 | } 8524 | }, 8525 | "node_modules/supports-preserve-symlinks-flag": { 8526 | "version": "1.0.0", 8527 | "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", 8528 | "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", 8529 | "engines": { 8530 | "node": ">= 0.4" 8531 | }, 8532 | "funding": { 8533 | "url": "https://github.com/sponsors/ljharb" 8534 | } 8535 | }, 8536 | "node_modules/svelte": { 8537 | "version": "4.2.12", 8538 | "resolved": "https://registry.npmjs.org/svelte/-/svelte-4.2.12.tgz", 8539 | "integrity": "sha512-d8+wsh5TfPwqVzbm4/HCXC783/KPHV60NvwitJnyTA5lWn1elhXMNWhXGCJ7PwPa8qFUnyJNIyuIRt2mT0WMug==", 8540 | "dependencies": { 8541 | "@ampproject/remapping": "^2.2.1", 8542 | "@jridgewell/sourcemap-codec": "^1.4.15", 8543 | "@jridgewell/trace-mapping": "^0.3.18", 8544 | "@types/estree": "^1.0.1", 8545 | "acorn": "^8.9.0", 8546 | "aria-query": "^5.3.0", 8547 | "axobject-query": "^4.0.0", 8548 | "code-red": "^1.0.3", 8549 | "css-tree": "^2.3.1", 8550 | "estree-walker": "^3.0.3", 8551 | "is-reference": "^3.0.1", 8552 | "locate-character": "^3.0.0", 8553 | "magic-string": "^0.30.4", 8554 | "periscopic": "^3.1.0" 8555 | }, 8556 | "engines": { 8557 | "node": ">=16" 8558 | } 8559 | }, 8560 | "node_modules/svelte-check": { 8561 | "version": "3.6.8", 8562 | "resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-3.6.8.tgz", 8563 | "integrity": "sha512-rhXU7YCDtL+lq2gCqfJDXKTxJfSsCgcd08d7VWBFxTw6IWIbMWSaASbAOD3N0VV9TYSSLUqEBiratLd8WxAJJA==", 8564 | "dev": true, 8565 | "dependencies": { 8566 | "@jridgewell/trace-mapping": "^0.3.17", 8567 | "chokidar": "^3.4.1", 8568 | "fast-glob": "^3.2.7", 8569 | "import-fresh": "^3.2.1", 8570 | "picocolors": "^1.0.0", 8571 | "sade": "^1.7.4", 8572 | "svelte-preprocess": "^5.1.3", 8573 | "typescript": "^5.0.3" 8574 | }, 8575 | "bin": { 8576 | "svelte-check": "bin/svelte-check" 8577 | }, 8578 | "peerDependencies": { 8579 | "svelte": "^3.55.0 || ^4.0.0-next.0 || ^4.0.0 || ^5.0.0-next.0" 8580 | } 8581 | }, 8582 | "node_modules/svelte-confetti": { 8583 | "version": "1.3.2", 8584 | "resolved": "https://registry.npmjs.org/svelte-confetti/-/svelte-confetti-1.3.2.tgz", 8585 | "integrity": "sha512-R+JwFTC7hIgWVA/OuXrkj384B7CMoceb0t9VacyW6dORTQg0pWojVBB8Bo3tM30cLEQE48Fekzqgx+XSzHESMA==", 8586 | "dev": true, 8587 | "peerDependencies": { 8588 | "svelte": "^4.0.0" 8589 | } 8590 | }, 8591 | "node_modules/svelte-eslint-parser": { 8592 | "version": "0.33.1", 8593 | "resolved": "https://registry.npmjs.org/svelte-eslint-parser/-/svelte-eslint-parser-0.33.1.tgz", 8594 | "integrity": "sha512-vo7xPGTlKBGdLH8T5L64FipvTrqv3OQRx9d2z5X05KKZDlF4rQk8KViZO4flKERY+5BiVdOh7zZ7JGJWo5P0uA==", 8595 | "dev": true, 8596 | "dependencies": { 8597 | "eslint-scope": "^7.0.0", 8598 | "eslint-visitor-keys": "^3.0.0", 8599 | "espree": "^9.0.0", 8600 | "postcss": "^8.4.29", 8601 | "postcss-scss": "^4.0.8" 8602 | }, 8603 | "engines": { 8604 | "node": "^12.22.0 || ^14.17.0 || >=16.0.0" 8605 | }, 8606 | "funding": { 8607 | "url": "https://github.com/sponsors/ota-meshi" 8608 | }, 8609 | "peerDependencies": { 8610 | "svelte": "^3.37.0 || ^4.0.0" 8611 | }, 8612 | "peerDependenciesMeta": { 8613 | "svelte": { 8614 | "optional": true 8615 | } 8616 | } 8617 | }, 8618 | "node_modules/svelte-hmr": { 8619 | "version": "0.15.3", 8620 | "resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.15.3.tgz", 8621 | "integrity": "sha512-41snaPswvSf8TJUhlkoJBekRrABDXDMdpNpT2tfHIv4JuhgvHqLMhEPGtaQn0BmbNSTkuz2Ed20DF2eHw0SmBQ==", 8622 | "engines": { 8623 | "node": "^12.20 || ^14.13.1 || >= 16" 8624 | }, 8625 | "peerDependencies": { 8626 | "svelte": "^3.19.0 || ^4.0.0" 8627 | } 8628 | }, 8629 | "node_modules/svelte-preprocess": { 8630 | "version": "5.1.3", 8631 | "resolved": "https://registry.npmjs.org/svelte-preprocess/-/svelte-preprocess-5.1.3.tgz", 8632 | "integrity": "sha512-xxAkmxGHT+J/GourS5mVJeOXZzne1FR5ljeOUAMXUkfEhkLEllRreXpbl3dIYJlcJRfL1LO1uIAPpBpBfiqGPw==", 8633 | "dev": true, 8634 | "hasInstallScript": true, 8635 | "dependencies": { 8636 | "@types/pug": "^2.0.6", 8637 | "detect-indent": "^6.1.0", 8638 | "magic-string": "^0.30.5", 8639 | "sorcery": "^0.11.0", 8640 | "strip-indent": "^3.0.0" 8641 | }, 8642 | "engines": { 8643 | "node": ">= 16.0.0", 8644 | "pnpm": "^8.0.0" 8645 | }, 8646 | "peerDependencies": { 8647 | "@babel/core": "^7.10.2", 8648 | "coffeescript": "^2.5.1", 8649 | "less": "^3.11.3 || ^4.0.0", 8650 | "postcss": "^7 || ^8", 8651 | "postcss-load-config": "^2.1.0 || ^3.0.0 || ^4.0.0 || ^5.0.0", 8652 | "pug": "^3.0.0", 8653 | "sass": "^1.26.8", 8654 | "stylus": "^0.55.0", 8655 | "sugarss": "^2.0.0 || ^3.0.0 || ^4.0.0", 8656 | "svelte": "^3.23.0 || ^4.0.0-next.0 || ^4.0.0 || ^5.0.0-next.0", 8657 | "typescript": ">=3.9.5 || ^4.0.0 || ^5.0.0" 8658 | }, 8659 | "peerDependenciesMeta": { 8660 | "@babel/core": { 8661 | "optional": true 8662 | }, 8663 | "coffeescript": { 8664 | "optional": true 8665 | }, 8666 | "less": { 8667 | "optional": true 8668 | }, 8669 | "postcss": { 8670 | "optional": true 8671 | }, 8672 | "postcss-load-config": { 8673 | "optional": true 8674 | }, 8675 | "pug": { 8676 | "optional": true 8677 | }, 8678 | "sass": { 8679 | "optional": true 8680 | }, 8681 | "stylus": { 8682 | "optional": true 8683 | }, 8684 | "sugarss": { 8685 | "optional": true 8686 | }, 8687 | "typescript": { 8688 | "optional": true 8689 | } 8690 | } 8691 | }, 8692 | "node_modules/svelte-sonner": { 8693 | "version": "0.3.19", 8694 | "resolved": "https://registry.npmjs.org/svelte-sonner/-/svelte-sonner-0.3.19.tgz", 8695 | "integrity": "sha512-jpPOgLtHwRaB6Vqo2dUQMv15/yUV/BQWTjKpEqQ11uqRSHKjAYUKZyGrHB2cQsGmyjR0JUzBD58btpgNqINQ/Q==", 8696 | "peerDependencies": { 8697 | "svelte": ">=3 <5" 8698 | } 8699 | }, 8700 | "node_modules/svelte/node_modules/estree-walker": { 8701 | "version": "3.0.3", 8702 | "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", 8703 | "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", 8704 | "dependencies": { 8705 | "@types/estree": "^1.0.0" 8706 | } 8707 | }, 8708 | "node_modules/svelte/node_modules/is-reference": { 8709 | "version": "3.0.2", 8710 | "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-3.0.2.tgz", 8711 | "integrity": "sha512-v3rht/LgVcsdZa3O2Nqs+NMowLOxeOm7Ay9+/ARQ2F+qEoANRcqrjAZKGN0v8ymUetZGgkp26LTnGT7H0Qo9Pg==", 8712 | "dependencies": { 8713 | "@types/estree": "*" 8714 | } 8715 | }, 8716 | "node_modules/symlink-or-copy": { 8717 | "version": "1.3.1", 8718 | "resolved": "https://registry.npmjs.org/symlink-or-copy/-/symlink-or-copy-1.3.1.tgz", 8719 | "integrity": "sha512-0K91MEXFpBUaywiwSSkmKjnGcasG/rVBXFLJz5DrgGabpYD6N+3yZrfD6uUIfpuTu65DZLHi7N8CizHc07BPZA==", 8720 | "dev": true 8721 | }, 8722 | "node_modules/tabbable": { 8723 | "version": "6.2.0", 8724 | "resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.2.0.tgz", 8725 | "integrity": "sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==" 8726 | }, 8727 | "node_modules/tailwindcss": { 8728 | "version": "3.4.1", 8729 | "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.1.tgz", 8730 | "integrity": "sha512-qAYmXRfk3ENzuPBakNK0SRrUDipP8NQnEY6772uDhflcQz5EhRdD7JNZxyrFHVQNCwULPBn6FNPp9brpO7ctcA==", 8731 | "dev": true, 8732 | "dependencies": { 8733 | "@alloc/quick-lru": "^5.2.0", 8734 | "arg": "^5.0.2", 8735 | "chokidar": "^3.5.3", 8736 | "didyoumean": "^1.2.2", 8737 | "dlv": "^1.1.3", 8738 | "fast-glob": "^3.3.0", 8739 | "glob-parent": "^6.0.2", 8740 | "is-glob": "^4.0.3", 8741 | "jiti": "^1.19.1", 8742 | "lilconfig": "^2.1.0", 8743 | "micromatch": "^4.0.5", 8744 | "normalize-path": "^3.0.0", 8745 | "object-hash": "^3.0.0", 8746 | "picocolors": "^1.0.0", 8747 | "postcss": "^8.4.23", 8748 | "postcss-import": "^15.1.0", 8749 | "postcss-js": "^4.0.1", 8750 | "postcss-load-config": "^4.0.1", 8751 | "postcss-nested": "^6.0.1", 8752 | "postcss-selector-parser": "^6.0.11", 8753 | "resolve": "^1.22.2", 8754 | "sucrase": "^3.32.0" 8755 | }, 8756 | "bin": { 8757 | "tailwind": "lib/cli.js", 8758 | "tailwindcss": "lib/cli.js" 8759 | }, 8760 | "engines": { 8761 | "node": ">=14.0.0" 8762 | } 8763 | }, 8764 | "node_modules/tailwindcss/node_modules/lilconfig": { 8765 | "version": "2.1.0", 8766 | "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", 8767 | "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", 8768 | "dev": true, 8769 | "engines": { 8770 | "node": ">=10" 8771 | } 8772 | }, 8773 | "node_modules/tailwindcss/node_modules/postcss-load-config": { 8774 | "version": "4.0.2", 8775 | "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-4.0.2.tgz", 8776 | "integrity": "sha512-bSVhyJGL00wMVoPUzAVAnbEoWyqRxkjv64tUl427SKnPrENtq6hJwUojroMz2VB+Q1edmi4IfrAPpami5VVgMQ==", 8777 | "dev": true, 8778 | "funding": [ 8779 | { 8780 | "type": "opencollective", 8781 | "url": "https://opencollective.com/postcss/" 8782 | }, 8783 | { 8784 | "type": "github", 8785 | "url": "https://github.com/sponsors/ai" 8786 | } 8787 | ], 8788 | "dependencies": { 8789 | "lilconfig": "^3.0.0", 8790 | "yaml": "^2.3.4" 8791 | }, 8792 | "engines": { 8793 | "node": ">= 14" 8794 | }, 8795 | "peerDependencies": { 8796 | "postcss": ">=8.0.9", 8797 | "ts-node": ">=9.0.0" 8798 | }, 8799 | "peerDependenciesMeta": { 8800 | "postcss": { 8801 | "optional": true 8802 | }, 8803 | "ts-node": { 8804 | "optional": true 8805 | } 8806 | } 8807 | }, 8808 | "node_modules/tailwindcss/node_modules/postcss-load-config/node_modules/lilconfig": { 8809 | "version": "3.1.1", 8810 | "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.1.tgz", 8811 | "integrity": "sha512-O18pf7nyvHTckunPWCV1XUNXU1piu01y2b7ATJ0ppkUkk8ocqVWBrYjJBCwHDjD/ZWcfyrA0P4gKhzWGi5EINQ==", 8812 | "dev": true, 8813 | "engines": { 8814 | "node": ">=14" 8815 | }, 8816 | "funding": { 8817 | "url": "https://github.com/sponsors/antonk52" 8818 | } 8819 | }, 8820 | "node_modules/tailwindcss/node_modules/postcss-selector-parser": { 8821 | "version": "6.0.16", 8822 | "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.16.tgz", 8823 | "integrity": "sha512-A0RVJrX+IUkVZbW3ClroRWurercFhieevHB38sr2+l9eUClMqome3LmEmnhlNy+5Mr2EYN6B2Kaw9wYdd+VHiw==", 8824 | "dev": true, 8825 | "dependencies": { 8826 | "cssesc": "^3.0.0", 8827 | "util-deprecate": "^1.0.2" 8828 | }, 8829 | "engines": { 8830 | "node": ">=4" 8831 | } 8832 | }, 8833 | "node_modules/tailwindcss/node_modules/yaml": { 8834 | "version": "2.4.1", 8835 | "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.1.tgz", 8836 | "integrity": "sha512-pIXzoImaqmfOrL7teGUBt/T7ZDnyeGBWyXQBvOVhLkWLN37GXv8NMLK406UY6dS51JfcQHsmcW5cJ441bHg6Lg==", 8837 | "dev": true, 8838 | "bin": { 8839 | "yaml": "bin.mjs" 8840 | }, 8841 | "engines": { 8842 | "node": ">= 14" 8843 | } 8844 | }, 8845 | "node_modules/teex": { 8846 | "version": "1.0.1", 8847 | "resolved": "https://registry.npmjs.org/teex/-/teex-1.0.1.tgz", 8848 | "integrity": "sha512-eYE6iEI62Ni1H8oIa7KlDU6uQBtqr4Eajni3wX7rpfXD8ysFx8z0+dri+KWEPWpBsxXfxu58x/0jvTVT1ekOSg==", 8849 | "dev": true, 8850 | "dependencies": { 8851 | "streamx": "^2.12.5" 8852 | } 8853 | }, 8854 | "node_modules/text-table": { 8855 | "version": "0.2.0", 8856 | "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", 8857 | "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", 8858 | "dev": true 8859 | }, 8860 | "node_modules/thenify": { 8861 | "version": "3.3.1", 8862 | "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", 8863 | "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", 8864 | "dev": true, 8865 | "dependencies": { 8866 | "any-promise": "^1.0.0" 8867 | } 8868 | }, 8869 | "node_modules/thenify-all": { 8870 | "version": "1.6.0", 8871 | "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", 8872 | "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", 8873 | "dev": true, 8874 | "dependencies": { 8875 | "thenify": ">= 3.1.0 < 4" 8876 | }, 8877 | "engines": { 8878 | "node": ">=0.8" 8879 | } 8880 | }, 8881 | "node_modules/throttleit": { 8882 | "version": "1.0.1", 8883 | "resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.1.tgz", 8884 | "integrity": "sha512-vDZpf9Chs9mAdfY046mcPt8fg5QSZr37hEH4TXYBnDF+izxgrbRGUAAaBvIk/fJm9aOFCGFd1EsNg5AZCbnQCQ==", 8885 | "dev": true, 8886 | "funding": { 8887 | "url": "https://github.com/sponsors/sindresorhus" 8888 | } 8889 | }, 8890 | "node_modules/through": { 8891 | "version": "2.3.8", 8892 | "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", 8893 | "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", 8894 | "dev": true 8895 | }, 8896 | "node_modules/through2": { 8897 | "version": "2.0.5", 8898 | "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", 8899 | "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", 8900 | "dev": true, 8901 | "dependencies": { 8902 | "readable-stream": "~2.3.6", 8903 | "xtend": "~4.0.1" 8904 | } 8905 | }, 8906 | "node_modules/tiny-glob": { 8907 | "version": "0.2.9", 8908 | "resolved": "https://registry.npmjs.org/tiny-glob/-/tiny-glob-0.2.9.tgz", 8909 | "integrity": "sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==", 8910 | "dependencies": { 8911 | "globalyzer": "0.1.0", 8912 | "globrex": "^0.1.2" 8913 | } 8914 | }, 8915 | "node_modules/tinybench": { 8916 | "version": "2.8.0", 8917 | "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.8.0.tgz", 8918 | "integrity": "sha512-1/eK7zUnIklz4JUUlL+658n58XO2hHLQfSk1Zf2LKieUjxidN16eKFEoDEfjHc3ohofSSqK3X5yO6VGb6iW8Lw==", 8919 | "dev": true 8920 | }, 8921 | "node_modules/tinypool": { 8922 | "version": "0.8.4", 8923 | "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.8.4.tgz", 8924 | "integrity": "sha512-i11VH5gS6IFeLY3gMBQ00/MmLncVP7JLXOw1vlgkytLmJK7QnEr7NXf0LBdxfmNPAeyetukOk0bOYrJrFGjYJQ==", 8925 | "dev": true, 8926 | "engines": { 8927 | "node": ">=14.0.0" 8928 | } 8929 | }, 8930 | "node_modules/tinyspy": { 8931 | "version": "2.2.1", 8932 | "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-2.2.1.tgz", 8933 | "integrity": "sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A==", 8934 | "dev": true, 8935 | "engines": { 8936 | "node": ">=14.0.0" 8937 | } 8938 | }, 8939 | "node_modules/tippy.js": { 8940 | "version": "6.3.7", 8941 | "resolved": "https://registry.npmjs.org/tippy.js/-/tippy.js-6.3.7.tgz", 8942 | "integrity": "sha512-E1d3oP2emgJ9dRQZdf3Kkn0qJgI6ZLpyS5z6ZkY1DF3kaQaBsGZsndEpHwx+eC+tYM41HaSNvNtLx8tU57FzTQ==", 8943 | "dependencies": { 8944 | "@popperjs/core": "^2.9.0" 8945 | } 8946 | }, 8947 | "node_modules/tmp": { 8948 | "version": "0.2.3", 8949 | "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.3.tgz", 8950 | "integrity": "sha512-nZD7m9iCPC5g0pYmcaxogYKggSfLsdxl8of3Q/oIbqCqLLIO9IAF0GWjX1z9NZRHPiXv8Wex4yDCaZsgEw0Y8w==", 8951 | "dev": true, 8952 | "engines": { 8953 | "node": ">=14.14" 8954 | } 8955 | }, 8956 | "node_modules/to-json-callback": { 8957 | "version": "0.1.1", 8958 | "resolved": "https://registry.npmjs.org/to-json-callback/-/to-json-callback-0.1.1.tgz", 8959 | "integrity": "sha512-BzOeinTT3NjE+FJ2iCvWB8HvyuyBzoH3WlSnJ+AYVC4tlePyZWSYdkQIFOARWiq0t35/XhmI0uQsFiUsRksRqg==" 8960 | }, 8961 | "node_modules/to-regex-range": { 8962 | "version": "5.0.1", 8963 | "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", 8964 | "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", 8965 | "dev": true, 8966 | "dependencies": { 8967 | "is-number": "^7.0.0" 8968 | }, 8969 | "engines": { 8970 | "node": ">=8.0" 8971 | } 8972 | }, 8973 | "node_modules/to-through": { 8974 | "version": "3.0.0", 8975 | "resolved": "https://registry.npmjs.org/to-through/-/to-through-3.0.0.tgz", 8976 | "integrity": "sha512-y8MN937s/HVhEoBU1SxfHC+wxCHkV1a9gW8eAdTadYh/bGyesZIVcbjI+mSpFbSVwQici/XjBjuUyri1dnXwBw==", 8977 | "dev": true, 8978 | "dependencies": { 8979 | "streamx": "^2.12.5" 8980 | }, 8981 | "engines": { 8982 | "node": ">=10.13.0" 8983 | } 8984 | }, 8985 | "node_modules/totalist": { 8986 | "version": "3.0.1", 8987 | "resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz", 8988 | "integrity": "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==", 8989 | "engines": { 8990 | "node": ">=6" 8991 | } 8992 | }, 8993 | "node_modules/tough-cookie": { 8994 | "version": "4.1.3", 8995 | "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz", 8996 | "integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==", 8997 | "dev": true, 8998 | "dependencies": { 8999 | "psl": "^1.1.33", 9000 | "punycode": "^2.1.1", 9001 | "universalify": "^0.2.0", 9002 | "url-parse": "^1.5.3" 9003 | }, 9004 | "engines": { 9005 | "node": ">=6" 9006 | } 9007 | }, 9008 | "node_modules/tough-cookie/node_modules/universalify": { 9009 | "version": "0.2.0", 9010 | "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", 9011 | "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==", 9012 | "dev": true, 9013 | "engines": { 9014 | "node": ">= 4.0.0" 9015 | } 9016 | }, 9017 | "node_modules/ts-api-utils": { 9018 | "version": "1.3.0", 9019 | "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz", 9020 | "integrity": "sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==", 9021 | "dev": true, 9022 | "engines": { 9023 | "node": ">=16" 9024 | }, 9025 | "peerDependencies": { 9026 | "typescript": ">=4.2.0" 9027 | } 9028 | }, 9029 | "node_modules/ts-dedent": { 9030 | "version": "2.2.0", 9031 | "resolved": "https://registry.npmjs.org/ts-dedent/-/ts-dedent-2.2.0.tgz", 9032 | "integrity": "sha512-q5W7tVM71e2xjHZTlgfTDoPF/SmqKG5hddq9SzR49CH2hayqRKJtQ4mtRlSxKaJlR/+9rEM+mnBHf7I2/BQcpQ==", 9033 | "engines": { 9034 | "node": ">=6.10" 9035 | } 9036 | }, 9037 | "node_modules/ts-interface-checker": { 9038 | "version": "0.1.13", 9039 | "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", 9040 | "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", 9041 | "dev": true 9042 | }, 9043 | "node_modules/tslib": { 9044 | "version": "2.6.2", 9045 | "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", 9046 | "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" 9047 | }, 9048 | "node_modules/tunnel-agent": { 9049 | "version": "0.6.0", 9050 | "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", 9051 | "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", 9052 | "dev": true, 9053 | "dependencies": { 9054 | "safe-buffer": "^5.0.1" 9055 | }, 9056 | "engines": { 9057 | "node": "*" 9058 | } 9059 | }, 9060 | "node_modules/turndown": { 9061 | "version": "7.2.0", 9062 | "resolved": "https://registry.npmjs.org/turndown/-/turndown-7.2.0.tgz", 9063 | "integrity": "sha512-eCZGBN4nNNqM9Owkv9HAtWRYfLA4h909E/WGAWWBpmB275ehNhZyk87/Tpvjbp0jjNl9XwCsbe6bm6CqFsgD+A==", 9064 | "dependencies": { 9065 | "@mixmark-io/domino": "^2.2.0" 9066 | } 9067 | }, 9068 | "node_modules/tweetnacl": { 9069 | "version": "0.14.5", 9070 | "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", 9071 | "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==", 9072 | "dev": true 9073 | }, 9074 | "node_modules/type-check": { 9075 | "version": "0.4.0", 9076 | "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", 9077 | "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", 9078 | "dev": true, 9079 | "dependencies": { 9080 | "prelude-ls": "^1.2.1" 9081 | }, 9082 | "engines": { 9083 | "node": ">= 0.8.0" 9084 | } 9085 | }, 9086 | "node_modules/type-checked-collections": { 9087 | "version": "0.1.7", 9088 | "resolved": "https://registry.npmjs.org/type-checked-collections/-/type-checked-collections-0.1.7.tgz", 9089 | "integrity": "sha512-fLIydlJy7IG9XL4wjRwEcKhxx/ekLXiWiMvcGo01cOMF+TN+5ZqajM1mRNRz2bNNi1bzou2yofhjZEQi7kgl9A==" 9090 | }, 9091 | "node_modules/type-detect": { 9092 | "version": "4.0.8", 9093 | "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", 9094 | "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", 9095 | "dev": true, 9096 | "engines": { 9097 | "node": ">=4" 9098 | } 9099 | }, 9100 | "node_modules/type-fest": { 9101 | "version": "0.20.2", 9102 | "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", 9103 | "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", 9104 | "dev": true, 9105 | "engines": { 9106 | "node": ">=10" 9107 | }, 9108 | "funding": { 9109 | "url": "https://github.com/sponsors/sindresorhus" 9110 | } 9111 | }, 9112 | "node_modules/typescript": { 9113 | "version": "5.4.3", 9114 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.3.tgz", 9115 | "integrity": "sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==", 9116 | "dev": true, 9117 | "bin": { 9118 | "tsc": "bin/tsc", 9119 | "tsserver": "bin/tsserver" 9120 | }, 9121 | "engines": { 9122 | "node": ">=14.17" 9123 | } 9124 | }, 9125 | "node_modules/ufo": { 9126 | "version": "1.5.3", 9127 | "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.5.3.tgz", 9128 | "integrity": "sha512-Y7HYmWaFwPUmkoQCUIAYpKqkOf+SbVj/2fJJZ4RJMCfZp0rTGwRbzQD+HghfnhKOjL9E01okqz+ncJskGYfBNw==", 9129 | "dev": true 9130 | }, 9131 | "node_modules/underscore.string": { 9132 | "version": "3.3.6", 9133 | "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-3.3.6.tgz", 9134 | "integrity": "sha512-VoC83HWXmCrF6rgkyxS9GHv8W9Q5nhMKho+OadDJGzL2oDYbYEppBaCMH6pFlwLeqj2QS+hhkw2kpXkSdD1JxQ==", 9135 | "dev": true, 9136 | "dependencies": { 9137 | "sprintf-js": "^1.1.1", 9138 | "util-deprecate": "^1.0.2" 9139 | }, 9140 | "engines": { 9141 | "node": "*" 9142 | } 9143 | }, 9144 | "node_modules/undici": { 9145 | "version": "5.28.4", 9146 | "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", 9147 | "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", 9148 | "dependencies": { 9149 | "@fastify/busboy": "^2.0.0" 9150 | }, 9151 | "engines": { 9152 | "node": ">=14.0" 9153 | } 9154 | }, 9155 | "node_modules/undici-types": { 9156 | "version": "5.26.5", 9157 | "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", 9158 | "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", 9159 | "devOptional": true 9160 | }, 9161 | "node_modules/unist-util-stringify-position": { 9162 | "version": "3.0.3", 9163 | "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-3.0.3.tgz", 9164 | "integrity": "sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==", 9165 | "dependencies": { 9166 | "@types/unist": "^2.0.0" 9167 | }, 9168 | "funding": { 9169 | "type": "opencollective", 9170 | "url": "https://opencollective.com/unified" 9171 | } 9172 | }, 9173 | "node_modules/universalify": { 9174 | "version": "2.0.1", 9175 | "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", 9176 | "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", 9177 | "dev": true, 9178 | "engines": { 9179 | "node": ">= 10.0.0" 9180 | } 9181 | }, 9182 | "node_modules/untildify": { 9183 | "version": "4.0.0", 9184 | "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", 9185 | "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==", 9186 | "dev": true, 9187 | "engines": { 9188 | "node": ">=8" 9189 | } 9190 | }, 9191 | "node_modules/update-browserslist-db": { 9192 | "version": "1.0.13", 9193 | "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", 9194 | "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", 9195 | "dev": true, 9196 | "funding": [ 9197 | { 9198 | "type": "opencollective", 9199 | "url": "https://opencollective.com/browserslist" 9200 | }, 9201 | { 9202 | "type": "tidelift", 9203 | "url": "https://tidelift.com/funding/github/npm/browserslist" 9204 | }, 9205 | { 9206 | "type": "github", 9207 | "url": "https://github.com/sponsors/ai" 9208 | } 9209 | ], 9210 | "dependencies": { 9211 | "escalade": "^3.1.1", 9212 | "picocolors": "^1.0.0" 9213 | }, 9214 | "bin": { 9215 | "update-browserslist-db": "cli.js" 9216 | }, 9217 | "peerDependencies": { 9218 | "browserslist": ">= 4.21.0" 9219 | } 9220 | }, 9221 | "node_modules/uri-js": { 9222 | "version": "4.4.1", 9223 | "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", 9224 | "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", 9225 | "dev": true, 9226 | "dependencies": { 9227 | "punycode": "^2.1.0" 9228 | } 9229 | }, 9230 | "node_modules/url-parse": { 9231 | "version": "1.5.10", 9232 | "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", 9233 | "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", 9234 | "dev": true, 9235 | "dependencies": { 9236 | "querystringify": "^2.1.1", 9237 | "requires-port": "^1.0.0" 9238 | } 9239 | }, 9240 | "node_modules/util-deprecate": { 9241 | "version": "1.0.2", 9242 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 9243 | "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", 9244 | "dev": true 9245 | }, 9246 | "node_modules/uuid": { 9247 | "version": "9.0.1", 9248 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", 9249 | "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", 9250 | "funding": [ 9251 | "https://github.com/sponsors/broofa", 9252 | "https://github.com/sponsors/ctavan" 9253 | ], 9254 | "bin": { 9255 | "uuid": "dist/bin/uuid" 9256 | } 9257 | }, 9258 | "node_modules/uvu": { 9259 | "version": "0.5.6", 9260 | "resolved": "https://registry.npmjs.org/uvu/-/uvu-0.5.6.tgz", 9261 | "integrity": "sha512-+g8ENReyr8YsOc6fv/NVJs2vFdHBnBNdfE49rshrTzDWOlUx4Gq7KOS2GD8eqhy2j+Ejq29+SbKH8yjkAqXqoA==", 9262 | "dependencies": { 9263 | "dequal": "^2.0.0", 9264 | "diff": "^5.0.0", 9265 | "kleur": "^4.0.3", 9266 | "sade": "^1.7.3" 9267 | }, 9268 | "bin": { 9269 | "uvu": "bin.js" 9270 | }, 9271 | "engines": { 9272 | "node": ">=8" 9273 | } 9274 | }, 9275 | "node_modules/value-or-function": { 9276 | "version": "4.0.0", 9277 | "resolved": "https://registry.npmjs.org/value-or-function/-/value-or-function-4.0.0.tgz", 9278 | "integrity": "sha512-aeVK81SIuT6aMJfNo9Vte8Dw0/FZINGBV8BfCraGtqVxIeLAEhJyoWs8SmvRVmXfGss2PmmOwZCuBPbZR+IYWg==", 9279 | "dev": true, 9280 | "engines": { 9281 | "node": ">= 10.13.0" 9282 | } 9283 | }, 9284 | "node_modules/verror": { 9285 | "version": "1.10.0", 9286 | "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", 9287 | "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", 9288 | "dev": true, 9289 | "engines": [ 9290 | "node >=0.6.0" 9291 | ], 9292 | "dependencies": { 9293 | "assert-plus": "^1.0.0", 9294 | "core-util-is": "1.0.2", 9295 | "extsprintf": "^1.2.0" 9296 | } 9297 | }, 9298 | "node_modules/verror/node_modules/core-util-is": { 9299 | "version": "1.0.2", 9300 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", 9301 | "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", 9302 | "dev": true 9303 | }, 9304 | "node_modules/vinyl": { 9305 | "version": "3.0.0", 9306 | "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-3.0.0.tgz", 9307 | "integrity": "sha512-rC2VRfAVVCGEgjnxHUnpIVh3AGuk62rP3tqVrn+yab0YH7UULisC085+NYH+mnqf3Wx4SpSi1RQMwudL89N03g==", 9308 | "dev": true, 9309 | "dependencies": { 9310 | "clone": "^2.1.2", 9311 | "clone-stats": "^1.0.0", 9312 | "remove-trailing-separator": "^1.1.0", 9313 | "replace-ext": "^2.0.0", 9314 | "teex": "^1.0.1" 9315 | }, 9316 | "engines": { 9317 | "node": ">=10.13.0" 9318 | } 9319 | }, 9320 | "node_modules/vinyl-contents": { 9321 | "version": "2.0.0", 9322 | "resolved": "https://registry.npmjs.org/vinyl-contents/-/vinyl-contents-2.0.0.tgz", 9323 | "integrity": "sha512-cHq6NnGyi2pZ7xwdHSW1v4Jfnho4TEGtxZHw01cmnc8+i7jgR6bRnED/LbrKan/Q7CvVLbnvA5OepnhbpjBZ5Q==", 9324 | "dev": true, 9325 | "dependencies": { 9326 | "bl": "^5.0.0", 9327 | "vinyl": "^3.0.0" 9328 | }, 9329 | "engines": { 9330 | "node": ">=10.13.0" 9331 | } 9332 | }, 9333 | "node_modules/vinyl-fs": { 9334 | "version": "4.0.0", 9335 | "resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-4.0.0.tgz", 9336 | "integrity": "sha512-7GbgBnYfaquMk3Qu9g22x000vbYkOex32930rBnc3qByw6HfMEAoELjCjoJv4HuEQxHAurT+nvMHm6MnJllFLw==", 9337 | "dev": true, 9338 | "dependencies": { 9339 | "fs-mkdirp-stream": "^2.0.1", 9340 | "glob-stream": "^8.0.0", 9341 | "graceful-fs": "^4.2.11", 9342 | "iconv-lite": "^0.6.3", 9343 | "is-valid-glob": "^1.0.0", 9344 | "lead": "^4.0.0", 9345 | "normalize-path": "3.0.0", 9346 | "resolve-options": "^2.0.0", 9347 | "stream-composer": "^1.0.2", 9348 | "streamx": "^2.14.0", 9349 | "to-through": "^3.0.0", 9350 | "value-or-function": "^4.0.0", 9351 | "vinyl": "^3.0.0", 9352 | "vinyl-sourcemap": "^2.0.0" 9353 | }, 9354 | "engines": { 9355 | "node": ">=10.13.0" 9356 | } 9357 | }, 9358 | "node_modules/vinyl-sourcemap": { 9359 | "version": "2.0.0", 9360 | "resolved": "https://registry.npmjs.org/vinyl-sourcemap/-/vinyl-sourcemap-2.0.0.tgz", 9361 | "integrity": "sha512-BAEvWxbBUXvlNoFQVFVHpybBbjW1r03WhohJzJDSfgrrK5xVYIDTan6xN14DlyImShgDRv2gl9qhM6irVMsV0Q==", 9362 | "dev": true, 9363 | "dependencies": { 9364 | "convert-source-map": "^2.0.0", 9365 | "graceful-fs": "^4.2.10", 9366 | "now-and-later": "^3.0.0", 9367 | "streamx": "^2.12.5", 9368 | "vinyl": "^3.0.0", 9369 | "vinyl-contents": "^2.0.0" 9370 | }, 9371 | "engines": { 9372 | "node": ">=10.13.0" 9373 | } 9374 | }, 9375 | "node_modules/vite": { 9376 | "version": "4.5.3", 9377 | "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.3.tgz", 9378 | "integrity": "sha512-kQL23kMeX92v3ph7IauVkXkikdDRsYMGTVl5KY2E9OY4ONLvkHf04MDTbnfo6NKxZiDLWzVpP5oTa8hQD8U3dg==", 9379 | "dependencies": { 9380 | "esbuild": "^0.18.10", 9381 | "postcss": "^8.4.27", 9382 | "rollup": "^3.27.1" 9383 | }, 9384 | "bin": { 9385 | "vite": "bin/vite.js" 9386 | }, 9387 | "engines": { 9388 | "node": "^14.18.0 || >=16.0.0" 9389 | }, 9390 | "funding": { 9391 | "url": "https://github.com/vitejs/vite?sponsor=1" 9392 | }, 9393 | "optionalDependencies": { 9394 | "fsevents": "~2.3.2" 9395 | }, 9396 | "peerDependencies": { 9397 | "@types/node": ">= 14", 9398 | "less": "*", 9399 | "lightningcss": "^1.21.0", 9400 | "sass": "*", 9401 | "stylus": "*", 9402 | "sugarss": "*", 9403 | "terser": "^5.4.0" 9404 | }, 9405 | "peerDependenciesMeta": { 9406 | "@types/node": { 9407 | "optional": true 9408 | }, 9409 | "less": { 9410 | "optional": true 9411 | }, 9412 | "lightningcss": { 9413 | "optional": true 9414 | }, 9415 | "sass": { 9416 | "optional": true 9417 | }, 9418 | "stylus": { 9419 | "optional": true 9420 | }, 9421 | "sugarss": { 9422 | "optional": true 9423 | }, 9424 | "terser": { 9425 | "optional": true 9426 | } 9427 | } 9428 | }, 9429 | "node_modules/vite-node": { 9430 | "version": "1.6.0", 9431 | "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-1.6.0.tgz", 9432 | "integrity": "sha512-de6HJgzC+TFzOu0NTC4RAIsyf/DY/ibWDYQUcuEA84EMHhcefTUGkjFHKKEJhQN4A+6I0u++kr3l36ZF2d7XRw==", 9433 | "dev": true, 9434 | "dependencies": { 9435 | "cac": "^6.7.14", 9436 | "debug": "^4.3.4", 9437 | "pathe": "^1.1.1", 9438 | "picocolors": "^1.0.0", 9439 | "vite": "^5.0.0" 9440 | }, 9441 | "bin": { 9442 | "vite-node": "vite-node.mjs" 9443 | }, 9444 | "engines": { 9445 | "node": "^18.0.0 || >=20.0.0" 9446 | }, 9447 | "funding": { 9448 | "url": "https://opencollective.com/vitest" 9449 | } 9450 | }, 9451 | "node_modules/vite-node/node_modules/rollup": { 9452 | "version": "4.17.2", 9453 | "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.17.2.tgz", 9454 | "integrity": "sha512-/9ClTJPByC0U4zNLowV1tMBe8yMEAxewtR3cUNX5BoEpGH3dQEWpJLr6CLp0fPdYRF/fzVOgvDb1zXuakwF5kQ==", 9455 | "dev": true, 9456 | "dependencies": { 9457 | "@types/estree": "1.0.5" 9458 | }, 9459 | "bin": { 9460 | "rollup": "dist/bin/rollup" 9461 | }, 9462 | "engines": { 9463 | "node": ">=18.0.0", 9464 | "npm": ">=8.0.0" 9465 | }, 9466 | "optionalDependencies": { 9467 | "@rollup/rollup-android-arm-eabi": "4.17.2", 9468 | "@rollup/rollup-android-arm64": "4.17.2", 9469 | "@rollup/rollup-darwin-arm64": "4.17.2", 9470 | "@rollup/rollup-darwin-x64": "4.17.2", 9471 | "@rollup/rollup-linux-arm-gnueabihf": "4.17.2", 9472 | "@rollup/rollup-linux-arm-musleabihf": "4.17.2", 9473 | "@rollup/rollup-linux-arm64-gnu": "4.17.2", 9474 | "@rollup/rollup-linux-arm64-musl": "4.17.2", 9475 | "@rollup/rollup-linux-powerpc64le-gnu": "4.17.2", 9476 | "@rollup/rollup-linux-riscv64-gnu": "4.17.2", 9477 | "@rollup/rollup-linux-s390x-gnu": "4.17.2", 9478 | "@rollup/rollup-linux-x64-gnu": "4.17.2", 9479 | "@rollup/rollup-linux-x64-musl": "4.17.2", 9480 | "@rollup/rollup-win32-arm64-msvc": "4.17.2", 9481 | "@rollup/rollup-win32-ia32-msvc": "4.17.2", 9482 | "@rollup/rollup-win32-x64-msvc": "4.17.2", 9483 | "fsevents": "~2.3.2" 9484 | } 9485 | }, 9486 | "node_modules/vite-node/node_modules/vite": { 9487 | "version": "5.2.11", 9488 | "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.11.tgz", 9489 | "integrity": "sha512-HndV31LWW05i1BLPMUCE1B9E9GFbOu1MbenhS58FuK6owSO5qHm7GiCotrNY1YE5rMeQSFBGmT5ZaLEjFizgiQ==", 9490 | "dev": true, 9491 | "dependencies": { 9492 | "esbuild": "^0.20.1", 9493 | "postcss": "^8.4.38", 9494 | "rollup": "^4.13.0" 9495 | }, 9496 | "bin": { 9497 | "vite": "bin/vite.js" 9498 | }, 9499 | "engines": { 9500 | "node": "^18.0.0 || >=20.0.0" 9501 | }, 9502 | "funding": { 9503 | "url": "https://github.com/vitejs/vite?sponsor=1" 9504 | }, 9505 | "optionalDependencies": { 9506 | "fsevents": "~2.3.3" 9507 | }, 9508 | "peerDependencies": { 9509 | "@types/node": "^18.0.0 || >=20.0.0", 9510 | "less": "*", 9511 | "lightningcss": "^1.21.0", 9512 | "sass": "*", 9513 | "stylus": "*", 9514 | "sugarss": "*", 9515 | "terser": "^5.4.0" 9516 | }, 9517 | "peerDependenciesMeta": { 9518 | "@types/node": { 9519 | "optional": true 9520 | }, 9521 | "less": { 9522 | "optional": true 9523 | }, 9524 | "lightningcss": { 9525 | "optional": true 9526 | }, 9527 | "sass": { 9528 | "optional": true 9529 | }, 9530 | "stylus": { 9531 | "optional": true 9532 | }, 9533 | "sugarss": { 9534 | "optional": true 9535 | }, 9536 | "terser": { 9537 | "optional": true 9538 | } 9539 | } 9540 | }, 9541 | "node_modules/vite/node_modules/@esbuild/android-arm": { 9542 | "version": "0.18.20", 9543 | "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", 9544 | "integrity": "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==", 9545 | "cpu": [ 9546 | "arm" 9547 | ], 9548 | "optional": true, 9549 | "os": [ 9550 | "android" 9551 | ], 9552 | "engines": { 9553 | "node": ">=12" 9554 | } 9555 | }, 9556 | "node_modules/vite/node_modules/@esbuild/android-arm64": { 9557 | "version": "0.18.20", 9558 | "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz", 9559 | "integrity": "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==", 9560 | "cpu": [ 9561 | "arm64" 9562 | ], 9563 | "optional": true, 9564 | "os": [ 9565 | "android" 9566 | ], 9567 | "engines": { 9568 | "node": ">=12" 9569 | } 9570 | }, 9571 | "node_modules/vite/node_modules/@esbuild/android-x64": { 9572 | "version": "0.18.20", 9573 | "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.20.tgz", 9574 | "integrity": "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==", 9575 | "cpu": [ 9576 | "x64" 9577 | ], 9578 | "optional": true, 9579 | "os": [ 9580 | "android" 9581 | ], 9582 | "engines": { 9583 | "node": ">=12" 9584 | } 9585 | }, 9586 | "node_modules/vite/node_modules/@esbuild/darwin-arm64": { 9587 | "version": "0.18.20", 9588 | "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz", 9589 | "integrity": "sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==", 9590 | "cpu": [ 9591 | "arm64" 9592 | ], 9593 | "optional": true, 9594 | "os": [ 9595 | "darwin" 9596 | ], 9597 | "engines": { 9598 | "node": ">=12" 9599 | } 9600 | }, 9601 | "node_modules/vite/node_modules/@esbuild/darwin-x64": { 9602 | "version": "0.18.20", 9603 | "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz", 9604 | "integrity": "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==", 9605 | "cpu": [ 9606 | "x64" 9607 | ], 9608 | "optional": true, 9609 | "os": [ 9610 | "darwin" 9611 | ], 9612 | "engines": { 9613 | "node": ">=12" 9614 | } 9615 | }, 9616 | "node_modules/vite/node_modules/@esbuild/freebsd-arm64": { 9617 | "version": "0.18.20", 9618 | "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz", 9619 | "integrity": "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==", 9620 | "cpu": [ 9621 | "arm64" 9622 | ], 9623 | "optional": true, 9624 | "os": [ 9625 | "freebsd" 9626 | ], 9627 | "engines": { 9628 | "node": ">=12" 9629 | } 9630 | }, 9631 | "node_modules/vite/node_modules/@esbuild/freebsd-x64": { 9632 | "version": "0.18.20", 9633 | "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz", 9634 | "integrity": "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==", 9635 | "cpu": [ 9636 | "x64" 9637 | ], 9638 | "optional": true, 9639 | "os": [ 9640 | "freebsd" 9641 | ], 9642 | "engines": { 9643 | "node": ">=12" 9644 | } 9645 | }, 9646 | "node_modules/vite/node_modules/@esbuild/linux-arm": { 9647 | "version": "0.18.20", 9648 | "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz", 9649 | "integrity": "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==", 9650 | "cpu": [ 9651 | "arm" 9652 | ], 9653 | "optional": true, 9654 | "os": [ 9655 | "linux" 9656 | ], 9657 | "engines": { 9658 | "node": ">=12" 9659 | } 9660 | }, 9661 | "node_modules/vite/node_modules/@esbuild/linux-arm64": { 9662 | "version": "0.18.20", 9663 | "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz", 9664 | "integrity": "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==", 9665 | "cpu": [ 9666 | "arm64" 9667 | ], 9668 | "optional": true, 9669 | "os": [ 9670 | "linux" 9671 | ], 9672 | "engines": { 9673 | "node": ">=12" 9674 | } 9675 | }, 9676 | "node_modules/vite/node_modules/@esbuild/linux-ia32": { 9677 | "version": "0.18.20", 9678 | "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz", 9679 | "integrity": "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==", 9680 | "cpu": [ 9681 | "ia32" 9682 | ], 9683 | "optional": true, 9684 | "os": [ 9685 | "linux" 9686 | ], 9687 | "engines": { 9688 | "node": ">=12" 9689 | } 9690 | }, 9691 | "node_modules/vite/node_modules/@esbuild/linux-loong64": { 9692 | "version": "0.18.20", 9693 | "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz", 9694 | "integrity": "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==", 9695 | "cpu": [ 9696 | "loong64" 9697 | ], 9698 | "optional": true, 9699 | "os": [ 9700 | "linux" 9701 | ], 9702 | "engines": { 9703 | "node": ">=12" 9704 | } 9705 | }, 9706 | "node_modules/vite/node_modules/@esbuild/linux-mips64el": { 9707 | "version": "0.18.20", 9708 | "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz", 9709 | "integrity": "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==", 9710 | "cpu": [ 9711 | "mips64el" 9712 | ], 9713 | "optional": true, 9714 | "os": [ 9715 | "linux" 9716 | ], 9717 | "engines": { 9718 | "node": ">=12" 9719 | } 9720 | }, 9721 | "node_modules/vite/node_modules/@esbuild/linux-ppc64": { 9722 | "version": "0.18.20", 9723 | "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz", 9724 | "integrity": "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==", 9725 | "cpu": [ 9726 | "ppc64" 9727 | ], 9728 | "optional": true, 9729 | "os": [ 9730 | "linux" 9731 | ], 9732 | "engines": { 9733 | "node": ">=12" 9734 | } 9735 | }, 9736 | "node_modules/vite/node_modules/@esbuild/linux-riscv64": { 9737 | "version": "0.18.20", 9738 | "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz", 9739 | "integrity": "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==", 9740 | "cpu": [ 9741 | "riscv64" 9742 | ], 9743 | "optional": true, 9744 | "os": [ 9745 | "linux" 9746 | ], 9747 | "engines": { 9748 | "node": ">=12" 9749 | } 9750 | }, 9751 | "node_modules/vite/node_modules/@esbuild/linux-s390x": { 9752 | "version": "0.18.20", 9753 | "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz", 9754 | "integrity": "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==", 9755 | "cpu": [ 9756 | "s390x" 9757 | ], 9758 | "optional": true, 9759 | "os": [ 9760 | "linux" 9761 | ], 9762 | "engines": { 9763 | "node": ">=12" 9764 | } 9765 | }, 9766 | "node_modules/vite/node_modules/@esbuild/linux-x64": { 9767 | "version": "0.18.20", 9768 | "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz", 9769 | "integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==", 9770 | "cpu": [ 9771 | "x64" 9772 | ], 9773 | "optional": true, 9774 | "os": [ 9775 | "linux" 9776 | ], 9777 | "engines": { 9778 | "node": ">=12" 9779 | } 9780 | }, 9781 | "node_modules/vite/node_modules/@esbuild/netbsd-x64": { 9782 | "version": "0.18.20", 9783 | "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz", 9784 | "integrity": "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==", 9785 | "cpu": [ 9786 | "x64" 9787 | ], 9788 | "optional": true, 9789 | "os": [ 9790 | "netbsd" 9791 | ], 9792 | "engines": { 9793 | "node": ">=12" 9794 | } 9795 | }, 9796 | "node_modules/vite/node_modules/@esbuild/openbsd-x64": { 9797 | "version": "0.18.20", 9798 | "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz", 9799 | "integrity": "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==", 9800 | "cpu": [ 9801 | "x64" 9802 | ], 9803 | "optional": true, 9804 | "os": [ 9805 | "openbsd" 9806 | ], 9807 | "engines": { 9808 | "node": ">=12" 9809 | } 9810 | }, 9811 | "node_modules/vite/node_modules/@esbuild/sunos-x64": { 9812 | "version": "0.18.20", 9813 | "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz", 9814 | "integrity": "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==", 9815 | "cpu": [ 9816 | "x64" 9817 | ], 9818 | "optional": true, 9819 | "os": [ 9820 | "sunos" 9821 | ], 9822 | "engines": { 9823 | "node": ">=12" 9824 | } 9825 | }, 9826 | "node_modules/vite/node_modules/@esbuild/win32-arm64": { 9827 | "version": "0.18.20", 9828 | "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz", 9829 | "integrity": "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==", 9830 | "cpu": [ 9831 | "arm64" 9832 | ], 9833 | "optional": true, 9834 | "os": [ 9835 | "win32" 9836 | ], 9837 | "engines": { 9838 | "node": ">=12" 9839 | } 9840 | }, 9841 | "node_modules/vite/node_modules/@esbuild/win32-ia32": { 9842 | "version": "0.18.20", 9843 | "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz", 9844 | "integrity": "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==", 9845 | "cpu": [ 9846 | "ia32" 9847 | ], 9848 | "optional": true, 9849 | "os": [ 9850 | "win32" 9851 | ], 9852 | "engines": { 9853 | "node": ">=12" 9854 | } 9855 | }, 9856 | "node_modules/vite/node_modules/@esbuild/win32-x64": { 9857 | "version": "0.18.20", 9858 | "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz", 9859 | "integrity": "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==", 9860 | "cpu": [ 9861 | "x64" 9862 | ], 9863 | "optional": true, 9864 | "os": [ 9865 | "win32" 9866 | ], 9867 | "engines": { 9868 | "node": ">=12" 9869 | } 9870 | }, 9871 | "node_modules/vite/node_modules/esbuild": { 9872 | "version": "0.18.20", 9873 | "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz", 9874 | "integrity": "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==", 9875 | "hasInstallScript": true, 9876 | "bin": { 9877 | "esbuild": "bin/esbuild" 9878 | }, 9879 | "engines": { 9880 | "node": ">=12" 9881 | }, 9882 | "optionalDependencies": { 9883 | "@esbuild/android-arm": "0.18.20", 9884 | "@esbuild/android-arm64": "0.18.20", 9885 | "@esbuild/android-x64": "0.18.20", 9886 | "@esbuild/darwin-arm64": "0.18.20", 9887 | "@esbuild/darwin-x64": "0.18.20", 9888 | "@esbuild/freebsd-arm64": "0.18.20", 9889 | "@esbuild/freebsd-x64": "0.18.20", 9890 | "@esbuild/linux-arm": "0.18.20", 9891 | "@esbuild/linux-arm64": "0.18.20", 9892 | "@esbuild/linux-ia32": "0.18.20", 9893 | "@esbuild/linux-loong64": "0.18.20", 9894 | "@esbuild/linux-mips64el": "0.18.20", 9895 | "@esbuild/linux-ppc64": "0.18.20", 9896 | "@esbuild/linux-riscv64": "0.18.20", 9897 | "@esbuild/linux-s390x": "0.18.20", 9898 | "@esbuild/linux-x64": "0.18.20", 9899 | "@esbuild/netbsd-x64": "0.18.20", 9900 | "@esbuild/openbsd-x64": "0.18.20", 9901 | "@esbuild/sunos-x64": "0.18.20", 9902 | "@esbuild/win32-arm64": "0.18.20", 9903 | "@esbuild/win32-ia32": "0.18.20", 9904 | "@esbuild/win32-x64": "0.18.20" 9905 | } 9906 | }, 9907 | "node_modules/vitefu": { 9908 | "version": "0.2.5", 9909 | "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-0.2.5.tgz", 9910 | "integrity": "sha512-SgHtMLoqaeeGnd2evZ849ZbACbnwQCIwRH57t18FxcXoZop0uQu0uzlIhJBlF/eWVzuce0sHeqPcDo+evVcg8Q==", 9911 | "peerDependencies": { 9912 | "vite": "^3.0.0 || ^4.0.0 || ^5.0.0" 9913 | }, 9914 | "peerDependenciesMeta": { 9915 | "vite": { 9916 | "optional": true 9917 | } 9918 | } 9919 | }, 9920 | "node_modules/vitest": { 9921 | "version": "1.6.0", 9922 | "resolved": "https://registry.npmjs.org/vitest/-/vitest-1.6.0.tgz", 9923 | "integrity": "sha512-H5r/dN06swuFnzNFhq/dnz37bPXnq8xB2xB5JOVk8K09rUtoeNN+LHWkoQ0A/i3hvbUKKcCei9KpbxqHMLhLLA==", 9924 | "dev": true, 9925 | "dependencies": { 9926 | "@vitest/expect": "1.6.0", 9927 | "@vitest/runner": "1.6.0", 9928 | "@vitest/snapshot": "1.6.0", 9929 | "@vitest/spy": "1.6.0", 9930 | "@vitest/utils": "1.6.0", 9931 | "acorn-walk": "^8.3.2", 9932 | "chai": "^4.3.10", 9933 | "debug": "^4.3.4", 9934 | "execa": "^8.0.1", 9935 | "local-pkg": "^0.5.0", 9936 | "magic-string": "^0.30.5", 9937 | "pathe": "^1.1.1", 9938 | "picocolors": "^1.0.0", 9939 | "std-env": "^3.5.0", 9940 | "strip-literal": "^2.0.0", 9941 | "tinybench": "^2.5.1", 9942 | "tinypool": "^0.8.3", 9943 | "vite": "^5.0.0", 9944 | "vite-node": "1.6.0", 9945 | "why-is-node-running": "^2.2.2" 9946 | }, 9947 | "bin": { 9948 | "vitest": "vitest.mjs" 9949 | }, 9950 | "engines": { 9951 | "node": "^18.0.0 || >=20.0.0" 9952 | }, 9953 | "funding": { 9954 | "url": "https://opencollective.com/vitest" 9955 | }, 9956 | "peerDependencies": { 9957 | "@edge-runtime/vm": "*", 9958 | "@types/node": "^18.0.0 || >=20.0.0", 9959 | "@vitest/browser": "1.6.0", 9960 | "@vitest/ui": "1.6.0", 9961 | "happy-dom": "*", 9962 | "jsdom": "*" 9963 | }, 9964 | "peerDependenciesMeta": { 9965 | "@edge-runtime/vm": { 9966 | "optional": true 9967 | }, 9968 | "@types/node": { 9969 | "optional": true 9970 | }, 9971 | "@vitest/browser": { 9972 | "optional": true 9973 | }, 9974 | "@vitest/ui": { 9975 | "optional": true 9976 | }, 9977 | "happy-dom": { 9978 | "optional": true 9979 | }, 9980 | "jsdom": { 9981 | "optional": true 9982 | } 9983 | } 9984 | }, 9985 | "node_modules/vitest/node_modules/execa": { 9986 | "version": "8.0.1", 9987 | "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz", 9988 | "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==", 9989 | "dev": true, 9990 | "dependencies": { 9991 | "cross-spawn": "^7.0.3", 9992 | "get-stream": "^8.0.1", 9993 | "human-signals": "^5.0.0", 9994 | "is-stream": "^3.0.0", 9995 | "merge-stream": "^2.0.0", 9996 | "npm-run-path": "^5.1.0", 9997 | "onetime": "^6.0.0", 9998 | "signal-exit": "^4.1.0", 9999 | "strip-final-newline": "^3.0.0" 10000 | }, 10001 | "engines": { 10002 | "node": ">=16.17" 10003 | }, 10004 | "funding": { 10005 | "url": "https://github.com/sindresorhus/execa?sponsor=1" 10006 | } 10007 | }, 10008 | "node_modules/vitest/node_modules/get-stream": { 10009 | "version": "8.0.1", 10010 | "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz", 10011 | "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", 10012 | "dev": true, 10013 | "engines": { 10014 | "node": ">=16" 10015 | }, 10016 | "funding": { 10017 | "url": "https://github.com/sponsors/sindresorhus" 10018 | } 10019 | }, 10020 | "node_modules/vitest/node_modules/human-signals": { 10021 | "version": "5.0.0", 10022 | "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz", 10023 | "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", 10024 | "dev": true, 10025 | "engines": { 10026 | "node": ">=16.17.0" 10027 | } 10028 | }, 10029 | "node_modules/vitest/node_modules/is-stream": { 10030 | "version": "3.0.0", 10031 | "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", 10032 | "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==", 10033 | "dev": true, 10034 | "engines": { 10035 | "node": "^12.20.0 || ^14.13.1 || >=16.0.0" 10036 | }, 10037 | "funding": { 10038 | "url": "https://github.com/sponsors/sindresorhus" 10039 | } 10040 | }, 10041 | "node_modules/vitest/node_modules/mimic-fn": { 10042 | "version": "4.0.0", 10043 | "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz", 10044 | "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==", 10045 | "dev": true, 10046 | "engines": { 10047 | "node": ">=12" 10048 | }, 10049 | "funding": { 10050 | "url": "https://github.com/sponsors/sindresorhus" 10051 | } 10052 | }, 10053 | "node_modules/vitest/node_modules/npm-run-path": { 10054 | "version": "5.3.0", 10055 | "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz", 10056 | "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==", 10057 | "dev": true, 10058 | "dependencies": { 10059 | "path-key": "^4.0.0" 10060 | }, 10061 | "engines": { 10062 | "node": "^12.20.0 || ^14.13.1 || >=16.0.0" 10063 | }, 10064 | "funding": { 10065 | "url": "https://github.com/sponsors/sindresorhus" 10066 | } 10067 | }, 10068 | "node_modules/vitest/node_modules/onetime": { 10069 | "version": "6.0.0", 10070 | "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", 10071 | "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==", 10072 | "dev": true, 10073 | "dependencies": { 10074 | "mimic-fn": "^4.0.0" 10075 | }, 10076 | "engines": { 10077 | "node": ">=12" 10078 | }, 10079 | "funding": { 10080 | "url": "https://github.com/sponsors/sindresorhus" 10081 | } 10082 | }, 10083 | "node_modules/vitest/node_modules/path-key": { 10084 | "version": "4.0.0", 10085 | "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz", 10086 | "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==", 10087 | "dev": true, 10088 | "engines": { 10089 | "node": ">=12" 10090 | }, 10091 | "funding": { 10092 | "url": "https://github.com/sponsors/sindresorhus" 10093 | } 10094 | }, 10095 | "node_modules/vitest/node_modules/rollup": { 10096 | "version": "4.17.2", 10097 | "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.17.2.tgz", 10098 | "integrity": "sha512-/9ClTJPByC0U4zNLowV1tMBe8yMEAxewtR3cUNX5BoEpGH3dQEWpJLr6CLp0fPdYRF/fzVOgvDb1zXuakwF5kQ==", 10099 | "dev": true, 10100 | "dependencies": { 10101 | "@types/estree": "1.0.5" 10102 | }, 10103 | "bin": { 10104 | "rollup": "dist/bin/rollup" 10105 | }, 10106 | "engines": { 10107 | "node": ">=18.0.0", 10108 | "npm": ">=8.0.0" 10109 | }, 10110 | "optionalDependencies": { 10111 | "@rollup/rollup-android-arm-eabi": "4.17.2", 10112 | "@rollup/rollup-android-arm64": "4.17.2", 10113 | "@rollup/rollup-darwin-arm64": "4.17.2", 10114 | "@rollup/rollup-darwin-x64": "4.17.2", 10115 | "@rollup/rollup-linux-arm-gnueabihf": "4.17.2", 10116 | "@rollup/rollup-linux-arm-musleabihf": "4.17.2", 10117 | "@rollup/rollup-linux-arm64-gnu": "4.17.2", 10118 | "@rollup/rollup-linux-arm64-musl": "4.17.2", 10119 | "@rollup/rollup-linux-powerpc64le-gnu": "4.17.2", 10120 | "@rollup/rollup-linux-riscv64-gnu": "4.17.2", 10121 | "@rollup/rollup-linux-s390x-gnu": "4.17.2", 10122 | "@rollup/rollup-linux-x64-gnu": "4.17.2", 10123 | "@rollup/rollup-linux-x64-musl": "4.17.2", 10124 | "@rollup/rollup-win32-arm64-msvc": "4.17.2", 10125 | "@rollup/rollup-win32-ia32-msvc": "4.17.2", 10126 | "@rollup/rollup-win32-x64-msvc": "4.17.2", 10127 | "fsevents": "~2.3.2" 10128 | } 10129 | }, 10130 | "node_modules/vitest/node_modules/strip-final-newline": { 10131 | "version": "3.0.0", 10132 | "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz", 10133 | "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==", 10134 | "dev": true, 10135 | "engines": { 10136 | "node": ">=12" 10137 | }, 10138 | "funding": { 10139 | "url": "https://github.com/sponsors/sindresorhus" 10140 | } 10141 | }, 10142 | "node_modules/vitest/node_modules/vite": { 10143 | "version": "5.2.11", 10144 | "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.11.tgz", 10145 | "integrity": "sha512-HndV31LWW05i1BLPMUCE1B9E9GFbOu1MbenhS58FuK6owSO5qHm7GiCotrNY1YE5rMeQSFBGmT5ZaLEjFizgiQ==", 10146 | "dev": true, 10147 | "dependencies": { 10148 | "esbuild": "^0.20.1", 10149 | "postcss": "^8.4.38", 10150 | "rollup": "^4.13.0" 10151 | }, 10152 | "bin": { 10153 | "vite": "bin/vite.js" 10154 | }, 10155 | "engines": { 10156 | "node": "^18.0.0 || >=20.0.0" 10157 | }, 10158 | "funding": { 10159 | "url": "https://github.com/vitejs/vite?sponsor=1" 10160 | }, 10161 | "optionalDependencies": { 10162 | "fsevents": "~2.3.3" 10163 | }, 10164 | "peerDependencies": { 10165 | "@types/node": "^18.0.0 || >=20.0.0", 10166 | "less": "*", 10167 | "lightningcss": "^1.21.0", 10168 | "sass": "*", 10169 | "stylus": "*", 10170 | "sugarss": "*", 10171 | "terser": "^5.4.0" 10172 | }, 10173 | "peerDependenciesMeta": { 10174 | "@types/node": { 10175 | "optional": true 10176 | }, 10177 | "less": { 10178 | "optional": true 10179 | }, 10180 | "lightningcss": { 10181 | "optional": true 10182 | }, 10183 | "sass": { 10184 | "optional": true 10185 | }, 10186 | "stylus": { 10187 | "optional": true 10188 | }, 10189 | "sugarss": { 10190 | "optional": true 10191 | }, 10192 | "terser": { 10193 | "optional": true 10194 | } 10195 | } 10196 | }, 10197 | "node_modules/vue-template-compiler": { 10198 | "version": "2.7.16", 10199 | "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.7.16.tgz", 10200 | "integrity": "sha512-AYbUWAJHLGGQM7+cNTELw+KsOG9nl2CnSv467WobS5Cv9uk3wFcnr1Etsz2sEIHEZvw1U+o9mRlEO6QbZvUPGQ==", 10201 | "dev": true, 10202 | "dependencies": { 10203 | "de-indent": "^1.0.2", 10204 | "he": "^1.2.0" 10205 | } 10206 | }, 10207 | "node_modules/w3c-keyname": { 10208 | "version": "2.2.8", 10209 | "resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz", 10210 | "integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==" 10211 | }, 10212 | "node_modules/walk-sync": { 10213 | "version": "2.2.0", 10214 | "resolved": "https://registry.npmjs.org/walk-sync/-/walk-sync-2.2.0.tgz", 10215 | "integrity": "sha512-IC8sL7aB4/ZgFcGI2T1LczZeFWZ06b3zoHH7jBPyHxOtIIz1jppWHjjEXkOFvFojBVAK9pV7g47xOZ4LW3QLfg==", 10216 | "dev": true, 10217 | "dependencies": { 10218 | "@types/minimatch": "^3.0.3", 10219 | "ensure-posix-path": "^1.1.0", 10220 | "matcher-collection": "^2.0.0", 10221 | "minimatch": "^3.0.4" 10222 | }, 10223 | "engines": { 10224 | "node": "8.* || >= 10.*" 10225 | } 10226 | }, 10227 | "node_modules/walk-sync/node_modules/brace-expansion": { 10228 | "version": "1.1.11", 10229 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 10230 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 10231 | "dev": true, 10232 | "dependencies": { 10233 | "balanced-match": "^1.0.0", 10234 | "concat-map": "0.0.1" 10235 | } 10236 | }, 10237 | "node_modules/walk-sync/node_modules/minimatch": { 10238 | "version": "3.1.2", 10239 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", 10240 | "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", 10241 | "dev": true, 10242 | "dependencies": { 10243 | "brace-expansion": "^1.1.7" 10244 | }, 10245 | "engines": { 10246 | "node": "*" 10247 | } 10248 | }, 10249 | "node_modules/web-worker": { 10250 | "version": "1.3.0", 10251 | "resolved": "https://registry.npmjs.org/web-worker/-/web-worker-1.3.0.tgz", 10252 | "integrity": "sha512-BSR9wyRsy/KOValMgd5kMyr3JzpdeoR9KVId8u5GVlTTAtNChlsE4yTxeY7zMdNSyOmoKBv8NH2qeRY9Tg+IaA==" 10253 | }, 10254 | "node_modules/which": { 10255 | "version": "2.0.2", 10256 | "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", 10257 | "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", 10258 | "dev": true, 10259 | "dependencies": { 10260 | "isexe": "^2.0.0" 10261 | }, 10262 | "bin": { 10263 | "node-which": "bin/node-which" 10264 | }, 10265 | "engines": { 10266 | "node": ">= 8" 10267 | } 10268 | }, 10269 | "node_modules/why-is-node-running": { 10270 | "version": "2.2.2", 10271 | "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.2.2.tgz", 10272 | "integrity": "sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==", 10273 | "dev": true, 10274 | "dependencies": { 10275 | "siginfo": "^2.0.0", 10276 | "stackback": "0.0.2" 10277 | }, 10278 | "bin": { 10279 | "why-is-node-running": "cli.js" 10280 | }, 10281 | "engines": { 10282 | "node": ">=8" 10283 | } 10284 | }, 10285 | "node_modules/wrap-ansi": { 10286 | "version": "8.1.0", 10287 | "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", 10288 | "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", 10289 | "dev": true, 10290 | "dependencies": { 10291 | "ansi-styles": "^6.1.0", 10292 | "string-width": "^5.0.1", 10293 | "strip-ansi": "^7.0.1" 10294 | }, 10295 | "engines": { 10296 | "node": ">=12" 10297 | }, 10298 | "funding": { 10299 | "url": "https://github.com/chalk/wrap-ansi?sponsor=1" 10300 | } 10301 | }, 10302 | "node_modules/wrap-ansi-cjs": { 10303 | "name": "wrap-ansi", 10304 | "version": "7.0.0", 10305 | "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", 10306 | "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", 10307 | "dev": true, 10308 | "dependencies": { 10309 | "ansi-styles": "^4.0.0", 10310 | "string-width": "^4.1.0", 10311 | "strip-ansi": "^6.0.0" 10312 | }, 10313 | "engines": { 10314 | "node": ">=10" 10315 | }, 10316 | "funding": { 10317 | "url": "https://github.com/chalk/wrap-ansi?sponsor=1" 10318 | } 10319 | }, 10320 | "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { 10321 | "version": "8.0.0", 10322 | "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", 10323 | "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", 10324 | "dev": true 10325 | }, 10326 | "node_modules/wrap-ansi-cjs/node_modules/string-width": { 10327 | "version": "4.2.3", 10328 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", 10329 | "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", 10330 | "dev": true, 10331 | "dependencies": { 10332 | "emoji-regex": "^8.0.0", 10333 | "is-fullwidth-code-point": "^3.0.0", 10334 | "strip-ansi": "^6.0.1" 10335 | }, 10336 | "engines": { 10337 | "node": ">=8" 10338 | } 10339 | }, 10340 | "node_modules/wrap-ansi/node_modules/ansi-regex": { 10341 | "version": "6.0.1", 10342 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", 10343 | "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", 10344 | "dev": true, 10345 | "engines": { 10346 | "node": ">=12" 10347 | }, 10348 | "funding": { 10349 | "url": "https://github.com/chalk/ansi-regex?sponsor=1" 10350 | } 10351 | }, 10352 | "node_modules/wrap-ansi/node_modules/ansi-styles": { 10353 | "version": "6.2.1", 10354 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", 10355 | "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", 10356 | "dev": true, 10357 | "engines": { 10358 | "node": ">=12" 10359 | }, 10360 | "funding": { 10361 | "url": "https://github.com/chalk/ansi-styles?sponsor=1" 10362 | } 10363 | }, 10364 | "node_modules/wrap-ansi/node_modules/strip-ansi": { 10365 | "version": "7.1.0", 10366 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", 10367 | "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", 10368 | "dev": true, 10369 | "dependencies": { 10370 | "ansi-regex": "^6.0.1" 10371 | }, 10372 | "engines": { 10373 | "node": ">=12" 10374 | }, 10375 | "funding": { 10376 | "url": "https://github.com/chalk/strip-ansi?sponsor=1" 10377 | } 10378 | }, 10379 | "node_modules/wrappy": { 10380 | "version": "1.0.2", 10381 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 10382 | "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" 10383 | }, 10384 | "node_modules/ws": { 10385 | "version": "8.17.1", 10386 | "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", 10387 | "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", 10388 | "engines": { 10389 | "node": ">=10.0.0" 10390 | }, 10391 | "peerDependencies": { 10392 | "bufferutil": "^4.0.1", 10393 | "utf-8-validate": ">=5.0.2" 10394 | }, 10395 | "peerDependenciesMeta": { 10396 | "bufferutil": { 10397 | "optional": true 10398 | }, 10399 | "utf-8-validate": { 10400 | "optional": true 10401 | } 10402 | } 10403 | }, 10404 | "node_modules/xmlhttprequest-ssl": { 10405 | "version": "2.0.0", 10406 | "resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz", 10407 | "integrity": "sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==", 10408 | "engines": { 10409 | "node": ">=0.4.0" 10410 | } 10411 | }, 10412 | "node_modules/xtend": { 10413 | "version": "4.0.2", 10414 | "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", 10415 | "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", 10416 | "dev": true, 10417 | "engines": { 10418 | "node": ">=0.4" 10419 | } 10420 | }, 10421 | "node_modules/yallist": { 10422 | "version": "4.0.0", 10423 | "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", 10424 | "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", 10425 | "dev": true 10426 | }, 10427 | "node_modules/yaml": { 10428 | "version": "1.10.2", 10429 | "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", 10430 | "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", 10431 | "dev": true, 10432 | "engines": { 10433 | "node": ">= 6" 10434 | } 10435 | }, 10436 | "node_modules/yauzl": { 10437 | "version": "2.10.0", 10438 | "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", 10439 | "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", 10440 | "dev": true, 10441 | "dependencies": { 10442 | "buffer-crc32": "~0.2.3", 10443 | "fd-slicer": "~1.1.0" 10444 | } 10445 | }, 10446 | "node_modules/yocto-queue": { 10447 | "version": "0.1.0", 10448 | "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", 10449 | "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", 10450 | "dev": true, 10451 | "engines": { 10452 | "node": ">=10" 10453 | }, 10454 | "funding": { 10455 | "url": "https://github.com/sponsors/sindresorhus" 10456 | } 10457 | } 10458 | } 10459 | } ``````` `\\?\D:\Coding\ai\package.json`: ```````json 1 | { 2 | "name": "open-webui", 3 | "version": "0.3.10", 4 | "private": true, 5 | "scripts": { 6 | "dev": "npm run pyodide:fetch && vite dev --host", 7 | "build": "npm run pyodide:fetch && vite build", 8 | "preview": "vite preview", 9 | "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", 10 | "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", 11 | "lint": "npm run lint:frontend ; npm run lint:types ; npm run lint:backend", 12 | "lint:frontend": "eslint . --fix", 13 | "lint:types": "npm run check", 14 | "lint:backend": "pylint backend/", 15 | "format": "prettier --plugin-search-dir --write \"**/*.{js,ts,svelte,css,md,html,json}\"", 16 | "format:backend": "black . --exclude \".venv/|/venv/\"", 17 | "i18n:parse": "i18next --config i18next-parser.config.ts && prettier --write \"src/lib/i18n/**/*.{js,json}\"", 18 | "cy:open": "cypress open", 19 | "test:frontend": "vitest --passWithNoTests", 20 | "pyodide:fetch": "node scripts/prepare-pyodide.js" 21 | }, 22 | "devDependencies": { 23 | "@sveltejs/adapter-auto": "^2.0.0", 24 | "@sveltejs/adapter-static": "^2.0.3", 25 | "@sveltejs/kit": "^1.30.0", 26 | "@tailwindcss/typography": "^0.5.10", 27 | "@types/bun": "latest", 28 | "@typescript-eslint/eslint-plugin": "^6.17.0", 29 | "@typescript-eslint/parser": "^6.17.0", 30 | "autoprefixer": "^10.4.16", 31 | "cypress": "^13.8.1", 32 | "eslint": "^8.56.0", 33 | "eslint-config-prettier": "^8.5.0", 34 | "eslint-plugin-cypress": "^3.0.2", 35 | "eslint-plugin-svelte": "^2.30.0", 36 | "i18next-parser": "^8.13.0", 37 | "postcss": "^8.4.31", 38 | "prettier": "^2.8.0", 39 | "prettier-plugin-svelte": "^2.10.1", 40 | "svelte": "^4.0.5", 41 | "svelte-check": "^3.4.3", 42 | "svelte-confetti": "^1.3.2", 43 | "tailwindcss": "^3.3.3", 44 | "tslib": "^2.4.1", 45 | "typescript": "^5.0.0", 46 | "vite": "^4.4.2", 47 | "vitest": "^1.6.0" 48 | }, 49 | "type": "module", 50 | "dependencies": { 51 | "@codemirror/lang-javascript": "^6.2.2", 52 | "@codemirror/lang-python": "^6.1.6", 53 | "@codemirror/theme-one-dark": "^6.1.2", 54 | "@pyscript/core": "^0.4.32", 55 | "@sveltejs/adapter-node": "^1.3.1", 56 | "async": "^3.2.5", 57 | "bits-ui": "^0.19.7", 58 | "codemirror": "^6.0.1", 59 | "crc-32": "^1.2.2", 60 | "dayjs": "^1.11.10", 61 | "eventsource-parser": "^1.1.2", 62 | "file-saver": "^2.0.5", 63 | "highlight.js": "^11.9.0", 64 | "i18next": "^23.10.0", 65 | "i18next-browser-languagedetector": "^7.2.0", 66 | "i18next-resources-to-backend": "^1.2.0", 67 | "idb": "^7.1.1", 68 | "js-sha256": "^0.10.1", 69 | "katex": "^0.16.9", 70 | "marked": "^9.1.0", 71 | "mermaid": "^10.9.1", 72 | "pyodide": "^0.26.1", 73 | "socket.io-client": "^4.2.0", 74 | "sortablejs": "^1.15.2", 75 | "svelte-sonner": "^0.3.19", 76 | "tippy.js": "^6.3.7", 77 | "turndown": "^7.2.0", 78 | "uuid": "^9.0.1" 79 | } 80 | } ``````` `\\?\D:\Coding\ai\postcss.config.js`: ```````js 1 | export default { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {} 5 | } 6 | }; ``````` `\\?\D:\Coding\ai\pyproject.toml`: ```````toml 1 | [project] 2 | name = "open-webui" 3 | description = "Open WebUI (Formerly Ollama WebUI)" 4 | authors = [ 5 | { name = "Timothy Jaeryang Baek", email = "tim@openwebui.com" } 6 | ] 7 | license = { file = "LICENSE" } 8 | dependencies = [ 9 | "fastapi==0.111.0", 10 | "uvicorn[standard]==0.22.0", 11 | "pydantic==2.7.1", 12 | "python-multipart==0.0.9", 13 | 14 | "Flask==3.0.3", 15 | "Flask-Cors==4.0.1", 16 | 17 | "python-socketio==5.11.2", 18 | "python-jose==3.3.0", 19 | "passlib[bcrypt]==1.7.4", 20 | 21 | "requests==2.32.2", 22 | "aiohttp==3.9.5", 23 | "peewee==3.17.5", 24 | "peewee-migrate==1.12.2", 25 | "psycopg2-binary==2.9.9", 26 | "PyMySQL==1.1.0", 27 | "bcrypt==4.1.3", 28 | 29 | "boto3==1.34.110", 30 | 31 | "argon2-cffi==23.1.0", 32 | "APScheduler==3.10.4", 33 | "google-generativeai==0.5.4", 34 | 35 | "langchain==0.2.0", 36 | "langchain-community==0.2.0", 37 | "langchain-chroma==0.1.1", 38 | 39 | "fake-useragent==1.5.1", 40 | "chromadb==0.5.0", 41 | "sentence-transformers==2.7.0", 42 | "pypdf==4.2.0", 43 | "docx2txt==0.8", 44 | "unstructured==0.14.0", 45 | "Markdown==3.6", 46 | "pypandoc==1.13", 47 | "pandas==2.2.2", 48 | "openpyxl==3.1.2", 49 | "pyxlsb==1.0.10", 50 | "xlrd==2.0.1", 51 | "validators==0.28.1", 52 | 53 | "opencv-python-headless==4.9.0.80", 54 | "rapidocr-onnxruntime==1.3.22", 55 | 56 | "fpdf2==2.7.9", 57 | "rank-bm25==0.2.2", 58 | 59 | "faster-whisper==1.0.2", 60 | 61 | "PyJWT[crypto]==2.8.0", 62 | "authlib==1.3.1", 63 | 64 | "black==24.4.2", 65 | "langfuse==2.33.0", 66 | "youtube-transcript-api==0.6.2", 67 | "pytube==15.0.0", 68 | "extract_msg", 69 | "pydub", 70 | "duckduckgo-search~=6.1.5" 71 | 72 | ] 73 | readme = "README.md" 74 | requires-python = ">= 3.11, < 3.12.0a1" 75 | dynamic = ["version"] 76 | classifiers = [ 77 | "Development Status :: 4 - Beta", 78 | "License :: OSI Approved :: MIT License", 79 | "Programming Language :: Python :: 3", 80 | "Programming Language :: Python :: 3.11", 81 | "Topic :: Communications :: Chat", 82 | "Topic :: Multimedia", 83 | ] 84 | 85 | [project.scripts] 86 | open-webui = "open_webui:app" 87 | 88 | [build-system] 89 | requires = ["hatchling"] 90 | build-backend = "hatchling.build" 91 | 92 | [tool.rye] 93 | managed = true 94 | dev-dependencies = [] 95 | 96 | [tool.hatch.metadata] 97 | allow-direct-references = true 98 | 99 | [tool.hatch.version] 100 | path = "package.json" 101 | pattern = '"version":\s*"(?P[^"]+)"' 102 | 103 | [tool.hatch.build.hooks.custom] # keep this for reading hooks from `hatch_build.py` 104 | 105 | [tool.hatch.build.targets.wheel] 106 | sources = ["backend"] 107 | exclude = [ 108 | ".dockerignore", 109 | ".gitignore", 110 | ".webui_secret_key", 111 | "dev.sh", 112 | "requirements.txt", 113 | "start.sh", 114 | "start_windows.bat", 115 | "webui.db", 116 | "chroma.sqlite3", 117 | ] 118 | force-include = { "CHANGELOG.md" = "open_webui/CHANGELOG.md", build = "open_webui/frontend" } ``````` `\\?\D:\Coding\ai\README.md`: ```````md 1 | # Open WebUI (Formerly Ollama WebUI) 👋 2 | 3 | ![GitHub stars](https://img.shields.io/github/stars/open-webui/open-webui?style=social) 4 | ![GitHub forks](https://img.shields.io/github/forks/open-webui/open-webui?style=social) 5 | ![GitHub watchers](https://img.shields.io/github/watchers/open-webui/open-webui?style=social) 6 | ![GitHub repo size](https://img.shields.io/github/repo-size/open-webui/open-webui) 7 | ![GitHub language count](https://img.shields.io/github/languages/count/open-webui/open-webui) 8 | ![GitHub top language](https://img.shields.io/github/languages/top/open-webui/open-webui) 9 | ![GitHub last commit](https://img.shields.io/github/last-commit/open-webui/open-webui?color=red) 10 | ![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Follama-webui%2Follama-wbui&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false) 11 | [![Discord](https://img.shields.io/badge/Discord-Open_WebUI-blue?logo=discord&logoColor=white)](https://discord.gg/5rJgQTnV4s) 12 | [![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/tjbck) 13 | 14 | Open WebUI is an [extensible](https://github.com/open-webui/pipelines), feature-rich, and user-friendly self-hosted WebUI designed to operate entirely offline. It supports various LLM runners, including Ollama and OpenAI-compatible APIs. For more information, be sure to check out our [Open WebUI Documentation](https://docs.openwebui.com/). 15 | 16 | ![Open WebUI Demo](./demo.gif) 17 | 18 | ## Key Features of Open WebUI ⭐ 19 | 20 | - 🚀 **Effortless Setup**: Install seamlessly using Docker or Kubernetes (kubectl, kustomize or helm) for a hassle-free experience with support for both `:ollama` and `:cuda` tagged images. 21 | 22 | - 🤝 **Ollama/OpenAI API Integration**: Effortlessly integrate OpenAI-compatible APIs for versatile conversations alongside Ollama models. Customize the OpenAI API URL to link with **LMStudio, GroqCloud, Mistral, OpenRouter, and more**. 23 | 24 | - 🧩 **Pipelines, Open WebUI Plugin Support**: Seamlessly integrate custom logic and Python libraries into Open WebUI using [Pipelines Plugin Framework](https://github.com/open-webui/pipelines). Launch your Pipelines instance, set the OpenAI URL to the Pipelines URL, and explore endless possibilities. [Examples](https://github.com/open-webui/pipelines/tree/main/examples) include **Function Calling**, User **Rate Limiting** to control access, **Usage Monitoring** with tools like Langfuse, **Live Translation with LibreTranslate** for multilingual support, **Toxic Message Filtering** and much more. 25 | 26 | - 📱 **Responsive Design**: Enjoy a seamless experience across Desktop PC, Laptop, and Mobile devices. 27 | 28 | - 📱 **Progressive Web App (PWA) for Mobile**: Enjoy a native app-like experience on your mobile device with our PWA, providing offline access on localhost and a seamless user interface. 29 | 30 | - ✒️🔢 **Full Markdown and LaTeX Support**: Elevate your LLM experience with comprehensive Markdown and LaTeX capabilities for enriched interaction. 31 | 32 | - 🎤📹 **Hands-Free Voice/Video Call**: Experience seamless communication with integrated hands-free voice and video call features, allowing for a more dynamic and interactive chat environment. 33 | 34 | - 🛠️ **Model Builder**: Easily create Ollama models via the Web UI. Create and add custom characters/agents, customize chat elements, and import models effortlessly through [Open WebUI Community](https://openwebui.com/) integration. 35 | 36 | - 🐍 **Native Python Function Calling Tool**: Enhance your LLMs with built-in code editor support in the tools workspace. Bring Your Own Function (BYOF) by simply adding your pure Python functions, enabling seamless integration with LLMs. 37 | 38 | - 📚 **Local RAG Integration**: Dive into the future of chat interactions with groundbreaking Retrieval Augmented Generation (RAG) support. This feature seamlessly integrates document interactions into your chat experience. You can load documents directly into the chat or add files to your document library, effortlessly accessing them using the `#` command before a query. 39 | 40 | - 🔍 **Web Search for RAG**: Perform web searches using providers like `SearXNG`, `Google PSE`, `Brave Search`, `serpstack`, `serper`, `Serply`, `DuckDuckGo` and `TavilySearch` and inject the results directly into your chat experience. 41 | 42 | - 🌐 **Web Browsing Capability**: Seamlessly integrate websites into your chat experience using the `#` command followed by a URL. This feature allows you to incorporate web content directly into your conversations, enhancing the richness and depth of your interactions. 43 | 44 | - 🎨 **Image Generation Integration**: Seamlessly incorporate image generation capabilities using options such as AUTOMATIC1111 API or ComfyUI (local), and OpenAI's DALL-E (external), enriching your chat experience with dynamic visual content. 45 | 46 | - ⚙️ **Many Models Conversations**: Effortlessly engage with various models simultaneously, harnessing their unique strengths for optimal responses. Enhance your experience by leveraging a diverse set of models in parallel. 47 | 48 | - 🔐 **Role-Based Access Control (RBAC)**: Ensure secure access with restricted permissions; only authorized individuals can access your Ollama, and exclusive model creation/pulling rights are reserved for administrators. 49 | 50 | - 🌐🌍 **Multilingual Support**: Experience Open WebUI in your preferred language with our internationalization (i18n) support. Join us in expanding our supported languages! We're actively seeking contributors! 51 | 52 | - 🌟 **Continuous Updates**: We are committed to improving Open WebUI with regular updates, fixes, and new features. 53 | 54 | Want to learn more about Open WebUI's features? Check out our [Open WebUI documentation](https://docs.openwebui.com/features) for a comprehensive overview! 55 | 56 | ## 🔗 Also Check Out Open WebUI Community! 57 | 58 | Don't forget to explore our sibling project, [Open WebUI Community](https://openwebui.com/), where you can discover, download, and explore customized Modelfiles. Open WebUI Community offers a wide range of exciting possibilities for enhancing your chat interactions with Open WebUI! 🚀 59 | 60 | ## How to Install 🚀 61 | 62 | > [!NOTE] 63 | > Please note that for certain Docker environments, additional configurations might be needed. If you encounter any connection issues, our detailed guide on [Open WebUI Documentation](https://docs.openwebui.com/) is ready to assist you. 64 | 65 | ### Quick Start with Docker 🐳 66 | 67 | > [!WARNING] 68 | > When using Docker to install Open WebUI, make sure to include the `-v open-webui:/app/backend/data` in your Docker command. This step is crucial as it ensures your database is properly mounted and prevents any loss of data. 69 | 70 | > [!TIP] 71 | > If you wish to utilize Open WebUI with Ollama included or CUDA acceleration, we recommend utilizing our official images tagged with either `:cuda` or `:ollama`. To enable CUDA, you must install the [Nvidia CUDA container toolkit](https://docs.nvidia.com/dgx/nvidia-container-runtime-upgrade/) on your Linux/WSL system. 72 | 73 | ### Installation with Default Configuration 74 | 75 | - **If Ollama is on your computer**, use this command: 76 | 77 | ```bash 78 | docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main 79 | ``` 80 | 81 | - **If Ollama is on a Different Server**, use this command: 82 | 83 | To connect to Ollama on another server, change the `OLLAMA_BASE_URL` to the server's URL: 84 | 85 | ```bash 86 | docker run -d -p 3000:8080 -e OLLAMA_BASE_URL=https://example.com -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main 87 | ``` 88 | 89 | - **To run Open WebUI with Nvidia GPU support**, use this command: 90 | 91 | ```bash 92 | docker run -d -p 3000:8080 --gpus all --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:cuda 93 | ``` 94 | 95 | ### Installation for OpenAI API Usage Only 96 | 97 | - **If you're only using OpenAI API**, use this command: 98 | 99 | ```bash 100 | docker run -d -p 3000:8080 -e OPENAI_API_KEY=your_secret_key -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main 101 | ``` 102 | 103 | ### Installing Open WebUI with Bundled Ollama Support 104 | 105 | This installation method uses a single container image that bundles Open WebUI with Ollama, allowing for a streamlined setup via a single command. Choose the appropriate command based on your hardware setup: 106 | 107 | - **With GPU Support**: 108 | Utilize GPU resources by running the following command: 109 | 110 | ```bash 111 | docker run -d -p 3000:8080 --gpus=all -v ollama:/root/.ollama -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:ollama 112 | ``` 113 | 114 | - **For CPU Only**: 115 | If you're not using a GPU, use this command instead: 116 | 117 | ```bash 118 | docker run -d -p 3000:8080 -v ollama:/root/.ollama -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:ollama 119 | ``` 120 | 121 | Both commands facilitate a built-in, hassle-free installation of both Open WebUI and Ollama, ensuring that you can get everything up and running swiftly. 122 | 123 | After installation, you can access Open WebUI at [http://localhost:3000](http://localhost:3000). Enjoy! 😄 124 | 125 | ### Other Installation Methods 126 | 127 | We offer various installation alternatives, including non-Docker native installation methods, Docker Compose, Kustomize, and Helm. Visit our [Open WebUI Documentation](https://docs.openwebui.com/getting-started/) or join our [Discord community](https://discord.gg/5rJgQTnV4s) for comprehensive guidance. 128 | 129 | ### Troubleshooting 130 | 131 | Encountering connection issues? Our [Open WebUI Documentation](https://docs.openwebui.com/troubleshooting/) has got you covered. For further assistance and to join our vibrant community, visit the [Open WebUI Discord](https://discord.gg/5rJgQTnV4s). 132 | 133 | #### Open WebUI: Server Connection Error 134 | 135 | If you're experiencing connection issues, it’s often due to the WebUI docker container not being able to reach the Ollama server at 127.0.0.1:11434 (host.docker.internal:11434) inside the container . Use the `--network=host` flag in your docker command to resolve this. Note that the port changes from 3000 to 8080, resulting in the link: `http://localhost:8080`. 136 | 137 | **Example Docker Command**: 138 | 139 | ```bash 140 | docker run -d --network=host -v open-webui:/app/backend/data -e OLLAMA_BASE_URL=http://127.0.0.1:11434 --name open-webui --restart always ghcr.io/open-webui/open-webui:main 141 | ``` 142 | 143 | ### Keeping Your Docker Installation Up-to-Date 144 | 145 | In case you want to update your local Docker installation to the latest version, you can do it with [Watchtower](https://containrrr.dev/watchtower/): 146 | 147 | ```bash 148 | docker run --rm --volume /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --run-once open-webui 149 | ``` 150 | 151 | In the last part of the command, replace `open-webui` with your container name if it is different. 152 | 153 | Check our Migration Guide available in our [Open WebUI Documentation](https://docs.openwebui.com/migration/). 154 | 155 | ### Using the Dev Branch 🌙 156 | 157 | > [!WARNING] 158 | > The `:dev` branch contains the latest unstable features and changes. Use it at your own risk as it may have bugs or incomplete features. 159 | 160 | If you want to try out the latest bleeding-edge features and are okay with occasional instability, you can use the `:dev` tag like this: 161 | 162 | ```bash 163 | docker run -d -p 3000:8080 -v open-webui:/app/backend/data --name open-webui --add-host=host.docker.internal:host-gateway --restart always ghcr.io/open-webui/open-webui:dev 164 | ``` 165 | 166 | ## What's Next? 🌟 167 | 168 | Discover upcoming features on our roadmap in the [Open WebUI Documentation](https://docs.openwebui.com/roadmap/). 169 | 170 | ## Supporters ✨ 171 | 172 | A big shoutout to our amazing supporters who's helping to make this project possible! 🙏 173 | 174 | ### Platinum Sponsors 🤍 175 | 176 | - We're looking for Sponsors! 177 | 178 | ### Acknowledgments 179 | 180 | Special thanks to [Prof. Lawrence Kim](https://www.lhkim.com/) and [Prof. Nick Vincent](https://www.nickmvincent.com/) for their invaluable support and guidance in shaping this project into a research endeavor. Grateful for your mentorship throughout the journey! 🙌 181 | 182 | ## License 📜 183 | 184 | This project is licensed under the [MIT License](LICENSE) - see the [LICENSE](LICENSE) file for details. 📄 185 | 186 | ## Support 💬 187 | 188 | If you have any questions, suggestions, or need assistance, please open an issue or join our 189 | [Open WebUI Discord community](https://discord.gg/5rJgQTnV4s) to connect with us! 🤝 190 | 191 | ## Star History 192 | 193 | 194 | 195 | 196 | 197 | Star History Chart 198 | 199 | 200 | 201 | --- 202 | 203 | Created by [Timothy J. Baek](https://github.com/tjbck) - Let's make Open WebUI even more amazing together! 💪 ``````` `\\?\D:\Coding\ai\requirements-dev.lock`: ```````lock 1 | # generated by rye 2 | # use `rye lock` or `rye sync` to update this lockfile 3 | # 4 | # last locked with the following flags: 5 | # pre: false 6 | # features: [] 7 | # all-features: false 8 | # with-sources: false 9 | # generate-hashes: false 10 | # universal: false 11 | 12 | -e file:. 13 | aiohttp==3.9.5 14 | # via langchain 15 | # via langchain-community 16 | # via open-webui 17 | aiosignal==1.3.1 18 | # via aiohttp 19 | annotated-types==0.6.0 20 | # via pydantic 21 | anyio==4.3.0 22 | # via httpx 23 | # via starlette 24 | # via watchfiles 25 | apscheduler==3.10.4 26 | # via open-webui 27 | argon2-cffi==23.1.0 28 | # via open-webui 29 | argon2-cffi-bindings==21.2.0 30 | # via argon2-cffi 31 | asgiref==3.8.1 32 | # via opentelemetry-instrumentation-asgi 33 | attrs==23.2.0 34 | # via aiohttp 35 | authlib==1.3.1 36 | # via open-webui 37 | av==11.0.0 38 | # via faster-whisper 39 | backoff==2.2.1 40 | # via langfuse 41 | # via posthog 42 | # via unstructured 43 | bcrypt==4.1.3 44 | # via chromadb 45 | # via open-webui 46 | # via passlib 47 | beautifulsoup4==4.12.3 48 | # via extract-msg 49 | # via unstructured 50 | bidict==0.23.1 51 | # via python-socketio 52 | black==24.4.2 53 | # via open-webui 54 | blinker==1.8.2 55 | # via flask 56 | boto3==1.34.110 57 | # via open-webui 58 | botocore==1.34.110 59 | # via boto3 60 | # via s3transfer 61 | build==1.2.1 62 | # via chromadb 63 | cachetools==5.3.3 64 | # via google-auth 65 | certifi==2024.2.2 66 | # via httpcore 67 | # via httpx 68 | # via kubernetes 69 | # via requests 70 | # via unstructured-client 71 | cffi==1.16.0 72 | # via argon2-cffi-bindings 73 | # via cryptography 74 | chardet==5.2.0 75 | # via unstructured 76 | charset-normalizer==3.3.2 77 | # via requests 78 | # via unstructured-client 79 | chroma-hnswlib==0.7.3 80 | # via chromadb 81 | chromadb==0.5.0 82 | # via langchain-chroma 83 | # via open-webui 84 | click==8.1.7 85 | # via black 86 | # via duckduckgo-search 87 | # via flask 88 | # via nltk 89 | # via peewee-migrate 90 | # via typer 91 | # via uvicorn 92 | colorclass==2.2.2 93 | # via oletools 94 | coloredlogs==15.0.1 95 | # via onnxruntime 96 | compressed-rtf==1.0.6 97 | # via extract-msg 98 | cryptography==42.0.7 99 | # via authlib 100 | # via msoffcrypto-tool 101 | # via pyjwt 102 | ctranslate2==4.2.1 103 | # via faster-whisper 104 | dataclasses-json==0.6.6 105 | # via langchain 106 | # via langchain-community 107 | # via unstructured 108 | # via unstructured-client 109 | deepdiff==7.0.1 110 | # via unstructured-client 111 | defusedxml==0.7.1 112 | # via fpdf2 113 | deprecated==1.2.14 114 | # via opentelemetry-api 115 | # via opentelemetry-exporter-otlp-proto-grpc 116 | dnspython==2.6.1 117 | # via email-validator 118 | docx2txt==0.8 119 | # via open-webui 120 | duckduckgo-search==6.1.5 121 | # via open-webui 122 | easygui==0.98.3 123 | # via oletools 124 | ebcdic==1.1.1 125 | # via extract-msg 126 | ecdsa==0.19.0 127 | # via python-jose 128 | email-validator==2.1.1 129 | # via fastapi 130 | emoji==2.11.1 131 | # via unstructured 132 | et-xmlfile==1.1.0 133 | # via openpyxl 134 | extract-msg==0.48.5 135 | # via open-webui 136 | fake-useragent==1.5.1 137 | # via open-webui 138 | fastapi==0.111.0 139 | # via chromadb 140 | # via langchain-chroma 141 | # via open-webui 142 | fastapi-cli==0.0.4 143 | # via fastapi 144 | faster-whisper==1.0.2 145 | # via open-webui 146 | filelock==3.14.0 147 | # via huggingface-hub 148 | # via torch 149 | # via transformers 150 | filetype==1.2.0 151 | # via unstructured 152 | flask==3.0.3 153 | # via flask-cors 154 | # via open-webui 155 | flask-cors==4.0.1 156 | # via open-webui 157 | flatbuffers==24.3.25 158 | # via onnxruntime 159 | fonttools==4.51.0 160 | # via fpdf2 161 | fpdf2==2.7.9 162 | # via open-webui 163 | frozenlist==1.4.1 164 | # via aiohttp 165 | # via aiosignal 166 | fsspec==2024.3.1 167 | # via huggingface-hub 168 | # via torch 169 | google-ai-generativelanguage==0.6.4 170 | # via google-generativeai 171 | google-api-core==2.19.0 172 | # via google-ai-generativelanguage 173 | # via google-api-python-client 174 | # via google-generativeai 175 | google-api-python-client==2.129.0 176 | # via google-generativeai 177 | google-auth==2.29.0 178 | # via google-ai-generativelanguage 179 | # via google-api-core 180 | # via google-api-python-client 181 | # via google-auth-httplib2 182 | # via google-generativeai 183 | # via kubernetes 184 | google-auth-httplib2==0.2.0 185 | # via google-api-python-client 186 | google-generativeai==0.5.4 187 | # via open-webui 188 | googleapis-common-protos==1.63.0 189 | # via google-api-core 190 | # via grpcio-status 191 | # via opentelemetry-exporter-otlp-proto-grpc 192 | grpcio==1.63.0 193 | # via chromadb 194 | # via google-api-core 195 | # via grpcio-status 196 | # via opentelemetry-exporter-otlp-proto-grpc 197 | grpcio-status==1.62.2 198 | # via google-api-core 199 | h11==0.14.0 200 | # via httpcore 201 | # via uvicorn 202 | # via wsproto 203 | httpcore==1.0.5 204 | # via httpx 205 | httplib2==0.22.0 206 | # via google-api-python-client 207 | # via google-auth-httplib2 208 | httptools==0.6.1 209 | # via uvicorn 210 | httpx==0.27.0 211 | # via fastapi 212 | # via langfuse 213 | huggingface-hub==0.23.0 214 | # via faster-whisper 215 | # via sentence-transformers 216 | # via tokenizers 217 | # via transformers 218 | humanfriendly==10.0 219 | # via coloredlogs 220 | idna==3.7 221 | # via anyio 222 | # via email-validator 223 | # via httpx 224 | # via langfuse 225 | # via requests 226 | # via unstructured-client 227 | # via yarl 228 | importlib-metadata==7.0.0 229 | # via opentelemetry-api 230 | importlib-resources==6.4.0 231 | # via chromadb 232 | itsdangerous==2.2.0 233 | # via flask 234 | jinja2==3.1.4 235 | # via fastapi 236 | # via flask 237 | # via torch 238 | jmespath==1.0.1 239 | # via boto3 240 | # via botocore 241 | joblib==1.4.2 242 | # via nltk 243 | # via scikit-learn 244 | jsonpatch==1.33 245 | # via langchain-core 246 | jsonpath-python==1.0.6 247 | # via unstructured-client 248 | jsonpointer==2.4 249 | # via jsonpatch 250 | kubernetes==29.0.0 251 | # via chromadb 252 | langchain==0.2.0 253 | # via langchain-community 254 | # via open-webui 255 | langchain-chroma==0.1.1 256 | # via open-webui 257 | langchain-community==0.2.0 258 | # via open-webui 259 | langchain-core==0.2.1 260 | # via langchain 261 | # via langchain-chroma 262 | # via langchain-community 263 | # via langchain-text-splitters 264 | langchain-text-splitters==0.2.0 265 | # via langchain 266 | langdetect==1.0.9 267 | # via unstructured 268 | langfuse==2.33.0 269 | # via open-webui 270 | langsmith==0.1.57 271 | # via langchain 272 | # via langchain-community 273 | # via langchain-core 274 | lark==1.1.8 275 | # via rtfde 276 | lxml==5.2.2 277 | # via unstructured 278 | markdown==3.6 279 | # via open-webui 280 | markdown-it-py==3.0.0 281 | # via rich 282 | markupsafe==2.1.5 283 | # via jinja2 284 | # via werkzeug 285 | marshmallow==3.21.2 286 | # via dataclasses-json 287 | # via unstructured-client 288 | mdurl==0.1.2 289 | # via markdown-it-py 290 | mmh3==4.1.0 291 | # via chromadb 292 | monotonic==1.6 293 | # via posthog 294 | mpmath==1.3.0 295 | # via sympy 296 | msoffcrypto-tool==5.4.1 297 | # via oletools 298 | multidict==6.0.5 299 | # via aiohttp 300 | # via yarl 301 | mypy-extensions==1.0.0 302 | # via black 303 | # via typing-inspect 304 | # via unstructured-client 305 | networkx==3.3 306 | # via torch 307 | nltk==3.8.1 308 | # via unstructured 309 | numpy==1.26.4 310 | # via chroma-hnswlib 311 | # via chromadb 312 | # via ctranslate2 313 | # via langchain 314 | # via langchain-chroma 315 | # via langchain-community 316 | # via onnxruntime 317 | # via opencv-python 318 | # via opencv-python-headless 319 | # via pandas 320 | # via rank-bm25 321 | # via rapidocr-onnxruntime 322 | # via scikit-learn 323 | # via scipy 324 | # via sentence-transformers 325 | # via shapely 326 | # via transformers 327 | # via unstructured 328 | oauthlib==3.2.2 329 | # via kubernetes 330 | # via requests-oauthlib 331 | olefile==0.47 332 | # via extract-msg 333 | # via msoffcrypto-tool 334 | # via oletools 335 | oletools==0.60.1 336 | # via pcodedmp 337 | # via rtfde 338 | onnxruntime==1.17.3 339 | # via chromadb 340 | # via faster-whisper 341 | # via rapidocr-onnxruntime 342 | opencv-python==4.9.0.80 343 | # via rapidocr-onnxruntime 344 | opencv-python-headless==4.9.0.80 345 | # via open-webui 346 | openpyxl==3.1.2 347 | # via open-webui 348 | opentelemetry-api==1.24.0 349 | # via chromadb 350 | # via opentelemetry-exporter-otlp-proto-grpc 351 | # via opentelemetry-instrumentation 352 | # via opentelemetry-instrumentation-asgi 353 | # via opentelemetry-instrumentation-fastapi 354 | # via opentelemetry-sdk 355 | opentelemetry-exporter-otlp-proto-common==1.24.0 356 | # via opentelemetry-exporter-otlp-proto-grpc 357 | opentelemetry-exporter-otlp-proto-grpc==1.24.0 358 | # via chromadb 359 | opentelemetry-instrumentation==0.45b0 360 | # via opentelemetry-instrumentation-asgi 361 | # via opentelemetry-instrumentation-fastapi 362 | opentelemetry-instrumentation-asgi==0.45b0 363 | # via opentelemetry-instrumentation-fastapi 364 | opentelemetry-instrumentation-fastapi==0.45b0 365 | # via chromadb 366 | opentelemetry-proto==1.24.0 367 | # via opentelemetry-exporter-otlp-proto-common 368 | # via opentelemetry-exporter-otlp-proto-grpc 369 | opentelemetry-sdk==1.24.0 370 | # via chromadb 371 | # via opentelemetry-exporter-otlp-proto-grpc 372 | opentelemetry-semantic-conventions==0.45b0 373 | # via opentelemetry-instrumentation-asgi 374 | # via opentelemetry-instrumentation-fastapi 375 | # via opentelemetry-sdk 376 | opentelemetry-util-http==0.45b0 377 | # via opentelemetry-instrumentation-asgi 378 | # via opentelemetry-instrumentation-fastapi 379 | ordered-set==4.1.0 380 | # via deepdiff 381 | orjson==3.10.3 382 | # via chromadb 383 | # via duckduckgo-search 384 | # via fastapi 385 | # via langsmith 386 | overrides==7.7.0 387 | # via chromadb 388 | packaging==23.2 389 | # via black 390 | # via build 391 | # via huggingface-hub 392 | # via langchain-core 393 | # via langfuse 394 | # via marshmallow 395 | # via onnxruntime 396 | # via transformers 397 | # via unstructured-client 398 | pandas==2.2.2 399 | # via open-webui 400 | passlib==1.7.4 401 | # via open-webui 402 | pathspec==0.12.1 403 | # via black 404 | pcodedmp==1.2.6 405 | # via oletools 406 | peewee==3.17.5 407 | # via open-webui 408 | # via peewee-migrate 409 | peewee-migrate==1.12.2 410 | # via open-webui 411 | pillow==10.3.0 412 | # via fpdf2 413 | # via rapidocr-onnxruntime 414 | # via sentence-transformers 415 | platformdirs==4.2.1 416 | # via black 417 | posthog==3.5.0 418 | # via chromadb 419 | proto-plus==1.23.0 420 | # via google-ai-generativelanguage 421 | # via google-api-core 422 | protobuf==4.25.3 423 | # via google-ai-generativelanguage 424 | # via google-api-core 425 | # via google-generativeai 426 | # via googleapis-common-protos 427 | # via grpcio-status 428 | # via onnxruntime 429 | # via opentelemetry-proto 430 | # via proto-plus 431 | psycopg2-binary==2.9.9 432 | # via open-webui 433 | pyasn1==0.6.0 434 | # via pyasn1-modules 435 | # via python-jose 436 | # via rsa 437 | pyasn1-modules==0.4.0 438 | # via google-auth 439 | pyclipper==1.3.0.post5 440 | # via rapidocr-onnxruntime 441 | pycparser==2.22 442 | # via cffi 443 | pydantic==2.7.1 444 | # via chromadb 445 | # via fastapi 446 | # via google-generativeai 447 | # via langchain 448 | # via langchain-core 449 | # via langfuse 450 | # via langsmith 451 | # via open-webui 452 | pydantic-core==2.18.2 453 | # via pydantic 454 | pydub==0.25.1 455 | # via open-webui 456 | pygments==2.18.0 457 | # via rich 458 | pyjwt==2.8.0 459 | # via open-webui 460 | pymysql==1.1.0 461 | # via open-webui 462 | pypandoc==1.13 463 | # via open-webui 464 | pyparsing==2.4.7 465 | # via httplib2 466 | # via oletools 467 | pypdf==4.2.0 468 | # via open-webui 469 | # via unstructured-client 470 | pypika==0.48.9 471 | # via chromadb 472 | pyproject-hooks==1.1.0 473 | # via build 474 | pyreqwest-impersonate==0.4.7 475 | # via duckduckgo-search 476 | python-dateutil==2.9.0.post0 477 | # via botocore 478 | # via kubernetes 479 | # via pandas 480 | # via posthog 481 | # via unstructured-client 482 | python-dotenv==1.0.1 483 | # via uvicorn 484 | python-engineio==4.9.0 485 | # via python-socketio 486 | python-iso639==2024.4.27 487 | # via unstructured 488 | python-jose==3.3.0 489 | # via open-webui 490 | python-magic==0.4.27 491 | # via unstructured 492 | python-multipart==0.0.9 493 | # via fastapi 494 | # via open-webui 495 | python-socketio==5.11.2 496 | # via open-webui 497 | pytube==15.0.0 498 | # via open-webui 499 | pytz==2024.1 500 | # via apscheduler 501 | # via pandas 502 | pyxlsb==1.0.10 503 | # via open-webui 504 | pyyaml==6.0.1 505 | # via chromadb 506 | # via ctranslate2 507 | # via huggingface-hub 508 | # via kubernetes 509 | # via langchain 510 | # via langchain-community 511 | # via langchain-core 512 | # via rapidocr-onnxruntime 513 | # via transformers 514 | # via uvicorn 515 | rank-bm25==0.2.2 516 | # via open-webui 517 | rapidfuzz==3.9.0 518 | # via unstructured 519 | rapidocr-onnxruntime==1.3.22 520 | # via open-webui 521 | red-black-tree-mod==1.20 522 | # via extract-msg 523 | regex==2024.5.10 524 | # via nltk 525 | # via transformers 526 | requests==2.32.2 527 | # via chromadb 528 | # via google-api-core 529 | # via huggingface-hub 530 | # via kubernetes 531 | # via langchain 532 | # via langchain-community 533 | # via langsmith 534 | # via open-webui 535 | # via posthog 536 | # via requests-oauthlib 537 | # via transformers 538 | # via unstructured 539 | # via unstructured-client 540 | # via youtube-transcript-api 541 | requests-oauthlib==2.0.0 542 | # via kubernetes 543 | rich==13.7.1 544 | # via typer 545 | rsa==4.9 546 | # via google-auth 547 | # via python-jose 548 | rtfde==0.1.1 549 | # via extract-msg 550 | s3transfer==0.10.1 551 | # via boto3 552 | safetensors==0.4.3 553 | # via transformers 554 | scikit-learn==1.4.2 555 | # via sentence-transformers 556 | scipy==1.13.0 557 | # via scikit-learn 558 | # via sentence-transformers 559 | sentence-transformers==2.7.0 560 | # via open-webui 561 | setuptools==69.5.1 562 | # via ctranslate2 563 | # via opentelemetry-instrumentation 564 | shapely==2.0.4 565 | # via rapidocr-onnxruntime 566 | shellingham==1.5.4 567 | # via typer 568 | simple-websocket==1.0.0 569 | # via python-engineio 570 | six==1.16.0 571 | # via apscheduler 572 | # via ecdsa 573 | # via kubernetes 574 | # via langdetect 575 | # via posthog 576 | # via python-dateutil 577 | # via rapidocr-onnxruntime 578 | # via unstructured-client 579 | sniffio==1.3.1 580 | # via anyio 581 | # via httpx 582 | soupsieve==2.5 583 | # via beautifulsoup4 584 | sqlalchemy==2.0.30 585 | # via langchain 586 | # via langchain-community 587 | starlette==0.37.2 588 | # via fastapi 589 | sympy==1.12 590 | # via onnxruntime 591 | # via torch 592 | tabulate==0.9.0 593 | # via unstructured 594 | tenacity==8.3.0 595 | # via chromadb 596 | # via langchain 597 | # via langchain-community 598 | # via langchain-core 599 | threadpoolctl==3.5.0 600 | # via scikit-learn 601 | tokenizers==0.15.2 602 | # via chromadb 603 | # via faster-whisper 604 | # via transformers 605 | torch==2.3.0 606 | # via sentence-transformers 607 | tqdm==4.66.4 608 | # via chromadb 609 | # via google-generativeai 610 | # via huggingface-hub 611 | # via nltk 612 | # via sentence-transformers 613 | # via transformers 614 | transformers==4.39.3 615 | # via sentence-transformers 616 | typer==0.12.3 617 | # via chromadb 618 | # via fastapi-cli 619 | typing-extensions==4.11.0 620 | # via chromadb 621 | # via fastapi 622 | # via google-generativeai 623 | # via huggingface-hub 624 | # via opentelemetry-sdk 625 | # via pydantic 626 | # via pydantic-core 627 | # via sqlalchemy 628 | # via torch 629 | # via typer 630 | # via typing-inspect 631 | # via unstructured 632 | # via unstructured-client 633 | typing-inspect==0.9.0 634 | # via dataclasses-json 635 | # via unstructured-client 636 | tzdata==2024.1 637 | # via pandas 638 | tzlocal==5.2 639 | # via apscheduler 640 | # via extract-msg 641 | ujson==5.10.0 642 | # via fastapi 643 | unstructured==0.14.0 644 | # via open-webui 645 | unstructured-client==0.22.0 646 | # via unstructured 647 | uritemplate==4.1.1 648 | # via google-api-python-client 649 | urllib3==2.2.1 650 | # via botocore 651 | # via kubernetes 652 | # via requests 653 | # via unstructured-client 654 | uvicorn==0.22.0 655 | # via chromadb 656 | # via fastapi 657 | # via open-webui 658 | uvloop==0.19.0 659 | # via uvicorn 660 | validators==0.28.1 661 | # via open-webui 662 | watchfiles==0.21.0 663 | # via uvicorn 664 | websocket-client==1.8.0 665 | # via kubernetes 666 | websockets==12.0 667 | # via uvicorn 668 | werkzeug==3.0.3 669 | # via flask 670 | wrapt==1.16.0 671 | # via deprecated 672 | # via langfuse 673 | # via opentelemetry-instrumentation 674 | # via unstructured 675 | wsproto==1.2.0 676 | # via simple-websocket 677 | xlrd==2.0.1 678 | # via open-webui 679 | yarl==1.9.4 680 | # via aiohttp 681 | youtube-transcript-api==0.6.2 682 | # via open-webui 683 | zipp==3.18.1 684 | # via importlib-metadata ``````` `\\?\D:\Coding\ai\requirements.lock`: ```````lock 1 | # generated by rye 2 | # use `rye lock` or `rye sync` to update this lockfile 3 | # 4 | # last locked with the following flags: 5 | # pre: false 6 | # features: [] 7 | # all-features: false 8 | # with-sources: false 9 | # generate-hashes: false 10 | # universal: false 11 | 12 | -e file:. 13 | aiohttp==3.9.5 14 | # via langchain 15 | # via langchain-community 16 | # via open-webui 17 | aiosignal==1.3.1 18 | # via aiohttp 19 | annotated-types==0.6.0 20 | # via pydantic 21 | anyio==4.3.0 22 | # via httpx 23 | # via starlette 24 | # via watchfiles 25 | apscheduler==3.10.4 26 | # via open-webui 27 | argon2-cffi==23.1.0 28 | # via open-webui 29 | argon2-cffi-bindings==21.2.0 30 | # via argon2-cffi 31 | asgiref==3.8.1 32 | # via opentelemetry-instrumentation-asgi 33 | attrs==23.2.0 34 | # via aiohttp 35 | authlib==1.3.1 36 | # via open-webui 37 | av==11.0.0 38 | # via faster-whisper 39 | backoff==2.2.1 40 | # via langfuse 41 | # via posthog 42 | # via unstructured 43 | bcrypt==4.1.3 44 | # via chromadb 45 | # via open-webui 46 | # via passlib 47 | beautifulsoup4==4.12.3 48 | # via extract-msg 49 | # via unstructured 50 | bidict==0.23.1 51 | # via python-socketio 52 | black==24.4.2 53 | # via open-webui 54 | blinker==1.8.2 55 | # via flask 56 | boto3==1.34.110 57 | # via open-webui 58 | botocore==1.34.110 59 | # via boto3 60 | # via s3transfer 61 | build==1.2.1 62 | # via chromadb 63 | cachetools==5.3.3 64 | # via google-auth 65 | certifi==2024.2.2 66 | # via httpcore 67 | # via httpx 68 | # via kubernetes 69 | # via requests 70 | # via unstructured-client 71 | cffi==1.16.0 72 | # via argon2-cffi-bindings 73 | # via cryptography 74 | chardet==5.2.0 75 | # via unstructured 76 | charset-normalizer==3.3.2 77 | # via requests 78 | # via unstructured-client 79 | chroma-hnswlib==0.7.3 80 | # via chromadb 81 | chromadb==0.5.0 82 | # via langchain-chroma 83 | # via open-webui 84 | click==8.1.7 85 | # via black 86 | # via duckduckgo-search 87 | # via flask 88 | # via nltk 89 | # via peewee-migrate 90 | # via typer 91 | # via uvicorn 92 | colorclass==2.2.2 93 | # via oletools 94 | coloredlogs==15.0.1 95 | # via onnxruntime 96 | compressed-rtf==1.0.6 97 | # via extract-msg 98 | cryptography==42.0.7 99 | # via authlib 100 | # via msoffcrypto-tool 101 | # via pyjwt 102 | ctranslate2==4.2.1 103 | # via faster-whisper 104 | dataclasses-json==0.6.6 105 | # via langchain 106 | # via langchain-community 107 | # via unstructured 108 | # via unstructured-client 109 | deepdiff==7.0.1 110 | # via unstructured-client 111 | defusedxml==0.7.1 112 | # via fpdf2 113 | deprecated==1.2.14 114 | # via opentelemetry-api 115 | # via opentelemetry-exporter-otlp-proto-grpc 116 | dnspython==2.6.1 117 | # via email-validator 118 | docx2txt==0.8 119 | # via open-webui 120 | duckduckgo-search==6.1.5 121 | # via open-webui 122 | easygui==0.98.3 123 | # via oletools 124 | ebcdic==1.1.1 125 | # via extract-msg 126 | ecdsa==0.19.0 127 | # via python-jose 128 | email-validator==2.1.1 129 | # via fastapi 130 | emoji==2.11.1 131 | # via unstructured 132 | et-xmlfile==1.1.0 133 | # via openpyxl 134 | extract-msg==0.48.5 135 | # via open-webui 136 | fake-useragent==1.5.1 137 | # via open-webui 138 | fastapi==0.111.0 139 | # via chromadb 140 | # via langchain-chroma 141 | # via open-webui 142 | fastapi-cli==0.0.4 143 | # via fastapi 144 | faster-whisper==1.0.2 145 | # via open-webui 146 | filelock==3.14.0 147 | # via huggingface-hub 148 | # via torch 149 | # via transformers 150 | filetype==1.2.0 151 | # via unstructured 152 | flask==3.0.3 153 | # via flask-cors 154 | # via open-webui 155 | flask-cors==4.0.1 156 | # via open-webui 157 | flatbuffers==24.3.25 158 | # via onnxruntime 159 | fonttools==4.51.0 160 | # via fpdf2 161 | fpdf2==2.7.9 162 | # via open-webui 163 | frozenlist==1.4.1 164 | # via aiohttp 165 | # via aiosignal 166 | fsspec==2024.3.1 167 | # via huggingface-hub 168 | # via torch 169 | google-ai-generativelanguage==0.6.4 170 | # via google-generativeai 171 | google-api-core==2.19.0 172 | # via google-ai-generativelanguage 173 | # via google-api-python-client 174 | # via google-generativeai 175 | google-api-python-client==2.129.0 176 | # via google-generativeai 177 | google-auth==2.29.0 178 | # via google-ai-generativelanguage 179 | # via google-api-core 180 | # via google-api-python-client 181 | # via google-auth-httplib2 182 | # via google-generativeai 183 | # via kubernetes 184 | google-auth-httplib2==0.2.0 185 | # via google-api-python-client 186 | google-generativeai==0.5.4 187 | # via open-webui 188 | googleapis-common-protos==1.63.0 189 | # via google-api-core 190 | # via grpcio-status 191 | # via opentelemetry-exporter-otlp-proto-grpc 192 | grpcio==1.63.0 193 | # via chromadb 194 | # via google-api-core 195 | # via grpcio-status 196 | # via opentelemetry-exporter-otlp-proto-grpc 197 | grpcio-status==1.62.2 198 | # via google-api-core 199 | h11==0.14.0 200 | # via httpcore 201 | # via uvicorn 202 | # via wsproto 203 | httpcore==1.0.5 204 | # via httpx 205 | httplib2==0.22.0 206 | # via google-api-python-client 207 | # via google-auth-httplib2 208 | httptools==0.6.1 209 | # via uvicorn 210 | httpx==0.27.0 211 | # via fastapi 212 | # via langfuse 213 | huggingface-hub==0.23.0 214 | # via faster-whisper 215 | # via sentence-transformers 216 | # via tokenizers 217 | # via transformers 218 | humanfriendly==10.0 219 | # via coloredlogs 220 | idna==3.7 221 | # via anyio 222 | # via email-validator 223 | # via httpx 224 | # via langfuse 225 | # via requests 226 | # via unstructured-client 227 | # via yarl 228 | importlib-metadata==7.0.0 229 | # via opentelemetry-api 230 | importlib-resources==6.4.0 231 | # via chromadb 232 | itsdangerous==2.2.0 233 | # via flask 234 | jinja2==3.1.4 235 | # via fastapi 236 | # via flask 237 | # via torch 238 | jmespath==1.0.1 239 | # via boto3 240 | # via botocore 241 | joblib==1.4.2 242 | # via nltk 243 | # via scikit-learn 244 | jsonpatch==1.33 245 | # via langchain-core 246 | jsonpath-python==1.0.6 247 | # via unstructured-client 248 | jsonpointer==2.4 249 | # via jsonpatch 250 | kubernetes==29.0.0 251 | # via chromadb 252 | langchain==0.2.0 253 | # via langchain-community 254 | # via open-webui 255 | langchain-chroma==0.1.1 256 | # via open-webui 257 | langchain-community==0.2.0 258 | # via open-webui 259 | langchain-core==0.2.1 260 | # via langchain 261 | # via langchain-chroma 262 | # via langchain-community 263 | # via langchain-text-splitters 264 | langchain-text-splitters==0.2.0 265 | # via langchain 266 | langdetect==1.0.9 267 | # via unstructured 268 | langfuse==2.33.0 269 | # via open-webui 270 | langsmith==0.1.57 271 | # via langchain 272 | # via langchain-community 273 | # via langchain-core 274 | lark==1.1.8 275 | # via rtfde 276 | lxml==5.2.2 277 | # via unstructured 278 | markdown==3.6 279 | # via open-webui 280 | markdown-it-py==3.0.0 281 | # via rich 282 | markupsafe==2.1.5 283 | # via jinja2 284 | # via werkzeug 285 | marshmallow==3.21.2 286 | # via dataclasses-json 287 | # via unstructured-client 288 | mdurl==0.1.2 289 | # via markdown-it-py 290 | mmh3==4.1.0 291 | # via chromadb 292 | monotonic==1.6 293 | # via posthog 294 | mpmath==1.3.0 295 | # via sympy 296 | msoffcrypto-tool==5.4.1 297 | # via oletools 298 | multidict==6.0.5 299 | # via aiohttp 300 | # via yarl 301 | mypy-extensions==1.0.0 302 | # via black 303 | # via typing-inspect 304 | # via unstructured-client 305 | networkx==3.3 306 | # via torch 307 | nltk==3.8.1 308 | # via unstructured 309 | numpy==1.26.4 310 | # via chroma-hnswlib 311 | # via chromadb 312 | # via ctranslate2 313 | # via langchain 314 | # via langchain-chroma 315 | # via langchain-community 316 | # via onnxruntime 317 | # via opencv-python 318 | # via opencv-python-headless 319 | # via pandas 320 | # via rank-bm25 321 | # via rapidocr-onnxruntime 322 | # via scikit-learn 323 | # via scipy 324 | # via sentence-transformers 325 | # via shapely 326 | # via transformers 327 | # via unstructured 328 | oauthlib==3.2.2 329 | # via kubernetes 330 | # via requests-oauthlib 331 | olefile==0.47 332 | # via extract-msg 333 | # via msoffcrypto-tool 334 | # via oletools 335 | oletools==0.60.1 336 | # via pcodedmp 337 | # via rtfde 338 | onnxruntime==1.17.3 339 | # via chromadb 340 | # via faster-whisper 341 | # via rapidocr-onnxruntime 342 | opencv-python==4.9.0.80 343 | # via rapidocr-onnxruntime 344 | opencv-python-headless==4.9.0.80 345 | # via open-webui 346 | openpyxl==3.1.2 347 | # via open-webui 348 | opentelemetry-api==1.24.0 349 | # via chromadb 350 | # via opentelemetry-exporter-otlp-proto-grpc 351 | # via opentelemetry-instrumentation 352 | # via opentelemetry-instrumentation-asgi 353 | # via opentelemetry-instrumentation-fastapi 354 | # via opentelemetry-sdk 355 | opentelemetry-exporter-otlp-proto-common==1.24.0 356 | # via opentelemetry-exporter-otlp-proto-grpc 357 | opentelemetry-exporter-otlp-proto-grpc==1.24.0 358 | # via chromadb 359 | opentelemetry-instrumentation==0.45b0 360 | # via opentelemetry-instrumentation-asgi 361 | # via opentelemetry-instrumentation-fastapi 362 | opentelemetry-instrumentation-asgi==0.45b0 363 | # via opentelemetry-instrumentation-fastapi 364 | opentelemetry-instrumentation-fastapi==0.45b0 365 | # via chromadb 366 | opentelemetry-proto==1.24.0 367 | # via opentelemetry-exporter-otlp-proto-common 368 | # via opentelemetry-exporter-otlp-proto-grpc 369 | opentelemetry-sdk==1.24.0 370 | # via chromadb 371 | # via opentelemetry-exporter-otlp-proto-grpc 372 | opentelemetry-semantic-conventions==0.45b0 373 | # via opentelemetry-instrumentation-asgi 374 | # via opentelemetry-instrumentation-fastapi 375 | # via opentelemetry-sdk 376 | opentelemetry-util-http==0.45b0 377 | # via opentelemetry-instrumentation-asgi 378 | # via opentelemetry-instrumentation-fastapi 379 | ordered-set==4.1.0 380 | # via deepdiff 381 | orjson==3.10.3 382 | # via chromadb 383 | # via duckduckgo-search 384 | # via fastapi 385 | # via langsmith 386 | overrides==7.7.0 387 | # via chromadb 388 | packaging==23.2 389 | # via black 390 | # via build 391 | # via huggingface-hub 392 | # via langchain-core 393 | # via langfuse 394 | # via marshmallow 395 | # via onnxruntime 396 | # via transformers 397 | # via unstructured-client 398 | pandas==2.2.2 399 | # via open-webui 400 | passlib==1.7.4 401 | # via open-webui 402 | pathspec==0.12.1 403 | # via black 404 | pcodedmp==1.2.6 405 | # via oletools 406 | peewee==3.17.5 407 | # via open-webui 408 | # via peewee-migrate 409 | peewee-migrate==1.12.2 410 | # via open-webui 411 | pillow==10.3.0 412 | # via fpdf2 413 | # via rapidocr-onnxruntime 414 | # via sentence-transformers 415 | platformdirs==4.2.1 416 | # via black 417 | posthog==3.5.0 418 | # via chromadb 419 | proto-plus==1.23.0 420 | # via google-ai-generativelanguage 421 | # via google-api-core 422 | protobuf==4.25.3 423 | # via google-ai-generativelanguage 424 | # via google-api-core 425 | # via google-generativeai 426 | # via googleapis-common-protos 427 | # via grpcio-status 428 | # via onnxruntime 429 | # via opentelemetry-proto 430 | # via proto-plus 431 | psycopg2-binary==2.9.9 432 | # via open-webui 433 | pyasn1==0.6.0 434 | # via pyasn1-modules 435 | # via python-jose 436 | # via rsa 437 | pyasn1-modules==0.4.0 438 | # via google-auth 439 | pyclipper==1.3.0.post5 440 | # via rapidocr-onnxruntime 441 | pycparser==2.22 442 | # via cffi 443 | pydantic==2.7.1 444 | # via chromadb 445 | # via fastapi 446 | # via google-generativeai 447 | # via langchain 448 | # via langchain-core 449 | # via langfuse 450 | # via langsmith 451 | # via open-webui 452 | pydantic-core==2.18.2 453 | # via pydantic 454 | pydub==0.25.1 455 | # via open-webui 456 | pygments==2.18.0 457 | # via rich 458 | pyjwt==2.8.0 459 | # via open-webui 460 | pymysql==1.1.0 461 | # via open-webui 462 | pypandoc==1.13 463 | # via open-webui 464 | pyparsing==2.4.7 465 | # via httplib2 466 | # via oletools 467 | pypdf==4.2.0 468 | # via open-webui 469 | # via unstructured-client 470 | pypika==0.48.9 471 | # via chromadb 472 | pyproject-hooks==1.1.0 473 | # via build 474 | pyreqwest-impersonate==0.4.7 475 | # via duckduckgo-search 476 | python-dateutil==2.9.0.post0 477 | # via botocore 478 | # via kubernetes 479 | # via pandas 480 | # via posthog 481 | # via unstructured-client 482 | python-dotenv==1.0.1 483 | # via uvicorn 484 | python-engineio==4.9.0 485 | # via python-socketio 486 | python-iso639==2024.4.27 487 | # via unstructured 488 | python-jose==3.3.0 489 | # via open-webui 490 | python-magic==0.4.27 491 | # via unstructured 492 | python-multipart==0.0.9 493 | # via fastapi 494 | # via open-webui 495 | python-socketio==5.11.2 496 | # via open-webui 497 | pytube==15.0.0 498 | # via open-webui 499 | pytz==2024.1 500 | # via apscheduler 501 | # via pandas 502 | pyxlsb==1.0.10 503 | # via open-webui 504 | pyyaml==6.0.1 505 | # via chromadb 506 | # via ctranslate2 507 | # via huggingface-hub 508 | # via kubernetes 509 | # via langchain 510 | # via langchain-community 511 | # via langchain-core 512 | # via rapidocr-onnxruntime 513 | # via transformers 514 | # via uvicorn 515 | rank-bm25==0.2.2 516 | # via open-webui 517 | rapidfuzz==3.9.0 518 | # via unstructured 519 | rapidocr-onnxruntime==1.3.22 520 | # via open-webui 521 | red-black-tree-mod==1.20 522 | # via extract-msg 523 | regex==2024.5.10 524 | # via nltk 525 | # via transformers 526 | requests==2.32.2 527 | # via chromadb 528 | # via google-api-core 529 | # via huggingface-hub 530 | # via kubernetes 531 | # via langchain 532 | # via langchain-community 533 | # via langsmith 534 | # via open-webui 535 | # via posthog 536 | # via requests-oauthlib 537 | # via transformers 538 | # via unstructured 539 | # via unstructured-client 540 | # via youtube-transcript-api 541 | requests-oauthlib==2.0.0 542 | # via kubernetes 543 | rich==13.7.1 544 | # via typer 545 | rsa==4.9 546 | # via google-auth 547 | # via python-jose 548 | rtfde==0.1.1 549 | # via extract-msg 550 | s3transfer==0.10.1 551 | # via boto3 552 | safetensors==0.4.3 553 | # via transformers 554 | scikit-learn==1.4.2 555 | # via sentence-transformers 556 | scipy==1.13.0 557 | # via scikit-learn 558 | # via sentence-transformers 559 | sentence-transformers==2.7.0 560 | # via open-webui 561 | setuptools==69.5.1 562 | # via ctranslate2 563 | # via opentelemetry-instrumentation 564 | shapely==2.0.4 565 | # via rapidocr-onnxruntime 566 | shellingham==1.5.4 567 | # via typer 568 | simple-websocket==1.0.0 569 | # via python-engineio 570 | six==1.16.0 571 | # via apscheduler 572 | # via ecdsa 573 | # via kubernetes 574 | # via langdetect 575 | # via posthog 576 | # via python-dateutil 577 | # via rapidocr-onnxruntime 578 | # via unstructured-client 579 | sniffio==1.3.1 580 | # via anyio 581 | # via httpx 582 | soupsieve==2.5 583 | # via beautifulsoup4 584 | sqlalchemy==2.0.30 585 | # via langchain 586 | # via langchain-community 587 | starlette==0.37.2 588 | # via fastapi 589 | sympy==1.12 590 | # via onnxruntime 591 | # via torch 592 | tabulate==0.9.0 593 | # via unstructured 594 | tenacity==8.3.0 595 | # via chromadb 596 | # via langchain 597 | # via langchain-community 598 | # via langchain-core 599 | threadpoolctl==3.5.0 600 | # via scikit-learn 601 | tokenizers==0.15.2 602 | # via chromadb 603 | # via faster-whisper 604 | # via transformers 605 | torch==2.3.0 606 | # via sentence-transformers 607 | tqdm==4.66.4 608 | # via chromadb 609 | # via google-generativeai 610 | # via huggingface-hub 611 | # via nltk 612 | # via sentence-transformers 613 | # via transformers 614 | transformers==4.39.3 615 | # via sentence-transformers 616 | typer==0.12.3 617 | # via chromadb 618 | # via fastapi-cli 619 | typing-extensions==4.11.0 620 | # via chromadb 621 | # via fastapi 622 | # via google-generativeai 623 | # via huggingface-hub 624 | # via opentelemetry-sdk 625 | # via pydantic 626 | # via pydantic-core 627 | # via sqlalchemy 628 | # via torch 629 | # via typer 630 | # via typing-inspect 631 | # via unstructured 632 | # via unstructured-client 633 | typing-inspect==0.9.0 634 | # via dataclasses-json 635 | # via unstructured-client 636 | tzdata==2024.1 637 | # via pandas 638 | tzlocal==5.2 639 | # via apscheduler 640 | # via extract-msg 641 | ujson==5.10.0 642 | # via fastapi 643 | unstructured==0.14.0 644 | # via open-webui 645 | unstructured-client==0.22.0 646 | # via unstructured 647 | uritemplate==4.1.1 648 | # via google-api-python-client 649 | urllib3==2.2.1 650 | # via botocore 651 | # via kubernetes 652 | # via requests 653 | # via unstructured-client 654 | uvicorn==0.22.0 655 | # via chromadb 656 | # via fastapi 657 | # via open-webui 658 | uvloop==0.19.0 659 | # via uvicorn 660 | validators==0.28.1 661 | # via open-webui 662 | watchfiles==0.21.0 663 | # via uvicorn 664 | websocket-client==1.8.0 665 | # via kubernetes 666 | websockets==12.0 667 | # via uvicorn 668 | werkzeug==3.0.3 669 | # via flask 670 | wrapt==1.16.0 671 | # via deprecated 672 | # via langfuse 673 | # via opentelemetry-instrumentation 674 | # via unstructured 675 | wsproto==1.2.0 676 | # via simple-websocket 677 | xlrd==2.0.1 678 | # via open-webui 679 | yarl==1.9.4 680 | # via aiohttp 681 | youtube-transcript-api==0.6.2 682 | # via open-webui 683 | zipp==3.18.1 684 | # via importlib-metadata ``````` `\\?\D:\Coding\ai\run-compose.sh`: ```````sh 1 | #!/bin/bash 2 | 3 | # Define color and formatting codes 4 | BOLD='\033[1m' 5 | GREEN='\033[1;32m' 6 | WHITE='\033[1;37m' 7 | RED='\033[0;31m' 8 | NC='\033[0m' # No Color 9 | # Unicode character for tick mark 10 | TICK='\u2713' 11 | 12 | # Detect GPU driver 13 | get_gpu_driver() { 14 | # Detect NVIDIA GPUs using lspci or nvidia-smi 15 | if lspci | grep -i nvidia >/dev/null || nvidia-smi >/dev/null 2>&1; then 16 | echo "nvidia" 17 | return 18 | fi 19 | 20 | # Detect AMD GPUs (including GCN architecture check for amdgpu vs radeon) 21 | if lspci | grep -i amd >/dev/null; then 22 | # List of known GCN and later architecture cards 23 | # This is a simplified list, and in a real-world scenario, you'd want a more comprehensive one 24 | local gcn_and_later=("Radeon HD 7000" "Radeon HD 8000" "Radeon R5" "Radeon R7" "Radeon R9" "Radeon RX") 25 | 26 | # Get GPU information 27 | local gpu_info=$(lspci | grep -i 'vga.*amd') 28 | 29 | for model in "${gcn_and_later[@]}"; do 30 | if echo "$gpu_info" | grep -iq "$model"; then 31 | echo "amdgpu" 32 | return 33 | fi 34 | done 35 | 36 | # Default to radeon if no GCN or later architecture is detected 37 | echo "radeon" 38 | return 39 | fi 40 | 41 | # Detect Intel GPUs 42 | if lspci | grep -i intel >/dev/null; then 43 | echo "i915" 44 | return 45 | fi 46 | 47 | # If no known GPU is detected 48 | echo "Unknown or unsupported GPU driver" 49 | exit 1 50 | } 51 | 52 | # Function for rolling animation 53 | show_loading() { 54 | local spin='-\|/' 55 | local i=0 56 | 57 | printf " " 58 | 59 | while kill -0 $1 2>/dev/null; do 60 | i=$(( (i+1) %4 )) 61 | printf "\b${spin:$i:1}" 62 | sleep .1 63 | done 64 | 65 | # Replace the spinner with a tick 66 | printf "\b${GREEN}${TICK}${NC}" 67 | } 68 | 69 | # Usage information 70 | usage() { 71 | echo "Usage: $0 [OPTIONS]" 72 | echo "Options:" 73 | echo " --enable-gpu[count=COUNT] Enable GPU support with the specified count." 74 | echo " --enable-api[port=PORT] Enable API and expose it on the specified port." 75 | echo " --webui[port=PORT] Set the port for the web user interface." 76 | echo " --data[folder=PATH] Bind mount for ollama data folder (by default will create the 'ollama' volume)." 77 | echo " --build Build the docker image before running the compose project." 78 | echo " --drop Drop the compose project." 79 | echo " -q, --quiet Run script in headless mode." 80 | echo " -h, --help Show this help message." 81 | echo "" 82 | echo "Examples:" 83 | echo " $0 --drop" 84 | echo " $0 --enable-gpu[count=1]" 85 | echo " $0 --enable-gpu[count=all]" 86 | echo " $0 --enable-api[port=11435]" 87 | echo " $0 --enable-gpu[count=1] --enable-api[port=12345] --webui[port=3000]" 88 | echo " $0 --enable-gpu[count=1] --enable-api[port=12345] --webui[port=3000] --data[folder=./ollama-data]" 89 | echo " $0 --enable-gpu[count=1] --enable-api[port=12345] --webui[port=3000] --data[folder=./ollama-data] --build" 90 | echo "" 91 | echo "This script configures and runs a docker-compose setup with optional GPU support, API exposure, and web UI configuration." 92 | echo "About the gpu to use, the script automatically detects it using the "lspci" command." 93 | echo "In this case the gpu detected is: $(get_gpu_driver)" 94 | } 95 | 96 | # Default values 97 | gpu_count=1 98 | api_port=11435 99 | webui_port=3000 100 | headless=false 101 | build_image=false 102 | kill_compose=false 103 | 104 | # Function to extract value from the parameter 105 | extract_value() { 106 | echo "$1" | sed -E 's/.*\[.*=(.*)\].*/\1/; t; s/.*//' 107 | } 108 | 109 | # Parse arguments 110 | while [[ $# -gt 0 ]]; do 111 | key="$1" 112 | 113 | case $key in 114 | --enable-gpu*) 115 | enable_gpu=true 116 | value=$(extract_value "$key") 117 | gpu_count=${value:-1} 118 | ;; 119 | --enable-api*) 120 | enable_api=true 121 | value=$(extract_value "$key") 122 | api_port=${value:-11435} 123 | ;; 124 | --webui*) 125 | value=$(extract_value "$key") 126 | webui_port=${value:-3000} 127 | ;; 128 | --data*) 129 | value=$(extract_value "$key") 130 | data_dir=${value:-"./ollama-data"} 131 | ;; 132 | --drop) 133 | kill_compose=true 134 | ;; 135 | --build) 136 | build_image=true 137 | ;; 138 | -q|--quiet) 139 | headless=true 140 | ;; 141 | -h|--help) 142 | usage 143 | exit 144 | ;; 145 | *) 146 | # Unknown option 147 | echo "Unknown option: $key" 148 | usage 149 | exit 1 150 | ;; 151 | esac 152 | shift # past argument or value 153 | done 154 | 155 | if [[ $kill_compose == true ]]; then 156 | docker compose down --remove-orphans 157 | echo -e "${GREEN}${BOLD}Compose project dropped successfully.${NC}" 158 | exit 159 | else 160 | DEFAULT_COMPOSE_COMMAND="docker compose -f docker-compose.yaml" 161 | if [[ $enable_gpu == true ]]; then 162 | # Validate and process command-line arguments 163 | if [[ -n $gpu_count ]]; then 164 | if ! [[ $gpu_count =~ ^([0-9]+|all)$ ]]; then 165 | echo "Invalid GPU count: $gpu_count" 166 | exit 1 167 | fi 168 | echo "Enabling GPU with $gpu_count GPUs" 169 | # Add your GPU allocation logic here 170 | export OLLAMA_GPU_DRIVER=$(get_gpu_driver) 171 | export OLLAMA_GPU_COUNT=$gpu_count # Set OLLAMA_GPU_COUNT environment variable 172 | fi 173 | DEFAULT_COMPOSE_COMMAND+=" -f docker-compose.gpu.yaml" 174 | fi 175 | if [[ $enable_api == true ]]; then 176 | DEFAULT_COMPOSE_COMMAND+=" -f docker-compose.api.yaml" 177 | if [[ -n $api_port ]]; then 178 | export OLLAMA_WEBAPI_PORT=$api_port # Set OLLAMA_WEBAPI_PORT environment variable 179 | fi 180 | fi 181 | if [[ -n $data_dir ]]; then 182 | DEFAULT_COMPOSE_COMMAND+=" -f docker-compose.data.yaml" 183 | export OLLAMA_DATA_DIR=$data_dir # Set OLLAMA_DATA_DIR environment variable 184 | fi 185 | if [[ -n $webui_port ]]; then 186 | export OPEN_WEBUI_PORT=$webui_port # Set OPEN_WEBUI_PORT environment variable 187 | fi 188 | DEFAULT_COMPOSE_COMMAND+=" up -d" 189 | DEFAULT_COMPOSE_COMMAND+=" --remove-orphans" 190 | DEFAULT_COMPOSE_COMMAND+=" --force-recreate" 191 | if [[ $build_image == true ]]; then 192 | DEFAULT_COMPOSE_COMMAND+=" --build" 193 | fi 194 | fi 195 | 196 | # Recap of environment variables 197 | echo 198 | echo -e "${WHITE}${BOLD}Current Setup:${NC}" 199 | echo -e " ${GREEN}${BOLD}GPU Driver:${NC} ${OLLAMA_GPU_DRIVER:-Not Enabled}" 200 | echo -e " ${GREEN}${BOLD}GPU Count:${NC} ${OLLAMA_GPU_COUNT:-Not Enabled}" 201 | echo -e " ${GREEN}${BOLD}WebAPI Port:${NC} ${OLLAMA_WEBAPI_PORT:-Not Enabled}" 202 | echo -e " ${GREEN}${BOLD}Data Folder:${NC} ${data_dir:-Using ollama volume}" 203 | echo -e " ${GREEN}${BOLD}WebUI Port:${NC} $webui_port" 204 | echo 205 | 206 | if [[ $headless == true ]]; then 207 | echo -ne "${WHITE}${BOLD}Running in headless mode... ${NC}" 208 | choice="y" 209 | else 210 | # Ask for user acceptance 211 | echo -ne "${WHITE}${BOLD}Do you want to proceed with current setup? (Y/n): ${NC}" 212 | read -n1 -s choice 213 | fi 214 | 215 | echo 216 | 217 | if [[ $choice == "" || $choice == "y" ]]; then 218 | # Execute the command with the current user 219 | eval "$DEFAULT_COMPOSE_COMMAND" & 220 | 221 | # Capture the background process PID 222 | PID=$! 223 | 224 | # Display the loading animation 225 | #show_loading $PID 226 | 227 | # Wait for the command to finish 228 | wait $PID 229 | 230 | echo 231 | # Check exit status 232 | if [ $? -eq 0 ]; then 233 | echo -e "${GREEN}${BOLD}Compose project started successfully.${NC}" 234 | else 235 | echo -e "${RED}${BOLD}There was an error starting the compose project.${NC}" 236 | fi 237 | else 238 | echo "Aborted." 239 | fi 240 | 241 | echo ``````` `\\?\D:\Coding\ai\run-ollama-docker.sh`: ```````sh 1 | #!/bin/bash 2 | 3 | host_port=11434 4 | container_port=11434 5 | 6 | read -r -p "Do you want ollama in Docker with GPU support? (y/n): " use_gpu 7 | 8 | docker rm -f ollama || true 9 | docker pull ollama/ollama:latest 10 | 11 | docker_args="-d -v ollama:/root/.ollama -p $host_port:$container_port --name ollama ollama/ollama" 12 | 13 | if [ "$use_gpu" = "y" ]; then 14 | docker_args="--gpus=all $docker_args" 15 | fi 16 | 17 | docker run $docker_args 18 | 19 | docker image prune -f ``````` `\\?\D:\Coding\ai\run.sh`: ```````sh 1 | #!/bin/bash 2 | 3 | image_name="open-webui" 4 | container_name="open-webui" 5 | host_port=3000 6 | container_port=8080 7 | 8 | docker build -t "$image_name" . 9 | docker stop "$container_name" &>/dev/null || true 10 | docker rm "$container_name" &>/dev/null || true 11 | 12 | docker run -d -p "$host_port":"$container_port" \ 13 | --add-host=host.docker.internal:host-gateway \ 14 | -v "${image_name}:/app/backend/data" \ 15 | --name "$container_name" \ 16 | --restart always \ 17 | "$image_name" 18 | 19 | docker image prune -f ``````` `\\?\D:\Coding\ai\scripts\prepare-pyodide.js`: ```````js 1 | const packages = [ 2 | 'micropip', 3 | 'packaging', 4 | 'requests', 5 | 'beautifulsoup4', 6 | 'numpy', 7 | 'pandas', 8 | 'matplotlib', 9 | 'scikit-learn', 10 | 'scipy', 11 | 'regex', 12 | 'seaborn' 13 | ]; 14 | 15 | import { loadPyodide } from 'pyodide'; 16 | import { writeFile, readFile, copyFile, readdir, rmdir } from 'fs/promises'; 17 | 18 | async function downloadPackages() { 19 | console.log('Setting up pyodide + micropip'); 20 | 21 | let pyodide; 22 | try { 23 | pyodide = await loadPyodide({ 24 | packageCacheDir: 'static/pyodide' 25 | }); 26 | } catch (err) { 27 | console.error('Failed to load Pyodide:', err); 28 | return; 29 | } 30 | 31 | const packageJson = JSON.parse(await readFile('package.json')); 32 | const pyodideVersion = packageJson.dependencies.pyodide.replace('^', ''); 33 | 34 | try { 35 | const pyodidePackageJson = JSON.parse(await readFile('static/pyodide/package.json')); 36 | const pyodidePackageVersion = pyodidePackageJson.version.replace('^', ''); 37 | 38 | if (pyodideVersion !== pyodidePackageVersion) { 39 | console.log('Pyodide version mismatch, removing static/pyodide directory'); 40 | await rmdir('static/pyodide', { recursive: true }); 41 | } 42 | } catch (e) { 43 | console.log('Pyodide package not found, proceeding with download.'); 44 | } 45 | 46 | try { 47 | console.log('Loading micropip package'); 48 | await pyodide.loadPackage('micropip'); 49 | 50 | const micropip = pyodide.pyimport('micropip'); 51 | console.log('Downloading Pyodide packages:', packages); 52 | 53 | try { 54 | for (const pkg of packages) { 55 | console.log(`Installing package: ${pkg}`); 56 | await micropip.install(pkg); 57 | } 58 | } catch (err) { 59 | console.error('Package installation failed:', err); 60 | return; 61 | } 62 | 63 | console.log('Pyodide packages downloaded, freezing into lock file'); 64 | 65 | try { 66 | const lockFile = await micropip.freeze(); 67 | await writeFile('static/pyodide/pyodide-lock.json', lockFile); 68 | } catch (err) { 69 | console.error('Failed to write lock file:', err); 70 | } 71 | } catch (err) { 72 | console.error('Failed to load or install micropip:', err); 73 | } 74 | } 75 | 76 | async function copyPyodide() { 77 | console.log('Copying Pyodide files into static directory'); 78 | // Copy all files from node_modules/pyodide to static/pyodide 79 | for await (const entry of await readdir('node_modules/pyodide')) { 80 | await copyFile(`node_modules/pyodide/${entry}`, `static/pyodide/${entry}`); 81 | } 82 | } 83 | 84 | await downloadPackages(); 85 | await copyPyodide(); ``````` `\\?\D:\Coding\ai\src\app.css`: ```````css 1 | @font-face { 2 | font-family: 'Inter'; 3 | src: url('/assets/fonts/Inter-Variable.ttf'); 4 | font-display: swap; 5 | } 6 | 7 | @font-face { 8 | font-family: 'Archivo'; 9 | src: url('/assets/fonts/Archivo-Variable.ttf'); 10 | font-display: swap; 11 | } 12 | 13 | @font-face { 14 | font-family: 'Mona Sans'; 15 | src: url('/assets/fonts/Mona-Sans.woff2'); 16 | font-display: swap; 17 | } 18 | 19 | html { 20 | word-break: break-word; 21 | } 22 | 23 | code { 24 | /* white-space-collapse: preserve !important; */ 25 | overflow-x: auto; 26 | width: auto; 27 | } 28 | 29 | math { 30 | margin-top: 1rem; 31 | } 32 | 33 | .hljs { 34 | @apply rounded-lg; 35 | } 36 | 37 | .markdown a { 38 | @apply underline; 39 | } 40 | 41 | .font-primary { 42 | font-family: 'Archivo', sans-serif; 43 | } 44 | 45 | iframe { 46 | @apply rounded-lg; 47 | } 48 | 49 | ol > li { 50 | counter-increment: list-number; 51 | display: block; 52 | margin-bottom: 0; 53 | margin-top: 0; 54 | min-height: 28px; 55 | } 56 | 57 | .prose ol > li::before { 58 | content: counters(list-number, '.') '.'; 59 | padding-right: 0.5rem; 60 | color: var(--tw-prose-counters); 61 | font-weight: 400; 62 | } 63 | 64 | li p { 65 | display: inline; 66 | } 67 | 68 | ::-webkit-scrollbar-thumb { 69 | --tw-border-opacity: 1; 70 | background-color: rgba(217, 217, 227, 0.8); 71 | border-color: rgba(255, 255, 255, var(--tw-border-opacity)); 72 | border-radius: 9999px; 73 | border-width: 1px; 74 | } 75 | 76 | ::-webkit-scrollbar { 77 | height: 0.4rem; 78 | width: 0.4rem; 79 | } 80 | 81 | ::-webkit-scrollbar-track { 82 | background-color: transparent; 83 | border-radius: 9999px; 84 | } 85 | 86 | select { 87 | background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E"); 88 | background-position: right 0.5rem center; 89 | background-repeat: no-repeat; 90 | background-size: 1.5em 1.5em; 91 | padding-right: 2.5rem; 92 | -webkit-print-color-adjust: exact; 93 | print-color-adjust: exact; 94 | /* for Firefox */ 95 | -moz-appearance: none; 96 | /* for Chrome */ 97 | -webkit-appearance: none; 98 | } 99 | 100 | .katex-mathml { 101 | display: none; 102 | } 103 | 104 | .scrollbar-hidden:active::-webkit-scrollbar-thumb, 105 | .scrollbar-hidden:focus::-webkit-scrollbar-thumb, 106 | .scrollbar-hidden:hover::-webkit-scrollbar-thumb { 107 | visibility: visible; 108 | } 109 | .scrollbar-hidden::-webkit-scrollbar-thumb { 110 | visibility: hidden; 111 | } 112 | 113 | .scrollbar-hidden::-webkit-scrollbar-corner { 114 | display: none; 115 | } 116 | 117 | .scrollbar-none::-webkit-scrollbar { 118 | display: none; /* for Chrome, Safari and Opera */ 119 | } 120 | 121 | .scrollbar-none::-webkit-scrollbar-corner { 122 | display: none; 123 | } 124 | 125 | .scrollbar-none { 126 | -ms-overflow-style: none; /* IE and Edge */ 127 | scrollbar-width: none; /* Firefox */ 128 | } 129 | 130 | input::-webkit-outer-spin-button, 131 | input::-webkit-inner-spin-button { 132 | /* display: none; <- Crashes Chrome on hover */ 133 | -webkit-appearance: none; 134 | margin: 0; /* <-- Apparently some margin are still there even though it's hidden */ 135 | } 136 | 137 | input[type='number'] { 138 | -moz-appearance: textfield; /* Firefox */ 139 | } 140 | 141 | .cm-editor { 142 | height: 100%; 143 | width: 100%; 144 | } 145 | 146 | .cm-scroller { 147 | @apply scrollbar-hidden; 148 | } 149 | 150 | .cm-editor.cm-focused { 151 | outline: none; 152 | } 153 | 154 | .tippy-box[data-theme~='dark'] { 155 | @apply rounded-lg bg-gray-950 text-xs border border-gray-900 shadow-xl; 156 | } ``````` `\\?\D:\Coding\ai\src\app.d.ts`: ```````ts 1 | // See https://kit.svelte.dev/docs/types#app 2 | // for information about these interfaces 3 | declare global { 4 | namespace App { 5 | // interface Error {} 6 | // interface Locals {} 7 | // interface PageData {} 8 | // interface Platform {} 9 | } 10 | } 11 | 12 | export {}; ``````` `\\?\D:\Coding\ai\src\app.html`: ```````html 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 21 | 22 | 27 | 28 | 89 | 90 | Open WebUI 91 | 92 | %sveltekit.head% 93 | 94 | 95 | 96 |
%sveltekit.body%
97 | 98 |
102 | 107 | 108 | 120 | 121 |
135 | 141 | 142 |
143 |
154 | 155 |
166 |
167 |
168 | 169 | 172 |
173 | 183 | 184 | 185 | 186 | ``````` `\\?\D:\Coding\ai\src\lib\apis\audio\index.ts`: ```````ts 1 | import { AUDIO_API_BASE_URL } from '$lib/constants'; 2 | 3 | export const getAudioConfig = async (token: string) => { 4 | let error = null; 5 | 6 | const res = await fetch(`${AUDIO_API_BASE_URL}/config`, { 7 | method: 'GET', 8 | headers: { 9 | 'Content-Type': 'application/json', 10 | Authorization: `Bearer ${token}` 11 | } 12 | }) 13 | .then(async (res) => { 14 | if (!res.ok) throw await res.json(); 15 | return res.json(); 16 | }) 17 | .catch((err) => { 18 | console.log(err); 19 | error = err.detail; 20 | return null; 21 | }); 22 | 23 | if (error) { 24 | throw error; 25 | } 26 | 27 | return res; 28 | }; 29 | 30 | type OpenAIConfigForm = { 31 | url: string; 32 | key: string; 33 | model: string; 34 | speaker: string; 35 | }; 36 | 37 | export const updateAudioConfig = async (token: string, payload: OpenAIConfigForm) => { 38 | let error = null; 39 | 40 | const res = await fetch(`${AUDIO_API_BASE_URL}/config/update`, { 41 | method: 'POST', 42 | headers: { 43 | 'Content-Type': 'application/json', 44 | Authorization: `Bearer ${token}` 45 | }, 46 | body: JSON.stringify({ 47 | ...payload 48 | }) 49 | }) 50 | .then(async (res) => { 51 | if (!res.ok) throw await res.json(); 52 | return res.json(); 53 | }) 54 | .catch((err) => { 55 | console.log(err); 56 | error = err.detail; 57 | return null; 58 | }); 59 | 60 | if (error) { 61 | throw error; 62 | } 63 | 64 | return res; 65 | }; 66 | 67 | export const transcribeAudio = async (token: string, file: File) => { 68 | const data = new FormData(); 69 | data.append('file', file); 70 | 71 | let error = null; 72 | const res = await fetch(`${AUDIO_API_BASE_URL}/transcriptions`, { 73 | method: 'POST', 74 | headers: { 75 | Accept: 'application/json', 76 | authorization: `Bearer ${token}` 77 | }, 78 | body: data 79 | }) 80 | .then(async (res) => { 81 | if (!res.ok) throw await res.json(); 82 | return res.json(); 83 | }) 84 | .catch((err) => { 85 | error = err.detail; 86 | console.log(err); 87 | return null; 88 | }); 89 | 90 | if (error) { 91 | throw error; 92 | } 93 | 94 | return res; 95 | }; 96 | 97 | export const synthesizeOpenAISpeech = async ( 98 | token: string = '', 99 | speaker: string = 'alloy', 100 | text: string = '', 101 | model?: string 102 | ) => { 103 | let error = null; 104 | 105 | const res = await fetch(`${AUDIO_API_BASE_URL}/speech`, { 106 | method: 'POST', 107 | headers: { 108 | Authorization: `Bearer ${token}`, 109 | 'Content-Type': 'application/json' 110 | }, 111 | body: JSON.stringify({ 112 | input: text, 113 | voice: speaker, 114 | ...(model && { model }) 115 | }) 116 | }) 117 | .then(async (res) => { 118 | if (!res.ok) throw await res.json(); 119 | return res; 120 | }) 121 | .catch((err) => { 122 | error = err.detail; 123 | console.log(err); 124 | 125 | return null; 126 | }); 127 | 128 | if (error) { 129 | throw error; 130 | } 131 | 132 | return res; 133 | }; ``````` `\\?\D:\Coding\ai\src\lib\apis\auths\index.ts`: ```````ts 1 | import { WEBUI_API_BASE_URL } from '$lib/constants'; 2 | 3 | export const getAdminDetails = async (token: string) => { 4 | let error = null; 5 | 6 | const res = await fetch(`${WEBUI_API_BASE_URL}/auths/admin/details`, { 7 | method: 'GET', 8 | headers: { 9 | 'Content-Type': 'application/json', 10 | Authorization: `Bearer ${token}` 11 | } 12 | }) 13 | .then(async (res) => { 14 | if (!res.ok) throw await res.json(); 15 | return res.json(); 16 | }) 17 | .catch((err) => { 18 | console.log(err); 19 | error = err.detail; 20 | return null; 21 | }); 22 | 23 | if (error) { 24 | throw error; 25 | } 26 | 27 | return res; 28 | }; 29 | 30 | export const getAdminConfig = async (token: string) => { 31 | let error = null; 32 | 33 | const res = await fetch(`${WEBUI_API_BASE_URL}/auths/admin/config`, { 34 | method: 'GET', 35 | headers: { 36 | 'Content-Type': 'application/json', 37 | Authorization: `Bearer ${token}` 38 | } 39 | }) 40 | .then(async (res) => { 41 | if (!res.ok) throw await res.json(); 42 | return res.json(); 43 | }) 44 | .catch((err) => { 45 | console.log(err); 46 | error = err.detail; 47 | return null; 48 | }); 49 | 50 | if (error) { 51 | throw error; 52 | } 53 | 54 | return res; 55 | }; 56 | 57 | export const updateAdminConfig = async (token: string, body: object) => { 58 | let error = null; 59 | 60 | const res = await fetch(`${WEBUI_API_BASE_URL}/auths/admin/config`, { 61 | method: 'POST', 62 | headers: { 63 | 'Content-Type': 'application/json', 64 | Authorization: `Bearer ${token}` 65 | }, 66 | body: JSON.stringify(body) 67 | }) 68 | .then(async (res) => { 69 | if (!res.ok) throw await res.json(); 70 | return res.json(); 71 | }) 72 | .catch((err) => { 73 | console.log(err); 74 | error = err.detail; 75 | return null; 76 | }); 77 | 78 | if (error) { 79 | throw error; 80 | } 81 | 82 | return res; 83 | }; 84 | 85 | export const getSessionUser = async (token: string) => { 86 | let error = null; 87 | 88 | const res = await fetch(`${WEBUI_API_BASE_URL}/auths/`, { 89 | method: 'GET', 90 | headers: { 91 | 'Content-Type': 'application/json', 92 | Authorization: `Bearer ${token}` 93 | }, 94 | credentials: 'include' 95 | }) 96 | .then(async (res) => { 97 | if (!res.ok) throw await res.json(); 98 | return res.json(); 99 | }) 100 | .catch((err) => { 101 | console.log(err); 102 | error = err.detail; 103 | return null; 104 | }); 105 | 106 | if (error) { 107 | throw error; 108 | } 109 | 110 | return res; 111 | }; 112 | 113 | export const userSignIn = async (email: string, password: string) => { 114 | let error = null; 115 | 116 | const res = await fetch(`${WEBUI_API_BASE_URL}/auths/signin`, { 117 | method: 'POST', 118 | headers: { 119 | 'Content-Type': 'application/json' 120 | }, 121 | credentials: 'include', 122 | body: JSON.stringify({ 123 | email: email, 124 | password: password 125 | }) 126 | }) 127 | .then(async (res) => { 128 | if (!res.ok) throw await res.json(); 129 | return res.json(); 130 | }) 131 | .catch((err) => { 132 | console.log(err); 133 | 134 | error = err.detail; 135 | return null; 136 | }); 137 | 138 | if (error) { 139 | throw error; 140 | } 141 | 142 | return res; 143 | }; 144 | 145 | export const userSignUp = async ( 146 | name: string, 147 | email: string, 148 | password: string, 149 | profile_image_url: string 150 | ) => { 151 | let error = null; 152 | 153 | const res = await fetch(`${WEBUI_API_BASE_URL}/auths/signup`, { 154 | method: 'POST', 155 | headers: { 156 | 'Content-Type': 'application/json' 157 | }, 158 | credentials: 'include', 159 | body: JSON.stringify({ 160 | name: name, 161 | email: email, 162 | password: password, 163 | profile_image_url: profile_image_url 164 | }) 165 | }) 166 | .then(async (res) => { 167 | if (!res.ok) throw await res.json(); 168 | return res.json(); 169 | }) 170 | .catch((err) => { 171 | console.log(err); 172 | error = err.detail; 173 | return null; 174 | }); 175 | 176 | if (error) { 177 | throw error; 178 | } 179 | 180 | return res; 181 | }; 182 | 183 | export const addUser = async ( 184 | token: string, 185 | name: string, 186 | email: string, 187 | password: string, 188 | role: string = 'pending' 189 | ) => { 190 | let error = null; 191 | 192 | const res = await fetch(`${WEBUI_API_BASE_URL}/auths/add`, { 193 | method: 'POST', 194 | headers: { 195 | 'Content-Type': 'application/json', 196 | ...(token && { authorization: `Bearer ${token}` }) 197 | }, 198 | body: JSON.stringify({ 199 | name: name, 200 | email: email, 201 | password: password, 202 | role: role 203 | }) 204 | }) 205 | .then(async (res) => { 206 | if (!res.ok) throw await res.json(); 207 | return res.json(); 208 | }) 209 | .catch((err) => { 210 | console.log(err); 211 | error = err.detail; 212 | return null; 213 | }); 214 | 215 | if (error) { 216 | throw error; 217 | } 218 | 219 | return res; 220 | }; 221 | 222 | export const updateUserProfile = async (token: string, name: string, profileImageUrl: string) => { 223 | let error = null; 224 | 225 | const res = await fetch(`${WEBUI_API_BASE_URL}/auths/update/profile`, { 226 | method: 'POST', 227 | headers: { 228 | 'Content-Type': 'application/json', 229 | ...(token && { authorization: `Bearer ${token}` }) 230 | }, 231 | body: JSON.stringify({ 232 | name: name, 233 | profile_image_url: profileImageUrl 234 | }) 235 | }) 236 | .then(async (res) => { 237 | if (!res.ok) throw await res.json(); 238 | return res.json(); 239 | }) 240 | .catch((err) => { 241 | console.log(err); 242 | error = err.detail; 243 | return null; 244 | }); 245 | 246 | if (error) { 247 | throw error; 248 | } 249 | 250 | return res; 251 | }; 252 | 253 | export const updateUserPassword = async (token: string, password: string, newPassword: string) => { 254 | let error = null; 255 | 256 | const res = await fetch(`${WEBUI_API_BASE_URL}/auths/update/password`, { 257 | method: 'POST', 258 | headers: { 259 | 'Content-Type': 'application/json', 260 | ...(token && { authorization: `Bearer ${token}` }) 261 | }, 262 | body: JSON.stringify({ 263 | password: password, 264 | new_password: newPassword 265 | }) 266 | }) 267 | .then(async (res) => { 268 | if (!res.ok) throw await res.json(); 269 | return res.json(); 270 | }) 271 | .catch((err) => { 272 | console.log(err); 273 | error = err.detail; 274 | return null; 275 | }); 276 | 277 | if (error) { 278 | throw error; 279 | } 280 | 281 | return res; 282 | }; 283 | 284 | export const getSignUpEnabledStatus = async (token: string) => { 285 | let error = null; 286 | 287 | const res = await fetch(`${WEBUI_API_BASE_URL}/auths/signup/enabled`, { 288 | method: 'GET', 289 | headers: { 290 | 'Content-Type': 'application/json', 291 | Authorization: `Bearer ${token}` 292 | } 293 | }) 294 | .then(async (res) => { 295 | if (!res.ok) throw await res.json(); 296 | return res.json(); 297 | }) 298 | .catch((err) => { 299 | console.log(err); 300 | error = err.detail; 301 | return null; 302 | }); 303 | 304 | if (error) { 305 | throw error; 306 | } 307 | 308 | return res; 309 | }; 310 | 311 | export const getDefaultUserRole = async (token: string) => { 312 | let error = null; 313 | 314 | const res = await fetch(`${WEBUI_API_BASE_URL}/auths/signup/user/role`, { 315 | method: 'GET', 316 | headers: { 317 | 'Content-Type': 'application/json', 318 | Authorization: `Bearer ${token}` 319 | } 320 | }) 321 | .then(async (res) => { 322 | if (!res.ok) throw await res.json(); 323 | return res.json(); 324 | }) 325 | .catch((err) => { 326 | console.log(err); 327 | error = err.detail; 328 | return null; 329 | }); 330 | 331 | if (error) { 332 | throw error; 333 | } 334 | 335 | return res; 336 | }; 337 | 338 | export const updateDefaultUserRole = async (token: string, role: string) => { 339 | let error = null; 340 | 341 | const res = await fetch(`${WEBUI_API_BASE_URL}/auths/signup/user/role`, { 342 | method: 'POST', 343 | headers: { 344 | 'Content-Type': 'application/json', 345 | Authorization: `Bearer ${token}` 346 | }, 347 | body: JSON.stringify({ 348 | role: role 349 | }) 350 | }) 351 | .then(async (res) => { 352 | if (!res.ok) throw await res.json(); 353 | return res.json(); 354 | }) 355 | .catch((err) => { 356 | console.log(err); 357 | error = err.detail; 358 | return null; 359 | }); 360 | 361 | if (error) { 362 | throw error; 363 | } 364 | 365 | return res; 366 | }; 367 | 368 | export const toggleSignUpEnabledStatus = async (token: string) => { 369 | let error = null; 370 | 371 | const res = await fetch(`${WEBUI_API_BASE_URL}/auths/signup/enabled/toggle`, { 372 | method: 'GET', 373 | headers: { 374 | 'Content-Type': 'application/json', 375 | Authorization: `Bearer ${token}` 376 | } 377 | }) 378 | .then(async (res) => { 379 | if (!res.ok) throw await res.json(); 380 | return res.json(); 381 | }) 382 | .catch((err) => { 383 | console.log(err); 384 | error = err.detail; 385 | return null; 386 | }); 387 | 388 | if (error) { 389 | throw error; 390 | } 391 | 392 | return res; 393 | }; 394 | 395 | export const getJWTExpiresDuration = async (token: string) => { 396 | let error = null; 397 | 398 | const res = await fetch(`${WEBUI_API_BASE_URL}/auths/token/expires`, { 399 | method: 'GET', 400 | headers: { 401 | 'Content-Type': 'application/json', 402 | Authorization: `Bearer ${token}` 403 | } 404 | }) 405 | .then(async (res) => { 406 | if (!res.ok) throw await res.json(); 407 | return res.json(); 408 | }) 409 | .catch((err) => { 410 | console.log(err); 411 | error = err.detail; 412 | return null; 413 | }); 414 | 415 | if (error) { 416 | throw error; 417 | } 418 | 419 | return res; 420 | }; 421 | 422 | export const updateJWTExpiresDuration = async (token: string, duration: string) => { 423 | let error = null; 424 | 425 | const res = await fetch(`${WEBUI_API_BASE_URL}/auths/token/expires/update`, { 426 | method: 'POST', 427 | headers: { 428 | 'Content-Type': 'application/json', 429 | Authorization: `Bearer ${token}` 430 | }, 431 | body: JSON.stringify({ 432 | duration: duration 433 | }) 434 | }) 435 | .then(async (res) => { 436 | if (!res.ok) throw await res.json(); 437 | return res.json(); 438 | }) 439 | .catch((err) => { 440 | console.log(err); 441 | error = err.detail; 442 | return null; 443 | }); 444 | 445 | if (error) { 446 | throw error; 447 | } 448 | 449 | return res; 450 | }; 451 | 452 | export const createAPIKey = async (token: string) => { 453 | let error = null; 454 | 455 | const res = await fetch(`${WEBUI_API_BASE_URL}/auths/api_key`, { 456 | method: 'POST', 457 | headers: { 458 | 'Content-Type': 'application/json', 459 | Authorization: `Bearer ${token}` 460 | } 461 | }) 462 | .then(async (res) => { 463 | if (!res.ok) throw await res.json(); 464 | return res.json(); 465 | }) 466 | .catch((err) => { 467 | console.log(err); 468 | error = err.detail; 469 | return null; 470 | }); 471 | if (error) { 472 | throw error; 473 | } 474 | return res.api_key; 475 | }; 476 | 477 | export const getAPIKey = async (token: string) => { 478 | let error = null; 479 | 480 | const res = await fetch(`${WEBUI_API_BASE_URL}/auths/api_key`, { 481 | method: 'GET', 482 | headers: { 483 | 'Content-Type': 'application/json', 484 | Authorization: `Bearer ${token}` 485 | } 486 | }) 487 | .then(async (res) => { 488 | if (!res.ok) throw await res.json(); 489 | return res.json(); 490 | }) 491 | .catch((err) => { 492 | console.log(err); 493 | error = err.detail; 494 | return null; 495 | }); 496 | if (error) { 497 | throw error; 498 | } 499 | return res.api_key; 500 | }; 501 | 502 | export const deleteAPIKey = async (token: string) => { 503 | let error = null; 504 | 505 | const res = await fetch(`${WEBUI_API_BASE_URL}/auths/api_key`, { 506 | method: 'DELETE', 507 | headers: { 508 | 'Content-Type': 'application/json', 509 | Authorization: `Bearer ${token}` 510 | } 511 | }) 512 | .then(async (res) => { 513 | if (!res.ok) throw await res.json(); 514 | return res.json(); 515 | }) 516 | .catch((err) => { 517 | console.log(err); 518 | error = err.detail; 519 | return null; 520 | }); 521 | if (error) { 522 | throw error; 523 | } 524 | return res; 525 | }; ``````` `\\?\D:\Coding\ai\src\lib\apis\chats\index.ts`: ```````ts 1 | import { WEBUI_API_BASE_URL } from '$lib/constants'; 2 | import { getTimeRange } from '$lib/utils'; 3 | 4 | export const createNewChat = async (token: string, chat: object) => { 5 | let error = null; 6 | 7 | const res = await fetch(`${WEBUI_API_BASE_URL}/chats/new`, { 8 | method: 'POST', 9 | headers: { 10 | Accept: 'application/json', 11 | 'Content-Type': 'application/json', 12 | authorization: `Bearer ${token}` 13 | }, 14 | body: JSON.stringify({ 15 | chat: chat 16 | }) 17 | }) 18 | .then(async (res) => { 19 | if (!res.ok) throw await res.json(); 20 | return res.json(); 21 | }) 22 | .catch((err) => { 23 | error = err; 24 | console.log(err); 25 | return null; 26 | }); 27 | 28 | if (error) { 29 | throw error; 30 | } 31 | 32 | return res; 33 | }; 34 | 35 | export const getChatList = async (token: string = '') => { 36 | let error = null; 37 | 38 | const res = await fetch(`${WEBUI_API_BASE_URL}/chats/`, { 39 | method: 'GET', 40 | headers: { 41 | Accept: 'application/json', 42 | 'Content-Type': 'application/json', 43 | ...(token && { authorization: `Bearer ${token}` }) 44 | } 45 | }) 46 | .then(async (res) => { 47 | if (!res.ok) throw await res.json(); 48 | return res.json(); 49 | }) 50 | .then((json) => { 51 | return json; 52 | }) 53 | .catch((err) => { 54 | error = err; 55 | console.log(err); 56 | return null; 57 | }); 58 | 59 | if (error) { 60 | throw error; 61 | } 62 | 63 | return res.map((chat) => ({ 64 | ...chat, 65 | time_range: getTimeRange(chat.updated_at) 66 | })); 67 | }; 68 | 69 | export const getChatListByUserId = async (token: string = '', userId: string) => { 70 | let error = null; 71 | 72 | const res = await fetch(`${WEBUI_API_BASE_URL}/chats/list/user/${userId}`, { 73 | method: 'GET', 74 | headers: { 75 | Accept: 'application/json', 76 | 'Content-Type': 'application/json', 77 | ...(token && { authorization: `Bearer ${token}` }) 78 | } 79 | }) 80 | .then(async (res) => { 81 | if (!res.ok) throw await res.json(); 82 | return res.json(); 83 | }) 84 | .then((json) => { 85 | return json; 86 | }) 87 | .catch((err) => { 88 | error = err; 89 | console.log(err); 90 | return null; 91 | }); 92 | 93 | if (error) { 94 | throw error; 95 | } 96 | 97 | return res.map((chat) => ({ 98 | ...chat, 99 | time_range: getTimeRange(chat.updated_at) 100 | })); 101 | }; 102 | 103 | export const getArchivedChatList = async (token: string = '') => { 104 | let error = null; 105 | 106 | const res = await fetch(`${WEBUI_API_BASE_URL}/chats/archived`, { 107 | method: 'GET', 108 | headers: { 109 | Accept: 'application/json', 110 | 'Content-Type': 'application/json', 111 | ...(token && { authorization: `Bearer ${token}` }) 112 | } 113 | }) 114 | .then(async (res) => { 115 | if (!res.ok) throw await res.json(); 116 | return res.json(); 117 | }) 118 | .then((json) => { 119 | return json; 120 | }) 121 | .catch((err) => { 122 | error = err; 123 | console.log(err); 124 | return null; 125 | }); 126 | 127 | if (error) { 128 | throw error; 129 | } 130 | 131 | return res; 132 | }; 133 | 134 | export const getAllChats = async (token: string) => { 135 | let error = null; 136 | 137 | const res = await fetch(`${WEBUI_API_BASE_URL}/chats/all`, { 138 | method: 'GET', 139 | headers: { 140 | Accept: 'application/json', 141 | 'Content-Type': 'application/json', 142 | ...(token && { authorization: `Bearer ${token}` }) 143 | } 144 | }) 145 | .then(async (res) => { 146 | if (!res.ok) throw await res.json(); 147 | return res.json(); 148 | }) 149 | .then((json) => { 150 | return json; 151 | }) 152 | .catch((err) => { 153 | error = err; 154 | console.log(err); 155 | return null; 156 | }); 157 | 158 | if (error) { 159 | throw error; 160 | } 161 | 162 | return res; 163 | }; 164 | 165 | export const getAllArchivedChats = async (token: string) => { 166 | let error = null; 167 | 168 | const res = await fetch(`${WEBUI_API_BASE_URL}/chats/all/archived`, { 169 | method: 'GET', 170 | headers: { 171 | Accept: 'application/json', 172 | 'Content-Type': 'application/json', 173 | ...(token && { authorization: `Bearer ${token}` }) 174 | } 175 | }) 176 | .then(async (res) => { 177 | if (!res.ok) throw await res.json(); 178 | return res.json(); 179 | }) 180 | .then((json) => { 181 | return json; 182 | }) 183 | .catch((err) => { 184 | error = err; 185 | console.log(err); 186 | return null; 187 | }); 188 | 189 | if (error) { 190 | throw error; 191 | } 192 | 193 | return res; 194 | }; 195 | 196 | export const getAllUserChats = async (token: string) => { 197 | let error = null; 198 | 199 | const res = await fetch(`${WEBUI_API_BASE_URL}/chats/all/db`, { 200 | method: 'GET', 201 | headers: { 202 | Accept: 'application/json', 203 | 'Content-Type': 'application/json', 204 | ...(token && { authorization: `Bearer ${token}` }) 205 | } 206 | }) 207 | .then(async (res) => { 208 | if (!res.ok) throw await res.json(); 209 | return res.json(); 210 | }) 211 | .then((json) => { 212 | return json; 213 | }) 214 | .catch((err) => { 215 | error = err; 216 | console.log(err); 217 | return null; 218 | }); 219 | 220 | if (error) { 221 | throw error; 222 | } 223 | 224 | return res; 225 | }; 226 | 227 | export const getAllChatTags = async (token: string) => { 228 | let error = null; 229 | 230 | const res = await fetch(`${WEBUI_API_BASE_URL}/chats/tags/all`, { 231 | method: 'GET', 232 | headers: { 233 | Accept: 'application/json', 234 | 'Content-Type': 'application/json', 235 | ...(token && { authorization: `Bearer ${token}` }) 236 | } 237 | }) 238 | .then(async (res) => { 239 | if (!res.ok) throw await res.json(); 240 | return res.json(); 241 | }) 242 | .then((json) => { 243 | return json; 244 | }) 245 | .catch((err) => { 246 | error = err; 247 | console.log(err); 248 | return null; 249 | }); 250 | 251 | if (error) { 252 | throw error; 253 | } 254 | 255 | return res; 256 | }; 257 | 258 | export const getChatListByTagName = async (token: string = '', tagName: string) => { 259 | let error = null; 260 | 261 | const res = await fetch(`${WEBUI_API_BASE_URL}/chats/tags`, { 262 | method: 'POST', 263 | headers: { 264 | Accept: 'application/json', 265 | 'Content-Type': 'application/json', 266 | ...(token && { authorization: `Bearer ${token}` }) 267 | }, 268 | body: JSON.stringify({ 269 | name: tagName 270 | }) 271 | }) 272 | .then(async (res) => { 273 | if (!res.ok) throw await res.json(); 274 | return res.json(); 275 | }) 276 | .then((json) => { 277 | return json; 278 | }) 279 | .catch((err) => { 280 | error = err; 281 | console.log(err); 282 | return null; 283 | }); 284 | 285 | if (error) { 286 | throw error; 287 | } 288 | 289 | return res.map((chat) => ({ 290 | ...chat, 291 | time_range: getTimeRange(chat.updated_at) 292 | })); 293 | }; 294 | 295 | export const getChatById = async (token: string, id: string) => { 296 | let error = null; 297 | 298 | const res = await fetch(`${WEBUI_API_BASE_URL}/chats/${id}`, { 299 | method: 'GET', 300 | headers: { 301 | Accept: 'application/json', 302 | 'Content-Type': 'application/json', 303 | ...(token && { authorization: `Bearer ${token}` }) 304 | } 305 | }) 306 | .then(async (res) => { 307 | if (!res.ok) throw await res.json(); 308 | return res.json(); 309 | }) 310 | .then((json) => { 311 | return json; 312 | }) 313 | .catch((err) => { 314 | error = err; 315 | 316 | console.log(err); 317 | return null; 318 | }); 319 | 320 | if (error) { 321 | throw error; 322 | } 323 | 324 | return res; 325 | }; 326 | 327 | export const getChatByShareId = async (token: string, share_id: string) => { 328 | let error = null; 329 | 330 | const res = await fetch(`${WEBUI_API_BASE_URL}/chats/share/${share_id}`, { 331 | method: 'GET', 332 | headers: { 333 | Accept: 'application/json', 334 | 'Content-Type': 'application/json', 335 | ...(token && { authorization: `Bearer ${token}` }) 336 | } 337 | }) 338 | .then(async (res) => { 339 | if (!res.ok) throw await res.json(); 340 | return res.json(); 341 | }) 342 | .then((json) => { 343 | return json; 344 | }) 345 | .catch((err) => { 346 | error = err; 347 | 348 | console.log(err); 349 | return null; 350 | }); 351 | 352 | if (error) { 353 | throw error; 354 | } 355 | 356 | return res; 357 | }; 358 | 359 | export const cloneChatById = async (token: string, id: string) => { 360 | let error = null; 361 | 362 | const res = await fetch(`${WEBUI_API_BASE_URL}/chats/${id}/clone`, { 363 | method: 'GET', 364 | headers: { 365 | Accept: 'application/json', 366 | 'Content-Type': 'application/json', 367 | ...(token && { authorization: `Bearer ${token}` }) 368 | } 369 | }) 370 | .then(async (res) => { 371 | if (!res.ok) throw await res.json(); 372 | return res.json(); 373 | }) 374 | .then((json) => { 375 | return json; 376 | }) 377 | .catch((err) => { 378 | error = err; 379 | 380 | if ('detail' in err) { 381 | error = err.detail; 382 | } else { 383 | error = err; 384 | } 385 | 386 | console.log(err); 387 | return null; 388 | }); 389 | 390 | if (error) { 391 | throw error; 392 | } 393 | 394 | return res; 395 | }; 396 | 397 | export const shareChatById = async (token: string, id: string) => { 398 | let error = null; 399 | 400 | const res = await fetch(`${WEBUI_API_BASE_URL}/chats/${id}/share`, { 401 | method: 'POST', 402 | headers: { 403 | Accept: 'application/json', 404 | 'Content-Type': 'application/json', 405 | ...(token && { authorization: `Bearer ${token}` }) 406 | } 407 | }) 408 | .then(async (res) => { 409 | if (!res.ok) throw await res.json(); 410 | return res.json(); 411 | }) 412 | .then((json) => { 413 | return json; 414 | }) 415 | .catch((err) => { 416 | error = err; 417 | 418 | console.log(err); 419 | return null; 420 | }); 421 | 422 | if (error) { 423 | throw error; 424 | } 425 | 426 | return res; 427 | }; 428 | 429 | export const archiveChatById = async (token: string, id: string) => { 430 | let error = null; 431 | 432 | const res = await fetch(`${WEBUI_API_BASE_URL}/chats/${id}/archive`, { 433 | method: 'GET', 434 | headers: { 435 | Accept: 'application/json', 436 | 'Content-Type': 'application/json', 437 | ...(token && { authorization: `Bearer ${token}` }) 438 | } 439 | }) 440 | .then(async (res) => { 441 | if (!res.ok) throw await res.json(); 442 | return res.json(); 443 | }) 444 | .then((json) => { 445 | return json; 446 | }) 447 | .catch((err) => { 448 | error = err; 449 | 450 | console.log(err); 451 | return null; 452 | }); 453 | 454 | if (error) { 455 | throw error; 456 | } 457 | 458 | return res; 459 | }; 460 | 461 | export const deleteSharedChatById = async (token: string, id: string) => { 462 | let error = null; 463 | 464 | const res = await fetch(`${WEBUI_API_BASE_URL}/chats/${id}/share`, { 465 | method: 'DELETE', 466 | headers: { 467 | Accept: 'application/json', 468 | 'Content-Type': 'application/json', 469 | ...(token && { authorization: `Bearer ${token}` }) 470 | } 471 | }) 472 | .then(async (res) => { 473 | if (!res.ok) throw await res.json(); 474 | return res.json(); 475 | }) 476 | .then((json) => { 477 | return json; 478 | }) 479 | .catch((err) => { 480 | error = err; 481 | 482 | console.log(err); 483 | return null; 484 | }); 485 | 486 | if (error) { 487 | throw error; 488 | } 489 | 490 | return res; 491 | }; 492 | 493 | export const updateChatById = async (token: string, id: string, chat: object) => { 494 | let error = null; 495 | 496 | const res = await fetch(`${WEBUI_API_BASE_URL}/chats/${id}`, { 497 | method: 'POST', 498 | headers: { 499 | Accept: 'application/json', 500 | 'Content-Type': 'application/json', 501 | ...(token && { authorization: `Bearer ${token}` }) 502 | }, 503 | body: JSON.stringify({ 504 | chat: chat 505 | }) 506 | }) 507 | .then(async (res) => { 508 | if (!res.ok) throw await res.json(); 509 | return res.json(); 510 | }) 511 | .then((json) => { 512 | return json; 513 | }) 514 | .catch((err) => { 515 | error = err; 516 | 517 | console.log(err); 518 | return null; 519 | }); 520 | 521 | if (error) { 522 | throw error; 523 | } 524 | 525 | return res; 526 | }; 527 | 528 | export const deleteChatById = async (token: string, id: string) => { 529 | let error = null; 530 | 531 | const res = await fetch(`${WEBUI_API_BASE_URL}/chats/${id}`, { 532 | method: 'DELETE', 533 | headers: { 534 | Accept: 'application/json', 535 | 'Content-Type': 'application/json', 536 | ...(token && { authorization: `Bearer ${token}` }) 537 | } 538 | }) 539 | .then(async (res) => { 540 | if (!res.ok) throw await res.json(); 541 | return res.json(); 542 | }) 543 | .then((json) => { 544 | return json; 545 | }) 546 | .catch((err) => { 547 | error = err.detail; 548 | 549 | console.log(err); 550 | return null; 551 | }); 552 | 553 | if (error) { 554 | throw error; 555 | } 556 | 557 | return res; 558 | }; 559 | 560 | export const getTagsById = async (token: string, id: string) => { 561 | let error = null; 562 | 563 | const res = await fetch(`${WEBUI_API_BASE_URL}/chats/${id}/tags`, { 564 | method: 'GET', 565 | headers: { 566 | Accept: 'application/json', 567 | 'Content-Type': 'application/json', 568 | ...(token && { authorization: `Bearer ${token}` }) 569 | } 570 | }) 571 | .then(async (res) => { 572 | if (!res.ok) throw await res.json(); 573 | return res.json(); 574 | }) 575 | .then((json) => { 576 | return json; 577 | }) 578 | .catch((err) => { 579 | error = err; 580 | 581 | console.log(err); 582 | return null; 583 | }); 584 | 585 | if (error) { 586 | throw error; 587 | } 588 | 589 | return res; 590 | }; 591 | 592 | export const addTagById = async (token: string, id: string, tagName: string) => { 593 | let error = null; 594 | 595 | const res = await fetch(`${WEBUI_API_BASE_URL}/chats/${id}/tags`, { 596 | method: 'POST', 597 | headers: { 598 | Accept: 'application/json', 599 | 'Content-Type': 'application/json', 600 | ...(token && { authorization: `Bearer ${token}` }) 601 | }, 602 | body: JSON.stringify({ 603 | tag_name: tagName, 604 | chat_id: id 605 | }) 606 | }) 607 | .then(async (res) => { 608 | if (!res.ok) throw await res.json(); 609 | return res.json(); 610 | }) 611 | .then((json) => { 612 | return json; 613 | }) 614 | .catch((err) => { 615 | error = err; 616 | 617 | console.log(err); 618 | return null; 619 | }); 620 | 621 | if (error) { 622 | throw error; 623 | } 624 | 625 | return res; 626 | }; 627 | 628 | export const deleteTagById = async (token: string, id: string, tagName: string) => { 629 | let error = null; 630 | 631 | const res = await fetch(`${WEBUI_API_BASE_URL}/chats/${id}/tags`, { 632 | method: 'DELETE', 633 | headers: { 634 | Accept: 'application/json', 635 | 'Content-Type': 'application/json', 636 | ...(token && { authorization: `Bearer ${token}` }) 637 | }, 638 | body: JSON.stringify({ 639 | tag_name: tagName, 640 | chat_id: id 641 | }) 642 | }) 643 | .then(async (res) => { 644 | if (!res.ok) throw await res.json(); 645 | return res.json(); 646 | }) 647 | .then((json) => { 648 | return json; 649 | }) 650 | .catch((err) => { 651 | error = err; 652 | 653 | console.log(err); 654 | return null; 655 | }); 656 | 657 | if (error) { 658 | throw error; 659 | } 660 | 661 | return res; 662 | }; 663 | export const deleteTagsById = async (token: string, id: string) => { 664 | let error = null; 665 | 666 | const res = await fetch(`${WEBUI_API_BASE_URL}/chats/${id}/tags/all`, { 667 | method: 'DELETE', 668 | headers: { 669 | Accept: 'application/json', 670 | 'Content-Type': 'application/json', 671 | ...(token && { authorization: `Bearer ${token}` }) 672 | } 673 | }) 674 | .then(async (res) => { 675 | if (!res.ok) throw await res.json(); 676 | return res.json(); 677 | }) 678 | .then((json) => { 679 | return json; 680 | }) 681 | .catch((err) => { 682 | error = err; 683 | 684 | console.log(err); 685 | return null; 686 | }); 687 | 688 | if (error) { 689 | throw error; 690 | } 691 | 692 | return res; 693 | }; 694 | 695 | export const deleteAllChats = async (token: string) => { 696 | let error = null; 697 | 698 | const res = await fetch(`${WEBUI_API_BASE_URL}/chats/`, { 699 | method: 'DELETE', 700 | headers: { 701 | Accept: 'application/json', 702 | 'Content-Type': 'application/json', 703 | ...(token && { authorization: `Bearer ${token}` }) 704 | } 705 | }) 706 | .then(async (res) => { 707 | if (!res.ok) throw await res.json(); 708 | return res.json(); 709 | }) 710 | .then((json) => { 711 | return json; 712 | }) 713 | .catch((err) => { 714 | error = err.detail; 715 | 716 | console.log(err); 717 | return null; 718 | }); 719 | 720 | if (error) { 721 | throw error; 722 | } 723 | 724 | return res; 725 | }; 726 | 727 | export const archiveAllChats = async (token: string) => { 728 | let error = null; 729 | 730 | const res = await fetch(`${WEBUI_API_BASE_URL}/chats/archive/all`, { 731 | method: 'POST', 732 | headers: { 733 | Accept: 'application/json', 734 | 'Content-Type': 'application/json', 735 | ...(token && { authorization: `Bearer ${token}` }) 736 | } 737 | }) 738 | .then(async (res) => { 739 | if (!res.ok) throw await res.json(); 740 | return res.json(); 741 | }) 742 | .then((json) => { 743 | return json; 744 | }) 745 | .catch((err) => { 746 | error = err.detail; 747 | 748 | console.log(err); 749 | return null; 750 | }); 751 | 752 | if (error) { 753 | throw error; 754 | } 755 | 756 | return res; 757 | }; ``````` `\\?\D:\Coding\ai\src\lib\apis\configs\index.ts`: ```````ts 1 | import { WEBUI_API_BASE_URL } from '$lib/constants'; 2 | import type { Banner } from '$lib/types'; 3 | 4 | export const setDefaultModels = async (token: string, models: string) => { 5 | let error = null; 6 | 7 | const res = await fetch(`${WEBUI_API_BASE_URL}/configs/default/models`, { 8 | method: 'POST', 9 | headers: { 10 | 'Content-Type': 'application/json', 11 | Authorization: `Bearer ${token}` 12 | }, 13 | body: JSON.stringify({ 14 | models: models 15 | }) 16 | }) 17 | .then(async (res) => { 18 | if (!res.ok) throw await res.json(); 19 | return res.json(); 20 | }) 21 | .catch((err) => { 22 | console.log(err); 23 | error = err.detail; 24 | return null; 25 | }); 26 | 27 | if (error) { 28 | throw error; 29 | } 30 | 31 | return res; 32 | }; 33 | 34 | export const setDefaultPromptSuggestions = async (token: string, promptSuggestions: string) => { 35 | let error = null; 36 | 37 | const res = await fetch(`${WEBUI_API_BASE_URL}/configs/default/suggestions`, { 38 | method: 'POST', 39 | headers: { 40 | 'Content-Type': 'application/json', 41 | Authorization: `Bearer ${token}` 42 | }, 43 | body: JSON.stringify({ 44 | suggestions: promptSuggestions 45 | }) 46 | }) 47 | .then(async (res) => { 48 | if (!res.ok) throw await res.json(); 49 | return res.json(); 50 | }) 51 | .catch((err) => { 52 | console.log(err); 53 | error = err.detail; 54 | return null; 55 | }); 56 | 57 | if (error) { 58 | throw error; 59 | } 60 | 61 | return res; 62 | }; 63 | 64 | export const getBanners = async (token: string): Promise => { 65 | let error = null; 66 | 67 | const res = await fetch(`${WEBUI_API_BASE_URL}/configs/banners`, { 68 | method: 'GET', 69 | headers: { 70 | 'Content-Type': 'application/json', 71 | Authorization: `Bearer ${token}` 72 | } 73 | }) 74 | .then(async (res) => { 75 | if (!res.ok) throw await res.json(); 76 | return res.json(); 77 | }) 78 | .catch((err) => { 79 | console.log(err); 80 | error = err.detail; 81 | return null; 82 | }); 83 | 84 | if (error) { 85 | throw error; 86 | } 87 | 88 | return res; 89 | }; 90 | 91 | export const setBanners = async (token: string, banners: Banner[]) => { 92 | let error = null; 93 | 94 | const res = await fetch(`${WEBUI_API_BASE_URL}/configs/banners`, { 95 | method: 'POST', 96 | headers: { 97 | 'Content-Type': 'application/json', 98 | Authorization: `Bearer ${token}` 99 | }, 100 | body: JSON.stringify({ 101 | banners: banners 102 | }) 103 | }) 104 | .then(async (res) => { 105 | if (!res.ok) throw await res.json(); 106 | return res.json(); 107 | }) 108 | .catch((err) => { 109 | console.log(err); 110 | error = err.detail; 111 | return null; 112 | }); 113 | 114 | if (error) { 115 | throw error; 116 | } 117 | 118 | return res; 119 | }; ``````` `\\?\D:\Coding\ai\src\lib\apis\documents\index.ts`: ```````ts 1 | import { WEBUI_API_BASE_URL } from '$lib/constants'; 2 | 3 | export const createNewDoc = async ( 4 | token: string, 5 | collection_name: string, 6 | filename: string, 7 | name: string, 8 | title: string, 9 | content: object | null = null 10 | ) => { 11 | let error = null; 12 | 13 | const res = await fetch(`${WEBUI_API_BASE_URL}/documents/create`, { 14 | method: 'POST', 15 | headers: { 16 | Accept: 'application/json', 17 | 'Content-Type': 'application/json', 18 | authorization: `Bearer ${token}` 19 | }, 20 | body: JSON.stringify({ 21 | collection_name: collection_name, 22 | filename: filename, 23 | name: name, 24 | title: title, 25 | ...(content ? { content: JSON.stringify(content) } : {}) 26 | }) 27 | }) 28 | .then(async (res) => { 29 | if (!res.ok) throw await res.json(); 30 | return res.json(); 31 | }) 32 | .catch((err) => { 33 | error = err.detail; 34 | console.log(err); 35 | return null; 36 | }); 37 | 38 | if (error) { 39 | throw error; 40 | } 41 | 42 | return res; 43 | }; 44 | 45 | export const getDocs = async (token: string = '') => { 46 | let error = null; 47 | 48 | const res = await fetch(`${WEBUI_API_BASE_URL}/documents/`, { 49 | method: 'GET', 50 | headers: { 51 | Accept: 'application/json', 52 | 'Content-Type': 'application/json', 53 | authorization: `Bearer ${token}` 54 | } 55 | }) 56 | .then(async (res) => { 57 | if (!res.ok) throw await res.json(); 58 | return res.json(); 59 | }) 60 | .then((json) => { 61 | return json; 62 | }) 63 | .catch((err) => { 64 | error = err.detail; 65 | console.log(err); 66 | return null; 67 | }); 68 | 69 | if (error) { 70 | throw error; 71 | } 72 | 73 | return res; 74 | }; 75 | 76 | export const getDocByName = async (token: string, name: string) => { 77 | let error = null; 78 | 79 | const searchParams = new URLSearchParams(); 80 | searchParams.append('name', name); 81 | 82 | const res = await fetch(`${WEBUI_API_BASE_URL}/documents/docs?${searchParams.toString()}`, { 83 | method: 'GET', 84 | headers: { 85 | Accept: 'application/json', 86 | 'Content-Type': 'application/json', 87 | authorization: `Bearer ${token}` 88 | } 89 | }) 90 | .then(async (res) => { 91 | if (!res.ok) throw await res.json(); 92 | return res.json(); 93 | }) 94 | .then((json) => { 95 | return json; 96 | }) 97 | .catch((err) => { 98 | error = err.detail; 99 | 100 | console.log(err); 101 | return null; 102 | }); 103 | 104 | if (error) { 105 | throw error; 106 | } 107 | 108 | return res; 109 | }; 110 | 111 | type DocUpdateForm = { 112 | name: string; 113 | title: string; 114 | }; 115 | 116 | export const updateDocByName = async (token: string, name: string, form: DocUpdateForm) => { 117 | let error = null; 118 | 119 | const searchParams = new URLSearchParams(); 120 | searchParams.append('name', name); 121 | 122 | const res = await fetch(`${WEBUI_API_BASE_URL}/documents/doc/update?${searchParams.toString()}`, { 123 | method: 'POST', 124 | headers: { 125 | Accept: 'application/json', 126 | 'Content-Type': 'application/json', 127 | authorization: `Bearer ${token}` 128 | }, 129 | body: JSON.stringify({ 130 | name: form.name, 131 | title: form.title 132 | }) 133 | }) 134 | .then(async (res) => { 135 | if (!res.ok) throw await res.json(); 136 | return res.json(); 137 | }) 138 | .then((json) => { 139 | return json; 140 | }) 141 | .catch((err) => { 142 | error = err.detail; 143 | 144 | console.log(err); 145 | return null; 146 | }); 147 | 148 | if (error) { 149 | throw error; 150 | } 151 | 152 | return res; 153 | }; 154 | 155 | type TagDocForm = { 156 | name: string; 157 | tags: string[]; 158 | }; 159 | 160 | export const tagDocByName = async (token: string, name: string, form: TagDocForm) => { 161 | let error = null; 162 | 163 | const searchParams = new URLSearchParams(); 164 | searchParams.append('name', name); 165 | 166 | const res = await fetch(`${WEBUI_API_BASE_URL}/documents/doc/tags?${searchParams.toString()}`, { 167 | method: 'POST', 168 | headers: { 169 | Accept: 'application/json', 170 | 'Content-Type': 'application/json', 171 | authorization: `Bearer ${token}` 172 | }, 173 | body: JSON.stringify({ 174 | name: form.name, 175 | tags: form.tags 176 | }) 177 | }) 178 | .then(async (res) => { 179 | if (!res.ok) throw await res.json(); 180 | return res.json(); 181 | }) 182 | .then((json) => { 183 | return json; 184 | }) 185 | .catch((err) => { 186 | error = err.detail; 187 | 188 | console.log(err); 189 | return null; 190 | }); 191 | 192 | if (error) { 193 | throw error; 194 | } 195 | 196 | return res; 197 | }; 198 | 199 | export const deleteDocByName = async (token: string, name: string) => { 200 | let error = null; 201 | 202 | const searchParams = new URLSearchParams(); 203 | searchParams.append('name', name); 204 | 205 | const res = await fetch(`${WEBUI_API_BASE_URL}/documents/doc/delete?${searchParams.toString()}`, { 206 | method: 'DELETE', 207 | headers: { 208 | Accept: 'application/json', 209 | 'Content-Type': 'application/json', 210 | authorization: `Bearer ${token}` 211 | } 212 | }) 213 | .then(async (res) => { 214 | if (!res.ok) throw await res.json(); 215 | return res.json(); 216 | }) 217 | .then((json) => { 218 | return json; 219 | }) 220 | .catch((err) => { 221 | error = err.detail; 222 | 223 | console.log(err); 224 | return null; 225 | }); 226 | 227 | if (error) { 228 | throw error; 229 | } 230 | 231 | return res; 232 | }; ``````` `\\?\D:\Coding\ai\src\lib\apis\files\index.ts`: ```````ts 1 | import { WEBUI_API_BASE_URL } from '$lib/constants'; 2 | 3 | export const uploadFile = async (token: string, file: File) => { 4 | const data = new FormData(); 5 | data.append('file', file); 6 | let error = null; 7 | 8 | const res = await fetch(`${WEBUI_API_BASE_URL}/files/`, { 9 | method: 'POST', 10 | headers: { 11 | Accept: 'application/json', 12 | authorization: `Bearer ${token}` 13 | }, 14 | body: data 15 | }) 16 | .then(async (res) => { 17 | if (!res.ok) throw await res.json(); 18 | return res.json(); 19 | }) 20 | .catch((err) => { 21 | error = err.detail; 22 | console.log(err); 23 | return null; 24 | }); 25 | 26 | if (error) { 27 | throw error; 28 | } 29 | 30 | return res; 31 | }; 32 | 33 | export const getFiles = async (token: string = '') => { 34 | let error = null; 35 | 36 | const res = await fetch(`${WEBUI_API_BASE_URL}/files/`, { 37 | method: 'GET', 38 | headers: { 39 | Accept: 'application/json', 40 | 'Content-Type': 'application/json', 41 | authorization: `Bearer ${token}` 42 | } 43 | }) 44 | .then(async (res) => { 45 | if (!res.ok) throw await res.json(); 46 | return res.json(); 47 | }) 48 | .then((json) => { 49 | return json; 50 | }) 51 | .catch((err) => { 52 | error = err.detail; 53 | console.log(err); 54 | return null; 55 | }); 56 | 57 | if (error) { 58 | throw error; 59 | } 60 | 61 | return res; 62 | }; 63 | 64 | export const getFileById = async (token: string, id: string) => { 65 | let error = null; 66 | 67 | const res = await fetch(`${WEBUI_API_BASE_URL}/files/${id}`, { 68 | method: 'GET', 69 | headers: { 70 | Accept: 'application/json', 71 | 'Content-Type': 'application/json', 72 | authorization: `Bearer ${token}` 73 | } 74 | }) 75 | .then(async (res) => { 76 | if (!res.ok) throw await res.json(); 77 | return res.json(); 78 | }) 79 | .then((json) => { 80 | return json; 81 | }) 82 | .catch((err) => { 83 | error = err.detail; 84 | console.log(err); 85 | return null; 86 | }); 87 | 88 | if (error) { 89 | throw error; 90 | } 91 | 92 | return res; 93 | }; 94 | 95 | export const getFileContentById = async (id: string) => { 96 | let error = null; 97 | 98 | const res = await fetch(`${WEBUI_API_BASE_URL}/files/${id}/content`, { 99 | method: 'GET', 100 | headers: { 101 | Accept: 'application/json' 102 | }, 103 | credentials: 'include' 104 | }) 105 | .then(async (res) => { 106 | if (!res.ok) throw await res.json(); 107 | return await res.blob(); 108 | }) 109 | .catch((err) => { 110 | error = err.detail; 111 | console.log(err); 112 | 113 | return null; 114 | }); 115 | 116 | if (error) { 117 | throw error; 118 | } 119 | 120 | return res; 121 | }; 122 | 123 | export const deleteFileById = async (token: string, id: string) => { 124 | let error = null; 125 | 126 | const res = await fetch(`${WEBUI_API_BASE_URL}/files/${id}`, { 127 | method: 'DELETE', 128 | headers: { 129 | Accept: 'application/json', 130 | 'Content-Type': 'application/json', 131 | authorization: `Bearer ${token}` 132 | } 133 | }) 134 | .then(async (res) => { 135 | if (!res.ok) throw await res.json(); 136 | return res.json(); 137 | }) 138 | .then((json) => { 139 | return json; 140 | }) 141 | .catch((err) => { 142 | error = err.detail; 143 | console.log(err); 144 | return null; 145 | }); 146 | 147 | if (error) { 148 | throw error; 149 | } 150 | 151 | return res; 152 | }; 153 | 154 | export const deleteAllFiles = async (token: string) => { 155 | let error = null; 156 | 157 | const res = await fetch(`${WEBUI_API_BASE_URL}/files/all`, { 158 | method: 'DELETE', 159 | headers: { 160 | Accept: 'application/json', 161 | 'Content-Type': 'application/json', 162 | authorization: `Bearer ${token}` 163 | } 164 | }) 165 | .then(async (res) => { 166 | if (!res.ok) throw await res.json(); 167 | return res.json(); 168 | }) 169 | .then((json) => { 170 | return json; 171 | }) 172 | .catch((err) => { 173 | error = err.detail; 174 | console.log(err); 175 | return null; 176 | }); 177 | 178 | if (error) { 179 | throw error; 180 | } 181 | 182 | return res; 183 | }; ``````` `\\?\D:\Coding\ai\src\lib\apis\functions\index.ts`: ```````ts 1 | import { WEBUI_API_BASE_URL } from '$lib/constants'; 2 | 3 | export const createNewFunction = async (token: string, func: object) => { 4 | let error = null; 5 | 6 | const res = await fetch(`${WEBUI_API_BASE_URL}/functions/create`, { 7 | method: 'POST', 8 | headers: { 9 | Accept: 'application/json', 10 | 'Content-Type': 'application/json', 11 | authorization: `Bearer ${token}` 12 | }, 13 | body: JSON.stringify({ 14 | ...func 15 | }) 16 | }) 17 | .then(async (res) => { 18 | if (!res.ok) throw await res.json(); 19 | return res.json(); 20 | }) 21 | .catch((err) => { 22 | error = err.detail; 23 | console.log(err); 24 | return null; 25 | }); 26 | 27 | if (error) { 28 | throw error; 29 | } 30 | 31 | return res; 32 | }; 33 | 34 | export const getFunctions = async (token: string = '') => { 35 | let error = null; 36 | 37 | const res = await fetch(`${WEBUI_API_BASE_URL}/functions/`, { 38 | method: 'GET', 39 | headers: { 40 | Accept: 'application/json', 41 | 'Content-Type': 'application/json', 42 | authorization: `Bearer ${token}` 43 | } 44 | }) 45 | .then(async (res) => { 46 | if (!res.ok) throw await res.json(); 47 | return res.json(); 48 | }) 49 | .then((json) => { 50 | return json; 51 | }) 52 | .catch((err) => { 53 | error = err.detail; 54 | console.log(err); 55 | return null; 56 | }); 57 | 58 | if (error) { 59 | throw error; 60 | } 61 | 62 | return res; 63 | }; 64 | 65 | export const exportFunctions = async (token: string = '') => { 66 | let error = null; 67 | 68 | const res = await fetch(`${WEBUI_API_BASE_URL}/functions/export`, { 69 | method: 'GET', 70 | headers: { 71 | Accept: 'application/json', 72 | 'Content-Type': 'application/json', 73 | authorization: `Bearer ${token}` 74 | } 75 | }) 76 | .then(async (res) => { 77 | if (!res.ok) throw await res.json(); 78 | return res.json(); 79 | }) 80 | .then((json) => { 81 | return json; 82 | }) 83 | .catch((err) => { 84 | error = err.detail; 85 | console.log(err); 86 | return null; 87 | }); 88 | 89 | if (error) { 90 | throw error; 91 | } 92 | 93 | return res; 94 | }; 95 | 96 | export const getFunctionById = async (token: string, id: string) => { 97 | let error = null; 98 | 99 | const res = await fetch(`${WEBUI_API_BASE_URL}/functions/id/${id}`, { 100 | method: 'GET', 101 | headers: { 102 | Accept: 'application/json', 103 | 'Content-Type': 'application/json', 104 | authorization: `Bearer ${token}` 105 | } 106 | }) 107 | .then(async (res) => { 108 | if (!res.ok) throw await res.json(); 109 | return res.json(); 110 | }) 111 | .then((json) => { 112 | return json; 113 | }) 114 | .catch((err) => { 115 | error = err.detail; 116 | 117 | console.log(err); 118 | return null; 119 | }); 120 | 121 | if (error) { 122 | throw error; 123 | } 124 | 125 | return res; 126 | }; 127 | 128 | export const updateFunctionById = async (token: string, id: string, func: object) => { 129 | let error = null; 130 | 131 | const res = await fetch(`${WEBUI_API_BASE_URL}/functions/id/${id}/update`, { 132 | method: 'POST', 133 | headers: { 134 | Accept: 'application/json', 135 | 'Content-Type': 'application/json', 136 | authorization: `Bearer ${token}` 137 | }, 138 | body: JSON.stringify({ 139 | ...func 140 | }) 141 | }) 142 | .then(async (res) => { 143 | if (!res.ok) throw await res.json(); 144 | return res.json(); 145 | }) 146 | .then((json) => { 147 | return json; 148 | }) 149 | .catch((err) => { 150 | error = err.detail; 151 | 152 | console.log(err); 153 | return null; 154 | }); 155 | 156 | if (error) { 157 | throw error; 158 | } 159 | 160 | return res; 161 | }; 162 | 163 | export const deleteFunctionById = async (token: string, id: string) => { 164 | let error = null; 165 | 166 | const res = await fetch(`${WEBUI_API_BASE_URL}/functions/id/${id}/delete`, { 167 | method: 'DELETE', 168 | headers: { 169 | Accept: 'application/json', 170 | 'Content-Type': 'application/json', 171 | authorization: `Bearer ${token}` 172 | } 173 | }) 174 | .then(async (res) => { 175 | if (!res.ok) throw await res.json(); 176 | return res.json(); 177 | }) 178 | .then((json) => { 179 | return json; 180 | }) 181 | .catch((err) => { 182 | error = err.detail; 183 | 184 | console.log(err); 185 | return null; 186 | }); 187 | 188 | if (error) { 189 | throw error; 190 | } 191 | 192 | return res; 193 | }; 194 | 195 | export const toggleFunctionById = async (token: string, id: string) => { 196 | let error = null; 197 | 198 | const res = await fetch(`${WEBUI_API_BASE_URL}/functions/id/${id}/toggle`, { 199 | method: 'POST', 200 | headers: { 201 | Accept: 'application/json', 202 | 'Content-Type': 'application/json', 203 | authorization: `Bearer ${token}` 204 | } 205 | }) 206 | .then(async (res) => { 207 | if (!res.ok) throw await res.json(); 208 | return res.json(); 209 | }) 210 | .then((json) => { 211 | return json; 212 | }) 213 | .catch((err) => { 214 | error = err.detail; 215 | 216 | console.log(err); 217 | return null; 218 | }); 219 | 220 | if (error) { 221 | throw error; 222 | } 223 | 224 | return res; 225 | }; 226 | 227 | export const toggleGlobalById = async (token: string, id: string) => { 228 | let error = null; 229 | 230 | const res = await fetch(`${WEBUI_API_BASE_URL}/functions/id/${id}/toggle/global`, { 231 | method: 'POST', 232 | headers: { 233 | Accept: 'application/json', 234 | 'Content-Type': 'application/json', 235 | authorization: `Bearer ${token}` 236 | } 237 | }) 238 | .then(async (res) => { 239 | if (!res.ok) throw await res.json(); 240 | return res.json(); 241 | }) 242 | .then((json) => { 243 | return json; 244 | }) 245 | .catch((err) => { 246 | error = err.detail; 247 | 248 | console.log(err); 249 | return null; 250 | }); 251 | 252 | if (error) { 253 | throw error; 254 | } 255 | 256 | return res; 257 | }; 258 | 259 | export const getFunctionValvesById = async (token: string, id: string) => { 260 | let error = null; 261 | 262 | const res = await fetch(`${WEBUI_API_BASE_URL}/functions/id/${id}/valves`, { 263 | method: 'GET', 264 | headers: { 265 | Accept: 'application/json', 266 | 'Content-Type': 'application/json', 267 | authorization: `Bearer ${token}` 268 | } 269 | }) 270 | .then(async (res) => { 271 | if (!res.ok) throw await res.json(); 272 | return res.json(); 273 | }) 274 | .then((json) => { 275 | return json; 276 | }) 277 | .catch((err) => { 278 | error = err.detail; 279 | 280 | console.log(err); 281 | return null; 282 | }); 283 | 284 | if (error) { 285 | throw error; 286 | } 287 | 288 | return res; 289 | }; 290 | 291 | export const getFunctionValvesSpecById = async (token: string, id: string) => { 292 | let error = null; 293 | 294 | const res = await fetch(`${WEBUI_API_BASE_URL}/functions/id/${id}/valves/spec`, { 295 | method: 'GET', 296 | headers: { 297 | Accept: 'application/json', 298 | 'Content-Type': 'application/json', 299 | authorization: `Bearer ${token}` 300 | } 301 | }) 302 | .then(async (res) => { 303 | if (!res.ok) throw await res.json(); 304 | return res.json(); 305 | }) 306 | .then((json) => { 307 | return json; 308 | }) 309 | .catch((err) => { 310 | error = err.detail; 311 | 312 | console.log(err); 313 | return null; 314 | }); 315 | 316 | if (error) { 317 | throw error; 318 | } 319 | 320 | return res; 321 | }; 322 | 323 | export const updateFunctionValvesById = async (token: string, id: string, valves: object) => { 324 | let error = null; 325 | 326 | const res = await fetch(`${WEBUI_API_BASE_URL}/functions/id/${id}/valves/update`, { 327 | method: 'POST', 328 | headers: { 329 | Accept: 'application/json', 330 | 'Content-Type': 'application/json', 331 | authorization: `Bearer ${token}` 332 | }, 333 | body: JSON.stringify({ 334 | ...valves 335 | }) 336 | }) 337 | .then(async (res) => { 338 | if (!res.ok) throw await res.json(); 339 | return res.json(); 340 | }) 341 | .then((json) => { 342 | return json; 343 | }) 344 | .catch((err) => { 345 | error = err.detail; 346 | 347 | console.log(err); 348 | return null; 349 | }); 350 | 351 | if (error) { 352 | throw error; 353 | } 354 | 355 | return res; 356 | }; 357 | 358 | export const getUserValvesById = async (token: string, id: string) => { 359 | let error = null; 360 | 361 | const res = await fetch(`${WEBUI_API_BASE_URL}/functions/id/${id}/valves/user`, { 362 | method: 'GET', 363 | headers: { 364 | Accept: 'application/json', 365 | 'Content-Type': 'application/json', 366 | authorization: `Bearer ${token}` 367 | } 368 | }) 369 | .then(async (res) => { 370 | if (!res.ok) throw await res.json(); 371 | return res.json(); 372 | }) 373 | .then((json) => { 374 | return json; 375 | }) 376 | .catch((err) => { 377 | error = err.detail; 378 | 379 | console.log(err); 380 | return null; 381 | }); 382 | 383 | if (error) { 384 | throw error; 385 | } 386 | 387 | return res; 388 | }; 389 | 390 | export const getUserValvesSpecById = async (token: string, id: string) => { 391 | let error = null; 392 | 393 | const res = await fetch(`${WEBUI_API_BASE_URL}/functions/id/${id}/valves/user/spec`, { 394 | method: 'GET', 395 | headers: { 396 | Accept: 'application/json', 397 | 'Content-Type': 'application/json', 398 | authorization: `Bearer ${token}` 399 | } 400 | }) 401 | .then(async (res) => { 402 | if (!res.ok) throw await res.json(); 403 | return res.json(); 404 | }) 405 | .then((json) => { 406 | return json; 407 | }) 408 | .catch((err) => { 409 | error = err.detail; 410 | 411 | console.log(err); 412 | return null; 413 | }); 414 | 415 | if (error) { 416 | throw error; 417 | } 418 | 419 | return res; 420 | }; 421 | 422 | export const updateUserValvesById = async (token: string, id: string, valves: object) => { 423 | let error = null; 424 | 425 | const res = await fetch(`${WEBUI_API_BASE_URL}/functions/id/${id}/valves/user/update`, { 426 | method: 'POST', 427 | headers: { 428 | Accept: 'application/json', 429 | 'Content-Type': 'application/json', 430 | authorization: `Bearer ${token}` 431 | }, 432 | body: JSON.stringify({ 433 | ...valves 434 | }) 435 | }) 436 | .then(async (res) => { 437 | if (!res.ok) throw await res.json(); 438 | return res.json(); 439 | }) 440 | .then((json) => { 441 | return json; 442 | }) 443 | .catch((err) => { 444 | error = err.detail; 445 | 446 | console.log(err); 447 | return null; 448 | }); 449 | 450 | if (error) { 451 | throw error; 452 | } 453 | 454 | return res; 455 | }; ``````` `\\?\D:\Coding\ai\src\lib\apis\images\index.ts`: ```````ts 1 | import { IMAGES_API_BASE_URL } from '$lib/constants'; 2 | 3 | export const getImageGenerationConfig = async (token: string = '') => { 4 | let error = null; 5 | 6 | const res = await fetch(`${IMAGES_API_BASE_URL}/config`, { 7 | method: 'GET', 8 | headers: { 9 | Accept: 'application/json', 10 | 'Content-Type': 'application/json', 11 | ...(token && { authorization: `Bearer ${token}` }) 12 | } 13 | }) 14 | .then(async (res) => { 15 | if (!res.ok) throw await res.json(); 16 | return res.json(); 17 | }) 18 | .catch((err) => { 19 | console.log(err); 20 | if ('detail' in err) { 21 | error = err.detail; 22 | } else { 23 | error = 'Server connection failed'; 24 | } 25 | return null; 26 | }); 27 | 28 | if (error) { 29 | throw error; 30 | } 31 | 32 | return res; 33 | }; 34 | 35 | export const updateImageGenerationConfig = async ( 36 | token: string = '', 37 | engine: string, 38 | enabled: boolean 39 | ) => { 40 | let error = null; 41 | 42 | const res = await fetch(`${IMAGES_API_BASE_URL}/config/update`, { 43 | method: 'POST', 44 | headers: { 45 | Accept: 'application/json', 46 | 'Content-Type': 'application/json', 47 | ...(token && { authorization: `Bearer ${token}` }) 48 | }, 49 | body: JSON.stringify({ 50 | engine, 51 | enabled 52 | }) 53 | }) 54 | .then(async (res) => { 55 | if (!res.ok) throw await res.json(); 56 | return res.json(); 57 | }) 58 | .catch((err) => { 59 | console.log(err); 60 | if ('detail' in err) { 61 | error = err.detail; 62 | } else { 63 | error = 'Server connection failed'; 64 | } 65 | return null; 66 | }); 67 | 68 | if (error) { 69 | throw error; 70 | } 71 | 72 | return res; 73 | }; 74 | 75 | export const getOpenAIConfig = async (token: string = '') => { 76 | let error = null; 77 | 78 | const res = await fetch(`${IMAGES_API_BASE_URL}/openai/config`, { 79 | method: 'GET', 80 | headers: { 81 | Accept: 'application/json', 82 | 'Content-Type': 'application/json', 83 | ...(token && { authorization: `Bearer ${token}` }) 84 | } 85 | }) 86 | .then(async (res) => { 87 | if (!res.ok) throw await res.json(); 88 | return res.json(); 89 | }) 90 | .catch((err) => { 91 | console.log(err); 92 | if ('detail' in err) { 93 | error = err.detail; 94 | } else { 95 | error = 'Server connection failed'; 96 | } 97 | return null; 98 | }); 99 | 100 | if (error) { 101 | throw error; 102 | } 103 | 104 | return res; 105 | }; 106 | 107 | export const updateOpenAIConfig = async (token: string = '', url: string, key: string) => { 108 | let error = null; 109 | 110 | const res = await fetch(`${IMAGES_API_BASE_URL}/openai/config/update`, { 111 | method: 'POST', 112 | headers: { 113 | Accept: 'application/json', 114 | 'Content-Type': 'application/json', 115 | ...(token && { authorization: `Bearer ${token}` }) 116 | }, 117 | body: JSON.stringify({ 118 | url: url, 119 | key: key 120 | }) 121 | }) 122 | .then(async (res) => { 123 | if (!res.ok) throw await res.json(); 124 | return res.json(); 125 | }) 126 | .catch((err) => { 127 | console.log(err); 128 | if ('detail' in err) { 129 | error = err.detail; 130 | } else { 131 | error = 'Server connection failed'; 132 | } 133 | return null; 134 | }); 135 | 136 | if (error) { 137 | throw error; 138 | } 139 | 140 | return res; 141 | }; 142 | 143 | export const getImageGenerationEngineUrls = async (token: string = '') => { 144 | let error = null; 145 | 146 | const res = await fetch(`${IMAGES_API_BASE_URL}/url`, { 147 | method: 'GET', 148 | headers: { 149 | Accept: 'application/json', 150 | 'Content-Type': 'application/json', 151 | ...(token && { authorization: `Bearer ${token}` }) 152 | } 153 | }) 154 | .then(async (res) => { 155 | if (!res.ok) throw await res.json(); 156 | return res.json(); 157 | }) 158 | .catch((err) => { 159 | console.log(err); 160 | if ('detail' in err) { 161 | error = err.detail; 162 | } else { 163 | error = 'Server connection failed'; 164 | } 165 | return null; 166 | }); 167 | 168 | if (error) { 169 | throw error; 170 | } 171 | 172 | return res; 173 | }; 174 | 175 | export const updateImageGenerationEngineUrls = async (token: string = '', urls: object = {}) => { 176 | let error = null; 177 | 178 | const res = await fetch(`${IMAGES_API_BASE_URL}/url/update`, { 179 | method: 'POST', 180 | headers: { 181 | Accept: 'application/json', 182 | 'Content-Type': 'application/json', 183 | ...(token && { authorization: `Bearer ${token}` }) 184 | }, 185 | body: JSON.stringify({ 186 | ...urls 187 | }) 188 | }) 189 | .then(async (res) => { 190 | if (!res.ok) throw await res.json(); 191 | return res.json(); 192 | }) 193 | .catch((err) => { 194 | console.log(err); 195 | if ('detail' in err) { 196 | error = err.detail; 197 | } else { 198 | error = 'Server connection failed'; 199 | } 200 | return null; 201 | }); 202 | 203 | if (error) { 204 | throw error; 205 | } 206 | 207 | return res; 208 | }; 209 | 210 | export const getImageSize = async (token: string = '') => { 211 | let error = null; 212 | 213 | const res = await fetch(`${IMAGES_API_BASE_URL}/size`, { 214 | method: 'GET', 215 | headers: { 216 | Accept: 'application/json', 217 | 'Content-Type': 'application/json', 218 | ...(token && { authorization: `Bearer ${token}` }) 219 | } 220 | }) 221 | .then(async (res) => { 222 | if (!res.ok) throw await res.json(); 223 | return res.json(); 224 | }) 225 | .catch((err) => { 226 | console.log(err); 227 | if ('detail' in err) { 228 | error = err.detail; 229 | } else { 230 | error = 'Server connection failed'; 231 | } 232 | return null; 233 | }); 234 | 235 | if (error) { 236 | throw error; 237 | } 238 | 239 | return res.IMAGE_SIZE; 240 | }; 241 | 242 | export const updateImageSize = async (token: string = '', size: string) => { 243 | let error = null; 244 | 245 | const res = await fetch(`${IMAGES_API_BASE_URL}/size/update`, { 246 | method: 'POST', 247 | headers: { 248 | Accept: 'application/json', 249 | 'Content-Type': 'application/json', 250 | ...(token && { authorization: `Bearer ${token}` }) 251 | }, 252 | body: JSON.stringify({ 253 | size: size 254 | }) 255 | }) 256 | .then(async (res) => { 257 | if (!res.ok) throw await res.json(); 258 | return res.json(); 259 | }) 260 | .catch((err) => { 261 | console.log(err); 262 | if ('detail' in err) { 263 | error = err.detail; 264 | } else { 265 | error = 'Server connection failed'; 266 | } 267 | return null; 268 | }); 269 | 270 | if (error) { 271 | throw error; 272 | } 273 | 274 | return res.IMAGE_SIZE; 275 | }; 276 | 277 | export const getImageSteps = async (token: string = '') => { 278 | let error = null; 279 | 280 | const res = await fetch(`${IMAGES_API_BASE_URL}/steps`, { 281 | method: 'GET', 282 | headers: { 283 | Accept: 'application/json', 284 | 'Content-Type': 'application/json', 285 | ...(token && { authorization: `Bearer ${token}` }) 286 | } 287 | }) 288 | .then(async (res) => { 289 | if (!res.ok) throw await res.json(); 290 | return res.json(); 291 | }) 292 | .catch((err) => { 293 | console.log(err); 294 | if ('detail' in err) { 295 | error = err.detail; 296 | } else { 297 | error = 'Server connection failed'; 298 | } 299 | return null; 300 | }); 301 | 302 | if (error) { 303 | throw error; 304 | } 305 | 306 | return res.IMAGE_STEPS; 307 | }; 308 | 309 | export const updateImageSteps = async (token: string = '', steps: number) => { 310 | let error = null; 311 | 312 | const res = await fetch(`${IMAGES_API_BASE_URL}/steps/update`, { 313 | method: 'POST', 314 | headers: { 315 | Accept: 'application/json', 316 | 'Content-Type': 'application/json', 317 | ...(token && { authorization: `Bearer ${token}` }) 318 | }, 319 | body: JSON.stringify({ steps }) 320 | }) 321 | .then(async (res) => { 322 | if (!res.ok) throw await res.json(); 323 | return res.json(); 324 | }) 325 | .catch((err) => { 326 | console.log(err); 327 | if ('detail' in err) { 328 | error = err.detail; 329 | } else { 330 | error = 'Server connection failed'; 331 | } 332 | return null; 333 | }); 334 | 335 | if (error) { 336 | throw error; 337 | } 338 | 339 | return res.IMAGE_STEPS; 340 | }; 341 | 342 | export const getImageGenerationModels = async (token: string = '') => { 343 | let error = null; 344 | 345 | const res = await fetch(`${IMAGES_API_BASE_URL}/models`, { 346 | method: 'GET', 347 | headers: { 348 | Accept: 'application/json', 349 | 'Content-Type': 'application/json', 350 | ...(token && { authorization: `Bearer ${token}` }) 351 | } 352 | }) 353 | .then(async (res) => { 354 | if (!res.ok) throw await res.json(); 355 | return res.json(); 356 | }) 357 | .catch((err) => { 358 | console.log(err); 359 | if ('detail' in err) { 360 | error = err.detail; 361 | } else { 362 | error = 'Server connection failed'; 363 | } 364 | return null; 365 | }); 366 | 367 | if (error) { 368 | throw error; 369 | } 370 | 371 | return res; 372 | }; 373 | 374 | export const getDefaultImageGenerationModel = async (token: string = '') => { 375 | let error = null; 376 | 377 | const res = await fetch(`${IMAGES_API_BASE_URL}/models/default`, { 378 | method: 'GET', 379 | headers: { 380 | Accept: 'application/json', 381 | 'Content-Type': 'application/json', 382 | ...(token && { authorization: `Bearer ${token}` }) 383 | } 384 | }) 385 | .then(async (res) => { 386 | if (!res.ok) throw await res.json(); 387 | return res.json(); 388 | }) 389 | .catch((err) => { 390 | console.log(err); 391 | if ('detail' in err) { 392 | error = err.detail; 393 | } else { 394 | error = 'Server connection failed'; 395 | } 396 | return null; 397 | }); 398 | 399 | if (error) { 400 | throw error; 401 | } 402 | 403 | return res.model; 404 | }; 405 | 406 | export const updateDefaultImageGenerationModel = async (token: string = '', model: string) => { 407 | let error = null; 408 | 409 | const res = await fetch(`${IMAGES_API_BASE_URL}/models/default/update`, { 410 | method: 'POST', 411 | headers: { 412 | Accept: 'application/json', 413 | 'Content-Type': 'application/json', 414 | ...(token && { authorization: `Bearer ${token}` }) 415 | }, 416 | body: JSON.stringify({ 417 | model: model 418 | }) 419 | }) 420 | .then(async (res) => { 421 | if (!res.ok) throw await res.json(); 422 | return res.json(); 423 | }) 424 | .catch((err) => { 425 | console.log(err); 426 | if ('detail' in err) { 427 | error = err.detail; 428 | } else { 429 | error = 'Server connection failed'; 430 | } 431 | return null; 432 | }); 433 | 434 | if (error) { 435 | throw error; 436 | } 437 | 438 | return res.model; 439 | }; 440 | 441 | export const imageGenerations = async (token: string = '', prompt: string) => { 442 | let error = null; 443 | 444 | const res = await fetch(`${IMAGES_API_BASE_URL}/generations`, { 445 | method: 'POST', 446 | headers: { 447 | Accept: 'application/json', 448 | 'Content-Type': 'application/json', 449 | ...(token && { authorization: `Bearer ${token}` }) 450 | }, 451 | body: JSON.stringify({ 452 | prompt: prompt 453 | }) 454 | }) 455 | .then(async (res) => { 456 | if (!res.ok) throw await res.json(); 457 | return res.json(); 458 | }) 459 | .catch((err) => { 460 | console.log(err); 461 | if ('detail' in err) { 462 | error = err.detail; 463 | } else { 464 | error = 'Server connection failed'; 465 | } 466 | return null; 467 | }); 468 | 469 | if (error) { 470 | throw error; 471 | } 472 | 473 | return res; 474 | }; ``````` `\\?\D:\Coding\ai\src\lib\apis\index.ts`: ```````ts 1 | import { WEBUI_API_BASE_URL, WEBUI_BASE_URL } from '$lib/constants'; 2 | 3 | export const getModels = async (token: string = '') => { 4 | let error = null; 5 | 6 | const res = await fetch(`${WEBUI_BASE_URL}/api/models`, { 7 | method: 'GET', 8 | headers: { 9 | Accept: 'application/json', 10 | 'Content-Type': 'application/json', 11 | ...(token && { authorization: `Bearer ${token}` }) 12 | } 13 | }) 14 | .then(async (res) => { 15 | if (!res.ok) throw await res.json(); 16 | return res.json(); 17 | }) 18 | .catch((err) => { 19 | console.log(err); 20 | error = err; 21 | return null; 22 | }); 23 | 24 | if (error) { 25 | throw error; 26 | } 27 | 28 | let models = res?.data ?? []; 29 | 30 | models = models 31 | .filter((models) => models) 32 | // Sort the models 33 | .sort((a, b) => { 34 | // Check if models have position property 35 | const aHasPosition = a.info?.meta?.position !== undefined; 36 | const bHasPosition = b.info?.meta?.position !== undefined; 37 | 38 | // If both a and b have the position property 39 | if (aHasPosition && bHasPosition) { 40 | return a.info.meta.position - b.info.meta.position; 41 | } 42 | 43 | // If only a has the position property, it should come first 44 | if (aHasPosition) return -1; 45 | 46 | // If only b has the position property, it should come first 47 | if (bHasPosition) return 1; 48 | 49 | // Compare case-insensitively by name for models without position property 50 | const lowerA = a.name.toLowerCase(); 51 | const lowerB = b.name.toLowerCase(); 52 | 53 | if (lowerA < lowerB) return -1; 54 | if (lowerA > lowerB) return 1; 55 | 56 | // If same case-insensitively, sort by original strings, 57 | // lowercase will come before uppercase due to ASCII values 58 | if (a.name < b.name) return -1; 59 | if (a.name > b.name) return 1; 60 | 61 | return 0; // They are equal 62 | }); 63 | 64 | console.log(models); 65 | return models; 66 | }; 67 | 68 | type ChatCompletedForm = { 69 | model: string; 70 | messages: string[]; 71 | chat_id: string; 72 | }; 73 | 74 | export const chatCompleted = async (token: string, body: ChatCompletedForm) => { 75 | let error = null; 76 | 77 | const res = await fetch(`${WEBUI_BASE_URL}/api/chat/completed`, { 78 | method: 'POST', 79 | headers: { 80 | Accept: 'application/json', 81 | 'Content-Type': 'application/json', 82 | ...(token && { authorization: `Bearer ${token}` }) 83 | }, 84 | body: JSON.stringify(body) 85 | }) 86 | .then(async (res) => { 87 | if (!res.ok) throw await res.json(); 88 | return res.json(); 89 | }) 90 | .catch((err) => { 91 | console.log(err); 92 | if ('detail' in err) { 93 | error = err.detail; 94 | } else { 95 | error = err; 96 | } 97 | return null; 98 | }); 99 | 100 | if (error) { 101 | throw error; 102 | } 103 | 104 | return res; 105 | }; 106 | 107 | type ChatActionForm = { 108 | model: string; 109 | messages: string[]; 110 | chat_id: string; 111 | }; 112 | 113 | export const chatAction = async (token: string, action_id: string, body: ChatActionForm) => { 114 | let error = null; 115 | 116 | const res = await fetch(`${WEBUI_BASE_URL}/api/chat/actions/${action_id}`, { 117 | method: 'POST', 118 | headers: { 119 | Accept: 'application/json', 120 | 'Content-Type': 'application/json', 121 | ...(token && { authorization: `Bearer ${token}` }) 122 | }, 123 | body: JSON.stringify(body) 124 | }) 125 | .then(async (res) => { 126 | if (!res.ok) throw await res.json(); 127 | return res.json(); 128 | }) 129 | .catch((err) => { 130 | console.log(err); 131 | if ('detail' in err) { 132 | error = err.detail; 133 | } else { 134 | error = err; 135 | } 136 | return null; 137 | }); 138 | 139 | if (error) { 140 | throw error; 141 | } 142 | 143 | return res; 144 | }; 145 | 146 | export const getTaskConfig = async (token: string = '') => { 147 | let error = null; 148 | 149 | const res = await fetch(`${WEBUI_BASE_URL}/api/task/config`, { 150 | method: 'GET', 151 | headers: { 152 | Accept: 'application/json', 153 | 'Content-Type': 'application/json', 154 | ...(token && { authorization: `Bearer ${token}` }) 155 | } 156 | }) 157 | .then(async (res) => { 158 | if (!res.ok) throw await res.json(); 159 | return res.json(); 160 | }) 161 | .catch((err) => { 162 | console.log(err); 163 | error = err; 164 | return null; 165 | }); 166 | 167 | if (error) { 168 | throw error; 169 | } 170 | 171 | return res; 172 | }; 173 | 174 | export const updateTaskConfig = async (token: string, config: object) => { 175 | let error = null; 176 | 177 | const res = await fetch(`${WEBUI_BASE_URL}/api/task/config/update`, { 178 | method: 'POST', 179 | headers: { 180 | Accept: 'application/json', 181 | 'Content-Type': 'application/json', 182 | ...(token && { authorization: `Bearer ${token}` }) 183 | }, 184 | body: JSON.stringify(config) 185 | }) 186 | .then(async (res) => { 187 | if (!res.ok) throw await res.json(); 188 | return res.json(); 189 | }) 190 | .catch((err) => { 191 | console.log(err); 192 | if ('detail' in err) { 193 | error = err.detail; 194 | } else { 195 | error = err; 196 | } 197 | return null; 198 | }); 199 | 200 | if (error) { 201 | throw error; 202 | } 203 | 204 | return res; 205 | }; 206 | 207 | export const generateTitle = async ( 208 | token: string = '', 209 | model: string, 210 | prompt: string, 211 | chat_id?: string 212 | ) => { 213 | let error = null; 214 | 215 | const res = await fetch(`${WEBUI_BASE_URL}/api/task/title/completions`, { 216 | method: 'POST', 217 | headers: { 218 | Accept: 'application/json', 219 | 'Content-Type': 'application/json', 220 | Authorization: `Bearer ${token}` 221 | }, 222 | body: JSON.stringify({ 223 | model: model, 224 | prompt: prompt, 225 | ...(chat_id && { chat_id: chat_id }) 226 | }) 227 | }) 228 | .then(async (res) => { 229 | if (!res.ok) throw await res.json(); 230 | return res.json(); 231 | }) 232 | .catch((err) => { 233 | console.log(err); 234 | if ('detail' in err) { 235 | error = err.detail; 236 | } 237 | return null; 238 | }); 239 | 240 | if (error) { 241 | throw error; 242 | } 243 | 244 | return res?.choices[0]?.message?.content.replace(/["']/g, '') ?? 'New Chat'; 245 | }; 246 | 247 | export const generateEmoji = async ( 248 | token: string = '', 249 | model: string, 250 | prompt: string, 251 | chat_id?: string 252 | ) => { 253 | let error = null; 254 | 255 | const res = await fetch(`${WEBUI_BASE_URL}/api/task/emoji/completions`, { 256 | method: 'POST', 257 | headers: { 258 | Accept: 'application/json', 259 | 'Content-Type': 'application/json', 260 | Authorization: `Bearer ${token}` 261 | }, 262 | body: JSON.stringify({ 263 | model: model, 264 | prompt: prompt, 265 | ...(chat_id && { chat_id: chat_id }) 266 | }) 267 | }) 268 | .then(async (res) => { 269 | if (!res.ok) throw await res.json(); 270 | return res.json(); 271 | }) 272 | .catch((err) => { 273 | console.log(err); 274 | if ('detail' in err) { 275 | error = err.detail; 276 | } 277 | return null; 278 | }); 279 | 280 | if (error) { 281 | throw error; 282 | } 283 | 284 | const response = res?.choices[0]?.message?.content.replace(/["']/g, '') ?? null; 285 | 286 | if (response) { 287 | if (/\p{Extended_Pictographic}/u.test(response)) { 288 | return response.match(/\p{Extended_Pictographic}/gu)[0]; 289 | } 290 | } 291 | 292 | return null; 293 | }; 294 | 295 | export const generateSearchQuery = async ( 296 | token: string = '', 297 | model: string, 298 | messages: object[], 299 | prompt: string 300 | ) => { 301 | let error = null; 302 | 303 | const res = await fetch(`${WEBUI_BASE_URL}/api/task/query/completions`, { 304 | method: 'POST', 305 | headers: { 306 | Accept: 'application/json', 307 | 'Content-Type': 'application/json', 308 | Authorization: `Bearer ${token}` 309 | }, 310 | body: JSON.stringify({ 311 | model: model, 312 | messages: messages, 313 | prompt: prompt 314 | }) 315 | }) 316 | .then(async (res) => { 317 | if (!res.ok) throw await res.json(); 318 | return res.json(); 319 | }) 320 | .catch((err) => { 321 | console.log(err); 322 | if ('detail' in err) { 323 | error = err.detail; 324 | } 325 | return null; 326 | }); 327 | 328 | if (error) { 329 | throw error; 330 | } 331 | 332 | return res?.choices[0]?.message?.content.replace(/["']/g, '') ?? prompt; 333 | }; 334 | 335 | export const getPipelinesList = async (token: string = '') => { 336 | let error = null; 337 | 338 | const res = await fetch(`${WEBUI_BASE_URL}/api/pipelines/list`, { 339 | method: 'GET', 340 | headers: { 341 | Accept: 'application/json', 342 | 'Content-Type': 'application/json', 343 | ...(token && { authorization: `Bearer ${token}` }) 344 | } 345 | }) 346 | .then(async (res) => { 347 | if (!res.ok) throw await res.json(); 348 | return res.json(); 349 | }) 350 | .catch((err) => { 351 | console.log(err); 352 | error = err; 353 | return null; 354 | }); 355 | 356 | if (error) { 357 | throw error; 358 | } 359 | 360 | let pipelines = res?.data ?? []; 361 | return pipelines; 362 | }; 363 | 364 | export const uploadPipeline = async (token: string, file: File, urlIdx: string) => { 365 | let error = null; 366 | 367 | // Create a new FormData object to handle the file upload 368 | const formData = new FormData(); 369 | formData.append('file', file); 370 | formData.append('urlIdx', urlIdx); 371 | 372 | const res = await fetch(`${WEBUI_BASE_URL}/api/pipelines/upload`, { 373 | method: 'POST', 374 | headers: { 375 | ...(token && { authorization: `Bearer ${token}` }) 376 | // 'Content-Type': 'multipart/form-data' is not needed as Fetch API will set it automatically 377 | }, 378 | body: formData 379 | }) 380 | .then(async (res) => { 381 | if (!res.ok) throw await res.json(); 382 | return res.json(); 383 | }) 384 | .catch((err) => { 385 | console.log(err); 386 | if ('detail' in err) { 387 | error = err.detail; 388 | } else { 389 | error = err; 390 | } 391 | return null; 392 | }); 393 | 394 | if (error) { 395 | throw error; 396 | } 397 | 398 | return res; 399 | }; 400 | 401 | export const downloadPipeline = async (token: string, url: string, urlIdx: string) => { 402 | let error = null; 403 | 404 | const res = await fetch(`${WEBUI_BASE_URL}/api/pipelines/add`, { 405 | method: 'POST', 406 | headers: { 407 | Accept: 'application/json', 408 | 'Content-Type': 'application/json', 409 | ...(token && { authorization: `Bearer ${token}` }) 410 | }, 411 | body: JSON.stringify({ 412 | url: url, 413 | urlIdx: urlIdx 414 | }) 415 | }) 416 | .then(async (res) => { 417 | if (!res.ok) throw await res.json(); 418 | return res.json(); 419 | }) 420 | .catch((err) => { 421 | console.log(err); 422 | if ('detail' in err) { 423 | error = err.detail; 424 | } else { 425 | error = err; 426 | } 427 | return null; 428 | }); 429 | 430 | if (error) { 431 | throw error; 432 | } 433 | 434 | return res; 435 | }; 436 | 437 | export const deletePipeline = async (token: string, id: string, urlIdx: string) => { 438 | let error = null; 439 | 440 | const res = await fetch(`${WEBUI_BASE_URL}/api/pipelines/delete`, { 441 | method: 'DELETE', 442 | headers: { 443 | Accept: 'application/json', 444 | 'Content-Type': 'application/json', 445 | ...(token && { authorization: `Bearer ${token}` }) 446 | }, 447 | body: JSON.stringify({ 448 | id: id, 449 | urlIdx: urlIdx 450 | }) 451 | }) 452 | .then(async (res) => { 453 | if (!res.ok) throw await res.json(); 454 | return res.json(); 455 | }) 456 | .catch((err) => { 457 | console.log(err); 458 | if ('detail' in err) { 459 | error = err.detail; 460 | } else { 461 | error = err; 462 | } 463 | return null; 464 | }); 465 | 466 | if (error) { 467 | throw error; 468 | } 469 | 470 | return res; 471 | }; 472 | 473 | export const getPipelines = async (token: string, urlIdx?: string) => { 474 | let error = null; 475 | 476 | const searchParams = new URLSearchParams(); 477 | if (urlIdx !== undefined) { 478 | searchParams.append('urlIdx', urlIdx); 479 | } 480 | 481 | const res = await fetch(`${WEBUI_BASE_URL}/api/pipelines?${searchParams.toString()}`, { 482 | method: 'GET', 483 | headers: { 484 | Accept: 'application/json', 485 | 'Content-Type': 'application/json', 486 | ...(token && { authorization: `Bearer ${token}` }) 487 | } 488 | }) 489 | .then(async (res) => { 490 | if (!res.ok) throw await res.json(); 491 | return res.json(); 492 | }) 493 | .catch((err) => { 494 | console.log(err); 495 | error = err; 496 | return null; 497 | }); 498 | 499 | if (error) { 500 | throw error; 501 | } 502 | 503 | let pipelines = res?.data ?? []; 504 | return pipelines; 505 | }; 506 | 507 | export const getPipelineValves = async (token: string, pipeline_id: string, urlIdx: string) => { 508 | let error = null; 509 | 510 | const searchParams = new URLSearchParams(); 511 | if (urlIdx !== undefined) { 512 | searchParams.append('urlIdx', urlIdx); 513 | } 514 | 515 | const res = await fetch( 516 | `${WEBUI_BASE_URL}/api/pipelines/${pipeline_id}/valves?${searchParams.toString()}`, 517 | { 518 | method: 'GET', 519 | headers: { 520 | Accept: 'application/json', 521 | 'Content-Type': 'application/json', 522 | ...(token && { authorization: `Bearer ${token}` }) 523 | } 524 | } 525 | ) 526 | .then(async (res) => { 527 | if (!res.ok) throw await res.json(); 528 | return res.json(); 529 | }) 530 | .catch((err) => { 531 | console.log(err); 532 | error = err; 533 | return null; 534 | }); 535 | 536 | if (error) { 537 | throw error; 538 | } 539 | 540 | return res; 541 | }; 542 | 543 | export const getPipelineValvesSpec = async (token: string, pipeline_id: string, urlIdx: string) => { 544 | let error = null; 545 | 546 | const searchParams = new URLSearchParams(); 547 | if (urlIdx !== undefined) { 548 | searchParams.append('urlIdx', urlIdx); 549 | } 550 | 551 | const res = await fetch( 552 | `${WEBUI_BASE_URL}/api/pipelines/${pipeline_id}/valves/spec?${searchParams.toString()}`, 553 | { 554 | method: 'GET', 555 | headers: { 556 | Accept: 'application/json', 557 | 'Content-Type': 'application/json', 558 | ...(token && { authorization: `Bearer ${token}` }) 559 | } 560 | } 561 | ) 562 | .then(async (res) => { 563 | if (!res.ok) throw await res.json(); 564 | return res.json(); 565 | }) 566 | .catch((err) => { 567 | console.log(err); 568 | error = err; 569 | return null; 570 | }); 571 | 572 | if (error) { 573 | throw error; 574 | } 575 | 576 | return res; 577 | }; 578 | 579 | export const updatePipelineValves = async ( 580 | token: string = '', 581 | pipeline_id: string, 582 | valves: object, 583 | urlIdx: string 584 | ) => { 585 | let error = null; 586 | 587 | const searchParams = new URLSearchParams(); 588 | if (urlIdx !== undefined) { 589 | searchParams.append('urlIdx', urlIdx); 590 | } 591 | 592 | const res = await fetch( 593 | `${WEBUI_BASE_URL}/api/pipelines/${pipeline_id}/valves/update?${searchParams.toString()}`, 594 | { 595 | method: 'POST', 596 | headers: { 597 | Accept: 'application/json', 598 | 'Content-Type': 'application/json', 599 | ...(token && { authorization: `Bearer ${token}` }) 600 | }, 601 | body: JSON.stringify(valves) 602 | } 603 | ) 604 | .then(async (res) => { 605 | if (!res.ok) throw await res.json(); 606 | return res.json(); 607 | }) 608 | .catch((err) => { 609 | console.log(err); 610 | 611 | if ('detail' in err) { 612 | error = err.detail; 613 | } else { 614 | error = err; 615 | } 616 | return null; 617 | }); 618 | 619 | if (error) { 620 | throw error; 621 | } 622 | 623 | return res; 624 | }; 625 | 626 | export const getBackendConfig = async () => { 627 | let error = null; 628 | 629 | const res = await fetch(`${WEBUI_BASE_URL}/api/config`, { 630 | method: 'GET', 631 | headers: { 632 | 'Content-Type': 'application/json' 633 | } 634 | }) 635 | .then(async (res) => { 636 | if (!res.ok) throw await res.json(); 637 | return res.json(); 638 | }) 639 | .catch((err) => { 640 | console.log(err); 641 | error = err; 642 | return null; 643 | }); 644 | 645 | if (error) { 646 | throw error; 647 | } 648 | 649 | return res; 650 | }; 651 | 652 | export const getChangelog = async () => { 653 | let error = null; 654 | 655 | const res = await fetch(`${WEBUI_BASE_URL}/api/changelog`, { 656 | method: 'GET', 657 | headers: { 658 | 'Content-Type': 'application/json' 659 | } 660 | }) 661 | .then(async (res) => { 662 | if (!res.ok) throw await res.json(); 663 | return res.json(); 664 | }) 665 | .catch((err) => { 666 | console.log(err); 667 | error = err; 668 | return null; 669 | }); 670 | 671 | if (error) { 672 | throw error; 673 | } 674 | 675 | return res; 676 | }; 677 | 678 | export const getVersionUpdates = async () => { 679 | let error = null; 680 | 681 | const res = await fetch(`${WEBUI_BASE_URL}/api/version/updates`, { 682 | method: 'GET', 683 | headers: { 684 | 'Content-Type': 'application/json' 685 | } 686 | }) 687 | .then(async (res) => { 688 | if (!res.ok) throw await res.json(); 689 | return res.json(); 690 | }) 691 | .catch((err) => { 692 | console.log(err); 693 | error = err; 694 | return null; 695 | }); 696 | 697 | if (error) { 698 | throw error; 699 | } 700 | 701 | return res; 702 | }; 703 | 704 | export const getModelFilterConfig = async (token: string) => { 705 | let error = null; 706 | 707 | const res = await fetch(`${WEBUI_BASE_URL}/api/config/model/filter`, { 708 | method: 'GET', 709 | headers: { 710 | 'Content-Type': 'application/json', 711 | Authorization: `Bearer ${token}` 712 | } 713 | }) 714 | .then(async (res) => { 715 | if (!res.ok) throw await res.json(); 716 | return res.json(); 717 | }) 718 | .catch((err) => { 719 | console.log(err); 720 | error = err; 721 | return null; 722 | }); 723 | 724 | if (error) { 725 | throw error; 726 | } 727 | 728 | return res; 729 | }; 730 | 731 | export const updateModelFilterConfig = async ( 732 | token: string, 733 | enabled: boolean, 734 | models: string[] 735 | ) => { 736 | let error = null; 737 | 738 | const res = await fetch(`${WEBUI_BASE_URL}/api/config/model/filter`, { 739 | method: 'POST', 740 | headers: { 741 | 'Content-Type': 'application/json', 742 | Authorization: `Bearer ${token}` 743 | }, 744 | body: JSON.stringify({ 745 | enabled: enabled, 746 | models: models 747 | }) 748 | }) 749 | .then(async (res) => { 750 | if (!res.ok) throw await res.json(); 751 | return res.json(); 752 | }) 753 | .catch((err) => { 754 | console.log(err); 755 | error = err; 756 | return null; 757 | }); 758 | 759 | if (error) { 760 | throw error; 761 | } 762 | 763 | return res; 764 | }; 765 | 766 | export const getWebhookUrl = async (token: string) => { 767 | let error = null; 768 | 769 | const res = await fetch(`${WEBUI_BASE_URL}/api/webhook`, { 770 | method: 'GET', 771 | headers: { 772 | 'Content-Type': 'application/json', 773 | Authorization: `Bearer ${token}` 774 | } 775 | }) 776 | .then(async (res) => { 777 | if (!res.ok) throw await res.json(); 778 | return res.json(); 779 | }) 780 | .catch((err) => { 781 | console.log(err); 782 | error = err; 783 | return null; 784 | }); 785 | 786 | if (error) { 787 | throw error; 788 | } 789 | 790 | return res.url; 791 | }; 792 | 793 | export const updateWebhookUrl = async (token: string, url: string) => { 794 | let error = null; 795 | 796 | const res = await fetch(`${WEBUI_BASE_URL}/api/webhook`, { 797 | method: 'POST', 798 | headers: { 799 | 'Content-Type': 'application/json', 800 | Authorization: `Bearer ${token}` 801 | }, 802 | body: JSON.stringify({ 803 | url: url 804 | }) 805 | }) 806 | .then(async (res) => { 807 | if (!res.ok) throw await res.json(); 808 | return res.json(); 809 | }) 810 | .catch((err) => { 811 | console.log(err); 812 | error = err; 813 | return null; 814 | }); 815 | 816 | if (error) { 817 | throw error; 818 | } 819 | 820 | return res.url; 821 | }; 822 | 823 | export const getCommunitySharingEnabledStatus = async (token: string) => { 824 | let error = null; 825 | 826 | const res = await fetch(`${WEBUI_BASE_URL}/api/community_sharing`, { 827 | method: 'GET', 828 | headers: { 829 | 'Content-Type': 'application/json', 830 | Authorization: `Bearer ${token}` 831 | } 832 | }) 833 | .then(async (res) => { 834 | if (!res.ok) throw await res.json(); 835 | return res.json(); 836 | }) 837 | .catch((err) => { 838 | console.log(err); 839 | error = err; 840 | return null; 841 | }); 842 | 843 | if (error) { 844 | throw error; 845 | } 846 | 847 | return res; 848 | }; 849 | 850 | export const toggleCommunitySharingEnabledStatus = async (token: string) => { 851 | let error = null; 852 | 853 | const res = await fetch(`${WEBUI_BASE_URL}/api/community_sharing/toggle`, { 854 | method: 'GET', 855 | headers: { 856 | 'Content-Type': 'application/json', 857 | Authorization: `Bearer ${token}` 858 | } 859 | }) 860 | .then(async (res) => { 861 | if (!res.ok) throw await res.json(); 862 | return res.json(); 863 | }) 864 | .catch((err) => { 865 | console.log(err); 866 | error = err.detail; 867 | return null; 868 | }); 869 | 870 | if (error) { 871 | throw error; 872 | } 873 | 874 | return res; 875 | }; 876 | 877 | export const getModelConfig = async (token: string): Promise => { 878 | let error = null; 879 | 880 | const res = await fetch(`${WEBUI_BASE_URL}/api/config/models`, { 881 | method: 'GET', 882 | headers: { 883 | 'Content-Type': 'application/json', 884 | Authorization: `Bearer ${token}` 885 | } 886 | }) 887 | .then(async (res) => { 888 | if (!res.ok) throw await res.json(); 889 | return res.json(); 890 | }) 891 | .catch((err) => { 892 | console.log(err); 893 | error = err; 894 | return null; 895 | }); 896 | 897 | if (error) { 898 | throw error; 899 | } 900 | 901 | return res.models; 902 | }; 903 | 904 | export interface ModelConfig { 905 | id: string; 906 | name: string; 907 | meta: ModelMeta; 908 | base_model_id?: string; 909 | params: ModelParams; 910 | } 911 | 912 | export interface ModelMeta { 913 | description?: string; 914 | capabilities?: object; 915 | } 916 | 917 | export interface ModelParams {} 918 | 919 | export type GlobalModelConfig = ModelConfig[]; 920 | 921 | export const updateModelConfig = async (token: string, config: GlobalModelConfig) => { 922 | let error = null; 923 | 924 | const res = await fetch(`${WEBUI_BASE_URL}/api/config/models`, { 925 | method: 'POST', 926 | headers: { 927 | 'Content-Type': 'application/json', 928 | Authorization: `Bearer ${token}` 929 | }, 930 | body: JSON.stringify({ 931 | models: config 932 | }) 933 | }) 934 | .then(async (res) => { 935 | if (!res.ok) throw await res.json(); 936 | return res.json(); 937 | }) 938 | .catch((err) => { 939 | console.log(err); 940 | error = err; 941 | return null; 942 | }); 943 | 944 | if (error) { 945 | throw error; 946 | } 947 | 948 | return res; 949 | }; ``````` `\\?\D:\Coding\ai\src\lib\apis\memories\index.ts`: ```````ts 1 | import { WEBUI_API_BASE_URL } from '$lib/constants'; 2 | 3 | export const getMemories = async (token: string) => { 4 | let error = null; 5 | 6 | const res = await fetch(`${WEBUI_API_BASE_URL}/memories/`, { 7 | method: 'GET', 8 | headers: { 9 | Accept: 'application/json', 10 | 'Content-Type': 'application/json', 11 | authorization: `Bearer ${token}` 12 | } 13 | }) 14 | .then(async (res) => { 15 | if (!res.ok) throw await res.json(); 16 | return res.json(); 17 | }) 18 | .catch((err) => { 19 | error = err.detail; 20 | console.log(err); 21 | return null; 22 | }); 23 | 24 | if (error) { 25 | throw error; 26 | } 27 | 28 | return res; 29 | }; 30 | 31 | export const addNewMemory = async (token: string, content: string) => { 32 | let error = null; 33 | 34 | const res = await fetch(`${WEBUI_API_BASE_URL}/memories/add`, { 35 | method: 'POST', 36 | headers: { 37 | Accept: 'application/json', 38 | 'Content-Type': 'application/json', 39 | authorization: `Bearer ${token}` 40 | }, 41 | body: JSON.stringify({ 42 | content: content 43 | }) 44 | }) 45 | .then(async (res) => { 46 | if (!res.ok) throw await res.json(); 47 | return res.json(); 48 | }) 49 | .catch((err) => { 50 | error = err.detail; 51 | console.log(err); 52 | return null; 53 | }); 54 | 55 | if (error) { 56 | throw error; 57 | } 58 | 59 | return res; 60 | }; 61 | 62 | export const updateMemoryById = async (token: string, id: string, content: string) => { 63 | let error = null; 64 | 65 | const res = await fetch(`${WEBUI_API_BASE_URL}/memories/${id}/update`, { 66 | method: 'POST', 67 | headers: { 68 | Accept: 'application/json', 69 | 'Content-Type': 'application/json', 70 | authorization: `Bearer ${token}` 71 | }, 72 | body: JSON.stringify({ 73 | content: content 74 | }) 75 | }) 76 | .then(async (res) => { 77 | if (!res.ok) throw await res.json(); 78 | return res.json(); 79 | }) 80 | .catch((err) => { 81 | error = err.detail; 82 | console.log(err); 83 | return null; 84 | }); 85 | 86 | if (error) { 87 | throw error; 88 | } 89 | 90 | return res; 91 | }; 92 | 93 | export const queryMemory = async (token: string, content: string) => { 94 | let error = null; 95 | 96 | const res = await fetch(`${WEBUI_API_BASE_URL}/memories/query`, { 97 | method: 'POST', 98 | headers: { 99 | Accept: 'application/json', 100 | 'Content-Type': 'application/json', 101 | authorization: `Bearer ${token}` 102 | }, 103 | body: JSON.stringify({ 104 | content: content 105 | }) 106 | }) 107 | .then(async (res) => { 108 | if (!res.ok) throw await res.json(); 109 | return res.json(); 110 | }) 111 | .catch((err) => { 112 | error = err.detail; 113 | console.log(err); 114 | return null; 115 | }); 116 | 117 | if (error) { 118 | throw error; 119 | } 120 | 121 | return res; 122 | }; 123 | 124 | export const deleteMemoryById = async (token: string, id: string) => { 125 | let error = null; 126 | 127 | const res = await fetch(`${WEBUI_API_BASE_URL}/memories/${id}`, { 128 | method: 'DELETE', 129 | headers: { 130 | Accept: 'application/json', 131 | 'Content-Type': 'application/json', 132 | authorization: `Bearer ${token}` 133 | } 134 | }) 135 | .then(async (res) => { 136 | if (!res.ok) throw await res.json(); 137 | return res.json(); 138 | }) 139 | .then((json) => { 140 | return json; 141 | }) 142 | .catch((err) => { 143 | error = err.detail; 144 | 145 | console.log(err); 146 | return null; 147 | }); 148 | 149 | if (error) { 150 | throw error; 151 | } 152 | 153 | return res; 154 | }; 155 | 156 | export const deleteMemoriesByUserId = async (token: string) => { 157 | let error = null; 158 | 159 | const res = await fetch(`${WEBUI_API_BASE_URL}/memories/user`, { 160 | method: 'DELETE', 161 | headers: { 162 | Accept: 'application/json', 163 | 'Content-Type': 'application/json', 164 | authorization: `Bearer ${token}` 165 | } 166 | }) 167 | .then(async (res) => { 168 | if (!res.ok) throw await res.json(); 169 | return res.json(); 170 | }) 171 | .then((json) => { 172 | return json; 173 | }) 174 | .catch((err) => { 175 | error = err.detail; 176 | 177 | console.log(err); 178 | return null; 179 | }); 180 | 181 | if (error) { 182 | throw error; 183 | } 184 | 185 | return res; 186 | }; ``````` `\\?\D:\Coding\ai\src\lib\apis\models\index.ts`: ```````ts 1 | import { WEBUI_API_BASE_URL } from '$lib/constants'; 2 | 3 | export const addNewModel = async (token: string, model: object) => { 4 | let error = null; 5 | 6 | const res = await fetch(`${WEBUI_API_BASE_URL}/models/add`, { 7 | method: 'POST', 8 | headers: { 9 | Accept: 'application/json', 10 | 'Content-Type': 'application/json', 11 | authorization: `Bearer ${token}` 12 | }, 13 | body: JSON.stringify(model) 14 | }) 15 | .then(async (res) => { 16 | if (!res.ok) throw await res.json(); 17 | return res.json(); 18 | }) 19 | .catch((err) => { 20 | error = err.detail; 21 | console.log(err); 22 | return null; 23 | }); 24 | 25 | if (error) { 26 | throw error; 27 | } 28 | 29 | return res; 30 | }; 31 | 32 | export const getModelInfos = async (token: string = '') => { 33 | let error = null; 34 | 35 | const res = await fetch(`${WEBUI_API_BASE_URL}/models`, { 36 | method: 'GET', 37 | headers: { 38 | Accept: 'application/json', 39 | 'Content-Type': 'application/json', 40 | authorization: `Bearer ${token}` 41 | } 42 | }) 43 | .then(async (res) => { 44 | if (!res.ok) throw await res.json(); 45 | return res.json(); 46 | }) 47 | .then((json) => { 48 | return json; 49 | }) 50 | .catch((err) => { 51 | error = err; 52 | console.log(err); 53 | return null; 54 | }); 55 | 56 | if (error) { 57 | throw error; 58 | } 59 | 60 | return res; 61 | }; 62 | 63 | export const getModelById = async (token: string, id: string) => { 64 | let error = null; 65 | 66 | const searchParams = new URLSearchParams(); 67 | searchParams.append('id', id); 68 | 69 | const res = await fetch(`${WEBUI_API_BASE_URL}/models?${searchParams.toString()}`, { 70 | method: 'GET', 71 | headers: { 72 | Accept: 'application/json', 73 | 'Content-Type': 'application/json', 74 | authorization: `Bearer ${token}` 75 | } 76 | }) 77 | .then(async (res) => { 78 | if (!res.ok) throw await res.json(); 79 | return res.json(); 80 | }) 81 | .then((json) => { 82 | return json; 83 | }) 84 | .catch((err) => { 85 | error = err; 86 | 87 | console.log(err); 88 | return null; 89 | }); 90 | 91 | if (error) { 92 | throw error; 93 | } 94 | 95 | return res; 96 | }; 97 | 98 | export const updateModelById = async (token: string, id: string, model: object) => { 99 | let error = null; 100 | 101 | const searchParams = new URLSearchParams(); 102 | searchParams.append('id', id); 103 | 104 | const res = await fetch(`${WEBUI_API_BASE_URL}/models/update?${searchParams.toString()}`, { 105 | method: 'POST', 106 | headers: { 107 | Accept: 'application/json', 108 | 'Content-Type': 'application/json', 109 | authorization: `Bearer ${token}` 110 | }, 111 | body: JSON.stringify(model) 112 | }) 113 | .then(async (res) => { 114 | if (!res.ok) throw await res.json(); 115 | return res.json(); 116 | }) 117 | .then((json) => { 118 | return json; 119 | }) 120 | .catch((err) => { 121 | error = err; 122 | 123 | console.log(err); 124 | return null; 125 | }); 126 | 127 | if (error) { 128 | throw error; 129 | } 130 | 131 | return res; 132 | }; 133 | 134 | export const deleteModelById = async (token: string, id: string) => { 135 | let error = null; 136 | 137 | const searchParams = new URLSearchParams(); 138 | searchParams.append('id', id); 139 | 140 | const res = await fetch(`${WEBUI_API_BASE_URL}/models/delete?${searchParams.toString()}`, { 141 | method: 'DELETE', 142 | headers: { 143 | Accept: 'application/json', 144 | 'Content-Type': 'application/json', 145 | authorization: `Bearer ${token}` 146 | } 147 | }) 148 | .then(async (res) => { 149 | if (!res.ok) throw await res.json(); 150 | return res.json(); 151 | }) 152 | .then((json) => { 153 | return json; 154 | }) 155 | .catch((err) => { 156 | error = err; 157 | 158 | console.log(err); 159 | return null; 160 | }); 161 | 162 | if (error) { 163 | throw error; 164 | } 165 | 166 | return res; 167 | }; ``````` `\\?\D:\Coding\ai\src\lib\apis\ollama\index.ts`: ```````ts 1 | import { OLLAMA_API_BASE_URL } from '$lib/constants'; 2 | import { titleGenerationTemplate } from '$lib/utils'; 3 | 4 | export const getOllamaConfig = async (token: string = '') => { 5 | let error = null; 6 | 7 | const res = await fetch(`${OLLAMA_API_BASE_URL}/config`, { 8 | method: 'GET', 9 | headers: { 10 | Accept: 'application/json', 11 | 'Content-Type': 'application/json', 12 | ...(token && { authorization: `Bearer ${token}` }) 13 | } 14 | }) 15 | .then(async (res) => { 16 | if (!res.ok) throw await res.json(); 17 | return res.json(); 18 | }) 19 | .catch((err) => { 20 | console.log(err); 21 | if ('detail' in err) { 22 | error = err.detail; 23 | } else { 24 | error = 'Server connection failed'; 25 | } 26 | return null; 27 | }); 28 | 29 | if (error) { 30 | throw error; 31 | } 32 | 33 | return res; 34 | }; 35 | 36 | export const updateOllamaConfig = async (token: string = '', enable_ollama_api: boolean) => { 37 | let error = null; 38 | 39 | const res = await fetch(`${OLLAMA_API_BASE_URL}/config/update`, { 40 | method: 'POST', 41 | headers: { 42 | Accept: 'application/json', 43 | 'Content-Type': 'application/json', 44 | ...(token && { authorization: `Bearer ${token}` }) 45 | }, 46 | body: JSON.stringify({ 47 | enable_ollama_api: enable_ollama_api 48 | }) 49 | }) 50 | .then(async (res) => { 51 | if (!res.ok) throw await res.json(); 52 | return res.json(); 53 | }) 54 | .catch((err) => { 55 | console.log(err); 56 | if ('detail' in err) { 57 | error = err.detail; 58 | } else { 59 | error = 'Server connection failed'; 60 | } 61 | return null; 62 | }); 63 | 64 | if (error) { 65 | throw error; 66 | } 67 | 68 | return res; 69 | }; 70 | 71 | export const getOllamaUrls = async (token: string = '') => { 72 | let error = null; 73 | 74 | const res = await fetch(`${OLLAMA_API_BASE_URL}/urls`, { 75 | method: 'GET', 76 | headers: { 77 | Accept: 'application/json', 78 | 'Content-Type': 'application/json', 79 | ...(token && { authorization: `Bearer ${token}` }) 80 | } 81 | }) 82 | .then(async (res) => { 83 | if (!res.ok) throw await res.json(); 84 | return res.json(); 85 | }) 86 | .catch((err) => { 87 | console.log(err); 88 | if ('detail' in err) { 89 | error = err.detail; 90 | } else { 91 | error = 'Server connection failed'; 92 | } 93 | return null; 94 | }); 95 | 96 | if (error) { 97 | throw error; 98 | } 99 | 100 | return res.OLLAMA_BASE_URLS; 101 | }; 102 | 103 | export const updateOllamaUrls = async (token: string = '', urls: string[]) => { 104 | let error = null; 105 | 106 | const res = await fetch(`${OLLAMA_API_BASE_URL}/urls/update`, { 107 | method: 'POST', 108 | headers: { 109 | Accept: 'application/json', 110 | 'Content-Type': 'application/json', 111 | ...(token && { authorization: `Bearer ${token}` }) 112 | }, 113 | body: JSON.stringify({ 114 | urls: urls 115 | }) 116 | }) 117 | .then(async (res) => { 118 | if (!res.ok) throw await res.json(); 119 | return res.json(); 120 | }) 121 | .catch((err) => { 122 | console.log(err); 123 | if ('detail' in err) { 124 | error = err.detail; 125 | } else { 126 | error = 'Server connection failed'; 127 | } 128 | return null; 129 | }); 130 | 131 | if (error) { 132 | throw error; 133 | } 134 | 135 | return res.OLLAMA_BASE_URLS; 136 | }; 137 | 138 | export const getOllamaVersion = async (token: string, urlIdx?: number) => { 139 | let error = null; 140 | 141 | const res = await fetch(`${OLLAMA_API_BASE_URL}/api/version${urlIdx ? `/${urlIdx}` : ''}`, { 142 | method: 'GET', 143 | headers: { 144 | Accept: 'application/json', 145 | 'Content-Type': 'application/json', 146 | ...(token && { authorization: `Bearer ${token}` }) 147 | } 148 | }) 149 | .then(async (res) => { 150 | if (!res.ok) throw await res.json(); 151 | return res.json(); 152 | }) 153 | .catch((err) => { 154 | console.log(err); 155 | if ('detail' in err) { 156 | error = err.detail; 157 | } else { 158 | error = 'Server connection failed'; 159 | } 160 | return null; 161 | }); 162 | 163 | if (error) { 164 | throw error; 165 | } 166 | 167 | return res?.version ?? false; 168 | }; 169 | 170 | export const getOllamaModels = async (token: string = '') => { 171 | let error = null; 172 | 173 | const res = await fetch(`${OLLAMA_API_BASE_URL}/api/tags`, { 174 | method: 'GET', 175 | headers: { 176 | Accept: 'application/json', 177 | 'Content-Type': 'application/json', 178 | ...(token && { authorization: `Bearer ${token}` }) 179 | } 180 | }) 181 | .then(async (res) => { 182 | if (!res.ok) throw await res.json(); 183 | return res.json(); 184 | }) 185 | .catch((err) => { 186 | console.log(err); 187 | if ('detail' in err) { 188 | error = err.detail; 189 | } else { 190 | error = 'Server connection failed'; 191 | } 192 | return null; 193 | }); 194 | 195 | if (error) { 196 | throw error; 197 | } 198 | 199 | return (res?.models ?? []) 200 | .map((model) => ({ id: model.model, name: model.name ?? model.model, ...model })) 201 | .sort((a, b) => { 202 | return a.name.localeCompare(b.name); 203 | }); 204 | }; 205 | 206 | // TODO: migrate to backend 207 | export const generateTitle = async ( 208 | token: string = '', 209 | template: string, 210 | model: string, 211 | prompt: string 212 | ) => { 213 | let error = null; 214 | 215 | template = titleGenerationTemplate(template, prompt); 216 | 217 | console.log(template); 218 | 219 | const res = await fetch(`${OLLAMA_API_BASE_URL}/api/generate`, { 220 | method: 'POST', 221 | headers: { 222 | Accept: 'application/json', 223 | 'Content-Type': 'application/json', 224 | Authorization: `Bearer ${token}` 225 | }, 226 | body: JSON.stringify({ 227 | model: model, 228 | prompt: template, 229 | stream: false, 230 | options: { 231 | // Restrict the number of tokens generated to 50 232 | num_predict: 50 233 | } 234 | }) 235 | }) 236 | .then(async (res) => { 237 | if (!res.ok) throw await res.json(); 238 | return res.json(); 239 | }) 240 | .catch((err) => { 241 | console.log(err); 242 | if ('detail' in err) { 243 | error = err.detail; 244 | } 245 | return null; 246 | }); 247 | 248 | if (error) { 249 | throw error; 250 | } 251 | 252 | return res?.response.replace(/["']/g, '') ?? 'New Chat'; 253 | }; 254 | 255 | export const generatePrompt = async (token: string = '', model: string, conversation: string) => { 256 | let error = null; 257 | 258 | if (conversation === '') { 259 | conversation = '[no existing conversation]'; 260 | } 261 | 262 | const res = await fetch(`${OLLAMA_API_BASE_URL}/api/generate`, { 263 | method: 'POST', 264 | headers: { 265 | Accept: 'application/json', 266 | 'Content-Type': 'application/json', 267 | Authorization: `Bearer ${token}` 268 | }, 269 | body: JSON.stringify({ 270 | model: model, 271 | prompt: `Conversation: 272 | ${conversation} 273 | 274 | As USER in the conversation above, your task is to continue the conversation. Remember, Your responses should be crafted as if you're a human conversing in a natural, realistic manner, keeping in mind the context and flow of the dialogue. Please generate a fitting response to the last message in the conversation, or if there is no existing conversation, initiate one as a normal person would. 275 | 276 | Response: 277 | ` 278 | }) 279 | }).catch((err) => { 280 | console.log(err); 281 | if ('detail' in err) { 282 | error = err.detail; 283 | } 284 | return null; 285 | }); 286 | 287 | if (error) { 288 | throw error; 289 | } 290 | 291 | return res; 292 | }; 293 | 294 | export const generateEmbeddings = async (token: string = '', model: string, text: string) => { 295 | let error = null; 296 | 297 | const res = await fetch(`${OLLAMA_API_BASE_URL}/api/embeddings`, { 298 | method: 'POST', 299 | headers: { 300 | Accept: 'application/json', 301 | 'Content-Type': 'application/json', 302 | Authorization: `Bearer ${token}` 303 | }, 304 | body: JSON.stringify({ 305 | model: model, 306 | prompt: text 307 | }) 308 | }).catch((err) => { 309 | error = err; 310 | return null; 311 | }); 312 | 313 | if (error) { 314 | throw error; 315 | } 316 | 317 | return res; 318 | }; 319 | 320 | export const generateTextCompletion = async (token: string = '', model: string, text: string) => { 321 | let error = null; 322 | 323 | const res = await fetch(`${OLLAMA_API_BASE_URL}/api/generate`, { 324 | method: 'POST', 325 | headers: { 326 | Accept: 'application/json', 327 | 'Content-Type': 'application/json', 328 | Authorization: `Bearer ${token}` 329 | }, 330 | body: JSON.stringify({ 331 | model: model, 332 | prompt: text, 333 | stream: true 334 | }) 335 | }).catch((err) => { 336 | error = err; 337 | return null; 338 | }); 339 | 340 | if (error) { 341 | throw error; 342 | } 343 | 344 | return res; 345 | }; 346 | 347 | export const generateChatCompletion = async (token: string = '', body: object) => { 348 | let controller = new AbortController(); 349 | let error = null; 350 | 351 | const res = await fetch(`${OLLAMA_API_BASE_URL}/api/chat`, { 352 | signal: controller.signal, 353 | method: 'POST', 354 | headers: { 355 | Accept: 'application/json', 356 | 'Content-Type': 'application/json', 357 | Authorization: `Bearer ${token}` 358 | }, 359 | body: JSON.stringify(body) 360 | }).catch((err) => { 361 | error = err; 362 | return null; 363 | }); 364 | 365 | if (error) { 366 | throw error; 367 | } 368 | 369 | return [res, controller]; 370 | }; 371 | 372 | export const createModel = async ( 373 | token: string, 374 | tagName: string, 375 | content: string, 376 | urlIdx: string | null = null 377 | ) => { 378 | let error = null; 379 | 380 | const res = await fetch( 381 | `${OLLAMA_API_BASE_URL}/api/create${urlIdx !== null ? `/${urlIdx}` : ''}`, 382 | { 383 | method: 'POST', 384 | headers: { 385 | Accept: 'application/json', 386 | 'Content-Type': 'application/json', 387 | Authorization: `Bearer ${token}` 388 | }, 389 | body: JSON.stringify({ 390 | name: tagName, 391 | modelfile: content 392 | }) 393 | } 394 | ).catch((err) => { 395 | error = err; 396 | return null; 397 | }); 398 | 399 | if (error) { 400 | throw error; 401 | } 402 | 403 | return res; 404 | }; 405 | 406 | export const deleteModel = async (token: string, tagName: string, urlIdx: string | null = null) => { 407 | let error = null; 408 | 409 | const res = await fetch( 410 | `${OLLAMA_API_BASE_URL}/api/delete${urlIdx !== null ? `/${urlIdx}` : ''}`, 411 | { 412 | method: 'DELETE', 413 | headers: { 414 | Accept: 'application/json', 415 | 'Content-Type': 'application/json', 416 | Authorization: `Bearer ${token}` 417 | }, 418 | body: JSON.stringify({ 419 | name: tagName 420 | }) 421 | } 422 | ) 423 | .then(async (res) => { 424 | if (!res.ok) throw await res.json(); 425 | return res.json(); 426 | }) 427 | .then((json) => { 428 | console.log(json); 429 | return true; 430 | }) 431 | .catch((err) => { 432 | console.log(err); 433 | error = err; 434 | 435 | if ('detail' in err) { 436 | error = err.detail; 437 | } 438 | 439 | return null; 440 | }); 441 | 442 | if (error) { 443 | throw error; 444 | } 445 | 446 | return res; 447 | }; 448 | 449 | export const pullModel = async (token: string, tagName: string, urlIdx: string | null = null) => { 450 | let error = null; 451 | const controller = new AbortController(); 452 | 453 | const res = await fetch(`${OLLAMA_API_BASE_URL}/api/pull${urlIdx !== null ? `/${urlIdx}` : ''}`, { 454 | signal: controller.signal, 455 | method: 'POST', 456 | headers: { 457 | Accept: 'application/json', 458 | 'Content-Type': 'application/json', 459 | Authorization: `Bearer ${token}` 460 | }, 461 | body: JSON.stringify({ 462 | name: tagName 463 | }) 464 | }).catch((err) => { 465 | console.log(err); 466 | error = err; 467 | 468 | if ('detail' in err) { 469 | error = err.detail; 470 | } 471 | 472 | return null; 473 | }); 474 | if (error) { 475 | throw error; 476 | } 477 | return [res, controller]; 478 | }; 479 | 480 | export const downloadModel = async ( 481 | token: string, 482 | download_url: string, 483 | urlIdx: string | null = null 484 | ) => { 485 | let error = null; 486 | 487 | const res = await fetch( 488 | `${OLLAMA_API_BASE_URL}/models/download${urlIdx !== null ? `/${urlIdx}` : ''}`, 489 | { 490 | method: 'POST', 491 | headers: { 492 | Accept: 'application/json', 493 | 'Content-Type': 'application/json', 494 | Authorization: `Bearer ${token}` 495 | }, 496 | body: JSON.stringify({ 497 | url: download_url 498 | }) 499 | } 500 | ).catch((err) => { 501 | console.log(err); 502 | error = err; 503 | 504 | if ('detail' in err) { 505 | error = err.detail; 506 | } 507 | 508 | return null; 509 | }); 510 | if (error) { 511 | throw error; 512 | } 513 | return res; 514 | }; 515 | 516 | export const uploadModel = async (token: string, file: File, urlIdx: string | null = null) => { 517 | let error = null; 518 | 519 | const formData = new FormData(); 520 | formData.append('file', file); 521 | 522 | const res = await fetch( 523 | `${OLLAMA_API_BASE_URL}/models/upload${urlIdx !== null ? `/${urlIdx}` : ''}`, 524 | { 525 | method: 'POST', 526 | headers: { 527 | Authorization: `Bearer ${token}` 528 | }, 529 | body: formData 530 | } 531 | ).catch((err) => { 532 | console.log(err); 533 | error = err; 534 | 535 | if ('detail' in err) { 536 | error = err.detail; 537 | } 538 | 539 | return null; 540 | }); 541 | if (error) { 542 | throw error; 543 | } 544 | return res; 545 | }; 546 | 547 | // export const pullModel = async (token: string, tagName: string) => { 548 | // return await fetch(`${OLLAMA_API_BASE_URL}/pull`, { 549 | // method: 'POST', 550 | // headers: { 551 | // 'Content-Type': 'text/event-stream', 552 | // Authorization: `Bearer ${token}` 553 | // }, 554 | // body: JSON.stringify({ 555 | // name: tagName 556 | // }) 557 | // }); 558 | // }; ``````` `\\?\D:\Coding\ai\src\lib\apis\openai\index.ts`: ```````ts 1 | import { OPENAI_API_BASE_URL } from '$lib/constants'; 2 | import { titleGenerationTemplate } from '$lib/utils'; 3 | import { type Model, models, settings } from '$lib/stores'; 4 | 5 | export const getOpenAIConfig = async (token: string = '') => { 6 | let error = null; 7 | 8 | const res = await fetch(`${OPENAI_API_BASE_URL}/config`, { 9 | method: 'GET', 10 | headers: { 11 | Accept: 'application/json', 12 | 'Content-Type': 'application/json', 13 | ...(token && { authorization: `Bearer ${token}` }) 14 | } 15 | }) 16 | .then(async (res) => { 17 | if (!res.ok) throw await res.json(); 18 | return res.json(); 19 | }) 20 | .catch((err) => { 21 | console.log(err); 22 | if ('detail' in err) { 23 | error = err.detail; 24 | } else { 25 | error = 'Server connection failed'; 26 | } 27 | return null; 28 | }); 29 | 30 | if (error) { 31 | throw error; 32 | } 33 | 34 | return res; 35 | }; 36 | 37 | export const updateOpenAIConfig = async (token: string = '', enable_openai_api: boolean) => { 38 | let error = null; 39 | 40 | const res = await fetch(`${OPENAI_API_BASE_URL}/config/update`, { 41 | method: 'POST', 42 | headers: { 43 | Accept: 'application/json', 44 | 'Content-Type': 'application/json', 45 | ...(token && { authorization: `Bearer ${token}` }) 46 | }, 47 | body: JSON.stringify({ 48 | enable_openai_api: enable_openai_api 49 | }) 50 | }) 51 | .then(async (res) => { 52 | if (!res.ok) throw await res.json(); 53 | return res.json(); 54 | }) 55 | .catch((err) => { 56 | console.log(err); 57 | if ('detail' in err) { 58 | error = err.detail; 59 | } else { 60 | error = 'Server connection failed'; 61 | } 62 | return null; 63 | }); 64 | 65 | if (error) { 66 | throw error; 67 | } 68 | 69 | return res; 70 | }; 71 | 72 | export const getOpenAIUrls = async (token: string = '') => { 73 | let error = null; 74 | 75 | const res = await fetch(`${OPENAI_API_BASE_URL}/urls`, { 76 | method: 'GET', 77 | headers: { 78 | Accept: 'application/json', 79 | 'Content-Type': 'application/json', 80 | ...(token && { authorization: `Bearer ${token}` }) 81 | } 82 | }) 83 | .then(async (res) => { 84 | if (!res.ok) throw await res.json(); 85 | return res.json(); 86 | }) 87 | .catch((err) => { 88 | console.log(err); 89 | if ('detail' in err) { 90 | error = err.detail; 91 | } else { 92 | error = 'Server connection failed'; 93 | } 94 | return null; 95 | }); 96 | 97 | if (error) { 98 | throw error; 99 | } 100 | 101 | return res.OPENAI_API_BASE_URLS; 102 | }; 103 | 104 | export const updateOpenAIUrls = async (token: string = '', urls: string[]) => { 105 | let error = null; 106 | 107 | const res = await fetch(`${OPENAI_API_BASE_URL}/urls/update`, { 108 | method: 'POST', 109 | headers: { 110 | Accept: 'application/json', 111 | 'Content-Type': 'application/json', 112 | ...(token && { authorization: `Bearer ${token}` }) 113 | }, 114 | body: JSON.stringify({ 115 | urls: urls 116 | }) 117 | }) 118 | .then(async (res) => { 119 | if (!res.ok) throw await res.json(); 120 | return res.json(); 121 | }) 122 | .catch((err) => { 123 | console.log(err); 124 | if ('detail' in err) { 125 | error = err.detail; 126 | } else { 127 | error = 'Server connection failed'; 128 | } 129 | return null; 130 | }); 131 | 132 | if (error) { 133 | throw error; 134 | } 135 | 136 | return res.OPENAI_API_BASE_URLS; 137 | }; 138 | 139 | export const getOpenAIKeys = async (token: string = '') => { 140 | let error = null; 141 | 142 | const res = await fetch(`${OPENAI_API_BASE_URL}/keys`, { 143 | method: 'GET', 144 | headers: { 145 | Accept: 'application/json', 146 | 'Content-Type': 'application/json', 147 | ...(token && { authorization: `Bearer ${token}` }) 148 | } 149 | }) 150 | .then(async (res) => { 151 | if (!res.ok) throw await res.json(); 152 | return res.json(); 153 | }) 154 | .catch((err) => { 155 | console.log(err); 156 | if ('detail' in err) { 157 | error = err.detail; 158 | } else { 159 | error = 'Server connection failed'; 160 | } 161 | return null; 162 | }); 163 | 164 | if (error) { 165 | throw error; 166 | } 167 | 168 | return res.OPENAI_API_KEYS; 169 | }; 170 | 171 | export const updateOpenAIKeys = async (token: string = '', keys: string[]) => { 172 | let error = null; 173 | 174 | const res = await fetch(`${OPENAI_API_BASE_URL}/keys/update`, { 175 | method: 'POST', 176 | headers: { 177 | Accept: 'application/json', 178 | 'Content-Type': 'application/json', 179 | ...(token && { authorization: `Bearer ${token}` }) 180 | }, 181 | body: JSON.stringify({ 182 | keys: keys 183 | }) 184 | }) 185 | .then(async (res) => { 186 | if (!res.ok) throw await res.json(); 187 | return res.json(); 188 | }) 189 | .catch((err) => { 190 | console.log(err); 191 | if ('detail' in err) { 192 | error = err.detail; 193 | } else { 194 | error = 'Server connection failed'; 195 | } 196 | return null; 197 | }); 198 | 199 | if (error) { 200 | throw error; 201 | } 202 | 203 | return res.OPENAI_API_KEYS; 204 | }; 205 | 206 | export const getOpenAIModels = async (token: string, urlIdx?: number) => { 207 | let error = null; 208 | 209 | const res = await fetch( 210 | `${OPENAI_API_BASE_URL}/models${typeof urlIdx === 'number' ? `/${urlIdx}` : ''}`, 211 | { 212 | method: 'GET', 213 | headers: { 214 | Accept: 'application/json', 215 | 'Content-Type': 'application/json', 216 | ...(token && { authorization: `Bearer ${token}` }) 217 | } 218 | } 219 | ) 220 | .then(async (res) => { 221 | if (!res.ok) throw await res.json(); 222 | return res.json(); 223 | }) 224 | .catch((err) => { 225 | error = `OpenAI: ${err?.error?.message ?? 'Network Problem'}`; 226 | return []; 227 | }); 228 | 229 | if (error) { 230 | throw error; 231 | } 232 | 233 | return res; 234 | }; 235 | 236 | export const getOpenAIModelsDirect = async ( 237 | base_url: string = 'https://api.openai.com/v1', 238 | api_key: string = '' 239 | ) => { 240 | let error = null; 241 | 242 | const res = await fetch(`${base_url}/models`, { 243 | method: 'GET', 244 | headers: { 245 | 'Content-Type': 'application/json', 246 | Authorization: `Bearer ${api_key}` 247 | } 248 | }) 249 | .then(async (res) => { 250 | if (!res.ok) throw await res.json(); 251 | return res.json(); 252 | }) 253 | .catch((err) => { 254 | console.log(err); 255 | error = `OpenAI: ${err?.error?.message ?? 'Network Problem'}`; 256 | return null; 257 | }); 258 | 259 | if (error) { 260 | throw error; 261 | } 262 | 263 | const models = Array.isArray(res) ? res : res?.data ?? null; 264 | 265 | return models 266 | .map((model) => ({ id: model.id, name: model.name ?? model.id, external: true })) 267 | .filter((model) => (base_url.includes('openai') ? model.name.includes('gpt') : true)) 268 | .sort((a, b) => { 269 | return a.name.localeCompare(b.name); 270 | }); 271 | }; 272 | 273 | export const generateOpenAIChatCompletion = async ( 274 | token: string = '', 275 | body: object, 276 | url: string = OPENAI_API_BASE_URL 277 | ): Promise<[Response | null, AbortController]> => { 278 | const controller = new AbortController(); 279 | let error = null; 280 | 281 | const res = await fetch(`${url}/chat/completions`, { 282 | signal: controller.signal, 283 | method: 'POST', 284 | headers: { 285 | Authorization: `Bearer ${token}`, 286 | 'Content-Type': 'application/json' 287 | }, 288 | body: JSON.stringify(body) 289 | }).catch((err) => { 290 | console.log(err); 291 | error = err; 292 | return null; 293 | }); 294 | 295 | if (error) { 296 | throw error; 297 | } 298 | 299 | return [res, controller]; 300 | }; 301 | 302 | export const synthesizeOpenAISpeech = async ( 303 | token: string = '', 304 | speaker: string = 'alloy', 305 | text: string = '', 306 | model: string = 'tts-1' 307 | ) => { 308 | let error = null; 309 | 310 | const res = await fetch(`${OPENAI_API_BASE_URL}/audio/speech`, { 311 | method: 'POST', 312 | headers: { 313 | Authorization: `Bearer ${token}`, 314 | 'Content-Type': 'application/json' 315 | }, 316 | body: JSON.stringify({ 317 | model: model, 318 | input: text, 319 | voice: speaker 320 | }) 321 | }).catch((err) => { 322 | console.log(err); 323 | error = err; 324 | return null; 325 | }); 326 | 327 | if (error) { 328 | throw error; 329 | } 330 | 331 | return res; 332 | }; 333 | 334 | export const generateTitle = async ( 335 | token: string = '', 336 | template: string, 337 | model: string, 338 | prompt: string, 339 | chat_id?: string, 340 | url: string = OPENAI_API_BASE_URL 341 | ) => { 342 | let error = null; 343 | 344 | template = titleGenerationTemplate(template, prompt); 345 | 346 | console.log(template); 347 | 348 | const res = await fetch(`${url}/chat/completions`, { 349 | method: 'POST', 350 | headers: { 351 | Accept: 'application/json', 352 | 'Content-Type': 'application/json', 353 | Authorization: `Bearer ${token}` 354 | }, 355 | body: JSON.stringify({ 356 | model: model, 357 | messages: [ 358 | { 359 | role: 'user', 360 | content: template 361 | } 362 | ], 363 | stream: false, 364 | // Restricting the max tokens to 50 to avoid long titles 365 | max_tokens: 50, 366 | ...(chat_id && { chat_id: chat_id }), 367 | title: true 368 | }) 369 | }) 370 | .then(async (res) => { 371 | if (!res.ok) throw await res.json(); 372 | return res.json(); 373 | }) 374 | .catch((err) => { 375 | console.log(err); 376 | if ('detail' in err) { 377 | error = err.detail; 378 | } 379 | return null; 380 | }); 381 | 382 | if (error) { 383 | throw error; 384 | } 385 | 386 | return res?.choices[0]?.message?.content.replace(/["']/g, '') ?? 'New Chat'; 387 | }; 388 | 389 | export const generateSearchQuery = async ( 390 | token: string = '', 391 | model: string, 392 | previousMessages: string[], 393 | prompt: string, 394 | url: string = OPENAI_API_BASE_URL 395 | ): Promise => { 396 | let error = null; 397 | 398 | // TODO: Allow users to specify the prompt 399 | // Get the current date in the format "January 20, 2024" 400 | const currentDate = new Intl.DateTimeFormat('en-US', { 401 | year: 'numeric', 402 | month: 'long', 403 | day: '2-digit' 404 | }).format(new Date()); 405 | 406 | const res = await fetch(`${url}/chat/completions`, { 407 | method: 'POST', 408 | headers: { 409 | Accept: 'application/json', 410 | 'Content-Type': 'application/json', 411 | Authorization: `Bearer ${token}` 412 | }, 413 | body: JSON.stringify({ 414 | model: model, 415 | // Few shot prompting 416 | messages: [ 417 | { 418 | role: 'assistant', 419 | content: `You are tasked with generating web search queries. Give me an appropriate query to answer my question for google search. Answer with only the query. Today is ${currentDate}.` 420 | }, 421 | { 422 | role: 'user', 423 | content: prompt 424 | } 425 | // { 426 | // role: 'user', 427 | // content: 428 | // (previousMessages.length > 0 429 | // ? `Previous Questions:\n${previousMessages.join('\n')}\n\n` 430 | // : '') + `Current Question: ${prompt}` 431 | // } 432 | ], 433 | stream: false, 434 | // Restricting the max tokens to 30 to avoid long search queries 435 | max_tokens: 30 436 | }) 437 | }) 438 | .then(async (res) => { 439 | if (!res.ok) throw await res.json(); 440 | return res.json(); 441 | }) 442 | .catch((err) => { 443 | console.log(err); 444 | if ('detail' in err) { 445 | error = err.detail; 446 | } 447 | return undefined; 448 | }); 449 | 450 | if (error) { 451 | throw error; 452 | } 453 | 454 | return res?.choices[0]?.message?.content.replace(/["']/g, '') ?? undefined; 455 | }; ``````` `\\?\D:\Coding\ai\src\lib\apis\prompts\index.ts`: ```````ts 1 | import { WEBUI_API_BASE_URL } from '$lib/constants'; 2 | 3 | export const createNewPrompt = async ( 4 | token: string, 5 | command: string, 6 | title: string, 7 | content: string 8 | ) => { 9 | let error = null; 10 | 11 | const res = await fetch(`${WEBUI_API_BASE_URL}/prompts/create`, { 12 | method: 'POST', 13 | headers: { 14 | Accept: 'application/json', 15 | 'Content-Type': 'application/json', 16 | authorization: `Bearer ${token}` 17 | }, 18 | body: JSON.stringify({ 19 | command: `/${command}`, 20 | title: title, 21 | content: content 22 | }) 23 | }) 24 | .then(async (res) => { 25 | if (!res.ok) throw await res.json(); 26 | return res.json(); 27 | }) 28 | .catch((err) => { 29 | error = err.detail; 30 | console.log(err); 31 | return null; 32 | }); 33 | 34 | if (error) { 35 | throw error; 36 | } 37 | 38 | return res; 39 | }; 40 | 41 | export const getPrompts = async (token: string = '') => { 42 | let error = null; 43 | 44 | const res = await fetch(`${WEBUI_API_BASE_URL}/prompts/`, { 45 | method: 'GET', 46 | headers: { 47 | Accept: 'application/json', 48 | 'Content-Type': 'application/json', 49 | authorization: `Bearer ${token}` 50 | } 51 | }) 52 | .then(async (res) => { 53 | if (!res.ok) throw await res.json(); 54 | return res.json(); 55 | }) 56 | .then((json) => { 57 | return json; 58 | }) 59 | .catch((err) => { 60 | error = err.detail; 61 | console.log(err); 62 | return null; 63 | }); 64 | 65 | if (error) { 66 | throw error; 67 | } 68 | 69 | return res; 70 | }; 71 | 72 | export const getPromptByCommand = async (token: string, command: string) => { 73 | let error = null; 74 | 75 | const res = await fetch(`${WEBUI_API_BASE_URL}/prompts/command/${command}`, { 76 | method: 'GET', 77 | headers: { 78 | Accept: 'application/json', 79 | 'Content-Type': 'application/json', 80 | authorization: `Bearer ${token}` 81 | } 82 | }) 83 | .then(async (res) => { 84 | if (!res.ok) throw await res.json(); 85 | return res.json(); 86 | }) 87 | .then((json) => { 88 | return json; 89 | }) 90 | .catch((err) => { 91 | error = err.detail; 92 | 93 | console.log(err); 94 | return null; 95 | }); 96 | 97 | if (error) { 98 | throw error; 99 | } 100 | 101 | return res; 102 | }; 103 | 104 | export const updatePromptByCommand = async ( 105 | token: string, 106 | command: string, 107 | title: string, 108 | content: string 109 | ) => { 110 | let error = null; 111 | 112 | const res = await fetch(`${WEBUI_API_BASE_URL}/prompts/command/${command}/update`, { 113 | method: 'POST', 114 | headers: { 115 | Accept: 'application/json', 116 | 'Content-Type': 'application/json', 117 | authorization: `Bearer ${token}` 118 | }, 119 | body: JSON.stringify({ 120 | command: `/${command}`, 121 | title: title, 122 | content: content 123 | }) 124 | }) 125 | .then(async (res) => { 126 | if (!res.ok) throw await res.json(); 127 | return res.json(); 128 | }) 129 | .then((json) => { 130 | return json; 131 | }) 132 | .catch((err) => { 133 | error = err.detail; 134 | 135 | console.log(err); 136 | return null; 137 | }); 138 | 139 | if (error) { 140 | throw error; 141 | } 142 | 143 | return res; 144 | }; 145 | 146 | export const deletePromptByCommand = async (token: string, command: string) => { 147 | let error = null; 148 | 149 | command = command.charAt(0) === '/' ? command.slice(1) : command; 150 | 151 | const res = await fetch(`${WEBUI_API_BASE_URL}/prompts/command/${command}/delete`, { 152 | method: 'DELETE', 153 | headers: { 154 | Accept: 'application/json', 155 | 'Content-Type': 'application/json', 156 | authorization: `Bearer ${token}` 157 | } 158 | }) 159 | .then(async (res) => { 160 | if (!res.ok) throw await res.json(); 161 | return res.json(); 162 | }) 163 | .then((json) => { 164 | return json; 165 | }) 166 | .catch((err) => { 167 | error = err.detail; 168 | 169 | console.log(err); 170 | return null; 171 | }); 172 | 173 | if (error) { 174 | throw error; 175 | } 176 | 177 | return res; 178 | }; ``````` `\\?\D:\Coding\ai\src\lib\apis\rag\index.ts`: ```````ts 1 | import { RAG_API_BASE_URL } from '$lib/constants'; 2 | 3 | export const getRAGConfig = async (token: string) => { 4 | let error = null; 5 | 6 | const res = await fetch(`${RAG_API_BASE_URL}/config`, { 7 | method: 'GET', 8 | headers: { 9 | 'Content-Type': 'application/json', 10 | Authorization: `Bearer ${token}` 11 | } 12 | }) 13 | .then(async (res) => { 14 | if (!res.ok) throw await res.json(); 15 | return res.json(); 16 | }) 17 | .catch((err) => { 18 | console.log(err); 19 | error = err.detail; 20 | return null; 21 | }); 22 | 23 | if (error) { 24 | throw error; 25 | } 26 | 27 | return res; 28 | }; 29 | 30 | type ChunkConfigForm = { 31 | chunk_size: number; 32 | chunk_overlap: number; 33 | }; 34 | 35 | type ContentExtractConfigForm = { 36 | engine: string; 37 | tika_server_url: string | null; 38 | }; 39 | 40 | type YoutubeConfigForm = { 41 | language: string[]; 42 | translation?: string | null; 43 | }; 44 | 45 | type RAGConfigForm = { 46 | pdf_extract_images?: boolean; 47 | chunk?: ChunkConfigForm; 48 | content_extraction?: ContentExtractConfigForm; 49 | web_loader_ssl_verification?: boolean; 50 | youtube?: YoutubeConfigForm; 51 | }; 52 | 53 | export const updateRAGConfig = async (token: string, payload: RAGConfigForm) => { 54 | let error = null; 55 | 56 | const res = await fetch(`${RAG_API_BASE_URL}/config/update`, { 57 | method: 'POST', 58 | headers: { 59 | 'Content-Type': 'application/json', 60 | Authorization: `Bearer ${token}` 61 | }, 62 | body: JSON.stringify({ 63 | ...payload 64 | }) 65 | }) 66 | .then(async (res) => { 67 | if (!res.ok) throw await res.json(); 68 | return res.json(); 69 | }) 70 | .catch((err) => { 71 | console.log(err); 72 | error = err.detail; 73 | return null; 74 | }); 75 | 76 | if (error) { 77 | throw error; 78 | } 79 | 80 | return res; 81 | }; 82 | 83 | export const getRAGTemplate = async (token: string) => { 84 | let error = null; 85 | 86 | const res = await fetch(`${RAG_API_BASE_URL}/template`, { 87 | method: 'GET', 88 | headers: { 89 | 'Content-Type': 'application/json', 90 | Authorization: `Bearer ${token}` 91 | } 92 | }) 93 | .then(async (res) => { 94 | if (!res.ok) throw await res.json(); 95 | return res.json(); 96 | }) 97 | .catch((err) => { 98 | console.log(err); 99 | error = err.detail; 100 | return null; 101 | }); 102 | 103 | if (error) { 104 | throw error; 105 | } 106 | 107 | return res?.template ?? ''; 108 | }; 109 | 110 | export const getQuerySettings = async (token: string) => { 111 | let error = null; 112 | 113 | const res = await fetch(`${RAG_API_BASE_URL}/query/settings`, { 114 | method: 'GET', 115 | headers: { 116 | 'Content-Type': 'application/json', 117 | Authorization: `Bearer ${token}` 118 | } 119 | }) 120 | .then(async (res) => { 121 | if (!res.ok) throw await res.json(); 122 | return res.json(); 123 | }) 124 | .catch((err) => { 125 | console.log(err); 126 | error = err.detail; 127 | return null; 128 | }); 129 | 130 | if (error) { 131 | throw error; 132 | } 133 | 134 | return res; 135 | }; 136 | 137 | type QuerySettings = { 138 | k: number | null; 139 | r: number | null; 140 | template: string | null; 141 | }; 142 | 143 | export const updateQuerySettings = async (token: string, settings: QuerySettings) => { 144 | let error = null; 145 | 146 | const res = await fetch(`${RAG_API_BASE_URL}/query/settings/update`, { 147 | method: 'POST', 148 | headers: { 149 | 'Content-Type': 'application/json', 150 | Authorization: `Bearer ${token}` 151 | }, 152 | body: JSON.stringify({ 153 | ...settings 154 | }) 155 | }) 156 | .then(async (res) => { 157 | if (!res.ok) throw await res.json(); 158 | return res.json(); 159 | }) 160 | .catch((err) => { 161 | console.log(err); 162 | error = err.detail; 163 | return null; 164 | }); 165 | 166 | if (error) { 167 | throw error; 168 | } 169 | 170 | return res; 171 | }; 172 | 173 | export const processDocToVectorDB = async (token: string, file_id: string) => { 174 | let error = null; 175 | 176 | const res = await fetch(`${RAG_API_BASE_URL}/process/doc`, { 177 | method: 'POST', 178 | headers: { 179 | Accept: 'application/json', 180 | 'Content-Type': 'application/json', 181 | authorization: `Bearer ${token}` 182 | }, 183 | body: JSON.stringify({ 184 | file_id: file_id 185 | }) 186 | }) 187 | .then(async (res) => { 188 | if (!res.ok) throw await res.json(); 189 | return res.json(); 190 | }) 191 | .catch((err) => { 192 | error = err.detail; 193 | console.log(err); 194 | return null; 195 | }); 196 | 197 | if (error) { 198 | throw error; 199 | } 200 | 201 | return res; 202 | }; 203 | 204 | export const uploadDocToVectorDB = async (token: string, collection_name: string, file: File) => { 205 | const data = new FormData(); 206 | data.append('file', file); 207 | data.append('collection_name', collection_name); 208 | 209 | let error = null; 210 | 211 | const res = await fetch(`${RAG_API_BASE_URL}/doc`, { 212 | method: 'POST', 213 | headers: { 214 | Accept: 'application/json', 215 | authorization: `Bearer ${token}` 216 | }, 217 | body: data 218 | }) 219 | .then(async (res) => { 220 | if (!res.ok) throw await res.json(); 221 | return res.json(); 222 | }) 223 | .catch((err) => { 224 | error = err.detail; 225 | console.log(err); 226 | return null; 227 | }); 228 | 229 | if (error) { 230 | throw error; 231 | } 232 | 233 | return res; 234 | }; 235 | 236 | export const uploadWebToVectorDB = async (token: string, collection_name: string, url: string) => { 237 | let error = null; 238 | 239 | const res = await fetch(`${RAG_API_BASE_URL}/web`, { 240 | method: 'POST', 241 | headers: { 242 | Accept: 'application/json', 243 | 'Content-Type': 'application/json', 244 | authorization: `Bearer ${token}` 245 | }, 246 | body: JSON.stringify({ 247 | url: url, 248 | collection_name: collection_name 249 | }) 250 | }) 251 | .then(async (res) => { 252 | if (!res.ok) throw await res.json(); 253 | return res.json(); 254 | }) 255 | .catch((err) => { 256 | error = err.detail; 257 | console.log(err); 258 | return null; 259 | }); 260 | 261 | if (error) { 262 | throw error; 263 | } 264 | 265 | return res; 266 | }; 267 | 268 | export const uploadYoutubeTranscriptionToVectorDB = async (token: string, url: string) => { 269 | let error = null; 270 | 271 | const res = await fetch(`${RAG_API_BASE_URL}/youtube`, { 272 | method: 'POST', 273 | headers: { 274 | Accept: 'application/json', 275 | 'Content-Type': 'application/json', 276 | authorization: `Bearer ${token}` 277 | }, 278 | body: JSON.stringify({ 279 | url: url 280 | }) 281 | }) 282 | .then(async (res) => { 283 | if (!res.ok) throw await res.json(); 284 | return res.json(); 285 | }) 286 | .catch((err) => { 287 | error = err.detail; 288 | console.log(err); 289 | return null; 290 | }); 291 | 292 | if (error) { 293 | throw error; 294 | } 295 | 296 | return res; 297 | }; 298 | 299 | export const queryDoc = async ( 300 | token: string, 301 | collection_name: string, 302 | query: string, 303 | k: number | null = null 304 | ) => { 305 | let error = null; 306 | 307 | const res = await fetch(`${RAG_API_BASE_URL}/query/doc`, { 308 | method: 'POST', 309 | headers: { 310 | Accept: 'application/json', 311 | 'Content-Type': 'application/json', 312 | authorization: `Bearer ${token}` 313 | }, 314 | body: JSON.stringify({ 315 | collection_name: collection_name, 316 | query: query, 317 | k: k 318 | }) 319 | }) 320 | .then(async (res) => { 321 | if (!res.ok) throw await res.json(); 322 | return res.json(); 323 | }) 324 | .catch((err) => { 325 | error = err.detail; 326 | return null; 327 | }); 328 | 329 | if (error) { 330 | throw error; 331 | } 332 | 333 | return res; 334 | }; 335 | 336 | export const queryCollection = async ( 337 | token: string, 338 | collection_names: string, 339 | query: string, 340 | k: number | null = null 341 | ) => { 342 | let error = null; 343 | 344 | const res = await fetch(`${RAG_API_BASE_URL}/query/collection`, { 345 | method: 'POST', 346 | headers: { 347 | Accept: 'application/json', 348 | 'Content-Type': 'application/json', 349 | authorization: `Bearer ${token}` 350 | }, 351 | body: JSON.stringify({ 352 | collection_names: collection_names, 353 | query: query, 354 | k: k 355 | }) 356 | }) 357 | .then(async (res) => { 358 | if (!res.ok) throw await res.json(); 359 | return res.json(); 360 | }) 361 | .catch((err) => { 362 | error = err.detail; 363 | return null; 364 | }); 365 | 366 | if (error) { 367 | throw error; 368 | } 369 | 370 | return res; 371 | }; 372 | 373 | export const scanDocs = async (token: string) => { 374 | let error = null; 375 | 376 | const res = await fetch(`${RAG_API_BASE_URL}/scan`, { 377 | method: 'GET', 378 | headers: { 379 | Accept: 'application/json', 380 | authorization: `Bearer ${token}` 381 | } 382 | }) 383 | .then(async (res) => { 384 | if (!res.ok) throw await res.json(); 385 | return res.json(); 386 | }) 387 | .catch((err) => { 388 | error = err.detail; 389 | return null; 390 | }); 391 | 392 | if (error) { 393 | throw error; 394 | } 395 | 396 | return res; 397 | }; 398 | 399 | export const resetUploadDir = async (token: string) => { 400 | let error = null; 401 | 402 | const res = await fetch(`${RAG_API_BASE_URL}/reset/uploads`, { 403 | method: 'GET', 404 | headers: { 405 | Accept: 'application/json', 406 | authorization: `Bearer ${token}` 407 | } 408 | }) 409 | .then(async (res) => { 410 | if (!res.ok) throw await res.json(); 411 | return res.json(); 412 | }) 413 | .catch((err) => { 414 | error = err.detail; 415 | return null; 416 | }); 417 | 418 | if (error) { 419 | throw error; 420 | } 421 | 422 | return res; 423 | }; 424 | 425 | export const resetVectorDB = async (token: string) => { 426 | let error = null; 427 | 428 | const res = await fetch(`${RAG_API_BASE_URL}/reset/db`, { 429 | method: 'GET', 430 | headers: { 431 | Accept: 'application/json', 432 | authorization: `Bearer ${token}` 433 | } 434 | }) 435 | .then(async (res) => { 436 | if (!res.ok) throw await res.json(); 437 | return res.json(); 438 | }) 439 | .catch((err) => { 440 | error = err.detail; 441 | return null; 442 | }); 443 | 444 | if (error) { 445 | throw error; 446 | } 447 | 448 | return res; 449 | }; 450 | 451 | export const getEmbeddingConfig = async (token: string) => { 452 | let error = null; 453 | 454 | const res = await fetch(`${RAG_API_BASE_URL}/embedding`, { 455 | method: 'GET', 456 | headers: { 457 | 'Content-Type': 'application/json', 458 | Authorization: `Bearer ${token}` 459 | } 460 | }) 461 | .then(async (res) => { 462 | if (!res.ok) throw await res.json(); 463 | return res.json(); 464 | }) 465 | .catch((err) => { 466 | console.log(err); 467 | error = err.detail; 468 | return null; 469 | }); 470 | 471 | if (error) { 472 | throw error; 473 | } 474 | 475 | return res; 476 | }; 477 | 478 | type OpenAIConfigForm = { 479 | key: string; 480 | url: string; 481 | batch_size: number; 482 | }; 483 | 484 | type EmbeddingModelUpdateForm = { 485 | openai_config?: OpenAIConfigForm; 486 | embedding_engine: string; 487 | embedding_model: string; 488 | }; 489 | 490 | export const updateEmbeddingConfig = async (token: string, payload: EmbeddingModelUpdateForm) => { 491 | let error = null; 492 | 493 | const res = await fetch(`${RAG_API_BASE_URL}/embedding/update`, { 494 | method: 'POST', 495 | headers: { 496 | 'Content-Type': 'application/json', 497 | Authorization: `Bearer ${token}` 498 | }, 499 | body: JSON.stringify({ 500 | ...payload 501 | }) 502 | }) 503 | .then(async (res) => { 504 | if (!res.ok) throw await res.json(); 505 | return res.json(); 506 | }) 507 | .catch((err) => { 508 | console.log(err); 509 | error = err.detail; 510 | return null; 511 | }); 512 | 513 | if (error) { 514 | throw error; 515 | } 516 | 517 | return res; 518 | }; 519 | 520 | export const getRerankingConfig = async (token: string) => { 521 | let error = null; 522 | 523 | const res = await fetch(`${RAG_API_BASE_URL}/reranking`, { 524 | method: 'GET', 525 | headers: { 526 | 'Content-Type': 'application/json', 527 | Authorization: `Bearer ${token}` 528 | } 529 | }) 530 | .then(async (res) => { 531 | if (!res.ok) throw await res.json(); 532 | return res.json(); 533 | }) 534 | .catch((err) => { 535 | console.log(err); 536 | error = err.detail; 537 | return null; 538 | }); 539 | 540 | if (error) { 541 | throw error; 542 | } 543 | 544 | return res; 545 | }; 546 | 547 | type RerankingModelUpdateForm = { 548 | reranking_model: string; 549 | }; 550 | 551 | export const updateRerankingConfig = async (token: string, payload: RerankingModelUpdateForm) => { 552 | let error = null; 553 | 554 | const res = await fetch(`${RAG_API_BASE_URL}/reranking/update`, { 555 | method: 'POST', 556 | headers: { 557 | 'Content-Type': 'application/json', 558 | Authorization: `Bearer ${token}` 559 | }, 560 | body: JSON.stringify({ 561 | ...payload 562 | }) 563 | }) 564 | .then(async (res) => { 565 | if (!res.ok) throw await res.json(); 566 | return res.json(); 567 | }) 568 | .catch((err) => { 569 | console.log(err); 570 | error = err.detail; 571 | return null; 572 | }); 573 | 574 | if (error) { 575 | throw error; 576 | } 577 | 578 | return res; 579 | }; 580 | 581 | export const runWebSearch = async ( 582 | token: string, 583 | query: string, 584 | collection_name?: string 585 | ): Promise => { 586 | let error = null; 587 | 588 | const res = await fetch(`${RAG_API_BASE_URL}/web/search`, { 589 | method: 'POST', 590 | headers: { 591 | 'Content-Type': 'application/json', 592 | Authorization: `Bearer ${token}` 593 | }, 594 | body: JSON.stringify({ 595 | query, 596 | collection_name: collection_name ?? '' 597 | }) 598 | }) 599 | .then(async (res) => { 600 | if (!res.ok) throw await res.json(); 601 | return res.json(); 602 | }) 603 | .catch((err) => { 604 | console.log(err); 605 | error = err.detail; 606 | return null; 607 | }); 608 | 609 | if (error) { 610 | throw error; 611 | } 612 | 613 | return res; 614 | }; 615 | 616 | export interface SearchDocument { 617 | status: boolean; 618 | collection_name: string; 619 | filenames: string[]; 620 | } ``````` `\\?\D:\Coding\ai\src\lib\apis\streaming\index.ts`: ```````ts 1 | import { EventSourceParserStream } from 'eventsource-parser/stream'; 2 | import type { ParsedEvent } from 'eventsource-parser'; 3 | 4 | type TextStreamUpdate = { 5 | done: boolean; 6 | value: string; 7 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 8 | citations?: any; 9 | // eslint-disable-next-line @typescript-eslint/no-explicit-any 10 | error?: any; 11 | usage?: ResponseUsage; 12 | }; 13 | 14 | type ResponseUsage = { 15 | /** Including images and tools if any */ 16 | prompt_tokens: number; 17 | /** The tokens generated */ 18 | completion_tokens: number; 19 | /** Sum of the above two fields */ 20 | total_tokens: number; 21 | }; 22 | 23 | // createOpenAITextStream takes a responseBody with a SSE response, 24 | // and returns an async generator that emits delta updates with large deltas chunked into random sized chunks 25 | export async function createOpenAITextStream( 26 | responseBody: ReadableStream, 27 | splitLargeDeltas: boolean 28 | ): Promise> { 29 | const eventStream = responseBody 30 | .pipeThrough(new TextDecoderStream()) 31 | .pipeThrough(new EventSourceParserStream()) 32 | .getReader(); 33 | let iterator = openAIStreamToIterator(eventStream); 34 | if (splitLargeDeltas) { 35 | iterator = streamLargeDeltasAsRandomChunks(iterator); 36 | } 37 | return iterator; 38 | } 39 | 40 | async function* openAIStreamToIterator( 41 | reader: ReadableStreamDefaultReader 42 | ): AsyncGenerator { 43 | while (true) { 44 | const { value, done } = await reader.read(); 45 | if (done) { 46 | yield { done: true, value: '' }; 47 | break; 48 | } 49 | if (!value) { 50 | continue; 51 | } 52 | const data = value.data; 53 | if (data.startsWith('[DONE]')) { 54 | yield { done: true, value: '' }; 55 | break; 56 | } 57 | 58 | try { 59 | const parsedData = JSON.parse(data); 60 | console.log(parsedData); 61 | 62 | if (parsedData.error) { 63 | yield { done: true, value: '', error: parsedData.error }; 64 | break; 65 | } 66 | 67 | if (parsedData.citations) { 68 | yield { done: false, value: '', citations: parsedData.citations }; 69 | continue; 70 | } 71 | 72 | yield { 73 | done: false, 74 | value: parsedData.choices?.[0]?.delta?.content ?? '', 75 | usage: parsedData.usage 76 | }; 77 | } catch (e) { 78 | console.error('Error extracting delta from SSE event:', e); 79 | } 80 | } 81 | } 82 | 83 | // streamLargeDeltasAsRandomChunks will chunk large deltas (length > 5) into random sized chunks between 1-3 characters 84 | // This is to simulate a more fluid streaming, even though some providers may send large chunks of text at once 85 | async function* streamLargeDeltasAsRandomChunks( 86 | iterator: AsyncGenerator 87 | ): AsyncGenerator { 88 | for await (const textStreamUpdate of iterator) { 89 | if (textStreamUpdate.done) { 90 | yield textStreamUpdate; 91 | return; 92 | } 93 | if (textStreamUpdate.citations) { 94 | yield textStreamUpdate; 95 | continue; 96 | } 97 | let content = textStreamUpdate.value; 98 | if (content.length < 5) { 99 | yield { done: false, value: content }; 100 | continue; 101 | } 102 | while (content != '') { 103 | const chunkSize = Math.min(Math.floor(Math.random() * 3) + 1, content.length); 104 | const chunk = content.slice(0, chunkSize); 105 | yield { done: false, value: chunk }; 106 | // Do not sleep if the tab is hidden 107 | // Timers are throttled to 1s in hidden tabs 108 | if (document?.visibilityState !== 'hidden') { 109 | await sleep(5); 110 | } 111 | content = content.slice(chunkSize); 112 | } 113 | } 114 | } 115 | 116 | const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); ``````` `\\?\D:\Coding\ai\src\lib\apis\tools\index.ts`: ```````ts 1 | import { WEBUI_API_BASE_URL } from '$lib/constants'; 2 | 3 | export const createNewTool = async (token: string, tool: object) => { 4 | let error = null; 5 | 6 | const res = await fetch(`${WEBUI_API_BASE_URL}/tools/create`, { 7 | method: 'POST', 8 | headers: { 9 | Accept: 'application/json', 10 | 'Content-Type': 'application/json', 11 | authorization: `Bearer ${token}` 12 | }, 13 | body: JSON.stringify({ 14 | ...tool 15 | }) 16 | }) 17 | .then(async (res) => { 18 | if (!res.ok) throw await res.json(); 19 | return res.json(); 20 | }) 21 | .catch((err) => { 22 | error = err.detail; 23 | console.log(err); 24 | return null; 25 | }); 26 | 27 | if (error) { 28 | throw error; 29 | } 30 | 31 | return res; 32 | }; 33 | 34 | export const getTools = async (token: string = '') => { 35 | let error = null; 36 | 37 | const res = await fetch(`${WEBUI_API_BASE_URL}/tools/`, { 38 | method: 'GET', 39 | headers: { 40 | Accept: 'application/json', 41 | 'Content-Type': 'application/json', 42 | authorization: `Bearer ${token}` 43 | } 44 | }) 45 | .then(async (res) => { 46 | if (!res.ok) throw await res.json(); 47 | return res.json(); 48 | }) 49 | .then((json) => { 50 | return json; 51 | }) 52 | .catch((err) => { 53 | error = err.detail; 54 | console.log(err); 55 | return null; 56 | }); 57 | 58 | if (error) { 59 | throw error; 60 | } 61 | 62 | return res; 63 | }; 64 | 65 | export const exportTools = async (token: string = '') => { 66 | let error = null; 67 | 68 | const res = await fetch(`${WEBUI_API_BASE_URL}/tools/export`, { 69 | method: 'GET', 70 | headers: { 71 | Accept: 'application/json', 72 | 'Content-Type': 'application/json', 73 | authorization: `Bearer ${token}` 74 | } 75 | }) 76 | .then(async (res) => { 77 | if (!res.ok) throw await res.json(); 78 | return res.json(); 79 | }) 80 | .then((json) => { 81 | return json; 82 | }) 83 | .catch((err) => { 84 | error = err.detail; 85 | console.log(err); 86 | return null; 87 | }); 88 | 89 | if (error) { 90 | throw error; 91 | } 92 | 93 | return res; 94 | }; 95 | 96 | export const getToolById = async (token: string, id: string) => { 97 | let error = null; 98 | 99 | const res = await fetch(`${WEBUI_API_BASE_URL}/tools/id/${id}`, { 100 | method: 'GET', 101 | headers: { 102 | Accept: 'application/json', 103 | 'Content-Type': 'application/json', 104 | authorization: `Bearer ${token}` 105 | } 106 | }) 107 | .then(async (res) => { 108 | if (!res.ok) throw await res.json(); 109 | return res.json(); 110 | }) 111 | .then((json) => { 112 | return json; 113 | }) 114 | .catch((err) => { 115 | error = err.detail; 116 | 117 | console.log(err); 118 | return null; 119 | }); 120 | 121 | if (error) { 122 | throw error; 123 | } 124 | 125 | return res; 126 | }; 127 | 128 | export const updateToolById = async (token: string, id: string, tool: object) => { 129 | let error = null; 130 | 131 | const res = await fetch(`${WEBUI_API_BASE_URL}/tools/id/${id}/update`, { 132 | method: 'POST', 133 | headers: { 134 | Accept: 'application/json', 135 | 'Content-Type': 'application/json', 136 | authorization: `Bearer ${token}` 137 | }, 138 | body: JSON.stringify({ 139 | ...tool 140 | }) 141 | }) 142 | .then(async (res) => { 143 | if (!res.ok) throw await res.json(); 144 | return res.json(); 145 | }) 146 | .then((json) => { 147 | return json; 148 | }) 149 | .catch((err) => { 150 | error = err.detail; 151 | 152 | console.log(err); 153 | return null; 154 | }); 155 | 156 | if (error) { 157 | throw error; 158 | } 159 | 160 | return res; 161 | }; 162 | 163 | export const deleteToolById = async (token: string, id: string) => { 164 | let error = null; 165 | 166 | const res = await fetch(`${WEBUI_API_BASE_URL}/tools/id/${id}/delete`, { 167 | method: 'DELETE', 168 | headers: { 169 | Accept: 'application/json', 170 | 'Content-Type': 'application/json', 171 | authorization: `Bearer ${token}` 172 | } 173 | }) 174 | .then(async (res) => { 175 | if (!res.ok) throw await res.json(); 176 | return res.json(); 177 | }) 178 | .then((json) => { 179 | return json; 180 | }) 181 | .catch((err) => { 182 | error = err.detail; 183 | 184 | console.log(err); 185 | return null; 186 | }); 187 | 188 | if (error) { 189 | throw error; 190 | } 191 | 192 | return res; 193 | }; 194 | 195 | export const getToolValvesById = async (token: string, id: string) => { 196 | let error = null; 197 | 198 | const res = await fetch(`${WEBUI_API_BASE_URL}/tools/id/${id}/valves`, { 199 | method: 'GET', 200 | headers: { 201 | Accept: 'application/json', 202 | 'Content-Type': 'application/json', 203 | authorization: `Bearer ${token}` 204 | } 205 | }) 206 | .then(async (res) => { 207 | if (!res.ok) throw await res.json(); 208 | return res.json(); 209 | }) 210 | .then((json) => { 211 | return json; 212 | }) 213 | .catch((err) => { 214 | error = err.detail; 215 | 216 | console.log(err); 217 | return null; 218 | }); 219 | 220 | if (error) { 221 | throw error; 222 | } 223 | 224 | return res; 225 | }; 226 | 227 | export const getToolValvesSpecById = async (token: string, id: string) => { 228 | let error = null; 229 | 230 | const res = await fetch(`${WEBUI_API_BASE_URL}/tools/id/${id}/valves/spec`, { 231 | method: 'GET', 232 | headers: { 233 | Accept: 'application/json', 234 | 'Content-Type': 'application/json', 235 | authorization: `Bearer ${token}` 236 | } 237 | }) 238 | .then(async (res) => { 239 | if (!res.ok) throw await res.json(); 240 | return res.json(); 241 | }) 242 | .then((json) => { 243 | return json; 244 | }) 245 | .catch((err) => { 246 | error = err.detail; 247 | 248 | console.log(err); 249 | return null; 250 | }); 251 | 252 | if (error) { 253 | throw error; 254 | } 255 | 256 | return res; 257 | }; 258 | 259 | export const updateToolValvesById = async (token: string, id: string, valves: object) => { 260 | let error = null; 261 | 262 | const res = await fetch(`${WEBUI_API_BASE_URL}/tools/id/${id}/valves/update`, { 263 | method: 'POST', 264 | headers: { 265 | Accept: 'application/json', 266 | 'Content-Type': 'application/json', 267 | authorization: `Bearer ${token}` 268 | }, 269 | body: JSON.stringify({ 270 | ...valves 271 | }) 272 | }) 273 | .then(async (res) => { 274 | if (!res.ok) throw await res.json(); 275 | return res.json(); 276 | }) 277 | .then((json) => { 278 | return json; 279 | }) 280 | .catch((err) => { 281 | error = err.detail; 282 | 283 | console.log(err); 284 | return null; 285 | }); 286 | 287 | if (error) { 288 | throw error; 289 | } 290 | 291 | return res; 292 | }; 293 | 294 | export const getUserValvesById = async (token: string, id: string) => { 295 | let error = null; 296 | 297 | const res = await fetch(`${WEBUI_API_BASE_URL}/tools/id/${id}/valves/user`, { 298 | method: 'GET', 299 | headers: { 300 | Accept: 'application/json', 301 | 'Content-Type': 'application/json', 302 | authorization: `Bearer ${token}` 303 | } 304 | }) 305 | .then(async (res) => { 306 | if (!res.ok) throw await res.json(); 307 | return res.json(); 308 | }) 309 | .then((json) => { 310 | return json; 311 | }) 312 | .catch((err) => { 313 | error = err.detail; 314 | 315 | console.log(err); 316 | return null; 317 | }); 318 | 319 | if (error) { 320 | throw error; 321 | } 322 | 323 | return res; 324 | }; 325 | 326 | export const getUserValvesSpecById = async (token: string, id: string) => { 327 | let error = null; 328 | 329 | const res = await fetch(`${WEBUI_API_BASE_URL}/tools/id/${id}/valves/user/spec`, { 330 | method: 'GET', 331 | headers: { 332 | Accept: 'application/json', 333 | 'Content-Type': 'application/json', 334 | authorization: `Bearer ${token}` 335 | } 336 | }) 337 | .then(async (res) => { 338 | if (!res.ok) throw await res.json(); 339 | return res.json(); 340 | }) 341 | .then((json) => { 342 | return json; 343 | }) 344 | .catch((err) => { 345 | error = err.detail; 346 | 347 | console.log(err); 348 | return null; 349 | }); 350 | 351 | if (error) { 352 | throw error; 353 | } 354 | 355 | return res; 356 | }; 357 | 358 | export const updateUserValvesById = async (token: string, id: string, valves: object) => { 359 | let error = null; 360 | 361 | const res = await fetch(`${WEBUI_API_BASE_URL}/tools/id/${id}/valves/user/update`, { 362 | method: 'POST', 363 | headers: { 364 | Accept: 'application/json', 365 | 'Content-Type': 'application/json', 366 | authorization: `Bearer ${token}` 367 | }, 368 | body: JSON.stringify({ 369 | ...valves 370 | }) 371 | }) 372 | .then(async (res) => { 373 | if (!res.ok) throw await res.json(); 374 | return res.json(); 375 | }) 376 | .then((json) => { 377 | return json; 378 | }) 379 | .catch((err) => { 380 | error = err.detail; 381 | 382 | console.log(err); 383 | return null; 384 | }); 385 | 386 | if (error) { 387 | throw error; 388 | } 389 | 390 | return res; 391 | }; ``````` `\\?\D:\Coding\ai\src\lib\apis\users\index.ts`: ```````ts 1 | import { WEBUI_API_BASE_URL } from '$lib/constants'; 2 | import { getUserPosition } from '$lib/utils'; 3 | 4 | export const getUserPermissions = async (token: string) => { 5 | let error = null; 6 | 7 | const res = await fetch(`${WEBUI_API_BASE_URL}/users/permissions/user`, { 8 | method: 'GET', 9 | headers: { 10 | 'Content-Type': 'application/json', 11 | Authorization: `Bearer ${token}` 12 | } 13 | }) 14 | .then(async (res) => { 15 | if (!res.ok) throw await res.json(); 16 | return res.json(); 17 | }) 18 | .catch((err) => { 19 | console.log(err); 20 | error = err.detail; 21 | return null; 22 | }); 23 | 24 | if (error) { 25 | throw error; 26 | } 27 | 28 | return res; 29 | }; 30 | 31 | export const updateUserPermissions = async (token: string, permissions: object) => { 32 | let error = null; 33 | 34 | const res = await fetch(`${WEBUI_API_BASE_URL}/users/permissions/user`, { 35 | method: 'POST', 36 | headers: { 37 | 'Content-Type': 'application/json', 38 | Authorization: `Bearer ${token}` 39 | }, 40 | body: JSON.stringify({ 41 | ...permissions 42 | }) 43 | }) 44 | .then(async (res) => { 45 | if (!res.ok) throw await res.json(); 46 | return res.json(); 47 | }) 48 | .catch((err) => { 49 | console.log(err); 50 | error = err.detail; 51 | return null; 52 | }); 53 | 54 | if (error) { 55 | throw error; 56 | } 57 | 58 | return res; 59 | }; 60 | 61 | export const updateUserRole = async (token: string, id: string, role: string) => { 62 | let error = null; 63 | 64 | const res = await fetch(`${WEBUI_API_BASE_URL}/users/update/role`, { 65 | method: 'POST', 66 | headers: { 67 | 'Content-Type': 'application/json', 68 | Authorization: `Bearer ${token}` 69 | }, 70 | body: JSON.stringify({ 71 | id: id, 72 | role: role 73 | }) 74 | }) 75 | .then(async (res) => { 76 | if (!res.ok) throw await res.json(); 77 | return res.json(); 78 | }) 79 | .catch((err) => { 80 | console.log(err); 81 | error = err.detail; 82 | return null; 83 | }); 84 | 85 | if (error) { 86 | throw error; 87 | } 88 | 89 | return res; 90 | }; 91 | 92 | export const getUsers = async (token: string) => { 93 | let error = null; 94 | 95 | const res = await fetch(`${WEBUI_API_BASE_URL}/users/`, { 96 | method: 'GET', 97 | headers: { 98 | 'Content-Type': 'application/json', 99 | Authorization: `Bearer ${token}` 100 | } 101 | }) 102 | .then(async (res) => { 103 | if (!res.ok) throw await res.json(); 104 | return res.json(); 105 | }) 106 | .catch((err) => { 107 | console.log(err); 108 | error = err.detail; 109 | return null; 110 | }); 111 | 112 | if (error) { 113 | throw error; 114 | } 115 | 116 | return res ? res : []; 117 | }; 118 | 119 | export const getUserSettings = async (token: string) => { 120 | let error = null; 121 | const res = await fetch(`${WEBUI_API_BASE_URL}/users/user/settings`, { 122 | method: 'GET', 123 | headers: { 124 | 'Content-Type': 'application/json', 125 | Authorization: `Bearer ${token}` 126 | } 127 | }) 128 | .then(async (res) => { 129 | if (!res.ok) throw await res.json(); 130 | return res.json(); 131 | }) 132 | .catch((err) => { 133 | console.log(err); 134 | error = err.detail; 135 | return null; 136 | }); 137 | 138 | if (error) { 139 | throw error; 140 | } 141 | 142 | return res; 143 | }; 144 | 145 | export const updateUserSettings = async (token: string, settings: object) => { 146 | let error = null; 147 | 148 | const res = await fetch(`${WEBUI_API_BASE_URL}/users/user/settings/update`, { 149 | method: 'POST', 150 | headers: { 151 | 'Content-Type': 'application/json', 152 | Authorization: `Bearer ${token}` 153 | }, 154 | body: JSON.stringify({ 155 | ...settings 156 | }) 157 | }) 158 | .then(async (res) => { 159 | if (!res.ok) throw await res.json(); 160 | return res.json(); 161 | }) 162 | .catch((err) => { 163 | console.log(err); 164 | error = err.detail; 165 | return null; 166 | }); 167 | 168 | if (error) { 169 | throw error; 170 | } 171 | 172 | return res; 173 | }; 174 | 175 | export const getUserById = async (token: string, userId: string) => { 176 | let error = null; 177 | 178 | const res = await fetch(`${WEBUI_API_BASE_URL}/users/${userId}`, { 179 | method: 'GET', 180 | headers: { 181 | 'Content-Type': 'application/json', 182 | Authorization: `Bearer ${token}` 183 | } 184 | }) 185 | .then(async (res) => { 186 | if (!res.ok) throw await res.json(); 187 | return res.json(); 188 | }) 189 | .catch((err) => { 190 | console.log(err); 191 | error = err.detail; 192 | return null; 193 | }); 194 | 195 | if (error) { 196 | throw error; 197 | } 198 | 199 | return res; 200 | }; 201 | 202 | export const getUserInfo = async (token: string) => { 203 | let error = null; 204 | const res = await fetch(`${WEBUI_API_BASE_URL}/users/user/info`, { 205 | method: 'GET', 206 | headers: { 207 | 'Content-Type': 'application/json', 208 | Authorization: `Bearer ${token}` 209 | } 210 | }) 211 | .then(async (res) => { 212 | if (!res.ok) throw await res.json(); 213 | return res.json(); 214 | }) 215 | .catch((err) => { 216 | console.log(err); 217 | error = err.detail; 218 | return null; 219 | }); 220 | 221 | if (error) { 222 | throw error; 223 | } 224 | 225 | return res; 226 | }; 227 | 228 | export const updateUserInfo = async (token: string, info: object) => { 229 | let error = null; 230 | 231 | const res = await fetch(`${WEBUI_API_BASE_URL}/users/user/info/update`, { 232 | method: 'POST', 233 | headers: { 234 | 'Content-Type': 'application/json', 235 | Authorization: `Bearer ${token}` 236 | }, 237 | body: JSON.stringify({ 238 | ...info 239 | }) 240 | }) 241 | .then(async (res) => { 242 | if (!res.ok) throw await res.json(); 243 | return res.json(); 244 | }) 245 | .catch((err) => { 246 | console.log(err); 247 | error = err.detail; 248 | return null; 249 | }); 250 | 251 | if (error) { 252 | throw error; 253 | } 254 | 255 | return res; 256 | }; 257 | 258 | export const getAndUpdateUserLocation = async (token: string) => { 259 | const location = await getUserPosition().catch((err) => { 260 | throw err; 261 | }); 262 | 263 | if (location) { 264 | await updateUserInfo(token, { location: location }); 265 | return location; 266 | } else { 267 | throw new Error('Failed to get user location'); 268 | } 269 | }; 270 | 271 | export const deleteUserById = async (token: string, userId: string) => { 272 | let error = null; 273 | 274 | const res = await fetch(`${WEBUI_API_BASE_URL}/users/${userId}`, { 275 | method: 'DELETE', 276 | headers: { 277 | 'Content-Type': 'application/json', 278 | Authorization: `Bearer ${token}` 279 | } 280 | }) 281 | .then(async (res) => { 282 | if (!res.ok) throw await res.json(); 283 | return res.json(); 284 | }) 285 | .catch((err) => { 286 | console.log(err); 287 | error = err.detail; 288 | return null; 289 | }); 290 | 291 | if (error) { 292 | throw error; 293 | } 294 | 295 | return res; 296 | }; 297 | 298 | type UserUpdateForm = { 299 | profile_image_url: string; 300 | email: string; 301 | name: string; 302 | password: string; 303 | }; 304 | 305 | export const updateUserById = async (token: string, userId: string, user: UserUpdateForm) => { 306 | let error = null; 307 | 308 | const res = await fetch(`${WEBUI_API_BASE_URL}/users/${userId}/update`, { 309 | method: 'POST', 310 | headers: { 311 | 'Content-Type': 'application/json', 312 | Authorization: `Bearer ${token}` 313 | }, 314 | body: JSON.stringify({ 315 | profile_image_url: user.profile_image_url, 316 | email: user.email, 317 | name: user.name, 318 | password: user.password !== '' ? user.password : undefined 319 | }) 320 | }) 321 | .then(async (res) => { 322 | if (!res.ok) throw await res.json(); 323 | return res.json(); 324 | }) 325 | .catch((err) => { 326 | console.log(err); 327 | error = err.detail; 328 | return null; 329 | }); 330 | 331 | if (error) { 332 | throw error; 333 | } 334 | 335 | return res; 336 | }; ``````` `\\?\D:\Coding\ai\src\lib\apis\utils\index.ts`: ```````ts 1 | import { WEBUI_API_BASE_URL } from '$lib/constants'; 2 | 3 | export const getGravatarUrl = async (email: string) => { 4 | let error = null; 5 | 6 | const res = await fetch(`${WEBUI_API_BASE_URL}/utils/gravatar?email=${email}`, { 7 | method: 'GET', 8 | headers: { 9 | 'Content-Type': 'application/json' 10 | } 11 | }) 12 | .then(async (res) => { 13 | if (!res.ok) throw await res.json(); 14 | return res.json(); 15 | }) 16 | .catch((err) => { 17 | console.log(err); 18 | error = err; 19 | return null; 20 | }); 21 | 22 | return res; 23 | }; 24 | 25 | export const formatPythonCode = async (code: string) => { 26 | let error = null; 27 | 28 | const res = await fetch(`${WEBUI_API_BASE_URL}/utils/code/format`, { 29 | method: 'POST', 30 | headers: { 31 | 'Content-Type': 'application/json' 32 | }, 33 | body: JSON.stringify({ 34 | code: code 35 | }) 36 | }) 37 | .then(async (res) => { 38 | if (!res.ok) throw await res.json(); 39 | return res.json(); 40 | }) 41 | .catch((err) => { 42 | console.log(err); 43 | 44 | error = err; 45 | if (err.detail) { 46 | error = err.detail; 47 | } 48 | return null; 49 | }); 50 | 51 | if (error) { 52 | throw error; 53 | } 54 | 55 | return res; 56 | }; 57 | 58 | export const downloadChatAsPDF = async (chat: object) => { 59 | let error = null; 60 | 61 | const blob = await fetch(`${WEBUI_API_BASE_URL}/utils/pdf`, { 62 | method: 'POST', 63 | headers: { 64 | 'Content-Type': 'application/json' 65 | }, 66 | body: JSON.stringify({ 67 | title: chat.title, 68 | messages: chat.messages 69 | }) 70 | }) 71 | .then(async (res) => { 72 | if (!res.ok) throw await res.json(); 73 | return res.blob(); 74 | }) 75 | .catch((err) => { 76 | console.log(err); 77 | error = err; 78 | return null; 79 | }); 80 | 81 | return blob; 82 | }; 83 | 84 | export const getHTMLFromMarkdown = async (md: string) => { 85 | let error = null; 86 | 87 | const res = await fetch(`${WEBUI_API_BASE_URL}/utils/markdown`, { 88 | method: 'POST', 89 | headers: { 90 | 'Content-Type': 'application/json' 91 | }, 92 | body: JSON.stringify({ 93 | md: md 94 | }) 95 | }) 96 | .then(async (res) => { 97 | if (!res.ok) throw await res.json(); 98 | return res.json(); 99 | }) 100 | .catch((err) => { 101 | console.log(err); 102 | error = err; 103 | return null; 104 | }); 105 | 106 | return res.html; 107 | }; 108 | 109 | export const downloadDatabase = async (token: string) => { 110 | let error = null; 111 | 112 | const res = await fetch(`${WEBUI_API_BASE_URL}/utils/db/download`, { 113 | method: 'GET', 114 | headers: { 115 | 'Content-Type': 'application/json', 116 | Authorization: `Bearer ${token}` 117 | } 118 | }) 119 | .then(async (response) => { 120 | if (!response.ok) { 121 | throw await response.json(); 122 | } 123 | return response.blob(); 124 | }) 125 | .then((blob) => { 126 | const url = window.URL.createObjectURL(blob); 127 | const a = document.createElement('a'); 128 | a.href = url; 129 | a.download = 'webui.db'; 130 | document.body.appendChild(a); 131 | a.click(); 132 | window.URL.revokeObjectURL(url); 133 | }) 134 | .catch((err) => { 135 | console.log(err); 136 | error = err.detail; 137 | return null; 138 | }); 139 | 140 | if (error) { 141 | throw error; 142 | } 143 | }; 144 | 145 | export const downloadLiteLLMConfig = async (token: string) => { 146 | let error = null; 147 | 148 | const res = await fetch(`${WEBUI_API_BASE_URL}/utils/litellm/config`, { 149 | method: 'GET', 150 | headers: { 151 | 'Content-Type': 'application/json', 152 | Authorization: `Bearer ${token}` 153 | } 154 | }) 155 | .then(async (response) => { 156 | if (!response.ok) { 157 | throw await response.json(); 158 | } 159 | return response.blob(); 160 | }) 161 | .then((blob) => { 162 | const url = window.URL.createObjectURL(blob); 163 | const a = document.createElement('a'); 164 | a.href = url; 165 | a.download = 'config.yaml'; 166 | document.body.appendChild(a); 167 | a.click(); 168 | window.URL.revokeObjectURL(url); 169 | }) 170 | .catch((err) => { 171 | console.log(err); 172 | error = err.detail; 173 | return null; 174 | }); 175 | 176 | if (error) { 177 | throw error; 178 | } 179 | }; ``````` `\\?\D:\Coding\ai\src\lib\components\AddFilesPlaceholder.svelte`: ```````svelte 1 | 5 | 6 |
📄
7 |
{$i18n.t('Add Files')}
8 | 9 |
11 | {$i18n.t('Drop any files here to add to the conversation')} 12 |
13 |
``````` `\\?\D:\Coding\ai\src\lib\components\admin\AddUserModal.svelte`: ```````svelte 1 | 118 | 119 | 120 |
121 |
122 |
{$i18n.t('Add User')}
123 | 140 |
141 | 142 |
143 |
144 |
{ 147 | submitHandler(); 148 | }} 149 | > 150 |
151 | 158 | 159 | 166 |
167 |
168 | {#if tab === ''} 169 |
170 |
{$i18n.t('Role')}
171 | 172 |
173 | 183 |
184 |
185 | 186 |
187 |
{$i18n.t('Name')}
188 | 189 |
190 | 198 |
199 |
200 | 201 |
202 | 203 |
204 |
{$i18n.t('Email')}
205 | 206 |
207 | 215 |
216 |
217 | 218 |
219 |
{$i18n.t('Password')}
220 | 221 |
222 | 229 |
230 |
231 | {:else if tab === 'import'} 232 |
233 |
234 | 241 | 242 | 255 |
256 | 257 |
258 | ⓘ {$i18n.t( 259 | 'Ensure your CSV file includes 4 columns in this order: Name, Email, Password, Role.' 260 | )} 261 | 265 | {$i18n.t('Click here to download user import template file.')} 266 | 267 |
268 |
269 | {/if} 270 |
271 | 272 |
273 | 310 |
311 |
312 |
313 |
314 |
315 |
316 | 317 | ``````` `\\?\D:\Coding\ai\src\lib\components\admin\EditUserModal.svelte`: ```````svelte 1 | 42 | 43 | 44 |
45 |
46 |
{$i18n.t('Edit User')}
47 | 64 |
65 |
66 | 67 |
68 |
69 |
{ 72 | submitHandler(); 73 | }} 74 | > 75 |
76 |
77 | User profile 82 |
83 | 84 |
85 |
{selectedUser.name}
86 | 87 |
88 | {$i18n.t('Created at')} 89 | {dayjs(selectedUser.created_at * 1000).format($i18n.t('MMMM DD, YYYY'))} 90 |
91 |
92 |
93 | 94 |
95 | 96 |
97 |
98 |
{$i18n.t('Email')}
99 | 100 |
101 | 109 |
110 |
111 | 112 |
113 |
{$i18n.t('Name')}
114 | 115 |
116 | 123 |
124 |
125 | 126 |
127 |
{$i18n.t('New Password')}
128 | 129 |
130 | 136 |
137 |
138 |
139 | 140 |
141 | 147 |
148 |
149 |
150 |
151 |
152 |
153 | 154 | ``````` `\\?\D:\Coding\ai\src\lib\components\admin\Settings\Audio.svelte`: ```````svelte 1 | 109 | 110 |
{ 113 | await updateConfigHandler(); 114 | dispatch('save'); 115 | }} 116 | > 117 |
118 |
119 |
120 |
{$i18n.t('STT Settings')}
121 | 122 |
123 |
{$i18n.t('Speech-to-Text Engine')}
124 |
125 | 134 |
135 |
136 | 137 | {#if STT_ENGINE === 'openai'} 138 |
139 |
140 | 146 | 147 | 148 |
149 |
150 | 151 |
152 | 153 |
154 |
{$i18n.t('STT Model')}
155 |
156 |
157 | 163 | 164 | 165 | 167 |
168 |
169 |
170 | {/if} 171 |
172 | 173 |
174 | 175 |
176 |
{$i18n.t('TTS Settings')}
177 | 178 |
179 |
{$i18n.t('Text-to-Speech Engine')}
180 |
181 | 199 |
200 |
201 | 202 | {#if TTS_ENGINE === 'openai'} 203 |
204 |
205 | 211 | 212 | 213 |
214 |
215 | {/if} 216 | 217 |
218 | 219 | {#if TTS_ENGINE === ''} 220 |
221 |
{$i18n.t('TTS Voice')}
222 |
223 |
224 | 237 |
238 |
239 |
240 | {:else if TTS_ENGINE === 'openai'} 241 |
242 |
243 |
{$i18n.t('TTS Voice')}
244 |
245 |
246 | 252 | 253 | 254 | {#each voices as voice} 255 | 258 |
259 |
260 |
261 |
262 |
{$i18n.t('TTS Model')}
263 |
264 |
265 | 271 | 272 | 273 | {#each models as model} 274 | 277 |
278 |
279 |
280 |
281 | {/if} 282 |
283 |
284 |
285 |
286 | 292 |
293 |
``````` `\\?\D:\Coding\ai\src\lib\components\admin\Settings\Connections.svelte`: ```````svelte 1 | 168 | 169 |
{ 172 | updateOpenAIHandler(); 173 | updateOllamaUrlsHandler(); 174 | 175 | dispatch('save'); 176 | }} 177 | > 178 |
179 | {#if ENABLE_OPENAI_API !== null && ENABLE_OLLAMA_API !== null} 180 |
181 |
182 |
183 |
{$i18n.t('OpenAI API')}
184 | 185 |
186 | { 189 | updateOpenAIConfig(localStorage.token, ENABLE_OPENAI_API); 190 | }} 191 | /> 192 |
193 |
194 | 195 | {#if ENABLE_OPENAI_API} 196 |
197 | {#each OPENAI_API_BASE_URLS as url, idx} 198 |
199 |
200 | 208 | 209 | {#if pipelineUrls[url]} 210 |
211 | 212 | 218 | 221 | 224 | 227 | 228 | 229 |
230 | {/if} 231 |
232 | 233 | 237 |
238 | {#if idx === 0} 239 | 258 | {:else} 259 | 278 | {/if} 279 |
280 | 281 |
282 | 283 | 303 | 304 |
305 |
306 |
307 | {$i18n.t('WebUI will make requests to')} 308 | '{url}/models' 309 |
310 | {/each} 311 |
312 | {/if} 313 |
314 |
315 | 316 |
317 | 318 |
319 |
320 |
{$i18n.t('Ollama API')}
321 | 322 |
323 | { 326 | updateOllamaConfig(localStorage.token, ENABLE_OLLAMA_API); 327 | 328 | if (OLLAMA_BASE_URLS.length === 0) { 329 | OLLAMA_BASE_URLS = ['']; 330 | } 331 | }} 332 | /> 333 |
334 |
335 | {#if ENABLE_OLLAMA_API} 336 |
337 |
338 | {#each OLLAMA_BASE_URLS as url, idx} 339 |
340 | 345 | 346 |
347 | {#if idx === 0} 348 | 366 | {:else} 367 | 385 | {/if} 386 |
387 | 388 |
389 | 390 | 410 | 411 |
412 |
413 | {/each} 414 |
415 |
416 | 417 |
418 | {$i18n.t('Trouble accessing Ollama?')} 419 | 424 | {$i18n.t('Click here for help.')} 425 | 426 |
427 | {/if} 428 |
429 | {:else} 430 |
431 |
432 | 433 |
434 |
435 | {/if} 436 |
437 | 438 |
439 | 445 |
446 |
``````` `\\?\D:\Coding\ai\src\lib\components\admin\Settings\Database.svelte`: ```````svelte 1 | 26 | 27 |
{ 30 | saveHandler(); 31 | }} 32 | > 33 |
34 |
35 |
{$i18n.t('Database')}
36 | 37 | {#if $config?.features.enable_admin_export ?? true} 38 |
39 | 40 | 41 | 69 |
70 | 71 | 96 | {/if} 97 | 98 |
99 | 100 |
101 | 102 | 103 | 133 |
134 |
135 |
136 | 137 | 146 |
``````` `\\?\D:\Coding\ai\src\lib\components\admin\Settings\Documents.svelte`: ```````svelte 1 | 236 | 237 | { 240 | const res = await deleteAllFiles(localStorage.token).catch((error) => { 241 | toast.error(error); 242 | return null; 243 | }); 244 | 245 | if (res) { 246 | toast.success($i18n.t('Success')); 247 | } 248 | }} 249 | /> 250 | 251 | { 254 | const res = resetVectorDB(localStorage.token).catch((error) => { 255 | toast.error(error); 256 | return null; 257 | }); 258 | 259 | if (res) { 260 | toast.success($i18n.t('Success')); 261 | } 262 | }} 263 | /> 264 | 265 |
{ 268 | submitHandler(); 269 | saveHandler(); 270 | }} 271 | > 272 |
273 |
274 |
{$i18n.t('General Settings')}
275 | 276 |
277 |
278 | {$i18n.t('Scan for documents from {{path}}', { path: 'DOCS_DIR (/data/docs)' })} 279 |
280 | 281 | 326 |
327 | 328 |
329 |
{$i18n.t('Embedding Model Engine')}
330 |
331 | 349 |
350 |
351 | 352 | {#if embeddingEngine === 'openai'} 353 |
354 | 360 | 361 | 362 |
363 |
364 |
{$i18n.t('Embedding Batch Size')}
365 |
366 | 375 |
376 |
377 | 385 |
386 |
387 | {/if} 388 | 389 |
390 |
{$i18n.t('Hybrid Search')}
391 | 392 | 405 |
406 |
407 | 408 |
409 | 410 |
411 |
412 |
{$i18n.t('Embedding Model')}
413 | 414 | {#if embeddingEngine === 'ollama'} 415 |
416 |
417 | 430 |
431 |
432 | {:else} 433 |
434 |
435 | 442 |
443 | 444 | {#if embeddingEngine === ''} 445 | 498 | {/if} 499 |
500 | {/if} 501 | 502 |
503 | {$i18n.t( 504 | 'Warning: If you update or change your embedding model, you will need to re-import all documents.' 505 | )} 506 |
507 | 508 | {#if querySettings.hybrid === true} 509 |
510 |
{$i18n.t('Reranking Model')}
511 | 512 |
513 |
514 | 521 |
522 | 575 |
576 |
577 | {/if} 578 |
579 | 580 |
581 | 582 |
583 |
{$i18n.t('Content Extraction')}
584 | 585 |
586 |
{$i18n.t('Engine')}
587 |
588 | 598 |
599 |
600 | 601 | {#if showTikaServerUrl} 602 |
603 |
604 | 609 |
610 |
611 | {/if} 612 |
613 |
614 | 615 |
616 |
{$i18n.t('Query Params')}
617 | 618 |
619 |
620 |
{$i18n.t('Top K')}
621 | 622 |
623 | 631 |
632 |
633 | 634 | {#if querySettings.hybrid === true} 635 |
636 |
637 | {$i18n.t('Minimum Score')} 638 |
639 | 640 |
641 | 651 |
652 |
653 | {/if} 654 |
655 | 656 | {#if querySettings.hybrid === true} 657 |
658 | {$i18n.t( 659 | 'Note: If you set a minimum score, the search will only return documents with a score greater than or equal to the minimum score.' 660 | )} 661 |
662 | 663 |
664 | {/if} 665 | 666 |
667 |
{$i18n.t('RAG Template')}
668 |