From 5c93561b3a9e81a67a68e2f914e6bc9cbc5ef865 Mon Sep 17 00:00:00 2001 From: druzbuzz Date: Fri, 30 Jan 2026 18:09:30 +0000 Subject: [PATCH] Initial commit: Add QognyX front-end development code (optimized) --- .gitignore | 11 + CHANGELOG.md | 236 + Dockerfile | 60 + Dockerfile.multi | 87 + INSTALLATION.md | 151 + LICENSE | 21 + README.md | 217 + RESUME.txt | 98 + api/app/clients/BaseClient.js | 1435 + api/app/clients/OllamaClient.js | 167 + api/app/clients/TextStream.js | 60 + api/app/clients/index.js | 7 + api/app/clients/prompts/artifacts.js | 537 + .../clients/prompts/createContextHandlers.js | 160 + api/app/clients/prompts/createVisionPrompt.js | 34 + .../prompts/formatAgentMessages.spec.js | 361 + api/app/clients/prompts/formatGoogleInputs.js | 42 + .../prompts/formatGoogleInputs.spec.js | 274 + api/app/clients/prompts/formatMessages.js | 245 + .../clients/prompts/formatMessages.spec.js | 276 + api/app/clients/prompts/index.js | 13 + .../clients/prompts/shadcn-docs/components.js | 495 + .../clients/prompts/shadcn-docs/generate.js | 50 + api/app/clients/prompts/summaryPrompts.js | 53 + api/app/clients/prompts/truncate.js | 115 + api/app/clients/specs/BaseClient.test.js | 931 + api/app/clients/specs/FakeClient.js | 126 + api/app/clients/tools/index.js | 30 + api/app/clients/tools/manifest.js | 20 + api/app/clients/tools/manifest.json | 183 + .../clients/tools/structured/AzureAISearch.js | 104 + api/app/clients/tools/structured/DALLE3.js | 230 + api/app/clients/tools/structured/FluxAPI.js | 554 + .../tools/structured/GeminiImageGen.js | 595 + .../clients/tools/structured/GoogleSearch.js | 72 + .../tools/structured/OpenAIImageTools.js | 413 + .../clients/tools/structured/OpenWeather.js | 317 + .../tools/structured/StableDiffusion.js | 196 + .../clients/tools/structured/TavilySearch.js | 77 + .../tools/structured/TavilySearchResults.js | 131 + .../tools/structured/TraversaalSearch.js | 88 + api/app/clients/tools/structured/Wolfram.js | 95 + .../clients/tools/structured/credentials.js | 13 + .../structured/specs/DALLE3-proxy.spec.js | 60 + .../tools/structured/specs/DALLE3.spec.js | 216 + .../specs/GeminiImageGen-proxy.spec.js | 125 + .../structured/specs/GoogleSearch.spec.js | 50 + .../specs/TavilySearchResults.spec.js | 84 + .../specs/openWeather.integration.test.js | 224 + .../structured/specs/openweather.test.js | 358 + api/app/clients/tools/util/fileSearch.js | 196 + api/app/clients/tools/util/handleTools.js | 504 + .../clients/tools/util/handleTools.test.js | 286 + api/app/clients/tools/util/index.js | 6 + api/app/index.js | 5 + api/cache/banViolation.js | 86 + api/cache/banViolation.spec.js | 136 + api/cache/clearPendingReq.js | 49 + api/cache/getLogStores.js | 227 + api/cache/index.js | 4 + api/cache/logViolation.js | 40 + api/config/index.js | 38 + api/config/meiliLogger.js | 102 + api/config/parsers.js | 232 + api/config/paths.js | 14 + api/config/winston.js | 159 + api/db/connect.js | 79 + api/db/index.js | 8 + api/db/indexSync.js | 363 + api/db/indexSync.spec.js | 465 + api/db/models.js | 5 + api/db/utils.js | 90 + api/db/utils.spec.js | 521 + api/jest.config.js | 15 + api/jsconfig.json | 13 + api/models/Action.js | 77 + api/models/Agent.js | 925 + api/models/Agent.spec.js | 3829 ++ api/models/Assistant.js | 62 + api/models/Banner.js | 28 + api/models/Categories.js | 57 + api/models/Conversation.js | 367 + api/models/Conversation.spec.js | 833 + api/models/ConversationTag.js | 284 + api/models/File.js | 179 + api/models/File.spec.js | 629 + api/models/Message.js | 372 + api/models/Message.spec.js | 898 + api/models/Preset.js | 82 + api/models/Project.js | 133 + api/models/Prompt.js | 708 + api/models/Prompt.spec.js | 564 + api/models/PromptGroupMigration.spec.js | 280 + api/models/Role.js | 256 + api/models/Role.spec.js | 405 + api/models/ToolCall.js | 96 + api/models/Transaction.js | 346 + api/models/Transaction.spec.js | 566 + api/models/balanceMethods.js | 156 + api/models/convoStructure.spec.js | 275 + api/models/index.js | 48 + api/models/interface.js | 24 + api/models/inviteUser.js | 68 + api/models/loadAddedAgent.js | 218 + api/models/spendTokens.js | 127 + api/models/spendTokens.spec.js | 737 + api/models/tx.js | 381 + api/models/tx.spec.js | 1808 + api/models/userMethods.js | 31 + api/package.json | 122 + api/server/cleanup.js | 426 + api/server/controllers/AuthController.js | 240 + api/server/controllers/Balance.js | 24 + api/server/controllers/EndpointController.js | 8 + api/server/controllers/FavoritesController.js | 99 + api/server/controllers/ModelController.js | 50 + .../controllers/PermissionsController.js | 534 + api/server/controllers/PluginController.js | 129 + .../controllers/PluginController.spec.js | 493 + api/server/controllers/TwoFactorController.js | 163 + api/server/controllers/UserController.js | 417 + .../agents/__tests__/callbacks.spec.js | 332 + .../agents/__tests__/jobReplacement.spec.js | 281 + .../controllers/agents/__tests__/v1.spec.js | 195 + api/server/controllers/agents/callbacks.js | 494 + api/server/controllers/agents/client.js | 1408 + api/server/controllers/agents/client.test.js | 2073 + api/server/controllers/agents/errors.js | 141 + .../agents/recordCollectedUsage.spec.js | 712 + api/server/controllers/agents/request.js | 743 + api/server/controllers/agents/v1.js | 764 + api/server/controllers/agents/v1.spec.js | 1567 + api/server/controllers/assistants/chatV1.js | 655 + api/server/controllers/assistants/chatV2.js | 489 + api/server/controllers/assistants/errors.js | 193 + api/server/controllers/assistants/helpers.js | 278 + api/server/controllers/assistants/v1.js | 384 + api/server/controllers/assistants/v2.js | 297 + .../controllers/auth/LoginController.js | 30 + .../controllers/auth/LogoutController.js | 65 + .../auth/TwoFactorAuthController.js | 61 + api/server/controllers/mcp.js | 311 + api/server/controllers/tools.js | 252 + api/server/experimental.js | 436 + api/server/index.js | 464 + api/server/index.js.backup | 256 + api/server/index.spec.js | 146 + api/server/middleware/abortMiddleware.js | 295 + api/server/middleware/abortMiddleware.spec.js | 428 + api/server/middleware/abortRun.js | 105 + .../accessResources/canAccessAgentFromBody.js | 104 + .../accessResources/canAccessAgentResource.js | 59 + .../canAccessAgentResource.spec.js | 385 + .../canAccessMCPServerResource.js | 61 + .../canAccessMCPServerResource.spec.js | 627 + .../canAccessPromptGroupResource.js | 61 + .../canAccessPromptViaGroup.js | 55 + .../accessResources/canAccessResource.js | 158 + .../middleware/accessResources/fileAccess.js | 123 + .../accessResources/fileAccess.spec.js | 483 + .../middleware/accessResources/index.js | 15 + api/server/middleware/assistants/validate.js | 45 + .../middleware/assistants/validateAuthor.js | 44 + api/server/middleware/buildEndpointOption.js | 99 + api/server/middleware/canDeleteAccount.js | 28 + api/server/middleware/checkBan.js | 141 + api/server/middleware/checkDomainAllowed.js | 36 + api/server/middleware/checkInviteUser.js | 27 + .../middleware/checkPeoplePickerAccess.js | 82 + .../checkPeoplePickerAccess.spec.js | 251 + .../middleware/checkSharePublicAccess.js | 84 + .../middleware/checkSharePublicAccess.spec.js | 164 + api/server/middleware/config/app.js | 27 + api/server/middleware/denyRequest.js | 63 + api/server/middleware/error.js | 107 + api/server/middleware/index.js | 49 + .../middleware/limiters/forkLimiters.js | 79 + .../middleware/limiters/importLimiters.js | 80 + api/server/middleware/limiters/index.js | 26 + .../middleware/limiters/loginLimiter.js | 35 + .../middleware/limiters/messageLimiters.js | 79 + .../middleware/limiters/registerLimiter.js | 35 + .../limiters/resetPasswordLimiter.js | 39 + api/server/middleware/limiters/sttLimiters.js | 76 + .../middleware/limiters/toolCallLimiter.js | 33 + api/server/middleware/limiters/ttsLimiters.js | 76 + .../middleware/limiters/uploadLimiters.js | 84 + .../middleware/limiters/verifyEmailLimiter.js | 39 + api/server/middleware/logHeaders.js | 32 + api/server/middleware/moderateText.js | 43 + api/server/middleware/noIndex.js | 11 + api/server/middleware/optionalJwtAuth.js | 25 + api/server/middleware/requireJwtAuth.js | 23 + api/server/middleware/requireLdapAuth.js | 22 + api/server/middleware/requireLocalAuth.js | 23 + api/server/middleware/roles/access.spec.js | 370 + api/server/middleware/roles/admin.js | 14 + api/server/middleware/roles/index.js | 5 + api/server/middleware/setHeaders.js | 12 + .../middleware/spec/validateImages.spec.js | 474 + api/server/middleware/uaParser.js | 32 + api/server/middleware/validate/convoAccess.js | 82 + api/server/middleware/validate/index.js | 4 + api/server/middleware/validateImageRequest.js | 162 + api/server/middleware/validateMessageReq.js | 28 + api/server/middleware/validateModel.js | 47 + .../middleware/validatePasswordReset.js | 13 + api/server/middleware/validateRegistration.js | 17 + api/server/routes/__tests__/config.spec.js | 105 + api/server/routes/__tests__/convos.spec.js | 635 + api/server/routes/__tests__/ldap.spec.js | 58 + api/server/routes/__tests__/mcp.spec.js | 1739 + api/server/routes/__tests__/static.spec.js | 162 + api/server/routes/accessPermissions.js | 116 + api/server/routes/accessPermissions.test.js | 228 + api/server/routes/actions.js | 85 + .../routes/agents/__tests__/abort.spec.js | 301 + api/server/routes/agents/actions.js | 264 + api/server/routes/agents/chat.js | 58 + api/server/routes/agents/index.js | 266 + api/server/routes/agents/tools.js | 39 + api/server/routes/agents/v1.js | 185 + api/server/routes/assistants/actions.js | 210 + api/server/routes/assistants/chatV1.js | 34 + api/server/routes/assistants/chatV2.js | 34 + api/server/routes/assistants/documents.js | 13 + api/server/routes/assistants/index.js | 19 + api/server/routes/assistants/tools.js | 8 + api/server/routes/assistants/v1.js | 81 + api/server/routes/assistants/v2.js | 83 + api/server/routes/auth.js | 75 + api/server/routes/balance.js | 8 + api/server/routes/banner.js | 15 + api/server/routes/categories.js | 15 + api/server/routes/config.js | 158 + api/server/routes/convos.js | 299 + api/server/routes/endpoints.js | 7 + api/server/routes/files/avatar.js | 49 + api/server/routes/files/files.agents.test.js | 721 + api/server/routes/files/files.js | 465 + api/server/routes/files/files.test.js | 426 + api/server/routes/files/images.js | 64 + api/server/routes/files/index.js | 60 + api/server/routes/files/multer.js | 88 + api/server/routes/files/multer.spec.js | 549 + .../routes/files/speech/customConfigSpeech.js | 10 + api/server/routes/files/speech/index.js | 17 + api/server/routes/files/speech/stt.js | 8 + api/server/routes/files/speech/tts.js | 42 + api/server/routes/index.js | 55 + api/server/routes/keys.js | 36 + api/server/routes/mcp.js | 683 + api/server/routes/memories.js | 298 + api/server/routes/messages.js | 416 + api/server/routes/models.js | 8 + api/server/routes/oauth.js | 228 + api/server/routes/presets.js | 48 + api/server/routes/prompts.js | 503 + api/server/routes/prompts.test.js | 1010 + api/server/routes/roles.js | 163 + api/server/routes/search.js | 28 + api/server/routes/settings.js | 13 + api/server/routes/share.js | 144 + api/server/routes/static.js | 11 + api/server/routes/tags.js | 124 + api/server/routes/types/assistants.js | 53 + api/server/routes/user.js | 31 + api/server/services/ActionService.js | 460 + api/server/services/ActionService.spec.js | 175 + api/server/services/Artifacts/update.js | 134 + api/server/services/Artifacts/update.spec.js | 761 + api/server/services/AssistantService.js | 460 + api/server/services/AuthService.js | 568 + api/server/services/Config/EndpointService.js | 47 + .../Config/__tests__/getCachedTools.spec.js | 10 + api/server/services/Config/app.js | 84 + api/server/services/Config/getCachedTools.js | 108 + .../services/Config/getEndpointsConfig.js | 133 + api/server/services/Config/index.js | 21 + api/server/services/Config/ldap.js | 24 + .../services/Config/loadAsyncEndpoints.js | 34 + .../services/Config/loadConfigModels.js | 112 + .../services/Config/loadConfigModels.spec.js | 403 + .../services/Config/loadCustomConfig.js | 181 + .../services/Config/loadCustomConfig.spec.js | 344 + .../services/Config/loadDefaultEConfig.js | 37 + .../services/Config/loadDefaultModels.js | 71 + api/server/services/Config/mcp.js | 100 + .../services/Endpoints/agents/addedConvo.js | 136 + api/server/services/Endpoints/agents/build.js | 33 + api/server/services/Endpoints/agents/index.js | 7 + .../services/Endpoints/agents/initialize.js | 325 + api/server/services/Endpoints/agents/title.js | 81 + .../services/Endpoints/assistants/build.js | 40 + .../services/Endpoints/assistants/index.js | 9 + .../Endpoints/assistants/initalize.js | 74 + .../services/Endpoints/assistants/title.js | 89 + .../Endpoints/azureAssistants/build.js | 38 + .../Endpoints/azureAssistants/index.js | 7 + .../Endpoints/azureAssistants/initialize.js | 193 + api/server/services/Endpoints/index.js | 76 + api/server/services/Files/Audio/STTService.js | 379 + api/server/services/Files/Audio/TTSService.js | 494 + .../Files/Audio/getCustomConfigSpeech.js | 76 + api/server/services/Files/Audio/getVoices.js | 54 + api/server/services/Files/Audio/index.js | 11 + .../services/Files/Audio/streamAudio.js | 212 + .../services/Files/Audio/streamAudio.spec.js | 201 + api/server/services/Files/Azure/crud.js | 253 + api/server/services/Files/Azure/images.js | 144 + api/server/services/Files/Azure/index.js | 7 + api/server/services/Files/Citations/index.js | 158 + api/server/services/Files/Code/crud.js | 100 + api/server/services/Files/Code/index.js | 5 + api/server/services/Files/Code/process.js | 282 + api/server/services/Files/Firebase/crud.js | 282 + api/server/services/Files/Firebase/images.js | 121 + api/server/services/Files/Firebase/index.js | 7 + api/server/services/Files/Local/crud.js | 377 + api/server/services/Files/Local/images.js | 159 + api/server/services/Files/Local/index.js | 7 + api/server/services/Files/OpenAI/crud.js | 80 + api/server/services/Files/OpenAI/index.js | 5 + api/server/services/Files/S3/crud.js | 483 + api/server/services/Files/S3/images.js | 129 + api/server/services/Files/S3/index.js | 7 + api/server/services/Files/VectorDB/crud.js | 125 + api/server/services/Files/VectorDB/index.js | 5 + api/server/services/Files/images/avatar.js | 86 + api/server/services/Files/images/convert.js | 71 + api/server/services/Files/images/encode.js | 255 + api/server/services/Files/images/index.js | 11 + api/server/services/Files/images/resize.js | 116 + api/server/services/Files/index.js | 12 + api/server/services/Files/permissions.js | 131 + api/server/services/Files/process.js | 1029 + api/server/services/Files/strategies.js | 284 + api/server/services/GraphApiService.js | 542 + api/server/services/GraphApiService.spec.js | 803 + api/server/services/GraphTokenService.js | 86 + api/server/services/MCP.js | 702 + api/server/services/MCP.spec.js | 1199 + api/server/services/PermissionService.js | 845 + api/server/services/PermissionService.spec.js | 1935 + api/server/services/PluginService.js | 139 + api/server/services/Runs/RunManager.js | 163 + api/server/services/Runs/StreamRunManager.js | 699 + api/server/services/Runs/handle.js | 264 + api/server/services/Runs/index.js | 11 + api/server/services/Runs/methods.js | 63 + api/server/services/Threads/index.js | 5 + api/server/services/Threads/manage.js | 695 + .../services/Threads/processMessages.spec.js | 983 + api/server/services/ToolService.js | 664 + api/server/services/Tools/credentials.js | 56 + api/server/services/Tools/mcp.js | 147 + api/server/services/Tools/search.js | 138 + api/server/services/cleanup.js | 14 + api/server/services/createRunBody.js | 78 + api/server/services/initializeMCPs.js | 40 + api/server/services/initializeMCPs.spec.js | 281 + .../initializeOAuthReconnectManager.js | 26 + api/server/services/start/migration.js | 48 + api/server/services/start/tools.js | 132 + api/server/services/twoFactorService.js | 223 + api/server/socialLogins.js | 111 + .../utils/__tests__/staticCache.spec.js | 407 + api/server/utils/emails/inviteUser.handlebars | 287 + .../utils/emails/passwordReset.handlebars | 250 + .../emails/requestPasswordReset.handlebars | 344 + .../utils/emails/verifyEmail.handlebars | 347 + api/server/utils/files.js | 67 + api/server/utils/getFileStrategy.js | 56 + api/server/utils/handleText.js | 172 + .../import/__data__/chatbotui-export.json | 98 + .../import/__data__/chatgpt-citations.json | 345 + .../utils/import/__data__/chatgpt-export.json | 1224 + .../utils/import/__data__/chatgpt-tree.json | 429 + .../import/__data__/librechat-export.json | 137 + .../import/__data__/librechat-linear.json | 40 + .../librechat-opts-nonr-branches.json | 99 + .../utils/import/__data__/librechat-tree.json | 151 + api/server/utils/import/fork.js | 415 + api/server/utils/import/fork.spec.js | 1005 + api/server/utils/import/importBatchBuilder.js | 168 + .../utils/import/importConversations.js | 39 + .../utils/import/importers-timestamp.spec.js | 407 + api/server/utils/import/importers.js | 580 + api/server/utils/import/importers.spec.js | 1613 + api/server/utils/import/index.js | 7 + api/server/utils/index.js | 13 + api/server/utils/queue.js | 58 + api/server/utils/removePorts.js | 1 + api/server/utils/sendEmail.js | 170 + api/server/utils/staticCache.js | 62 + api/strategies/appleStrategy.js | 49 + api/strategies/appleStrategy.test.js | 395 + api/strategies/discordStrategy.js | 36 + api/strategies/facebookStrategy.js | 26 + api/strategies/githubStrategy.js | 34 + api/strategies/googleStrategy.js | 24 + api/strategies/index.js | 26 + api/strategies/jwtStrategy.js | 33 + api/strategies/ldapStrategy.js | 167 + api/strategies/ldapStrategy.spec.js | 183 + api/strategies/localStrategy.js | 89 + api/strategies/openIdJwtStrategy.js | 120 + api/strategies/openidStrategy.js | 589 + api/strategies/openidStrategy.spec.js | 961 + api/strategies/process.js | 125 + api/strategies/process.test.js | 242 + api/strategies/samlStrategy.js | 299 + api/strategies/samlStrategy.spec.js | 444 + api/strategies/socialLogin.js | 86 + api/strategies/socialLogin.test.js | 277 + api/strategies/validators.js | 80 + api/strategies/validators.spec.js | 516 + api/test/.env.test.example | 17 + api/test/__mocks__/auth.mock.json | 13 + api/test/__mocks__/logger.js | 60 + api/test/__mocks__/openid-client-passport.js | 6 + api/test/__mocks__/openid-client.js | 71 + .../tools/structured/OpenAIImageTools.test.js | 162 + .../app/clients/tools/util/fileSearch.test.js | 232 + api/test/jestSetup.js | 18 + .../server/services/Files/S3/crud.test.js | 72 + .../Files/processFileCitations.test.js | 352 + api/typedefs.js | 1986 + api/utils/LoggingSystem.js | 129 + api/utils/logger.js | 12 + api/utils/tokens.spec.js | 1310 + backend.pid | 1 + build-prod.sh | 19 + bun.lock | 9864 ++++ client/babel.config.cjs | 28 + client/check_updates.sh | 51 + client/index.html | 58 + client/jest.config.cjs | 46 + client/nginx.conf | 94 + client/package.json | 160 + client/postcss.config.cjs | 8 + client/public/assets/Logo.png | Bin 0 -> 51910 bytes client/public/assets/anyscale.png | Bin 0 -> 70768 bytes client/public/assets/apipie.png | Bin 0 -> 34503 bytes .../assets/apple-touch-icon-180x180-v2.png | Bin 0 -> 4948 bytes .../assets/apple-touch-icon-180x180.png | Bin 0 -> 48842 bytes client/public/assets/bingai-jb.png | Bin 0 -> 63822 bytes client/public/assets/bingai.png | Bin 0 -> 60465 bytes client/public/assets/c.svg | 1 + client/public/assets/cohere.png | Bin 0 -> 26469 bytes client/public/assets/cplusplus.svg | 1 + client/public/assets/deepseek.svg | 1 + client/public/assets/favicon-16x16-v2.png | Bin 0 -> 709 bytes client/public/assets/favicon-16x16.png | Bin 0 -> 4956 bytes client/public/assets/favicon-32x32-v2.png | Bin 0 -> 1712 bytes client/public/assets/favicon-32x32.png | Bin 0 -> 2528 bytes client/public/assets/fireworks.png | Bin 0 -> 223682 bytes client/public/assets/fortran.svg | 1 + client/public/assets/gemini_image_gen.svg | 23 + client/public/assets/go.svg | 1 + client/public/assets/google-palm.svg | 67 + client/public/assets/google.svg | 1 + client/public/assets/groq.png | Bin 0 -> 23360 bytes client/public/assets/helicone.svg | 16 + client/public/assets/huggingface.svg | 8 + client/public/assets/icon-192x192.png | Bin 0 -> 48842 bytes client/public/assets/image_gen_oai.png | Bin 0 -> 38419 bytes client/public/assets/logo.svg | 3 + client/public/assets/maskable-icon.png | Bin 0 -> 227368 bytes client/public/assets/mistral.png | Bin 0 -> 4799 bytes client/public/assets/mlx.png | Bin 0 -> 83421 bytes client/public/assets/nodedotjs.svg | 1 + client/public/assets/ollama.png | Bin 0 -> 39717 bytes client/public/assets/openai.svg | 1 + client/public/assets/openrouter.png | Bin 0 -> 15406 bytes client/public/assets/openweather.png | Bin 0 -> 6799 bytes client/public/assets/perplexity.png | Bin 0 -> 14309 bytes client/public/assets/php.svg | 1 + client/public/assets/python.svg | 1 + client/public/assets/qwen.svg | 1 + client/public/assets/r.svg | 1 + client/public/assets/rust.svg | 1 + client/public/assets/shuttleai.png | Bin 0 -> 261079 bytes client/public/assets/silence.mp3 | Bin 0 -> 36494 bytes client/public/assets/thotai.png | Bin 0 -> 227368 bytes client/public/assets/together.png | Bin 0 -> 20985 bytes client/public/assets/tsnode.svg | 1 + client/public/assets/unify.webp | Bin 0 -> 6928 bytes client/public/assets/web-browser.svg | 86 + client/public/fonts/Inter-Bold.woff2 | Bin 0 -> 111040 bytes client/public/fonts/Inter-BoldItalic.woff2 | Bin 0 -> 118392 bytes client/public/fonts/Inter-Italic.woff2 | Bin 0 -> 114576 bytes client/public/fonts/Inter-Regular.woff2 | Bin 0 -> 108488 bytes client/public/fonts/Inter-SemiBold.woff2 | Bin 0 -> 111588 bytes .../public/fonts/Inter-SemiBoldItalic.woff2 | Bin 0 -> 118216 bytes .../fonts/roboto-mono-latin-400-italic.woff2 | Bin 0 -> 14052 bytes .../fonts/roboto-mono-latin-400-normal.woff2 | Bin 0 -> 12764 bytes .../fonts/roboto-mono-latin-700-normal.woff2 | Bin 0 -> 12740 bytes client/public/robots.txt | 3 + client/scripts/post-build.cjs | 14 + client/src/@types/i18next.d.ts | 9 + client/src/App.jsx | 92 + client/src/Providers/ActivePanelContext.tsx | 37 + client/src/Providers/AddedChatContext.tsx | 13 + client/src/Providers/AgentPanelContext.tsx | 159 + client/src/Providers/AgentsContext.tsx | 27 + client/src/Providers/AgentsMapContext.tsx | 6 + client/src/Providers/AnnouncerContext.tsx | 22 + client/src/Providers/ArtifactContext.tsx | 32 + client/src/Providers/ArtifactsContext.tsx | 56 + client/src/Providers/AssistantsContext.tsx | 27 + client/src/Providers/AssistantsMapContext.tsx | 8 + client/src/Providers/BadgeRowContext.tsx | 204 + client/src/Providers/BookmarkContext.tsx | 9 + client/src/Providers/ChatContext.tsx | 6 + client/src/Providers/ChatFormContext.tsx | 6 + client/src/Providers/CodeBlockContext.tsx | 32 + client/src/Providers/CustomFormContext.tsx | 56 + client/src/Providers/DashboardContext.tsx | 7 + client/src/Providers/DragDropContext.tsx | 85 + client/src/Providers/EditorContext.tsx | 76 + client/src/Providers/FileMapContext.tsx | 6 + client/src/Providers/MessageContext.tsx | 16 + client/src/Providers/MessagesViewContext.tsx | 147 + client/src/Providers/PromptGroupsContext.tsx | 85 + client/src/Providers/SearchContext.tsx | 9 + client/src/Providers/SetConvoContext.tsx | 14 + client/src/Providers/ShareContext.tsx | 5 + client/src/Providers/SidePanelContext.tsx | 31 + client/src/Providers/ToolCallsMapContext.tsx | 21 + client/src/Providers/index.ts | 30 + client/src/a11y/Announcer.tsx | 22 + client/src/a11y/LiveAnnouncer.tsx | 80 + client/src/a11y/LiveMessage.tsx | 37 + client/src/a11y/LiveMessenger.tsx | 12 + client/src/a11y/MessageBlock.tsx | 26 + client/src/a11y/index.ts | 1 + client/src/common/a11y.ts | 6 + client/src/common/agents-types.ts | 48 + client/src/common/artifacts.ts | 27 + client/src/common/assistants-types.ts | 31 + client/src/common/index.ts | 8 + client/src/common/menus.ts | 27 + client/src/common/selector.ts | 23 + client/src/common/tools.ts | 6 + client/src/common/types.ts | 637 + client/src/components/Agents/AgentCard.tsx | 122 + client/src/components/Agents/AgentDetail.tsx | 195 + .../components/Agents/AgentDetailContent.tsx | 192 + client/src/components/Agents/AgentGrid.tsx | 234 + client/src/components/Agents/CategoryTabs.tsx | 197 + client/src/components/Agents/ErrorDisplay.tsx | 251 + client/src/components/Agents/Marketplace.tsx | 496 + .../Agents/MarketplaceAdminSettings.tsx | 50 + .../components/Agents/MarketplaceContext.tsx | 17 + client/src/components/Agents/SearchBar.tsx | 110 + client/src/components/Agents/SmartLoader.tsx | 96 + .../Agents/VirtualizedAgentGrid.tsx | 348 + .../Agents/tests/Accessibility.spec.tsx | 561 + .../Agents/tests/AgentCard.spec.tsx | 393 + .../Agents/tests/AgentDetail.spec.tsx | 418 + .../tests/AgentGrid.integration.spec.tsx | 872 + .../Agents/tests/CategoryTabs.spec.tsx | 231 + .../Agents/tests/ErrorDisplay.spec.tsx | 303 + .../Agents/tests/MarketplaceContext.spec.tsx | 150 + .../Agents/tests/SearchBar.spec.tsx | 139 + .../Agents/tests/SmartLoader.spec.tsx | 370 + .../VirtualScrollingPerformance.test.tsx | 275 + .../tests/VirtualizedAgentGrid.test.tsx | 248 + client/src/components/Artifacts/Artifact.tsx | 128 + .../components/Artifacts/ArtifactButton.tsx | 109 + .../Artifacts/ArtifactCodeEditor.tsx | 206 + .../components/Artifacts/ArtifactPreview.tsx | 71 + .../src/components/Artifacts/ArtifactTabs.tsx | 76 + .../components/Artifacts/ArtifactVersion.tsx | 84 + client/src/components/Artifacts/Artifacts.tsx | 340 + client/src/components/Artifacts/Code.tsx | 124 + .../components/Artifacts/DownloadArtifact.tsx | 53 + client/src/components/Artifacts/Mermaid.tsx | 187 + client/src/components/Audio/TTS.tsx | 199 + client/src/components/Audio/Voices.tsx | 71 + .../src/components/Auth/ApiErrorWatcher.tsx | 18 + client/src/components/Auth/AuthLayout.tsx | 98 + .../src/components/Auth/AuthLayout.tsx.backup | 98 + client/src/components/Auth/BlinkAnimation.tsx | 29 + client/src/components/Auth/ErrorMessage.tsx | 9 + client/src/components/Auth/Footer.tsx | 47 + client/src/components/Auth/Login.tsx | 118 + client/src/components/Auth/LoginForm.tsx | 188 + client/src/components/Auth/Registration.tsx | 230 + .../components/Auth/RequestPasswordReset.tsx | 148 + client/src/components/Auth/ResetPassword.tsx | 163 + client/src/components/Auth/SocialButton.tsx | 23 + .../src/components/Auth/SocialLoginRender.tsx | 141 + .../src/components/Auth/TwoFactorScreen.tsx | 176 + client/src/components/Auth/VerifyEmail.tsx | 125 + .../components/Auth/__tests__/Login.spec.tsx | 206 + .../Auth/__tests__/LoginForm.spec.tsx | 144 + .../Auth/__tests__/Registration.spec.tsx | 231 + client/src/components/Auth/index.ts | 7 + client/src/components/Banners/Banner.tsx | 63 + client/src/components/Banners/index.ts | 1 + .../Bookmarks/BookmarkEditDialog.tsx | 121 + .../src/components/Bookmarks/BookmarkForm.tsx | 196 + .../src/components/Bookmarks/BookmarkItem.tsx | 67 + .../components/Bookmarks/BookmarkItems.tsx | 29 + .../Bookmarks/DeleteBookmarkButton.tsx | 87 + .../Bookmarks/EditBookmarkButton.tsx | 46 + .../Bookmarks/__tests__/BookmarkForm.test.tsx | 499 + client/src/components/Bookmarks/index.ts | 6 + client/src/components/Chat/AddMultiConvo.tsx | 50 + client/src/components/Chat/ChatView.tsx | 116 + .../components/Chat/ExportAndShareMenu.tsx | 113 + client/src/components/Chat/Footer.tsx | 118 + client/src/components/Chat/Header.tsx | 96 + .../components/Chat/Input/ActiveSetting.tsx | 8 + .../src/components/Chat/Input/AddedConvo.tsx | 78 + .../src/components/Chat/Input/Artifacts.tsx | 170 + .../Chat/Input/ArtifactsSubMenu.tsx | 154 + .../components/Chat/Input/AudioRecorder.tsx | 128 + client/src/components/Chat/Input/BadgeRow.tsx | 404 + client/src/components/Chat/Input/ChatForm.tsx | 365 + .../components/Chat/Input/CircleRender.tsx | 36 + .../components/Chat/Input/CodeInterpreter.tsx | 38 + .../components/Chat/Input/CollapseChat.tsx | 55 + .../Chat/Input/ConversationStarters.tsx | 79 + .../src/components/Chat/Input/EditBadges.tsx | 87 + .../src/components/Chat/Input/FileSearch.tsx | 37 + .../Chat/Input/Files/AttachFile.tsx | 54 + .../Chat/Input/Files/AttachFileChat.tsx | 101 + .../Chat/Input/Files/AttachFileMenu.tsx | 292 + .../Chat/Input/Files/DragDropModal.tsx | 176 + .../Chat/Input/Files/DragDropOverlay.tsx | 102 + .../Chat/Input/Files/DragDropWrapper.tsx | 33 + .../Chat/Input/Files/FileContainer.tsx | 56 + .../Chat/Input/Files/FileFormChat.tsx | 31 + .../Chat/Input/Files/FilePreview.tsx | 35 + .../components/Chat/Input/Files/FileRow.tsx | 156 + .../Chat/Input/Files/FileUpload.tsx | 100 + .../src/components/Chat/Input/Files/Image.tsx | 28 + .../Chat/Input/Files/ImagePreview.tsx | 205 + .../Chat/Input/Files/MyFilesModal.tsx | 41 + .../Chat/Input/Files/ProgressCircle.tsx | 36 + .../Chat/Input/Files/RemoveFile.tsx | 31 + .../Chat/Input/Files/SourceIcon.tsx | 79 + .../Files/Table/ColumnVisibilityDropdown.tsx | 59 + .../Chat/Input/Files/Table/Columns.tsx | 294 + .../Chat/Input/Files/Table/DataTable.tsx | 239 + .../Input/Files/Table/SortFilterHeader.tsx | 138 + .../Chat/Input/Files/Table/TemplateTable.tsx | 88 + .../Chat/Input/Files/Table/fakeData.ts | 76 + .../Chat/Input/Files/Table/index.ts | 4 + .../Files/__tests__/AttachFileMenu.spec.tsx | 640 + .../Files/__tests__/DragDropModal.spec.tsx | 183 + .../Input/Files/__tests__/FileRow.spec.tsx | 347 + .../components/Chat/Input/HeaderOptions.tsx | 99 + .../components/Chat/Input/MCPConfigDialog.tsx | 115 + .../src/components/Chat/Input/MCPSelect.tsx | 152 + .../src/components/Chat/Input/MCPSubMenu.tsx | 117 + client/src/components/Chat/Input/Mention.tsx | 230 + .../src/components/Chat/Input/MentionItem.tsx | 55 + .../components/Chat/Input/OptionsPopover.tsx | 93 + .../components/Chat/Input/PopoverButtons.tsx | 138 + .../components/Chat/Input/PromptsCommand.tsx | 258 + .../src/components/Chat/Input/SendButton.tsx | 48 + .../src/components/Chat/Input/StopButton.tsx | 37 + .../src/components/Chat/Input/StreamAudio.tsx | 233 + .../components/Chat/Input/TextareaHeader.tsx | 20 + .../src/components/Chat/Input/ToolDialogs.tsx | 66 + .../components/Chat/Input/ToolsDropdown.tsx | 344 + .../src/components/Chat/Input/WebSearch.tsx | 38 + client/src/components/Chat/Landing.tsx | 209 + .../components/Chat/Menus/BookmarkMenu.tsx | 209 + .../Menus/Bookmarks/BookmarkMenuItems.tsx | 44 + .../Chat/Menus/Endpoints/CustomMenu.tsx | 257 + .../Chat/Menus/Endpoints/DialogManager.tsx | 33 + .../Chat/Menus/Endpoints/ModelSelector.tsx | 140 + .../Endpoints/ModelSelectorChatContext.tsx | 49 + .../Menus/Endpoints/ModelSelectorContext.tsx | 238 + .../Endpoints/components/CustomGroup.tsx | 78 + .../Endpoints/components/EndpointItem.tsx | 253 + .../components/EndpointModelItem.tsx | 168 + .../Menus/Endpoints/components/GroupIcon.tsx | 60 + .../Endpoints/components/ModelSpecItem.tsx | 68 + .../Endpoints/components/SearchResults.tsx | 252 + .../Menus/Endpoints/components/SpecIcon.tsx | 50 + .../Chat/Menus/Endpoints/components/index.ts | 5 + .../components/Chat/Menus/Endpoints/utils.ts | 217 + .../components/Chat/Menus/HeaderNewChat.tsx | 40 + .../components/Chat/Menus/Models/fakeData.ts | 46 + .../src/components/Chat/Menus/OpenSidebar.tsx | 58 + .../Chat/Menus/Presets/EditPresetDialog.tsx | 219 + .../Chat/Menus/Presets/PresetItems.tsx | 258 + .../components/Chat/Menus/Presets/index.ts | 2 + .../src/components/Chat/Menus/PresetsMenu.tsx | 140 + .../src/components/Chat/Menus/UI/MenuItem.tsx | 91 + .../Chat/Menus/UI/MenuSeparator.tsx | 11 + .../components/Chat/Menus/UI/TitleButton.tsx | 29 + client/src/components/Chat/Menus/UI/index.ts | 3 + client/src/components/Chat/Menus/index.ts | 3 + .../Chat/Messages/Content/ActionIcon.tsx | 172 + .../Chat/Messages/Content/AgentHandoff.tsx | 93 + .../Chat/Messages/Content/CancelledIcon.tsx | 9 + .../Chat/Messages/Content/CodeAnalyze.tsx | 61 + .../Chat/Messages/Content/Container.tsx | 14 + .../Chat/Messages/Content/ContentParts.tsx | 192 + .../Chat/Messages/Content/DialogImage.tsx | 443 + .../Chat/Messages/Content/EditMessage.tsx | 212 + .../Chat/Messages/Content/Files.tsx | 39 + .../Chat/Messages/Content/FinishedIcon.tsx | 17 + .../Chat/Messages/Content/Image.tsx | 150 + .../Chat/Messages/Content/ImageGen.tsx | 84 + .../Chat/Messages/Content/InProgressCall.tsx | 19 + .../Chat/Messages/Content/Markdown.tsx | 110 + .../Messages/Content/MarkdownComponents.tsx | 201 + .../Content/MarkdownErrorBoundary.tsx | 90 + .../Chat/Messages/Content/MarkdownLite.tsx | 62 + .../Chat/Messages/Content/MemoryArtifacts.tsx | 159 + .../Chat/Messages/Content/MemoryInfo.tsx | 109 + .../Chat/Messages/Content/MessageContent.tsx | 188 + .../Chat/Messages/Content/ParallelContent.tsx | 269 + .../components/Chat/Messages/Content/Part.tsx | 224 + .../Messages/Content/Parts/AgentUpdate.tsx | 47 + .../Messages/Content/Parts/Attachment.tsx | 148 + .../Messages/Content/Parts/EditTextPart.tsx | 213 + .../Chat/Messages/Content/Parts/EmptyText.tsx | 17 + .../Messages/Content/Parts/ExecuteCode.tsx | 225 + .../Messages/Content/Parts/LogContent.tsx | 112 + .../Chat/Messages/Content/Parts/LogLink.tsx | 57 + .../Parts/OpenAIImageGen/OpenAIImageGen.tsx | 203 + .../Parts/OpenAIImageGen/ProgressText.tsx | 79 + .../Content/Parts/OpenAIImageGen/index.ts | 1 + .../Chat/Messages/Content/Parts/Reasoning.tsx | 133 + .../Chat/Messages/Content/Parts/Stdout.tsx | 26 + .../Chat/Messages/Content/Parts/Text.tsx | 50 + .../Chat/Messages/Content/Parts/Thinking.tsx | 325 + .../Chat/Messages/Content/Parts/index.ts | 10 + .../Chat/Messages/Content/ProgressCircle.tsx | 38 + .../Chat/Messages/Content/ProgressText.tsx | 109 + .../Chat/Messages/Content/RetrievalCall.tsx | 53 + .../Chat/Messages/Content/RetrievalIcon.tsx | 80 + .../Chat/Messages/Content/SearchContent.tsx | 84 + .../Chat/Messages/Content/SiblingHeader.tsx | 139 + .../Chat/Messages/Content/ToolCall.tsx | 247 + .../Chat/Messages/Content/ToolCallInfo.tsx | 107 + .../Messages/Content/UIResourceCarousel.tsx | 146 + .../Chat/Messages/Content/WebSearch.tsx | 91 + .../Chat/Messages/Content/WrenchIcon.tsx | 49 + .../Content/__tests__/Markdown.mcpui.test.tsx | 106 + .../__tests__/MemoryArtifacts.test.tsx | 197 + .../Content/__tests__/MemoryInfo.test.tsx | 267 + .../Content/__tests__/ToolCall.test.tsx | 382 + .../Content/__tests__/ToolCallInfo.test.tsx | 329 + .../__tests__/UIResourceCarousel.test.tsx | 266 + .../src/components/Chat/Messages/Feedback.tsx | 341 + client/src/components/Chat/Messages/Fork.tsx | 446 + .../components/Chat/Messages/HoverButtons.tsx | 276 + .../src/components/Chat/Messages/Message.tsx | 56 + .../components/Chat/Messages/MessageAudio.tsx | 23 + .../components/Chat/Messages/MessageIcon.tsx | 80 + .../components/Chat/Messages/MessageParts.tsx | 188 + .../components/Chat/Messages/MessagesView.tsx | 107 + .../Chat/Messages/MinimalHoverButtons.tsx | 38 + .../Chat/Messages/MinimalMessages.tsx | 42 + .../components/Chat/Messages/MultiMessage.tsx | 85 + .../Chat/Messages/SearchButtons.tsx | 69 + .../Chat/Messages/SearchMessage.tsx | 84 + .../Chat/Messages/SiblingSwitch.tsx | 68 + .../src/components/Chat/Messages/SubRow.tsx | 19 + .../Chat/Messages/ui/MessageRender.tsx | 202 + .../Chat/Messages/ui/PlaceholderRow.tsx | 7 + client/src/components/Chat/Presentation.tsx | 93 + client/src/components/Chat/TemporaryChat.tsx | 57 + .../Conversations/Conversations.tsx | 396 + client/src/components/Conversations/Convo.tsx | 251 + .../components/Conversations/ConvoLink.tsx | 62 + .../ConvoOptions/ConvoOptions.tsx | 357 + .../ConvoOptions/DeleteButton.tsx | 141 + .../ConvoOptions/ShareButton.tsx | 128 + .../ConvoOptions/SharedLinkButton.tsx | 238 + .../Conversations/ConvoOptions/index.js | 4 + .../Conversations/ConvoOptions/index.ts | 4 + .../components/Conversations/HoverToggle.tsx | 41 + client/src/components/Conversations/Pages.tsx | 55 + .../components/Conversations/RenameForm.tsx | 80 + .../components/Conversations/ToggleContext.ts | 9 + client/src/components/Conversations/index.ts | 4 + .../Endpoints/AlternativeSettings.tsx | 24 + client/src/components/Endpoints/ConvoIcon.tsx | 83 + .../src/components/Endpoints/ConvoIconURL.tsx | 76 + .../src/components/Endpoints/EndpointIcon.tsx | 69 + .../components/Endpoints/EndpointSettings.tsx | 55 + client/src/components/Endpoints/Icon.tsx | 89 + .../Endpoints/MessageEndpointIcon.tsx | 208 + .../src/components/Endpoints/MinimalIcon.tsx | 88 + .../Endpoints/SaveAsPresetDialog.tsx | 94 + .../Endpoints/Settings/Advanced.tsx | 347 + .../Endpoints/Settings/Anthropic.tsx | 65 + .../Endpoints/Settings/Assistants.tsx | 189 + .../components/Endpoints/Settings/Bedrock.tsx | 65 + .../Endpoints/Settings/Examples.tsx | 98 + .../components/Endpoints/Settings/Google.tsx | 314 + .../Settings/MultiView/GoogleSettings.tsx | 30 + .../Endpoints/Settings/MultiView/index.ts | 1 + .../components/Endpoints/Settings/OpenAI.tsx | 65 + .../Endpoints/Settings/OptionHover.tsx | 58 + .../components/Endpoints/Settings/index.ts | 8 + .../components/Endpoints/Settings/settings.ts | 28 + client/src/components/Endpoints/URLIcon.tsx | 66 + client/src/components/Endpoints/index.ts | 8 + client/src/components/Files/ActionButton.tsx | 22 + .../src/components/Files/DeleteIconButton.tsx | 16 + .../components/Files/FileDashboardView.tsx | 39 + .../Files/FileList/DataTableFile.tsx | 277 + .../Files/FileList/DataTableFilePreview.tsx | 81 + .../Files/FileList/EmptyFilePreview.tsx | 9 + .../components/Files/FileList/FileList.tsx | 26 + .../Files/FileList/FileListItem.tsx | 32 + .../Files/FileList/FileListItem2.tsx | 75 + .../components/Files/FileList/FilePreview.tsx | 179 + .../Files/FileList/FileSidePanel.tsx | 186 + .../Files/FileList/FileTableColumns.tsx | 123 + .../Files/FileList/UploadFileButton.tsx | 18 + .../Files/FileList/UploadFileModal.tsx | 87 + client/src/components/Files/FilesListView.tsx | 47 + .../components/Files/FilesSectionSelector.tsx | 48 + .../VectorStore/EmptyVectorStorePreview.tsx | 9 + .../Files/VectorStore/VectorStoreButton.tsx | 18 + .../Files/VectorStore/VectorStoreFilter.tsx | 7 + .../Files/VectorStore/VectorStoreList.tsx | 22 + .../Files/VectorStore/VectorStoreListItem.tsx | 46 + .../Files/VectorStore/VectorStorePreview.tsx | 243 + .../VectorStore/VectorStoreSidePanel.tsx | 249 + .../src/components/Files/VectorStoreView.tsx | 43 + .../components/Input/Generations/Button.tsx | 27 + .../Input/Generations/Regenerate.tsx | 15 + .../src/components/Input/Generations/Stop.tsx | 15 + .../Generations/__tests__/Button.spec.tsx | 30 + .../Generations/__tests__/Regenerate.spec.tsx | 22 + .../Input/Generations/__tests__/Stop.spec.tsx | 22 + .../Input/ModelSelect/Anthropic.tsx | 27 + .../components/Input/ModelSelect/ChatGPT.tsx | 34 + .../components/Input/ModelSelect/Google.tsx | 27 + .../Input/ModelSelect/ModelSelect.tsx | 50 + .../Input/ModelSelect/MultiSelectDropDown.tsx | 229 + .../Input/ModelSelect/MultiSelectPop.tsx | 154 + .../components/Input/ModelSelect/OpenAI.tsx | 27 + .../Input/ModelSelect/SelectDropDownPop.tsx | 155 + .../src/components/Input/ModelSelect/index.ts | 1 + .../components/Input/ModelSelect/options.ts | 20 + .../Input/SetKeyDialog/CustomEndpoint.tsx | 46 + .../Input/SetKeyDialog/GoogleConfig.tsx | 61 + .../Input/SetKeyDialog/HelpText.tsx | 54 + .../Input/SetKeyDialog/InputWithLabel.tsx | 44 + .../Input/SetKeyDialog/OpenAIConfig.tsx | 107 + .../Input/SetKeyDialog/OtherConfig.tsx | 18 + .../Input/SetKeyDialog/SetKeyDialog.tsx | 327 + .../components/Input/SetKeyDialog/index.ts | 1 + .../components/MCP/CustomUserVarsSection.tsx | 197 + client/src/components/MCP/MCPConfigDialog.tsx | 176 + .../src/components/MCP/MCPServerMenuItem.tsx | 113 + .../components/MCP/MCPServerStatusIcon.tsx | 196 + .../MCP/ServerInitializationSection.tsx | 120 + client/src/components/MCP/StackedMCPIcons.tsx | 101 + client/src/components/MCP/mcpServerUtils.ts | 196 + .../MCPUIResource/MCPUIResource.tsx | 63 + .../MCPUIResource/MCPUIResourceCarousel.tsx | 37 + .../__tests__/MCPUIResource.test.tsx | 276 + .../__tests__/MCPUIResourceCarousel.test.tsx | 263 + .../MCPUIResource/__tests__/plugin.test.ts | 301 + client/src/components/MCPUIResource/index.ts | 4 + client/src/components/MCPUIResource/plugin.ts | 91 + client/src/components/MCPUIResource/types.ts | 12 + .../components/Messages/Content/CodeBlock.tsx | 286 + .../components/Messages/Content/Container.tsx | 6 + .../src/components/Messages/Content/Error.tsx | 150 + .../components/Messages/Content/Mermaid.tsx | 847 + .../Messages/Content/MermaidErrorBoundary.tsx | 59 + .../Messages/Content/MermaidHeader.tsx | 99 + .../Messages/Content/ResultSwitcher.tsx | 69 + .../components/Messages/Content/RunCode.tsx | 134 + .../components/Messages/Content/SubRow.tsx | 18 + .../src/components/Messages/Content/index.ts | 1 + .../src/components/Messages/ContentRender.tsx | 197 + .../components/Messages/MessageContent.tsx | 57 + .../components/Messages/ScrollToBottom.tsx | 30 + client/src/components/Nav/AccountSettings.tsx | 111 + .../components/Nav/AgentMarketplaceButton.tsx | 47 + .../components/Nav/Bookmarks/BookmarkNav.tsx | 132 + .../Nav/ExportConversation/ExportModal.tsx | 200 + .../Nav/ExportConversation/index.ts | 1 + .../components/Nav/Favorites/FavoriteItem.tsx | 168 + .../Nav/Favorites/FavoritesList.tsx | 350 + client/src/components/Nav/MobileNav.tsx | 90 + client/src/components/Nav/Nav.tsx | 306 + client/src/components/Nav/NavLink.tsx | 39 + client/src/components/Nav/NavToggle.tsx | 100 + client/src/components/Nav/NewChat.tsx | 103 + client/src/components/Nav/SearchBar.tsx | 153 + client/src/components/Nav/Settings.tsx | 263 + .../Nav/SettingsTabs/Account/Account.tsx | 39 + .../Nav/SettingsTabs/Account/Avatar.tsx | 368 + .../SettingsTabs/Account/BackupCodesItem.tsx | 202 + .../SettingsTabs/Account/DeleteAccount.tsx | 140 + .../Account/DisableTwoFactorToggle.tsx | 41 + .../Account/DisplayUsernameMessages.tsx | 31 + .../Account/TwoFactorAuthentication.tsx | 306 + .../Account/TwoFactorPhases/BackupPhase.tsx | 60 + .../Account/TwoFactorPhases/DisablePhase.tsx | 88 + .../Account/TwoFactorPhases/QRPhase.tsx | 70 + .../Account/TwoFactorPhases/SetupPhase.tsx | 46 + .../Account/TwoFactorPhases/VerifyPhase.tsx | 64 + .../Account/TwoFactorPhases/index.ts | 5 + .../Balance/AutoRefillSettings.tsx | 178 + .../Nav/SettingsTabs/Balance/Balance.tsx | 62 + .../SettingsTabs/Balance/TokenCreditsItem.tsx | 28 + .../components/Nav/SettingsTabs/Chat/Chat.tsx | 113 + .../Nav/SettingsTabs/Chat/ChatDirection.tsx | 37 + .../SettingsTabs/Chat/FontSizeSelector.tsx | 38 + .../Nav/SettingsTabs/Chat/ForkSettings.tsx | 77 + .../Nav/SettingsTabs/Chat/SaveBadgesState.tsx | 37 + .../Nav/SettingsTabs/Chat/ShowThinking.tsx | 37 + .../Nav/SettingsTabs/Commands/Commands.tsx | 82 + .../Nav/SettingsTabs/DangerButton.tsx | 75 + .../Nav/SettingsTabs/Data/ClearChats.tsx | 64 + .../components/Nav/SettingsTabs/Data/Data.tsx | 35 + .../Nav/SettingsTabs/Data/DeleteCache.tsx | 72 + .../SettingsTabs/Data/ImportConversations.tsx | 144 + .../Nav/SettingsTabs/Data/RevokeKeys.tsx | 72 + .../Nav/SettingsTabs/Data/SharedLinks.tsx | 371 + .../SettingsTabs/General/ArchivedChats.tsx | 28 + .../General/ArchivedChatsTable.tsx | 326 + .../Nav/SettingsTabs/General/General.tsx | 202 + .../General/LangSelector.spec.tsx | 57 + .../General/ThemeSelector.spec.tsx | 59 + .../Nav/SettingsTabs/Personalization.tsx | 90 + .../Speech/ConversationModeSwitch.spec.tsx | 38 + .../Speech/ConversationModeSwitch.tsx | 35 + .../Speech/STT/AutoSendTextSelector.tsx | 114 + .../Speech/STT/AutoTranscribeAudioSwitch.tsx | 21 + .../Speech/STT/DecibelSelector.tsx | 53 + .../Speech/STT/EngineSTTDropdown.tsx | 44 + .../Speech/STT/LanguageSTTDropdown.tsx | 113 + .../Speech/STT/SpeechToTextSwitch.tsx | 18 + .../AutoTranscribeAudioSwitch.spec.tsx | 41 + .../STT/__tests__/SpeechToTextSwitch.spec.tsx | 38 + .../Nav/SettingsTabs/Speech/STT/index.ts | 6 + .../Nav/SettingsTabs/Speech/Speech.tsx | 243 + .../Speech/TTS/AutomaticPlaybackSwitch.tsx | 17 + .../Speech/TTS/CacheTTSSwitch.tsx | 21 + .../Speech/TTS/CloudBrowserVoicesSwitch.tsx | 21 + .../Speech/TTS/EngineTTSDropdown.tsx | 44 + .../SettingsTabs/Speech/TTS/PlaybackRate.tsx | 53 + .../Speech/TTS/TextToSpeechSwitch.tsx | 18 + .../SettingsTabs/Speech/TTS/VoiceDropdown.tsx | 20 + .../AutomaticPlaybackSwitch.spec.tsx | 38 + .../TTS/__tests__/CacheTTSSwitch.spec.tsx | 38 + .../CloudBrowserVoicesSwitch.spec.tsx | 41 + .../TTS/__tests__/TextToSpeechSwitch.spec.tsx | 38 + .../Nav/SettingsTabs/Speech/TTS/index.ts | 7 + .../Nav/SettingsTabs/ToggleSwitch.tsx | 124 + .../src/components/Nav/SettingsTabs/index.ts | 8 + client/src/components/Nav/index.ts | 8 + client/src/components/OAuth/OAuthError.tsx | 72 + client/src/components/OAuth/OAuthSuccess.tsx | 47 + client/src/components/OAuth/index.ts | 2 + .../Plugins/Store/PluginAuthForm.tsx | 110 + .../Plugins/Store/PluginPagination.tsx | 118 + .../Plugins/Store/PluginTooltip.tsx | 20 + .../Store/__tests__/PluginAuthForm.spec.tsx | 47 + .../Store/__tests__/PluginPagination.spec.tsx | 51 + client/src/components/Plugins/Store/index.ts | 3 + .../src/components/Prompts/AdminSettings.tsx | 99 + .../src/components/Prompts/AdvancedSwitch.tsx | 63 + client/src/components/Prompts/BackToChat.tsx | 26 + client/src/components/Prompts/Command.tsx | 83 + .../src/components/Prompts/DeleteVersion.tsx | 101 + client/src/components/Prompts/Description.tsx | 80 + .../components/Prompts/EmptyPromptPreview.tsx | 12 + .../Prompts/Groups/AlwaysMakeProd.tsx | 36 + .../Prompts/Groups/AutoSendPrompt.tsx | 41 + .../Prompts/Groups/CategoryIcon.tsx | 70 + .../Prompts/Groups/CategorySelector.tsx | 124 + .../Prompts/Groups/ChatGroupItem.tsx | 155 + .../Prompts/Groups/CreatePromptForm.tsx | 199 + .../Prompts/Groups/DashGroupItem.tsx | 216 + .../Prompts/Groups/FilterPrompts.tsx | 118 + .../Prompts/Groups/GroupSidePanel.tsx | 82 + client/src/components/Prompts/Groups/List.tsx | 92 + .../components/Prompts/Groups/ListCard.tsx | 59 + .../Prompts/Groups/NoPromptGroup.tsx | 28 + .../Prompts/Groups/PanelNavigation.tsx | 54 + .../Prompts/Groups/VariableDialog.tsx | 42 + .../Prompts/Groups/VariableForm.tsx | 220 + .../src/components/Prompts/ManagePrompts.tsx | 33 + client/src/components/Prompts/Markdown.tsx | 45 + .../src/components/Prompts/PreviewLabels.tsx | 69 + .../src/components/Prompts/PreviewPrompt.tsx | 30 + .../src/components/Prompts/PromptDetails.tsx | 83 + .../src/components/Prompts/PromptEditor.tsx | 153 + client/src/components/Prompts/PromptForm.tsx | 530 + client/src/components/Prompts/PromptName.tsx | 117 + .../components/Prompts/PromptVariables.tsx | 90 + .../src/components/Prompts/PromptVersions.tsx | 192 + .../components/Prompts/PromptsAccordion.tsx | 18 + client/src/components/Prompts/PromptsView.tsx | 114 + client/src/components/Prompts/SharePrompt.tsx | 72 + .../src/components/Prompts/SkeletonForm.tsx | 17 + .../components/Prompts/VariablesDropdown.tsx | 72 + client/src/components/Prompts/index.ts | 10 + client/src/components/Share/Message.tsx | 128 + client/src/components/Share/MessageIcon.tsx | 93 + client/src/components/Share/MessagesView.tsx | 49 + client/src/components/Share/MultiMessage.tsx | 54 + .../src/components/Share/ShareArtifacts.tsx | 176 + .../Share/ShareMessagesProvider.tsx | 43 + client/src/components/Share/ShareView.tsx | 249 + .../SharePoint/SharePointPickerDialog.tsx | 137 + client/src/components/SharePoint/index.ts | 1 + .../components/Sharing/AccessRolesPicker.tsx | 91 + .../Sharing/GenericGrantAccessDialog.tsx | 428 + .../PeoplePicker/PeoplePickerSearchItem.tsx | 83 + .../Sharing/PeoplePicker/SearchPicker.tsx | 198 + .../PeoplePicker/SelectedPrincipalsList.tsx | 101 + .../PeoplePicker/UnifiedPeopleSearch.tsx | 83 + .../components/Sharing/PeoplePicker/index.ts | 3 + .../Sharing/PeoplePickerAdminSettings.tsx | 223 + .../components/Sharing/PrincipalAvatar.tsx | 111 + .../Sharing/PublicSharingToggle.tsx | 134 + client/src/components/Sharing/index.ts | 4 + .../SidePanel/Agents/ActionsInput.tsx | 285 + .../SidePanel/Agents/ActionsPanel.tsx | 162 + .../SidePanel/Agents/ActionsTable/Columns.tsx | 54 + .../SidePanel/Agents/ActionsTable/Table.tsx | 47 + .../SidePanel/Agents/ActionsTable/index.ts | 2 + .../SidePanel/Agents/AdminSettings.tsx | 39 + .../Agents/Advanced/AdvancedButton.tsx | 28 + .../Agents/Advanced/AdvancedPanel.tsx | 63 + .../SidePanel/Agents/Advanced/AgentChain.tsx | 197 + .../Agents/Advanced/AgentHandoffs.tsx | 296 + .../Agents/Advanced/MaxAgentSteps.tsx | 52 + .../SidePanel/Agents/AgentAvatar.tsx | 102 + .../Agents/AgentCategorySelector.tsx | 98 + .../SidePanel/Agents/AgentConfig.tsx | 507 + .../SidePanel/Agents/AgentFooter.tsx | 107 + .../SidePanel/Agents/AgentPanel.test.tsx | 406 + .../SidePanel/Agents/AgentPanel.tsx | 557 + .../SidePanel/Agents/AgentPanelSkeleton.tsx | 70 + .../SidePanel/Agents/AgentPanelSwitch.tsx | 35 + .../SidePanel/Agents/AgentSelect.tsx | 222 + .../components/SidePanel/Agents/AgentTool.tsx | 142 + .../components/SidePanel/Agents/Artifacts.tsx | 125 + .../SidePanel/Agents/Code/Action.tsx | 127 + .../SidePanel/Agents/Code/ApiKeyDialog.tsx | 117 + .../SidePanel/Agents/Code/Files.tsx | 111 + .../components/SidePanel/Agents/Code/Form.tsx | 38 + .../SidePanel/Agents/DeleteButton.tsx | 120 + .../SidePanel/Agents/DuplicateAgent.tsx | 48 + .../SidePanel/Agents/FileContext.tsx | 199 + .../SidePanel/Agents/FileSearch.tsx | 203 + .../SidePanel/Agents/FileSearchCheckbox.tsx | 71 + .../SidePanel/Agents/ImageVision.tsx | 40 + .../components/SidePanel/Agents/Images.tsx | 138 + .../SidePanel/Agents/Instructions.tsx | 106 + .../components/SidePanel/Agents/MCPIcon.tsx | 75 + .../components/SidePanel/Agents/MCPTool.tsx | 303 + .../components/SidePanel/Agents/MCPTools.tsx | 78 + .../SidePanel/Agents/ModelPanel.tsx | 258 + .../components/SidePanel/Agents/Retrieval.tsx | 91 + .../SidePanel/Agents/Search/Action.tsx | 132 + .../Agents/Search/ApiKeyDialog.test.tsx | 148 + .../SidePanel/Agents/Search/ApiKeyDialog.tsx | 266 + .../SidePanel/Agents/Search/Form.tsx | 31 + .../SidePanel/Agents/Search/InputSection.tsx | 149 + .../SidePanel/Agents/UnconfiguredMCPTool.tsx | 84 + .../SidePanel/Agents/UninitializedMCPTool.tsx | 139 + .../Agents/Version/VersionButton.tsx | 27 + .../Agents/Version/VersionContent.tsx | 68 + .../SidePanel/Agents/Version/VersionItem.tsx | 67 + .../SidePanel/Agents/Version/VersionPanel.tsx | 150 + .../Version/__tests__/VersionContent.spec.tsx | 142 + .../Version/__tests__/VersionItem.spec.tsx | 124 + .../Version/__tests__/VersionPanel.spec.tsx | 221 + .../Version/__tests__/isActiveVersion.spec.ts | 238 + .../Agents/Version/isActiveVersion.ts | 59 + .../SidePanel/Agents/Version/types.ts | 35 + .../Agents/__tests__/AgentAvatar.spec.tsx | 95 + .../Agents/__tests__/AgentFooter.spec.tsx | 444 + .../__tests__/AgentPanel.helpers.spec.ts | 141 + .../src/components/SidePanel/Agents/config.ts | 640 + .../components/SidePanel/ArtifactsPanel.tsx | 66 + .../SidePanel/Bookmarks/BookmarkCard.tsx | 111 + .../Bookmarks/BookmarkCardActions.tsx | 118 + .../Bookmarks/BookmarkEmptyState.tsx | 30 + .../SidePanel/Bookmarks/BookmarkList.tsx | 32 + .../SidePanel/Bookmarks/BookmarkPanel.tsx | 16 + .../SidePanel/Bookmarks/BookmarkTable.tsx | 131 + .../components/SidePanel/Bookmarks/index.ts | 6 + .../components/SidePanel/Builder/Action.tsx | 41 + .../SidePanel/Builder/ActionCallback.tsx | 66 + .../SidePanel/Builder/ActionsAuth.tsx | 376 + .../SidePanel/Builder/ActionsInput.tsx | 297 + .../SidePanel/Builder/ActionsPanel.tsx | 180 + .../Builder/ActionsTable/Columns.tsx | 54 + .../SidePanel/Builder/ActionsTable/Table.tsx | 47 + .../SidePanel/Builder/ActionsTable/index.ts | 2 + .../SidePanel/Builder/AppendDateCheckbox.tsx | 76 + .../SidePanel/Builder/AssistantAvatar.tsx | 230 + .../Builder/AssistantConversationStarters.tsx | 157 + .../SidePanel/Builder/AssistantPanel.tsx | 478 + .../SidePanel/Builder/AssistantSelect.tsx | 308 + .../SidePanel/Builder/AssistantTool.tsx | 110 + .../SidePanel/Builder/CapabilitiesForm.tsx | 73 + .../src/components/SidePanel/Builder/Code.tsx | 71 + .../SidePanel/Builder/CodeFiles.tsx | 98 + .../SidePanel/Builder/ContextButton.tsx | 125 + .../SidePanel/Builder/ImageVision.tsx | 42 + .../components/SidePanel/Builder/Images.tsx | 133 + .../SidePanel/Builder/Knowledge.tsx | 134 + .../SidePanel/Builder/PanelSwitch.tsx | 81 + .../SidePanel/Builder/Retrieval.tsx | 111 + .../src/components/SidePanel/Files/Panel.tsx | 14 + .../SidePanel/Files/PanelColumns.tsx | 57 + .../SidePanel/Files/PanelFileCell.tsx | 28 + .../components/SidePanel/Files/PanelTable.tsx | 335 + .../components/SidePanel/GPUServerStatus.tsx | 181 + .../SidePanel/GPUServerStatus.tsx.backup | 278 + .../SidePanel/MCPBuilder/MCPAdminSettings.tsx | 39 + .../SidePanel/MCPBuilder/MCPBuilderPanel.tsx | 99 + .../SidePanel/MCPBuilder/MCPCardActions.tsx | 184 + .../SidePanel/MCPBuilder/MCPServerCard.tsx | 160 + .../MCPServerDialog/MCPServerForm.tsx | 31 + .../MCPServerDialog/hooks/useMCPServerForm.ts | 311 + .../MCPBuilder/MCPServerDialog/index.tsx | 237 + .../MCPServerDialog/sections/AuthSection.tsx | 226 + .../sections/BasicInfoSection.tsx | 77 + .../sections/ConnectionSection.tsx | 37 + .../sections/TransportSection.tsx | 38 + .../MCPServerDialog/sections/TrustSection.tsx | 75 + .../MCPServerDialog/utils/urlUtils.ts | 109 + .../SidePanel/MCPBuilder/MCPServerList.tsx | 63 + .../SidePanel/MCPBuilder/MCPStatusBadge.tsx | 179 + .../components/SidePanel/MCPBuilder/index.ts | 8 + .../SidePanel/Memories/AdminSettings.tsx | 40 + .../SidePanel/Memories/MemoryCard.tsx | 57 + .../SidePanel/Memories/MemoryCardActions.tsx | 124 + .../SidePanel/Memories/MemoryCreateDialog.tsx | 159 + .../SidePanel/Memories/MemoryEditDialog.tsx | 232 + .../SidePanel/Memories/MemoryEmptyState.tsx | 28 + .../SidePanel/Memories/MemoryList.tsx | 32 + .../SidePanel/Memories/MemoryPanel.tsx | 229 + .../SidePanel/Memories/MemoryUsageBadge.tsx | 63 + .../components/SidePanel/Memories/index.ts | 10 + client/src/components/SidePanel/Nav.tsx | 121 + .../SidePanel/Parameters/DynamicCheckbox.tsx | 98 + .../SidePanel/Parameters/DynamicCombobox.tsx | 131 + .../SidePanel/Parameters/DynamicDropdown.tsx | 121 + .../SidePanel/Parameters/DynamicInput.tsx | 104 + .../SidePanel/Parameters/DynamicSlider.tsx | 240 + .../SidePanel/Parameters/DynamicSwitch.tsx | 90 + .../SidePanel/Parameters/DynamicTags.tsx | 188 + .../SidePanel/Parameters/DynamicTextarea.tsx | 105 + .../SidePanel/Parameters/OptionHover.tsx | 39 + .../components/SidePanel/Parameters/Panel.tsx | 197 + .../SidePanel/Parameters/components.tsx | 26 + .../components/SidePanel/Parameters/index.ts | 9 + client/src/components/SidePanel/SidePanel.tsx | 194 + .../components/SidePanel/SidePanelGroup.tsx | 164 + client/src/components/SidePanel/data.tsx | 38 + client/src/components/SidePanel/index.ts | 2 + .../src/components/System/WakeLockManager.tsx | 31 + .../components/Tools/AssistantToolsDialog.tsx | 254 + client/src/components/Tools/MCPToolItem.tsx | 115 + .../components/Tools/MCPToolSelectDialog.tsx | 379 + client/src/components/Tools/ToolItem.tsx | 83 + .../src/components/Tools/ToolSelectDialog.tsx | 259 + client/src/components/Tools/index.ts | 3 + client/src/components/Web/Citation.tsx | 230 + client/src/components/Web/Context.tsx | 106 + client/src/components/Web/SourceHovercard.tsx | 160 + client/src/components/Web/Sources.tsx | 769 + .../components/Web/SourcesErrorBoundary.tsx | 58 + .../__tests__/SourcesErrorBoundary.test.tsx | 67 + client/src/components/Web/index.ts | 2 + client/src/components/Web/plugin.ts | 262 + client/src/components/Web/types.ts | 32 + client/src/components/index.ts | 2 + .../src/components/ui/AdminSettingsDialog.tsx | 275 + .../components/ui/TermsAndConditionsModal.tsx | 109 + client/src/components/ui/index.ts | 3 + client/src/constants/agentCategories.ts | 12 + client/src/data-provider/Agents/index.ts | 5 + client/src/data-provider/Agents/mutations.ts | 408 + client/src/data-provider/Agents/queries.ts | 168 + client/src/data-provider/Auth/index.ts | 2 + client/src/data-provider/Auth/mutations.ts | 174 + client/src/data-provider/Auth/queries.ts | 44 + client/src/data-provider/Endpoints/index.ts | 1 + client/src/data-provider/Endpoints/queries.ts | 42 + client/src/data-provider/Favorites.ts | 44 + client/src/data-provider/Files/index.ts | 3 + client/src/data-provider/Files/mutations.ts | 191 + client/src/data-provider/Files/queries.ts | 107 + client/src/data-provider/Files/sharepoint.ts | 232 + client/src/data-provider/MCP/index.ts | 2 + client/src/data-provider/MCP/mutations.ts | 141 + client/src/data-provider/MCP/queries.ts | 44 + client/src/data-provider/Memories/index.ts | 2 + client/src/data-provider/Memories/queries.ts | 116 + client/src/data-provider/Messages/index.ts | 2 + .../src/data-provider/Messages/mutations.ts | 174 + client/src/data-provider/Messages/queries.ts | 42 + client/src/data-provider/Misc/index.ts | 1 + client/src/data-provider/Misc/queries.ts | 45 + client/src/data-provider/SSE/index.ts | 2 + client/src/data-provider/SSE/mutations.ts | 42 + client/src/data-provider/SSE/queries.ts | 153 + client/src/data-provider/Tools/index.ts | 2 + client/src/data-provider/Tools/mutations.ts | 42 + client/src/data-provider/Tools/queries.ts | 75 + .../__tests__/connection.test.ts | 316 + .../data-provider/__tests__/memories.test.ts | 19 + client/src/data-provider/connection.ts | 101 + client/src/data-provider/index.ts | 18 + client/src/data-provider/mutations.ts | 1052 + client/src/data-provider/prompts.ts | 360 + client/src/data-provider/queries.ts | 531 + client/src/data-provider/roles.ts | 245 + client/src/data-provider/tags.ts | 19 + .../__tests__/useAgentCategories.spec.tsx | 80 + .../useAgentToolPermissions.render.test.ts | 558 + .../__tests__/useAgentToolPermissions.test.ts | 250 + client/src/hooks/Agents/index.ts | 9 + .../src/hooks/Agents/useAgentCapabilities.ts | 68 + .../src/hooks/Agents/useAgentCategories.tsx | 58 + .../Agents/useAgentDefaultPermissionLevel.ts | 18 + .../hooks/Agents/useAgentToolPermissions.ts | 73 + client/src/hooks/Agents/useAgentsMap.ts | 25 + .../hooks/Agents/useApplyModelSpecAgents.ts | 93 + client/src/hooks/Agents/useGetAgentsConfig.ts | 36 + client/src/hooks/Agents/useSelectAgent.ts | 95 + client/src/hooks/ApiErrorBoundaryContext.tsx | 33 + .../__tests__/useArtifactProps.test.ts | 219 + .../Artifacts/__tests__/useArtifacts.test.ts | 693 + .../src/hooks/Artifacts/useArtifactProps.ts | 41 + client/src/hooks/Artifacts/useArtifacts.ts | 148 + client/src/hooks/Artifacts/useAutoScroll.ts | 47 + client/src/hooks/Assistants/index.ts | 3 + .../hooks/Assistants/useAssistantListMap.ts | 44 + .../src/hooks/Assistants/useAssistantsMap.ts | 28 + .../hooks/Assistants/useSelectAssistant.ts | 50 + client/src/hooks/Audio/MediaSourceAppender.ts | 41 + client/src/hooks/Audio/index.ts | 5 + client/src/hooks/Audio/useAudioRef.ts | 48 + client/src/hooks/Audio/useCustomAudioRef.ts | 98 + client/src/hooks/Audio/usePauseGlobalAudio.ts | 40 + client/src/hooks/Audio/useTTSBrowser.ts | 100 + client/src/hooks/Audio/useTTSExternal.ts | 101 + client/src/hooks/AuthContext.tsx | 238 + .../__tests__/useFocusChatEffect.spec.tsx | 397 + client/src/hooks/Chat/index.ts | 6 + client/src/hooks/Chat/useAddedResponse.ts | 123 + client/src/hooks/Chat/useChatFunctions.ts | 365 + client/src/hooks/Chat/useChatHelpers.ts | 216 + client/src/hooks/Chat/useFocusChatEffect.ts | 36 + client/src/hooks/Chat/useGetAddedConvo.ts | 15 + client/src/hooks/Chat/useIdChangeEffect.ts | 21 + client/src/hooks/Config/index.ts | 3 + client/src/hooks/Config/useAppStartup.ts | 75 + client/src/hooks/Config/useClearStates.ts | 50 + .../src/hooks/Config/useSpeechSettingsInit.ts | 50 + client/src/hooks/Conversations/index.ts | 12 + .../hooks/Conversations/useBookmarkSuccess.ts | 18 + .../hooks/Conversations/useDebouncedInput.ts | 58 + .../hooks/Conversations/useDefaultConvo.ts | 77 + .../Conversations/useExportConversation.ts | 391 + .../hooks/Conversations/useGenerateConvo.ts | 150 + .../src/hooks/Conversations/useGetSender.ts | 15 + .../Conversations/useNavigateToConvo.tsx | 132 + .../Conversations/useParameterEffects.ts | 69 + .../Conversations/usePresetIndexOptions.ts | 110 + client/src/hooks/Conversations/usePresets.ts | 287 + .../hooks/Conversations/useSearchEnabled.ts | 23 + .../hooks/Conversations/useSetIndexOptions.ts | 122 + .../Conversations/useUpdateTagsInConvo.ts | 104 + client/src/hooks/Endpoint/Icons.tsx | 72 + client/src/hooks/Endpoint/UnknownIcon.tsx | 110 + client/src/hooks/Endpoint/index.ts | 3 + client/src/hooks/Endpoint/useEndpoints.ts | 189 + client/src/hooks/Endpoint/useKeyDialog.ts | 38 + .../src/hooks/Endpoint/useSelectorEffects.ts | 130 + client/src/hooks/Files/index.ts | 11 + client/src/hooks/Files/useClientResize.ts | 84 + .../src/hooks/Files/useDelayedUploadToast.ts | 46 + .../hooks/Files/useDeleteFilesFromTable.tsx | 42 + client/src/hooks/Files/useDragHelpers.ts | 167 + client/src/hooks/Files/useFileDeletion.ts | 161 + client/src/hooks/Files/useFileHandling.ts | 437 + client/src/hooks/Files/useFileMap.ts | 11 + client/src/hooks/Files/useSetFilesToDelete.ts | 7 + .../src/hooks/Files/useSharePointDownload.ts | 129 + .../hooks/Files/useSharePointFileHandling.ts | 55 + client/src/hooks/Files/useSharePointPicker.ts | 383 + client/src/hooks/Files/useSharePointToken.ts | 46 + client/src/hooks/Files/useUpdateFiles.ts | 68 + client/src/hooks/Generic/index.ts | 2 + client/src/hooks/Generic/useLazyEffect.ts | 18 + client/src/hooks/Generic/useShiftKey.ts | 47 + client/src/hooks/Input/index.ts | 11 + client/src/hooks/Input/useAutoSave.ts | 250 + client/src/hooks/Input/useDebounce.ts | 19 + client/src/hooks/Input/useGetAudioSettings.ts | 18 + client/src/hooks/Input/useHandleKeyUp.ts | 145 + client/src/hooks/Input/useMentions.ts | 264 + client/src/hooks/Input/useMultipleKeys.ts | 24 + client/src/hooks/Input/useQueryParams.spec.ts | 529 + client/src/hooks/Input/useQueryParams.ts | 465 + client/src/hooks/Input/useRequiresKey.ts | 19 + client/src/hooks/Input/useSelectMention.ts | 314 + client/src/hooks/Input/useSpeechToText.ts | 49 + .../src/hooks/Input/useSpeechToTextBrowser.ts | 124 + .../hooks/Input/useSpeechToTextExternal.ts | 282 + client/src/hooks/Input/useTextToSpeech.ts | 159 + .../src/hooks/Input/useTextToSpeechBrowser.ts | 120 + .../hooks/Input/useTextToSpeechExternal.ts | 204 + client/src/hooks/Input/useTextarea.ts | 243 + client/src/hooks/Input/useUserKey.ts | 57 + .../hooks/MCP/__tests__/useMCPSelect.test.tsx | 634 + client/src/hooks/MCP/index.ts | 5 + .../src/hooks/MCP/useMCPConnectionStatus.ts | 11 + client/src/hooks/MCP/useMCPSelect.ts | 71 + client/src/hooks/MCP/useMCPServerManager.ts | 691 + client/src/hooks/MCP/useRemoveMCPTool.ts | 45 + client/src/hooks/MCP/useVisibleTools.ts | 52 + client/src/hooks/Mermaid/index.ts | 2 + .../src/hooks/Mermaid/useDebouncedMermaid.ts | 204 + client/src/hooks/Mermaid/useMermaid.ts | 182 + client/src/hooks/Messages/index.ts | 10 + client/src/hooks/Messages/useAttachments.ts | 26 + .../src/hooks/Messages/useBuildMessageTree.ts | 78 + .../src/hooks/Messages/useContentMetadata.ts | 30 + .../Messages/useConversationUIResources.ts | 55 + .../hooks/Messages/useCopyToClipboard.spec.ts | 494 + .../src/hooks/Messages/useCopyToClipboard.ts | 343 + .../src/hooks/Messages/useMessageActions.tsx | 163 + .../src/hooks/Messages/useMessageHelpers.tsx | 149 + .../src/hooks/Messages/useMessageProcess.tsx | 82 + .../src/hooks/Messages/useMessageScrolling.ts | 113 + client/src/hooks/Messages/useProgress.ts | 73 + .../hooks/Messages/useSearchResultsByTurn.ts | 119 + client/src/hooks/Messages/useSubmitMessage.ts | 59 + client/src/hooks/Nav/index.ts | 3 + client/src/hooks/Nav/useNavHelpers.ts | 35 + client/src/hooks/Nav/useNavScrolling.ts | 74 + client/src/hooks/Nav/useShowMarketplace.ts | 37 + client/src/hooks/Nav/useSideNavLinks.ts | 203 + .../src/hooks/Nav/useSideNavLinks.ts.backup | 203 + client/src/hooks/Plugins/index.ts | 5 + client/src/hooks/Plugins/useAuthCodeTool.ts | 51 + client/src/hooks/Plugins/useAuthSearchTool.ts | 95 + client/src/hooks/Plugins/useCodeApiKeyForm.ts | 47 + .../hooks/Plugins/usePluginDialogHelpers.ts | 79 + .../src/hooks/Plugins/useSearchApiKeyForm.ts | 45 + client/src/hooks/Plugins/useToolCallsMap.ts | 28 + client/src/hooks/Plugins/useToolToggle.ts | 118 + client/src/hooks/Prompts/index.ts | 2 + client/src/hooks/Prompts/useCategories.tsx | 41 + .../src/hooks/Prompts/usePromptGroupsNav.ts | 115 + client/src/hooks/Roles/index.ts | 1 + client/src/hooks/Roles/useHasAccess.ts | 47 + client/src/hooks/SSE/index.ts | 7 + client/src/hooks/SSE/useAdaptiveSSE.ts | 46 + client/src/hooks/SSE/useAttachmentHandler.ts | 41 + client/src/hooks/SSE/useContentHandler.ts | 96 + client/src/hooks/SSE/useEventHandlers.ts | 840 + client/src/hooks/SSE/useResumableSSE.ts | 702 + client/src/hooks/SSE/useResumeOnLoad.ts | 260 + client/src/hooks/SSE/useSSE.ts | 261 + client/src/hooks/SSE/useStepHandler.ts | 595 + client/src/hooks/ScreenshotContext.tsx | 66 + client/src/hooks/Sharing/index.ts | 3 + client/src/hooks/Sharing/useCanSharePublic.ts | 22 + .../Sharing/usePeoplePickerPermissions.ts | 59 + .../Sharing/useResourcePermissionState.ts | 81 + client/src/hooks/index.ts | 38 + client/src/hooks/useChatBadges.ts | 56 + client/src/hooks/useDocumentTitle.ts | 20 + client/src/hooks/useFavorites.ts | 206 + client/src/hooks/useGPUServerStatus.ts | 90 + client/src/hooks/useGenerationsByLatest.ts | 77 + client/src/hooks/useInfiniteScroll.ts | 109 + client/src/hooks/useLocalStorage.tsx | 53 + client/src/hooks/useLocalStorageAlt.tsx | 72 + client/src/hooks/useLocalize.ts | 21 + client/src/hooks/useLocalizedConfig.ts | 36 + client/src/hooks/useNewConvo.ts | 374 + client/src/hooks/usePersonalizationAccess.ts | 16 + client/src/hooks/useResourcePermissions.ts | 28 + client/src/hooks/useScrollToRef.ts | 53 + client/src/hooks/useTimeout.tsx | 39 + client/src/hooks/useVirtualGrid.ts | 66 + client/src/hooks/useWakeLock.ts | 211 + client/src/locales/README.md | 135 + client/src/locales/Translation.spec.ts | 48 + client/src/locales/ar/translation.json | 700 + client/src/locales/bo/translation.json | 1 + client/src/locales/bs/translation.json | 1 + client/src/locales/ca/translation.json | 861 + client/src/locales/cs/translation.json | 706 + client/src/locales/da/translation.json | 900 + client/src/locales/de/translation.json | 1412 + client/src/locales/en/translation.json | 1457 + client/src/locales/es/translation.json | 787 + client/src/locales/et/translation.json | 922 + client/src/locales/fa/translation.json | 805 + client/src/locales/fi/translation.json | 580 + client/src/locales/fr/translation.json | 1259 + client/src/locales/he/translation.json | 1250 + client/src/locales/hu/translation.json | 805 + client/src/locales/hy/translation.json | 193 + client/src/locales/i18n.ts | 104 + client/src/locales/id/translation.json | 275 + client/src/locales/it/translation.json | 880 + client/src/locales/ja/translation.json | 1438 + client/src/locales/ka/translation.json | 65 + client/src/locales/ko/translation.json | 1060 + client/src/locales/lv/translation.json | 1457 + client/src/locales/nb/translation.json | 1232 + client/src/locales/nl/translation.json | 683 + client/src/locales/pl/translation.json | 689 + client/src/locales/pt-BR/translation.json | 983 + client/src/locales/pt-PT/translation.json | 1212 + client/src/locales/ru/translation.json | 1273 + client/src/locales/sl/translation.json | 37 + client/src/locales/sv/translation.json | 528 + client/src/locales/th/translation.json | 846 + client/src/locales/tr/translation.json | 699 + client/src/locales/ug/translation.json | 1 + client/src/locales/uk/translation.json | 1233 + client/src/locales/vi/translation.json | 366 + client/src/locales/zh-Hans/translation.json | 1293 + client/src/locales/zh-Hant/translation.json | 897 + client/src/main.jsx | 18 + client/src/mobile.css | 384 + client/src/routes/ChatRoute.tsx | 163 + client/src/routes/Dashboard.tsx | 82 + client/src/routes/Layouts/DashBreadcrumb.tsx | 132 + client/src/routes/Layouts/Dashboard.tsx | 36 + client/src/routes/Layouts/Login.tsx | 23 + client/src/routes/Layouts/Startup.tsx | 71 + client/src/routes/Root.tsx | 113 + client/src/routes/RouteErrorBoundary.tsx | 234 + client/src/routes/Search.tsx | 118 + client/src/routes/ShareRoute.tsx | 5 + .../routes/__tests__/useAuthRedirect.spec.tsx | 202 + client/src/routes/index.tsx | 136 + client/src/routes/useAuthRedirect.ts | 26 + client/src/store/agents.ts | 105 + client/src/store/artifacts.ts | 63 + client/src/store/endpoints.ts | 44 + client/src/store/families.ts | 429 + client/src/store/favorites.ts | 19 + client/src/store/fontSize.ts | 21 + client/src/store/index.ts | 34 + client/src/store/jotai-utils.ts | 88 + client/src/store/language.ts | 11 + client/src/store/mcp.ts | 57 + client/src/store/misc.ts | 74 + client/src/store/preset.ts | 17 + client/src/store/prompts.ts | 28 + client/src/store/search.ts | 24 + client/src/store/settings.ts | 75 + client/src/store/showThinking.ts | 8 + client/src/store/submission.ts | 28 + client/src/store/temporary.ts | 9 + client/src/store/text.ts | 8 + client/src/store/toast.ts | 14 + client/src/store/user.ts | 17 + client/src/store/utils.ts | 31 + client/src/style.css | 2924 + client/src/utils/__tests__/agents.spec.tsx | 183 + client/src/utils/__tests__/citations.test.ts | 558 + .../src/utils/__tests__/cleanupPreset.test.ts | 224 + .../src/utils/__tests__/imageResize.test.ts | 108 + client/src/utils/__tests__/markdown.test.ts | 185 + client/src/utils/__tests__/presets.test.ts | 362 + client/src/utils/__tests__/share.test.ts | 22 + client/src/utils/__tests__/timestamps.test.ts | 163 + client/src/utils/agents.tsx | 137 + client/src/utils/artifacts.ts | 199 + client/src/utils/buildDefaultConvo.ts | 87 + client/src/utils/buildTree.ts | 19 + client/src/utils/citations.ts | 46 + client/src/utils/cleanupPreset.ts | 50 + client/src/utils/cn.ts | 11 + client/src/utils/collection.ts | 220 + client/src/utils/conversationTags.spec.ts | 225 + client/src/utils/conversationTags.ts | 55 + client/src/utils/convos.fakeData.ts | 567 + client/src/utils/convos.spec.ts | 693 + client/src/utils/convos.ts | 453 + .../src/utils/createChatSearchParams.spec.ts | 363 + client/src/utils/createChatSearchParams.ts | 75 + client/src/utils/drafts.ts | 39 + client/src/utils/email.ts | 28 + client/src/utils/endpoints.spec.ts | 85 + client/src/utils/endpoints.ts | 346 + client/src/utils/files.ts | 320 + client/src/utils/forms.tsx | 168 + client/src/utils/getDefaultEndpoint.ts | 65 + client/src/utils/getLoginError.ts | 24 + client/src/utils/getThemeFromEnv.js | 58 + client/src/utils/heicConverter.ts | 79 + client/src/utils/imageResize.ts | 215 + client/src/utils/index.ts | 181 + client/src/utils/json.ts | 37 + client/src/utils/languages.ts | 427 + client/src/utils/latex.spec.ts | 254 + client/src/utils/latex.ts | 152 + client/src/utils/localStorage.ts | 80 + client/src/utils/logger.ts | 49 + client/src/utils/map.ts | 117 + client/src/utils/markdown.ts | 256 + client/src/utils/memory.ts | 90 + client/src/utils/mermaid.ts | 268 + client/src/utils/messages.ts | 288 + client/src/utils/presets.ts | 84 + client/src/utils/promptGroups.ts | 102 + client/src/utils/prompts.ts | 96 + client/src/utils/resetConvo.ts | 24 + client/src/utils/resources.ts | 54 + client/src/utils/roles.ts | 65 + client/src/utils/routes.ts | 7 + client/src/utils/scaleImage.ts | 21 + client/src/utils/share.ts | 6 + client/src/utils/textarea.ts | 87 + client/src/utils/timestamps.ts | 143 + client/src/vite-env.d.ts | 11 + client/tailwind.config.cjs | 165 + client/test/layout-test-utils.tsx | 33 + client/test/localStorage.mock | 21 + client/test/matchMedia.mock | 13 + client/test/resizeObserver.mock | 8 + client/test/setupTests.js | 76 + client/tsconfig.json | 39 + client/vite.config.ts | 297 + config/add-balance.js | 116 + config/ban-user.js | 92 + config/connect.js | 38 + config/create-user.js | 139 + config/delete-banner.js | 62 + config/delete-user.js | 126 + config/deployed-update.js | 68 + config/flush-cache.js | 361 + config/helpers.js | 84 + config/invite-user.js | 93 + config/list-balances.js | 40 + config/list-users.js | 32 + config/migrate-agent-permissions.js | 287 + config/migrate-prompt-permissions.js | 251 + config/packages.js | 38 + config/prepare.js | 12 + config/reset-meili-sync.js | 101 + config/reset-password.js | 68 + config/reset-terms.js | 45 + config/set-balance.js | 117 + config/stop-backend.js | 21 + config/translations/README.md | 30 + config/translations/anthropic.ts | 82 + config/translations/comparisons.ts | 49 + config/translations/embeddings.ts | 43 + config/translations/file.ts | 21 + config/translations/instructions.ts | 78 + config/translations/keys.ts | 46 + config/translations/main.ts | 53 + config/translations/process.ts | 50 + config/translations/scan.ts | 25 + config/translations/tsconfig.json | 17 + config/update-banner.js | 158 + config/update.js | 137 + config/user-stats.js | 54 + deploy-compose.yml | 88 + docker-compose.override.yml.example | 181 + docker-compose.yml | 72 + e2e/config.local.example.ts | 10 + e2e/jestSetup.js | 3 + e2e/playwright.config.a11y.ts | 59 + e2e/playwright.config.local.ts | 59 + e2e/playwright.config.ts | 73 + e2e/setup/authenticate.ts | 95 + e2e/setup/cleanupUser.ts | 60 + e2e/setup/global-setup.local.ts | 9 + e2e/setup/global-setup.ts | 14 + e2e/setup/global-teardown.local.ts | 12 + e2e/setup/global-teardown.ts | 16 + e2e/specs/a11y.spec.ts | 43 + e2e/specs/keys.spec.ts | 86 + e2e/specs/landing.spec.ts | 42 + e2e/specs/messages.spec.ts | 162 + e2e/specs/nav.spec.ts | 58 + e2e/specs/popup.spec.ts | 16 + e2e/specs/settings.spec.ts | 63 + e2e/types.ts | 1 + eslint.config.mjs | 350 + helm/librechat-rag-api/Chart.yaml | 33 + helm/librechat-rag-api/readme.md | 4 + helm/librechat-rag-api/templates/_helpers.tpl | 65 + .../templates/configmap.yaml | 9 + .../templates/rag-deployment.yaml | 97 + helm/librechat-rag-api/templates/service.yaml | 17 + .../templates/tests/test-connection.yaml | 15 + .../templates/vectordb-secret.yaml | 12 + helm/librechat-rag-api/values.yaml | 99 + helm/librechat/.helmignore | 23 + helm/librechat/Chart.yaml | 42 + helm/librechat/DNS_CONFIGURATION.md | 186 + .../librechat/examples/dns-configuration.yaml | 43 + .../examples/hostaliases-values.yaml | 6 + helm/librechat/readme.md | 37 + helm/librechat/templates/NOTES.txt | 22 + helm/librechat/templates/_checks.yaml | 4 + helm/librechat/templates/_helpers.tpl | 78 + helm/librechat/templates/configmap-env.yaml | 17 + helm/librechat/templates/configmap.yaml | 10 + .../templates/configmaps-additional.yaml | 26 + helm/librechat/templates/deployment.yaml | 136 + helm/librechat/templates/hpa.yaml | 32 + helm/librechat/templates/ingress.yaml | 60 + .../templates/persistentvolumeclaim.yaml | 16 + helm/librechat/templates/service.yaml | 17 + helm/librechat/templates/serviceaccount.yaml | 13 + .../templates/tests/test-connection.yaml | 15 + helm/librechat/values.yaml | 307 + librechat.example.yaml | 595 + librechat.yaml | 59 + package-lock.json | 45681 ++++++++++++++++ package.json | 164 + packages/api/.gitignore | 2 + packages/api/babel.config.cjs | 4 + packages/api/jest.config.mjs | 27 + packages/api/package.json | 118 + packages/api/rollup.config.js | 65 + .../api/src/acl/accessControlService.spec.ts | 1084 + packages/api/src/acl/accessControlService.ts | 360 + .../api/src/agents/__tests__/memory.test.ts | 469 + packages/api/src/agents/auth.ts | 92 + packages/api/src/agents/avatars.spec.ts | 228 + packages/api/src/agents/avatars.ts | 122 + packages/api/src/agents/chain.ts | 47 + packages/api/src/agents/context.spec.ts | 528 + packages/api/src/agents/context.ts | 148 + packages/api/src/agents/edges.spec.ts | 257 + packages/api/src/agents/edges.ts | 90 + packages/api/src/agents/index.ts | 11 + packages/api/src/agents/initialize.ts | 321 + packages/api/src/agents/legacy.test.ts | 697 + packages/api/src/agents/legacy.ts | 141 + packages/api/src/agents/memory.spec.ts | 385 + packages/api/src/agents/memory.ts | 604 + packages/api/src/agents/migration.ts | 244 + packages/api/src/agents/resources.test.ts | 1315 + packages/api/src/agents/resources.ts | 312 + packages/api/src/agents/run.ts | 176 + packages/api/src/agents/validation.ts | 177 + .../api/src/app/AppService.interface.spec.ts | 157 + packages/api/src/app/AppService.spec.ts | 814 + packages/api/src/app/cdn.ts | 26 + packages/api/src/app/checks.spec.ts | 358 + packages/api/src/app/checks.ts | 307 + packages/api/src/app/config.test.ts | 284 + packages/api/src/app/config.ts | 74 + packages/api/src/app/index.ts | 4 + packages/api/src/app/limits.ts | 55 + packages/api/src/app/permissions.spec.ts | 1740 + packages/api/src/app/permissions.ts | 350 + packages/api/src/auth/domain.spec.ts | 759 + packages/api/src/auth/domain.ts | 362 + packages/api/src/auth/index.ts | 2 + packages/api/src/auth/openid.spec.ts | 436 + packages/api/src/auth/openid.ts | 62 + .../src/cache/__tests__/cacheConfig.spec.ts | 230 + .../limiterCache.cache_integration.spec.ts | 105 + .../sessionCache.cache_integration.spec.ts | 191 + .../standardCache.cache_integration.spec.ts | 205 + .../violationCache.cache_integration.spec.ts | 221 + .../redisClients.cache_integration.spec.ts | 157 + .../redisUtils.cache_integration.spec.ts | 211 + packages/api/src/cache/cacheConfig.ts | 133 + packages/api/src/cache/cacheFactory.ts | 143 + packages/api/src/cache/index.ts | 6 + packages/api/src/cache/keyvFiles.ts | 6 + packages/api/src/cache/keyvMongo.ts | 280 + packages/api/src/cache/redisClients.ts | 218 + packages/api/src/cache/redisUtils.ts | 129 + packages/api/src/cdn/azure.ts | 54 + packages/api/src/cdn/firebase.ts | 42 + packages/api/src/cdn/index.ts | 3 + packages/api/src/cdn/s3.ts | 51 + packages/api/src/cluster/LeaderElection.ts | 180 + .../LeaderElection.cache_integration.spec.ts | 218 + packages/api/src/cluster/config.ts | 14 + packages/api/src/cluster/index.ts | 1 + packages/api/src/crypto/index.ts | 11 + packages/api/src/crypto/jwt.ts | 14 + packages/api/src/db/utils.ts | 54 + .../api/src/endpoints/anthropic/helpers.ts | 121 + packages/api/src/endpoints/anthropic/index.ts | 4 + .../api/src/endpoints/anthropic/initialize.ts | 96 + .../api/src/endpoints/anthropic/llm.spec.ts | 1473 + packages/api/src/endpoints/anthropic/llm.ts | 264 + .../api/src/endpoints/anthropic/vertex.ts | 222 + packages/api/src/endpoints/bedrock/index.ts | 1 + .../src/endpoints/bedrock/initialize.spec.ts | 316 + .../api/src/endpoints/bedrock/initialize.ts | 166 + packages/api/src/endpoints/config.ts | 99 + packages/api/src/endpoints/custom/config.ts | 56 + packages/api/src/endpoints/custom/index.ts | 2 + .../api/src/endpoints/custom/initialize.ts | 180 + packages/api/src/endpoints/google/index.ts | 2 + .../api/src/endpoints/google/initialize.ts | 91 + packages/api/src/endpoints/google/llm.spec.ts | 779 + packages/api/src/endpoints/google/llm.ts | 311 + packages/api/src/endpoints/index.ts | 7 + packages/api/src/endpoints/models.spec.ts | 628 + packages/api/src/endpoints/models.ts | 391 + .../endpoints/openai/config.anthropic.spec.ts | 919 + .../openai/config.backward-compat.spec.ts | 431 + .../endpoints/openai/config.google.spec.ts | 407 + .../api/src/endpoints/openai/config.spec.ts | 1865 + packages/api/src/endpoints/openai/config.ts | 194 + packages/api/src/endpoints/openai/index.ts | 3 + .../api/src/endpoints/openai/initialize.ts | 164 + packages/api/src/endpoints/openai/llm.spec.ts | 673 + packages/api/src/endpoints/openai/llm.ts | 399 + .../api/src/endpoints/openai/transform.ts | 166 + packages/api/src/files/audio.ts | 43 + packages/api/src/files/context.ts | 64 + packages/api/src/files/encode/audio.ts | 103 + .../api/src/files/encode/document.spec.ts | 531 + packages/api/src/files/encode/document.ts | 133 + packages/api/src/files/encode/index.ts | 3 + packages/api/src/files/encode/utils.ts | 73 + packages/api/src/files/encode/video.ts | 95 + packages/api/src/files/filter.spec.ts | 1313 + packages/api/src/files/filter.ts | 96 + packages/api/src/files/index.ts | 9 + packages/api/src/files/mistral/crud.spec.ts | 2341 + packages/api/src/files/mistral/crud.ts | 730 + packages/api/src/files/ocr.ts | 15 + packages/api/src/files/parse.ts | 40 + packages/api/src/files/text.spec.ts | 304 + packages/api/src/files/text.ts | 112 + packages/api/src/files/validation.spec.ts | 558 + packages/api/src/files/validation.ts | 286 + packages/api/src/flow/manager.test.ts | 990 + packages/api/src/flow/manager.ts | 403 + packages/api/src/flow/types.ts | 23 + packages/api/src/index.ts | 47 + packages/api/src/mcp/ConnectionsRepository.ts | 132 + packages/api/src/mcp/MCPConnectionFactory.ts | 428 + packages/api/src/mcp/MCPManager.ts | 260 + packages/api/src/mcp/UserConnectionManager.ts | 239 + .../__tests__/ConnectionsRepository.test.ts | 473 + .../src/mcp/__tests__/MCPConnection.test.ts | 531 + .../__tests__/MCPConnectionFactory.test.ts | 427 + .../api/src/mcp/__tests__/MCPManager.test.ts | 392 + packages/api/src/mcp/__tests__/auth.test.ts | 269 + .../__tests__/detectOAuth.integration.dev.ts | 83 + .../api/src/mcp/__tests__/handler.test.ts | 1138 + packages/api/src/mcp/__tests__/mcp.spec.ts | 862 + .../api/src/mcp/__tests__/parsers.test.ts | 442 + packages/api/src/mcp/__tests__/tokens.test.ts | 194 + packages/api/src/mcp/__tests__/utils.test.ts | 28 + packages/api/src/mcp/__tests__/zod.spec.ts | 1978 + packages/api/src/mcp/auth.ts | 76 + packages/api/src/mcp/connection.ts | 1056 + packages/api/src/mcp/enum.ts | 8 + packages/api/src/mcp/errors.ts | 61 + packages/api/src/mcp/mcpConfig.ts | 15 + .../oauth/OAuthReconnectionManager.test.ts | 484 + .../src/mcp/oauth/OAuthReconnectionManager.ts | 186 + .../oauth/OAuthReconnectionTracker.test.ts | 455 + .../src/mcp/oauth/OAuthReconnectionTracker.ts | 89 + .../api/src/mcp/oauth/detectOAuth.test.ts | 267 + packages/api/src/mcp/oauth/detectOAuth.ts | 169 + packages/api/src/mcp/oauth/handler.ts | 1066 + packages/api/src/mcp/oauth/index.ts | 4 + packages/api/src/mcp/oauth/tokens.ts | 484 + packages/api/src/mcp/oauth/types.ts | 104 + packages/api/src/mcp/parsers.ts | 219 + .../src/mcp/registry/MCPServerInspector.ts | 140 + .../src/mcp/registry/MCPServersInitializer.ts | 103 + .../src/mcp/registry/MCPServersRegistry.ts | 224 + .../ServerConfigsRepositoryInterface.ts | 22 + .../__tests__/MCPServerInspector.test.ts | 387 + ...rversInitializer.cache_integration.spec.ts | 431 + .../__tests__/MCPServersInitializer.test.ts | 380 + ...PServersRegistry.cache_integration.spec.ts | 239 + .../__tests__/MCPServersRegistry.test.ts | 305 + .../__tests__/ServerConfigsDB.test.ts | 1276 + .../__tests__/mcpConnectionsMock.helper.ts | 55 + .../mcp/registry/cache/BaseRegistryCache.ts | 33 + .../mcp/registry/cache/RegistryStatusCache.ts | 38 + .../cache/ServerConfigsCacheFactory.ts | 31 + .../cache/ServerConfigsCacheInMemory.ts | 48 + .../registry/cache/ServerConfigsCacheRedis.ts | 86 + ...istryStatusCache.cache_integration.spec.ts | 79 + .../ServerConfigsCacheFactory.test.ts | 70 + .../ServerConfigsCacheInMemory.test.ts | 183 + ...onfigsCacheRedis.cache_integration.spec.ts | 273 + .../src/mcp/registry/db/ServerConfigsDB.ts | 535 + packages/api/src/mcp/types/index.ts | 187 + packages/api/src/mcp/utils.ts | 74 + packages/api/src/mcp/zod.ts | 486 + packages/api/src/memory/config.ts | 28 + packages/api/src/memory/index.ts | 1 + packages/api/src/middleware/access.spec.ts | 554 + packages/api/src/middleware/access.ts | 138 + packages/api/src/middleware/balance.spec.ts | 653 + packages/api/src/middleware/balance.ts | 119 + packages/api/src/middleware/concurrency.ts | 227 + packages/api/src/middleware/error.spec.ts | 266 + packages/api/src/middleware/error.ts | 83 + packages/api/src/middleware/index.ts | 5 + packages/api/src/middleware/json.spec.ts | 158 + packages/api/src/middleware/json.ts | 40 + packages/api/src/oauth/index.ts | 1 + packages/api/src/oauth/tokens.ts | 323 + .../api/src/prompts/artifacts/components.ts | 711 + .../api/src/prompts/artifacts/generate.ts | 49 + packages/api/src/prompts/artifacts/index.ts | 426 + packages/api/src/prompts/format.ts | 153 + packages/api/src/prompts/index.ts | 4 + packages/api/src/prompts/migration.ts | 232 + packages/api/src/prompts/schemas.spec.ts | 222 + packages/api/src/prompts/schemas.ts | 53 + .../api/src/stream/GenerationJobManager.ts | 1183 + ...ationJobManager.stream_integration.spec.ts | 1110 + ...sEventTransport.stream_integration.spec.ts | 474 + .../RedisJobStore.stream_integration.spec.ts | 975 + .../stream/__tests__/collectedUsage.spec.ts | 482 + .../api/src/stream/createStreamServices.ts | 133 + .../implementations/InMemoryEventTransport.ts | 141 + .../implementations/InMemoryJobStore.ts | 330 + .../implementations/RedisEventTransport.ts | 384 + .../stream/implementations/RedisJobStore.ts | 869 + .../api/src/stream/implementations/index.ts | 4 + packages/api/src/stream/index.ts | 23 + .../api/src/stream/interfaces/IJobStore.ts | 340 + packages/api/src/stream/interfaces/index.ts | 1 + packages/api/src/tools/format.spec.ts | 279 + packages/api/src/tools/format.ts | 80 + packages/api/src/tools/index.ts | 2 + packages/api/src/tools/toolkits/gemini.ts | 100 + .../api/src/tools/toolkits/imageContext.ts | 38 + packages/api/src/tools/toolkits/index.ts | 3 + packages/api/src/tools/toolkits/oai.ts | 153 + packages/api/src/types/anthropic.ts | 96 + packages/api/src/types/azure.ts | 19 + packages/api/src/types/balance.ts | 9 + packages/api/src/types/bedrock.ts | 53 + packages/api/src/types/endpoints.ts | 64 + packages/api/src/types/error.ts | 27 + packages/api/src/types/events.ts | 4 + packages/api/src/types/files.ts | 161 + packages/api/src/types/google.ts | 30 + packages/api/src/types/http.ts | 21 + packages/api/src/types/index.ts | 16 + packages/api/src/types/mistral.ts | 82 + packages/api/src/types/openai.ts | 47 + packages/api/src/types/prompts.ts | 24 + packages/api/src/types/run.ts | 12 + packages/api/src/types/stream.ts | 49 + packages/api/src/types/tokens.ts | 17 + .../api/src/utils/__tests__/files.test.ts | 414 + packages/api/src/utils/axios.spec.ts | 131 + packages/api/src/utils/axios.ts | 90 + packages/api/src/utils/azure.spec.ts | 269 + packages/api/src/utils/azure.ts | 126 + packages/api/src/utils/common.spec.ts | 55 + packages/api/src/utils/common.ts | 59 + packages/api/src/utils/content.spec.ts | 200 + packages/api/src/utils/content.ts | 46 + packages/api/src/utils/email.ts | 16 + packages/api/src/utils/env.spec.ts | 1615 + packages/api/src/utils/env.ts | 460 + packages/api/src/utils/events.ts | 26 + packages/api/src/utils/files.spec.ts | 115 + packages/api/src/utils/files.ts | 154 + packages/api/src/utils/generators.ts | 75 + packages/api/src/utils/http.ts | 26 + packages/api/src/utils/index.ts | 25 + packages/api/src/utils/key.test.ts | 187 + packages/api/src/utils/key.ts | 139 + packages/api/src/utils/latex.spec.ts | 122 + packages/api/src/utils/latex.ts | 27 + packages/api/src/utils/llm.test.ts | 199 + packages/api/src/utils/llm.ts | 50 + .../api/src/utils/math.integration.spec.ts | 196 + packages/api/src/utils/math.spec.ts | 326 + packages/api/src/utils/math.ts | 57 + packages/api/src/utils/message.spec.ts | 122 + packages/api/src/utils/message.ts | 68 + packages/api/src/utils/oidc.spec.ts | 482 + packages/api/src/utils/oidc.ts | 176 + packages/api/src/utils/openid.ts | 51 + packages/api/src/utils/path.spec.ts | 97 + packages/api/src/utils/path.ts | 25 + packages/api/src/utils/promise.spec.ts | 115 + packages/api/src/utils/promise.ts | 42 + packages/api/src/utils/sanitizeTitle.spec.ts | 215 + packages/api/src/utils/sanitizeTitle.ts | 30 + .../api/src/utils/tempChatRetention.spec.ts | 137 + packages/api/src/utils/tempChatRetention.ts | 77 + packages/api/src/utils/text.spec.ts | 851 + packages/api/src/utils/text.ts | 87 + packages/api/src/utils/tokenizer.spec.ts | 143 + packages/api/src/utils/tokenizer.ts | 88 + packages/api/src/utils/tokens.ts | 578 + packages/api/src/utils/url.spec.ts | 156 + packages/api/src/utils/url.ts | 102 + packages/api/src/utils/yaml.ts | 11 + packages/api/src/web/index.ts | 1 + packages/api/src/web/web.spec.ts | 1230 + packages/api/src/web/web.ts | 206 + packages/api/tsconfig-paths-bootstrap.mjs | 23 + packages/api/tsconfig.build.json | 12 + packages/api/tsconfig.json | 33 + packages/api/tsconfig.spec.json | 10 + packages/client/babel.config.js | 24 + packages/client/jest.config.js | 29 + packages/client/jest.setup.ts | 159 + packages/client/package.json | 115 + packages/client/rollup.config.js | 82 + .../client/src/Providers/ToastContext.tsx | 21 + packages/client/src/Providers/index.ts | 2 + packages/client/src/common/enum.ts | 13 + packages/client/src/common/index.ts | 5 + packages/client/src/common/menus.ts | 39 + packages/client/src/common/types.ts | 28 + packages/client/src/components/Accordion.tsx | 50 + .../client/src/components/AlertDialog.tsx | 131 + .../client/src/components/AnimatePopover.css | 27 + .../src/components/AnimatedSearchInput.tsx | 82 + .../client/src/components/AnimatedTabs.css | 57 + .../client/src/components/AnimatedTabs.tsx | 162 + packages/client/src/components/Avatar.tsx | 102 + packages/client/src/components/Badge.tsx | 118 + packages/client/src/components/Breadcrumb.tsx | 100 + packages/client/src/components/Button.tsx | 57 + packages/client/src/components/Checkbox.tsx | 41 + .../client/src/components/CheckboxButton.tsx | 76 + .../client/src/components/Collapsible.tsx | 9 + packages/client/src/components/Combobox.tsx | 176 + .../client/src/components/ControlCombobox.tsx | 183 + packages/client/src/components/DataTable.tsx | 520 + .../DataTable/DataTable.hooks.spec.ts | 470 + .../components/DataTable/DataTable.hooks.ts | 135 + .../components/DataTable/DataTable.spec.tsx | 973 + .../src/components/DataTable/DataTable.tsx | 609 + .../components/DataTable/DataTable.types.ts | 124 + .../DataTable/DataTableComponents.spec.tsx | 362 + .../DataTable/DataTableComponents.tsx | 168 + .../DataTable/DataTableErrorBoundary.spec.tsx | 311 + .../DataTable/DataTableErrorBoundary.tsx | 122 + .../DataTable/DataTableSearch.spec.tsx | 178 + .../components/DataTable/DataTableSearch.tsx | 37 + .../client/src/components/DataTable/index.ts | 3 + .../client/src/components/DelayedRender.tsx | 12 + packages/client/src/components/Dialog.tsx | 170 + .../src/components/DialogTemplate.spec.tsx | 88 + .../client/src/components/DialogTemplate.tsx | 94 + packages/client/src/components/Dropdown.css | 78 + packages/client/src/components/Dropdown.tsx | 160 + .../client/src/components/DropdownMenu.tsx | 225 + .../client/src/components/DropdownNoState.tsx | 136 + .../client/src/components/DropdownPopup.tsx | 183 + packages/client/src/components/FileUpload.tsx | 29 + .../client/src/components/FilterInput.tsx | 54 + packages/client/src/components/FormInput.tsx | 67 + packages/client/src/components/HoverCard.tsx | 34 + .../client/src/components/InfoHoverCard.tsx | 36 + packages/client/src/components/Input.tsx | 21 + .../client/src/components/InputCombobox.tsx | 105 + .../client/src/components/InputNumber.tsx | 45 + packages/client/src/components/InputOTP.tsx | 73 + .../src/components/InputWithDropDown.tsx | 154 + packages/client/src/components/Label.tsx | 24 + .../client/src/components/MultiSearch.tsx | 155 + .../client/src/components/MultiSelect.tsx | 185 + .../src/components/OGDialogTemplate.tsx | 115 + .../client/src/components/OriginalDialog.tsx | 212 + packages/client/src/components/Pagination.tsx | 105 + packages/client/src/components/PixelCard.tsx | 380 + packages/client/src/components/Progress.tsx | 22 + .../client/src/components/QuestionMark.tsx | 16 + packages/client/src/components/Radio.tsx | 130 + packages/client/src/components/Resizable.tsx | 62 + .../client/src/components/SecretInput.tsx | 106 + packages/client/src/components/Select.tsx | 162 + .../client/src/components/SelectDropDown.tsx | 282 + packages/client/src/components/Separator.tsx | 28 + packages/client/src/components/Skeleton.tsx | 15 + packages/client/src/components/Slider.tsx | 57 + .../client/src/components/SplitText.spec.tsx | 25 + packages/client/src/components/SplitText.tsx | 171 + packages/client/src/components/Switch.tsx | 40 + packages/client/src/components/Table.tsx | 126 + packages/client/src/components/Tabs.tsx | 45 + packages/client/src/components/Tag.tsx | 50 + packages/client/src/components/Textarea.tsx | 24 + .../src/components/TextareaAutosize.tsx | 26 + .../client/src/components/ThemeSelector.tsx | 110 + packages/client/src/components/Toast.tsx | 63 + packages/client/src/components/Tooltip.css | 31 + packages/client/src/components/Tooltip.tsx | 113 + packages/client/src/components/index.ts | 56 + .../client/src/hooks/ThemeContext.old.tsx | 88 + packages/client/src/hooks/index.ts | 11 + packages/client/src/hooks/useAvatar.ts | 62 + packages/client/src/hooks/useCombobox.ts | 37 + .../client/src/hooks/useDelayedRender.tsx | 37 + packages/client/src/hooks/useLocalize.ts | 21 + packages/client/src/hooks/useMediaQuery.tsx | 17 + .../client/src/hooks/useOnClickOutside.ts | 41 + packages/client/src/hooks/useToast.ts | 58 + packages/client/src/index.ts | 24 + .../client/src/locales/Translation.spec.ts | 49 + .../client/src/locales/ar/translation.json | 3 + .../client/src/locales/ca/translation.json | 3 + .../client/src/locales/cs/translation.json | 3 + .../client/src/locales/da/translation.json | 3 + .../client/src/locales/de/translation.json | 3 + .../client/src/locales/en/translation.json | 32 + .../client/src/locales/es/translation.json | 3 + .../client/src/locales/et/translation.json | 3 + .../client/src/locales/fa/translation.json | 3 + .../client/src/locales/fi/translation.json | 3 + .../client/src/locales/fr/translation.json | 3 + .../client/src/locales/he/translation.json | 3 + .../client/src/locales/hu/translation.json | 3 + packages/client/src/locales/i18n.ts | 87 + .../client/src/locales/id/translation.json | 3 + .../client/src/locales/it/translation.json | 3 + .../client/src/locales/ja/translation.json | 3 + .../client/src/locales/ka/translation.json | 3 + .../client/src/locales/ko/translation.json | 3 + .../client/src/locales/nl/translation.json | 3 + .../client/src/locales/pl/translation.json | 3 + .../client/src/locales/pt-BR/translation.json | 3 + .../client/src/locales/pt-PT/translation.json | 3 + .../client/src/locales/ru/translation.json | 3 + .../client/src/locales/sv/translation.json | 3 + .../client/src/locales/th/translation.json | 3 + .../client/src/locales/tr/translation.json | 3 + .../client/src/locales/vi/translation.json | 3 + .../src/locales/zh-Hans/translation.json | 3 + .../src/locales/zh-Hant/translation.json | 3 + packages/client/src/store.ts | 20 + packages/client/src/svgs/AnthropicIcon.tsx | 47 + .../client/src/svgs/AnthropicMinimalIcon.tsx | 21 + packages/client/src/svgs/AppleIcon.tsx | 19 + packages/client/src/svgs/ArchiveIcon.tsx | 20 + packages/client/src/svgs/AssistantIcon.tsx | 32 + packages/client/src/svgs/AttachmentIcon.tsx | 20 + packages/client/src/svgs/AudioPaths.tsx | 41 + packages/client/src/svgs/AzureMinimalIcon.tsx | 32 + packages/client/src/svgs/BedrockIcon.tsx | 24 + packages/client/src/svgs/BirthdayIcon.tsx | 65 + packages/client/src/svgs/Blocks.tsx | 21 + packages/client/src/svgs/CautionIcon.tsx | 23 + .../client/src/svgs/ChatGPTMinimalIcon.tsx | 24 + packages/client/src/svgs/ChatIcon.tsx | 25 + packages/client/src/svgs/CheckMark.tsx | 25 + packages/client/src/svgs/CircleHelpIcon.tsx | 23 + packages/client/src/svgs/Clipboard.tsx | 24 + packages/client/src/svgs/CodePaths.tsx | 20 + packages/client/src/svgs/CodeyIcon.tsx | 27 + packages/client/src/svgs/ContinueIcon.tsx | 22 + packages/client/src/svgs/ConvoIcon.tsx | 22 + packages/client/src/svgs/CrossIcon.tsx | 23 + .../client/src/svgs/CustomMinimalIcon.tsx | 31 + packages/client/src/svgs/DarkModeIcon.tsx | 21 + packages/client/src/svgs/DataIcon.tsx | 20 + packages/client/src/svgs/DiscordIcon.tsx | 19 + packages/client/src/svgs/DislikeIcon.tsx | 21 + packages/client/src/svgs/DotsIcon.tsx | 27 + packages/client/src/svgs/EditIcon.tsx | 35 + packages/client/src/svgs/ExperimentIcon.tsx | 28 + packages/client/src/svgs/FacebookIcon.tsx | 28 + packages/client/src/svgs/FileIcon.tsx | 29 + packages/client/src/svgs/FilePaths.tsx | 20 + packages/client/src/svgs/GPTIcon.tsx | 31 + packages/client/src/svgs/GearIcon.tsx | 29 + packages/client/src/svgs/GeminiIcon.tsx | 37 + packages/client/src/svgs/GithubIcon.tsx | 12 + packages/client/src/svgs/GoogleIcon.tsx | 30 + packages/client/src/svgs/GoogleIconChat.tsx | 27 + .../client/src/svgs/GoogleMinimalIcon.tsx | 16 + packages/client/src/svgs/LightModeIcon.tsx | 29 + packages/client/src/svgs/LightningIcon.tsx | 21 + packages/client/src/svgs/LikeIcon.tsx | 21 + packages/client/src/svgs/LinkIcon.tsx | 20 + packages/client/src/svgs/ListeningIcon.tsx | 26 + packages/client/src/svgs/LockIcon.tsx | 20 + packages/client/src/svgs/LogOutIcon.tsx | 29 + packages/client/src/svgs/MCPIcon.tsx | 32 + packages/client/src/svgs/MessagesSquared.tsx | 22 + packages/client/src/svgs/MinimalPlugin.tsx | 26 + packages/client/src/svgs/MobileSidebar.tsx | 20 + packages/client/src/svgs/NewChatIcon.tsx | 22 + .../client/src/svgs/OpenAIMinimalIcon.tsx | 19 + packages/client/src/svgs/OpenIDIcon.tsx | 18 + packages/client/src/svgs/PaLMIcon.tsx | 51 + packages/client/src/svgs/PaLMinimalIcon.tsx | 26 + .../client/src/svgs/PersonalizationIcon.tsx | 20 + packages/client/src/svgs/PinIcon.tsx | 54 + packages/client/src/svgs/Plugin.tsx | 22 + packages/client/src/svgs/RegenerateIcon.tsx | 22 + packages/client/src/svgs/RenameIcon.tsx | 23 + packages/client/src/svgs/SamlIcon.tsx | 32 + packages/client/src/svgs/SaveIcon.tsx | 23 + packages/client/src/svgs/SendIcon.tsx | 22 + packages/client/src/svgs/SendMessageIcon.tsx | 19 + packages/client/src/svgs/SharePointIcon.tsx | 15 + packages/client/src/svgs/SheetPaths.tsx | 13 + packages/client/src/svgs/Sidebar.tsx | 20 + packages/client/src/svgs/Sparkles.tsx | 26 + packages/client/src/svgs/SpeechIcon.tsx | 30 + packages/client/src/svgs/Spinner.tsx | 68 + packages/client/src/svgs/SquirclePlusIcon.tsx | 20 + .../client/src/svgs/StopGeneratingIcon.tsx | 21 + packages/client/src/svgs/SunIcon.tsx | 29 + packages/client/src/svgs/SwitchIcon.tsx | 23 + packages/client/src/svgs/TextPaths.tsx | 41 + packages/client/src/svgs/ThumbDownIcon.tsx | 39 + packages/client/src/svgs/ThumbUpIcon.tsx | 39 + packages/client/src/svgs/TrashIcon.tsx | 29 + packages/client/src/svgs/UserIcon.tsx | 19 + packages/client/src/svgs/VectorIcon.tsx | 15 + packages/client/src/svgs/VideoPaths.tsx | 10 + packages/client/src/svgs/VolumeIcon.tsx | 22 + packages/client/src/svgs/VolumeMuteIcon.tsx | 22 + packages/client/src/svgs/XAIcon.tsx | 16 + packages/client/src/svgs/index.ts | 75 + packages/client/src/theme/README.md | 473 + packages/client/src/theme/atoms/themeAtoms.ts | 36 + .../src/theme/context/ThemeProvider.tsx | 165 + packages/client/src/theme/index.ts | 14 + packages/client/src/theme/themes/dark.ts | 72 + packages/client/src/theme/themes/default.ts | 72 + packages/client/src/theme/themes/index.ts | 2 + packages/client/src/theme/types/index.ts | 189 + packages/client/src/theme/utils/applyTheme.ts | 115 + .../src/theme/utils/createTailwindColors.js | 86 + packages/client/src/utils/index.ts | 3 + packages/client/src/utils/logger.ts | 49 + packages/client/src/utils/theme.ts | 38 + packages/client/src/utils/utils.ts | 7 + packages/client/tailwind.config.js | 13 + packages/client/tsconfig.json | 35 + packages/client/tsconfig.test.json | 20 + packages/data-provider/.gitignore | 2 + packages/data-provider/babel.config.js | 4 + packages/data-provider/check_updates.sh | 52 + packages/data-provider/jest.config.js | 18 + packages/data-provider/package.json | 77 + .../react-query/package-lock.json | 292 + .../data-provider/react-query/package.json | 10 + packages/data-provider/rollup.config.js | 74 + .../data-provider/server-rollup.config.js | 40 + packages/data-provider/specs/actions.spec.ts | 2457 + packages/data-provider/specs/azure.spec.ts | 844 + packages/data-provider/specs/bedrock.spec.ts | 166 + .../data-provider/specs/filetypes.spec.ts | 175 + packages/data-provider/specs/generate.spec.ts | 770 + packages/data-provider/specs/openapiSpecs.ts | 524 + packages/data-provider/specs/parsers.spec.ts | 261 + packages/data-provider/specs/utils.spec.ts | 129 + .../data-provider/src/accessPermissions.ts | 331 + packages/data-provider/src/actions.ts | 808 + packages/data-provider/src/actions.ts.orig | 808 + packages/data-provider/src/actions.ts.rej | 24 + packages/data-provider/src/api-endpoints.ts | 401 + packages/data-provider/src/artifacts.ts | 3104 ++ packages/data-provider/src/azure.ts | 328 + packages/data-provider/src/bedrock.ts | 277 + packages/data-provider/src/config.ts | 1889 + packages/data-provider/src/createPayload.ts | 46 + packages/data-provider/src/data-service.ts | 1054 + packages/data-provider/src/feedback.ts | 141 + .../data-provider/src/file-config.spec.ts | 1097 + packages/data-provider/src/file-config.ts | 695 + packages/data-provider/src/generate.ts | 634 + packages/data-provider/src/headers-helpers.ts | 9 + packages/data-provider/src/index.ts | 49 + packages/data-provider/src/keys.ts | 95 + packages/data-provider/src/mcp.ts | 239 + packages/data-provider/src/messages.ts | 50 + packages/data-provider/src/models.ts | 67 + .../data-provider/src/parameterSettings.ts | 991 + packages/data-provider/src/parsers.ts | 553 + packages/data-provider/src/permissions.ts | 175 + .../data-provider/src/react-query/index.ts | 1 + .../src/react-query/react-query-service.ts | 526 + packages/data-provider/src/request.ts | 165 + packages/data-provider/src/roles.ts | 191 + packages/data-provider/src/schemas.spec.ts | 341 + packages/data-provider/src/schemas.ts | 1160 + packages/data-provider/src/types.ts | 656 + packages/data-provider/src/types/agents.ts | 445 + .../data-provider/src/types/assistants.ts | 608 + packages/data-provider/src/types/files.ts | 190 + packages/data-provider/src/types/graph.ts | 145 + packages/data-provider/src/types/index.ts | 2 + .../data-provider/src/types/mcpServers.ts | 49 + packages/data-provider/src/types/mutations.ts | 413 + packages/data-provider/src/types/queries.ts | 208 + packages/data-provider/src/types/runs.ts | 26 + packages/data-provider/src/types/web.ts | 588 + packages/data-provider/src/utils.ts | 62 + packages/data-provider/tsconfig.json | 28 + packages/data-provider/tsconfig.spec.json | 10 + packages/data-schemas/.gitignore | 2 + packages/data-schemas/LICENSE | 21 + packages/data-schemas/README.md | 318 + packages/data-schemas/babel.config.cjs | 4 + packages/data-schemas/jest.config.mjs | 20 + packages/data-schemas/package.json | 81 + packages/data-schemas/rollup.config.js | 40 + packages/data-schemas/src/app/agents.ts | 24 + packages/data-schemas/src/app/assistants.ts | 70 + packages/data-schemas/src/app/azure.ts | 71 + packages/data-schemas/src/app/endpoints.ts | 81 + packages/data-schemas/src/app/index.ts | 7 + packages/data-schemas/src/app/interface.ts | 61 + packages/data-schemas/src/app/memory.ts | 28 + packages/data-schemas/src/app/ocr.ts | 15 + packages/data-schemas/src/app/service.ts | 117 + packages/data-schemas/src/app/specs.ts | 86 + packages/data-schemas/src/app/turnstile.ts | 45 + packages/data-schemas/src/app/vertex.ts | 198 + packages/data-schemas/src/app/web.spec.ts | 173 + packages/data-schemas/src/app/web.ts | 90 + packages/data-schemas/src/common/enum.ts | 15 + packages/data-schemas/src/common/index.ts | 2 + .../data-schemas/src/common/pagination.ts | 17 + .../data-schemas/src/config/meiliLogger.ts | 75 + packages/data-schemas/src/config/parsers.ts | 252 + packages/data-schemas/src/config/utils.ts | 37 + packages/data-schemas/src/config/winston.ts | 120 + packages/data-schemas/src/crypto/index.ts | 175 + packages/data-schemas/src/index.ts | 11 + .../src/methods/accessRole.spec.ts | 323 + .../data-schemas/src/methods/accessRole.ts | 223 + .../data-schemas/src/methods/aclEntry.spec.ts | 962 + packages/data-schemas/src/methods/aclEntry.ts | 364 + .../data-schemas/src/methods/agentCategory.ts | 265 + .../data-schemas/src/methods/file.spec.ts | 530 + packages/data-schemas/src/methods/file.ts | 272 + packages/data-schemas/src/methods/index.ts | 76 + packages/data-schemas/src/methods/key.ts | 160 + .../src/methods/mcpServer.spec.ts | 827 + .../data-schemas/src/methods/mcpServer.ts | 324 + packages/data-schemas/src/methods/memory.ts | 170 + .../data-schemas/src/methods/pluginAuth.ts | 148 + packages/data-schemas/src/methods/role.ts | 48 + packages/data-schemas/src/methods/session.ts | 275 + .../data-schemas/src/methods/share.test.ts | 1240 + packages/data-schemas/src/methods/share.ts | 563 + .../data-schemas/src/methods/token.spec.ts | 822 + packages/data-schemas/src/methods/token.ts | 129 + .../src/methods/user.methods.spec.ts | 623 + .../data-schemas/src/methods/user.test.ts | 128 + packages/data-schemas/src/methods/user.ts | 338 + .../src/methods/userGroup.methods.spec.ts | 620 + .../src/methods/userGroup.roles.spec.ts | 383 + .../src/methods/userGroup.spec.ts | 562 + .../data-schemas/src/methods/userGroup.ts | 610 + .../data-schemas/src/models/accessRole.ts | 11 + packages/data-schemas/src/models/aclEntry.ts | 9 + packages/data-schemas/src/models/action.ts | 9 + packages/data-schemas/src/models/agent.ts | 9 + .../data-schemas/src/models/agentCategory.ts | 12 + packages/data-schemas/src/models/assistant.ts | 9 + packages/data-schemas/src/models/balance.ts | 9 + packages/data-schemas/src/models/banner.ts | 9 + .../src/models/conversationTag.ts | 11 + packages/data-schemas/src/models/convo.ts | 22 + packages/data-schemas/src/models/file.ts | 9 + packages/data-schemas/src/models/group.ts | 9 + packages/data-schemas/src/models/index.ts | 64 + packages/data-schemas/src/models/key.ts | 8 + packages/data-schemas/src/models/mcpServer.ts | 11 + packages/data-schemas/src/models/memory.ts | 6 + packages/data-schemas/src/models/message.ts | 20 + .../data-schemas/src/models/pluginAuth.ts | 9 + .../src/models/plugins/mongoMeili.spec.ts | 628 + .../src/models/plugins/mongoMeili.ts | 720 + packages/data-schemas/src/models/preset.ts | 8 + packages/data-schemas/src/models/project.ts | 8 + packages/data-schemas/src/models/prompt.ts | 9 + .../data-schemas/src/models/promptGroup.ts | 12 + packages/data-schemas/src/models/role.ts | 9 + packages/data-schemas/src/models/session.ts | 9 + .../data-schemas/src/models/sharedLink.ts | 8 + packages/data-schemas/src/models/token.ts | 9 + packages/data-schemas/src/models/toolCall.ts | 8 + .../data-schemas/src/models/transaction.ts | 10 + packages/data-schemas/src/models/user.ts | 9 + .../data-schemas/src/schema/accessRole.ts | 31 + packages/data-schemas/src/schema/aclEntry.ts | 66 + packages/data-schemas/src/schema/action.ts | 52 + packages/data-schemas/src/schema/agent.ts | 130 + .../data-schemas/src/schema/agentCategory.ts | 47 + packages/data-schemas/src/schema/assistant.ts | 39 + packages/data-schemas/src/schema/balance.ts | 41 + packages/data-schemas/src/schema/banner.ts | 48 + .../data-schemas/src/schema/categories.ts | 21 + .../src/schema/conversationTag.ts | 41 + packages/data-schemas/src/schema/convo.ts | 51 + packages/data-schemas/src/schema/defaults.ts | 157 + packages/data-schemas/src/schema/file.ts | 85 + packages/data-schemas/src/schema/group.ts | 57 + packages/data-schemas/src/schema/index.ts | 26 + packages/data-schemas/src/schema/key.ts | 31 + packages/data-schemas/src/schema/mcpServer.ts | 31 + packages/data-schemas/src/schema/memory.ts | 33 + packages/data-schemas/src/schema/message.ts | 158 + .../data-schemas/src/schema/pluginAuth.ts | 25 + packages/data-schemas/src/schema/preset.ts | 85 + packages/data-schemas/src/schema/project.ts | 34 + packages/data-schemas/src/schema/prompt.ts | 34 + .../data-schemas/src/schema/promptGroup.ts | 70 + packages/data-schemas/src/schema/role.ts | 75 + packages/data-schemas/src/schema/session.ts | 21 + packages/data-schemas/src/schema/share.ts | 49 + packages/data-schemas/src/schema/token.ts | 40 + packages/data-schemas/src/schema/toolCall.ts | 55 + .../data-schemas/src/schema/transaction.ts | 61 + packages/data-schemas/src/schema/user.ts | 164 + packages/data-schemas/src/types/accessRole.ts | 18 + packages/data-schemas/src/types/aclEntry.ts | 30 + packages/data-schemas/src/types/action.ts | 28 + packages/data-schemas/src/types/agent.ts | 45 + .../data-schemas/src/types/agentCategory.ts | 21 + packages/data-schemas/src/types/app.ts | 122 + packages/data-schemas/src/types/assistant.ts | 15 + packages/data-schemas/src/types/balance.ts | 12 + packages/data-schemas/src/types/banner.ts | 11 + packages/data-schemas/src/types/convo.ts | 58 + packages/data-schemas/src/types/file.ts | 27 + packages/data-schemas/src/types/group.ts | 44 + packages/data-schemas/src/types/index.ts | 31 + packages/data-schemas/src/types/mcp.ts | 12 + packages/data-schemas/src/types/memory.ts | 48 + packages/data-schemas/src/types/message.ts | 46 + packages/data-schemas/src/types/pluginAuth.ts | 41 + packages/data-schemas/src/types/prompts.ts | 27 + packages/data-schemas/src/types/role.ts | 82 + packages/data-schemas/src/types/session.ts | 49 + packages/data-schemas/src/types/share.ts | 67 + packages/data-schemas/src/types/token.ts | 43 + packages/data-schemas/src/types/user.ts | 106 + packages/data-schemas/src/types/web.ts | 17 + packages/data-schemas/src/utils/index.ts | 1 + .../data-schemas/src/utils/object-traverse.ts | 178 + .../data-schemas/src/utils/transactions.ts | 55 + packages/data-schemas/tsconfig.json | 23 + packages/data-schemas/tsconfig.spec.json | 10 + rag.yml | 31 + redis-config/README.md | 408 + redis-config/certs/ca-cert.srl | 1 + redis-config/certs/dump.rdb | Bin 0 -> 11572 bytes redis-config/certs/redis.dh | 8 + redis-config/certs/server.conf | 16 + redis-config/redis-7001.conf | 27 + redis-config/redis-7002.conf | 27 + redis-config/redis-7003.conf | 27 + redis-config/redis-tls.conf | 31 + redis-config/start-cluster.sh | 93 + redis-config/start-redis-tls.sh | 13 + redis-config/stop-cluster.sh | 69 + src/tests/oidc-integration.test.ts | 473 + start-backend.sh | 5 + start-dev.sh | 17 + stop-backend.sh | 8 + utils/docker/docker-build.sh | 21 + utils/docker/docker-push.sh | 31 + utils/docker/test-compose.yml | 66 + utils/update_env.py | 94 + 2391 files changed, 457215 insertions(+) create mode 100644 .gitignore create mode 100644 CHANGELOG.md create mode 100644 Dockerfile create mode 100644 Dockerfile.multi create mode 100644 INSTALLATION.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 RESUME.txt create mode 100644 api/app/clients/BaseClient.js create mode 100644 api/app/clients/OllamaClient.js create mode 100644 api/app/clients/TextStream.js create mode 100644 api/app/clients/index.js create mode 100644 api/app/clients/prompts/artifacts.js create mode 100644 api/app/clients/prompts/createContextHandlers.js create mode 100644 api/app/clients/prompts/createVisionPrompt.js create mode 100644 api/app/clients/prompts/formatAgentMessages.spec.js create mode 100644 api/app/clients/prompts/formatGoogleInputs.js create mode 100644 api/app/clients/prompts/formatGoogleInputs.spec.js create mode 100644 api/app/clients/prompts/formatMessages.js create mode 100644 api/app/clients/prompts/formatMessages.spec.js create mode 100644 api/app/clients/prompts/index.js create mode 100644 api/app/clients/prompts/shadcn-docs/components.js create mode 100644 api/app/clients/prompts/shadcn-docs/generate.js create mode 100644 api/app/clients/prompts/summaryPrompts.js create mode 100644 api/app/clients/prompts/truncate.js create mode 100644 api/app/clients/specs/BaseClient.test.js create mode 100644 api/app/clients/specs/FakeClient.js create mode 100644 api/app/clients/tools/index.js create mode 100644 api/app/clients/tools/manifest.js create mode 100644 api/app/clients/tools/manifest.json create mode 100644 api/app/clients/tools/structured/AzureAISearch.js create mode 100644 api/app/clients/tools/structured/DALLE3.js create mode 100644 api/app/clients/tools/structured/FluxAPI.js create mode 100644 api/app/clients/tools/structured/GeminiImageGen.js create mode 100644 api/app/clients/tools/structured/GoogleSearch.js create mode 100644 api/app/clients/tools/structured/OpenAIImageTools.js create mode 100644 api/app/clients/tools/structured/OpenWeather.js create mode 100644 api/app/clients/tools/structured/StableDiffusion.js create mode 100644 api/app/clients/tools/structured/TavilySearch.js create mode 100644 api/app/clients/tools/structured/TavilySearchResults.js create mode 100644 api/app/clients/tools/structured/TraversaalSearch.js create mode 100644 api/app/clients/tools/structured/Wolfram.js create mode 100644 api/app/clients/tools/structured/credentials.js create mode 100644 api/app/clients/tools/structured/specs/DALLE3-proxy.spec.js create mode 100644 api/app/clients/tools/structured/specs/DALLE3.spec.js create mode 100644 api/app/clients/tools/structured/specs/GeminiImageGen-proxy.spec.js create mode 100644 api/app/clients/tools/structured/specs/GoogleSearch.spec.js create mode 100644 api/app/clients/tools/structured/specs/TavilySearchResults.spec.js create mode 100644 api/app/clients/tools/structured/specs/openWeather.integration.test.js create mode 100644 api/app/clients/tools/structured/specs/openweather.test.js create mode 100644 api/app/clients/tools/util/fileSearch.js create mode 100644 api/app/clients/tools/util/handleTools.js create mode 100644 api/app/clients/tools/util/handleTools.test.js create mode 100644 api/app/clients/tools/util/index.js create mode 100644 api/app/index.js create mode 100644 api/cache/banViolation.js create mode 100644 api/cache/banViolation.spec.js create mode 100644 api/cache/clearPendingReq.js create mode 100644 api/cache/getLogStores.js create mode 100644 api/cache/index.js create mode 100644 api/cache/logViolation.js create mode 100644 api/config/index.js create mode 100644 api/config/meiliLogger.js create mode 100644 api/config/parsers.js create mode 100644 api/config/paths.js create mode 100644 api/config/winston.js create mode 100644 api/db/connect.js create mode 100644 api/db/index.js create mode 100644 api/db/indexSync.js create mode 100644 api/db/indexSync.spec.js create mode 100644 api/db/models.js create mode 100644 api/db/utils.js create mode 100644 api/db/utils.spec.js create mode 100644 api/jest.config.js create mode 100644 api/jsconfig.json create mode 100644 api/models/Action.js create mode 100644 api/models/Agent.js create mode 100644 api/models/Agent.spec.js create mode 100644 api/models/Assistant.js create mode 100644 api/models/Banner.js create mode 100644 api/models/Categories.js create mode 100644 api/models/Conversation.js create mode 100644 api/models/Conversation.spec.js create mode 100644 api/models/ConversationTag.js create mode 100644 api/models/File.js create mode 100644 api/models/File.spec.js create mode 100644 api/models/Message.js create mode 100644 api/models/Message.spec.js create mode 100644 api/models/Preset.js create mode 100644 api/models/Project.js create mode 100644 api/models/Prompt.js create mode 100644 api/models/Prompt.spec.js create mode 100644 api/models/PromptGroupMigration.spec.js create mode 100644 api/models/Role.js create mode 100644 api/models/Role.spec.js create mode 100644 api/models/ToolCall.js create mode 100644 api/models/Transaction.js create mode 100644 api/models/Transaction.spec.js create mode 100644 api/models/balanceMethods.js create mode 100644 api/models/convoStructure.spec.js create mode 100644 api/models/index.js create mode 100644 api/models/interface.js create mode 100644 api/models/inviteUser.js create mode 100644 api/models/loadAddedAgent.js create mode 100644 api/models/spendTokens.js create mode 100644 api/models/spendTokens.spec.js create mode 100644 api/models/tx.js create mode 100644 api/models/tx.spec.js create mode 100644 api/models/userMethods.js create mode 100644 api/package.json create mode 100644 api/server/cleanup.js create mode 100644 api/server/controllers/AuthController.js create mode 100644 api/server/controllers/Balance.js create mode 100644 api/server/controllers/EndpointController.js create mode 100644 api/server/controllers/FavoritesController.js create mode 100644 api/server/controllers/ModelController.js create mode 100644 api/server/controllers/PermissionsController.js create mode 100644 api/server/controllers/PluginController.js create mode 100644 api/server/controllers/PluginController.spec.js create mode 100644 api/server/controllers/TwoFactorController.js create mode 100644 api/server/controllers/UserController.js create mode 100644 api/server/controllers/agents/__tests__/callbacks.spec.js create mode 100644 api/server/controllers/agents/__tests__/jobReplacement.spec.js create mode 100644 api/server/controllers/agents/__tests__/v1.spec.js create mode 100644 api/server/controllers/agents/callbacks.js create mode 100644 api/server/controllers/agents/client.js create mode 100644 api/server/controllers/agents/client.test.js create mode 100644 api/server/controllers/agents/errors.js create mode 100644 api/server/controllers/agents/recordCollectedUsage.spec.js create mode 100644 api/server/controllers/agents/request.js create mode 100644 api/server/controllers/agents/v1.js create mode 100644 api/server/controllers/agents/v1.spec.js create mode 100644 api/server/controllers/assistants/chatV1.js create mode 100644 api/server/controllers/assistants/chatV2.js create mode 100644 api/server/controllers/assistants/errors.js create mode 100644 api/server/controllers/assistants/helpers.js create mode 100644 api/server/controllers/assistants/v1.js create mode 100644 api/server/controllers/assistants/v2.js create mode 100644 api/server/controllers/auth/LoginController.js create mode 100644 api/server/controllers/auth/LogoutController.js create mode 100644 api/server/controllers/auth/TwoFactorAuthController.js create mode 100644 api/server/controllers/mcp.js create mode 100644 api/server/controllers/tools.js create mode 100644 api/server/experimental.js create mode 100644 api/server/index.js create mode 100644 api/server/index.js.backup create mode 100644 api/server/index.spec.js create mode 100644 api/server/middleware/abortMiddleware.js create mode 100644 api/server/middleware/abortMiddleware.spec.js create mode 100644 api/server/middleware/abortRun.js create mode 100644 api/server/middleware/accessResources/canAccessAgentFromBody.js create mode 100644 api/server/middleware/accessResources/canAccessAgentResource.js create mode 100644 api/server/middleware/accessResources/canAccessAgentResource.spec.js create mode 100644 api/server/middleware/accessResources/canAccessMCPServerResource.js create mode 100644 api/server/middleware/accessResources/canAccessMCPServerResource.spec.js create mode 100644 api/server/middleware/accessResources/canAccessPromptGroupResource.js create mode 100644 api/server/middleware/accessResources/canAccessPromptViaGroup.js create mode 100644 api/server/middleware/accessResources/canAccessResource.js create mode 100644 api/server/middleware/accessResources/fileAccess.js create mode 100644 api/server/middleware/accessResources/fileAccess.spec.js create mode 100644 api/server/middleware/accessResources/index.js create mode 100644 api/server/middleware/assistants/validate.js create mode 100644 api/server/middleware/assistants/validateAuthor.js create mode 100644 api/server/middleware/buildEndpointOption.js create mode 100644 api/server/middleware/canDeleteAccount.js create mode 100644 api/server/middleware/checkBan.js create mode 100644 api/server/middleware/checkDomainAllowed.js create mode 100644 api/server/middleware/checkInviteUser.js create mode 100644 api/server/middleware/checkPeoplePickerAccess.js create mode 100644 api/server/middleware/checkPeoplePickerAccess.spec.js create mode 100644 api/server/middleware/checkSharePublicAccess.js create mode 100644 api/server/middleware/checkSharePublicAccess.spec.js create mode 100644 api/server/middleware/config/app.js create mode 100644 api/server/middleware/denyRequest.js create mode 100644 api/server/middleware/error.js create mode 100644 api/server/middleware/index.js create mode 100644 api/server/middleware/limiters/forkLimiters.js create mode 100644 api/server/middleware/limiters/importLimiters.js create mode 100644 api/server/middleware/limiters/index.js create mode 100644 api/server/middleware/limiters/loginLimiter.js create mode 100644 api/server/middleware/limiters/messageLimiters.js create mode 100644 api/server/middleware/limiters/registerLimiter.js create mode 100644 api/server/middleware/limiters/resetPasswordLimiter.js create mode 100644 api/server/middleware/limiters/sttLimiters.js create mode 100644 api/server/middleware/limiters/toolCallLimiter.js create mode 100644 api/server/middleware/limiters/ttsLimiters.js create mode 100644 api/server/middleware/limiters/uploadLimiters.js create mode 100644 api/server/middleware/limiters/verifyEmailLimiter.js create mode 100644 api/server/middleware/logHeaders.js create mode 100644 api/server/middleware/moderateText.js create mode 100644 api/server/middleware/noIndex.js create mode 100644 api/server/middleware/optionalJwtAuth.js create mode 100644 api/server/middleware/requireJwtAuth.js create mode 100644 api/server/middleware/requireLdapAuth.js create mode 100644 api/server/middleware/requireLocalAuth.js create mode 100644 api/server/middleware/roles/access.spec.js create mode 100644 api/server/middleware/roles/admin.js create mode 100644 api/server/middleware/roles/index.js create mode 100644 api/server/middleware/setHeaders.js create mode 100644 api/server/middleware/spec/validateImages.spec.js create mode 100644 api/server/middleware/uaParser.js create mode 100644 api/server/middleware/validate/convoAccess.js create mode 100644 api/server/middleware/validate/index.js create mode 100644 api/server/middleware/validateImageRequest.js create mode 100644 api/server/middleware/validateMessageReq.js create mode 100644 api/server/middleware/validateModel.js create mode 100644 api/server/middleware/validatePasswordReset.js create mode 100644 api/server/middleware/validateRegistration.js create mode 100644 api/server/routes/__tests__/config.spec.js create mode 100644 api/server/routes/__tests__/convos.spec.js create mode 100644 api/server/routes/__tests__/ldap.spec.js create mode 100644 api/server/routes/__tests__/mcp.spec.js create mode 100644 api/server/routes/__tests__/static.spec.js create mode 100644 api/server/routes/accessPermissions.js create mode 100644 api/server/routes/accessPermissions.test.js create mode 100644 api/server/routes/actions.js create mode 100644 api/server/routes/agents/__tests__/abort.spec.js create mode 100644 api/server/routes/agents/actions.js create mode 100644 api/server/routes/agents/chat.js create mode 100644 api/server/routes/agents/index.js create mode 100644 api/server/routes/agents/tools.js create mode 100644 api/server/routes/agents/v1.js create mode 100644 api/server/routes/assistants/actions.js create mode 100644 api/server/routes/assistants/chatV1.js create mode 100644 api/server/routes/assistants/chatV2.js create mode 100644 api/server/routes/assistants/documents.js create mode 100644 api/server/routes/assistants/index.js create mode 100644 api/server/routes/assistants/tools.js create mode 100644 api/server/routes/assistants/v1.js create mode 100644 api/server/routes/assistants/v2.js create mode 100644 api/server/routes/auth.js create mode 100644 api/server/routes/balance.js create mode 100644 api/server/routes/banner.js create mode 100644 api/server/routes/categories.js create mode 100644 api/server/routes/config.js create mode 100644 api/server/routes/convos.js create mode 100644 api/server/routes/endpoints.js create mode 100644 api/server/routes/files/avatar.js create mode 100644 api/server/routes/files/files.agents.test.js create mode 100644 api/server/routes/files/files.js create mode 100644 api/server/routes/files/files.test.js create mode 100644 api/server/routes/files/images.js create mode 100644 api/server/routes/files/index.js create mode 100644 api/server/routes/files/multer.js create mode 100644 api/server/routes/files/multer.spec.js create mode 100644 api/server/routes/files/speech/customConfigSpeech.js create mode 100644 api/server/routes/files/speech/index.js create mode 100644 api/server/routes/files/speech/stt.js create mode 100644 api/server/routes/files/speech/tts.js create mode 100644 api/server/routes/index.js create mode 100644 api/server/routes/keys.js create mode 100644 api/server/routes/mcp.js create mode 100644 api/server/routes/memories.js create mode 100644 api/server/routes/messages.js create mode 100644 api/server/routes/models.js create mode 100644 api/server/routes/oauth.js create mode 100644 api/server/routes/presets.js create mode 100644 api/server/routes/prompts.js create mode 100644 api/server/routes/prompts.test.js create mode 100644 api/server/routes/roles.js create mode 100644 api/server/routes/search.js create mode 100644 api/server/routes/settings.js create mode 100644 api/server/routes/share.js create mode 100644 api/server/routes/static.js create mode 100644 api/server/routes/tags.js create mode 100644 api/server/routes/types/assistants.js create mode 100644 api/server/routes/user.js create mode 100644 api/server/services/ActionService.js create mode 100644 api/server/services/ActionService.spec.js create mode 100644 api/server/services/Artifacts/update.js create mode 100644 api/server/services/Artifacts/update.spec.js create mode 100644 api/server/services/AssistantService.js create mode 100644 api/server/services/AuthService.js create mode 100644 api/server/services/Config/EndpointService.js create mode 100644 api/server/services/Config/__tests__/getCachedTools.spec.js create mode 100644 api/server/services/Config/app.js create mode 100644 api/server/services/Config/getCachedTools.js create mode 100644 api/server/services/Config/getEndpointsConfig.js create mode 100644 api/server/services/Config/index.js create mode 100644 api/server/services/Config/ldap.js create mode 100644 api/server/services/Config/loadAsyncEndpoints.js create mode 100644 api/server/services/Config/loadConfigModels.js create mode 100644 api/server/services/Config/loadConfigModels.spec.js create mode 100644 api/server/services/Config/loadCustomConfig.js create mode 100644 api/server/services/Config/loadCustomConfig.spec.js create mode 100644 api/server/services/Config/loadDefaultEConfig.js create mode 100644 api/server/services/Config/loadDefaultModels.js create mode 100644 api/server/services/Config/mcp.js create mode 100644 api/server/services/Endpoints/agents/addedConvo.js create mode 100644 api/server/services/Endpoints/agents/build.js create mode 100644 api/server/services/Endpoints/agents/index.js create mode 100644 api/server/services/Endpoints/agents/initialize.js create mode 100644 api/server/services/Endpoints/agents/title.js create mode 100644 api/server/services/Endpoints/assistants/build.js create mode 100644 api/server/services/Endpoints/assistants/index.js create mode 100644 api/server/services/Endpoints/assistants/initalize.js create mode 100644 api/server/services/Endpoints/assistants/title.js create mode 100644 api/server/services/Endpoints/azureAssistants/build.js create mode 100644 api/server/services/Endpoints/azureAssistants/index.js create mode 100644 api/server/services/Endpoints/azureAssistants/initialize.js create mode 100644 api/server/services/Endpoints/index.js create mode 100644 api/server/services/Files/Audio/STTService.js create mode 100644 api/server/services/Files/Audio/TTSService.js create mode 100644 api/server/services/Files/Audio/getCustomConfigSpeech.js create mode 100644 api/server/services/Files/Audio/getVoices.js create mode 100644 api/server/services/Files/Audio/index.js create mode 100644 api/server/services/Files/Audio/streamAudio.js create mode 100644 api/server/services/Files/Audio/streamAudio.spec.js create mode 100644 api/server/services/Files/Azure/crud.js create mode 100644 api/server/services/Files/Azure/images.js create mode 100644 api/server/services/Files/Azure/index.js create mode 100644 api/server/services/Files/Citations/index.js create mode 100644 api/server/services/Files/Code/crud.js create mode 100644 api/server/services/Files/Code/index.js create mode 100644 api/server/services/Files/Code/process.js create mode 100644 api/server/services/Files/Firebase/crud.js create mode 100644 api/server/services/Files/Firebase/images.js create mode 100644 api/server/services/Files/Firebase/index.js create mode 100644 api/server/services/Files/Local/crud.js create mode 100644 api/server/services/Files/Local/images.js create mode 100644 api/server/services/Files/Local/index.js create mode 100644 api/server/services/Files/OpenAI/crud.js create mode 100644 api/server/services/Files/OpenAI/index.js create mode 100644 api/server/services/Files/S3/crud.js create mode 100644 api/server/services/Files/S3/images.js create mode 100644 api/server/services/Files/S3/index.js create mode 100644 api/server/services/Files/VectorDB/crud.js create mode 100644 api/server/services/Files/VectorDB/index.js create mode 100644 api/server/services/Files/images/avatar.js create mode 100644 api/server/services/Files/images/convert.js create mode 100644 api/server/services/Files/images/encode.js create mode 100644 api/server/services/Files/images/index.js create mode 100644 api/server/services/Files/images/resize.js create mode 100644 api/server/services/Files/index.js create mode 100644 api/server/services/Files/permissions.js create mode 100644 api/server/services/Files/process.js create mode 100644 api/server/services/Files/strategies.js create mode 100644 api/server/services/GraphApiService.js create mode 100644 api/server/services/GraphApiService.spec.js create mode 100644 api/server/services/GraphTokenService.js create mode 100644 api/server/services/MCP.js create mode 100644 api/server/services/MCP.spec.js create mode 100644 api/server/services/PermissionService.js create mode 100644 api/server/services/PermissionService.spec.js create mode 100644 api/server/services/PluginService.js create mode 100644 api/server/services/Runs/RunManager.js create mode 100644 api/server/services/Runs/StreamRunManager.js create mode 100644 api/server/services/Runs/handle.js create mode 100644 api/server/services/Runs/index.js create mode 100644 api/server/services/Runs/methods.js create mode 100644 api/server/services/Threads/index.js create mode 100644 api/server/services/Threads/manage.js create mode 100644 api/server/services/Threads/processMessages.spec.js create mode 100644 api/server/services/ToolService.js create mode 100644 api/server/services/Tools/credentials.js create mode 100644 api/server/services/Tools/mcp.js create mode 100644 api/server/services/Tools/search.js create mode 100644 api/server/services/cleanup.js create mode 100644 api/server/services/createRunBody.js create mode 100644 api/server/services/initializeMCPs.js create mode 100644 api/server/services/initializeMCPs.spec.js create mode 100644 api/server/services/initializeOAuthReconnectManager.js create mode 100644 api/server/services/start/migration.js create mode 100644 api/server/services/start/tools.js create mode 100644 api/server/services/twoFactorService.js create mode 100644 api/server/socialLogins.js create mode 100644 api/server/utils/__tests__/staticCache.spec.js create mode 100644 api/server/utils/emails/inviteUser.handlebars create mode 100644 api/server/utils/emails/passwordReset.handlebars create mode 100644 api/server/utils/emails/requestPasswordReset.handlebars create mode 100644 api/server/utils/emails/verifyEmail.handlebars create mode 100644 api/server/utils/files.js create mode 100644 api/server/utils/getFileStrategy.js create mode 100644 api/server/utils/handleText.js create mode 100644 api/server/utils/import/__data__/chatbotui-export.json create mode 100644 api/server/utils/import/__data__/chatgpt-citations.json create mode 100644 api/server/utils/import/__data__/chatgpt-export.json create mode 100644 api/server/utils/import/__data__/chatgpt-tree.json create mode 100644 api/server/utils/import/__data__/librechat-export.json create mode 100644 api/server/utils/import/__data__/librechat-linear.json create mode 100644 api/server/utils/import/__data__/librechat-opts-nonr-branches.json create mode 100644 api/server/utils/import/__data__/librechat-tree.json create mode 100644 api/server/utils/import/fork.js create mode 100644 api/server/utils/import/fork.spec.js create mode 100644 api/server/utils/import/importBatchBuilder.js create mode 100644 api/server/utils/import/importConversations.js create mode 100644 api/server/utils/import/importers-timestamp.spec.js create mode 100644 api/server/utils/import/importers.js create mode 100644 api/server/utils/import/importers.spec.js create mode 100644 api/server/utils/import/index.js create mode 100644 api/server/utils/index.js create mode 100644 api/server/utils/queue.js create mode 100644 api/server/utils/removePorts.js create mode 100644 api/server/utils/sendEmail.js create mode 100644 api/server/utils/staticCache.js create mode 100644 api/strategies/appleStrategy.js create mode 100644 api/strategies/appleStrategy.test.js create mode 100644 api/strategies/discordStrategy.js create mode 100644 api/strategies/facebookStrategy.js create mode 100644 api/strategies/githubStrategy.js create mode 100644 api/strategies/googleStrategy.js create mode 100644 api/strategies/index.js create mode 100644 api/strategies/jwtStrategy.js create mode 100644 api/strategies/ldapStrategy.js create mode 100644 api/strategies/ldapStrategy.spec.js create mode 100644 api/strategies/localStrategy.js create mode 100644 api/strategies/openIdJwtStrategy.js create mode 100644 api/strategies/openidStrategy.js create mode 100644 api/strategies/openidStrategy.spec.js create mode 100644 api/strategies/process.js create mode 100644 api/strategies/process.test.js create mode 100644 api/strategies/samlStrategy.js create mode 100644 api/strategies/samlStrategy.spec.js create mode 100644 api/strategies/socialLogin.js create mode 100644 api/strategies/socialLogin.test.js create mode 100644 api/strategies/validators.js create mode 100644 api/strategies/validators.spec.js create mode 100644 api/test/.env.test.example create mode 100644 api/test/__mocks__/auth.mock.json create mode 100644 api/test/__mocks__/logger.js create mode 100644 api/test/__mocks__/openid-client-passport.js create mode 100644 api/test/__mocks__/openid-client.js create mode 100644 api/test/app/clients/tools/structured/OpenAIImageTools.test.js create mode 100644 api/test/app/clients/tools/util/fileSearch.test.js create mode 100644 api/test/jestSetup.js create mode 100644 api/test/server/services/Files/S3/crud.test.js create mode 100644 api/test/services/Files/processFileCitations.test.js create mode 100644 api/typedefs.js create mode 100644 api/utils/LoggingSystem.js create mode 100644 api/utils/logger.js create mode 100644 api/utils/tokens.spec.js create mode 100644 backend.pid create mode 100755 build-prod.sh create mode 100644 bun.lock create mode 100644 client/babel.config.cjs create mode 100755 client/check_updates.sh create mode 100644 client/index.html create mode 100644 client/jest.config.cjs create mode 100644 client/nginx.conf create mode 100644 client/package.json create mode 100644 client/postcss.config.cjs create mode 100644 client/public/assets/Logo.png create mode 100644 client/public/assets/anyscale.png create mode 100644 client/public/assets/apipie.png create mode 100644 client/public/assets/apple-touch-icon-180x180-v2.png create mode 100644 client/public/assets/apple-touch-icon-180x180.png create mode 100644 client/public/assets/bingai-jb.png create mode 100644 client/public/assets/bingai.png create mode 100644 client/public/assets/c.svg create mode 100644 client/public/assets/cohere.png create mode 100644 client/public/assets/cplusplus.svg create mode 100644 client/public/assets/deepseek.svg create mode 100644 client/public/assets/favicon-16x16-v2.png create mode 100644 client/public/assets/favicon-16x16.png create mode 100644 client/public/assets/favicon-32x32-v2.png create mode 100644 client/public/assets/favicon-32x32.png create mode 100644 client/public/assets/fireworks.png create mode 100644 client/public/assets/fortran.svg create mode 100644 client/public/assets/gemini_image_gen.svg create mode 100644 client/public/assets/go.svg create mode 100644 client/public/assets/google-palm.svg create mode 100644 client/public/assets/google.svg create mode 100644 client/public/assets/groq.png create mode 100644 client/public/assets/helicone.svg create mode 100644 client/public/assets/huggingface.svg create mode 100644 client/public/assets/icon-192x192.png create mode 100644 client/public/assets/image_gen_oai.png create mode 100644 client/public/assets/logo.svg create mode 100644 client/public/assets/maskable-icon.png create mode 100644 client/public/assets/mistral.png create mode 100644 client/public/assets/mlx.png create mode 100644 client/public/assets/nodedotjs.svg create mode 100644 client/public/assets/ollama.png create mode 100644 client/public/assets/openai.svg create mode 100644 client/public/assets/openrouter.png create mode 100644 client/public/assets/openweather.png create mode 100644 client/public/assets/perplexity.png create mode 100644 client/public/assets/php.svg create mode 100644 client/public/assets/python.svg create mode 100644 client/public/assets/qwen.svg create mode 100644 client/public/assets/r.svg create mode 100644 client/public/assets/rust.svg create mode 100644 client/public/assets/shuttleai.png create mode 100644 client/public/assets/silence.mp3 create mode 100644 client/public/assets/thotai.png create mode 100644 client/public/assets/together.png create mode 100644 client/public/assets/tsnode.svg create mode 100644 client/public/assets/unify.webp create mode 100644 client/public/assets/web-browser.svg create mode 100644 client/public/fonts/Inter-Bold.woff2 create mode 100644 client/public/fonts/Inter-BoldItalic.woff2 create mode 100644 client/public/fonts/Inter-Italic.woff2 create mode 100644 client/public/fonts/Inter-Regular.woff2 create mode 100644 client/public/fonts/Inter-SemiBold.woff2 create mode 100644 client/public/fonts/Inter-SemiBoldItalic.woff2 create mode 100644 client/public/fonts/roboto-mono-latin-400-italic.woff2 create mode 100644 client/public/fonts/roboto-mono-latin-400-normal.woff2 create mode 100644 client/public/fonts/roboto-mono-latin-700-normal.woff2 create mode 100644 client/public/robots.txt create mode 100644 client/scripts/post-build.cjs create mode 100644 client/src/@types/i18next.d.ts create mode 100644 client/src/App.jsx create mode 100644 client/src/Providers/ActivePanelContext.tsx create mode 100644 client/src/Providers/AddedChatContext.tsx create mode 100644 client/src/Providers/AgentPanelContext.tsx create mode 100644 client/src/Providers/AgentsContext.tsx create mode 100644 client/src/Providers/AgentsMapContext.tsx create mode 100644 client/src/Providers/AnnouncerContext.tsx create mode 100644 client/src/Providers/ArtifactContext.tsx create mode 100644 client/src/Providers/ArtifactsContext.tsx create mode 100644 client/src/Providers/AssistantsContext.tsx create mode 100644 client/src/Providers/AssistantsMapContext.tsx create mode 100644 client/src/Providers/BadgeRowContext.tsx create mode 100644 client/src/Providers/BookmarkContext.tsx create mode 100644 client/src/Providers/ChatContext.tsx create mode 100644 client/src/Providers/ChatFormContext.tsx create mode 100644 client/src/Providers/CodeBlockContext.tsx create mode 100644 client/src/Providers/CustomFormContext.tsx create mode 100644 client/src/Providers/DashboardContext.tsx create mode 100644 client/src/Providers/DragDropContext.tsx create mode 100644 client/src/Providers/EditorContext.tsx create mode 100644 client/src/Providers/FileMapContext.tsx create mode 100644 client/src/Providers/MessageContext.tsx create mode 100644 client/src/Providers/MessagesViewContext.tsx create mode 100644 client/src/Providers/PromptGroupsContext.tsx create mode 100644 client/src/Providers/SearchContext.tsx create mode 100644 client/src/Providers/SetConvoContext.tsx create mode 100644 client/src/Providers/ShareContext.tsx create mode 100644 client/src/Providers/SidePanelContext.tsx create mode 100644 client/src/Providers/ToolCallsMapContext.tsx create mode 100644 client/src/Providers/index.ts create mode 100644 client/src/a11y/Announcer.tsx create mode 100644 client/src/a11y/LiveAnnouncer.tsx create mode 100644 client/src/a11y/LiveMessage.tsx create mode 100644 client/src/a11y/LiveMessenger.tsx create mode 100644 client/src/a11y/MessageBlock.tsx create mode 100644 client/src/a11y/index.ts create mode 100644 client/src/common/a11y.ts create mode 100644 client/src/common/agents-types.ts create mode 100644 client/src/common/artifacts.ts create mode 100644 client/src/common/assistants-types.ts create mode 100644 client/src/common/index.ts create mode 100644 client/src/common/menus.ts create mode 100644 client/src/common/selector.ts create mode 100644 client/src/common/tools.ts create mode 100644 client/src/common/types.ts create mode 100644 client/src/components/Agents/AgentCard.tsx create mode 100644 client/src/components/Agents/AgentDetail.tsx create mode 100644 client/src/components/Agents/AgentDetailContent.tsx create mode 100644 client/src/components/Agents/AgentGrid.tsx create mode 100644 client/src/components/Agents/CategoryTabs.tsx create mode 100644 client/src/components/Agents/ErrorDisplay.tsx create mode 100644 client/src/components/Agents/Marketplace.tsx create mode 100644 client/src/components/Agents/MarketplaceAdminSettings.tsx create mode 100644 client/src/components/Agents/MarketplaceContext.tsx create mode 100644 client/src/components/Agents/SearchBar.tsx create mode 100644 client/src/components/Agents/SmartLoader.tsx create mode 100644 client/src/components/Agents/VirtualizedAgentGrid.tsx create mode 100644 client/src/components/Agents/tests/Accessibility.spec.tsx create mode 100644 client/src/components/Agents/tests/AgentCard.spec.tsx create mode 100644 client/src/components/Agents/tests/AgentDetail.spec.tsx create mode 100644 client/src/components/Agents/tests/AgentGrid.integration.spec.tsx create mode 100644 client/src/components/Agents/tests/CategoryTabs.spec.tsx create mode 100644 client/src/components/Agents/tests/ErrorDisplay.spec.tsx create mode 100644 client/src/components/Agents/tests/MarketplaceContext.spec.tsx create mode 100644 client/src/components/Agents/tests/SearchBar.spec.tsx create mode 100644 client/src/components/Agents/tests/SmartLoader.spec.tsx create mode 100644 client/src/components/Agents/tests/VirtualScrollingPerformance.test.tsx create mode 100644 client/src/components/Agents/tests/VirtualizedAgentGrid.test.tsx create mode 100644 client/src/components/Artifacts/Artifact.tsx create mode 100644 client/src/components/Artifacts/ArtifactButton.tsx create mode 100644 client/src/components/Artifacts/ArtifactCodeEditor.tsx create mode 100644 client/src/components/Artifacts/ArtifactPreview.tsx create mode 100644 client/src/components/Artifacts/ArtifactTabs.tsx create mode 100644 client/src/components/Artifacts/ArtifactVersion.tsx create mode 100644 client/src/components/Artifacts/Artifacts.tsx create mode 100644 client/src/components/Artifacts/Code.tsx create mode 100644 client/src/components/Artifacts/DownloadArtifact.tsx create mode 100644 client/src/components/Artifacts/Mermaid.tsx create mode 100644 client/src/components/Audio/TTS.tsx create mode 100644 client/src/components/Audio/Voices.tsx create mode 100644 client/src/components/Auth/ApiErrorWatcher.tsx create mode 100644 client/src/components/Auth/AuthLayout.tsx create mode 100644 client/src/components/Auth/AuthLayout.tsx.backup create mode 100644 client/src/components/Auth/BlinkAnimation.tsx create mode 100644 client/src/components/Auth/ErrorMessage.tsx create mode 100644 client/src/components/Auth/Footer.tsx create mode 100644 client/src/components/Auth/Login.tsx create mode 100644 client/src/components/Auth/LoginForm.tsx create mode 100644 client/src/components/Auth/Registration.tsx create mode 100644 client/src/components/Auth/RequestPasswordReset.tsx create mode 100644 client/src/components/Auth/ResetPassword.tsx create mode 100644 client/src/components/Auth/SocialButton.tsx create mode 100644 client/src/components/Auth/SocialLoginRender.tsx create mode 100644 client/src/components/Auth/TwoFactorScreen.tsx create mode 100644 client/src/components/Auth/VerifyEmail.tsx create mode 100644 client/src/components/Auth/__tests__/Login.spec.tsx create mode 100644 client/src/components/Auth/__tests__/LoginForm.spec.tsx create mode 100644 client/src/components/Auth/__tests__/Registration.spec.tsx create mode 100644 client/src/components/Auth/index.ts create mode 100644 client/src/components/Banners/Banner.tsx create mode 100644 client/src/components/Banners/index.ts create mode 100644 client/src/components/Bookmarks/BookmarkEditDialog.tsx create mode 100644 client/src/components/Bookmarks/BookmarkForm.tsx create mode 100644 client/src/components/Bookmarks/BookmarkItem.tsx create mode 100644 client/src/components/Bookmarks/BookmarkItems.tsx create mode 100644 client/src/components/Bookmarks/DeleteBookmarkButton.tsx create mode 100644 client/src/components/Bookmarks/EditBookmarkButton.tsx create mode 100644 client/src/components/Bookmarks/__tests__/BookmarkForm.test.tsx create mode 100644 client/src/components/Bookmarks/index.ts create mode 100644 client/src/components/Chat/AddMultiConvo.tsx create mode 100644 client/src/components/Chat/ChatView.tsx create mode 100644 client/src/components/Chat/ExportAndShareMenu.tsx create mode 100644 client/src/components/Chat/Footer.tsx create mode 100644 client/src/components/Chat/Header.tsx create mode 100644 client/src/components/Chat/Input/ActiveSetting.tsx create mode 100644 client/src/components/Chat/Input/AddedConvo.tsx create mode 100644 client/src/components/Chat/Input/Artifacts.tsx create mode 100644 client/src/components/Chat/Input/ArtifactsSubMenu.tsx create mode 100644 client/src/components/Chat/Input/AudioRecorder.tsx create mode 100644 client/src/components/Chat/Input/BadgeRow.tsx create mode 100644 client/src/components/Chat/Input/ChatForm.tsx create mode 100644 client/src/components/Chat/Input/CircleRender.tsx create mode 100644 client/src/components/Chat/Input/CodeInterpreter.tsx create mode 100644 client/src/components/Chat/Input/CollapseChat.tsx create mode 100644 client/src/components/Chat/Input/ConversationStarters.tsx create mode 100644 client/src/components/Chat/Input/EditBadges.tsx create mode 100644 client/src/components/Chat/Input/FileSearch.tsx create mode 100644 client/src/components/Chat/Input/Files/AttachFile.tsx create mode 100644 client/src/components/Chat/Input/Files/AttachFileChat.tsx create mode 100644 client/src/components/Chat/Input/Files/AttachFileMenu.tsx create mode 100644 client/src/components/Chat/Input/Files/DragDropModal.tsx create mode 100644 client/src/components/Chat/Input/Files/DragDropOverlay.tsx create mode 100644 client/src/components/Chat/Input/Files/DragDropWrapper.tsx create mode 100644 client/src/components/Chat/Input/Files/FileContainer.tsx create mode 100644 client/src/components/Chat/Input/Files/FileFormChat.tsx create mode 100644 client/src/components/Chat/Input/Files/FilePreview.tsx create mode 100644 client/src/components/Chat/Input/Files/FileRow.tsx create mode 100644 client/src/components/Chat/Input/Files/FileUpload.tsx create mode 100644 client/src/components/Chat/Input/Files/Image.tsx create mode 100644 client/src/components/Chat/Input/Files/ImagePreview.tsx create mode 100644 client/src/components/Chat/Input/Files/MyFilesModal.tsx create mode 100644 client/src/components/Chat/Input/Files/ProgressCircle.tsx create mode 100644 client/src/components/Chat/Input/Files/RemoveFile.tsx create mode 100644 client/src/components/Chat/Input/Files/SourceIcon.tsx create mode 100644 client/src/components/Chat/Input/Files/Table/ColumnVisibilityDropdown.tsx create mode 100644 client/src/components/Chat/Input/Files/Table/Columns.tsx create mode 100644 client/src/components/Chat/Input/Files/Table/DataTable.tsx create mode 100644 client/src/components/Chat/Input/Files/Table/SortFilterHeader.tsx create mode 100644 client/src/components/Chat/Input/Files/Table/TemplateTable.tsx create mode 100644 client/src/components/Chat/Input/Files/Table/fakeData.ts create mode 100644 client/src/components/Chat/Input/Files/Table/index.ts create mode 100644 client/src/components/Chat/Input/Files/__tests__/AttachFileMenu.spec.tsx create mode 100644 client/src/components/Chat/Input/Files/__tests__/DragDropModal.spec.tsx create mode 100644 client/src/components/Chat/Input/Files/__tests__/FileRow.spec.tsx create mode 100644 client/src/components/Chat/Input/HeaderOptions.tsx create mode 100644 client/src/components/Chat/Input/MCPConfigDialog.tsx create mode 100644 client/src/components/Chat/Input/MCPSelect.tsx create mode 100644 client/src/components/Chat/Input/MCPSubMenu.tsx create mode 100644 client/src/components/Chat/Input/Mention.tsx create mode 100644 client/src/components/Chat/Input/MentionItem.tsx create mode 100644 client/src/components/Chat/Input/OptionsPopover.tsx create mode 100644 client/src/components/Chat/Input/PopoverButtons.tsx create mode 100644 client/src/components/Chat/Input/PromptsCommand.tsx create mode 100644 client/src/components/Chat/Input/SendButton.tsx create mode 100644 client/src/components/Chat/Input/StopButton.tsx create mode 100644 client/src/components/Chat/Input/StreamAudio.tsx create mode 100644 client/src/components/Chat/Input/TextareaHeader.tsx create mode 100644 client/src/components/Chat/Input/ToolDialogs.tsx create mode 100644 client/src/components/Chat/Input/ToolsDropdown.tsx create mode 100644 client/src/components/Chat/Input/WebSearch.tsx create mode 100644 client/src/components/Chat/Landing.tsx create mode 100644 client/src/components/Chat/Menus/BookmarkMenu.tsx create mode 100644 client/src/components/Chat/Menus/Bookmarks/BookmarkMenuItems.tsx create mode 100644 client/src/components/Chat/Menus/Endpoints/CustomMenu.tsx create mode 100644 client/src/components/Chat/Menus/Endpoints/DialogManager.tsx create mode 100644 client/src/components/Chat/Menus/Endpoints/ModelSelector.tsx create mode 100644 client/src/components/Chat/Menus/Endpoints/ModelSelectorChatContext.tsx create mode 100644 client/src/components/Chat/Menus/Endpoints/ModelSelectorContext.tsx create mode 100644 client/src/components/Chat/Menus/Endpoints/components/CustomGroup.tsx create mode 100644 client/src/components/Chat/Menus/Endpoints/components/EndpointItem.tsx create mode 100644 client/src/components/Chat/Menus/Endpoints/components/EndpointModelItem.tsx create mode 100644 client/src/components/Chat/Menus/Endpoints/components/GroupIcon.tsx create mode 100644 client/src/components/Chat/Menus/Endpoints/components/ModelSpecItem.tsx create mode 100644 client/src/components/Chat/Menus/Endpoints/components/SearchResults.tsx create mode 100644 client/src/components/Chat/Menus/Endpoints/components/SpecIcon.tsx create mode 100644 client/src/components/Chat/Menus/Endpoints/components/index.ts create mode 100644 client/src/components/Chat/Menus/Endpoints/utils.ts create mode 100644 client/src/components/Chat/Menus/HeaderNewChat.tsx create mode 100644 client/src/components/Chat/Menus/Models/fakeData.ts create mode 100644 client/src/components/Chat/Menus/OpenSidebar.tsx create mode 100644 client/src/components/Chat/Menus/Presets/EditPresetDialog.tsx create mode 100644 client/src/components/Chat/Menus/Presets/PresetItems.tsx create mode 100644 client/src/components/Chat/Menus/Presets/index.ts create mode 100644 client/src/components/Chat/Menus/PresetsMenu.tsx create mode 100644 client/src/components/Chat/Menus/UI/MenuItem.tsx create mode 100644 client/src/components/Chat/Menus/UI/MenuSeparator.tsx create mode 100644 client/src/components/Chat/Menus/UI/TitleButton.tsx create mode 100644 client/src/components/Chat/Menus/UI/index.ts create mode 100644 client/src/components/Chat/Menus/index.ts create mode 100644 client/src/components/Chat/Messages/Content/ActionIcon.tsx create mode 100644 client/src/components/Chat/Messages/Content/AgentHandoff.tsx create mode 100644 client/src/components/Chat/Messages/Content/CancelledIcon.tsx create mode 100644 client/src/components/Chat/Messages/Content/CodeAnalyze.tsx create mode 100644 client/src/components/Chat/Messages/Content/Container.tsx create mode 100644 client/src/components/Chat/Messages/Content/ContentParts.tsx create mode 100644 client/src/components/Chat/Messages/Content/DialogImage.tsx create mode 100644 client/src/components/Chat/Messages/Content/EditMessage.tsx create mode 100644 client/src/components/Chat/Messages/Content/Files.tsx create mode 100644 client/src/components/Chat/Messages/Content/FinishedIcon.tsx create mode 100644 client/src/components/Chat/Messages/Content/Image.tsx create mode 100644 client/src/components/Chat/Messages/Content/ImageGen.tsx create mode 100644 client/src/components/Chat/Messages/Content/InProgressCall.tsx create mode 100644 client/src/components/Chat/Messages/Content/Markdown.tsx create mode 100644 client/src/components/Chat/Messages/Content/MarkdownComponents.tsx create mode 100644 client/src/components/Chat/Messages/Content/MarkdownErrorBoundary.tsx create mode 100644 client/src/components/Chat/Messages/Content/MarkdownLite.tsx create mode 100644 client/src/components/Chat/Messages/Content/MemoryArtifacts.tsx create mode 100644 client/src/components/Chat/Messages/Content/MemoryInfo.tsx create mode 100644 client/src/components/Chat/Messages/Content/MessageContent.tsx create mode 100644 client/src/components/Chat/Messages/Content/ParallelContent.tsx create mode 100644 client/src/components/Chat/Messages/Content/Part.tsx create mode 100644 client/src/components/Chat/Messages/Content/Parts/AgentUpdate.tsx create mode 100644 client/src/components/Chat/Messages/Content/Parts/Attachment.tsx create mode 100644 client/src/components/Chat/Messages/Content/Parts/EditTextPart.tsx create mode 100644 client/src/components/Chat/Messages/Content/Parts/EmptyText.tsx create mode 100644 client/src/components/Chat/Messages/Content/Parts/ExecuteCode.tsx create mode 100644 client/src/components/Chat/Messages/Content/Parts/LogContent.tsx create mode 100644 client/src/components/Chat/Messages/Content/Parts/LogLink.tsx create mode 100644 client/src/components/Chat/Messages/Content/Parts/OpenAIImageGen/OpenAIImageGen.tsx create mode 100644 client/src/components/Chat/Messages/Content/Parts/OpenAIImageGen/ProgressText.tsx create mode 100644 client/src/components/Chat/Messages/Content/Parts/OpenAIImageGen/index.ts create mode 100644 client/src/components/Chat/Messages/Content/Parts/Reasoning.tsx create mode 100644 client/src/components/Chat/Messages/Content/Parts/Stdout.tsx create mode 100644 client/src/components/Chat/Messages/Content/Parts/Text.tsx create mode 100644 client/src/components/Chat/Messages/Content/Parts/Thinking.tsx create mode 100644 client/src/components/Chat/Messages/Content/Parts/index.ts create mode 100644 client/src/components/Chat/Messages/Content/ProgressCircle.tsx create mode 100644 client/src/components/Chat/Messages/Content/ProgressText.tsx create mode 100644 client/src/components/Chat/Messages/Content/RetrievalCall.tsx create mode 100644 client/src/components/Chat/Messages/Content/RetrievalIcon.tsx create mode 100644 client/src/components/Chat/Messages/Content/SearchContent.tsx create mode 100644 client/src/components/Chat/Messages/Content/SiblingHeader.tsx create mode 100644 client/src/components/Chat/Messages/Content/ToolCall.tsx create mode 100644 client/src/components/Chat/Messages/Content/ToolCallInfo.tsx create mode 100644 client/src/components/Chat/Messages/Content/UIResourceCarousel.tsx create mode 100644 client/src/components/Chat/Messages/Content/WebSearch.tsx create mode 100644 client/src/components/Chat/Messages/Content/WrenchIcon.tsx create mode 100644 client/src/components/Chat/Messages/Content/__tests__/Markdown.mcpui.test.tsx create mode 100644 client/src/components/Chat/Messages/Content/__tests__/MemoryArtifacts.test.tsx create mode 100644 client/src/components/Chat/Messages/Content/__tests__/MemoryInfo.test.tsx create mode 100644 client/src/components/Chat/Messages/Content/__tests__/ToolCall.test.tsx create mode 100644 client/src/components/Chat/Messages/Content/__tests__/ToolCallInfo.test.tsx create mode 100644 client/src/components/Chat/Messages/Content/__tests__/UIResourceCarousel.test.tsx create mode 100644 client/src/components/Chat/Messages/Feedback.tsx create mode 100644 client/src/components/Chat/Messages/Fork.tsx create mode 100644 client/src/components/Chat/Messages/HoverButtons.tsx create mode 100644 client/src/components/Chat/Messages/Message.tsx create mode 100644 client/src/components/Chat/Messages/MessageAudio.tsx create mode 100644 client/src/components/Chat/Messages/MessageIcon.tsx create mode 100644 client/src/components/Chat/Messages/MessageParts.tsx create mode 100644 client/src/components/Chat/Messages/MessagesView.tsx create mode 100644 client/src/components/Chat/Messages/MinimalHoverButtons.tsx create mode 100644 client/src/components/Chat/Messages/MinimalMessages.tsx create mode 100644 client/src/components/Chat/Messages/MultiMessage.tsx create mode 100644 client/src/components/Chat/Messages/SearchButtons.tsx create mode 100644 client/src/components/Chat/Messages/SearchMessage.tsx create mode 100644 client/src/components/Chat/Messages/SiblingSwitch.tsx create mode 100644 client/src/components/Chat/Messages/SubRow.tsx create mode 100644 client/src/components/Chat/Messages/ui/MessageRender.tsx create mode 100644 client/src/components/Chat/Messages/ui/PlaceholderRow.tsx create mode 100644 client/src/components/Chat/Presentation.tsx create mode 100644 client/src/components/Chat/TemporaryChat.tsx create mode 100644 client/src/components/Conversations/Conversations.tsx create mode 100644 client/src/components/Conversations/Convo.tsx create mode 100644 client/src/components/Conversations/ConvoLink.tsx create mode 100644 client/src/components/Conversations/ConvoOptions/ConvoOptions.tsx create mode 100644 client/src/components/Conversations/ConvoOptions/DeleteButton.tsx create mode 100644 client/src/components/Conversations/ConvoOptions/ShareButton.tsx create mode 100644 client/src/components/Conversations/ConvoOptions/SharedLinkButton.tsx create mode 100644 client/src/components/Conversations/ConvoOptions/index.js create mode 100644 client/src/components/Conversations/ConvoOptions/index.ts create mode 100644 client/src/components/Conversations/HoverToggle.tsx create mode 100644 client/src/components/Conversations/Pages.tsx create mode 100644 client/src/components/Conversations/RenameForm.tsx create mode 100644 client/src/components/Conversations/ToggleContext.ts create mode 100644 client/src/components/Conversations/index.ts create mode 100644 client/src/components/Endpoints/AlternativeSettings.tsx create mode 100644 client/src/components/Endpoints/ConvoIcon.tsx create mode 100644 client/src/components/Endpoints/ConvoIconURL.tsx create mode 100644 client/src/components/Endpoints/EndpointIcon.tsx create mode 100644 client/src/components/Endpoints/EndpointSettings.tsx create mode 100644 client/src/components/Endpoints/Icon.tsx create mode 100644 client/src/components/Endpoints/MessageEndpointIcon.tsx create mode 100644 client/src/components/Endpoints/MinimalIcon.tsx create mode 100644 client/src/components/Endpoints/SaveAsPresetDialog.tsx create mode 100644 client/src/components/Endpoints/Settings/Advanced.tsx create mode 100644 client/src/components/Endpoints/Settings/Anthropic.tsx create mode 100644 client/src/components/Endpoints/Settings/Assistants.tsx create mode 100644 client/src/components/Endpoints/Settings/Bedrock.tsx create mode 100644 client/src/components/Endpoints/Settings/Examples.tsx create mode 100644 client/src/components/Endpoints/Settings/Google.tsx create mode 100644 client/src/components/Endpoints/Settings/MultiView/GoogleSettings.tsx create mode 100644 client/src/components/Endpoints/Settings/MultiView/index.ts create mode 100644 client/src/components/Endpoints/Settings/OpenAI.tsx create mode 100644 client/src/components/Endpoints/Settings/OptionHover.tsx create mode 100644 client/src/components/Endpoints/Settings/index.ts create mode 100644 client/src/components/Endpoints/Settings/settings.ts create mode 100644 client/src/components/Endpoints/URLIcon.tsx create mode 100644 client/src/components/Endpoints/index.ts create mode 100644 client/src/components/Files/ActionButton.tsx create mode 100644 client/src/components/Files/DeleteIconButton.tsx create mode 100644 client/src/components/Files/FileDashboardView.tsx create mode 100644 client/src/components/Files/FileList/DataTableFile.tsx create mode 100644 client/src/components/Files/FileList/DataTableFilePreview.tsx create mode 100644 client/src/components/Files/FileList/EmptyFilePreview.tsx create mode 100644 client/src/components/Files/FileList/FileList.tsx create mode 100644 client/src/components/Files/FileList/FileListItem.tsx create mode 100644 client/src/components/Files/FileList/FileListItem2.tsx create mode 100644 client/src/components/Files/FileList/FilePreview.tsx create mode 100644 client/src/components/Files/FileList/FileSidePanel.tsx create mode 100644 client/src/components/Files/FileList/FileTableColumns.tsx create mode 100644 client/src/components/Files/FileList/UploadFileButton.tsx create mode 100644 client/src/components/Files/FileList/UploadFileModal.tsx create mode 100644 client/src/components/Files/FilesListView.tsx create mode 100644 client/src/components/Files/FilesSectionSelector.tsx create mode 100644 client/src/components/Files/VectorStore/EmptyVectorStorePreview.tsx create mode 100644 client/src/components/Files/VectorStore/VectorStoreButton.tsx create mode 100644 client/src/components/Files/VectorStore/VectorStoreFilter.tsx create mode 100644 client/src/components/Files/VectorStore/VectorStoreList.tsx create mode 100644 client/src/components/Files/VectorStore/VectorStoreListItem.tsx create mode 100644 client/src/components/Files/VectorStore/VectorStorePreview.tsx create mode 100644 client/src/components/Files/VectorStore/VectorStoreSidePanel.tsx create mode 100644 client/src/components/Files/VectorStoreView.tsx create mode 100644 client/src/components/Input/Generations/Button.tsx create mode 100644 client/src/components/Input/Generations/Regenerate.tsx create mode 100644 client/src/components/Input/Generations/Stop.tsx create mode 100644 client/src/components/Input/Generations/__tests__/Button.spec.tsx create mode 100644 client/src/components/Input/Generations/__tests__/Regenerate.spec.tsx create mode 100644 client/src/components/Input/Generations/__tests__/Stop.spec.tsx create mode 100644 client/src/components/Input/ModelSelect/Anthropic.tsx create mode 100644 client/src/components/Input/ModelSelect/ChatGPT.tsx create mode 100644 client/src/components/Input/ModelSelect/Google.tsx create mode 100644 client/src/components/Input/ModelSelect/ModelSelect.tsx create mode 100644 client/src/components/Input/ModelSelect/MultiSelectDropDown.tsx create mode 100644 client/src/components/Input/ModelSelect/MultiSelectPop.tsx create mode 100644 client/src/components/Input/ModelSelect/OpenAI.tsx create mode 100644 client/src/components/Input/ModelSelect/SelectDropDownPop.tsx create mode 100644 client/src/components/Input/ModelSelect/index.ts create mode 100644 client/src/components/Input/ModelSelect/options.ts create mode 100644 client/src/components/Input/SetKeyDialog/CustomEndpoint.tsx create mode 100644 client/src/components/Input/SetKeyDialog/GoogleConfig.tsx create mode 100644 client/src/components/Input/SetKeyDialog/HelpText.tsx create mode 100644 client/src/components/Input/SetKeyDialog/InputWithLabel.tsx create mode 100644 client/src/components/Input/SetKeyDialog/OpenAIConfig.tsx create mode 100644 client/src/components/Input/SetKeyDialog/OtherConfig.tsx create mode 100644 client/src/components/Input/SetKeyDialog/SetKeyDialog.tsx create mode 100644 client/src/components/Input/SetKeyDialog/index.ts create mode 100644 client/src/components/MCP/CustomUserVarsSection.tsx create mode 100644 client/src/components/MCP/MCPConfigDialog.tsx create mode 100644 client/src/components/MCP/MCPServerMenuItem.tsx create mode 100644 client/src/components/MCP/MCPServerStatusIcon.tsx create mode 100644 client/src/components/MCP/ServerInitializationSection.tsx create mode 100644 client/src/components/MCP/StackedMCPIcons.tsx create mode 100644 client/src/components/MCP/mcpServerUtils.ts create mode 100644 client/src/components/MCPUIResource/MCPUIResource.tsx create mode 100644 client/src/components/MCPUIResource/MCPUIResourceCarousel.tsx create mode 100644 client/src/components/MCPUIResource/__tests__/MCPUIResource.test.tsx create mode 100644 client/src/components/MCPUIResource/__tests__/MCPUIResourceCarousel.test.tsx create mode 100644 client/src/components/MCPUIResource/__tests__/plugin.test.ts create mode 100644 client/src/components/MCPUIResource/index.ts create mode 100644 client/src/components/MCPUIResource/plugin.ts create mode 100644 client/src/components/MCPUIResource/types.ts create mode 100644 client/src/components/Messages/Content/CodeBlock.tsx create mode 100644 client/src/components/Messages/Content/Container.tsx create mode 100644 client/src/components/Messages/Content/Error.tsx create mode 100644 client/src/components/Messages/Content/Mermaid.tsx create mode 100644 client/src/components/Messages/Content/MermaidErrorBoundary.tsx create mode 100644 client/src/components/Messages/Content/MermaidHeader.tsx create mode 100644 client/src/components/Messages/Content/ResultSwitcher.tsx create mode 100644 client/src/components/Messages/Content/RunCode.tsx create mode 100644 client/src/components/Messages/Content/SubRow.tsx create mode 100644 client/src/components/Messages/Content/index.ts create mode 100644 client/src/components/Messages/ContentRender.tsx create mode 100644 client/src/components/Messages/MessageContent.tsx create mode 100644 client/src/components/Messages/ScrollToBottom.tsx create mode 100644 client/src/components/Nav/AccountSettings.tsx create mode 100644 client/src/components/Nav/AgentMarketplaceButton.tsx create mode 100644 client/src/components/Nav/Bookmarks/BookmarkNav.tsx create mode 100644 client/src/components/Nav/ExportConversation/ExportModal.tsx create mode 100644 client/src/components/Nav/ExportConversation/index.ts create mode 100644 client/src/components/Nav/Favorites/FavoriteItem.tsx create mode 100644 client/src/components/Nav/Favorites/FavoritesList.tsx create mode 100644 client/src/components/Nav/MobileNav.tsx create mode 100644 client/src/components/Nav/Nav.tsx create mode 100644 client/src/components/Nav/NavLink.tsx create mode 100644 client/src/components/Nav/NavToggle.tsx create mode 100644 client/src/components/Nav/NewChat.tsx create mode 100644 client/src/components/Nav/SearchBar.tsx create mode 100644 client/src/components/Nav/Settings.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Account/Account.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Account/Avatar.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Account/BackupCodesItem.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Account/DeleteAccount.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Account/DisableTwoFactorToggle.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Account/DisplayUsernameMessages.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Account/TwoFactorAuthentication.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Account/TwoFactorPhases/BackupPhase.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Account/TwoFactorPhases/DisablePhase.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Account/TwoFactorPhases/QRPhase.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Account/TwoFactorPhases/SetupPhase.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Account/TwoFactorPhases/VerifyPhase.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Account/TwoFactorPhases/index.ts create mode 100644 client/src/components/Nav/SettingsTabs/Balance/AutoRefillSettings.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Balance/Balance.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Balance/TokenCreditsItem.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Chat/Chat.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Chat/ChatDirection.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Chat/FontSizeSelector.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Chat/ForkSettings.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Chat/SaveBadgesState.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Chat/ShowThinking.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Commands/Commands.tsx create mode 100644 client/src/components/Nav/SettingsTabs/DangerButton.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Data/ClearChats.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Data/Data.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Data/DeleteCache.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Data/ImportConversations.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Data/RevokeKeys.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Data/SharedLinks.tsx create mode 100644 client/src/components/Nav/SettingsTabs/General/ArchivedChats.tsx create mode 100644 client/src/components/Nav/SettingsTabs/General/ArchivedChatsTable.tsx create mode 100644 client/src/components/Nav/SettingsTabs/General/General.tsx create mode 100644 client/src/components/Nav/SettingsTabs/General/LangSelector.spec.tsx create mode 100644 client/src/components/Nav/SettingsTabs/General/ThemeSelector.spec.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Personalization.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Speech/ConversationModeSwitch.spec.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Speech/ConversationModeSwitch.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Speech/STT/AutoSendTextSelector.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Speech/STT/AutoTranscribeAudioSwitch.tsx create mode 100755 client/src/components/Nav/SettingsTabs/Speech/STT/DecibelSelector.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Speech/STT/EngineSTTDropdown.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Speech/STT/LanguageSTTDropdown.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Speech/STT/SpeechToTextSwitch.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Speech/STT/__tests__/AutoTranscribeAudioSwitch.spec.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Speech/STT/__tests__/SpeechToTextSwitch.spec.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Speech/STT/index.ts create mode 100644 client/src/components/Nav/SettingsTabs/Speech/Speech.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Speech/TTS/AutomaticPlaybackSwitch.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Speech/TTS/CacheTTSSwitch.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Speech/TTS/CloudBrowserVoicesSwitch.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Speech/TTS/EngineTTSDropdown.tsx create mode 100755 client/src/components/Nav/SettingsTabs/Speech/TTS/PlaybackRate.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Speech/TTS/TextToSpeechSwitch.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Speech/TTS/VoiceDropdown.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Speech/TTS/__tests__/AutomaticPlaybackSwitch.spec.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Speech/TTS/__tests__/CacheTTSSwitch.spec.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Speech/TTS/__tests__/CloudBrowserVoicesSwitch.spec.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Speech/TTS/__tests__/TextToSpeechSwitch.spec.tsx create mode 100644 client/src/components/Nav/SettingsTabs/Speech/TTS/index.ts create mode 100644 client/src/components/Nav/SettingsTabs/ToggleSwitch.tsx create mode 100644 client/src/components/Nav/SettingsTabs/index.ts create mode 100644 client/src/components/Nav/index.ts create mode 100644 client/src/components/OAuth/OAuthError.tsx create mode 100644 client/src/components/OAuth/OAuthSuccess.tsx create mode 100644 client/src/components/OAuth/index.ts create mode 100644 client/src/components/Plugins/Store/PluginAuthForm.tsx create mode 100644 client/src/components/Plugins/Store/PluginPagination.tsx create mode 100644 client/src/components/Plugins/Store/PluginTooltip.tsx create mode 100644 client/src/components/Plugins/Store/__tests__/PluginAuthForm.spec.tsx create mode 100644 client/src/components/Plugins/Store/__tests__/PluginPagination.spec.tsx create mode 100644 client/src/components/Plugins/Store/index.ts create mode 100644 client/src/components/Prompts/AdminSettings.tsx create mode 100644 client/src/components/Prompts/AdvancedSwitch.tsx create mode 100644 client/src/components/Prompts/BackToChat.tsx create mode 100644 client/src/components/Prompts/Command.tsx create mode 100644 client/src/components/Prompts/DeleteVersion.tsx create mode 100644 client/src/components/Prompts/Description.tsx create mode 100644 client/src/components/Prompts/EmptyPromptPreview.tsx create mode 100644 client/src/components/Prompts/Groups/AlwaysMakeProd.tsx create mode 100644 client/src/components/Prompts/Groups/AutoSendPrompt.tsx create mode 100644 client/src/components/Prompts/Groups/CategoryIcon.tsx create mode 100644 client/src/components/Prompts/Groups/CategorySelector.tsx create mode 100644 client/src/components/Prompts/Groups/ChatGroupItem.tsx create mode 100644 client/src/components/Prompts/Groups/CreatePromptForm.tsx create mode 100644 client/src/components/Prompts/Groups/DashGroupItem.tsx create mode 100644 client/src/components/Prompts/Groups/FilterPrompts.tsx create mode 100644 client/src/components/Prompts/Groups/GroupSidePanel.tsx create mode 100644 client/src/components/Prompts/Groups/List.tsx create mode 100644 client/src/components/Prompts/Groups/ListCard.tsx create mode 100644 client/src/components/Prompts/Groups/NoPromptGroup.tsx create mode 100644 client/src/components/Prompts/Groups/PanelNavigation.tsx create mode 100644 client/src/components/Prompts/Groups/VariableDialog.tsx create mode 100644 client/src/components/Prompts/Groups/VariableForm.tsx create mode 100644 client/src/components/Prompts/ManagePrompts.tsx create mode 100644 client/src/components/Prompts/Markdown.tsx create mode 100644 client/src/components/Prompts/PreviewLabels.tsx create mode 100644 client/src/components/Prompts/PreviewPrompt.tsx create mode 100644 client/src/components/Prompts/PromptDetails.tsx create mode 100644 client/src/components/Prompts/PromptEditor.tsx create mode 100644 client/src/components/Prompts/PromptForm.tsx create mode 100644 client/src/components/Prompts/PromptName.tsx create mode 100644 client/src/components/Prompts/PromptVariables.tsx create mode 100644 client/src/components/Prompts/PromptVersions.tsx create mode 100644 client/src/components/Prompts/PromptsAccordion.tsx create mode 100644 client/src/components/Prompts/PromptsView.tsx create mode 100644 client/src/components/Prompts/SharePrompt.tsx create mode 100644 client/src/components/Prompts/SkeletonForm.tsx create mode 100644 client/src/components/Prompts/VariablesDropdown.tsx create mode 100644 client/src/components/Prompts/index.ts create mode 100644 client/src/components/Share/Message.tsx create mode 100644 client/src/components/Share/MessageIcon.tsx create mode 100644 client/src/components/Share/MessagesView.tsx create mode 100644 client/src/components/Share/MultiMessage.tsx create mode 100644 client/src/components/Share/ShareArtifacts.tsx create mode 100644 client/src/components/Share/ShareMessagesProvider.tsx create mode 100644 client/src/components/Share/ShareView.tsx create mode 100644 client/src/components/SharePoint/SharePointPickerDialog.tsx create mode 100644 client/src/components/SharePoint/index.ts create mode 100644 client/src/components/Sharing/AccessRolesPicker.tsx create mode 100644 client/src/components/Sharing/GenericGrantAccessDialog.tsx create mode 100644 client/src/components/Sharing/PeoplePicker/PeoplePickerSearchItem.tsx create mode 100644 client/src/components/Sharing/PeoplePicker/SearchPicker.tsx create mode 100644 client/src/components/Sharing/PeoplePicker/SelectedPrincipalsList.tsx create mode 100644 client/src/components/Sharing/PeoplePicker/UnifiedPeopleSearch.tsx create mode 100644 client/src/components/Sharing/PeoplePicker/index.ts create mode 100644 client/src/components/Sharing/PeoplePickerAdminSettings.tsx create mode 100644 client/src/components/Sharing/PrincipalAvatar.tsx create mode 100644 client/src/components/Sharing/PublicSharingToggle.tsx create mode 100644 client/src/components/Sharing/index.ts create mode 100644 client/src/components/SidePanel/Agents/ActionsInput.tsx create mode 100644 client/src/components/SidePanel/Agents/ActionsPanel.tsx create mode 100644 client/src/components/SidePanel/Agents/ActionsTable/Columns.tsx create mode 100644 client/src/components/SidePanel/Agents/ActionsTable/Table.tsx create mode 100644 client/src/components/SidePanel/Agents/ActionsTable/index.ts create mode 100644 client/src/components/SidePanel/Agents/AdminSettings.tsx create mode 100644 client/src/components/SidePanel/Agents/Advanced/AdvancedButton.tsx create mode 100644 client/src/components/SidePanel/Agents/Advanced/AdvancedPanel.tsx create mode 100644 client/src/components/SidePanel/Agents/Advanced/AgentChain.tsx create mode 100644 client/src/components/SidePanel/Agents/Advanced/AgentHandoffs.tsx create mode 100644 client/src/components/SidePanel/Agents/Advanced/MaxAgentSteps.tsx create mode 100644 client/src/components/SidePanel/Agents/AgentAvatar.tsx create mode 100644 client/src/components/SidePanel/Agents/AgentCategorySelector.tsx create mode 100644 client/src/components/SidePanel/Agents/AgentConfig.tsx create mode 100644 client/src/components/SidePanel/Agents/AgentFooter.tsx create mode 100644 client/src/components/SidePanel/Agents/AgentPanel.test.tsx create mode 100644 client/src/components/SidePanel/Agents/AgentPanel.tsx create mode 100644 client/src/components/SidePanel/Agents/AgentPanelSkeleton.tsx create mode 100644 client/src/components/SidePanel/Agents/AgentPanelSwitch.tsx create mode 100644 client/src/components/SidePanel/Agents/AgentSelect.tsx create mode 100644 client/src/components/SidePanel/Agents/AgentTool.tsx create mode 100644 client/src/components/SidePanel/Agents/Artifacts.tsx create mode 100644 client/src/components/SidePanel/Agents/Code/Action.tsx create mode 100644 client/src/components/SidePanel/Agents/Code/ApiKeyDialog.tsx create mode 100644 client/src/components/SidePanel/Agents/Code/Files.tsx create mode 100644 client/src/components/SidePanel/Agents/Code/Form.tsx create mode 100644 client/src/components/SidePanel/Agents/DeleteButton.tsx create mode 100644 client/src/components/SidePanel/Agents/DuplicateAgent.tsx create mode 100644 client/src/components/SidePanel/Agents/FileContext.tsx create mode 100644 client/src/components/SidePanel/Agents/FileSearch.tsx create mode 100644 client/src/components/SidePanel/Agents/FileSearchCheckbox.tsx create mode 100644 client/src/components/SidePanel/Agents/ImageVision.tsx create mode 100644 client/src/components/SidePanel/Agents/Images.tsx create mode 100644 client/src/components/SidePanel/Agents/Instructions.tsx create mode 100644 client/src/components/SidePanel/Agents/MCPIcon.tsx create mode 100644 client/src/components/SidePanel/Agents/MCPTool.tsx create mode 100644 client/src/components/SidePanel/Agents/MCPTools.tsx create mode 100644 client/src/components/SidePanel/Agents/ModelPanel.tsx create mode 100644 client/src/components/SidePanel/Agents/Retrieval.tsx create mode 100644 client/src/components/SidePanel/Agents/Search/Action.tsx create mode 100644 client/src/components/SidePanel/Agents/Search/ApiKeyDialog.test.tsx create mode 100644 client/src/components/SidePanel/Agents/Search/ApiKeyDialog.tsx create mode 100644 client/src/components/SidePanel/Agents/Search/Form.tsx create mode 100644 client/src/components/SidePanel/Agents/Search/InputSection.tsx create mode 100644 client/src/components/SidePanel/Agents/UnconfiguredMCPTool.tsx create mode 100644 client/src/components/SidePanel/Agents/UninitializedMCPTool.tsx create mode 100644 client/src/components/SidePanel/Agents/Version/VersionButton.tsx create mode 100644 client/src/components/SidePanel/Agents/Version/VersionContent.tsx create mode 100644 client/src/components/SidePanel/Agents/Version/VersionItem.tsx create mode 100644 client/src/components/SidePanel/Agents/Version/VersionPanel.tsx create mode 100644 client/src/components/SidePanel/Agents/Version/__tests__/VersionContent.spec.tsx create mode 100644 client/src/components/SidePanel/Agents/Version/__tests__/VersionItem.spec.tsx create mode 100644 client/src/components/SidePanel/Agents/Version/__tests__/VersionPanel.spec.tsx create mode 100644 client/src/components/SidePanel/Agents/Version/__tests__/isActiveVersion.spec.ts create mode 100644 client/src/components/SidePanel/Agents/Version/isActiveVersion.ts create mode 100644 client/src/components/SidePanel/Agents/Version/types.ts create mode 100644 client/src/components/SidePanel/Agents/__tests__/AgentAvatar.spec.tsx create mode 100644 client/src/components/SidePanel/Agents/__tests__/AgentFooter.spec.tsx create mode 100644 client/src/components/SidePanel/Agents/__tests__/AgentPanel.helpers.spec.ts create mode 100644 client/src/components/SidePanel/Agents/config.ts create mode 100644 client/src/components/SidePanel/ArtifactsPanel.tsx create mode 100644 client/src/components/SidePanel/Bookmarks/BookmarkCard.tsx create mode 100644 client/src/components/SidePanel/Bookmarks/BookmarkCardActions.tsx create mode 100644 client/src/components/SidePanel/Bookmarks/BookmarkEmptyState.tsx create mode 100644 client/src/components/SidePanel/Bookmarks/BookmarkList.tsx create mode 100644 client/src/components/SidePanel/Bookmarks/BookmarkPanel.tsx create mode 100644 client/src/components/SidePanel/Bookmarks/BookmarkTable.tsx create mode 100644 client/src/components/SidePanel/Bookmarks/index.ts create mode 100644 client/src/components/SidePanel/Builder/Action.tsx create mode 100644 client/src/components/SidePanel/Builder/ActionCallback.tsx create mode 100644 client/src/components/SidePanel/Builder/ActionsAuth.tsx create mode 100644 client/src/components/SidePanel/Builder/ActionsInput.tsx create mode 100644 client/src/components/SidePanel/Builder/ActionsPanel.tsx create mode 100644 client/src/components/SidePanel/Builder/ActionsTable/Columns.tsx create mode 100644 client/src/components/SidePanel/Builder/ActionsTable/Table.tsx create mode 100644 client/src/components/SidePanel/Builder/ActionsTable/index.ts create mode 100644 client/src/components/SidePanel/Builder/AppendDateCheckbox.tsx create mode 100644 client/src/components/SidePanel/Builder/AssistantAvatar.tsx create mode 100644 client/src/components/SidePanel/Builder/AssistantConversationStarters.tsx create mode 100644 client/src/components/SidePanel/Builder/AssistantPanel.tsx create mode 100644 client/src/components/SidePanel/Builder/AssistantSelect.tsx create mode 100644 client/src/components/SidePanel/Builder/AssistantTool.tsx create mode 100644 client/src/components/SidePanel/Builder/CapabilitiesForm.tsx create mode 100644 client/src/components/SidePanel/Builder/Code.tsx create mode 100644 client/src/components/SidePanel/Builder/CodeFiles.tsx create mode 100644 client/src/components/SidePanel/Builder/ContextButton.tsx create mode 100644 client/src/components/SidePanel/Builder/ImageVision.tsx create mode 100644 client/src/components/SidePanel/Builder/Images.tsx create mode 100644 client/src/components/SidePanel/Builder/Knowledge.tsx create mode 100644 client/src/components/SidePanel/Builder/PanelSwitch.tsx create mode 100644 client/src/components/SidePanel/Builder/Retrieval.tsx create mode 100644 client/src/components/SidePanel/Files/Panel.tsx create mode 100644 client/src/components/SidePanel/Files/PanelColumns.tsx create mode 100644 client/src/components/SidePanel/Files/PanelFileCell.tsx create mode 100644 client/src/components/SidePanel/Files/PanelTable.tsx create mode 100644 client/src/components/SidePanel/GPUServerStatus.tsx create mode 100644 client/src/components/SidePanel/GPUServerStatus.tsx.backup create mode 100644 client/src/components/SidePanel/MCPBuilder/MCPAdminSettings.tsx create mode 100644 client/src/components/SidePanel/MCPBuilder/MCPBuilderPanel.tsx create mode 100644 client/src/components/SidePanel/MCPBuilder/MCPCardActions.tsx create mode 100644 client/src/components/SidePanel/MCPBuilder/MCPServerCard.tsx create mode 100644 client/src/components/SidePanel/MCPBuilder/MCPServerDialog/MCPServerForm.tsx create mode 100644 client/src/components/SidePanel/MCPBuilder/MCPServerDialog/hooks/useMCPServerForm.ts create mode 100644 client/src/components/SidePanel/MCPBuilder/MCPServerDialog/index.tsx create mode 100644 client/src/components/SidePanel/MCPBuilder/MCPServerDialog/sections/AuthSection.tsx create mode 100644 client/src/components/SidePanel/MCPBuilder/MCPServerDialog/sections/BasicInfoSection.tsx create mode 100644 client/src/components/SidePanel/MCPBuilder/MCPServerDialog/sections/ConnectionSection.tsx create mode 100644 client/src/components/SidePanel/MCPBuilder/MCPServerDialog/sections/TransportSection.tsx create mode 100644 client/src/components/SidePanel/MCPBuilder/MCPServerDialog/sections/TrustSection.tsx create mode 100644 client/src/components/SidePanel/MCPBuilder/MCPServerDialog/utils/urlUtils.ts create mode 100644 client/src/components/SidePanel/MCPBuilder/MCPServerList.tsx create mode 100644 client/src/components/SidePanel/MCPBuilder/MCPStatusBadge.tsx create mode 100644 client/src/components/SidePanel/MCPBuilder/index.ts create mode 100644 client/src/components/SidePanel/Memories/AdminSettings.tsx create mode 100644 client/src/components/SidePanel/Memories/MemoryCard.tsx create mode 100644 client/src/components/SidePanel/Memories/MemoryCardActions.tsx create mode 100644 client/src/components/SidePanel/Memories/MemoryCreateDialog.tsx create mode 100644 client/src/components/SidePanel/Memories/MemoryEditDialog.tsx create mode 100644 client/src/components/SidePanel/Memories/MemoryEmptyState.tsx create mode 100644 client/src/components/SidePanel/Memories/MemoryList.tsx create mode 100644 client/src/components/SidePanel/Memories/MemoryPanel.tsx create mode 100644 client/src/components/SidePanel/Memories/MemoryUsageBadge.tsx create mode 100644 client/src/components/SidePanel/Memories/index.ts create mode 100644 client/src/components/SidePanel/Nav.tsx create mode 100644 client/src/components/SidePanel/Parameters/DynamicCheckbox.tsx create mode 100644 client/src/components/SidePanel/Parameters/DynamicCombobox.tsx create mode 100644 client/src/components/SidePanel/Parameters/DynamicDropdown.tsx create mode 100644 client/src/components/SidePanel/Parameters/DynamicInput.tsx create mode 100644 client/src/components/SidePanel/Parameters/DynamicSlider.tsx create mode 100644 client/src/components/SidePanel/Parameters/DynamicSwitch.tsx create mode 100644 client/src/components/SidePanel/Parameters/DynamicTags.tsx create mode 100644 client/src/components/SidePanel/Parameters/DynamicTextarea.tsx create mode 100644 client/src/components/SidePanel/Parameters/OptionHover.tsx create mode 100644 client/src/components/SidePanel/Parameters/Panel.tsx create mode 100644 client/src/components/SidePanel/Parameters/components.tsx create mode 100644 client/src/components/SidePanel/Parameters/index.ts create mode 100644 client/src/components/SidePanel/SidePanel.tsx create mode 100644 client/src/components/SidePanel/SidePanelGroup.tsx create mode 100644 client/src/components/SidePanel/data.tsx create mode 100644 client/src/components/SidePanel/index.ts create mode 100644 client/src/components/System/WakeLockManager.tsx create mode 100644 client/src/components/Tools/AssistantToolsDialog.tsx create mode 100644 client/src/components/Tools/MCPToolItem.tsx create mode 100644 client/src/components/Tools/MCPToolSelectDialog.tsx create mode 100644 client/src/components/Tools/ToolItem.tsx create mode 100644 client/src/components/Tools/ToolSelectDialog.tsx create mode 100644 client/src/components/Tools/index.ts create mode 100644 client/src/components/Web/Citation.tsx create mode 100644 client/src/components/Web/Context.tsx create mode 100644 client/src/components/Web/SourceHovercard.tsx create mode 100644 client/src/components/Web/Sources.tsx create mode 100644 client/src/components/Web/SourcesErrorBoundary.tsx create mode 100644 client/src/components/Web/__tests__/SourcesErrorBoundary.test.tsx create mode 100644 client/src/components/Web/index.ts create mode 100644 client/src/components/Web/plugin.ts create mode 100644 client/src/components/Web/types.ts create mode 100644 client/src/components/index.ts create mode 100644 client/src/components/ui/AdminSettingsDialog.tsx create mode 100644 client/src/components/ui/TermsAndConditionsModal.tsx create mode 100644 client/src/components/ui/index.ts create mode 100644 client/src/constants/agentCategories.ts create mode 100644 client/src/data-provider/Agents/index.ts create mode 100644 client/src/data-provider/Agents/mutations.ts create mode 100644 client/src/data-provider/Agents/queries.ts create mode 100644 client/src/data-provider/Auth/index.ts create mode 100644 client/src/data-provider/Auth/mutations.ts create mode 100644 client/src/data-provider/Auth/queries.ts create mode 100644 client/src/data-provider/Endpoints/index.ts create mode 100644 client/src/data-provider/Endpoints/queries.ts create mode 100644 client/src/data-provider/Favorites.ts create mode 100644 client/src/data-provider/Files/index.ts create mode 100644 client/src/data-provider/Files/mutations.ts create mode 100644 client/src/data-provider/Files/queries.ts create mode 100644 client/src/data-provider/Files/sharepoint.ts create mode 100644 client/src/data-provider/MCP/index.ts create mode 100644 client/src/data-provider/MCP/mutations.ts create mode 100644 client/src/data-provider/MCP/queries.ts create mode 100644 client/src/data-provider/Memories/index.ts create mode 100644 client/src/data-provider/Memories/queries.ts create mode 100644 client/src/data-provider/Messages/index.ts create mode 100644 client/src/data-provider/Messages/mutations.ts create mode 100644 client/src/data-provider/Messages/queries.ts create mode 100644 client/src/data-provider/Misc/index.ts create mode 100644 client/src/data-provider/Misc/queries.ts create mode 100644 client/src/data-provider/SSE/index.ts create mode 100644 client/src/data-provider/SSE/mutations.ts create mode 100644 client/src/data-provider/SSE/queries.ts create mode 100644 client/src/data-provider/Tools/index.ts create mode 100644 client/src/data-provider/Tools/mutations.ts create mode 100644 client/src/data-provider/Tools/queries.ts create mode 100644 client/src/data-provider/__tests__/connection.test.ts create mode 100644 client/src/data-provider/__tests__/memories.test.ts create mode 100644 client/src/data-provider/connection.ts create mode 100644 client/src/data-provider/index.ts create mode 100644 client/src/data-provider/mutations.ts create mode 100644 client/src/data-provider/prompts.ts create mode 100644 client/src/data-provider/queries.ts create mode 100644 client/src/data-provider/roles.ts create mode 100644 client/src/data-provider/tags.ts create mode 100644 client/src/hooks/Agents/__tests__/useAgentCategories.spec.tsx create mode 100644 client/src/hooks/Agents/__tests__/useAgentToolPermissions.render.test.ts create mode 100644 client/src/hooks/Agents/__tests__/useAgentToolPermissions.test.ts create mode 100644 client/src/hooks/Agents/index.ts create mode 100644 client/src/hooks/Agents/useAgentCapabilities.ts create mode 100644 client/src/hooks/Agents/useAgentCategories.tsx create mode 100644 client/src/hooks/Agents/useAgentDefaultPermissionLevel.ts create mode 100644 client/src/hooks/Agents/useAgentToolPermissions.ts create mode 100644 client/src/hooks/Agents/useAgentsMap.ts create mode 100644 client/src/hooks/Agents/useApplyModelSpecAgents.ts create mode 100644 client/src/hooks/Agents/useGetAgentsConfig.ts create mode 100644 client/src/hooks/Agents/useSelectAgent.ts create mode 100644 client/src/hooks/ApiErrorBoundaryContext.tsx create mode 100644 client/src/hooks/Artifacts/__tests__/useArtifactProps.test.ts create mode 100644 client/src/hooks/Artifacts/__tests__/useArtifacts.test.ts create mode 100644 client/src/hooks/Artifacts/useArtifactProps.ts create mode 100644 client/src/hooks/Artifacts/useArtifacts.ts create mode 100644 client/src/hooks/Artifacts/useAutoScroll.ts create mode 100644 client/src/hooks/Assistants/index.ts create mode 100644 client/src/hooks/Assistants/useAssistantListMap.ts create mode 100644 client/src/hooks/Assistants/useAssistantsMap.ts create mode 100644 client/src/hooks/Assistants/useSelectAssistant.ts create mode 100644 client/src/hooks/Audio/MediaSourceAppender.ts create mode 100644 client/src/hooks/Audio/index.ts create mode 100644 client/src/hooks/Audio/useAudioRef.ts create mode 100644 client/src/hooks/Audio/useCustomAudioRef.ts create mode 100644 client/src/hooks/Audio/usePauseGlobalAudio.ts create mode 100644 client/src/hooks/Audio/useTTSBrowser.ts create mode 100644 client/src/hooks/Audio/useTTSExternal.ts create mode 100644 client/src/hooks/AuthContext.tsx create mode 100644 client/src/hooks/Chat/__tests__/useFocusChatEffect.spec.tsx create mode 100644 client/src/hooks/Chat/index.ts create mode 100644 client/src/hooks/Chat/useAddedResponse.ts create mode 100644 client/src/hooks/Chat/useChatFunctions.ts create mode 100644 client/src/hooks/Chat/useChatHelpers.ts create mode 100644 client/src/hooks/Chat/useFocusChatEffect.ts create mode 100644 client/src/hooks/Chat/useGetAddedConvo.ts create mode 100644 client/src/hooks/Chat/useIdChangeEffect.ts create mode 100644 client/src/hooks/Config/index.ts create mode 100644 client/src/hooks/Config/useAppStartup.ts create mode 100644 client/src/hooks/Config/useClearStates.ts create mode 100644 client/src/hooks/Config/useSpeechSettingsInit.ts create mode 100644 client/src/hooks/Conversations/index.ts create mode 100644 client/src/hooks/Conversations/useBookmarkSuccess.ts create mode 100644 client/src/hooks/Conversations/useDebouncedInput.ts create mode 100644 client/src/hooks/Conversations/useDefaultConvo.ts create mode 100644 client/src/hooks/Conversations/useExportConversation.ts create mode 100644 client/src/hooks/Conversations/useGenerateConvo.ts create mode 100644 client/src/hooks/Conversations/useGetSender.ts create mode 100644 client/src/hooks/Conversations/useNavigateToConvo.tsx create mode 100644 client/src/hooks/Conversations/useParameterEffects.ts create mode 100644 client/src/hooks/Conversations/usePresetIndexOptions.ts create mode 100644 client/src/hooks/Conversations/usePresets.ts create mode 100644 client/src/hooks/Conversations/useSearchEnabled.ts create mode 100644 client/src/hooks/Conversations/useSetIndexOptions.ts create mode 100644 client/src/hooks/Conversations/useUpdateTagsInConvo.ts create mode 100644 client/src/hooks/Endpoint/Icons.tsx create mode 100644 client/src/hooks/Endpoint/UnknownIcon.tsx create mode 100644 client/src/hooks/Endpoint/index.ts create mode 100644 client/src/hooks/Endpoint/useEndpoints.ts create mode 100644 client/src/hooks/Endpoint/useKeyDialog.ts create mode 100644 client/src/hooks/Endpoint/useSelectorEffects.ts create mode 100644 client/src/hooks/Files/index.ts create mode 100644 client/src/hooks/Files/useClientResize.ts create mode 100644 client/src/hooks/Files/useDelayedUploadToast.ts create mode 100644 client/src/hooks/Files/useDeleteFilesFromTable.tsx create mode 100644 client/src/hooks/Files/useDragHelpers.ts create mode 100644 client/src/hooks/Files/useFileDeletion.ts create mode 100644 client/src/hooks/Files/useFileHandling.ts create mode 100644 client/src/hooks/Files/useFileMap.ts create mode 100644 client/src/hooks/Files/useSetFilesToDelete.ts create mode 100644 client/src/hooks/Files/useSharePointDownload.ts create mode 100644 client/src/hooks/Files/useSharePointFileHandling.ts create mode 100644 client/src/hooks/Files/useSharePointPicker.ts create mode 100644 client/src/hooks/Files/useSharePointToken.ts create mode 100644 client/src/hooks/Files/useUpdateFiles.ts create mode 100644 client/src/hooks/Generic/index.ts create mode 100644 client/src/hooks/Generic/useLazyEffect.ts create mode 100644 client/src/hooks/Generic/useShiftKey.ts create mode 100644 client/src/hooks/Input/index.ts create mode 100644 client/src/hooks/Input/useAutoSave.ts create mode 100644 client/src/hooks/Input/useDebounce.ts create mode 100644 client/src/hooks/Input/useGetAudioSettings.ts create mode 100644 client/src/hooks/Input/useHandleKeyUp.ts create mode 100644 client/src/hooks/Input/useMentions.ts create mode 100644 client/src/hooks/Input/useMultipleKeys.ts create mode 100644 client/src/hooks/Input/useQueryParams.spec.ts create mode 100644 client/src/hooks/Input/useQueryParams.ts create mode 100644 client/src/hooks/Input/useRequiresKey.ts create mode 100644 client/src/hooks/Input/useSelectMention.ts create mode 100644 client/src/hooks/Input/useSpeechToText.ts create mode 100644 client/src/hooks/Input/useSpeechToTextBrowser.ts create mode 100644 client/src/hooks/Input/useSpeechToTextExternal.ts create mode 100644 client/src/hooks/Input/useTextToSpeech.ts create mode 100644 client/src/hooks/Input/useTextToSpeechBrowser.ts create mode 100644 client/src/hooks/Input/useTextToSpeechExternal.ts create mode 100644 client/src/hooks/Input/useTextarea.ts create mode 100644 client/src/hooks/Input/useUserKey.ts create mode 100644 client/src/hooks/MCP/__tests__/useMCPSelect.test.tsx create mode 100644 client/src/hooks/MCP/index.ts create mode 100644 client/src/hooks/MCP/useMCPConnectionStatus.ts create mode 100644 client/src/hooks/MCP/useMCPSelect.ts create mode 100644 client/src/hooks/MCP/useMCPServerManager.ts create mode 100644 client/src/hooks/MCP/useRemoveMCPTool.ts create mode 100644 client/src/hooks/MCP/useVisibleTools.ts create mode 100644 client/src/hooks/Mermaid/index.ts create mode 100644 client/src/hooks/Mermaid/useDebouncedMermaid.ts create mode 100644 client/src/hooks/Mermaid/useMermaid.ts create mode 100644 client/src/hooks/Messages/index.ts create mode 100644 client/src/hooks/Messages/useAttachments.ts create mode 100644 client/src/hooks/Messages/useBuildMessageTree.ts create mode 100644 client/src/hooks/Messages/useContentMetadata.ts create mode 100644 client/src/hooks/Messages/useConversationUIResources.ts create mode 100644 client/src/hooks/Messages/useCopyToClipboard.spec.ts create mode 100644 client/src/hooks/Messages/useCopyToClipboard.ts create mode 100644 client/src/hooks/Messages/useMessageActions.tsx create mode 100644 client/src/hooks/Messages/useMessageHelpers.tsx create mode 100644 client/src/hooks/Messages/useMessageProcess.tsx create mode 100644 client/src/hooks/Messages/useMessageScrolling.ts create mode 100644 client/src/hooks/Messages/useProgress.ts create mode 100644 client/src/hooks/Messages/useSearchResultsByTurn.ts create mode 100644 client/src/hooks/Messages/useSubmitMessage.ts create mode 100644 client/src/hooks/Nav/index.ts create mode 100644 client/src/hooks/Nav/useNavHelpers.ts create mode 100644 client/src/hooks/Nav/useNavScrolling.ts create mode 100644 client/src/hooks/Nav/useShowMarketplace.ts create mode 100644 client/src/hooks/Nav/useSideNavLinks.ts create mode 100644 client/src/hooks/Nav/useSideNavLinks.ts.backup create mode 100644 client/src/hooks/Plugins/index.ts create mode 100644 client/src/hooks/Plugins/useAuthCodeTool.ts create mode 100644 client/src/hooks/Plugins/useAuthSearchTool.ts create mode 100644 client/src/hooks/Plugins/useCodeApiKeyForm.ts create mode 100644 client/src/hooks/Plugins/usePluginDialogHelpers.ts create mode 100644 client/src/hooks/Plugins/useSearchApiKeyForm.ts create mode 100644 client/src/hooks/Plugins/useToolCallsMap.ts create mode 100644 client/src/hooks/Plugins/useToolToggle.ts create mode 100644 client/src/hooks/Prompts/index.ts create mode 100644 client/src/hooks/Prompts/useCategories.tsx create mode 100644 client/src/hooks/Prompts/usePromptGroupsNav.ts create mode 100644 client/src/hooks/Roles/index.ts create mode 100644 client/src/hooks/Roles/useHasAccess.ts create mode 100644 client/src/hooks/SSE/index.ts create mode 100644 client/src/hooks/SSE/useAdaptiveSSE.ts create mode 100644 client/src/hooks/SSE/useAttachmentHandler.ts create mode 100644 client/src/hooks/SSE/useContentHandler.ts create mode 100644 client/src/hooks/SSE/useEventHandlers.ts create mode 100644 client/src/hooks/SSE/useResumableSSE.ts create mode 100644 client/src/hooks/SSE/useResumeOnLoad.ts create mode 100644 client/src/hooks/SSE/useSSE.ts create mode 100644 client/src/hooks/SSE/useStepHandler.ts create mode 100644 client/src/hooks/ScreenshotContext.tsx create mode 100644 client/src/hooks/Sharing/index.ts create mode 100644 client/src/hooks/Sharing/useCanSharePublic.ts create mode 100644 client/src/hooks/Sharing/usePeoplePickerPermissions.ts create mode 100644 client/src/hooks/Sharing/useResourcePermissionState.ts create mode 100644 client/src/hooks/index.ts create mode 100644 client/src/hooks/useChatBadges.ts create mode 100644 client/src/hooks/useDocumentTitle.ts create mode 100644 client/src/hooks/useFavorites.ts create mode 100644 client/src/hooks/useGPUServerStatus.ts create mode 100644 client/src/hooks/useGenerationsByLatest.ts create mode 100644 client/src/hooks/useInfiniteScroll.ts create mode 100644 client/src/hooks/useLocalStorage.tsx create mode 100644 client/src/hooks/useLocalStorageAlt.tsx create mode 100644 client/src/hooks/useLocalize.ts create mode 100644 client/src/hooks/useLocalizedConfig.ts create mode 100644 client/src/hooks/useNewConvo.ts create mode 100644 client/src/hooks/usePersonalizationAccess.ts create mode 100644 client/src/hooks/useResourcePermissions.ts create mode 100644 client/src/hooks/useScrollToRef.ts create mode 100644 client/src/hooks/useTimeout.tsx create mode 100644 client/src/hooks/useVirtualGrid.ts create mode 100644 client/src/hooks/useWakeLock.ts create mode 100644 client/src/locales/README.md create mode 100644 client/src/locales/Translation.spec.ts create mode 100644 client/src/locales/ar/translation.json create mode 100644 client/src/locales/bo/translation.json create mode 100644 client/src/locales/bs/translation.json create mode 100644 client/src/locales/ca/translation.json create mode 100644 client/src/locales/cs/translation.json create mode 100644 client/src/locales/da/translation.json create mode 100644 client/src/locales/de/translation.json create mode 100644 client/src/locales/en/translation.json create mode 100644 client/src/locales/es/translation.json create mode 100644 client/src/locales/et/translation.json create mode 100644 client/src/locales/fa/translation.json create mode 100644 client/src/locales/fi/translation.json create mode 100644 client/src/locales/fr/translation.json create mode 100644 client/src/locales/he/translation.json create mode 100644 client/src/locales/hu/translation.json create mode 100644 client/src/locales/hy/translation.json create mode 100644 client/src/locales/i18n.ts create mode 100644 client/src/locales/id/translation.json create mode 100644 client/src/locales/it/translation.json create mode 100644 client/src/locales/ja/translation.json create mode 100644 client/src/locales/ka/translation.json create mode 100644 client/src/locales/ko/translation.json create mode 100644 client/src/locales/lv/translation.json create mode 100644 client/src/locales/nb/translation.json create mode 100644 client/src/locales/nl/translation.json create mode 100644 client/src/locales/pl/translation.json create mode 100644 client/src/locales/pt-BR/translation.json create mode 100644 client/src/locales/pt-PT/translation.json create mode 100644 client/src/locales/ru/translation.json create mode 100644 client/src/locales/sl/translation.json create mode 100644 client/src/locales/sv/translation.json create mode 100644 client/src/locales/th/translation.json create mode 100644 client/src/locales/tr/translation.json create mode 100644 client/src/locales/ug/translation.json create mode 100644 client/src/locales/uk/translation.json create mode 100644 client/src/locales/vi/translation.json create mode 100644 client/src/locales/zh-Hans/translation.json create mode 100644 client/src/locales/zh-Hant/translation.json create mode 100644 client/src/main.jsx create mode 100644 client/src/mobile.css create mode 100644 client/src/routes/ChatRoute.tsx create mode 100644 client/src/routes/Dashboard.tsx create mode 100644 client/src/routes/Layouts/DashBreadcrumb.tsx create mode 100644 client/src/routes/Layouts/Dashboard.tsx create mode 100644 client/src/routes/Layouts/Login.tsx create mode 100644 client/src/routes/Layouts/Startup.tsx create mode 100644 client/src/routes/Root.tsx create mode 100644 client/src/routes/RouteErrorBoundary.tsx create mode 100644 client/src/routes/Search.tsx create mode 100644 client/src/routes/ShareRoute.tsx create mode 100644 client/src/routes/__tests__/useAuthRedirect.spec.tsx create mode 100644 client/src/routes/index.tsx create mode 100644 client/src/routes/useAuthRedirect.ts create mode 100644 client/src/store/agents.ts create mode 100644 client/src/store/artifacts.ts create mode 100644 client/src/store/endpoints.ts create mode 100644 client/src/store/families.ts create mode 100644 client/src/store/favorites.ts create mode 100644 client/src/store/fontSize.ts create mode 100644 client/src/store/index.ts create mode 100644 client/src/store/jotai-utils.ts create mode 100644 client/src/store/language.ts create mode 100644 client/src/store/mcp.ts create mode 100644 client/src/store/misc.ts create mode 100644 client/src/store/preset.ts create mode 100644 client/src/store/prompts.ts create mode 100644 client/src/store/search.ts create mode 100644 client/src/store/settings.ts create mode 100644 client/src/store/showThinking.ts create mode 100644 client/src/store/submission.ts create mode 100644 client/src/store/temporary.ts create mode 100644 client/src/store/text.ts create mode 100644 client/src/store/toast.ts create mode 100644 client/src/store/user.ts create mode 100644 client/src/store/utils.ts create mode 100644 client/src/style.css create mode 100644 client/src/utils/__tests__/agents.spec.tsx create mode 100644 client/src/utils/__tests__/citations.test.ts create mode 100644 client/src/utils/__tests__/cleanupPreset.test.ts create mode 100644 client/src/utils/__tests__/imageResize.test.ts create mode 100644 client/src/utils/__tests__/markdown.test.ts create mode 100644 client/src/utils/__tests__/presets.test.ts create mode 100644 client/src/utils/__tests__/share.test.ts create mode 100644 client/src/utils/__tests__/timestamps.test.ts create mode 100644 client/src/utils/agents.tsx create mode 100644 client/src/utils/artifacts.ts create mode 100644 client/src/utils/buildDefaultConvo.ts create mode 100644 client/src/utils/buildTree.ts create mode 100644 client/src/utils/citations.ts create mode 100644 client/src/utils/cleanupPreset.ts create mode 100644 client/src/utils/cn.ts create mode 100644 client/src/utils/collection.ts create mode 100644 client/src/utils/conversationTags.spec.ts create mode 100644 client/src/utils/conversationTags.ts create mode 100644 client/src/utils/convos.fakeData.ts create mode 100644 client/src/utils/convos.spec.ts create mode 100644 client/src/utils/convos.ts create mode 100644 client/src/utils/createChatSearchParams.spec.ts create mode 100644 client/src/utils/createChatSearchParams.ts create mode 100644 client/src/utils/drafts.ts create mode 100644 client/src/utils/email.ts create mode 100644 client/src/utils/endpoints.spec.ts create mode 100644 client/src/utils/endpoints.ts create mode 100644 client/src/utils/files.ts create mode 100644 client/src/utils/forms.tsx create mode 100644 client/src/utils/getDefaultEndpoint.ts create mode 100644 client/src/utils/getLoginError.ts create mode 100644 client/src/utils/getThemeFromEnv.js create mode 100644 client/src/utils/heicConverter.ts create mode 100644 client/src/utils/imageResize.ts create mode 100644 client/src/utils/index.ts create mode 100644 client/src/utils/json.ts create mode 100644 client/src/utils/languages.ts create mode 100644 client/src/utils/latex.spec.ts create mode 100644 client/src/utils/latex.ts create mode 100644 client/src/utils/localStorage.ts create mode 100644 client/src/utils/logger.ts create mode 100644 client/src/utils/map.ts create mode 100644 client/src/utils/markdown.ts create mode 100644 client/src/utils/memory.ts create mode 100644 client/src/utils/mermaid.ts create mode 100644 client/src/utils/messages.ts create mode 100644 client/src/utils/presets.ts create mode 100644 client/src/utils/promptGroups.ts create mode 100644 client/src/utils/prompts.ts create mode 100644 client/src/utils/resetConvo.ts create mode 100644 client/src/utils/resources.ts create mode 100644 client/src/utils/roles.ts create mode 100644 client/src/utils/routes.ts create mode 100644 client/src/utils/scaleImage.ts create mode 100644 client/src/utils/share.ts create mode 100644 client/src/utils/textarea.ts create mode 100644 client/src/utils/timestamps.ts create mode 100644 client/src/vite-env.d.ts create mode 100644 client/tailwind.config.cjs create mode 100644 client/test/layout-test-utils.tsx create mode 100644 client/test/localStorage.mock create mode 100644 client/test/matchMedia.mock create mode 100644 client/test/resizeObserver.mock create mode 100644 client/test/setupTests.js create mode 100644 client/tsconfig.json create mode 100644 client/vite.config.ts create mode 100644 config/add-balance.js create mode 100644 config/ban-user.js create mode 100644 config/connect.js create mode 100644 config/create-user.js create mode 100644 config/delete-banner.js create mode 100644 config/delete-user.js create mode 100644 config/deployed-update.js create mode 100644 config/flush-cache.js create mode 100644 config/helpers.js create mode 100644 config/invite-user.js create mode 100644 config/list-balances.js create mode 100644 config/list-users.js create mode 100644 config/migrate-agent-permissions.js create mode 100644 config/migrate-prompt-permissions.js create mode 100644 config/packages.js create mode 100644 config/prepare.js create mode 100644 config/reset-meili-sync.js create mode 100644 config/reset-password.js create mode 100644 config/reset-terms.js create mode 100644 config/set-balance.js create mode 100644 config/stop-backend.js create mode 100644 config/translations/README.md create mode 100644 config/translations/anthropic.ts create mode 100644 config/translations/comparisons.ts create mode 100644 config/translations/embeddings.ts create mode 100644 config/translations/file.ts create mode 100644 config/translations/instructions.ts create mode 100644 config/translations/keys.ts create mode 100644 config/translations/main.ts create mode 100644 config/translations/process.ts create mode 100644 config/translations/scan.ts create mode 100644 config/translations/tsconfig.json create mode 100644 config/update-banner.js create mode 100644 config/update.js create mode 100644 config/user-stats.js create mode 100644 deploy-compose.yml create mode 100644 docker-compose.override.yml.example create mode 100644 docker-compose.yml create mode 100644 e2e/config.local.example.ts create mode 100644 e2e/jestSetup.js create mode 100644 e2e/playwright.config.a11y.ts create mode 100644 e2e/playwright.config.local.ts create mode 100644 e2e/playwright.config.ts create mode 100644 e2e/setup/authenticate.ts create mode 100644 e2e/setup/cleanupUser.ts create mode 100644 e2e/setup/global-setup.local.ts create mode 100644 e2e/setup/global-setup.ts create mode 100644 e2e/setup/global-teardown.local.ts create mode 100644 e2e/setup/global-teardown.ts create mode 100644 e2e/specs/a11y.spec.ts create mode 100644 e2e/specs/keys.spec.ts create mode 100644 e2e/specs/landing.spec.ts create mode 100644 e2e/specs/messages.spec.ts create mode 100644 e2e/specs/nav.spec.ts create mode 100644 e2e/specs/popup.spec.ts create mode 100644 e2e/specs/settings.spec.ts create mode 100644 e2e/types.ts create mode 100644 eslint.config.mjs create mode 100755 helm/librechat-rag-api/Chart.yaml create mode 100755 helm/librechat-rag-api/readme.md create mode 100755 helm/librechat-rag-api/templates/_helpers.tpl create mode 100755 helm/librechat-rag-api/templates/configmap.yaml create mode 100755 helm/librechat-rag-api/templates/rag-deployment.yaml create mode 100755 helm/librechat-rag-api/templates/service.yaml create mode 100755 helm/librechat-rag-api/templates/tests/test-connection.yaml create mode 100755 helm/librechat-rag-api/templates/vectordb-secret.yaml create mode 100755 helm/librechat-rag-api/values.yaml create mode 100755 helm/librechat/.helmignore create mode 100755 helm/librechat/Chart.yaml create mode 100644 helm/librechat/DNS_CONFIGURATION.md create mode 100644 helm/librechat/examples/dns-configuration.yaml create mode 100644 helm/librechat/examples/hostaliases-values.yaml create mode 100755 helm/librechat/readme.md create mode 100755 helm/librechat/templates/NOTES.txt create mode 100755 helm/librechat/templates/_checks.yaml create mode 100755 helm/librechat/templates/_helpers.tpl create mode 100755 helm/librechat/templates/configmap-env.yaml create mode 100755 helm/librechat/templates/configmap.yaml create mode 100755 helm/librechat/templates/configmaps-additional.yaml create mode 100755 helm/librechat/templates/deployment.yaml create mode 100755 helm/librechat/templates/hpa.yaml create mode 100755 helm/librechat/templates/ingress.yaml create mode 100755 helm/librechat/templates/persistentvolumeclaim.yaml create mode 100755 helm/librechat/templates/service.yaml create mode 100644 helm/librechat/templates/serviceaccount.yaml create mode 100755 helm/librechat/templates/tests/test-connection.yaml create mode 100755 helm/librechat/values.yaml create mode 100644 librechat.example.yaml create mode 100644 librechat.yaml create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 packages/api/.gitignore create mode 100644 packages/api/babel.config.cjs create mode 100644 packages/api/jest.config.mjs create mode 100644 packages/api/package.json create mode 100644 packages/api/rollup.config.js create mode 100644 packages/api/src/acl/accessControlService.spec.ts create mode 100644 packages/api/src/acl/accessControlService.ts create mode 100644 packages/api/src/agents/__tests__/memory.test.ts create mode 100644 packages/api/src/agents/auth.ts create mode 100644 packages/api/src/agents/avatars.spec.ts create mode 100644 packages/api/src/agents/avatars.ts create mode 100644 packages/api/src/agents/chain.ts create mode 100644 packages/api/src/agents/context.spec.ts create mode 100644 packages/api/src/agents/context.ts create mode 100644 packages/api/src/agents/edges.spec.ts create mode 100644 packages/api/src/agents/edges.ts create mode 100644 packages/api/src/agents/index.ts create mode 100644 packages/api/src/agents/initialize.ts create mode 100644 packages/api/src/agents/legacy.test.ts create mode 100644 packages/api/src/agents/legacy.ts create mode 100644 packages/api/src/agents/memory.spec.ts create mode 100644 packages/api/src/agents/memory.ts create mode 100644 packages/api/src/agents/migration.ts create mode 100644 packages/api/src/agents/resources.test.ts create mode 100644 packages/api/src/agents/resources.ts create mode 100644 packages/api/src/agents/run.ts create mode 100644 packages/api/src/agents/validation.ts create mode 100644 packages/api/src/app/AppService.interface.spec.ts create mode 100644 packages/api/src/app/AppService.spec.ts create mode 100644 packages/api/src/app/cdn.ts create mode 100644 packages/api/src/app/checks.spec.ts create mode 100644 packages/api/src/app/checks.ts create mode 100644 packages/api/src/app/config.test.ts create mode 100644 packages/api/src/app/config.ts create mode 100644 packages/api/src/app/index.ts create mode 100644 packages/api/src/app/limits.ts create mode 100644 packages/api/src/app/permissions.spec.ts create mode 100644 packages/api/src/app/permissions.ts create mode 100644 packages/api/src/auth/domain.spec.ts create mode 100644 packages/api/src/auth/domain.ts create mode 100644 packages/api/src/auth/index.ts create mode 100644 packages/api/src/auth/openid.spec.ts create mode 100644 packages/api/src/auth/openid.ts create mode 100644 packages/api/src/cache/__tests__/cacheConfig.spec.ts create mode 100644 packages/api/src/cache/__tests__/cacheFactory/limiterCache.cache_integration.spec.ts create mode 100644 packages/api/src/cache/__tests__/cacheFactory/sessionCache.cache_integration.spec.ts create mode 100644 packages/api/src/cache/__tests__/cacheFactory/standardCache.cache_integration.spec.ts create mode 100644 packages/api/src/cache/__tests__/cacheFactory/violationCache.cache_integration.spec.ts create mode 100644 packages/api/src/cache/__tests__/redisClients.cache_integration.spec.ts create mode 100644 packages/api/src/cache/__tests__/redisUtils.cache_integration.spec.ts create mode 100644 packages/api/src/cache/cacheConfig.ts create mode 100644 packages/api/src/cache/cacheFactory.ts create mode 100644 packages/api/src/cache/index.ts create mode 100644 packages/api/src/cache/keyvFiles.ts create mode 100644 packages/api/src/cache/keyvMongo.ts create mode 100644 packages/api/src/cache/redisClients.ts create mode 100644 packages/api/src/cache/redisUtils.ts create mode 100644 packages/api/src/cdn/azure.ts create mode 100644 packages/api/src/cdn/firebase.ts create mode 100644 packages/api/src/cdn/index.ts create mode 100644 packages/api/src/cdn/s3.ts create mode 100644 packages/api/src/cluster/LeaderElection.ts create mode 100644 packages/api/src/cluster/__tests__/LeaderElection.cache_integration.spec.ts create mode 100644 packages/api/src/cluster/config.ts create mode 100644 packages/api/src/cluster/index.ts create mode 100644 packages/api/src/crypto/index.ts create mode 100644 packages/api/src/crypto/jwt.ts create mode 100644 packages/api/src/db/utils.ts create mode 100644 packages/api/src/endpoints/anthropic/helpers.ts create mode 100644 packages/api/src/endpoints/anthropic/index.ts create mode 100644 packages/api/src/endpoints/anthropic/initialize.ts create mode 100644 packages/api/src/endpoints/anthropic/llm.spec.ts create mode 100644 packages/api/src/endpoints/anthropic/llm.ts create mode 100644 packages/api/src/endpoints/anthropic/vertex.ts create mode 100644 packages/api/src/endpoints/bedrock/index.ts create mode 100644 packages/api/src/endpoints/bedrock/initialize.spec.ts create mode 100644 packages/api/src/endpoints/bedrock/initialize.ts create mode 100644 packages/api/src/endpoints/config.ts create mode 100644 packages/api/src/endpoints/custom/config.ts create mode 100644 packages/api/src/endpoints/custom/index.ts create mode 100644 packages/api/src/endpoints/custom/initialize.ts create mode 100644 packages/api/src/endpoints/google/index.ts create mode 100644 packages/api/src/endpoints/google/initialize.ts create mode 100644 packages/api/src/endpoints/google/llm.spec.ts create mode 100644 packages/api/src/endpoints/google/llm.ts create mode 100644 packages/api/src/endpoints/index.ts create mode 100644 packages/api/src/endpoints/models.spec.ts create mode 100644 packages/api/src/endpoints/models.ts create mode 100644 packages/api/src/endpoints/openai/config.anthropic.spec.ts create mode 100644 packages/api/src/endpoints/openai/config.backward-compat.spec.ts create mode 100644 packages/api/src/endpoints/openai/config.google.spec.ts create mode 100644 packages/api/src/endpoints/openai/config.spec.ts create mode 100644 packages/api/src/endpoints/openai/config.ts create mode 100644 packages/api/src/endpoints/openai/index.ts create mode 100644 packages/api/src/endpoints/openai/initialize.ts create mode 100644 packages/api/src/endpoints/openai/llm.spec.ts create mode 100644 packages/api/src/endpoints/openai/llm.ts create mode 100644 packages/api/src/endpoints/openai/transform.ts create mode 100644 packages/api/src/files/audio.ts create mode 100644 packages/api/src/files/context.ts create mode 100644 packages/api/src/files/encode/audio.ts create mode 100644 packages/api/src/files/encode/document.spec.ts create mode 100644 packages/api/src/files/encode/document.ts create mode 100644 packages/api/src/files/encode/index.ts create mode 100644 packages/api/src/files/encode/utils.ts create mode 100644 packages/api/src/files/encode/video.ts create mode 100644 packages/api/src/files/filter.spec.ts create mode 100644 packages/api/src/files/filter.ts create mode 100644 packages/api/src/files/index.ts create mode 100644 packages/api/src/files/mistral/crud.spec.ts create mode 100644 packages/api/src/files/mistral/crud.ts create mode 100644 packages/api/src/files/ocr.ts create mode 100644 packages/api/src/files/parse.ts create mode 100644 packages/api/src/files/text.spec.ts create mode 100644 packages/api/src/files/text.ts create mode 100644 packages/api/src/files/validation.spec.ts create mode 100644 packages/api/src/files/validation.ts create mode 100644 packages/api/src/flow/manager.test.ts create mode 100644 packages/api/src/flow/manager.ts create mode 100644 packages/api/src/flow/types.ts create mode 100644 packages/api/src/index.ts create mode 100644 packages/api/src/mcp/ConnectionsRepository.ts create mode 100644 packages/api/src/mcp/MCPConnectionFactory.ts create mode 100644 packages/api/src/mcp/MCPManager.ts create mode 100644 packages/api/src/mcp/UserConnectionManager.ts create mode 100644 packages/api/src/mcp/__tests__/ConnectionsRepository.test.ts create mode 100644 packages/api/src/mcp/__tests__/MCPConnection.test.ts create mode 100644 packages/api/src/mcp/__tests__/MCPConnectionFactory.test.ts create mode 100644 packages/api/src/mcp/__tests__/MCPManager.test.ts create mode 100644 packages/api/src/mcp/__tests__/auth.test.ts create mode 100644 packages/api/src/mcp/__tests__/detectOAuth.integration.dev.ts create mode 100644 packages/api/src/mcp/__tests__/handler.test.ts create mode 100644 packages/api/src/mcp/__tests__/mcp.spec.ts create mode 100644 packages/api/src/mcp/__tests__/parsers.test.ts create mode 100644 packages/api/src/mcp/__tests__/tokens.test.ts create mode 100644 packages/api/src/mcp/__tests__/utils.test.ts create mode 100644 packages/api/src/mcp/__tests__/zod.spec.ts create mode 100644 packages/api/src/mcp/auth.ts create mode 100644 packages/api/src/mcp/connection.ts create mode 100644 packages/api/src/mcp/enum.ts create mode 100644 packages/api/src/mcp/errors.ts create mode 100644 packages/api/src/mcp/mcpConfig.ts create mode 100644 packages/api/src/mcp/oauth/OAuthReconnectionManager.test.ts create mode 100644 packages/api/src/mcp/oauth/OAuthReconnectionManager.ts create mode 100644 packages/api/src/mcp/oauth/OAuthReconnectionTracker.test.ts create mode 100644 packages/api/src/mcp/oauth/OAuthReconnectionTracker.ts create mode 100644 packages/api/src/mcp/oauth/detectOAuth.test.ts create mode 100644 packages/api/src/mcp/oauth/detectOAuth.ts create mode 100644 packages/api/src/mcp/oauth/handler.ts create mode 100644 packages/api/src/mcp/oauth/index.ts create mode 100644 packages/api/src/mcp/oauth/tokens.ts create mode 100644 packages/api/src/mcp/oauth/types.ts create mode 100644 packages/api/src/mcp/parsers.ts create mode 100644 packages/api/src/mcp/registry/MCPServerInspector.ts create mode 100644 packages/api/src/mcp/registry/MCPServersInitializer.ts create mode 100644 packages/api/src/mcp/registry/MCPServersRegistry.ts create mode 100644 packages/api/src/mcp/registry/ServerConfigsRepositoryInterface.ts create mode 100644 packages/api/src/mcp/registry/__tests__/MCPServerInspector.test.ts create mode 100644 packages/api/src/mcp/registry/__tests__/MCPServersInitializer.cache_integration.spec.ts create mode 100644 packages/api/src/mcp/registry/__tests__/MCPServersInitializer.test.ts create mode 100644 packages/api/src/mcp/registry/__tests__/MCPServersRegistry.cache_integration.spec.ts create mode 100644 packages/api/src/mcp/registry/__tests__/MCPServersRegistry.test.ts create mode 100644 packages/api/src/mcp/registry/__tests__/ServerConfigsDB.test.ts create mode 100644 packages/api/src/mcp/registry/__tests__/mcpConnectionsMock.helper.ts create mode 100644 packages/api/src/mcp/registry/cache/BaseRegistryCache.ts create mode 100644 packages/api/src/mcp/registry/cache/RegistryStatusCache.ts create mode 100644 packages/api/src/mcp/registry/cache/ServerConfigsCacheFactory.ts create mode 100644 packages/api/src/mcp/registry/cache/ServerConfigsCacheInMemory.ts create mode 100644 packages/api/src/mcp/registry/cache/ServerConfigsCacheRedis.ts create mode 100644 packages/api/src/mcp/registry/cache/__tests__/RegistryStatusCache.cache_integration.spec.ts create mode 100644 packages/api/src/mcp/registry/cache/__tests__/ServerConfigsCacheFactory.test.ts create mode 100644 packages/api/src/mcp/registry/cache/__tests__/ServerConfigsCacheInMemory.test.ts create mode 100644 packages/api/src/mcp/registry/cache/__tests__/ServerConfigsCacheRedis.cache_integration.spec.ts create mode 100644 packages/api/src/mcp/registry/db/ServerConfigsDB.ts create mode 100644 packages/api/src/mcp/types/index.ts create mode 100644 packages/api/src/mcp/utils.ts create mode 100644 packages/api/src/mcp/zod.ts create mode 100644 packages/api/src/memory/config.ts create mode 100644 packages/api/src/memory/index.ts create mode 100644 packages/api/src/middleware/access.spec.ts create mode 100644 packages/api/src/middleware/access.ts create mode 100644 packages/api/src/middleware/balance.spec.ts create mode 100644 packages/api/src/middleware/balance.ts create mode 100644 packages/api/src/middleware/concurrency.ts create mode 100644 packages/api/src/middleware/error.spec.ts create mode 100644 packages/api/src/middleware/error.ts create mode 100644 packages/api/src/middleware/index.ts create mode 100644 packages/api/src/middleware/json.spec.ts create mode 100644 packages/api/src/middleware/json.ts create mode 100644 packages/api/src/oauth/index.ts create mode 100644 packages/api/src/oauth/tokens.ts create mode 100644 packages/api/src/prompts/artifacts/components.ts create mode 100644 packages/api/src/prompts/artifacts/generate.ts create mode 100644 packages/api/src/prompts/artifacts/index.ts create mode 100644 packages/api/src/prompts/format.ts create mode 100644 packages/api/src/prompts/index.ts create mode 100644 packages/api/src/prompts/migration.ts create mode 100644 packages/api/src/prompts/schemas.spec.ts create mode 100644 packages/api/src/prompts/schemas.ts create mode 100644 packages/api/src/stream/GenerationJobManager.ts create mode 100644 packages/api/src/stream/__tests__/GenerationJobManager.stream_integration.spec.ts create mode 100644 packages/api/src/stream/__tests__/RedisEventTransport.stream_integration.spec.ts create mode 100644 packages/api/src/stream/__tests__/RedisJobStore.stream_integration.spec.ts create mode 100644 packages/api/src/stream/__tests__/collectedUsage.spec.ts create mode 100644 packages/api/src/stream/createStreamServices.ts create mode 100644 packages/api/src/stream/implementations/InMemoryEventTransport.ts create mode 100644 packages/api/src/stream/implementations/InMemoryJobStore.ts create mode 100644 packages/api/src/stream/implementations/RedisEventTransport.ts create mode 100644 packages/api/src/stream/implementations/RedisJobStore.ts create mode 100644 packages/api/src/stream/implementations/index.ts create mode 100644 packages/api/src/stream/index.ts create mode 100644 packages/api/src/stream/interfaces/IJobStore.ts create mode 100644 packages/api/src/stream/interfaces/index.ts create mode 100644 packages/api/src/tools/format.spec.ts create mode 100644 packages/api/src/tools/format.ts create mode 100644 packages/api/src/tools/index.ts create mode 100644 packages/api/src/tools/toolkits/gemini.ts create mode 100644 packages/api/src/tools/toolkits/imageContext.ts create mode 100644 packages/api/src/tools/toolkits/index.ts create mode 100644 packages/api/src/tools/toolkits/oai.ts create mode 100644 packages/api/src/types/anthropic.ts create mode 100644 packages/api/src/types/azure.ts create mode 100644 packages/api/src/types/balance.ts create mode 100644 packages/api/src/types/bedrock.ts create mode 100644 packages/api/src/types/endpoints.ts create mode 100644 packages/api/src/types/error.ts create mode 100644 packages/api/src/types/events.ts create mode 100644 packages/api/src/types/files.ts create mode 100644 packages/api/src/types/google.ts create mode 100644 packages/api/src/types/http.ts create mode 100644 packages/api/src/types/index.ts create mode 100644 packages/api/src/types/mistral.ts create mode 100644 packages/api/src/types/openai.ts create mode 100644 packages/api/src/types/prompts.ts create mode 100644 packages/api/src/types/run.ts create mode 100644 packages/api/src/types/stream.ts create mode 100644 packages/api/src/types/tokens.ts create mode 100644 packages/api/src/utils/__tests__/files.test.ts create mode 100644 packages/api/src/utils/axios.spec.ts create mode 100644 packages/api/src/utils/axios.ts create mode 100644 packages/api/src/utils/azure.spec.ts create mode 100644 packages/api/src/utils/azure.ts create mode 100644 packages/api/src/utils/common.spec.ts create mode 100644 packages/api/src/utils/common.ts create mode 100644 packages/api/src/utils/content.spec.ts create mode 100644 packages/api/src/utils/content.ts create mode 100644 packages/api/src/utils/email.ts create mode 100644 packages/api/src/utils/env.spec.ts create mode 100644 packages/api/src/utils/env.ts create mode 100644 packages/api/src/utils/events.ts create mode 100644 packages/api/src/utils/files.spec.ts create mode 100644 packages/api/src/utils/files.ts create mode 100644 packages/api/src/utils/generators.ts create mode 100644 packages/api/src/utils/http.ts create mode 100644 packages/api/src/utils/index.ts create mode 100644 packages/api/src/utils/key.test.ts create mode 100644 packages/api/src/utils/key.ts create mode 100644 packages/api/src/utils/latex.spec.ts create mode 100644 packages/api/src/utils/latex.ts create mode 100644 packages/api/src/utils/llm.test.ts create mode 100644 packages/api/src/utils/llm.ts create mode 100644 packages/api/src/utils/math.integration.spec.ts create mode 100644 packages/api/src/utils/math.spec.ts create mode 100644 packages/api/src/utils/math.ts create mode 100644 packages/api/src/utils/message.spec.ts create mode 100644 packages/api/src/utils/message.ts create mode 100644 packages/api/src/utils/oidc.spec.ts create mode 100644 packages/api/src/utils/oidc.ts create mode 100644 packages/api/src/utils/openid.ts create mode 100644 packages/api/src/utils/path.spec.ts create mode 100644 packages/api/src/utils/path.ts create mode 100644 packages/api/src/utils/promise.spec.ts create mode 100644 packages/api/src/utils/promise.ts create mode 100644 packages/api/src/utils/sanitizeTitle.spec.ts create mode 100644 packages/api/src/utils/sanitizeTitle.ts create mode 100644 packages/api/src/utils/tempChatRetention.spec.ts create mode 100644 packages/api/src/utils/tempChatRetention.ts create mode 100644 packages/api/src/utils/text.spec.ts create mode 100644 packages/api/src/utils/text.ts create mode 100644 packages/api/src/utils/tokenizer.spec.ts create mode 100644 packages/api/src/utils/tokenizer.ts create mode 100644 packages/api/src/utils/tokens.ts create mode 100644 packages/api/src/utils/url.spec.ts create mode 100644 packages/api/src/utils/url.ts create mode 100644 packages/api/src/utils/yaml.ts create mode 100644 packages/api/src/web/index.ts create mode 100644 packages/api/src/web/web.spec.ts create mode 100644 packages/api/src/web/web.ts create mode 100644 packages/api/tsconfig-paths-bootstrap.mjs create mode 100644 packages/api/tsconfig.build.json create mode 100644 packages/api/tsconfig.json create mode 100644 packages/api/tsconfig.spec.json create mode 100644 packages/client/babel.config.js create mode 100644 packages/client/jest.config.js create mode 100644 packages/client/jest.setup.ts create mode 100644 packages/client/package.json create mode 100644 packages/client/rollup.config.js create mode 100644 packages/client/src/Providers/ToastContext.tsx create mode 100644 packages/client/src/Providers/index.ts create mode 100644 packages/client/src/common/enum.ts create mode 100644 packages/client/src/common/index.ts create mode 100644 packages/client/src/common/menus.ts create mode 100644 packages/client/src/common/types.ts create mode 100644 packages/client/src/components/Accordion.tsx create mode 100644 packages/client/src/components/AlertDialog.tsx create mode 100644 packages/client/src/components/AnimatePopover.css create mode 100644 packages/client/src/components/AnimatedSearchInput.tsx create mode 100644 packages/client/src/components/AnimatedTabs.css create mode 100644 packages/client/src/components/AnimatedTabs.tsx create mode 100644 packages/client/src/components/Avatar.tsx create mode 100644 packages/client/src/components/Badge.tsx create mode 100644 packages/client/src/components/Breadcrumb.tsx create mode 100644 packages/client/src/components/Button.tsx create mode 100644 packages/client/src/components/Checkbox.tsx create mode 100644 packages/client/src/components/CheckboxButton.tsx create mode 100644 packages/client/src/components/Collapsible.tsx create mode 100644 packages/client/src/components/Combobox.tsx create mode 100644 packages/client/src/components/ControlCombobox.tsx create mode 100644 packages/client/src/components/DataTable.tsx create mode 100644 packages/client/src/components/DataTable/DataTable.hooks.spec.ts create mode 100644 packages/client/src/components/DataTable/DataTable.hooks.ts create mode 100644 packages/client/src/components/DataTable/DataTable.spec.tsx create mode 100644 packages/client/src/components/DataTable/DataTable.tsx create mode 100644 packages/client/src/components/DataTable/DataTable.types.ts create mode 100644 packages/client/src/components/DataTable/DataTableComponents.spec.tsx create mode 100644 packages/client/src/components/DataTable/DataTableComponents.tsx create mode 100644 packages/client/src/components/DataTable/DataTableErrorBoundary.spec.tsx create mode 100644 packages/client/src/components/DataTable/DataTableErrorBoundary.tsx create mode 100644 packages/client/src/components/DataTable/DataTableSearch.spec.tsx create mode 100644 packages/client/src/components/DataTable/DataTableSearch.tsx create mode 100644 packages/client/src/components/DataTable/index.ts create mode 100644 packages/client/src/components/DelayedRender.tsx create mode 100644 packages/client/src/components/Dialog.tsx create mode 100644 packages/client/src/components/DialogTemplate.spec.tsx create mode 100644 packages/client/src/components/DialogTemplate.tsx create mode 100644 packages/client/src/components/Dropdown.css create mode 100644 packages/client/src/components/Dropdown.tsx create mode 100644 packages/client/src/components/DropdownMenu.tsx create mode 100644 packages/client/src/components/DropdownNoState.tsx create mode 100644 packages/client/src/components/DropdownPopup.tsx create mode 100644 packages/client/src/components/FileUpload.tsx create mode 100644 packages/client/src/components/FilterInput.tsx create mode 100644 packages/client/src/components/FormInput.tsx create mode 100644 packages/client/src/components/HoverCard.tsx create mode 100644 packages/client/src/components/InfoHoverCard.tsx create mode 100644 packages/client/src/components/Input.tsx create mode 100644 packages/client/src/components/InputCombobox.tsx create mode 100644 packages/client/src/components/InputNumber.tsx create mode 100644 packages/client/src/components/InputOTP.tsx create mode 100644 packages/client/src/components/InputWithDropDown.tsx create mode 100644 packages/client/src/components/Label.tsx create mode 100644 packages/client/src/components/MultiSearch.tsx create mode 100644 packages/client/src/components/MultiSelect.tsx create mode 100644 packages/client/src/components/OGDialogTemplate.tsx create mode 100644 packages/client/src/components/OriginalDialog.tsx create mode 100644 packages/client/src/components/Pagination.tsx create mode 100644 packages/client/src/components/PixelCard.tsx create mode 100644 packages/client/src/components/Progress.tsx create mode 100644 packages/client/src/components/QuestionMark.tsx create mode 100644 packages/client/src/components/Radio.tsx create mode 100644 packages/client/src/components/Resizable.tsx create mode 100644 packages/client/src/components/SecretInput.tsx create mode 100644 packages/client/src/components/Select.tsx create mode 100644 packages/client/src/components/SelectDropDown.tsx create mode 100644 packages/client/src/components/Separator.tsx create mode 100644 packages/client/src/components/Skeleton.tsx create mode 100644 packages/client/src/components/Slider.tsx create mode 100644 packages/client/src/components/SplitText.spec.tsx create mode 100644 packages/client/src/components/SplitText.tsx create mode 100644 packages/client/src/components/Switch.tsx create mode 100644 packages/client/src/components/Table.tsx create mode 100644 packages/client/src/components/Tabs.tsx create mode 100644 packages/client/src/components/Tag.tsx create mode 100644 packages/client/src/components/Textarea.tsx create mode 100644 packages/client/src/components/TextareaAutosize.tsx create mode 100644 packages/client/src/components/ThemeSelector.tsx create mode 100644 packages/client/src/components/Toast.tsx create mode 100644 packages/client/src/components/Tooltip.css create mode 100644 packages/client/src/components/Tooltip.tsx create mode 100644 packages/client/src/components/index.ts create mode 100644 packages/client/src/hooks/ThemeContext.old.tsx create mode 100644 packages/client/src/hooks/index.ts create mode 100644 packages/client/src/hooks/useAvatar.ts create mode 100644 packages/client/src/hooks/useCombobox.ts create mode 100644 packages/client/src/hooks/useDelayedRender.tsx create mode 100644 packages/client/src/hooks/useLocalize.ts create mode 100644 packages/client/src/hooks/useMediaQuery.tsx create mode 100644 packages/client/src/hooks/useOnClickOutside.ts create mode 100644 packages/client/src/hooks/useToast.ts create mode 100644 packages/client/src/index.ts create mode 100644 packages/client/src/locales/Translation.spec.ts create mode 100644 packages/client/src/locales/ar/translation.json create mode 100644 packages/client/src/locales/ca/translation.json create mode 100644 packages/client/src/locales/cs/translation.json create mode 100644 packages/client/src/locales/da/translation.json create mode 100644 packages/client/src/locales/de/translation.json create mode 100644 packages/client/src/locales/en/translation.json create mode 100644 packages/client/src/locales/es/translation.json create mode 100644 packages/client/src/locales/et/translation.json create mode 100644 packages/client/src/locales/fa/translation.json create mode 100644 packages/client/src/locales/fi/translation.json create mode 100644 packages/client/src/locales/fr/translation.json create mode 100644 packages/client/src/locales/he/translation.json create mode 100644 packages/client/src/locales/hu/translation.json create mode 100644 packages/client/src/locales/i18n.ts create mode 100644 packages/client/src/locales/id/translation.json create mode 100644 packages/client/src/locales/it/translation.json create mode 100644 packages/client/src/locales/ja/translation.json create mode 100644 packages/client/src/locales/ka/translation.json create mode 100644 packages/client/src/locales/ko/translation.json create mode 100644 packages/client/src/locales/nl/translation.json create mode 100644 packages/client/src/locales/pl/translation.json create mode 100644 packages/client/src/locales/pt-BR/translation.json create mode 100644 packages/client/src/locales/pt-PT/translation.json create mode 100644 packages/client/src/locales/ru/translation.json create mode 100644 packages/client/src/locales/sv/translation.json create mode 100644 packages/client/src/locales/th/translation.json create mode 100644 packages/client/src/locales/tr/translation.json create mode 100644 packages/client/src/locales/vi/translation.json create mode 100644 packages/client/src/locales/zh-Hans/translation.json create mode 100644 packages/client/src/locales/zh-Hant/translation.json create mode 100644 packages/client/src/store.ts create mode 100644 packages/client/src/svgs/AnthropicIcon.tsx create mode 100644 packages/client/src/svgs/AnthropicMinimalIcon.tsx create mode 100644 packages/client/src/svgs/AppleIcon.tsx create mode 100644 packages/client/src/svgs/ArchiveIcon.tsx create mode 100644 packages/client/src/svgs/AssistantIcon.tsx create mode 100644 packages/client/src/svgs/AttachmentIcon.tsx create mode 100644 packages/client/src/svgs/AudioPaths.tsx create mode 100644 packages/client/src/svgs/AzureMinimalIcon.tsx create mode 100644 packages/client/src/svgs/BedrockIcon.tsx create mode 100644 packages/client/src/svgs/BirthdayIcon.tsx create mode 100644 packages/client/src/svgs/Blocks.tsx create mode 100644 packages/client/src/svgs/CautionIcon.tsx create mode 100644 packages/client/src/svgs/ChatGPTMinimalIcon.tsx create mode 100644 packages/client/src/svgs/ChatIcon.tsx create mode 100644 packages/client/src/svgs/CheckMark.tsx create mode 100644 packages/client/src/svgs/CircleHelpIcon.tsx create mode 100644 packages/client/src/svgs/Clipboard.tsx create mode 100644 packages/client/src/svgs/CodePaths.tsx create mode 100644 packages/client/src/svgs/CodeyIcon.tsx create mode 100644 packages/client/src/svgs/ContinueIcon.tsx create mode 100644 packages/client/src/svgs/ConvoIcon.tsx create mode 100644 packages/client/src/svgs/CrossIcon.tsx create mode 100644 packages/client/src/svgs/CustomMinimalIcon.tsx create mode 100644 packages/client/src/svgs/DarkModeIcon.tsx create mode 100644 packages/client/src/svgs/DataIcon.tsx create mode 100644 packages/client/src/svgs/DiscordIcon.tsx create mode 100644 packages/client/src/svgs/DislikeIcon.tsx create mode 100644 packages/client/src/svgs/DotsIcon.tsx create mode 100644 packages/client/src/svgs/EditIcon.tsx create mode 100644 packages/client/src/svgs/ExperimentIcon.tsx create mode 100644 packages/client/src/svgs/FacebookIcon.tsx create mode 100644 packages/client/src/svgs/FileIcon.tsx create mode 100644 packages/client/src/svgs/FilePaths.tsx create mode 100644 packages/client/src/svgs/GPTIcon.tsx create mode 100644 packages/client/src/svgs/GearIcon.tsx create mode 100644 packages/client/src/svgs/GeminiIcon.tsx create mode 100644 packages/client/src/svgs/GithubIcon.tsx create mode 100644 packages/client/src/svgs/GoogleIcon.tsx create mode 100644 packages/client/src/svgs/GoogleIconChat.tsx create mode 100644 packages/client/src/svgs/GoogleMinimalIcon.tsx create mode 100644 packages/client/src/svgs/LightModeIcon.tsx create mode 100644 packages/client/src/svgs/LightningIcon.tsx create mode 100644 packages/client/src/svgs/LikeIcon.tsx create mode 100644 packages/client/src/svgs/LinkIcon.tsx create mode 100644 packages/client/src/svgs/ListeningIcon.tsx create mode 100644 packages/client/src/svgs/LockIcon.tsx create mode 100644 packages/client/src/svgs/LogOutIcon.tsx create mode 100644 packages/client/src/svgs/MCPIcon.tsx create mode 100644 packages/client/src/svgs/MessagesSquared.tsx create mode 100644 packages/client/src/svgs/MinimalPlugin.tsx create mode 100644 packages/client/src/svgs/MobileSidebar.tsx create mode 100644 packages/client/src/svgs/NewChatIcon.tsx create mode 100644 packages/client/src/svgs/OpenAIMinimalIcon.tsx create mode 100644 packages/client/src/svgs/OpenIDIcon.tsx create mode 100644 packages/client/src/svgs/PaLMIcon.tsx create mode 100644 packages/client/src/svgs/PaLMinimalIcon.tsx create mode 100644 packages/client/src/svgs/PersonalizationIcon.tsx create mode 100644 packages/client/src/svgs/PinIcon.tsx create mode 100644 packages/client/src/svgs/Plugin.tsx create mode 100644 packages/client/src/svgs/RegenerateIcon.tsx create mode 100644 packages/client/src/svgs/RenameIcon.tsx create mode 100644 packages/client/src/svgs/SamlIcon.tsx create mode 100644 packages/client/src/svgs/SaveIcon.tsx create mode 100644 packages/client/src/svgs/SendIcon.tsx create mode 100644 packages/client/src/svgs/SendMessageIcon.tsx create mode 100644 packages/client/src/svgs/SharePointIcon.tsx create mode 100644 packages/client/src/svgs/SheetPaths.tsx create mode 100644 packages/client/src/svgs/Sidebar.tsx create mode 100644 packages/client/src/svgs/Sparkles.tsx create mode 100644 packages/client/src/svgs/SpeechIcon.tsx create mode 100644 packages/client/src/svgs/Spinner.tsx create mode 100644 packages/client/src/svgs/SquirclePlusIcon.tsx create mode 100644 packages/client/src/svgs/StopGeneratingIcon.tsx create mode 100644 packages/client/src/svgs/SunIcon.tsx create mode 100644 packages/client/src/svgs/SwitchIcon.tsx create mode 100644 packages/client/src/svgs/TextPaths.tsx create mode 100644 packages/client/src/svgs/ThumbDownIcon.tsx create mode 100644 packages/client/src/svgs/ThumbUpIcon.tsx create mode 100644 packages/client/src/svgs/TrashIcon.tsx create mode 100644 packages/client/src/svgs/UserIcon.tsx create mode 100644 packages/client/src/svgs/VectorIcon.tsx create mode 100644 packages/client/src/svgs/VideoPaths.tsx create mode 100644 packages/client/src/svgs/VolumeIcon.tsx create mode 100644 packages/client/src/svgs/VolumeMuteIcon.tsx create mode 100644 packages/client/src/svgs/XAIcon.tsx create mode 100644 packages/client/src/svgs/index.ts create mode 100644 packages/client/src/theme/README.md create mode 100644 packages/client/src/theme/atoms/themeAtoms.ts create mode 100644 packages/client/src/theme/context/ThemeProvider.tsx create mode 100644 packages/client/src/theme/index.ts create mode 100644 packages/client/src/theme/themes/dark.ts create mode 100644 packages/client/src/theme/themes/default.ts create mode 100644 packages/client/src/theme/themes/index.ts create mode 100644 packages/client/src/theme/types/index.ts create mode 100644 packages/client/src/theme/utils/applyTheme.ts create mode 100644 packages/client/src/theme/utils/createTailwindColors.js create mode 100644 packages/client/src/utils/index.ts create mode 100644 packages/client/src/utils/logger.ts create mode 100644 packages/client/src/utils/theme.ts create mode 100644 packages/client/src/utils/utils.ts create mode 100644 packages/client/tailwind.config.js create mode 100644 packages/client/tsconfig.json create mode 100644 packages/client/tsconfig.test.json create mode 100644 packages/data-provider/.gitignore create mode 100644 packages/data-provider/babel.config.js create mode 100755 packages/data-provider/check_updates.sh create mode 100644 packages/data-provider/jest.config.js create mode 100644 packages/data-provider/package.json create mode 100644 packages/data-provider/react-query/package-lock.json create mode 100644 packages/data-provider/react-query/package.json create mode 100644 packages/data-provider/rollup.config.js create mode 100644 packages/data-provider/server-rollup.config.js create mode 100644 packages/data-provider/specs/actions.spec.ts create mode 100644 packages/data-provider/specs/azure.spec.ts create mode 100644 packages/data-provider/specs/bedrock.spec.ts create mode 100644 packages/data-provider/specs/filetypes.spec.ts create mode 100644 packages/data-provider/specs/generate.spec.ts create mode 100644 packages/data-provider/specs/openapiSpecs.ts create mode 100644 packages/data-provider/specs/parsers.spec.ts create mode 100644 packages/data-provider/specs/utils.spec.ts create mode 100644 packages/data-provider/src/accessPermissions.ts create mode 100644 packages/data-provider/src/actions.ts create mode 100644 packages/data-provider/src/actions.ts.orig create mode 100644 packages/data-provider/src/actions.ts.rej create mode 100644 packages/data-provider/src/api-endpoints.ts create mode 100644 packages/data-provider/src/artifacts.ts create mode 100644 packages/data-provider/src/azure.ts create mode 100644 packages/data-provider/src/bedrock.ts create mode 100644 packages/data-provider/src/config.ts create mode 100644 packages/data-provider/src/createPayload.ts create mode 100644 packages/data-provider/src/data-service.ts create mode 100644 packages/data-provider/src/feedback.ts create mode 100644 packages/data-provider/src/file-config.spec.ts create mode 100644 packages/data-provider/src/file-config.ts create mode 100644 packages/data-provider/src/generate.ts create mode 100644 packages/data-provider/src/headers-helpers.ts create mode 100644 packages/data-provider/src/index.ts create mode 100644 packages/data-provider/src/keys.ts create mode 100644 packages/data-provider/src/mcp.ts create mode 100644 packages/data-provider/src/messages.ts create mode 100644 packages/data-provider/src/models.ts create mode 100644 packages/data-provider/src/parameterSettings.ts create mode 100644 packages/data-provider/src/parsers.ts create mode 100644 packages/data-provider/src/permissions.ts create mode 100644 packages/data-provider/src/react-query/index.ts create mode 100644 packages/data-provider/src/react-query/react-query-service.ts create mode 100644 packages/data-provider/src/request.ts create mode 100644 packages/data-provider/src/roles.ts create mode 100644 packages/data-provider/src/schemas.spec.ts create mode 100644 packages/data-provider/src/schemas.ts create mode 100644 packages/data-provider/src/types.ts create mode 100644 packages/data-provider/src/types/agents.ts create mode 100644 packages/data-provider/src/types/assistants.ts create mode 100644 packages/data-provider/src/types/files.ts create mode 100644 packages/data-provider/src/types/graph.ts create mode 100644 packages/data-provider/src/types/index.ts create mode 100644 packages/data-provider/src/types/mcpServers.ts create mode 100644 packages/data-provider/src/types/mutations.ts create mode 100644 packages/data-provider/src/types/queries.ts create mode 100644 packages/data-provider/src/types/runs.ts create mode 100644 packages/data-provider/src/types/web.ts create mode 100644 packages/data-provider/src/utils.ts create mode 100644 packages/data-provider/tsconfig.json create mode 100644 packages/data-provider/tsconfig.spec.json create mode 100644 packages/data-schemas/.gitignore create mode 100644 packages/data-schemas/LICENSE create mode 100644 packages/data-schemas/README.md create mode 100644 packages/data-schemas/babel.config.cjs create mode 100644 packages/data-schemas/jest.config.mjs create mode 100644 packages/data-schemas/package.json create mode 100644 packages/data-schemas/rollup.config.js create mode 100644 packages/data-schemas/src/app/agents.ts create mode 100644 packages/data-schemas/src/app/assistants.ts create mode 100644 packages/data-schemas/src/app/azure.ts create mode 100644 packages/data-schemas/src/app/endpoints.ts create mode 100644 packages/data-schemas/src/app/index.ts create mode 100644 packages/data-schemas/src/app/interface.ts create mode 100644 packages/data-schemas/src/app/memory.ts create mode 100644 packages/data-schemas/src/app/ocr.ts create mode 100644 packages/data-schemas/src/app/service.ts create mode 100644 packages/data-schemas/src/app/specs.ts create mode 100644 packages/data-schemas/src/app/turnstile.ts create mode 100644 packages/data-schemas/src/app/vertex.ts create mode 100644 packages/data-schemas/src/app/web.spec.ts create mode 100644 packages/data-schemas/src/app/web.ts create mode 100644 packages/data-schemas/src/common/enum.ts create mode 100644 packages/data-schemas/src/common/index.ts create mode 100644 packages/data-schemas/src/common/pagination.ts create mode 100644 packages/data-schemas/src/config/meiliLogger.ts create mode 100644 packages/data-schemas/src/config/parsers.ts create mode 100644 packages/data-schemas/src/config/utils.ts create mode 100644 packages/data-schemas/src/config/winston.ts create mode 100644 packages/data-schemas/src/crypto/index.ts create mode 100644 packages/data-schemas/src/index.ts create mode 100644 packages/data-schemas/src/methods/accessRole.spec.ts create mode 100644 packages/data-schemas/src/methods/accessRole.ts create mode 100644 packages/data-schemas/src/methods/aclEntry.spec.ts create mode 100644 packages/data-schemas/src/methods/aclEntry.ts create mode 100644 packages/data-schemas/src/methods/agentCategory.ts create mode 100644 packages/data-schemas/src/methods/file.spec.ts create mode 100644 packages/data-schemas/src/methods/file.ts create mode 100644 packages/data-schemas/src/methods/index.ts create mode 100644 packages/data-schemas/src/methods/key.ts create mode 100644 packages/data-schemas/src/methods/mcpServer.spec.ts create mode 100644 packages/data-schemas/src/methods/mcpServer.ts create mode 100644 packages/data-schemas/src/methods/memory.ts create mode 100644 packages/data-schemas/src/methods/pluginAuth.ts create mode 100644 packages/data-schemas/src/methods/role.ts create mode 100644 packages/data-schemas/src/methods/session.ts create mode 100644 packages/data-schemas/src/methods/share.test.ts create mode 100644 packages/data-schemas/src/methods/share.ts create mode 100644 packages/data-schemas/src/methods/token.spec.ts create mode 100644 packages/data-schemas/src/methods/token.ts create mode 100644 packages/data-schemas/src/methods/user.methods.spec.ts create mode 100644 packages/data-schemas/src/methods/user.test.ts create mode 100644 packages/data-schemas/src/methods/user.ts create mode 100644 packages/data-schemas/src/methods/userGroup.methods.spec.ts create mode 100644 packages/data-schemas/src/methods/userGroup.roles.spec.ts create mode 100644 packages/data-schemas/src/methods/userGroup.spec.ts create mode 100644 packages/data-schemas/src/methods/userGroup.ts create mode 100644 packages/data-schemas/src/models/accessRole.ts create mode 100644 packages/data-schemas/src/models/aclEntry.ts create mode 100644 packages/data-schemas/src/models/action.ts create mode 100644 packages/data-schemas/src/models/agent.ts create mode 100644 packages/data-schemas/src/models/agentCategory.ts create mode 100644 packages/data-schemas/src/models/assistant.ts create mode 100644 packages/data-schemas/src/models/balance.ts create mode 100644 packages/data-schemas/src/models/banner.ts create mode 100644 packages/data-schemas/src/models/conversationTag.ts create mode 100644 packages/data-schemas/src/models/convo.ts create mode 100644 packages/data-schemas/src/models/file.ts create mode 100644 packages/data-schemas/src/models/group.ts create mode 100644 packages/data-schemas/src/models/index.ts create mode 100644 packages/data-schemas/src/models/key.ts create mode 100644 packages/data-schemas/src/models/mcpServer.ts create mode 100644 packages/data-schemas/src/models/memory.ts create mode 100644 packages/data-schemas/src/models/message.ts create mode 100644 packages/data-schemas/src/models/pluginAuth.ts create mode 100644 packages/data-schemas/src/models/plugins/mongoMeili.spec.ts create mode 100644 packages/data-schemas/src/models/plugins/mongoMeili.ts create mode 100644 packages/data-schemas/src/models/preset.ts create mode 100644 packages/data-schemas/src/models/project.ts create mode 100644 packages/data-schemas/src/models/prompt.ts create mode 100644 packages/data-schemas/src/models/promptGroup.ts create mode 100644 packages/data-schemas/src/models/role.ts create mode 100644 packages/data-schemas/src/models/session.ts create mode 100644 packages/data-schemas/src/models/sharedLink.ts create mode 100644 packages/data-schemas/src/models/token.ts create mode 100644 packages/data-schemas/src/models/toolCall.ts create mode 100644 packages/data-schemas/src/models/transaction.ts create mode 100644 packages/data-schemas/src/models/user.ts create mode 100644 packages/data-schemas/src/schema/accessRole.ts create mode 100644 packages/data-schemas/src/schema/aclEntry.ts create mode 100644 packages/data-schemas/src/schema/action.ts create mode 100644 packages/data-schemas/src/schema/agent.ts create mode 100644 packages/data-schemas/src/schema/agentCategory.ts create mode 100644 packages/data-schemas/src/schema/assistant.ts create mode 100644 packages/data-schemas/src/schema/balance.ts create mode 100644 packages/data-schemas/src/schema/banner.ts create mode 100644 packages/data-schemas/src/schema/categories.ts create mode 100644 packages/data-schemas/src/schema/conversationTag.ts create mode 100644 packages/data-schemas/src/schema/convo.ts create mode 100644 packages/data-schemas/src/schema/defaults.ts create mode 100644 packages/data-schemas/src/schema/file.ts create mode 100644 packages/data-schemas/src/schema/group.ts create mode 100644 packages/data-schemas/src/schema/index.ts create mode 100644 packages/data-schemas/src/schema/key.ts create mode 100644 packages/data-schemas/src/schema/mcpServer.ts create mode 100644 packages/data-schemas/src/schema/memory.ts create mode 100644 packages/data-schemas/src/schema/message.ts create mode 100644 packages/data-schemas/src/schema/pluginAuth.ts create mode 100644 packages/data-schemas/src/schema/preset.ts create mode 100644 packages/data-schemas/src/schema/project.ts create mode 100644 packages/data-schemas/src/schema/prompt.ts create mode 100644 packages/data-schemas/src/schema/promptGroup.ts create mode 100644 packages/data-schemas/src/schema/role.ts create mode 100644 packages/data-schemas/src/schema/session.ts create mode 100644 packages/data-schemas/src/schema/share.ts create mode 100644 packages/data-schemas/src/schema/token.ts create mode 100644 packages/data-schemas/src/schema/toolCall.ts create mode 100644 packages/data-schemas/src/schema/transaction.ts create mode 100644 packages/data-schemas/src/schema/user.ts create mode 100644 packages/data-schemas/src/types/accessRole.ts create mode 100644 packages/data-schemas/src/types/aclEntry.ts create mode 100644 packages/data-schemas/src/types/action.ts create mode 100644 packages/data-schemas/src/types/agent.ts create mode 100644 packages/data-schemas/src/types/agentCategory.ts create mode 100644 packages/data-schemas/src/types/app.ts create mode 100644 packages/data-schemas/src/types/assistant.ts create mode 100644 packages/data-schemas/src/types/balance.ts create mode 100644 packages/data-schemas/src/types/banner.ts create mode 100644 packages/data-schemas/src/types/convo.ts create mode 100644 packages/data-schemas/src/types/file.ts create mode 100644 packages/data-schemas/src/types/group.ts create mode 100644 packages/data-schemas/src/types/index.ts create mode 100644 packages/data-schemas/src/types/mcp.ts create mode 100644 packages/data-schemas/src/types/memory.ts create mode 100644 packages/data-schemas/src/types/message.ts create mode 100644 packages/data-schemas/src/types/pluginAuth.ts create mode 100644 packages/data-schemas/src/types/prompts.ts create mode 100644 packages/data-schemas/src/types/role.ts create mode 100644 packages/data-schemas/src/types/session.ts create mode 100644 packages/data-schemas/src/types/share.ts create mode 100644 packages/data-schemas/src/types/token.ts create mode 100644 packages/data-schemas/src/types/user.ts create mode 100644 packages/data-schemas/src/types/web.ts create mode 100644 packages/data-schemas/src/utils/index.ts create mode 100644 packages/data-schemas/src/utils/object-traverse.ts create mode 100644 packages/data-schemas/src/utils/transactions.ts create mode 100644 packages/data-schemas/tsconfig.json create mode 100644 packages/data-schemas/tsconfig.spec.json create mode 100644 rag.yml create mode 100644 redis-config/README.md create mode 100644 redis-config/certs/ca-cert.srl create mode 100644 redis-config/certs/dump.rdb create mode 100644 redis-config/certs/redis.dh create mode 100644 redis-config/certs/server.conf create mode 100644 redis-config/redis-7001.conf create mode 100644 redis-config/redis-7002.conf create mode 100644 redis-config/redis-7003.conf create mode 100644 redis-config/redis-tls.conf create mode 100755 redis-config/start-cluster.sh create mode 100755 redis-config/start-redis-tls.sh create mode 100755 redis-config/stop-cluster.sh create mode 100644 src/tests/oidc-integration.test.ts create mode 100755 start-backend.sh create mode 100755 start-dev.sh create mode 100755 stop-backend.sh create mode 100755 utils/docker/docker-build.sh create mode 100755 utils/docker/docker-push.sh create mode 100644 utils/docker/test-compose.yml create mode 100644 utils/update_env.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..36be227 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +node_modules/ +.git/ +dist/ +build/ +.env.local +.env.*.local +logs/ +*.log +.DS_Store +.vscode/ +.idea/ diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..94c4228 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,236 @@ +# Changelog + +All notable changes to this project will be documented in this file. + + + + + + +## [Unreleased] + +### ✨ New Features + +- ✨ feat: implement search parameter updates by **@mawburn** in [#7151](https://github.com/danny-avila/QognyX/pull/7151) +- 🎏 feat: Add MCP support for Streamable HTTP Transport by **@benverhees** in [#7353](https://github.com/danny-avila/QognyX/pull/7353) +- 🔒 feat: Add Content Security Policy using Helmet middleware by **@rubentalstra** in [#7377](https://github.com/danny-avila/QognyX/pull/7377) +- ✨ feat: Add Normalization for MCP Server Names by **@danny-avila** in [#7421](https://github.com/danny-avila/QognyX/pull/7421) +- 📊 feat: Improve Helm Chart by **@hofq** in [#3638](https://github.com/danny-avila/QognyX/pull/3638) +- 🦾 feat: Claude-4 Support by **@danny-avila** in [#7509](https://github.com/danny-avila/QognyX/pull/7509) +- 🪨 feat: Bedrock Support for Claude-4 Reasoning by **@danny-avila** in [#7517](https://github.com/danny-avila/QognyX/pull/7517) + +### 🌍 Internationalization + +- 🌍 i18n: Add `Danish` and `Czech` and `Catalan` localization support by **@rubentalstra** in [#7373](https://github.com/danny-avila/QognyX/pull/7373) +- 🌍 i18n: Update translation.json with latest translations by **@github-actions[bot]** in [#7375](https://github.com/danny-avila/QognyX/pull/7375) +- 🌍 i18n: Update translation.json with latest translations by **@github-actions[bot]** in [#7468](https://github.com/danny-avila/QognyX/pull/7468) + +### 🔧 Fixes + +- 💬 fix: update aria-label for accessibility in ConvoLink component by **@berry-13** in [#7320](https://github.com/danny-avila/QognyX/pull/7320) +- 🔑 fix: use `apiKey` instead of `openAIApiKey` in OpenAI-like Config by **@danny-avila** in [#7337](https://github.com/danny-avila/QognyX/pull/7337) +- 🔄 fix: update navigation logic in `useFocusChatEffect` to ensure correct search parameters are used by **@mawburn** in [#7340](https://github.com/danny-avila/QognyX/pull/7340) +- 🔄 fix: Improve MCP Connection Cleanup by **@danny-avila** in [#7400](https://github.com/danny-avila/QognyX/pull/7400) +- 🛡️ fix: Preset and Validation Logic for URL Query Params by **@danny-avila** in [#7407](https://github.com/danny-avila/QognyX/pull/7407) +- 🌘 fix: artifact of preview text is illegible in dark mode by **@nhtruong** in [#7405](https://github.com/danny-avila/QognyX/pull/7405) +- 🛡️ fix: Temporarily Remove CSP until Configurable by **@danny-avila** in [#7419](https://github.com/danny-avila/QognyX/pull/7419) +- 💽 fix: Exclude index page `/` from static cache settings by **@sbruel** in [#7382](https://github.com/danny-avila/QognyX/pull/7382) + +### ⚙️ Other Changes + +- 📜 docs: CHANGELOG for release v0.7.8 by **@github-actions[bot]** in [#7290](https://github.com/danny-avila/QognyX/pull/7290) +- 📦 chore: Update API Package Dependencies by **@danny-avila** in [#7359](https://github.com/danny-avila/QognyX/pull/7359) +- 📜 docs: Unreleased Changelog by **@github-actions[bot]** in [#7321](https://github.com/danny-avila/QognyX/pull/7321) +- 📜 docs: Unreleased Changelog by **@github-actions[bot]** in [#7434](https://github.com/danny-avila/QognyX/pull/7434) +- 🛡️ chore: `multer` v2.0.0 for CVE-2025-47935 and CVE-2025-47944 by **@danny-avila** in [#7454](https://github.com/danny-avila/QognyX/pull/7454) +- 📂 refactor: Improve `FileAttachment` & File Form Deletion by **@danny-avila** in [#7471](https://github.com/danny-avila/QognyX/pull/7471) +- 📊 chore: Remove Old Helm Chart by **@hofq** in [#7512](https://github.com/danny-avila/QognyX/pull/7512) +- 🪖 chore: bump helm app version to v0.7.8 by **@austin-barrington** in [#7524](https://github.com/danny-avila/QognyX/pull/7524) + + + +--- +## [v0.7.8] - + +Changes from v0.7.8-rc1 to v0.7.8. + +### ✨ New Features + +- ✨ feat: Enhance form submission for touch screens by **@berry-13** in [#7198](https://github.com/danny-avila/QognyX/pull/7198) +- 🔍 feat: Additional Tavily API Tool Parameters by **@glowforge-opensource** in [#7232](https://github.com/danny-avila/QognyX/pull/7232) +- 🐋 feat: Add python to Dockerfile for increased MCP compatibility by **@technicalpickles** in [#7270](https://github.com/danny-avila/QognyX/pull/7270) + +### 🔧 Fixes + +- 🔧 fix: Google Gemma Support & OpenAI Reasoning Instructions by **@danny-avila** in [#7196](https://github.com/danny-avila/QognyX/pull/7196) +- 🛠️ fix: Conversation Navigation State by **@danny-avila** in [#7210](https://github.com/danny-avila/QognyX/pull/7210) +- 🔄 fix: o-Series Model Regex for System Messages by **@danny-avila** in [#7245](https://github.com/danny-avila/QognyX/pull/7245) +- 🔖 fix: Custom Headers for Initial MCP SSE Connection by **@danny-avila** in [#7246](https://github.com/danny-avila/QognyX/pull/7246) +- 🛡️ fix: Deep Clone `MCPOptions` for User MCP Connections by **@danny-avila** in [#7247](https://github.com/danny-avila/QognyX/pull/7247) +- 🔄 fix: URL Param Race Condition and File Draft Persistence by **@danny-avila** in [#7257](https://github.com/danny-avila/QognyX/pull/7257) +- 🔄 fix: Assistants Endpoint & Minor Issues by **@danny-avila** in [#7274](https://github.com/danny-avila/QognyX/pull/7274) +- 🔄 fix: Ollama Think Tag Edge Case with Tools by **@danny-avila** in [#7275](https://github.com/danny-avila/QognyX/pull/7275) + +### ⚙️ Other Changes + +- 📜 docs: CHANGELOG for release v0.7.8-rc1 by **@github-actions[bot]** in [#7153](https://github.com/danny-avila/QognyX/pull/7153) +- 🔄 refactor: Artifact Visibility Management by **@danny-avila** in [#7181](https://github.com/danny-avila/QognyX/pull/7181) +- 📦 chore: Bump Package Security by **@danny-avila** in [#7183](https://github.com/danny-avila/QognyX/pull/7183) +- 🌿 refactor: Unmount Fork Popover on Hide for Better Performance by **@danny-avila** in [#7189](https://github.com/danny-avila/QognyX/pull/7189) +- 🧰 chore: ESLint configuration to enforce Prettier formatting rules by **@mawburn** in [#7186](https://github.com/danny-avila/QognyX/pull/7186) +- 🎨 style: Improve KaTeX Rendering for LaTeX Equations by **@andresgit** in [#7223](https://github.com/danny-avila/QognyX/pull/7223) +- 📝 docs: Update `.env.example` Google models by **@marlonka** in [#7254](https://github.com/danny-avila/QognyX/pull/7254) +- 💬 refactor: MCP Chat Visibility Option, Google Rates, Remove OpenAPI Plugins by **@danny-avila** in [#7286](https://github.com/danny-avila/QognyX/pull/7286) +- 📜 docs: Unreleased Changelog by **@github-actions[bot]** in [#7214](https://github.com/danny-avila/QognyX/pull/7214) + + + +[See full release details][release-v0.7.8] + +[release-v0.7.8]: https://github.com/danny-avila/QognyX/releases/tag/v0.7.8 + +--- +## [v0.7.8-rc1] - + +Changes from v0.7.7 to v0.7.8-rc1. + +### ✨ New Features + +- 🔍 feat: Mistral OCR API / Upload Files as Text by **@danny-avila** in [#6274](https://github.com/danny-avila/QognyX/pull/6274) +- 🤖 feat: Support OpenAI Web Search models by **@danny-avila** in [#6313](https://github.com/danny-avila/QognyX/pull/6313) +- 🔗 feat: Agent Chain (Mixture-of-Agents) by **@danny-avila** in [#6374](https://github.com/danny-avila/QognyX/pull/6374) +- ⌛ feat: `initTimeout` for Slow Starting MCP Servers by **@perweij** in [#6383](https://github.com/danny-avila/QognyX/pull/6383) +- 🚀 feat: `S3` Integration for File handling and Image uploads by **@rubentalstra** in [#6142](https://github.com/danny-avila/QognyX/pull/6142) +- 🔒feat: Enable OpenID Auto-Redirect by **@leondape** in [#6066](https://github.com/danny-avila/QognyX/pull/6066) +- 🚀 feat: Integrate `Azure Blob Storage` for file handling and image uploads by **@rubentalstra** in [#6153](https://github.com/danny-avila/QognyX/pull/6153) +- 🚀 feat: Add support for custom `AWS` endpoint in `S3` by **@rubentalstra** in [#6431](https://github.com/danny-avila/QognyX/pull/6431) +- 🚀 feat: Add support for LDAP STARTTLS in LDAP authentication by **@rubentalstra** in [#6438](https://github.com/danny-avila/QognyX/pull/6438) +- 🚀 feat: Refactor schema exports and update package version to 0.0.4 by **@rubentalstra** in [#6455](https://github.com/danny-avila/QognyX/pull/6455) +- 🔼 feat: Add Auto Submit For URL Query Params by **@mjaverto** in [#6440](https://github.com/danny-avila/QognyX/pull/6440) +- 🛠 feat: Enhance Redis Integration, Rate Limiters & Log Headers by **@danny-avila** in [#6462](https://github.com/danny-avila/QognyX/pull/6462) +- 💵 feat: Add Automatic Balance Refill by **@rubentalstra** in [#6452](https://github.com/danny-avila/QognyX/pull/6452) +- 🗣️ feat: add support for gpt-4o-transcribe models by **@berry-13** in [#6483](https://github.com/danny-avila/QognyX/pull/6483) +- 🎨 feat: UI Refresh for Enhanced UX by **@berry-13** in [#6346](https://github.com/danny-avila/QognyX/pull/6346) +- 🌍 feat: Add support for Hungarian language localization by **@rubentalstra** in [#6508](https://github.com/danny-avila/QognyX/pull/6508) +- 🚀 feat: Add Gemini 2.5 Token/Context Values, Increase Max Possible Output to 64k by **@danny-avila** in [#6563](https://github.com/danny-avila/QognyX/pull/6563) +- 🚀 feat: Enhance MCP Connections For Multi-User Support by **@danny-avila** in [#6610](https://github.com/danny-avila/QognyX/pull/6610) +- 🚀 feat: Enhance S3 URL Expiry with Refresh; fix: S3 File Deletion by **@danny-avila** in [#6647](https://github.com/danny-avila/QognyX/pull/6647) +- 🚀 feat: enhance UI components and refactor settings by **@berry-13** in [#6625](https://github.com/danny-avila/QognyX/pull/6625) +- 💬 feat: move TemporaryChat to the Header by **@berry-13** in [#6646](https://github.com/danny-avila/QognyX/pull/6646) +- 🚀 feat: Use Model Specs + Specific Endpoints, Limit Providers for Agents by **@danny-avila** in [#6650](https://github.com/danny-avila/QognyX/pull/6650) +- 🪙 feat: Sync Balance Config on Login by **@danny-avila** in [#6671](https://github.com/danny-avila/QognyX/pull/6671) +- 🔦 feat: MCP Support for Non-Agent Endpoints by **@danny-avila** in [#6775](https://github.com/danny-avila/QognyX/pull/6775) +- 🗃️ feat: Code Interpreter File Persistence between Sessions by **@danny-avila** in [#6790](https://github.com/danny-avila/QognyX/pull/6790) +- 🖥️ feat: Code Interpreter API for Non-Agent Endpoints by **@danny-avila** in [#6803](https://github.com/danny-avila/QognyX/pull/6803) +- ⚡ feat: Self-hosted Artifacts Static Bundler URL by **@danny-avila** in [#6827](https://github.com/danny-avila/QognyX/pull/6827) +- 🐳 feat: Add Jemalloc and UV to Docker Builds by **@danny-avila** in [#6836](https://github.com/danny-avila/QognyX/pull/6836) +- 🤖 feat: GPT-4.1 by **@danny-avila** in [#6880](https://github.com/danny-avila/QognyX/pull/6880) +- 👋 feat: remove Edge TTS by **@berry-13** in [#6885](https://github.com/danny-avila/QognyX/pull/6885) +- feat: nav optimization by **@berry-13** in [#5785](https://github.com/danny-avila/QognyX/pull/5785) +- 🗺️ feat: Add Parameter Location Mapping for OpenAPI actions by **@peeeteeer** in [#6858](https://github.com/danny-avila/QognyX/pull/6858) +- 🤖 feat: Support `o4-mini` and `o3` Models by **@danny-avila** in [#6928](https://github.com/danny-avila/QognyX/pull/6928) +- 🎨 feat: OpenAI Image Tools (GPT-Image-1) by **@danny-avila** in [#7079](https://github.com/danny-avila/QognyX/pull/7079) +- 🗓️ feat: Add Special Variables for Prompts & Agents, Prompt UI Improvements by **@danny-avila** in [#7123](https://github.com/danny-avila/QognyX/pull/7123) + +### 🌍 Internationalization + +- 🌍 i18n: Add Thai Language Support and Update Translations by **@rubentalstra** in [#6219](https://github.com/danny-avila/QognyX/pull/6219) +- 🌍 i18n: Update translation.json with latest translations by **@github-actions[bot]** in [#6220](https://github.com/danny-avila/QognyX/pull/6220) +- 🌍 i18n: Update translation.json with latest translations by **@github-actions[bot]** in [#6240](https://github.com/danny-avila/QognyX/pull/6240) +- 🌍 i18n: Update translation.json with latest translations by **@github-actions[bot]** in [#6241](https://github.com/danny-avila/QognyX/pull/6241) +- 🌍 i18n: Update translation.json with latest translations by **@github-actions[bot]** in [#6277](https://github.com/danny-avila/QognyX/pull/6277) +- 🌍 i18n: Update translation.json with latest translations by **@github-actions[bot]** in [#6414](https://github.com/danny-avila/QognyX/pull/6414) +- 🌍 i18n: Update translation.json with latest translations by **@github-actions[bot]** in [#6505](https://github.com/danny-avila/QognyX/pull/6505) +- 🌍 i18n: Update translation.json with latest translations by **@github-actions[bot]** in [#6530](https://github.com/danny-avila/QognyX/pull/6530) +- 🌍 i18n: Add Persian Localization Support by **@rubentalstra** in [#6669](https://github.com/danny-avila/QognyX/pull/6669) +- 🌍 i18n: Update translation.json with latest translations by **@github-actions[bot]** in [#6667](https://github.com/danny-avila/QognyX/pull/6667) +- 🌍 i18n: Update translation.json with latest translations by **@github-actions[bot]** in [#7126](https://github.com/danny-avila/QognyX/pull/7126) +- 🌍 i18n: Update translation.json with latest translations by **@github-actions[bot]** in [#7148](https://github.com/danny-avila/QognyX/pull/7148) + +### 👐 Accessibility + +- 🎨 a11y: Update Model Spec Description Text by **@berry-13** in [#6294](https://github.com/danny-avila/QognyX/pull/6294) +- 🗑️ a11y: Add Accessible Name to Button for File Attachment Removal by **@kangabell** in [#6709](https://github.com/danny-avila/QognyX/pull/6709) +- ⌨️ a11y: enhance accessibility & visual consistency by **@berry-13** in [#6866](https://github.com/danny-avila/QognyX/pull/6866) +- 🙌 a11y: Searchbar/Conversations List Focus by **@danny-avila** in [#7096](https://github.com/danny-avila/QognyX/pull/7096) +- 👐 a11y: Improve Fork and SplitText Accessibility by **@danny-avila** in [#7147](https://github.com/danny-avila/QognyX/pull/7147) + +### 🔧 Fixes + +- 🐛 fix: Avatar Type Definitions in Agent/Assistant Schemas by **@danny-avila** in [#6235](https://github.com/danny-avila/QognyX/pull/6235) +- 🔧 fix: MeiliSearch Field Error and Patch Incorrect Import by #6210 by **@rubentalstra** in [#6245](https://github.com/danny-avila/QognyX/pull/6245) +- 🔏 fix: Enhance Two-Factor Authentication by **@rubentalstra** in [#6247](https://github.com/danny-avila/QognyX/pull/6247) +- 🐛 fix: Await saveMessage in abortMiddleware to ensure proper execution by **@sh4shii** in [#6248](https://github.com/danny-avila/QognyX/pull/6248) +- 🔧 fix: Axios Proxy Usage And Bump `mongoose` by **@danny-avila** in [#6298](https://github.com/danny-avila/QognyX/pull/6298) +- 🔧 fix: comment out MCP servers to resolve service run issues by **@KunalScriptz** in [#6316](https://github.com/danny-avila/QognyX/pull/6316) +- 🔧 fix: Update Token Calculations and Mapping, MCP `env` Initialization by **@danny-avila** in [#6406](https://github.com/danny-avila/QognyX/pull/6406) +- 🐞 fix: Agent "Resend" Message Attachments + Source Icon Styling by **@danny-avila** in [#6408](https://github.com/danny-avila/QognyX/pull/6408) +- 🐛 fix: Prevent Crash on Duplicate Message ID by **@Odrec** in [#6392](https://github.com/danny-avila/QognyX/pull/6392) +- 🔐 fix: Invalid Key Length in 2FA Encryption by **@rubentalstra** in [#6432](https://github.com/danny-avila/QognyX/pull/6432) +- 🏗️ fix: Fix Agents Token Spend Race Conditions, Expand Test Coverage by **@danny-avila** in [#6480](https://github.com/danny-avila/QognyX/pull/6480) +- 🔃 fix: Draft Clearing, Claude Titles, Remove Default Vision Max Tokens by **@danny-avila** in [#6501](https://github.com/danny-avila/QognyX/pull/6501) +- 🔧 fix: Update username reference to use user.name in greeting display by **@rubentalstra** in [#6534](https://github.com/danny-avila/QognyX/pull/6534) +- 🔧 fix: S3 Download Stream with Key Extraction and Blob Storage Encoding for Vision by **@danny-avila** in [#6557](https://github.com/danny-avila/QognyX/pull/6557) +- 🔧 fix: Mistral type strictness for `usage` & update token values/windows by **@danny-avila** in [#6562](https://github.com/danny-avila/QognyX/pull/6562) +- 🔧 fix: Consolidate Text Parsing and TTS Edge Initialization by **@danny-avila** in [#6582](https://github.com/danny-avila/QognyX/pull/6582) +- 🔧 fix: Ensure continuation in image processing on base64 encoding from Blob Storage by **@danny-avila** in [#6619](https://github.com/danny-avila/QognyX/pull/6619) +- ✉️ fix: Fallback For User Name In Email Templates by **@danny-avila** in [#6620](https://github.com/danny-avila/QognyX/pull/6620) +- 🔧 fix: Azure Blob Integration and File Source References by **@rubentalstra** in [#6575](https://github.com/danny-avila/QognyX/pull/6575) +- 🐛 fix: Safeguard against undefined addedEndpoints by **@wipash** in [#6654](https://github.com/danny-avila/QognyX/pull/6654) +- 🤖 fix: Gemini 2.5 Vision Support by **@danny-avila** in [#6663](https://github.com/danny-avila/QognyX/pull/6663) +- 🔄 fix: Avatar & Error Handling Enhancements by **@danny-avila** in [#6687](https://github.com/danny-avila/QognyX/pull/6687) +- 🔧 fix: Chat Middleware, Zod Conversion, Auto-Save and S3 URL Refresh by **@danny-avila** in [#6720](https://github.com/danny-avila/QognyX/pull/6720) +- 🔧 fix: Agent Capability Checks & DocumentDB Compatibility for Agent Resource Removal by **@danny-avila** in [#6726](https://github.com/danny-avila/QognyX/pull/6726) +- 🔄 fix: Improve audio MIME type detection and handling by **@berry-13** in [#6707](https://github.com/danny-avila/QognyX/pull/6707) +- 🪺 fix: Update Role Handling due to New Schema Shape by **@danny-avila** in [#6774](https://github.com/danny-avila/QognyX/pull/6774) +- 🗨️ fix: Show ModelSpec Greeting by **@berry-13** in [#6770](https://github.com/danny-avila/QognyX/pull/6770) +- 🔧 fix: Keyv and Proxy Issues, and More Memory Optimizations by **@danny-avila** in [#6867](https://github.com/danny-avila/QognyX/pull/6867) +- ✨ fix: Implement dynamic text sizing for greeting and name display by **@berry-13** in [#6833](https://github.com/danny-avila/QognyX/pull/6833) +- 📝 fix: Mistral OCR Image Support and Azure Agent Titles by **@danny-avila** in [#6901](https://github.com/danny-avila/QognyX/pull/6901) +- 📢 fix: Invalid `engineTTS` and Conversation State on Navigation by **@berry-13** in [#6904](https://github.com/danny-avila/QognyX/pull/6904) +- 🛠️ fix: Improve Accessibility and Display of Conversation Menu by **@danny-avila** in [#6913](https://github.com/danny-avila/QognyX/pull/6913) +- 🔧 fix: Agent Resource Form, Convo Menu Style, Ensure Draft Clears on Submission by **@danny-avila** in [#6925](https://github.com/danny-avila/QognyX/pull/6925) +- 🔀 fix: MCP Improvements, Auto-Save Drafts, Artifact Markup by **@danny-avila** in [#7040](https://github.com/danny-avila/QognyX/pull/7040) +- 🐋 fix: Improve Deepseek Compatbility by **@danny-avila** in [#7132](https://github.com/danny-avila/QognyX/pull/7132) +- 🐙 fix: Add Redis Ping Interval to Prevent Connection Drops by **@peeeteeer** in [#7127](https://github.com/danny-avila/QognyX/pull/7127) + +### ⚙️ Other Changes + +- 📦 refactor: Move DB Models to `@librechat/data-schemas` by **@rubentalstra** in [#6210](https://github.com/danny-avila/QognyX/pull/6210) +- 📦 chore: Patch `axios` to address CVE-2025-27152 by **@danny-avila** in [#6222](https://github.com/danny-avila/QognyX/pull/6222) +- ⚠️ refactor: Use Error Content Part Instead Of Throwing Error for Agents by **@danny-avila** in [#6262](https://github.com/danny-avila/QognyX/pull/6262) +- 🏃‍♂️ refactor: Improve Agent Run Context & Misc. Changes by **@danny-avila** in [#6448](https://github.com/danny-avila/QognyX/pull/6448) +- 📝 docs: librechat.example.yaml by **@ineiti** in [#6442](https://github.com/danny-avila/QognyX/pull/6442) +- 🏃‍♂️ refactor: More Agent Context Improvements during Run by **@danny-avila** in [#6477](https://github.com/danny-avila/QognyX/pull/6477) +- 🔃 refactor: Allow streaming for `o1` models by **@danny-avila** in [#6509](https://github.com/danny-avila/QognyX/pull/6509) +- 🔧 chore: `Vite` Plugin Upgrades & Config Optimizations by **@rubentalstra** in [#6547](https://github.com/danny-avila/QognyX/pull/6547) +- 🔧 refactor: Consolidate Logging, Model Selection & Actions Optimizations, Minor Fixes by **@danny-avila** in [#6553](https://github.com/danny-avila/QognyX/pull/6553) +- 🎨 style: Address Minor UI Refresh Issues by **@berry-13** in [#6552](https://github.com/danny-avila/QognyX/pull/6552) +- 🔧 refactor: Enhance Model & Endpoint Configurations with Global Indicators 🌍 by **@berry-13** in [#6578](https://github.com/danny-avila/QognyX/pull/6578) +- 💬 style: Chat UI, Greeting, and Message adjustments by **@berry-13** in [#6612](https://github.com/danny-avila/QognyX/pull/6612) +- ⚡ refactor: DocumentDB Compatibility for Balance Updates by **@danny-avila** in [#6673](https://github.com/danny-avila/QognyX/pull/6673) +- 🧹 chore: Update ESLint rules for React hooks by **@rubentalstra** in [#6685](https://github.com/danny-avila/QognyX/pull/6685) +- 🪙 chore: Update Gemini Pricing by **@RedwindA** in [#6731](https://github.com/danny-avila/QognyX/pull/6731) +- 🪺 refactor: Nest Permission fields for Roles by **@rubentalstra** in [#6487](https://github.com/danny-avila/QognyX/pull/6487) +- 📦 chore: Update `caniuse-lite` dependency to version 1.0.30001706 by **@rubentalstra** in [#6482](https://github.com/danny-avila/QognyX/pull/6482) +- ⚙️ refactor: OAuth Flow Signal, Type Safety, Tool Progress & Updated Packages by **@danny-avila** in [#6752](https://github.com/danny-avila/QognyX/pull/6752) +- 📦 chore: bump vite from 6.2.3 to 6.2.5 by **@dependabot[bot]** in [#6745](https://github.com/danny-avila/QognyX/pull/6745) +- 💾 chore: Enhance Local Storage Handling and Update MCP SDK by **@danny-avila** in [#6809](https://github.com/danny-avila/QognyX/pull/6809) +- 🤖 refactor: Improve Agents Memory Usage, Bump Keyv, Grok 3 by **@danny-avila** in [#6850](https://github.com/danny-avila/QognyX/pull/6850) +- 💾 refactor: Enhance Memory In Image Encodings & Client Disposal by **@danny-avila** in [#6852](https://github.com/danny-avila/QognyX/pull/6852) +- 🔁 refactor: Token Event Handler and Standardize `maxTokens` Key by **@danny-avila** in [#6886](https://github.com/danny-avila/QognyX/pull/6886) +- 🔍 refactor: Search & Message Retrieval by **@berry-13** in [#6903](https://github.com/danny-avila/QognyX/pull/6903) +- 🎨 style: standardize dropdown styling & fix z-Index layering by **@berry-13** in [#6939](https://github.com/danny-avila/QognyX/pull/6939) +- 📙 docs: CONTRIBUTING.md by **@dblock** in [#6831](https://github.com/danny-avila/QognyX/pull/6831) +- 🧭 refactor: Modernize Nav/Header by **@danny-avila** in [#7094](https://github.com/danny-avila/QognyX/pull/7094) +- 🪶 refactor: Chat Input Focus for Conversation Navigations & ChatForm Optimizations by **@danny-avila** in [#7100](https://github.com/danny-avila/QognyX/pull/7100) +- 🔃 refactor: Streamline Navigation, Message Loading UX by **@danny-avila** in [#7118](https://github.com/danny-avila/QognyX/pull/7118) +- 📜 docs: Unreleased changelog by **@github-actions[bot]** in [#6265](https://github.com/danny-avila/QognyX/pull/6265) + + + +[See full release details][release-v0.7.8-rc1] + +[release-v0.7.8-rc1]: https://github.com/danny-avila/QognyX/releases/tag/v0.7.8-rc1 + +--- diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..54f8410 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,60 @@ +# v0.8.2-rc3 + +# Base node image +FROM node:20-alpine AS node + +# Install jemalloc +RUN apk add --no-cache jemalloc +RUN apk add --no-cache python3 py3-pip uv + +# Set environment variable to use jemalloc +ENV LD_PRELOAD=/usr/lib/libjemalloc.so.2 + +# Add `uv` for extended MCP support +COPY --from=ghcr.io/astral-sh/uv:0.9.5-python3.12-alpine /usr/local/bin/uv /usr/local/bin/uvx /bin/ +RUN uv --version + +# Set configurable max-old-space-size with default +ARG NODE_MAX_OLD_SPACE_SIZE=6144 + +RUN mkdir -p /app && chown node:node /app +WORKDIR /app + +USER node + +COPY --chown=node:node package.json package-lock.json ./ +COPY --chown=node:node api/package.json ./api/package.json +COPY --chown=node:node client/package.json ./client/package.json +COPY --chown=node:node packages/data-provider/package.json ./packages/data-provider/package.json +COPY --chown=node:node packages/data-schemas/package.json ./packages/data-schemas/package.json +COPY --chown=node:node packages/api/package.json ./packages/api/package.json + +RUN \ + # Allow mounting of these files, which have no default + touch .env ; \ + # Create directories for the volumes to inherit the correct permissions + mkdir -p /app/client/public/images /app/logs /app/uploads ; \ + npm config set fetch-retry-maxtimeout 600000 ; \ + npm config set fetch-retries 5 ; \ + npm config set fetch-retry-mintimeout 15000 ; \ + npm ci --no-audit + +COPY --chown=node:node . . + +RUN \ + # React client build with configurable memory + NODE_OPTIONS="--max-old-space-size=${NODE_MAX_OLD_SPACE_SIZE}" npm run frontend; \ + npm prune --production; \ + npm cache clean --force + +# Node API setup +EXPOSE 3080 +ENV HOST=0.0.0.0 +CMD ["npm", "run", "backend"] + +# Optional: for client with nginx routing +# FROM nginx:stable-alpine AS nginx-client +# WORKDIR /usr/share/nginx/html +# COPY --from=node /app/client/dist /usr/share/nginx/html +# COPY client/nginx.conf /etc/nginx/conf.d/default.conf +# ENTRYPOINT ["nginx", "-g", "daemon off;"] diff --git a/Dockerfile.multi b/Dockerfile.multi new file mode 100644 index 0000000..2e96f53 --- /dev/null +++ b/Dockerfile.multi @@ -0,0 +1,87 @@ +# Dockerfile.multi +# v0.8.2-rc3 + +# Set configurable max-old-space-size with default +ARG NODE_MAX_OLD_SPACE_SIZE=6144 + +# Base for all builds +FROM node:20-alpine AS base-min +# Install jemalloc +RUN apk add --no-cache jemalloc +# Set environment variable to use jemalloc +ENV LD_PRELOAD=/usr/lib/libjemalloc.so.2 + +WORKDIR /app +RUN apk --no-cache add curl +RUN npm config set fetch-retry-maxtimeout 600000 && \ + npm config set fetch-retries 5 && \ + npm config set fetch-retry-mintimeout 15000 +COPY package*.json ./ +COPY packages/data-provider/package*.json ./packages/data-provider/ +COPY packages/api/package*.json ./packages/api/ +COPY packages/data-schemas/package*.json ./packages/data-schemas/ +COPY packages/client/package*.json ./packages/client/ +COPY client/package*.json ./client/ +COPY api/package*.json ./api/ + +# Install all dependencies for every build +FROM base-min AS base +WORKDIR /app +RUN npm ci + +# Build `data-provider` package +FROM base AS data-provider-build +WORKDIR /app/packages/data-provider +COPY packages/data-provider ./ +RUN npm run build + +# Build `data-schemas` package +FROM base AS data-schemas-build +WORKDIR /app/packages/data-schemas +COPY packages/data-schemas ./ +COPY --from=data-provider-build /app/packages/data-provider/dist /app/packages/data-provider/dist +RUN npm run build + +# Build `api` package +FROM base AS api-package-build +WORKDIR /app/packages/api +COPY packages/api ./ +COPY --from=data-provider-build /app/packages/data-provider/dist /app/packages/data-provider/dist +COPY --from=data-schemas-build /app/packages/data-schemas/dist /app/packages/data-schemas/dist +RUN npm run build + +# Build `client` package +FROM base AS client-package-build +WORKDIR /app/packages/client +COPY packages/client ./ +RUN npm run build + +# Client build +FROM base AS client-build +WORKDIR /app/client +COPY client ./ +COPY --from=data-provider-build /app/packages/data-provider/dist /app/packages/data-provider/dist +COPY --from=client-package-build /app/packages/client/dist /app/packages/client/dist +COPY --from=client-package-build /app/packages/client/src /app/packages/client/src +ARG NODE_MAX_OLD_SPACE_SIZE +ENV NODE_OPTIONS="--max-old-space-size=${NODE_MAX_OLD_SPACE_SIZE}" +RUN npm run build + +# API setup (including client dist) +FROM base-min AS api-build +# Add `uv` for extended MCP support +COPY --from=ghcr.io/astral-sh/uv:0.6.13 /uv /uvx /bin/ +RUN uv --version +WORKDIR /app +# Install only production deps +RUN npm ci --omit=dev +COPY api ./api +COPY config ./config +COPY --from=data-provider-build /app/packages/data-provider/dist ./packages/data-provider/dist +COPY --from=data-schemas-build /app/packages/data-schemas/dist ./packages/data-schemas/dist +COPY --from=api-package-build /app/packages/api/dist ./packages/api/dist +COPY --from=client-build /app/client/dist ./client/dist +WORKDIR /app/api +EXPOSE 3080 +ENV HOST=0.0.0.0 +CMD ["node", "server/index.js"] diff --git a/INSTALLATION.md b/INSTALLATION.md new file mode 100644 index 0000000..20a03ae --- /dev/null +++ b/INSTALLATION.md @@ -0,0 +1,151 @@ +# QognyX Installation - Environnement de Développement + +## Installation réalisée + +✅ Node.js 20.20.0 installé +✅ npm 10.8.2 installé +✅ MongoDB 7.0.28 installé et démarré +✅ QognyX sources téléchargées et configurées +✅ Dépendances npm installées + +## Configuration + +### API Personnalisée +L'environnement est configuré pour utiliser votre API personnalisée : +- URL: https://cpu.lsbuchet.com/v1 +- Format: Compatible OpenAI + +### Fichiers de configuration +- `.env` : Variables d'environnement +- `librechat.yaml` : Configuration de l'endpoint personnalisé + +### Base de données +MongoDB est configuré localement sur `mongodb://127.0.0.1:27017/QognyX` + +## Utilisation + +### Avant de démarrer +1. Éditer `/opt/front-dev/.env` et remplacer `your_api_key_here` par votre vraie clé API: + ```bash + nano /opt/front-dev/.env + # Chercher CPU_API_KEY= et remplacer la valeur + ``` + +### Démarrer l'environnement de développement +```bash +cd /opt/front-dev +./start-dev.sh +``` +ou +```bash +cd /opt/front-dev +npm run dev +``` + +L'application sera accessible sur: http://localhost:3080 + +### Build pour la production +```bash +cd /opt/front-dev +./build-prod.sh +``` + +### Démarrer en production +```bash +cd /opt/front-dev +npm run start +``` + +## Commandes utiles + +### Vérifier le statut de MongoDB +```bash +systemctl status mongod +``` + +### Arrêter MongoDB +```bash +systemctl stop mongod +``` + +### Démarrer MongoDB +```bash +systemctl start mongod +``` + +### Mettre à jour les sources +```bash +cd /opt/front-dev +curl -L https://github.com/danny-avila/QognyX/archive/refs/heads/main.tar.gz -o update.tar.gz +tar -xzf update.tar.gz --strip-components=1 +rm update.tar.gz +npm ci +``` + +### Installer de nouvelles dépendances +```bash +cd /opt/front-dev +npm install +``` + +## Développement + +### Structure du projet +- `api/` : Code backend (Node.js/Express) +- `client/` : Code frontend (React) +- `packages/` : Packages partagés +- `config/` : Fichiers de configuration + +### Variables d'environnement importantes +- `CPU_API_KEY` : Clé API pour cpu.lsbuchet.com +- `MONGO_URI` : URI de connexion MongoDB +- `PORT` : Port du serveur (défaut: 3080) +- `DEBUG_LOGGING` : Active les logs de debug + +## Logs et Debugging + +### Voir les logs MongoDB +```bash +tail -f /var/log/mongodb/mongod.log +``` + +### Activer le mode debug +Dans `.env`, définir: +``` +DEBUG_LOGGING=true +DEBUG_CONSOLE=true +``` + +## Production vs Développement + +### Environnement de développement +- Hot-reload activé +- Logs verbeux +- Pas de minification + +### Environnement de production +- Build optimisé +- Minification +- Meilleure performance + +## Servir plusieurs instances + +Vous pouvez configurer différentes instances sur différents ports: +- Développement: Port 3080 +- Production: Port 3081 (par exemple) + +Modifier `PORT=` dans `.env` pour changer le port. + +## Support + +Pour plus d'informations sur QognyX: +- Documentation: https://www.librechat.ai/docs +- GitHub: https://github.com/danny-avila/QognyX + +## Prochaines étapes + +1. ✏️ Éditer `.env` pour ajouter votre clé API +2. 🚀 Démarrer l'environnement de dev: `./start-dev.sh` +3. 🌐 Ouvrir http://localhost:3080 +4. 📝 Créer un compte utilisateur +5. 💬 Tester l'API personnalisée diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..535850a --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 LibreChat + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..492c78e --- /dev/null +++ b/README.md @@ -0,0 +1,217 @@ +

+ + + +

+ QognyX +

+

+ +

+ + + + + + + + + + + + +

+ +

+ + Deploy on Railway + + + Deploy on Zeabur + + + Deploy on Sealos + +

+ +

+ + Translation Progress + +

+ + +# ✨ Features + +- 🖥️ **UI & Experience** inspired by ChatGPT with enhanced design and features + +- 🤖 **AI Model Selection**: + - Anthropic (Claude), AWS Bedrock, OpenAI, Azure OpenAI, Google, Vertex AI, OpenAI Responses API (incl. Azure) + - [Custom Endpoints](https://www.librechat.ai/docs/quick_start/custom_endpoints): Use any OpenAI-compatible API with QognyX, no proxy required + - Compatible with [Local & Remote AI Providers](https://www.librechat.ai/docs/configuration/librechat_yaml/ai_endpoints): + - Ollama, groq, Cohere, Mistral AI, Apple MLX, koboldcpp, together.ai, + - OpenRouter, Helicone, Perplexity, ShuttleAI, Deepseek, Qwen, and more + +- 🔧 **[Code Interpreter API](https://www.librechat.ai/docs/features/code_interpreter)**: + - Secure, Sandboxed Execution in Python, Node.js (JS/TS), Go, C/C++, Java, PHP, Rust, and Fortran + - Seamless File Handling: Upload, process, and download files directly + - No Privacy Concerns: Fully isolated and secure execution + +- 🔦 **Agents & Tools Integration**: + - **[QognyX Agents](https://www.librechat.ai/docs/features/agents)**: + - No-Code Custom Assistants: Build specialized, AI-driven helpers + - Agent Marketplace: Discover and deploy community-built agents + - Collaborative Sharing: Share agents with specific users and groups + - Flexible & Extensible: Use MCP Servers, tools, file search, code execution, and more + - Compatible with Custom Endpoints, OpenAI, Azure, Anthropic, AWS Bedrock, Google, Vertex AI, Responses API, and more + - [Model Context Protocol (MCP) Support](https://modelcontextprotocol.io/clients#librechat) for Tools + +- 🔍 **Web Search**: + - Search the internet and retrieve relevant information to enhance your AI context + - Combines search providers, content scrapers, and result rerankers for optimal results + - **Customizable Jina Reranking**: Configure custom Jina API URLs for reranking services + - **[Learn More →](https://www.librechat.ai/docs/features/web_search)** + +- 🪄 **Generative UI with Code Artifacts**: + - [Code Artifacts](https://youtu.be/GfTj7O4gmd0?si=WJbdnemZpJzBrJo3) allow creation of React, HTML, and Mermaid diagrams directly in chat + +- 🎨 **Image Generation & Editing** + - Text-to-image and image-to-image with [GPT-Image-1](https://www.librechat.ai/docs/features/image_gen#1--openai-image-tools-recommended) + - Text-to-image with [DALL-E (3/2)](https://www.librechat.ai/docs/features/image_gen#2--dalle-legacy), [Stable Diffusion](https://www.librechat.ai/docs/features/image_gen#3--stable-diffusion-local), [Flux](https://www.librechat.ai/docs/features/image_gen#4--flux), or any [MCP server](https://www.librechat.ai/docs/features/image_gen#5--model-context-protocol-mcp) + - Produce stunning visuals from prompts or refine existing images with a single instruction + +- 💾 **Presets & Context Management**: + - Create, Save, & Share Custom Presets + - Switch between AI Endpoints and Presets mid-chat + - Edit, Resubmit, and Continue Messages with Conversation branching + - Create and share prompts with specific users and groups + - [Fork Messages & Conversations](https://www.librechat.ai/docs/features/fork) for Advanced Context control + +- 💬 **Multimodal & File Interactions**: + - Upload and analyze images with Claude 3, GPT-4.5, GPT-4o, o1, Llama-Vision, and Gemini 📸 + - Chat with Files using Custom Endpoints, OpenAI, Azure, Anthropic, AWS Bedrock, & Google 🗃️ + +- 🌎 **Multilingual UI**: + - English, 中文 (简体), 中文 (繁體), العربية, Deutsch, Español, Français, Italiano + - Polski, Português (PT), Português (BR), Русский, 日本語, Svenska, 한국어, Tiếng Việt + - Türkçe, Nederlands, עברית, Català, Čeština, Dansk, Eesti, فارسی + - Suomi, Magyar, Հայերեն, Bahasa Indonesia, ქართული, Latviešu, ไทย, ئۇيغۇرچە + +- 🧠 **Reasoning UI**: + - Dynamic Reasoning UI for Chain-of-Thought/Reasoning AI models like DeepSeek-R1 + +- 🎨 **Customizable Interface**: + - Customizable Dropdown & Interface that adapts to both power users and newcomers + +- 🗣️ **Speech & Audio**: + - Chat hands-free with Speech-to-Text and Text-to-Speech + - Automatically send and play Audio + - Supports OpenAI, Azure OpenAI, and Elevenlabs + +- 📥 **Import & Export Conversations**: + - Import Conversations from QognyX, ChatGPT, Chatbot UI + - Export conversations as screenshots, markdown, text, json + +- 🔍 **Search & Discovery**: + - Search all messages/conversations + +- 👥 **Multi-User & Secure Access**: + - Multi-User, Secure Authentication with OAuth2, LDAP, & Email Login Support + - Built-in Moderation, and Token spend tools + +- ⚙️ **Configuration & Deployment**: + - Configure Proxy, Reverse Proxy, Docker, & many Deployment options + - Use completely local or deploy on the cloud + +- 📖 **Open-Source & Community**: + - Completely Open-Source & Built in Public + - Community-driven development, support, and feedback + +[For a thorough review of our features, see our docs here](https://docs.librechat.ai/) 📚 + +## 🪶 All-In-One AI Conversations with QognyX + +QognyX brings together the future of assistant AIs with the revolutionary technology of OpenAI's ChatGPT. Celebrating the original styling, QognyX gives you the ability to integrate multiple AI models. It also integrates and enhances original client features such as conversation and message search, prompt templates and plugins. + +With QognyX, you no longer need to opt for ChatGPT Plus and can instead use free or pay-per-call APIs. We welcome contributions, cloning, and forking to enhance the capabilities of this advanced chatbot platform. + +[![Watch the video](https://raw.githubusercontent.com/QognyX-AI/librechat.ai/main/public/images/changelog/v0.7.6.gif)](https://www.youtube.com/watch?v=ilfwGQtJNlI) + +Click on the thumbnail to open the video☝️ + +--- + +## 🌐 Resources + +**GitHub Repo:** + - **RAG API:** [github.com/danny-avila/rag_api](https://github.com/danny-avila/rag_api) + - **Website:** [github.com/QognyX-AI/librechat.ai](https://github.com/QognyX-AI/librechat.ai) + +**Other:** + - **Website:** [librechat.ai](https://librechat.ai) + - **Documentation:** [librechat.ai/docs](https://librechat.ai/docs) + - **Blog:** [librechat.ai/blog](https://librechat.ai/blog) + +--- + +## 📝 Changelog + +Keep up with the latest updates by visiting the releases page and notes: +- [Releases](https://github.com/danny-avila/QognyX/releases) +- [Changelog](https://www.librechat.ai/changelog) + +**⚠️ Please consult the [changelog](https://www.librechat.ai/changelog) for breaking changes before updating.** + +--- + +## ⭐ Star History + +

+ + Star History Chart + +

+

+ + danny-avila%2FQognyX | Trendshift + + + ROSS Index - Fastest Growing Open-Source Startups in Q1 2024 | Runa Capital + +

+ +--- + +## ✨ Contributions + +Contributions, suggestions, bug reports and fixes are welcome! + +For new features, components, or extensions, please open an issue and discuss before sending a PR. + +If you'd like to help translate QognyX into your language, we'd love your contribution! Improving our translations not only makes QognyX more accessible to users around the world but also enhances the overall user experience. Please check out our [Translation Guide](https://www.librechat.ai/docs/translation). + +--- + +## 💖 This project exists in its current state thanks to all the people who contribute + + + + + +--- + +## 🎉 Special Thanks + +We thank [Locize](https://locize.com) for their translation management tools that support multiple languages in QognyX. + +

+ + Locize Logo + +

diff --git a/RESUME.txt b/RESUME.txt new file mode 100644 index 0000000..4f0eead --- /dev/null +++ b/RESUME.txt @@ -0,0 +1,98 @@ +================================================================================ + INSTALLATION LIBRECHAT - RÉSUMÉ +================================================================================ + +📁 RÉPERTOIRES CRÉÉS: +--------------------- +✅ /opt/front-Prod - Pour l'environnement de production (vide pour le moment) +✅ /opt/front-dev - Environnement de développement CONFIGURÉ +✅ /opt/www - Répertoire www (vide pour le moment) + +Chaque répertoire contient un sous-dossier /copilot + +🔧 LOGICIELS INSTALLÉS: +----------------------- +✅ Node.js v20.20.0 +✅ npm v10.8.2 +✅ MongoDB v7.0.28 (démarré et activé au boot) + +📦 LIBRECHAT - ENVIRONNEMENT DE DÉVELOPPEMENT (/opt/front-dev): +--------------------------------------------------------------- +✅ Sources complètes téléchargées depuis GitHub +✅ Toutes les dépendances npm installées (3169 packages) +✅ Fichier .env configuré avec secrets JWT générés +✅ Fichier librechat.yaml configuré pour l'API cpu.lsbuchet.com +✅ Scripts de démarrage créés + +📝 CONFIGURATION: +----------------- +API personnalisée: https://cpu.lsbuchet.com/v1 (format OpenAI) +Base de données: MongoDB local sur port 27017 +Port serveur: 3080 +Mode: Développement avec hot-reload + +⚠️ ACTION REQUISE AVANT LE DÉMARRAGE: +-------------------------------------- +1. Éditer le fichier /opt/front-dev/.env +2. Remplacer "your_api_key_here" par votre vraie clé API pour cpu.lsbuchet.com: + + Commande: nano /opt/front-dev/.env + Chercher: CPU_API_KEY=your_api_key_here + Remplacer par: CPU_API_KEY=votre_vraie_clé_ici + +🚀 DÉMARRAGE: +------------- +Pour démarrer l'environnement de développement: + cd /opt/front-dev + ./start-dev.sh + +Ou directement: + cd /opt/front-dev + npm run dev + +L'application sera accessible sur: http://localhost:3080 + +📚 DOCUMENTATION: +----------------- +Documentation complète: /opt/front-dev/INSTALLATION.md + +🔄 COMMANDES UTILES: +-------------------- +Démarrer MongoDB: systemctl start mongod +Arrêter MongoDB: systemctl stop mongod +Statut MongoDB: systemctl status mongod +Build production: cd /opt/front-dev && ./build-prod.sh +Démarrer en prod: cd /opt/front-dev && npm run start + +📊 FONCTIONNALITÉS: +------------------- +✅ Frontend React avec hot-reload +✅ Backend Node.js/Express +✅ API personnalisée configurée (cpu.lsbuchet.com) +✅ MongoDB pour le stockage +✅ Authentification locale activée +✅ Inscription activée +✅ Logs de debug activés +✅ Mise à jour des sources facile + +🔐 SÉCURITÉ: +------------ +✅ Secrets JWT générés automatiquement +✅ Clés de chiffrement créées +✅ Base de données locale sécurisée + +📌 PROCHAINES ÉTAPES: +--------------------- +1. Ajouter votre clé API dans /opt/front-dev/.env +2. Démarrer le serveur de développement: ./start-dev.sh +3. Ouvrir http://localhost:3080 dans votre navigateur +4. Créer un compte utilisateur +5. Commencer à développer et tester ! + +Pour la production: +- Configurer un environnement similaire dans /opt/front-Prod +- Builder avec: ./build-prod.sh +- Démarrer avec: npm run start +- Configurer un reverse proxy (nginx/apache) + +================================================================================ diff --git a/api/app/clients/BaseClient.js b/api/app/clients/BaseClient.js new file mode 100644 index 0000000..a2dfaf9 --- /dev/null +++ b/api/app/clients/BaseClient.js @@ -0,0 +1,1435 @@ +const crypto = require('crypto'); +const fetch = require('node-fetch'); +const { logger } = require('@librechat/data-schemas'); +const { + countTokens, + getBalanceConfig, + extractFileContext, + encodeAndFormatAudios, + encodeAndFormatVideos, + encodeAndFormatDocuments, +} = require('@librechat/api'); +const { + Constants, + ErrorTypes, + FileSources, + ContentTypes, + excludedKeys, + EModelEndpoint, + isParamEndpoint, + isAgentsEndpoint, + isEphemeralAgentId, + supportsBalanceCheck, +} = require('librechat-data-provider'); +const { + updateMessage, + getMessages, + saveMessage, + saveConvo, + getConvo, + getFiles, +} = require('~/models'); +const { getStrategyFunctions } = require('~/server/services/Files/strategies'); +const { checkBalance } = require('~/models/balanceMethods'); +const { truncateToolCallOutputs } = require('./prompts'); +const TextStream = require('./TextStream'); + +class BaseClient { + constructor(apiKey, options = {}) { + this.apiKey = apiKey; + this.sender = options.sender ?? 'AI'; + this.contextStrategy = null; + this.currentDateString = new Date().toLocaleDateString('en-us', { + year: 'numeric', + month: 'long', + day: 'numeric', + }); + /** @type {boolean} */ + this.skipSaveConvo = false; + /** @type {boolean} */ + this.skipSaveUserMessage = false; + /** @type {string} */ + this.user; + /** @type {string} */ + this.conversationId; + /** @type {string} */ + this.responseMessageId; + /** @type {string} */ + this.parentMessageId; + /** @type {TAttachment[]} */ + this.attachments; + /** The key for the usage object's input tokens + * @type {string} */ + this.inputTokensKey = 'prompt_tokens'; + /** The key for the usage object's output tokens + * @type {string} */ + this.outputTokensKey = 'completion_tokens'; + /** @type {Set} */ + this.savedMessageIds = new Set(); + /** + * Flag to determine if the client re-submitted the latest assistant message. + * @type {boolean | undefined} */ + this.continued; + /** + * Flag to determine if the client has already fetched the conversation while saving new messages. + * @type {boolean | undefined} */ + this.fetchedConvo; + /** @type {TMessage[]} */ + this.currentMessages = []; + /** @type {import('librechat-data-provider').VisionModes | undefined} */ + this.visionMode; + } + + setOptions() { + throw new Error("Method 'setOptions' must be implemented."); + } + + async getCompletion() { + throw new Error("Method 'getCompletion' must be implemented."); + } + + /** @type {sendCompletion} */ + async sendCompletion() { + throw new Error("Method 'sendCompletion' must be implemented."); + } + + getSaveOptions() { + throw new Error('Subclasses must implement getSaveOptions'); + } + + async buildMessages() { + throw new Error('Subclasses must implement buildMessages'); + } + + async summarizeMessages() { + throw new Error('Subclasses attempted to call summarizeMessages without implementing it'); + } + + /** + * @returns {string} + */ + getResponseModel() { + if (isAgentsEndpoint(this.options.endpoint) && this.options.agent && this.options.agent.id) { + return this.options.agent.id; + } + + return this.modelOptions?.model ?? this.model; + } + + /** + * Abstract method to get the token count for a message. Subclasses must implement this method. + * @param {TMessage} responseMessage + * @returns {number} + */ + getTokenCountForResponse(responseMessage) { + logger.debug('[BaseClient] `recordTokenUsage` not implemented.', responseMessage); + } + + /** + * Abstract method to record token usage. Subclasses must implement this method. + * If a correction to the token usage is needed, the method should return an object with the corrected token counts. + * Should only be used if `recordCollectedUsage` was not used instead. + * @param {string} [model] + * @param {AppConfig['balance']} [balance] + * @param {number} promptTokens + * @param {number} completionTokens + * @returns {Promise} + */ + async recordTokenUsage({ model, balance, promptTokens, completionTokens }) { + logger.debug('[BaseClient] `recordTokenUsage` not implemented.', { + model, + balance, + promptTokens, + completionTokens, + }); + } + + /** + * Makes an HTTP request and logs the process. + * + * @param {RequestInfo} url - The URL to make the request to. Can be a string or a Request object. + * @param {RequestInit} [init] - Optional init options for the request. + * @returns {Promise} - A promise that resolves to the response of the fetch request. + */ + async fetch(_url, init) { + let url = _url; + if (this.options.directEndpoint) { + url = this.options.reverseProxyUrl; + } + logger.debug(`Making request to ${url}`); + if (typeof Bun !== 'undefined') { + return await fetch(url, init); + } + return await fetch(url, init); + } + + getBuildMessagesOptions() { + throw new Error('Subclasses must implement getBuildMessagesOptions'); + } + + async generateTextStream(text, onProgress, options = {}) { + const stream = new TextStream(text, options); + await stream.processTextStream(onProgress); + } + + /** + * @returns {[string|undefined, string|undefined]} + */ + processOverideIds() { + /** @type {Record} */ + let { overrideConvoId, overrideUserMessageId } = this.options?.req?.body ?? {}; + if (overrideConvoId) { + const [conversationId, index] = overrideConvoId.split(Constants.COMMON_DIVIDER); + overrideConvoId = conversationId; + if (index !== '0') { + this.skipSaveConvo = true; + } + } + if (overrideUserMessageId) { + const [userMessageId, index] = overrideUserMessageId.split(Constants.COMMON_DIVIDER); + overrideUserMessageId = userMessageId; + if (index !== '0') { + this.skipSaveUserMessage = true; + } + } + + return [overrideConvoId, overrideUserMessageId]; + } + + async setMessageOptions(opts = {}) { + if (opts && opts.replaceOptions) { + this.setOptions(opts); + } + + const [overrideConvoId, overrideUserMessageId] = this.processOverideIds(); + const { isEdited, isContinued } = opts; + const user = opts.user ?? null; + this.user = user; + const saveOptions = this.getSaveOptions(); + this.abortController = opts.abortController ?? new AbortController(); + const requestConvoId = overrideConvoId ?? opts.conversationId; + const conversationId = requestConvoId ?? crypto.randomUUID(); + const parentMessageId = opts.parentMessageId ?? Constants.NO_PARENT; + const userMessageId = + overrideUserMessageId ?? opts.overrideParentMessageId ?? crypto.randomUUID(); + let responseMessageId = opts.responseMessageId ?? crypto.randomUUID(); + let head = isEdited ? responseMessageId : parentMessageId; + this.currentMessages = (await this.loadHistory(conversationId, head)) ?? []; + this.conversationId = conversationId; + + if (isEdited && !isContinued) { + responseMessageId = crypto.randomUUID(); + head = responseMessageId; + this.currentMessages[this.currentMessages.length - 1].messageId = head; + } + + if (opts.isRegenerate && responseMessageId.endsWith('_')) { + responseMessageId = crypto.randomUUID(); + } + + this.responseMessageId = responseMessageId; + + return { + ...opts, + user, + head, + saveOptions, + userMessageId, + requestConvoId, + conversationId, + parentMessageId, + responseMessageId, + }; + } + + createUserMessage({ messageId, parentMessageId, conversationId, text }) { + return { + messageId, + parentMessageId, + conversationId, + sender: 'User', + text, + isCreatedByUser: true, + }; + } + + async handleStartMethods(message, opts) { + const { + user, + head, + saveOptions, + userMessageId, + requestConvoId, + conversationId, + parentMessageId, + responseMessageId, + } = await this.setMessageOptions(opts); + + const userMessage = opts.isEdited + ? this.currentMessages[this.currentMessages.length - 2] + : this.createUserMessage({ + messageId: userMessageId, + parentMessageId, + conversationId, + text: message, + }); + + if (typeof opts?.getReqData === 'function') { + opts.getReqData({ + userMessage, + conversationId, + responseMessageId, + sender: this.sender, + }); + } + + if (typeof opts?.onStart === 'function') { + const isNewConvo = !requestConvoId && parentMessageId === Constants.NO_PARENT; + opts.onStart(userMessage, responseMessageId, isNewConvo); + } + + return { + ...opts, + user, + head, + conversationId, + responseMessageId, + saveOptions, + userMessage, + }; + } + + /** + * Adds instructions to the messages array. If the instructions object is empty or undefined, + * the original messages array is returned. Otherwise, the instructions are added to the messages + * array either at the beginning (default) or preserving the last message at the end. + * + * @param {Array} messages - An array of messages. + * @param {Object} instructions - An object containing instructions to be added to the messages. + * @param {boolean} [beforeLast=false] - If true, adds instructions before the last message; if false, adds at the beginning. + * @returns {Array} An array containing messages and instructions, or the original messages if instructions are empty. + */ + addInstructions(messages, instructions, beforeLast = false) { + if (!instructions || Object.keys(instructions).length === 0) { + return messages; + } + + if (!beforeLast) { + return [instructions, ...messages]; + } + + // Legacy behavior: add instructions before the last message + const payload = []; + if (messages.length > 1) { + payload.push(...messages.slice(0, -1)); + } + + payload.push(instructions); + + if (messages.length > 0) { + payload.push(messages[messages.length - 1]); + } + + return payload; + } + + async handleTokenCountMap(tokenCountMap) { + if (this.clientName === EModelEndpoint.agents) { + return; + } + if (this.currentMessages.length === 0) { + return; + } + + for (let i = 0; i < this.currentMessages.length; i++) { + // Skip the last message, which is the user message. + if (i === this.currentMessages.length - 1) { + break; + } + + const message = this.currentMessages[i]; + const { messageId } = message; + const update = {}; + + if (messageId === tokenCountMap.summaryMessage?.messageId) { + logger.debug(`[BaseClient] Adding summary props to ${messageId}.`); + + update.summary = tokenCountMap.summaryMessage.content; + update.summaryTokenCount = tokenCountMap.summaryMessage.tokenCount; + } + + if (message.tokenCount && !update.summaryTokenCount) { + logger.debug(`[BaseClient] Skipping ${messageId}: already had a token count.`); + continue; + } + + const tokenCount = tokenCountMap[messageId]; + if (tokenCount) { + message.tokenCount = tokenCount; + update.tokenCount = tokenCount; + await this.updateMessageInDatabase({ messageId, ...update }); + } + } + } + + concatenateMessages(messages) { + return messages.reduce((acc, message) => { + const nameOrRole = message.name ?? message.role; + return acc + `${nameOrRole}:\n${message.content}\n\n`; + }, ''); + } + + /** + * This method processes an array of messages and returns a context of messages that fit within a specified token limit. + * It iterates over the messages from newest to oldest, adding them to the context until the token limit is reached. + * If the token limit would be exceeded by adding a message, that message is not added to the context and remains in the original array. + * The method uses `push` and `pop` operations for efficient array manipulation, and reverses the context array at the end to maintain the original order of the messages. + * + * @param {Object} params + * @param {TMessage[]} params.messages - An array of messages, each with a `tokenCount` property. The messages should be ordered from oldest to newest. + * @param {number} [params.maxContextTokens] - The max number of tokens allowed in the context. If not provided, defaults to `this.maxContextTokens`. + * @param {{ role: 'system', content: text, tokenCount: number }} [params.instructions] - Instructions already added to the context at index 0. + * @returns {Promise<{ + * context: TMessage[], + * remainingContextTokens: number, + * messagesToRefine: TMessage[], + * }>} An object with three properties: `context`, `remainingContextTokens`, and `messagesToRefine`. + * `context` is an array of messages that fit within the token limit. + * `remainingContextTokens` is the number of tokens remaining within the limit after adding the messages to the context. + * `messagesToRefine` is an array of messages that were not added to the context because they would have exceeded the token limit. + */ + async getMessagesWithinTokenLimit({ messages: _messages, maxContextTokens, instructions }) { + // Every reply is primed with <|start|>assistant<|message|>, so we + // start with 3 tokens for the label after all messages have been counted. + let currentTokenCount = 3; + const instructionsTokenCount = instructions?.tokenCount ?? 0; + let remainingContextTokens = + (maxContextTokens ?? this.maxContextTokens) - instructionsTokenCount; + const messages = [..._messages]; + + const context = []; + + if (currentTokenCount < remainingContextTokens) { + while (messages.length > 0 && currentTokenCount < remainingContextTokens) { + if (messages.length === 1 && instructions) { + break; + } + const poppedMessage = messages.pop(); + const { tokenCount } = poppedMessage; + + if (poppedMessage && currentTokenCount + tokenCount <= remainingContextTokens) { + context.push(poppedMessage); + currentTokenCount += tokenCount; + } else { + messages.push(poppedMessage); + break; + } + } + } + + if (instructions) { + context.push(_messages[0]); + messages.shift(); + } + + const prunedMemory = messages; + remainingContextTokens -= currentTokenCount; + + return { + context: context.reverse(), + remainingContextTokens, + messagesToRefine: prunedMemory, + }; + } + + async handleContextStrategy({ + instructions, + orderedMessages, + formattedMessages, + buildTokenMap = true, + }) { + let _instructions; + let tokenCount; + + if (instructions) { + ({ tokenCount, ..._instructions } = instructions); + } + + _instructions && logger.debug('[BaseClient] instructions tokenCount: ' + tokenCount); + if (tokenCount && tokenCount > this.maxContextTokens) { + const info = `${tokenCount} / ${this.maxContextTokens}`; + const errorMessage = `{ "type": "${ErrorTypes.INPUT_LENGTH}", "info": "${info}" }`; + logger.warn(`Instructions token count exceeds max token count (${info}).`); + throw new Error(errorMessage); + } + + if (this.clientName === EModelEndpoint.agents) { + const { dbMessages, editedIndices } = truncateToolCallOutputs( + orderedMessages, + this.maxContextTokens, + this.getTokenCountForMessage.bind(this), + ); + + if (editedIndices.length > 0) { + logger.debug('[BaseClient] Truncated tool call outputs:', editedIndices); + for (const index of editedIndices) { + formattedMessages[index].content = dbMessages[index].content; + } + orderedMessages = dbMessages; + } + } + + let orderedWithInstructions = this.addInstructions(orderedMessages, instructions); + + let { context, remainingContextTokens, messagesToRefine } = + await this.getMessagesWithinTokenLimit({ + messages: orderedWithInstructions, + instructions, + }); + + logger.debug('[BaseClient] Context Count (1/2)', { + remainingContextTokens, + maxContextTokens: this.maxContextTokens, + }); + + let summaryMessage; + let summaryTokenCount; + let { shouldSummarize } = this; + + // Calculate the difference in length to determine how many messages were discarded if any + let payload; + let { length } = formattedMessages; + length += instructions != null ? 1 : 0; + const diff = length - context.length; + const firstMessage = orderedWithInstructions[0]; + const usePrevSummary = + shouldSummarize && + diff === 1 && + firstMessage?.summary && + this.previous_summary.messageId === firstMessage.messageId; + + if (diff > 0) { + payload = formattedMessages.slice(diff); + logger.debug( + `[BaseClient] Difference between original payload (${length}) and context (${context.length}): ${diff}`, + ); + } + + payload = this.addInstructions(payload ?? formattedMessages, _instructions); + + const latestMessage = orderedWithInstructions[orderedWithInstructions.length - 1]; + if (payload.length === 0 && !shouldSummarize && latestMessage) { + const info = `${latestMessage.tokenCount} / ${this.maxContextTokens}`; + const errorMessage = `{ "type": "${ErrorTypes.INPUT_LENGTH}", "info": "${info}" }`; + logger.warn(`Prompt token count exceeds max token count (${info}).`); + throw new Error(errorMessage); + } else if ( + _instructions && + payload.length === 1 && + payload[0].content === _instructions.content + ) { + const info = `${tokenCount + 3} / ${this.maxContextTokens}`; + const errorMessage = `{ "type": "${ErrorTypes.INPUT_LENGTH}", "info": "${info}" }`; + logger.warn( + `Including instructions, the prompt token count exceeds remaining max token count (${info}).`, + ); + throw new Error(errorMessage); + } + + if (usePrevSummary) { + summaryMessage = { role: 'system', content: firstMessage.summary }; + summaryTokenCount = firstMessage.summaryTokenCount; + payload.unshift(summaryMessage); + remainingContextTokens -= summaryTokenCount; + } else if (shouldSummarize && messagesToRefine.length > 0) { + ({ summaryMessage, summaryTokenCount } = await this.summarizeMessages({ + messagesToRefine, + remainingContextTokens, + })); + summaryMessage && payload.unshift(summaryMessage); + remainingContextTokens -= summaryTokenCount; + } + + // Make sure to only continue summarization logic if the summary message was generated + shouldSummarize = summaryMessage != null && shouldSummarize === true; + + logger.debug('[BaseClient] Context Count (2/2)', { + remainingContextTokens, + maxContextTokens: this.maxContextTokens, + }); + + /** @type {Record | undefined} */ + let tokenCountMap; + if (buildTokenMap) { + const currentPayload = shouldSummarize ? orderedWithInstructions : context; + tokenCountMap = currentPayload.reduce((map, message, index) => { + const { messageId } = message; + if (!messageId) { + return map; + } + + if (shouldSummarize && index === messagesToRefine.length - 1 && !usePrevSummary) { + map.summaryMessage = { ...summaryMessage, messageId, tokenCount: summaryTokenCount }; + } + + map[messageId] = currentPayload[index].tokenCount; + return map; + }, {}); + } + + const promptTokens = this.maxContextTokens - remainingContextTokens; + + logger.debug('[BaseClient] tokenCountMap:', tokenCountMap); + logger.debug('[BaseClient]', { + promptTokens, + remainingContextTokens, + payloadSize: payload.length, + maxContextTokens: this.maxContextTokens, + }); + + return { payload, tokenCountMap, promptTokens, messages: orderedWithInstructions }; + } + + async sendMessage(message, opts = {}) { + const appConfig = this.options.req?.config; + /** @type {Promise} */ + let userMessagePromise; + const { user, head, isEdited, conversationId, responseMessageId, saveOptions, userMessage } = + await this.handleStartMethods(message, opts); + + if (opts.progressCallback) { + opts.onProgress = opts.progressCallback.call(null, { + ...(opts.progressOptions ?? {}), + parentMessageId: userMessage.messageId, + messageId: responseMessageId, + }); + } + + const { editedContent } = opts; + + // It's not necessary to push to currentMessages + // depending on subclass implementation of handling messages + // When this is an edit, all messages are already in currentMessages, both user and response + if (isEdited) { + let latestMessage = this.currentMessages[this.currentMessages.length - 1]; + if (!latestMessage) { + latestMessage = { + messageId: responseMessageId, + conversationId, + parentMessageId: userMessage.messageId, + isCreatedByUser: false, + model: this.modelOptions?.model ?? this.model, + sender: this.sender, + }; + this.currentMessages.push(userMessage, latestMessage); + } else if (editedContent != null) { + // Handle editedContent for content parts + if (editedContent && latestMessage.content && Array.isArray(latestMessage.content)) { + const { index, text, type } = editedContent; + if (index >= 0 && index < latestMessage.content.length) { + const contentPart = latestMessage.content[index]; + if (type === ContentTypes.THINK && contentPart.type === ContentTypes.THINK) { + contentPart[ContentTypes.THINK] = text; + } else if (type === ContentTypes.TEXT && contentPart.type === ContentTypes.TEXT) { + contentPart[ContentTypes.TEXT] = text; + } + } + } + } + this.continued = true; + } else { + this.currentMessages.push(userMessage); + } + + /** + * When the userMessage is pushed to currentMessages, the parentMessage is the userMessageId. + * this only matters when buildMessages is utilizing the parentMessageId, and may vary on implementation + */ + const parentMessageId = isEdited ? head : userMessage.messageId; + this.parentMessageId = parentMessageId; + let { + prompt: payload, + tokenCountMap, + promptTokens, + } = await this.buildMessages( + this.currentMessages, + parentMessageId, + this.getBuildMessagesOptions(opts), + opts, + ); + + if (tokenCountMap) { + logger.debug('[BaseClient] tokenCountMap', tokenCountMap); + if (tokenCountMap[userMessage.messageId]) { + userMessage.tokenCount = tokenCountMap[userMessage.messageId]; + logger.debug('[BaseClient] userMessage', userMessage); + } + + this.handleTokenCountMap(tokenCountMap); + } + + if (!isEdited && !this.skipSaveUserMessage) { + userMessagePromise = this.saveMessageToDatabase(userMessage, saveOptions, user); + this.savedMessageIds.add(userMessage.messageId); + if (typeof opts?.getReqData === 'function') { + opts.getReqData({ + userMessagePromise, + }); + } + } + + const balanceConfig = getBalanceConfig(appConfig); + if ( + balanceConfig?.enabled && + supportsBalanceCheck[this.options.endpointType ?? this.options.endpoint] + ) { + await checkBalance({ + req: this.options.req, + res: this.options.res, + txData: { + user: this.user, + tokenType: 'prompt', + amount: promptTokens, + endpoint: this.options.endpoint, + model: this.modelOptions?.model ?? this.model, + endpointTokenConfig: this.options.endpointTokenConfig, + }, + }); + } + + const { completion, metadata } = await this.sendCompletion(payload, opts); + if (this.abortController) { + this.abortController.requestCompleted = true; + } + + /** @type {TMessage} */ + const responseMessage = { + messageId: responseMessageId, + conversationId, + parentMessageId: userMessage.messageId, + isCreatedByUser: false, + isEdited, + model: this.getResponseModel(), + sender: this.sender, + promptTokens, + iconURL: this.options.iconURL, + endpoint: this.options.endpoint, + ...(this.metadata ?? {}), + metadata: Object.keys(metadata ?? {}).length > 0 ? metadata : undefined, + }; + + if (typeof completion === 'string') { + responseMessage.text = completion; + } else if ( + Array.isArray(completion) && + (this.clientName === EModelEndpoint.agents || + isParamEndpoint(this.options.endpoint, this.options.endpointType)) + ) { + responseMessage.text = ''; + + if (!opts.editedContent || this.currentMessages.length === 0) { + responseMessage.content = completion; + } else { + const latestMessage = this.currentMessages[this.currentMessages.length - 1]; + if (!latestMessage?.content) { + responseMessage.content = completion; + } else { + const existingContent = [...latestMessage.content]; + const { type: editedType } = opts.editedContent; + responseMessage.content = this.mergeEditedContent( + existingContent, + completion, + editedType, + ); + } + } + } else if (Array.isArray(completion)) { + responseMessage.text = completion.join(''); + } + + if ( + tokenCountMap && + this.recordTokenUsage && + this.getTokenCountForResponse && + this.getTokenCount + ) { + let completionTokens; + + /** + * Metadata about input/output costs for the current message. The client + * should provide a function to get the current stream usage metadata; if not, + * use the legacy token estimations. + * @type {StreamUsage | null} */ + const usage = this.getStreamUsage != null ? this.getStreamUsage() : null; + + if (usage != null && Number(usage[this.outputTokensKey]) > 0) { + responseMessage.tokenCount = usage[this.outputTokensKey]; + completionTokens = responseMessage.tokenCount; + await this.updateUserMessageTokenCount({ + usage, + tokenCountMap, + userMessage, + userMessagePromise, + opts, + }); + } else { + responseMessage.tokenCount = this.getTokenCountForResponse(responseMessage); + completionTokens = responseMessage.tokenCount; + await this.recordTokenUsage({ + usage, + promptTokens, + completionTokens, + balance: balanceConfig, + model: responseMessage.model, + }); + } + } + + if (userMessagePromise) { + await userMessagePromise; + } + + if (this.artifactPromises) { + responseMessage.attachments = (await Promise.all(this.artifactPromises)).filter((a) => a); + } + + if (this.options.attachments) { + try { + saveOptions.files = this.options.attachments.map((attachments) => attachments.file_id); + } catch (error) { + logger.error('[BaseClient] Error mapping attachments for conversation', error); + } + } + + responseMessage.databasePromise = this.saveMessageToDatabase( + responseMessage, + saveOptions, + user, + ); + this.savedMessageIds.add(responseMessage.messageId); + delete responseMessage.tokenCount; + return responseMessage; + } + + /** + * Stream usage should only be used for user message token count re-calculation if: + * - The stream usage is available, with input tokens greater than 0, + * - the client provides a function to calculate the current token count, + * - files are being resent with every message (default behavior; or if `false`, with no attachments), + * - the `promptPrefix` (custom instructions) is not set. + * + * In these cases, the legacy token estimations would be more accurate. + * + * TODO: included system messages in the `orderedMessages` accounting, potentially as a + * separate message in the UI. ChatGPT does this through "hidden" system messages. + * @param {object} params + * @param {StreamUsage} params.usage + * @param {Record} params.tokenCountMap + * @param {TMessage} params.userMessage + * @param {Promise} params.userMessagePromise + * @param {object} params.opts + */ + async updateUserMessageTokenCount({ + usage, + tokenCountMap, + userMessage, + userMessagePromise, + opts, + }) { + /** @type {boolean} */ + const shouldUpdateCount = + this.calculateCurrentTokenCount != null && + Number(usage[this.inputTokensKey]) > 0 && + (this.options.resendFiles || + (!this.options.resendFiles && !this.options.attachments?.length)) && + !this.options.promptPrefix; + + if (!shouldUpdateCount) { + return; + } + + const userMessageTokenCount = this.calculateCurrentTokenCount({ + currentMessageId: userMessage.messageId, + tokenCountMap, + usage, + }); + + if (userMessageTokenCount === userMessage.tokenCount) { + return; + } + + userMessage.tokenCount = userMessageTokenCount; + /* + Note: `AgentController` saves the user message if not saved here + (noted by `savedMessageIds`), so we update the count of its `userMessage` reference + */ + if (typeof opts?.getReqData === 'function') { + opts.getReqData({ + userMessage, + }); + } + /* + Note: we update the user message to be sure it gets the calculated token count; + though `AgentController` saves the user message if not saved here + (noted by `savedMessageIds`), EditController does not + */ + await userMessagePromise; + await this.updateMessageInDatabase({ + messageId: userMessage.messageId, + tokenCount: userMessageTokenCount, + }); + } + + async loadHistory(conversationId, parentMessageId = null) { + logger.debug('[BaseClient] Loading history:', { conversationId, parentMessageId }); + + const messages = (await getMessages({ conversationId })) ?? []; + + if (messages.length === 0) { + return []; + } + + let mapMethod = null; + if (this.getMessageMapMethod) { + mapMethod = this.getMessageMapMethod(); + } + + let _messages = this.constructor.getMessagesForConversation({ + messages, + parentMessageId, + mapMethod, + }); + + _messages = await this.addPreviousAttachments(_messages); + + if (!this.shouldSummarize) { + return _messages; + } + + // Find the latest message with a 'summary' property + for (let i = _messages.length - 1; i >= 0; i--) { + if (_messages[i]?.summary) { + this.previous_summary = _messages[i]; + break; + } + } + + if (this.previous_summary) { + const { messageId, summary, tokenCount, summaryTokenCount } = this.previous_summary; + logger.debug('[BaseClient] Previous summary:', { + messageId, + summary, + tokenCount, + summaryTokenCount, + }); + } + + return _messages; + } + + /** + * Save a message to the database. + * @param {TMessage} message + * @param {Partial} endpointOptions + * @param {string | null} user + */ + async saveMessageToDatabase(message, endpointOptions, user = null) { + if (this.user && user !== this.user) { + throw new Error('User mismatch.'); + } + + const hasAddedConvo = this.options?.req?.body?.addedConvo != null; + const savedMessage = await saveMessage( + this.options?.req, + { + ...message, + endpoint: this.options.endpoint, + unfinished: false, + user, + ...(hasAddedConvo && { addedConvo: true }), + }, + { context: 'api/app/clients/BaseClient.js - saveMessageToDatabase #saveMessage' }, + ); + + if (this.skipSaveConvo) { + return { message: savedMessage }; + } + + const fieldsToKeep = { + conversationId: message.conversationId, + endpoint: this.options.endpoint, + endpointType: this.options.endpointType, + ...endpointOptions, + }; + + const existingConvo = + this.fetchedConvo === true + ? null + : await getConvo(this.options?.req?.user?.id, message.conversationId); + + const unsetFields = {}; + const exceptions = new Set(['spec', 'iconURL']); + const hasNonEphemeralAgent = + isAgentsEndpoint(this.options.endpoint) && + endpointOptions?.agent_id && + !isEphemeralAgentId(endpointOptions.agent_id); + if (hasNonEphemeralAgent) { + exceptions.add('model'); + } + if (existingConvo != null) { + this.fetchedConvo = true; + for (const key in existingConvo) { + if (!key) { + continue; + } + if (excludedKeys.has(key) && !exceptions.has(key)) { + continue; + } + + if (endpointOptions?.[key] === undefined) { + unsetFields[key] = 1; + } + } + } + + const conversation = await saveConvo(this.options?.req, fieldsToKeep, { + context: 'api/app/clients/BaseClient.js - saveMessageToDatabase #saveConvo', + unsetFields, + }); + + return { message: savedMessage, conversation }; + } + + /** + * Update a message in the database. + * @param {Partial} message + */ + async updateMessageInDatabase(message) { + await updateMessage(this.options.req, message); + } + + /** + * Iterate through messages, building an array based on the parentMessageId. + * + * This function constructs a conversation thread by traversing messages from a given parentMessageId up to the root message. + * It handles cyclic references by ensuring that a message is not processed more than once. + * If the 'summary' option is set to true and a message has a 'summary' property: + * - The message's 'role' is set to 'system'. + * - The message's 'text' is set to its 'summary'. + * - If the message has a 'summaryTokenCount', the message's 'tokenCount' is set to 'summaryTokenCount'. + * The traversal stops at the message with the 'summary' property. + * + * Each message object should have an 'id' or 'messageId' property and may have a 'parentMessageId' property. + * The 'parentMessageId' is the ID of the message that the current message is a reply to. + * If 'parentMessageId' is not present, null, or is Constants.NO_PARENT, + * the message is considered a root message. + * + * @param {Object} options - The options for the function. + * @param {TMessage[]} options.messages - An array of message objects. Each object should have either an 'id' or 'messageId' property, and may have a 'parentMessageId' property. + * @param {string} options.parentMessageId - The ID of the parent message to start the traversal from. + * @param {Function} [options.mapMethod] - An optional function to map over the ordered messages. Applied conditionally based on mapCondition. + * @param {(message: TMessage) => boolean} [options.mapCondition] - An optional function to determine whether mapMethod should be applied to a given message. If not provided and mapMethod is set, mapMethod applies to all messages. + * @param {boolean} [options.summary=false] - If set to true, the traversal modifies messages with 'summary' and 'summaryTokenCount' properties and stops at the message with a 'summary' property. + * @returns {TMessage[]} An array containing the messages in the order they should be displayed, starting with the most recent message with a 'summary' property if the 'summary' option is true, and ending with the message identified by 'parentMessageId'. + */ + static getMessagesForConversation({ + messages, + parentMessageId, + mapMethod = null, + mapCondition = null, + summary = false, + }) { + if (!messages || messages.length === 0) { + return []; + } + + const orderedMessages = []; + let currentMessageId = parentMessageId; + const visitedMessageIds = new Set(); + + while (currentMessageId) { + if (visitedMessageIds.has(currentMessageId)) { + break; + } + const message = messages.find((msg) => { + const messageId = msg.messageId ?? msg.id; + return messageId === currentMessageId; + }); + + visitedMessageIds.add(currentMessageId); + + if (!message) { + break; + } + + if (summary && message.summary) { + message.role = 'system'; + message.text = message.summary; + } + + if (summary && message.summaryTokenCount) { + message.tokenCount = message.summaryTokenCount; + } + + const shouldMap = mapMethod != null && (mapCondition != null ? mapCondition(message) : true); + const processedMessage = shouldMap ? mapMethod(message) : message; + orderedMessages.push(processedMessage); + + if (summary && message.summary) { + break; + } + + currentMessageId = + message.parentMessageId === Constants.NO_PARENT ? null : message.parentMessageId; + } + + orderedMessages.reverse(); + return orderedMessages; + } + + /** + * Algorithm adapted from "6. Counting tokens for chat API calls" of + * https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb + * + * An additional 3 tokens need to be added for assistant label priming after all messages have been counted. + * In our implementation, this is accounted for in the getMessagesWithinTokenLimit method. + * + * The content parts example was adapted from the following example: + * https://github.com/openai/openai-cookbook/pull/881/files + * + * Note: image token calculation is to be done elsewhere where we have access to the image metadata + * + * @param {Object} message + */ + getTokenCountForMessage(message) { + // Note: gpt-3.5-turbo and gpt-4 may update over time. Use default for these as well as for unknown models + let tokensPerMessage = 3; + let tokensPerName = 1; + const model = this.modelOptions?.model ?? this.model; + + if (model === 'gpt-3.5-turbo-0301') { + tokensPerMessage = 4; + tokensPerName = -1; + } + + const processValue = (value) => { + if (Array.isArray(value)) { + for (let item of value) { + if ( + !item || + !item.type || + item.type === ContentTypes.THINK || + item.type === ContentTypes.ERROR || + item.type === ContentTypes.IMAGE_URL + ) { + continue; + } + + if (item.type === ContentTypes.TOOL_CALL && item.tool_call != null) { + const toolName = item.tool_call?.name || ''; + if (toolName != null && toolName && typeof toolName === 'string') { + numTokens += this.getTokenCount(toolName); + } + + const args = item.tool_call?.args || ''; + if (args != null && args && typeof args === 'string') { + numTokens += this.getTokenCount(args); + } + + const output = item.tool_call?.output || ''; + if (output != null && output && typeof output === 'string') { + numTokens += this.getTokenCount(output); + } + continue; + } + + const nestedValue = item[item.type]; + + if (!nestedValue) { + continue; + } + + processValue(nestedValue); + } + } else if (typeof value === 'string') { + numTokens += this.getTokenCount(value); + } else if (typeof value === 'number') { + numTokens += this.getTokenCount(value.toString()); + } else if (typeof value === 'boolean') { + numTokens += this.getTokenCount(value.toString()); + } + }; + + let numTokens = tokensPerMessage; + for (let [key, value] of Object.entries(message)) { + processValue(value); + + if (key === 'name') { + numTokens += tokensPerName; + } + } + return numTokens; + } + + /** + * Merges completion content with existing content when editing TEXT or THINK types + * @param {Array} existingContent - The existing content array + * @param {Array} newCompletion - The new completion content + * @param {string} editedType - The type of content being edited + * @returns {Array} The merged content array + */ + mergeEditedContent(existingContent, newCompletion, editedType) { + if (!newCompletion.length) { + return existingContent.concat(newCompletion); + } + + if (editedType !== ContentTypes.TEXT && editedType !== ContentTypes.THINK) { + return existingContent.concat(newCompletion); + } + + const lastIndex = existingContent.length - 1; + const lastExisting = existingContent[lastIndex]; + const firstNew = newCompletion[0]; + + if (lastExisting?.type !== firstNew?.type || firstNew?.type !== editedType) { + return existingContent.concat(newCompletion); + } + + const mergedContent = [...existingContent]; + if (editedType === ContentTypes.TEXT) { + mergedContent[lastIndex] = { + ...mergedContent[lastIndex], + [ContentTypes.TEXT]: + (mergedContent[lastIndex][ContentTypes.TEXT] || '') + (firstNew[ContentTypes.TEXT] || ''), + }; + } else { + mergedContent[lastIndex] = { + ...mergedContent[lastIndex], + [ContentTypes.THINK]: + (mergedContent[lastIndex][ContentTypes.THINK] || '') + + (firstNew[ContentTypes.THINK] || ''), + }; + } + + // Add remaining completion items + return mergedContent.concat(newCompletion.slice(1)); + } + + async sendPayload(payload, opts = {}) { + if (opts && typeof opts === 'object') { + this.setOptions(opts); + } + + return await this.sendCompletion(payload, opts); + } + + async addDocuments(message, attachments) { + const documentResult = await encodeAndFormatDocuments( + this.options.req, + attachments, + { + provider: this.options.agent?.provider ?? this.options.endpoint, + endpoint: this.options.agent?.endpoint ?? this.options.endpoint, + useResponsesApi: this.options.agent?.model_parameters?.useResponsesApi, + }, + getStrategyFunctions, + ); + message.documents = + documentResult.documents && documentResult.documents.length + ? documentResult.documents + : undefined; + return documentResult.files; + } + + async addVideos(message, attachments) { + const videoResult = await encodeAndFormatVideos( + this.options.req, + attachments, + { + provider: this.options.agent?.provider ?? this.options.endpoint, + endpoint: this.options.agent?.endpoint ?? this.options.endpoint, + }, + getStrategyFunctions, + ); + message.videos = + videoResult.videos && videoResult.videos.length ? videoResult.videos : undefined; + return videoResult.files; + } + + async addAudios(message, attachments) { + const audioResult = await encodeAndFormatAudios( + this.options.req, + attachments, + { + provider: this.options.agent?.provider ?? this.options.endpoint, + endpoint: this.options.agent?.endpoint ?? this.options.endpoint, + }, + getStrategyFunctions, + ); + message.audios = + audioResult.audios && audioResult.audios.length ? audioResult.audios : undefined; + return audioResult.files; + } + + /** + * Extracts text context from attachments and sets it on the message. + * This handles text that was already extracted from files (OCR, transcriptions, document text, etc.) + * @param {TMessage} message - The message to add context to + * @param {MongoFile[]} attachments - Array of file attachments + * @returns {Promise} + */ + async addFileContextToMessage(message, attachments) { + const fileContext = await extractFileContext({ + attachments, + req: this.options?.req, + tokenCountFn: (text) => countTokens(text), + }); + + if (fileContext) { + message.fileContext = fileContext; + } + } + + async processAttachments(message, attachments) { + const categorizedAttachments = { + images: [], + videos: [], + audios: [], + documents: [], + }; + + const allFiles = []; + + for (const file of attachments) { + /** @type {FileSources} */ + const source = file.source ?? FileSources.local; + if (source === FileSources.text) { + allFiles.push(file); + continue; + } + if (file.embedded === true || file.metadata?.fileIdentifier != null) { + allFiles.push(file); + continue; + } + + if (file.type.startsWith('image/')) { + categorizedAttachments.images.push(file); + } else if (file.type === 'application/pdf') { + categorizedAttachments.documents.push(file); + allFiles.push(file); + } else if (file.type.startsWith('video/')) { + categorizedAttachments.videos.push(file); + allFiles.push(file); + } else if (file.type.startsWith('audio/')) { + categorizedAttachments.audios.push(file); + allFiles.push(file); + } + } + + const [imageFiles] = await Promise.all([ + categorizedAttachments.images.length > 0 + ? this.addImageURLs(message, categorizedAttachments.images) + : Promise.resolve([]), + categorizedAttachments.documents.length > 0 + ? this.addDocuments(message, categorizedAttachments.documents) + : Promise.resolve([]), + categorizedAttachments.videos.length > 0 + ? this.addVideos(message, categorizedAttachments.videos) + : Promise.resolve([]), + categorizedAttachments.audios.length > 0 + ? this.addAudios(message, categorizedAttachments.audios) + : Promise.resolve([]), + ]); + + allFiles.push(...imageFiles); + + const seenFileIds = new Set(); + const uniqueFiles = []; + + for (const file of allFiles) { + if (file.file_id && !seenFileIds.has(file.file_id)) { + seenFileIds.add(file.file_id); + uniqueFiles.push(file); + } else if (!file.file_id) { + uniqueFiles.push(file); + } + } + + return uniqueFiles; + } + + /** + * @param {TMessage[]} _messages + * @returns {Promise} + */ + async addPreviousAttachments(_messages) { + if (!this.options.resendFiles) { + return _messages; + } + + const seen = new Set(); + const attachmentsProcessed = + this.options.attachments && !(this.options.attachments instanceof Promise); + if (attachmentsProcessed) { + for (const attachment of this.options.attachments) { + seen.add(attachment.file_id); + } + } + + /** + * + * @param {TMessage} message + */ + const processMessage = async (message) => { + if (!this.message_file_map) { + /** @type {Record */ + this.message_file_map = {}; + } + + const fileIds = []; + for (const file of message.files) { + if (seen.has(file.file_id)) { + continue; + } + fileIds.push(file.file_id); + seen.add(file.file_id); + } + + if (fileIds.length === 0) { + return message; + } + + const files = await getFiles( + { + file_id: { $in: fileIds }, + }, + {}, + {}, + ); + + await this.addFileContextToMessage(message, files); + await this.processAttachments(message, files); + + this.message_file_map[message.messageId] = files; + return message; + }; + + const promises = []; + + for (const message of _messages) { + if (!message.files) { + promises.push(message); + continue; + } + + promises.push(processMessage(message)); + } + + const messages = await Promise.all(promises); + + this.checkVisionRequest(Object.values(this.message_file_map ?? {}).flat()); + return messages; + } +} + +module.exports = BaseClient; diff --git a/api/app/clients/OllamaClient.js b/api/app/clients/OllamaClient.js new file mode 100644 index 0000000..d0dda51 --- /dev/null +++ b/api/app/clients/OllamaClient.js @@ -0,0 +1,167 @@ +const { z } = require('zod'); +const axios = require('axios'); +const { Ollama } = require('ollama'); +const { sleep } = require('@librechat/agents'); +const { logger } = require('@librechat/data-schemas'); +const { Constants } = require('librechat-data-provider'); +const { resolveHeaders, deriveBaseURL } = require('@librechat/api'); + +const ollamaPayloadSchema = z.object({ + mirostat: z.number().optional(), + mirostat_eta: z.number().optional(), + mirostat_tau: z.number().optional(), + num_ctx: z.number().optional(), + repeat_last_n: z.number().optional(), + repeat_penalty: z.number().optional(), + temperature: z.number().optional(), + seed: z.number().nullable().optional(), + stop: z.array(z.string()).optional(), + tfs_z: z.number().optional(), + num_predict: z.number().optional(), + top_k: z.number().optional(), + top_p: z.number().optional(), + stream: z.optional(z.boolean()), + model: z.string(), +}); + +/** + * @param {string} imageUrl + * @returns {string} + * @throws {Error} + */ +const getValidBase64 = (imageUrl) => { + const parts = imageUrl.split(';base64,'); + + if (parts.length === 2) { + return parts[1]; + } else { + logger.error('Invalid or no Base64 string found in URL.'); + } +}; + +class OllamaClient { + constructor(options = {}) { + const host = deriveBaseURL(options.baseURL ?? 'http://localhost:11434'); + this.streamRate = options.streamRate ?? Constants.DEFAULT_STREAM_RATE; + this.headers = options.headers ?? {}; + /** @type {Ollama} */ + this.client = new Ollama({ host }); + } + + /** + * Fetches Ollama models from the specified base API path. + * @param {string} baseURL + * @param {Object} [options] - Optional configuration + * @param {Partial} [options.user] - User object for header resolution + * @param {Record} [options.headers] - Headers to include in the request + * @returns {Promise} The Ollama models. + * @throws {Error} Throws if the Ollama API request fails + */ + static async fetchModels(baseURL, options = {}) { + if (!baseURL) { + return []; + } + + const ollamaEndpoint = deriveBaseURL(baseURL); + + const resolvedHeaders = resolveHeaders({ + headers: options.headers, + user: options.user, + }); + + /** @type {Promise>} */ + const response = await axios.get(`${ollamaEndpoint}/api/tags`, { + headers: resolvedHeaders, + timeout: 5000, + }); + + const models = response.data.models.map((tag) => tag.name); + return models; + } + + /** + * @param {ChatCompletionMessage[]} messages + * @returns {OllamaMessage[]} + */ + static formatOpenAIMessages(messages) { + const ollamaMessages = []; + + for (const message of messages) { + if (typeof message.content === 'string') { + ollamaMessages.push({ + role: message.role, + content: message.content, + }); + continue; + } + + let aggregatedText = ''; + let imageUrls = []; + + for (const content of message.content) { + if (content.type === 'text') { + aggregatedText += content.text + ' '; + } else if (content.type === 'image_url') { + imageUrls.push(getValidBase64(content.image_url.url)); + } + } + + const ollamaMessage = { + role: message.role, + content: aggregatedText.trim(), + }; + + if (imageUrls.length > 0) { + ollamaMessage.images = imageUrls; + } + + ollamaMessages.push(ollamaMessage); + } + + return ollamaMessages; + } + + /*** + * @param {Object} params + * @param {ChatCompletionPayload} params.payload + * @param {onTokenProgress} params.onProgress + * @param {AbortController} params.abortController + */ + async chatCompletion({ payload, onProgress, abortController = null }) { + let intermediateReply = ''; + + const parameters = ollamaPayloadSchema.parse(payload); + const messages = OllamaClient.formatOpenAIMessages(payload.messages); + + if (parameters.stream) { + const stream = await this.client.chat({ + messages, + ...parameters, + }); + + for await (const chunk of stream) { + const token = chunk.message.content; + intermediateReply += token; + onProgress(token); + if (abortController.signal.aborted) { + stream.controller.abort(); + break; + } + + await sleep(this.streamRate); + } + } + // TODO: regular completion + else { + // const generation = await this.client.generate(payload); + } + + return intermediateReply; + } + catch(err) { + logger.error('[OllamaClient.chatCompletion]', err); + throw err; + } +} + +module.exports = { OllamaClient, ollamaPayloadSchema }; diff --git a/api/app/clients/TextStream.js b/api/app/clients/TextStream.js new file mode 100644 index 0000000..ea3d898 --- /dev/null +++ b/api/app/clients/TextStream.js @@ -0,0 +1,60 @@ +const { Readable } = require('stream'); +const { logger } = require('@librechat/data-schemas'); + +class TextStream extends Readable { + constructor(text, options = {}) { + super(options); + this.text = text; + this.currentIndex = 0; + this.minChunkSize = options.minChunkSize ?? 2; + this.maxChunkSize = options.maxChunkSize ?? 4; + this.delay = options.delay ?? 20; // Time in milliseconds + } + + _read() { + const { delay, minChunkSize, maxChunkSize } = this; + + if (this.currentIndex < this.text.length) { + setTimeout(() => { + const remainingChars = this.text.length - this.currentIndex; + const chunkSize = Math.min(this.randomInt(minChunkSize, maxChunkSize + 1), remainingChars); + + const chunk = this.text.slice(this.currentIndex, this.currentIndex + chunkSize); + this.push(chunk); + this.currentIndex += chunkSize; + }, delay); + } else { + this.push(null); // signal end of data + } + } + + randomInt(min, max) { + return Math.floor(Math.random() * (max - min)) + min; + } + + async processTextStream(onProgressCallback) { + const streamPromise = new Promise((resolve, reject) => { + this.on('data', (chunk) => { + onProgressCallback(chunk.toString()); + }); + + this.on('end', () => { + // logger.debug('[processTextStream] Stream ended'); + resolve(); + }); + + this.on('error', (err) => { + reject(err); + }); + }); + + try { + await streamPromise; + } catch (err) { + logger.error('[processTextStream] Error in text stream:', err); + // Handle the error appropriately, e.g., return an error message or throw an error + } + } +} + +module.exports = TextStream; diff --git a/api/app/clients/index.js b/api/app/clients/index.js new file mode 100644 index 0000000..3dbe397 --- /dev/null +++ b/api/app/clients/index.js @@ -0,0 +1,7 @@ +const TextStream = require('./TextStream'); +const toolUtils = require('./tools/util'); + +module.exports = { + TextStream, + ...toolUtils, +}; diff --git a/api/app/clients/prompts/artifacts.js b/api/app/clients/prompts/artifacts.js new file mode 100644 index 0000000..915ccae --- /dev/null +++ b/api/app/clients/prompts/artifacts.js @@ -0,0 +1,537 @@ +const dedent = require('dedent'); +const { EModelEndpoint, ArtifactModes } = require('librechat-data-provider'); +const { generateShadcnPrompt } = require('~/app/clients/prompts/shadcn-docs/generate'); +const { components } = require('~/app/clients/prompts/shadcn-docs/components'); + +/** @deprecated */ +// eslint-disable-next-line no-unused-vars +const artifactsPromptV1 = dedent`The assistant can create and reference artifacts during conversations. + +Artifacts are for substantial, self-contained content that users might modify or reuse, displayed in a separate UI window for clarity. + +# Good artifacts are... +- Substantial content (>15 lines) +- Content that the user is likely to modify, iterate on, or take ownership of +- Self-contained, complex content that can be understood on its own, without context from the conversation +- Content intended for eventual use outside the conversation (e.g., reports, emails, presentations) +- Content likely to be referenced or reused multiple times + +# Don't use artifacts for... +- Simple, informational, or short content, such as brief code snippets, mathematical equations, or small examples +- Primarily explanatory, instructional, or illustrative content, such as examples provided to clarify a concept +- Suggestions, commentary, or feedback on existing artifacts +- Conversational or explanatory content that doesn't represent a standalone piece of work +- Content that is dependent on the current conversational context to be useful +- Content that is unlikely to be modified or iterated upon by the user +- Request from users that appears to be a one-off question + +# Usage notes +- One artifact per message unless specifically requested +- Prefer in-line content (don't use artifacts) when possible. Unnecessary use of artifacts can be jarring for users. +- If a user asks the assistant to "draw an SVG" or "make a website," the assistant does not need to explain that it doesn't have these capabilities. Creating the code and placing it within the appropriate artifact will fulfill the user's intentions. +- If asked to generate an image, the assistant can offer an SVG instead. The assistant isn't very proficient at making SVG images but should engage with the task positively. Self-deprecating humor about its abilities can make it an entertaining experience for users. +- The assistant errs on the side of simplicity and avoids overusing artifacts for content that can be effectively presented within the conversation. +- Always provide complete, specific, and fully functional content without any placeholders, ellipses, or 'remains the same' comments. + + + When collaborating with the user on creating content that falls into compatible categories, the assistant should follow these steps: + + 1. Create the artifact using the following format: + + :::artifact{identifier="unique-identifier" type="mime-type" title="Artifact Title"} + \`\`\` + Your artifact content here + \`\`\` + ::: + + 2. Assign an identifier to the \`identifier\` attribute. For updates, reuse the prior identifier. For new artifacts, the identifier should be descriptive and relevant to the content, using kebab-case (e.g., "example-code-snippet"). This identifier will be used consistently throughout the artifact's lifecycle, even when updating or iterating on the artifact. + 3. Include a \`title\` attribute to provide a brief title or description of the content. + 4. Add a \`type\` attribute to specify the type of content the artifact represents. Assign one of the following values to the \`type\` attribute: + - HTML: "text/html" + - The user interface can render single file HTML pages placed within the artifact tags. HTML, JS, and CSS should be in a single file when using the \`text/html\` type. + - Images from the web are not allowed, but you can use placeholder images by specifying the width and height like so \`placeholder\` + - The only place external scripts can be imported from is https://cdnjs.cloudflare.com + - Mermaid Diagrams: "application/vnd.mermaid" + - The user interface will render Mermaid diagrams placed within the artifact tags. + - React Components: "application/vnd.react" + - Use this for displaying either: React elements, e.g. \`Hello World!\`, React pure functional components, e.g. \`() => Hello World!\`, React functional components with Hooks, or React component classes + - When creating a React component, ensure it has no required props (or provide default values for all props) and use a default export. + - Use Tailwind classes for styling. DO NOT USE ARBITRARY VALUES (e.g. \`h-[600px]\`). + - Base React is available to be imported. To use hooks, first import it at the top of the artifact, e.g. \`import { useState } from "react"\` + - The lucide-react@0.263.1 library is available to be imported. e.g. \`import { Camera } from "lucide-react"\` & \`\` + - The recharts charting library is available to be imported, e.g. \`import { LineChart, XAxis, ... } from "recharts"\` & \` ...\` + - The assistant can use prebuilt components from the \`shadcn/ui\` library after it is imported: \`import { Alert, AlertDescription, AlertTitle, AlertDialog, AlertDialogAction } from '/components/ui/alert';\`. If using components from the shadcn/ui library, the assistant mentions this to the user and offers to help them install the components if necessary. + - Components MUST be imported from \`/components/ui/name\` and NOT from \`/components/name\` or \`@/components/ui/name\`. + - NO OTHER LIBRARIES (e.g. zod, hookform) ARE INSTALLED OR ABLE TO BE IMPORTED. + - Images from the web are not allowed, but you can use placeholder images by specifying the width and height like so \`placeholder\` + - If you are unable to follow the above requirements for any reason, don't use artifacts and use regular code blocks instead, which will not attempt to render the component. + 5. Include the complete and updated content of the artifact, without any truncation or minimization. Don't use "// rest of the code remains the same...". + 6. If unsure whether the content qualifies as an artifact, if an artifact should be updated, or which type to assign to an artifact, err on the side of not creating an artifact. + 7. Always use triple backticks (\`\`\`) to enclose the content within the artifact, regardless of the content type. + + +Here are some examples of correct usage of artifacts: + + + + This example demonstrates how to create a Mermaid artifact for a simple flow chart. + + + + Can you create a simple flow chart showing the process of making tea using Mermaid? + + + Sure! Here's a simple flow chart depicting the process of making tea using Mermaid syntax: + + :::artifact{identifier="tea-making-flowchart" type="application/vnd.mermaid" title="Flow chart: Making Tea"} + \`\`\`mermaid + graph TD + A[Start] --> B{Water boiled?} + B -->|Yes| C[Add tea leaves to cup] + B -->|No| D[Boil water] + D --> B + C --> E[Pour boiling water into cup] + E --> F[Steep tea for desired time] + F --> G[Remove tea leaves] + G --> H[Add milk or sugar, if desired] + H --> I[Enjoy your tea!] + I --> J[End] + \`\`\` + ::: + + This flow chart uses Mermaid syntax to visualize the steps involved in making a cup of tea. Here's a brief explanation of the process: + + 1. Start + 2. Check if water is boiled + 3. If not boiled, boil the water + 4. Once water is boiled, add tea leaves to the cup + 5. Pour boiling water into the cup + 6. Steep the tea for the desired time + 7. Remove the tea leaves + 8. Optionally add milk or sugar + 9. Enjoy your tea! + 10. End + + This chart provides a clear visual representation of the tea-making process. You can easily modify or expand this chart if you want to add more details or steps to the process. Let me know if you'd like any changes or have any questions! + + +`; + +const artifactsPrompt = dedent`The assistant can create and reference artifacts during conversations. + +Artifacts are for substantial, self-contained content that users might modify or reuse, displayed in a separate UI window for clarity. + +# Good artifacts are... +- Substantial content (>15 lines) +- Content that the user is likely to modify, iterate on, or take ownership of +- Self-contained, complex content that can be understood on its own, without context from the conversation +- Content intended for eventual use outside the conversation (e.g., reports, emails, presentations) +- Content likely to be referenced or reused multiple times + +# Don't use artifacts for... +- Simple, informational, or short content, such as brief code snippets, mathematical equations, or small examples +- Primarily explanatory, instructional, or illustrative content, such as examples provided to clarify a concept +- Suggestions, commentary, or feedback on existing artifacts +- Conversational or explanatory content that doesn't represent a standalone piece of work +- Content that is dependent on the current conversational context to be useful +- Content that is unlikely to be modified or iterated upon by the user +- Request from users that appears to be a one-off question + +# Usage notes +- One artifact per message unless specifically requested +- Prefer in-line content (don't use artifacts) when possible. Unnecessary use of artifacts can be jarring for users. +- If a user asks the assistant to "draw an SVG" or "make a website," the assistant does not need to explain that it doesn't have these capabilities. Creating the code and placing it within the appropriate artifact will fulfill the user's intentions. +- If asked to generate an image, the assistant can offer an SVG instead. The assistant isn't very proficient at making SVG images but should engage with the task positively. Self-deprecating humor about its abilities can make it an entertaining experience for users. +- The assistant errs on the side of simplicity and avoids overusing artifacts for content that can be effectively presented within the conversation. +- Always provide complete, specific, and fully functional content for artifacts without any snippets, placeholders, ellipses, or 'remains the same' comments. +- If an artifact is not necessary or requested, the assistant should not mention artifacts at all, and respond to the user accordingly. + + + When collaborating with the user on creating content that falls into compatible categories, the assistant should follow these steps: + + 1. Create the artifact using the following format: + + :::artifact{identifier="unique-identifier" type="mime-type" title="Artifact Title"} + \`\`\` + Your artifact content here + \`\`\` + ::: + + 2. Assign an identifier to the \`identifier\` attribute. For updates, reuse the prior identifier. For new artifacts, the identifier should be descriptive and relevant to the content, using kebab-case (e.g., "example-code-snippet"). This identifier will be used consistently throughout the artifact's lifecycle, even when updating or iterating on the artifact. + 3. Include a \`title\` attribute to provide a brief title or description of the content. + 4. Add a \`type\` attribute to specify the type of content the artifact represents. Assign one of the following values to the \`type\` attribute: + - HTML: "text/html" + - The user interface can render single file HTML pages placed within the artifact tags. HTML, JS, and CSS should be in a single file when using the \`text/html\` type. + - Images from the web are not allowed, but you can use placeholder images by specifying the width and height like so \`placeholder\` + - The only place external scripts can be imported from is https://cdnjs.cloudflare.com + - SVG: "image/svg+xml" + - The user interface will render the Scalable Vector Graphics (SVG) image within the artifact tags. + - The assistant should specify the viewbox of the SVG rather than defining a width/height + - Markdown: "text/markdown" or "text/md" + - The user interface will render Markdown content placed within the artifact tags. + - Supports standard Markdown syntax including headers, lists, links, images, code blocks, tables, and more. + - Both "text/markdown" and "text/md" are accepted as valid MIME types for Markdown content. + - Mermaid Diagrams: "application/vnd.mermaid" + - The user interface will render Mermaid diagrams placed within the artifact tags. + - React Components: "application/vnd.react" + - Use this for displaying either: React elements, e.g. \`Hello World!\`, React pure functional components, e.g. \`() => Hello World!\`, React functional components with Hooks, or React component classes + - When creating a React component, ensure it has no required props (or provide default values for all props) and use a default export. + - Use Tailwind classes for styling. DO NOT USE ARBITRARY VALUES (e.g. \`h-[600px]\`). + - Base React is available to be imported. To use hooks, first import it at the top of the artifact, e.g. \`import { useState } from "react"\` + - The lucide-react@0.394.0 library is available to be imported. e.g. \`import { Camera } from "lucide-react"\` & \`\` + - The recharts charting library is available to be imported, e.g. \`import { LineChart, XAxis, ... } from "recharts"\` & \` ...\` + - The three.js library is available to be imported, e.g. \`import * as THREE from "three";\` + - The date-fns library is available to be imported, e.g. \`import { compareAsc, format } from "date-fns";\` + - The react-day-picker library is available to be imported, e.g. \`import { DayPicker } from "react-day-picker";\` + - The assistant can use prebuilt components from the \`shadcn/ui\` library after it is imported: \`import { Alert, AlertDescription, AlertTitle, AlertDialog, AlertDialogAction } from '/components/ui/alert';\`. If using components from the shadcn/ui library, the assistant mentions this to the user and offers to help them install the components if necessary. + - Components MUST be imported from \`/components/ui/name\` and NOT from \`/components/name\` or \`@/components/ui/name\`. + - NO OTHER LIBRARIES (e.g. zod, hookform) ARE INSTALLED OR ABLE TO BE IMPORTED. + - Images from the web are not allowed, but you can use placeholder images by specifying the width and height like so \`placeholder\` + - When iterating on code, ensure that the code is complete and functional without any snippets, placeholders, or ellipses. + - If you are unable to follow the above requirements for any reason, don't use artifacts and use regular code blocks instead, which will not attempt to render the component. + 5. Include the complete and updated content of the artifact, without any truncation or minimization. Don't use "// rest of the code remains the same...". + 6. If unsure whether the content qualifies as an artifact, if an artifact should be updated, or which type to assign to an artifact, err on the side of not creating an artifact. + 7. Always use triple backticks (\`\`\`) to enclose the content within the artifact, regardless of the content type. + + +Here are some examples of correct usage of artifacts: + + + + This example demonstrates how to create a Mermaid artifact for a simple flow chart. + + + + Can you create a simple flow chart showing the process of making tea using Mermaid? + + + Sure! Here's a simple flow chart depicting the process of making tea using Mermaid syntax: + + :::artifact{identifier="tea-making-flowchart" type="application/vnd.mermaid" title="Flow chart: Making Tea"} + \`\`\`mermaid + graph TD + A[Start] --> B{Water boiled?} + B -->|Yes| C[Add tea leaves to cup] + B -->|No| D[Boil water] + D --> B + C --> E[Pour boiling water into cup] + E --> F[Steep tea for desired time] + F --> G[Remove tea leaves] + G --> H[Add milk or sugar, if desired] + H --> I[Enjoy your tea!] + I --> J[End] + \`\`\` + ::: + + This flow chart uses Mermaid syntax to visualize the steps involved in making a cup of tea. Here's a brief explanation of the process: + + 1. Start + 2. Check if water is boiled + 3. If not boiled, boil the water + 4. Once water is boiled, add tea leaves to the cup + 5. Pour boiling water into the cup + 6. Steep the tea for the desired time + 7. Remove the tea leaves + 8. Optionally add milk or sugar + 9. Enjoy your tea! + 10. End + + This chart provides a clear visual representation of the tea-making process. You can easily modify or expand this chart if you want to add more details or steps to the process. Let me know if you'd like any changes or have any questions! + + + + + Create a simple React counter component + + Here's a simple React counter component: + + :::artifact{identifier="react-counter" type="application/vnd.react" title="React Counter"} + \`\`\` + import { useState } from 'react'; + + export default function Counter() { + const [count, setCount] = useState(0); + return ( +
+

Count: {count}

+ +
+ ); + } + \`\`\` + ::: + + This component creates a simple counter with an increment button. +
+
+ + + Create a basic HTML structure for a blog post + + Here's a basic HTML structure for a blog post: + + :::artifact{identifier="blog-post-html" type="text/html" title="Blog Post HTML"} + \`\`\` + + + + + + My Blog Post + + + +
+

My First Blog Post

+
+
+
+

This is the content of my blog post. It's short and sweet!

+
+
+
+

© 2023 My Blog

+
+ + + \`\`\` + ::: + + This HTML structure provides a simple layout for a blog post. +
+
+
`; + +const artifactsOpenAIPrompt = dedent`The assistant can create and reference artifacts during conversations. + +Artifacts are for substantial, self-contained content that users might modify or reuse, displayed in a separate UI window for clarity. + +# Good artifacts are... +- Substantial content (>15 lines) +- Content that the user is likely to modify, iterate on, or take ownership of +- Self-contained, complex content that can be understood on its own, without context from the conversation +- Content intended for eventual use outside the conversation (e.g., reports, emails, presentations) +- Content likely to be referenced or reused multiple times + +# Don't use artifacts for... +- Simple, informational, or short content, such as brief code snippets, mathematical equations, or small examples +- Primarily explanatory, instructional, or illustrative content, such as examples provided to clarify a concept +- Suggestions, commentary, or feedback on existing artifacts +- Conversational or explanatory content that doesn't represent a standalone piece of work +- Content that is dependent on the current conversational context to be useful +- Content that is unlikely to be modified or iterated upon by the user +- Request from users that appears to be a one-off question + +# Usage notes +- One artifact per message unless specifically requested +- Prefer in-line content (don't use artifacts) when possible. Unnecessary use of artifacts can be jarring for users. +- If a user asks the assistant to "draw an SVG" or "make a website," the assistant does not need to explain that it doesn't have these capabilities. Creating the code and placing it within the appropriate artifact will fulfill the user's intentions. +- If asked to generate an image, the assistant can offer an SVG instead. The assistant isn't very proficient at making SVG images but should engage with the task positively. Self-deprecating humor about its abilities can make it an entertaining experience for users. +- The assistant errs on the side of simplicity and avoids overusing artifacts for content that can be effectively presented within the conversation. +- Always provide complete, specific, and fully functional content for artifacts without any snippets, placeholders, ellipses, or 'remains the same' comments. +- If an artifact is not necessary or requested, the assistant should not mention artifacts at all, and respond to the user accordingly. + +## Artifact Instructions + When collaborating with the user on creating content that falls into compatible categories, the assistant should follow these steps: + + 1. Create the artifact using the following remark-directive markdown format: + + :::artifact{identifier="unique-identifier" type="mime-type" title="Artifact Title"} + \`\`\` + Your artifact content here + \`\`\` + ::: + + a. Example of correct format: + + :::artifact{identifier="example-artifact" type="text/plain" title="Example Artifact"} + \`\`\` + This is the content of the artifact. + It can span multiple lines. + \`\`\` + ::: + + b. Common mistakes to avoid: + - Don't split the opening ::: line + - Don't add extra backticks outside the artifact structure + - Don't omit the closing ::: + + 2. Assign an identifier to the \`identifier\` attribute. For updates, reuse the prior identifier. For new artifacts, the identifier should be descriptive and relevant to the content, using kebab-case (e.g., "example-code-snippet"). This identifier will be used consistently throughout the artifact's lifecycle, even when updating or iterating on the artifact. + 3. Include a \`title\` attribute to provide a brief title or description of the content. + 4. Add a \`type\` attribute to specify the type of content the artifact represents. Assign one of the following values to the \`type\` attribute: + - HTML: "text/html" + - The user interface can render single file HTML pages placed within the artifact tags. HTML, JS, and CSS should be in a single file when using the \`text/html\` type. + - Images from the web are not allowed, but you can use placeholder images by specifying the width and height like so \`placeholder\` + - The only place external scripts can be imported from is https://cdnjs.cloudflare.com + - SVG: "image/svg+xml" + - The user interface will render the Scalable Vector Graphics (SVG) image within the artifact tags. + - The assistant should specify the viewbox of the SVG rather than defining a width/height + - Markdown: "text/markdown" or "text/md" + - The user interface will render Markdown content placed within the artifact tags. + - Supports standard Markdown syntax including headers, lists, links, images, code blocks, tables, and more. + - Both "text/markdown" and "text/md" are accepted as valid MIME types for Markdown content. + - Mermaid Diagrams: "application/vnd.mermaid" + - The user interface will render Mermaid diagrams placed within the artifact tags. + - React Components: "application/vnd.react" + - Use this for displaying either: React elements, e.g. \`Hello World!\`, React pure functional components, e.g. \`() => Hello World!\`, React functional components with Hooks, or React component classes + - When creating a React component, ensure it has no required props (or provide default values for all props) and use a default export. + - Use Tailwind classes for styling. DO NOT USE ARBITRARY VALUES (e.g. \`h-[600px]\`). + - Base React is available to be imported. To use hooks, first import it at the top of the artifact, e.g. \`import { useState } from "react"\` + - The lucide-react@0.394.0 library is available to be imported. e.g. \`import { Camera } from "lucide-react"\` & \`\` + - The recharts charting library is available to be imported, e.g. \`import { LineChart, XAxis, ... } from "recharts"\` & \` ...\` + - The three.js library is available to be imported, e.g. \`import * as THREE from "three";\` + - The date-fns library is available to be imported, e.g. \`import { compareAsc, format } from "date-fns";\` + - The react-day-picker library is available to be imported, e.g. \`import { DayPicker } from "react-day-picker";\` + - The assistant can use prebuilt components from the \`shadcn/ui\` library after it is imported: \`import { Alert, AlertDescription, AlertTitle, AlertDialog, AlertDialogAction } from '/components/ui/alert';\`. If using components from the shadcn/ui library, the assistant mentions this to the user and offers to help them install the components if necessary. + - Components MUST be imported from \`/components/ui/name\` and NOT from \`/components/name\` or \`@/components/ui/name\`. + - NO OTHER LIBRARIES (e.g. zod, hookform) ARE INSTALLED OR ABLE TO BE IMPORTED. + - Images from the web are not allowed, but you can use placeholder images by specifying the width and height like so \`placeholder\` + - When iterating on code, ensure that the code is complete and functional without any snippets, placeholders, or ellipses. + - If you are unable to follow the above requirements for any reason, don't use artifacts and use regular code blocks instead, which will not attempt to render the component. + 5. Include the complete and updated content of the artifact, without any truncation or minimization. Don't use "// rest of the code remains the same...". + 6. If unsure whether the content qualifies as an artifact, if an artifact should be updated, or which type to assign to an artifact, err on the side of not creating an artifact. + 7. NEVER use triple backticks to enclose the artifact, ONLY the content within the artifact. + +Here are some examples of correct usage of artifacts: + +## Examples + +### Example 1 + + This example demonstrates how to create a Mermaid artifact for a simple flow chart. + + User: Can you create a simple flow chart showing the process of making tea using Mermaid? + + Assistant: Sure! Here's a simple flow chart depicting the process of making tea using Mermaid syntax: + + :::artifact{identifier="tea-making-flowchart" type="application/vnd.mermaid" title="Flow chart: Making Tea"} + \`\`\`mermaid + graph TD + A[Start] --> B{Water boiled?} + B -->|Yes| C[Add tea leaves to cup] + B -->|No| D[Boil water] + D --> B + C --> E[Pour boiling water into cup] + E --> F[Steep tea for desired time] + F --> G[Remove tea leaves] + G --> H[Add milk or sugar, if desired] + H --> I[Enjoy your tea!] + I --> J[End] + \`\`\` + ::: + + This flow chart uses Mermaid syntax to visualize the steps involved in making a cup of tea. Here's a brief explanation of the process: + + 1. Start + 2. Check if water is boiled + 3. If not boiled, boil the water + 4. Once water is boiled, add tea leaves to the cup + 5. Pour boiling water into the cup + 6. Steep the tea for the desired time + 7. Remove the tea leaves + 8. Optionally add milk or sugar + 9. Enjoy your tea! + 10. End + + This chart provides a clear visual representation of the tea-making process. You can easily modify or expand this chart if you want to add more details or steps to the process. Let me know if you'd like any changes or have any questions! + +--- + +### Example 2 + + User: Create a simple React counter component + + Assistant: Here's a simple React counter component: + + :::artifact{identifier="react-counter" type="application/vnd.react" title="React Counter"} + \`\`\` + import { useState } from 'react'; + + export default function Counter() { + const [count, setCount] = useState(0); + return ( +
+

Count: {count}

+ +
+ ); + } + \`\`\` + ::: + + This component creates a simple counter with an increment button. + +--- + +### Example 3 + User: Create a basic HTML structure for a blog post + Assistant: Here's a basic HTML structure for a blog post: + + :::artifact{identifier="blog-post-html" type="text/html" title="Blog Post HTML"} + \`\`\` + + + + + + My Blog Post + + + +
+

My First Blog Post

+
+
+
+

This is the content of my blog post. It's short and sweet!

+
+
+
+

© 2023 My Blog

+
+ + + \`\`\` + ::: + + This HTML structure provides a simple layout for a blog post. + +---`; + +/** + * + * @param {Object} params + * @param {EModelEndpoint | string} params.endpoint - The current endpoint + * @param {ArtifactModes} params.artifacts - The current artifact mode + * @returns + */ +const generateArtifactsPrompt = ({ endpoint, artifacts }) => { + if (artifacts === ArtifactModes.CUSTOM) { + return null; + } + + let prompt = artifactsPrompt; + if (endpoint !== EModelEndpoint.anthropic) { + prompt = artifactsOpenAIPrompt; + } + + if (artifacts === ArtifactModes.SHADCNUI) { + prompt += generateShadcnPrompt({ components, useXML: endpoint === EModelEndpoint.anthropic }); + } + + return prompt; +}; + +module.exports = generateArtifactsPrompt; diff --git a/api/app/clients/prompts/createContextHandlers.js b/api/app/clients/prompts/createContextHandlers.js new file mode 100644 index 0000000..87c48bc --- /dev/null +++ b/api/app/clients/prompts/createContextHandlers.js @@ -0,0 +1,160 @@ +const axios = require('axios'); +const { logger } = require('@librechat/data-schemas'); +const { isEnabled, generateShortLivedToken } = require('@librechat/api'); + +const footer = `Use the context as your learned knowledge to better answer the user. + +In your response, remember to follow these guidelines: +- If you don't know the answer, simply say that you don't know. +- If you are unsure how to answer, ask for clarification. +- Avoid mentioning that you obtained the information from the context. +`; + +function createContextHandlers(req, userMessageContent) { + if (!process.env.RAG_API_URL) { + return; + } + + const queryPromises = []; + const processedFiles = []; + const processedIds = new Set(); + const jwtToken = generateShortLivedToken(req.user.id); + const useFullContext = isEnabled(process.env.RAG_USE_FULL_CONTEXT); + + const query = async (file) => { + if (useFullContext) { + return axios.get(`${process.env.RAG_API_URL}/documents/${file.file_id}/context`, { + headers: { + Authorization: `Bearer ${jwtToken}`, + }, + }); + } + + return axios.post( + `${process.env.RAG_API_URL}/query`, + { + file_id: file.file_id, + query: userMessageContent, + k: 4, + }, + { + headers: { + Authorization: `Bearer ${jwtToken}`, + 'Content-Type': 'application/json', + }, + }, + ); + }; + + const processFile = async (file) => { + if (file.embedded && !processedIds.has(file.file_id)) { + try { + const promise = query(file); + queryPromises.push(promise); + processedFiles.push(file); + processedIds.add(file.file_id); + } catch (error) { + logger.error(`Error processing file ${file.filename}:`, error); + } + } + }; + + const createContext = async () => { + try { + if (!queryPromises.length || !processedFiles.length) { + return ''; + } + + const oneFile = processedFiles.length === 1; + const header = `The user has attached ${oneFile ? 'a' : processedFiles.length} file${ + !oneFile ? 's' : '' + } to the conversation:`; + + const files = `${ + oneFile + ? '' + : ` + ` + }${processedFiles + .map( + (file) => ` + + ${file.filename} + ${file.type} + `, + ) + .join('')}${ + oneFile + ? '' + : ` + ` + }`; + + const resolvedQueries = await Promise.all(queryPromises); + + const context = + resolvedQueries.length === 0 + ? '\n\tThe semantic search did not return any results.' + : resolvedQueries + .map((queryResult, index) => { + const file = processedFiles[index]; + let contextItems = queryResult.data; + + const generateContext = (currentContext) => + ` + + ${file.filename} + ${currentContext} + + `; + + if (useFullContext) { + return generateContext(`\n${contextItems}`); + } + + contextItems = queryResult.data + .map((item) => { + const pageContent = item[0].page_content; + return ` + + + `; + }) + .join(''); + + return generateContext(contextItems); + }) + .join(''); + + if (useFullContext) { + const prompt = `${header} + ${context} + ${footer}`; + + return prompt; + } + + const prompt = `${header} + ${files} + + A semantic search was executed with the user's message as the query, retrieving the following context inside XML tags. + + ${context} + + + ${footer}`; + + return prompt; + } catch (error) { + logger.error('Error creating context:', error); + throw error; + } + }; + + return { + processFile, + createContext, + }; +} + +module.exports = createContextHandlers; diff --git a/api/app/clients/prompts/createVisionPrompt.js b/api/app/clients/prompts/createVisionPrompt.js new file mode 100644 index 0000000..5d8a7bb --- /dev/null +++ b/api/app/clients/prompts/createVisionPrompt.js @@ -0,0 +1,34 @@ +/** + * Generates a prompt instructing the user to describe an image in detail, tailored to different types of visual content. + * @param {boolean} pluralized - Whether to pluralize the prompt for multiple images. + * @returns {string} - The generated vision prompt. + */ +const createVisionPrompt = (pluralized = false) => { + return `Please describe the image${ + pluralized ? 's' : '' + } in detail, covering relevant aspects such as: + + For photographs, illustrations, or artwork: + - The main subject(s) and their appearance, positioning, and actions + - The setting, background, and any notable objects or elements + - Colors, lighting, and overall mood or atmosphere + - Any interesting details, textures, or patterns + - The style, technique, or medium used (if discernible) + + For screenshots or images containing text: + - The content and purpose of the text + - The layout, formatting, and organization of the information + - Any notable visual elements, such as logos, icons, or graphics + - The overall context or message conveyed by the screenshot + + For graphs, charts, or data visualizations: + - The type of graph or chart (e.g., bar graph, line chart, pie chart) + - The variables being compared or analyzed + - Any trends, patterns, or outliers in the data + - The axis labels, scales, and units of measurement + - The title, legend, and any additional context provided + + Be as specific and descriptive as possible while maintaining clarity and concision.`; +}; + +module.exports = createVisionPrompt; diff --git a/api/app/clients/prompts/formatAgentMessages.spec.js b/api/app/clients/prompts/formatAgentMessages.spec.js new file mode 100644 index 0000000..1aee3ed --- /dev/null +++ b/api/app/clients/prompts/formatAgentMessages.spec.js @@ -0,0 +1,361 @@ +const { ToolMessage } = require('@langchain/core/messages'); +const { ContentTypes } = require('librechat-data-provider'); +const { HumanMessage, AIMessage, SystemMessage } = require('@langchain/core/messages'); +const { formatAgentMessages } = require('./formatMessages'); + +describe('formatAgentMessages', () => { + it('should format simple user and AI messages', () => { + const payload = [ + { role: 'user', content: 'Hello' }, + { role: 'assistant', content: 'Hi there!' }, + ]; + const result = formatAgentMessages(payload); + expect(result).toHaveLength(2); + expect(result[0]).toBeInstanceOf(HumanMessage); + expect(result[1]).toBeInstanceOf(AIMessage); + }); + + it('should handle system messages', () => { + const payload = [{ role: 'system', content: 'You are a helpful assistant.' }]; + const result = formatAgentMessages(payload); + expect(result).toHaveLength(1); + expect(result[0]).toBeInstanceOf(SystemMessage); + }); + + it('should format messages with content arrays', () => { + const payload = [ + { + role: 'user', + content: [{ type: ContentTypes.TEXT, [ContentTypes.TEXT]: 'Hello' }], + }, + ]; + const result = formatAgentMessages(payload); + expect(result).toHaveLength(1); + expect(result[0]).toBeInstanceOf(HumanMessage); + }); + + it('should handle tool calls and create ToolMessages', () => { + const payload = [ + { + role: 'assistant', + content: [ + { + type: ContentTypes.TEXT, + [ContentTypes.TEXT]: 'Let me check that for you.', + tool_call_ids: ['123'], + }, + { + type: ContentTypes.TOOL_CALL, + tool_call: { + id: '123', + name: 'search', + args: '{"query":"weather"}', + output: 'The weather is sunny.', + }, + }, + ], + }, + ]; + const result = formatAgentMessages(payload); + expect(result).toHaveLength(2); + expect(result[0]).toBeInstanceOf(AIMessage); + expect(result[1]).toBeInstanceOf(ToolMessage); + expect(result[0].tool_calls).toHaveLength(1); + expect(result[1].tool_call_id).toBe('123'); + }); + + it('should handle multiple content parts in assistant messages', () => { + const payload = [ + { + role: 'assistant', + content: [ + { type: ContentTypes.TEXT, [ContentTypes.TEXT]: 'Part 1' }, + { type: ContentTypes.TEXT, [ContentTypes.TEXT]: 'Part 2' }, + ], + }, + ]; + const result = formatAgentMessages(payload); + expect(result).toHaveLength(1); + expect(result[0]).toBeInstanceOf(AIMessage); + expect(result[0].content).toHaveLength(2); + }); + + it('should throw an error for invalid tool call structure', () => { + const payload = [ + { + role: 'assistant', + content: [ + { + type: ContentTypes.TOOL_CALL, + tool_call: { + id: '123', + name: 'search', + args: '{"query":"weather"}', + output: 'The weather is sunny.', + }, + }, + ], + }, + ]; + expect(() => formatAgentMessages(payload)).toThrow('Invalid tool call structure'); + }); + + it('should handle tool calls with non-JSON args', () => { + const payload = [ + { + role: 'assistant', + content: [ + { type: ContentTypes.TEXT, [ContentTypes.TEXT]: 'Checking...', tool_call_ids: ['123'] }, + { + type: ContentTypes.TOOL_CALL, + tool_call: { + id: '123', + name: 'search', + args: 'non-json-string', + output: 'Result', + }, + }, + ], + }, + ]; + const result = formatAgentMessages(payload); + expect(result).toHaveLength(2); + expect(result[0].tool_calls[0].args).toStrictEqual({ input: 'non-json-string' }); + }); + + it('should handle complex tool calls with multiple steps', () => { + const payload = [ + { + role: 'assistant', + content: [ + { + type: ContentTypes.TEXT, + [ContentTypes.TEXT]: "I'll search for that information.", + tool_call_ids: ['search_1'], + }, + { + type: ContentTypes.TOOL_CALL, + tool_call: { + id: 'search_1', + name: 'search', + args: '{"query":"weather in New York"}', + output: 'The weather in New York is currently sunny with a temperature of 75°F.', + }, + }, + { + type: ContentTypes.TEXT, + [ContentTypes.TEXT]: "Now, I'll convert the temperature.", + tool_call_ids: ['convert_1'], + }, + { + type: ContentTypes.TOOL_CALL, + tool_call: { + id: 'convert_1', + name: 'convert_temperature', + args: '{"temperature": 75, "from": "F", "to": "C"}', + output: '23.89°C', + }, + }, + { type: ContentTypes.TEXT, [ContentTypes.TEXT]: "Here's your answer." }, + ], + }, + ]; + + const result = formatAgentMessages(payload); + + expect(result).toHaveLength(5); + expect(result[0]).toBeInstanceOf(AIMessage); + expect(result[1]).toBeInstanceOf(ToolMessage); + expect(result[2]).toBeInstanceOf(AIMessage); + expect(result[3]).toBeInstanceOf(ToolMessage); + expect(result[4]).toBeInstanceOf(AIMessage); + + // Check first AIMessage + expect(result[0].content).toBe("I'll search for that information."); + expect(result[0].tool_calls).toHaveLength(1); + expect(result[0].tool_calls[0]).toEqual({ + id: 'search_1', + name: 'search', + args: { query: 'weather in New York' }, + }); + + // Check first ToolMessage + expect(result[1].tool_call_id).toBe('search_1'); + expect(result[1].name).toBe('search'); + expect(result[1].content).toBe( + 'The weather in New York is currently sunny with a temperature of 75°F.', + ); + + // Check second AIMessage + expect(result[2].content).toBe("Now, I'll convert the temperature."); + expect(result[2].tool_calls).toHaveLength(1); + expect(result[2].tool_calls[0]).toEqual({ + id: 'convert_1', + name: 'convert_temperature', + args: { temperature: 75, from: 'F', to: 'C' }, + }); + + // Check second ToolMessage + expect(result[3].tool_call_id).toBe('convert_1'); + expect(result[3].name).toBe('convert_temperature'); + expect(result[3].content).toBe('23.89°C'); + + // Check final AIMessage + expect(result[4].content).toStrictEqual([ + { [ContentTypes.TEXT]: "Here's your answer.", type: ContentTypes.TEXT }, + ]); + }); + + it.skip('should not produce two consecutive assistant messages and format content correctly', () => { + const payload = [ + { role: 'user', content: 'Hello' }, + { + role: 'assistant', + content: [{ type: ContentTypes.TEXT, [ContentTypes.TEXT]: 'Hi there!' }], + }, + { + role: 'assistant', + content: [{ type: ContentTypes.TEXT, [ContentTypes.TEXT]: 'How can I help you?' }], + }, + { role: 'user', content: "What's the weather?" }, + { + role: 'assistant', + content: [ + { + type: ContentTypes.TEXT, + [ContentTypes.TEXT]: 'Let me check that for you.', + tool_call_ids: ['weather_1'], + }, + { + type: ContentTypes.TOOL_CALL, + tool_call: { + id: 'weather_1', + name: 'check_weather', + args: '{"location":"New York"}', + output: 'Sunny, 75°F', + }, + }, + ], + }, + { + role: 'assistant', + content: [ + { type: ContentTypes.TEXT, [ContentTypes.TEXT]: "Here's the weather information." }, + ], + }, + ]; + + const result = formatAgentMessages(payload); + + // Check correct message count and types + expect(result).toHaveLength(6); + expect(result[0]).toBeInstanceOf(HumanMessage); + expect(result[1]).toBeInstanceOf(AIMessage); + expect(result[2]).toBeInstanceOf(HumanMessage); + expect(result[3]).toBeInstanceOf(AIMessage); + expect(result[4]).toBeInstanceOf(ToolMessage); + expect(result[5]).toBeInstanceOf(AIMessage); + + // Check content of messages + expect(result[0].content).toStrictEqual([ + { [ContentTypes.TEXT]: 'Hello', type: ContentTypes.TEXT }, + ]); + expect(result[1].content).toStrictEqual([ + { [ContentTypes.TEXT]: 'Hi there!', type: ContentTypes.TEXT }, + { [ContentTypes.TEXT]: 'How can I help you?', type: ContentTypes.TEXT }, + ]); + expect(result[2].content).toStrictEqual([ + { [ContentTypes.TEXT]: "What's the weather?", type: ContentTypes.TEXT }, + ]); + expect(result[3].content).toBe('Let me check that for you.'); + expect(result[4].content).toBe('Sunny, 75°F'); + expect(result[5].content).toStrictEqual([ + { [ContentTypes.TEXT]: "Here's the weather information.", type: ContentTypes.TEXT }, + ]); + + // Check that there are no consecutive AIMessages + const messageTypes = result.map((message) => message.constructor); + for (let i = 0; i < messageTypes.length - 1; i++) { + expect(messageTypes[i] === AIMessage && messageTypes[i + 1] === AIMessage).toBe(false); + } + + // Additional check to ensure the consecutive assistant messages were combined + expect(result[1].content).toHaveLength(2); + }); + + it('should skip THINK type content parts', () => { + const payload = [ + { + role: 'assistant', + content: [ + { type: ContentTypes.TEXT, [ContentTypes.TEXT]: 'Initial response' }, + { type: ContentTypes.THINK, [ContentTypes.THINK]: 'Reasoning about the problem...' }, + { type: ContentTypes.TEXT, [ContentTypes.TEXT]: 'Final answer' }, + ], + }, + ]; + + const result = formatAgentMessages(payload); + + expect(result).toHaveLength(1); + expect(result[0]).toBeInstanceOf(AIMessage); + expect(result[0].content).toEqual('Initial response\nFinal answer'); + }); + + it('should join TEXT content as string when THINK content type is present', () => { + const payload = [ + { + role: 'assistant', + content: [ + { type: ContentTypes.THINK, [ContentTypes.THINK]: 'Analyzing the problem...' }, + { type: ContentTypes.TEXT, [ContentTypes.TEXT]: 'First part of response' }, + { type: ContentTypes.TEXT, [ContentTypes.TEXT]: 'Second part of response' }, + { type: ContentTypes.TEXT, [ContentTypes.TEXT]: 'Final part of response' }, + ], + }, + ]; + + const result = formatAgentMessages(payload); + + expect(result).toHaveLength(1); + expect(result[0]).toBeInstanceOf(AIMessage); + expect(typeof result[0].content).toBe('string'); + expect(result[0].content).toBe( + 'First part of response\nSecond part of response\nFinal part of response', + ); + expect(result[0].content).not.toContain('Analyzing the problem...'); + }); + + it('should exclude ERROR type content parts', () => { + const payload = [ + { + role: 'assistant', + content: [ + { type: ContentTypes.TEXT, [ContentTypes.TEXT]: 'Hello there' }, + { + type: ContentTypes.ERROR, + [ContentTypes.ERROR]: + 'An error occurred while processing the request: Something went wrong', + }, + { type: ContentTypes.TEXT, [ContentTypes.TEXT]: 'Final answer' }, + ], + }, + ]; + + const result = formatAgentMessages(payload); + + expect(result).toHaveLength(1); + expect(result[0]).toBeInstanceOf(AIMessage); + expect(result[0].content).toEqual([ + { type: ContentTypes.TEXT, [ContentTypes.TEXT]: 'Hello there' }, + { type: ContentTypes.TEXT, [ContentTypes.TEXT]: 'Final answer' }, + ]); + + // Make sure no error content exists in the result + const hasErrorContent = result[0].content.some( + (item) => + item.type === ContentTypes.ERROR || JSON.stringify(item).includes('An error occurred'), + ); + expect(hasErrorContent).toBe(false); + }); +}); diff --git a/api/app/clients/prompts/formatGoogleInputs.js b/api/app/clients/prompts/formatGoogleInputs.js new file mode 100644 index 0000000..c929df8 --- /dev/null +++ b/api/app/clients/prompts/formatGoogleInputs.js @@ -0,0 +1,42 @@ +/** + * Formats an object to match the struct_val, list_val, string_val, float_val, and int_val format. + * + * @param {Object} obj - The object to be formatted. + * @returns {Object} The formatted object. + * + * Handles different types: + * - Arrays are wrapped in list_val and each element is processed. + * - Objects are recursively processed. + * - Strings are wrapped in string_val. + * - Numbers are wrapped in float_val or int_val depending on whether they are floating-point or integers. + */ +function formatGoogleInputs(obj) { + const formattedObj = {}; + + for (const key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + const value = obj[key]; + + // Handle arrays + if (Array.isArray(value)) { + formattedObj[key] = { list_val: value.map((item) => formatGoogleInputs(item)) }; + } + // Handle objects + else if (typeof value === 'object' && value !== null) { + formattedObj[key] = formatGoogleInputs(value); + } + // Handle numbers + else if (typeof value === 'number') { + formattedObj[key] = Number.isInteger(value) ? { int_val: value } : { float_val: value }; + } + // Handle other types (e.g., strings) + else { + formattedObj[key] = { string_val: [value] }; + } + } + } + + return { struct_val: formattedObj }; +} + +module.exports = formatGoogleInputs; diff --git a/api/app/clients/prompts/formatGoogleInputs.spec.js b/api/app/clients/prompts/formatGoogleInputs.spec.js new file mode 100644 index 0000000..8fef9df --- /dev/null +++ b/api/app/clients/prompts/formatGoogleInputs.spec.js @@ -0,0 +1,274 @@ +const formatGoogleInputs = require('./formatGoogleInputs'); + +describe('formatGoogleInputs', () => { + it('formats message correctly', () => { + const input = { + messages: [ + { + content: 'hi', + author: 'user', + }, + ], + context: 'context', + examples: [ + { + input: { + author: 'user', + content: 'user input', + }, + output: { + author: 'bot', + content: 'bot output', + }, + }, + ], + parameters: { + temperature: 0.2, + topP: 0.8, + topK: 40, + maxOutputTokens: 1024, + }, + }; + + const expectedOutput = { + struct_val: { + messages: { + list_val: [ + { + struct_val: { + content: { + string_val: ['hi'], + }, + author: { + string_val: ['user'], + }, + }, + }, + ], + }, + context: { + string_val: ['context'], + }, + examples: { + list_val: [ + { + struct_val: { + input: { + struct_val: { + author: { + string_val: ['user'], + }, + content: { + string_val: ['user input'], + }, + }, + }, + output: { + struct_val: { + author: { + string_val: ['bot'], + }, + content: { + string_val: ['bot output'], + }, + }, + }, + }, + }, + ], + }, + parameters: { + struct_val: { + temperature: { + float_val: 0.2, + }, + topP: { + float_val: 0.8, + }, + topK: { + int_val: 40, + }, + maxOutputTokens: { + int_val: 1024, + }, + }, + }, + }, + }; + + const result = formatGoogleInputs(input); + expect(JSON.stringify(result)).toEqual(JSON.stringify(expectedOutput)); + }); + + it('formats real payload parts', () => { + const input = { + instances: [ + { + context: 'context', + examples: [ + { + input: { + author: 'user', + content: 'user input', + }, + output: { + author: 'bot', + content: 'user output', + }, + }, + ], + messages: [ + { + author: 'user', + content: 'hi', + }, + ], + }, + ], + parameters: { + candidateCount: 1, + maxOutputTokens: 1024, + temperature: 0.2, + topP: 0.8, + topK: 40, + }, + }; + const expectedOutput = { + struct_val: { + instances: { + list_val: [ + { + struct_val: { + context: { string_val: ['context'] }, + examples: { + list_val: [ + { + struct_val: { + input: { + struct_val: { + author: { string_val: ['user'] }, + content: { string_val: ['user input'] }, + }, + }, + output: { + struct_val: { + author: { string_val: ['bot'] }, + content: { string_val: ['user output'] }, + }, + }, + }, + }, + ], + }, + messages: { + list_val: [ + { + struct_val: { + author: { string_val: ['user'] }, + content: { string_val: ['hi'] }, + }, + }, + ], + }, + }, + }, + ], + }, + parameters: { + struct_val: { + candidateCount: { int_val: 1 }, + maxOutputTokens: { int_val: 1024 }, + temperature: { float_val: 0.2 }, + topP: { float_val: 0.8 }, + topK: { int_val: 40 }, + }, + }, + }, + }; + + const result = formatGoogleInputs(input); + expect(JSON.stringify(result)).toEqual(JSON.stringify(expectedOutput)); + }); + + it('helps create valid payload parts', () => { + const instances = { + context: 'context', + examples: [ + { + input: { + author: 'user', + content: 'user input', + }, + output: { + author: 'bot', + content: 'user output', + }, + }, + ], + messages: [ + { + author: 'user', + content: 'hi', + }, + ], + }; + + const expectedInstances = { + struct_val: { + context: { string_val: ['context'] }, + examples: { + list_val: [ + { + struct_val: { + input: { + struct_val: { + author: { string_val: ['user'] }, + content: { string_val: ['user input'] }, + }, + }, + output: { + struct_val: { + author: { string_val: ['bot'] }, + content: { string_val: ['user output'] }, + }, + }, + }, + }, + ], + }, + messages: { + list_val: [ + { + struct_val: { + author: { string_val: ['user'] }, + content: { string_val: ['hi'] }, + }, + }, + ], + }, + }, + }; + + const parameters = { + candidateCount: 1, + maxOutputTokens: 1024, + temperature: 0.2, + topP: 0.8, + topK: 40, + }; + const expectedParameters = { + struct_val: { + candidateCount: { int_val: 1 }, + maxOutputTokens: { int_val: 1024 }, + temperature: { float_val: 0.2 }, + topP: { float_val: 0.8 }, + topK: { int_val: 40 }, + }, + }; + + const instancesResult = formatGoogleInputs(instances); + const parametersResult = formatGoogleInputs(parameters); + expect(JSON.stringify(instancesResult)).toEqual(JSON.stringify(expectedInstances)); + expect(JSON.stringify(parametersResult)).toEqual(JSON.stringify(expectedParameters)); + }); +}); diff --git a/api/app/clients/prompts/formatMessages.js b/api/app/clients/prompts/formatMessages.js new file mode 100644 index 0000000..376178b --- /dev/null +++ b/api/app/clients/prompts/formatMessages.js @@ -0,0 +1,245 @@ +const { ToolMessage } = require('@langchain/core/messages'); +const { EModelEndpoint, ContentTypes } = require('librechat-data-provider'); +const { HumanMessage, AIMessage, SystemMessage } = require('@langchain/core/messages'); + +/** + * Formats a message to OpenAI Vision API payload format. + * + * @param {Object} params - The parameters for formatting. + * @param {Object} params.message - The message object to format. + * @param {string} [params.message.role] - The role of the message sender (must be 'user'). + * @param {string} [params.message.content] - The text content of the message. + * @param {EModelEndpoint} [params.endpoint] - Identifier for specific endpoint handling + * @param {Array} [params.image_urls] - The image_urls to attach to the message. + * @returns {(Object)} - The formatted message. + */ +const formatVisionMessage = ({ message, image_urls, endpoint }) => { + if (endpoint === EModelEndpoint.anthropic) { + message.content = [...image_urls, { type: ContentTypes.TEXT, text: message.content }]; + return message; + } + + message.content = [{ type: ContentTypes.TEXT, text: message.content }, ...image_urls]; + + return message; +}; + +/** + * Formats a message to OpenAI payload format based on the provided options. + * + * @param {Object} params - The parameters for formatting. + * @param {Object} params.message - The message object to format. + * @param {string} [params.message.role] - The role of the message sender (e.g., 'user', 'assistant'). + * @param {string} [params.message._name] - The name associated with the message. + * @param {string} [params.message.sender] - The sender of the message. + * @param {string} [params.message.text] - The text content of the message. + * @param {string} [params.message.content] - The content of the message. + * @param {Array} [params.message.image_urls] - The image_urls attached to the message for Vision API. + * @param {string} [params.userName] - The name of the user. + * @param {string} [params.assistantName] - The name of the assistant. + * @param {string} [params.endpoint] - Identifier for specific endpoint handling + * @param {boolean} [params.langChain=false] - Whether to return a LangChain message object. + * @returns {(Object|HumanMessage|AIMessage|SystemMessage)} - The formatted message. + */ +const formatMessage = ({ message, userName, assistantName, endpoint, langChain = false }) => { + let { role: _role, _name, sender, text, content: _content, lc_id } = message; + if (lc_id && lc_id[2] && !langChain) { + const roleMapping = { + SystemMessage: 'system', + HumanMessage: 'user', + AIMessage: 'assistant', + }; + _role = roleMapping[lc_id[2]]; + } + const role = _role ?? (sender && sender?.toLowerCase() === 'user' ? 'user' : 'assistant'); + const content = _content ?? text ?? ''; + const formattedMessage = { + role, + content, + }; + + const { image_urls } = message; + if (Array.isArray(image_urls) && image_urls.length > 0 && role === 'user') { + return formatVisionMessage({ + message: formattedMessage, + image_urls: message.image_urls, + endpoint, + }); + } + + if (_name) { + formattedMessage.name = _name; + } + + if (userName && formattedMessage.role === 'user') { + formattedMessage.name = userName; + } + + if (assistantName && formattedMessage.role === 'assistant') { + formattedMessage.name = assistantName; + } + + if (formattedMessage.name) { + // Conform to API regex: ^[a-zA-Z0-9_-]{1,64}$ + // https://community.openai.com/t/the-format-of-the-name-field-in-the-documentation-is-incorrect/175684/2 + formattedMessage.name = formattedMessage.name.replace(/[^a-zA-Z0-9_-]/g, '_'); + + if (formattedMessage.name.length > 64) { + formattedMessage.name = formattedMessage.name.substring(0, 64); + } + } + + if (!langChain) { + return formattedMessage; + } + + if (role === 'user') { + return new HumanMessage(formattedMessage); + } else if (role === 'assistant') { + return new AIMessage(formattedMessage); + } else { + return new SystemMessage(formattedMessage); + } +}; + +/** + * Formats an array of messages for LangChain. + * + * @param {Array} messages - The array of messages to format. + * @param {Object} formatOptions - The options for formatting each message. + * @param {string} [formatOptions.userName] - The name of the user. + * @param {string} [formatOptions.assistantName] - The name of the assistant. + * @returns {Array<(HumanMessage|AIMessage|SystemMessage)>} - The array of formatted LangChain messages. + */ +const formatLangChainMessages = (messages, formatOptions) => + messages.map((msg) => formatMessage({ ...formatOptions, message: msg, langChain: true })); + +/** + * Formats a LangChain message object by merging properties from `lc_kwargs` or `kwargs` and `additional_kwargs`. + * + * @param {Object} message - The message object to format. + * @param {Object} [message.lc_kwargs] - Contains properties to be merged. Either this or `message.kwargs` should be provided. + * @param {Object} [message.kwargs] - Contains properties to be merged. Either this or `message.lc_kwargs` should be provided. + * @param {Object} [message.kwargs.additional_kwargs] - Additional properties to be merged. + * + * @returns {Object} The formatted LangChain message. + */ +const formatFromLangChain = (message) => { + const { additional_kwargs, ...message_kwargs } = message.lc_kwargs ?? message.kwargs; + return { + ...message_kwargs, + ...additional_kwargs, + }; +}; + +/** + * Formats an array of messages for LangChain, handling tool calls and creating ToolMessage instances. + * + * @param {Array>} payload - The array of messages to format. + * @returns {Array<(HumanMessage|AIMessage|SystemMessage|ToolMessage)>} - The array of formatted LangChain messages, including ToolMessages for tool calls. + */ +const formatAgentMessages = (payload) => { + const messages = []; + + for (const message of payload) { + if (typeof message.content === 'string') { + message.content = [{ type: ContentTypes.TEXT, [ContentTypes.TEXT]: message.content }]; + } + if (message.role !== 'assistant') { + messages.push(formatMessage({ message, langChain: true })); + continue; + } + + let currentContent = []; + let lastAIMessage = null; + + let hasReasoning = false; + for (const part of message.content) { + if (part.type === ContentTypes.TEXT && part.tool_call_ids) { + /* + If there's pending content, it needs to be aggregated as a single string to prepare for tool calls. + For Anthropic models, the "tool_calls" field on a message is only respected if content is a string. + */ + if (currentContent.length > 0) { + let content = currentContent.reduce((acc, curr) => { + if (curr.type === ContentTypes.TEXT) { + return `${acc}${curr[ContentTypes.TEXT]}\n`; + } + return acc; + }, ''); + content = `${content}\n${part[ContentTypes.TEXT] ?? ''}`.trim(); + lastAIMessage = new AIMessage({ content }); + messages.push(lastAIMessage); + currentContent = []; + continue; + } + + // Create a new AIMessage with this text and prepare for tool calls + lastAIMessage = new AIMessage({ + content: part.text || '', + }); + + messages.push(lastAIMessage); + } else if (part.type === ContentTypes.TOOL_CALL) { + if (!lastAIMessage) { + throw new Error('Invalid tool call structure: No preceding AIMessage with tool_call_ids'); + } + + // Note: `tool_calls` list is defined when constructed by `AIMessage` class, and outputs should be excluded from it + const { output, args: _args, ...tool_call } = part.tool_call; + // TODO: investigate; args as dictionary may need to be provider-or-tool-specific + let args = _args; + try { + args = JSON.parse(_args); + } catch (e) { + if (typeof _args === 'string') { + args = { input: _args }; + } + } + + tool_call.args = args; + lastAIMessage.tool_calls.push(tool_call); + + // Add the corresponding ToolMessage + messages.push( + new ToolMessage({ + tool_call_id: tool_call.id, + name: tool_call.name, + content: output || '', + }), + ); + } else if (part.type === ContentTypes.THINK) { + hasReasoning = true; + continue; + } else if (part.type === ContentTypes.ERROR || part.type === ContentTypes.AGENT_UPDATE) { + continue; + } else { + currentContent.push(part); + } + } + + if (hasReasoning) { + currentContent = currentContent + .reduce((acc, curr) => { + if (curr.type === ContentTypes.TEXT) { + return `${acc}${curr[ContentTypes.TEXT]}\n`; + } + return acc; + }, '') + .trim(); + } + + if (currentContent.length > 0) { + messages.push(new AIMessage({ content: currentContent })); + } + } + + return messages; +}; + +module.exports = { + formatMessage, + formatFromLangChain, + formatAgentMessages, + formatLangChainMessages, +}; diff --git a/api/app/clients/prompts/formatMessages.spec.js b/api/app/clients/prompts/formatMessages.spec.js new file mode 100644 index 0000000..97e40b0 --- /dev/null +++ b/api/app/clients/prompts/formatMessages.spec.js @@ -0,0 +1,276 @@ +const { Constants } = require('librechat-data-provider'); +const { HumanMessage, AIMessage, SystemMessage } = require('@langchain/core/messages'); +const { formatMessage, formatLangChainMessages, formatFromLangChain } = require('./formatMessages'); + +describe('formatMessage', () => { + it('formats user message', () => { + const input = { + message: { + sender: 'user', + text: 'Hello', + }, + userName: 'John', + }; + const result = formatMessage(input); + expect(result).toEqual({ + role: 'user', + content: 'Hello', + name: 'John', + }); + }); + + it('sanitizes the name by replacing invalid characters (per OpenAI)', () => { + const input = { + message: { + sender: 'user', + text: 'Hello', + }, + userName: ' John$Doe@Example! ', + }; + const result = formatMessage(input); + expect(result).toEqual({ + role: 'user', + content: 'Hello', + name: '_John_Doe_Example__', + }); + }); + + it('trims the name to a maximum length of 64 characters', () => { + const longName = 'a'.repeat(100); + const input = { + message: { + sender: 'user', + text: 'Hello', + }, + userName: longName, + }; + const result = formatMessage(input); + expect(result.name.length).toBe(64); + expect(result.name).toBe('a'.repeat(64)); + }); + + it('formats a realistic user message', () => { + const input = { + message: { + _id: '6512cdfb92cbf69fea615331', + messageId: 'b620bf73-c5c3-4a38-b724-76886aac24c4', + __v: 0, + conversationId: '5c23d24f-941f-4aab-85df-127b596c8aa5', + createdAt: Date.now(), + error: false, + finish_reason: null, + isCreatedByUser: true, + model: null, + parentMessageId: Constants.NO_PARENT, + sender: 'User', + text: 'hi', + tokenCount: 5, + unfinished: false, + updatedAt: Date.now(), + user: '6512cdf475f05c86d44c31d2', + }, + userName: 'John', + }; + const result = formatMessage(input); + expect(result).toEqual({ + role: 'user', + content: 'hi', + name: 'John', + }); + }); + + it('formats assistant message', () => { + const input = { + message: { + sender: 'assistant', + text: 'Hi there', + }, + assistantName: 'Assistant', + }; + const result = formatMessage(input); + expect(result).toEqual({ + role: 'assistant', + content: 'Hi there', + name: 'Assistant', + }); + }); + + it('formats system message', () => { + const input = { + message: { + role: 'system', + text: 'Hi there', + }, + }; + const result = formatMessage(input); + expect(result).toEqual({ + role: 'system', + content: 'Hi there', + }); + }); + + it('formats user message with langChain', () => { + const input = { + message: { + sender: 'user', + text: 'Hello', + }, + userName: 'John', + langChain: true, + }; + const result = formatMessage(input); + expect(result).toBeInstanceOf(HumanMessage); + expect(result.lc_kwargs.content).toEqual(input.message.text); + expect(result.lc_kwargs.name).toEqual(input.userName); + }); + + it('formats assistant message with langChain', () => { + const input = { + message: { + sender: 'assistant', + text: 'Hi there', + }, + assistantName: 'Assistant', + langChain: true, + }; + const result = formatMessage(input); + expect(result).toBeInstanceOf(AIMessage); + expect(result.lc_kwargs.content).toEqual(input.message.text); + expect(result.lc_kwargs.name).toEqual(input.assistantName); + }); + + it('formats system message with langChain', () => { + const input = { + message: { + role: 'system', + text: 'This is a system message.', + }, + langChain: true, + }; + const result = formatMessage(input); + expect(result).toBeInstanceOf(SystemMessage); + expect(result.lc_kwargs.content).toEqual(input.message.text); + }); + + it('formats langChain messages into OpenAI payload format', () => { + const human = { + message: new HumanMessage({ + content: 'Hello', + }), + }; + const system = { + message: new SystemMessage({ + content: 'Hello', + }), + }; + const ai = { + message: new AIMessage({ + content: 'Hello', + }), + }; + const humanResult = formatMessage(human); + const systemResult = formatMessage(system); + const aiResult = formatMessage(ai); + expect(humanResult).toEqual({ + role: 'user', + content: 'Hello', + }); + expect(systemResult).toEqual({ + role: 'system', + content: 'Hello', + }); + expect(aiResult).toEqual({ + role: 'assistant', + content: 'Hello', + }); + }); +}); + +describe('formatLangChainMessages', () => { + it('formats an array of messages for LangChain', () => { + const messages = [ + { + role: 'system', + content: 'This is a system message', + }, + { + sender: 'user', + text: 'Hello', + }, + { + sender: 'assistant', + text: 'Hi there', + }, + ]; + const formatOptions = { + userName: 'John', + assistantName: 'Assistant', + }; + const result = formatLangChainMessages(messages, formatOptions); + expect(result).toHaveLength(3); + expect(result[0]).toBeInstanceOf(SystemMessage); + expect(result[1]).toBeInstanceOf(HumanMessage); + expect(result[2]).toBeInstanceOf(AIMessage); + + expect(result[0].lc_kwargs.content).toEqual(messages[0].content); + expect(result[1].lc_kwargs.content).toEqual(messages[1].text); + expect(result[2].lc_kwargs.content).toEqual(messages[2].text); + + expect(result[1].lc_kwargs.name).toEqual(formatOptions.userName); + expect(result[2].lc_kwargs.name).toEqual(formatOptions.assistantName); + }); + + describe('formatFromLangChain', () => { + it('should merge kwargs and additional_kwargs', () => { + const message = { + kwargs: { + content: 'some content', + name: 'dan', + additional_kwargs: { + function_call: { + name: 'dall-e', + arguments: '{\n "input": "Subject: hedgehog, Style: cute"\n}', + }, + }, + }, + }; + + const expected = { + content: 'some content', + name: 'dan', + function_call: { + name: 'dall-e', + arguments: '{\n "input": "Subject: hedgehog, Style: cute"\n}', + }, + }; + + expect(formatFromLangChain(message)).toEqual(expected); + }); + + it('should handle messages without additional_kwargs', () => { + const message = { + kwargs: { + content: 'some content', + name: 'dan', + }, + }; + + const expected = { + content: 'some content', + name: 'dan', + }; + + expect(formatFromLangChain(message)).toEqual(expected); + }); + + it('should handle empty messages', () => { + const message = { + kwargs: {}, + }; + + const expected = {}; + + expect(formatFromLangChain(message)).toEqual(expected); + }); + }); +}); diff --git a/api/app/clients/prompts/index.js b/api/app/clients/prompts/index.js new file mode 100644 index 0000000..ba4859e --- /dev/null +++ b/api/app/clients/prompts/index.js @@ -0,0 +1,13 @@ +const formatMessages = require('./formatMessages'); +const summaryPrompts = require('./summaryPrompts'); +const truncate = require('./truncate'); +const createVisionPrompt = require('./createVisionPrompt'); +const createContextHandlers = require('./createContextHandlers'); + +module.exports = { + ...formatMessages, + ...summaryPrompts, + ...truncate, + createVisionPrompt, + createContextHandlers, +}; diff --git a/api/app/clients/prompts/shadcn-docs/components.js b/api/app/clients/prompts/shadcn-docs/components.js new file mode 100644 index 0000000..b67c47d --- /dev/null +++ b/api/app/clients/prompts/shadcn-docs/components.js @@ -0,0 +1,495 @@ +// Essential Components +const essentialComponents = { + avatar: { + componentName: 'Avatar', + importDocs: 'import { Avatar, AvatarFallback, AvatarImage } from "/components/ui/avatar"', + usageDocs: ` + + + CN +`, + }, + button: { + componentName: 'Button', + importDocs: 'import { Button } from "/components/ui/button"', + usageDocs: ` +`, + }, + card: { + componentName: 'Card', + importDocs: ` +import { + Card, + CardContent, + CardDescription, + CardFooter, + CardHeader, + CardTitle, +} from "/components/ui/card"`, + usageDocs: ` + + + Card Title + Card Description + + +

Card Content

+
+ +

Card Footer

+
+
`, + }, + checkbox: { + componentName: 'Checkbox', + importDocs: 'import { Checkbox } from "/components/ui/checkbox"', + usageDocs: '', + }, + input: { + componentName: 'Input', + importDocs: 'import { Input } from "/components/ui/input"', + usageDocs: '', + }, + label: { + componentName: 'Label', + importDocs: 'import { Label } from "/components/ui/label"', + usageDocs: '', + }, + radioGroup: { + componentName: 'RadioGroup', + importDocs: ` +import { Label } from "/components/ui/label" +import { RadioGroup, RadioGroupItem } from "/components/ui/radio-group"`, + usageDocs: ` + +
+ + +
+
+ + +
+
`, + }, + select: { + componentName: 'Select', + importDocs: ` +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "/components/ui/select"`, + usageDocs: ` +`, + }, + textarea: { + componentName: 'Textarea', + importDocs: 'import { Textarea } from "/components/ui/textarea"', + usageDocs: '