2025-06-18 06:42:15 +05:30
|
|
|
import react from '@vitejs/plugin-react';
|
2025-05-24 19:47:17 -04:00
|
|
|
import path from 'path';
|
|
|
|
|
import { defineConfig } from 'vite';
|
2026-03-03 10:25:10 -05:00
|
|
|
import { createRequire } from 'module';
|
|
|
|
|
import { VitePWA } from 'vite-plugin-pwa';
|
2025-03-26 17:16:45 +01:00
|
|
|
import { compression } from 'vite-plugin-compression2';
|
2025-05-24 19:47:17 -04:00
|
|
|
import { nodePolyfills } from 'vite-plugin-node-polyfills';
|
2026-03-03 10:25:10 -05:00
|
|
|
import type { Plugin } from 'vite';
|
|
|
|
|
|
|
|
|
|
const require = createRequire(import.meta.url);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* vite-plugin-node-polyfills uses @rollup/plugin-inject to replace bare globals (e.g. `process`)
|
|
|
|
|
* with imports like `import process from 'vite-plugin-node-polyfills/shims/process'`. When the
|
|
|
|
|
* consuming module (e.g. recoil) is hoisted to the monorepo root, Vite 7's ESM resolver walks up
|
|
|
|
|
* from there and never finds the shims (installed only in client/node_modules). This map resolves
|
|
|
|
|
* the shim specifiers to absolute paths via CJS require.resolve anchored to the client directory.
|
|
|
|
|
*/
|
|
|
|
|
const NODE_POLYFILL_SHIMS: Record<string, string> = {
|
|
|
|
|
'vite-plugin-node-polyfills/shims/process': require.resolve(
|
|
|
|
|
'vite-plugin-node-polyfills/shims/process',
|
|
|
|
|
),
|
|
|
|
|
'vite-plugin-node-polyfills/shims/buffer': require.resolve(
|
|
|
|
|
'vite-plugin-node-polyfills/shims/buffer',
|
|
|
|
|
),
|
|
|
|
|
'vite-plugin-node-polyfills/shims/global': require.resolve(
|
|
|
|
|
'vite-plugin-node-polyfills/shims/global',
|
|
|
|
|
),
|
|
|
|
|
};
|
2024-04-22 20:08:34 -04:00
|
|
|
|
2023-04-01 12:58:49 -07:00
|
|
|
// https://vitejs.dev/config/
|
2026-02-26 16:43:24 -05:00
|
|
|
const backendPort = (process.env.BACKEND_PORT && Number(process.env.BACKEND_PORT)) || 3080;
|
|
|
|
|
const backendURL = process.env.HOST
|
|
|
|
|
? `http://${process.env.HOST}:${backendPort}`
|
|
|
|
|
: `http://localhost:${backendPort}`;
|
2025-10-23 05:04:49 +09:00
|
|
|
|
2025-05-28 09:27:12 -04:00
|
|
|
export default defineConfig(({ command }) => ({
|
2025-08-27 07:00:18 +01:00
|
|
|
base: '',
|
2023-05-18 11:09:31 -07:00
|
|
|
server: {
|
2026-02-26 16:43:24 -05:00
|
|
|
allowedHosts:
|
|
|
|
|
(process.env.VITE_ALLOWED_HOSTS && process.env.VITE_ALLOWED_HOSTS.split(',')) || [],
|
2025-10-23 05:04:49 +09:00
|
|
|
host: process.env.HOST || 'localhost',
|
2026-02-26 16:43:24 -05:00
|
|
|
port: (process.env.PORT && Number(process.env.PORT)) || 3090,
|
2023-05-18 11:09:31 -07:00
|
|
|
strictPort: false,
|
|
|
|
|
proxy: {
|
|
|
|
|
'/api': {
|
2025-10-23 05:04:49 +09:00
|
|
|
target: backendURL,
|
2023-07-14 09:36:49 -04:00
|
|
|
changeOrigin: true,
|
2023-05-18 11:09:31 -07:00
|
|
|
},
|
|
|
|
|
'/oauth': {
|
2025-10-23 05:04:49 +09:00
|
|
|
target: backendURL,
|
2023-07-14 09:36:49 -04:00
|
|
|
changeOrigin: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
2023-05-18 11:09:31 -07:00
|
|
|
},
|
2025-02-22 23:42:20 +01:00
|
|
|
// Set the directory where environment variables are loaded from and restrict prefixes
|
feat: Plugins endpoint - Reverse Engineering of official Plugins features (#197)
* components for plugins in progress
* WIP: add langchain client implementation for tools/plugins
feat(langchain): add loadHistory function for loading chat history from database
feat(langchain): add saveMessageToDatabase function for saving chat messages to database
* chore(Memory.js): remove Memory.js file from the project directory.
* WIP: adding plugin functionality
——————————————————
fix(eslintrc.js): change arrow-parens rule to always require parentheses
refactor(agent.js): reorganize imports and add new imports
feat(agent.js): add support for saving and loading chat history
feat(agent.js): add support for saving messages to database
feat(agent.js): add ChatAgent class with initialize and sendMessage methods
fix(langchain): use getConvo and saveMessage functions from models.js instead of Conversation and Message models
feat(langchain): add user parameter to loadHistory and saveMessageToDatabase functions
chore(package.json): update langchain package version to 0.0.59 and add langchain script to run test2.js file
——————————————————
* WIP: testing agent initialization
* WIP: testing various agent methods
feat(agent.js): add CustomChatAgent class and initializeAgentExecutorWithOptions method
feat(customChatAgent.js): add CustomPromptTemplate and CustomOutputParser classes
refactor(langchain): uncomment code for input2 and options
feat(langchain): add input1 to read comments on a youtube video
docs(langchain): remove commented code and add whitespace to package.json
* WIP: feat: plugin endpoint, backend class working
* feat(agent.js): add support for Zapier NLA API key
feat(agent.js): add ZapierToolKit to tools if zapierApiKey is provided
feat(customAgent.js): change prompt prefix and suffix to reflect new task-based prompt
feat(test4.js): add test for new task-based prompt
* style(langchain): improve readability and add comments to code
feat(langchain): update prompt message for custom agent
fix(langchain): update message format in test4.js
* style(customAgent.js): remove unnecessary capitalization and rephrase some sentences
test(langchain): add test2 and test3 scripts to package.json
* chore(customAgent.js): fix typo in comment, change "an" to "identical"
* WIP: gpt-4 testing
* feat(langchain): add AIPluginTool and HumanTool classes
fix(langchain): remove zapierApiKey option from ChatAgent constructor
refactor(langchain): update langchain package to v0.0.64
misc(langchain): update test2, test3, and test4 scripts to use --inspect flag
* feat(langchain): add GoogleSearchAPI tool for searching the web using Google Custom Search API
* feat(askGPTPlugins.js): add support for progress callback in ask function
fix(agent.js): pass progress callback to sendApiMessage function
* refactor(agent.js): load tools from options and initialize them in constructor
feat(agent.js): add support for environment variable SERPAPI_API_KEY
feat(agent.js): add support for environment variable ZAPIER_NLA_API_KEY
docs(agent.js): remove commented out code and add comments to clarify code
* chore(langchain): remove unused files loadHistory.js and saveMessage.js
* feat(validateTools.js): add function to validate API keys for supported tools
* feat(langchain): update langchain package to version 0.0.66
feat(langchain): add support for GPT-4 model
fix(server/index.js): fix uncaughtException handler to ignore 'fetch failed' errors
* refactor(agent.js): remove FORMAT_INSTRUCTIONS and replace with a more concise message
refactor(agent.js): remove unused variable 'errorMessage'
refactor(agent.js): change 'result' variable initialization to an empty object instead of null
refactor(agent.js): change error message when response generation fails
refactor(agent.js): change output message when response generation fails
refactor(agent.js): change output message when response generation succeeds
* chore(langchain): comment out unused model in ChatAgent constructor
feat(langchain): add test5 script to package.json for running test5.js script
* refactor(agent.js): change response to answer and update message
refactor(test3.js, test5.js): remove commented out code and add comments
The changes in agent.js are to improve the message that is returned to the user. The word "response" has been changed to "answer" to better reflect the output of the chatbot. The message has also been updated to provide clearer instructions to the user.
The changes in test3.js and test5.js are to remove commented out code and add comments to improve readability.
* docs: update links to LOCAL_INSTALL.md and defaultSystemMessage.md
fix: fix typo in BingAI/Settings.jsx
feat: add Dockerfile for app containerization
docs(google_search.md): add guide for setting up Google Custom Search API key and ID
* docs: update link to system message guidelines in Bing AI Settings component
docs: update link to system message guidelines in GOOGLE_SEARCH.md
feat: add JAILBREAK_INFO.md guide for Bing AI jailbreak mode system message guidelines
* style(api): remove unnecessary quotes and empty values from .env.example
style(agent.js): refactor getActions method to accept an input parameter
feat(agent.js): add handleChainEnd method to CustomChatAgent class
style(customAgent.js): add a new line to the end of the file
style(test5.js): comment out unused variable and update input1 variable
style(googleSearch.js): change tool name to kebab-case
* chore(langchain): comment out handleChainEnd method in agent.js
feat(langchain): add browser tool to ChatAgent in test2.js
feat(langchain): add modelOptions to ChatAgent in test2.js
feat(langchain): change question in input1 and request article review summary in test5.js
* fix(askGPTPlugins.js): fix syntax error by removing extra comma in parentMessageId field
feat(askGPTPlugins.js): add default value of null to parentMessageId parameter in ask function
* fix(askGPTPlugins.js): change endpoint string from 'GPTPlugins' to 'gptPlugins'
feat(endpoints.js): add support for gptPlugins endpoint
feat(PresetItem.jsx): add support for gptPlugins endpoint
feat(HoverButtons.jsx): add support for gptPlugins endpoint
feat(createPayload.ts): add support for gptPlugins endpoint
feat(types.ts): add gptPlugins endpoint to EModelEndpoint enum
feat(endpoints.js): add gptPlugins endpoint to availableEndpoints selector
feat(cleanupPreset.js): add support for gptPlugins endpoint
feat(getDefaultConversation.js): add support for gptPlugins endpoint
feat(getIcon.jsx): add support for gptPlugins endpoint
feat(handleSubmit.js): add support for gptPlugins endpoint
* refactor(agent.js): remove debug option from options object
refactor(agent.js): change tool name from 'google-search' to 'google'
refactor(agent.js): update description for 'google' tool
feat(agent.js): add support for citing sources when using web links in response message
fix(agent.js): update error message to not mention error to user
feat(agent.js): add unique message ids for user message and response message
feat(agent.js): limit number of search results to 5 in 'google' tool
refactor(validateTools.js): add console log to show valid tools
* feat(askGPTPlugins.js): add support for GPT-3.5-turbo model and validate model option
refactor(askGPTPlugins.js): remove unused imports and variables
refactor(askGPTPlugins.js): remove commented code
refactor(askGPTPlugins.js): remove unused parameters in ask function
feat(ask/index.js): add askGPTPlugins route to router
* feat(NewConversationMenu): add alpha tag to gptPlugins endpoint and rename it to Plugins
* refactor(askGPTPlugins.js): remove commented code and unused imports
feat(askGPTPlugins.js): add support for debug option in endpointOption
feat(askGPTPlugins.js): add support for chatGptLabel, promptPrefix, temperature, top_p, presence_penalty, and frequency_penalty in endpointOption
feat(askGPTPlugins.js): add support for sending plugin and pluginend events
feat(askGPTPlugins.js): add onAgentAction and onChainEnd callbacks to ChatAgent.sendMessage
refactor(titleConvo.js): comment out unused imports
refactor(validateTools.js): comment out console.log statement
refactor(agent.js): change saveMessage to include unfinished property
feat(agent.js): add endpoint property to saveConvo call in saveMessageToDatabase
feat(askGPTPlugins.js): add validateTools import and use it to validate endpointOption.tools before passing to ChatAgent constructor
feat(askGPTPlugins.js
* refactor(MessageHeader.jsx): extract plugins section into a separate variable and add support for gptPlugins endpoint
fix(MessageHeader.jsx): disable clicking on non-clickable endpoints
* components for plugins in progress
* feat(Plugin.jsx): add plugin prop to Plugin component and display plugin name
feat(Plugin.jsx): add loading state and display loading spinner
feat(Plugin.jsx): add Disclosure component to Plugin component
feat(Plugin.jsx): add Disclosure.Panel to Plugin component to display team pricing information
feat(Spinner.jsx): add classProp prop to Spinner component to allow for custom styling
feat(Landing.jsx): add Plugin component to Landing page for testing
testing gpt plugins
feat(plugins): Milestone commit
- Add formatAction function to format plugin actions.
- Add prefix.js file to store the prefix message for ChatAgent.
- Update ask function to include plugin object to store plugin data.
- Update onAgentAction and onChainEnd functions to format plugin data and send intermediate messages.
- Update response object to include plugin data.
The `handlers.js` file now includes a `formatAction` function that formats the action object for display in the UI. The `createOnProgress` function now returns a `sendIntermediateMessage` function that sends intermediate messages to the client.
feat (client): add support for plugins in messages
This commit adds support for plugins in messages. It includes changes to the `handlers.js`, `index.jsx`, `CodeBlock.jsx`, `Message.jsx`, `MessageHeader.jsx`, and `Plugin.jsx` files.
The `index.jsx` file now includes a `plugin` property in the `messageHandler` function.
The `CodeBlock.jsx` file now includes a `plugin` property that determines the language of the code block.
The `Message.jsx` file now includes a `Plugin` component that displays the plugin used in the message.
The `MessageHeader.jsx` file now includes a `Plugins` component that displays the enabled plugins.
feat(langchain): add OpenAICreateImage tool for generating images based on user prompts
fix(langchain): update validateTools to include create-image tool
fix(langchain): save plugin data to messageSchema
fix(server/routes/askGPTPlugins.js): save userMessage and response to messageSchema
feat(langchain): add SelfReflectionTool
Add a new tool to the LangChain agent, SelfReflectionTool, which enhances the agent's self-awareness by reflecting on its thoughts before taking action. The tool provides a space for the agent to explore and organize its ideas in response to the user's message.
Also, update the prefix message to reflect the changes in the agent's behavior and the way it should engage with the user. The prefix message now emphasizes the use of tools when necessary, and relying on the agent's knowledge for creative requests. It also provides clear instructions on how to use the 'Action' input and how to carry out tasks in the sequence written by the human.
Finally, update the OpenAICreateImage tool to return the image URL in markdown format. The tool replaces newlines and spaces in the input text with hyphens to create a valid markdown link.
Milestone commit: better error handling with custom output parser, dir and file re-org
style(langchain): fix formatting and add comments to prefix.js
fix(langchain): remove commented out code in test6.js
feat(langchain): reduce maxAttempts from 3 to 2 in CustomChatAgent's buildPromptPrefix method
feat(langchain): add null check for result.output in CustomChatAgent's buildPromptPrefix method
style(langchain): improve consistency and readability of code
This commit improves the consistency and readability of the code in the langchain directory. Specifically, it:
- Changes the case of the "Thought" output in the CustomChatAgent class to match the "Thought" output in the SelfReflectionTool class.
- Adds a currentDateString property to the CustomChatAgent class to avoid repeating the same code in multiple places.
- Updates the prefix in the prefix.js file to match the current objectives of the ChatGPT model.
- Changes the description of the OpenAICreateImage tool to request a description of the image to be generated.
- Updates the tools used by the ChatAgent in the askGPTPlugins.js file to include the Google and Browser tools instead of the Calculator and Create-Image tools.
feat: add wolfram, improve image creation, rename to dall-e
* refactor(langchain): update language and formatting in various files
- Update tool-based instructions to use proper Markdown syntax for image URLs
- Adjust temperature for modelOptions in CustomChatAgent class
- Comment out console.debug statement in CustomChatAgent class
- Update prefix in initializeCustomAgent function to use proper line breaks
- Update prefix in instructions.js to use proper line breaks and change "user" to "human"
- Update input in test6.js to use Ezra Pound instead of Hemingway
- Update return statement in OpenAICreateImage class to use "generated-image" as alt-text
- Update description in SelfReflectionTool class to provide clearer instructions
- Update tools in ask function in askGPTPlugins.js to use only the DALL-E tool and enable debug mode
feat(ask): add support for DALL-E tool in formatAction function
feat(ask): add support for self-reflection tool in formatAction function
feat(Plugin.jsx): add support for self-reflection tool in Plugin component
fix(Plugin.jsx): fix Plugin component to not display 'None' when latest is not available
* docs(openaiCreateImage.js): update tool description to clarify usage
* feat(agent.js): add message parameter to initialize function
feat(agent.js): pass message parameter to SelfReflectionTool constructor
feat(customAgent.js): add longestToolName variable to CustomOutputParser
feat(openaiCreateImage.js): replace new lines with spaces in prompt parameter
feat(selfReflection.js): add message parameter to SelfReflectionTool constructor
feat(selfReflection.js): add placeholder response to selfReflect function
* feat: frontend plugin selection
* fix: agent updates, available tools via endpoint config
* fix: improve frontend plugin selection
* feat: further customize agent and bypass executor when no tools are provided
* fix: key issue in multiselect and allow setting changes during convo in plugins endpoint
* fix: convo will save modelOptions, fix persistent errors with agent
* fix: add looser final answer parsing and edit action formatting
* fix: handle edge case where stop token is not hit and causes long parsing error
* feat: trying new prompt for image creation
* fix: improvements based on gpt-3.5
* feat: allow setting model options throughout plugin conversation
* fix: agent adjustments
* improve final reply for gpt-4, gpt-3.5 needs a more stable approach
* fix: better context output for gpt-3.5
* fix: added clarification for better context output for gpt-3.5
* feat(PluginsOptions): add advanced mode to show/hide options
style(PluginsOptions): add styles for advanced mode and show/hide options
* minor changes to styling
* refactor(langchain): add support for custom GPT-4 agent
This commit adds support for a custom GPT-4 agent in the langchain
module. The `CustomGpt4Agent` class extends the `ZeroShotAgent` class
and includes a new `createPrompt` method that generates a prompt
template for the agent. The `initializeCustomAgent` function has been
updated to use the `CustomGpt4Agent` class when the model is not GPT-3.
The `instructions.js` file has also been updated to include new
instructions for the GPT-4 agent. The `formatInstructions` method has
been removed and replaced with `gpt4Instructions` and `prefix2` and
`suffix2` have been added to include the new instructions.
feat(langchain): add custom output parser for langchain agents
This commit adds a custom output parser for langchain agents. The new parser is called CustomOutputParser and it extends ZeroShotAgentOutputParser. It takes a fields object as a parameter and sets the tools and longestToolName properties. It also sets the finishToolNameRegex property to match the final answer. The parse method of the CustomOutputParser class takes a text parameter and returns an object with returnValues, log, and toolInput properties.
This commit also adds a Gpt4OutputParser class that extends ZeroShotAgentOutputParser. It takes a fields object as a parameter and sets the tools and longestToolName properties. It also sets the finishToolNameRegex property to match the final answer. The parse method of the Gpt4OutputParser class takes a text parameter and returns an object with returnValues, log, and toolInput properties.
feat(langchain): add isGpt3 parameter to
* Stable Diffusion Plugin (#204)
* Added stable diffusion plugin
* Added example prompt
* Fixed naming
* Removed brackets in the prompt
* fix: improved agent for gpt-3.5
* fix: outparser, gpt3 instructions, and wolfram error handling
* chore: update langchain to 0.0.71
* fix: long parsing action input fix
* fix: make plugin select close on clicking label/button
* fix: make plugin select close on clicking label/button
* fix: wolfram input formatting and gpt-3 payload without plugins
* chore(api): update axios package version to 1.3.4
feat(api): add requireJwtAuth middleware to askGPTPlugins endpoint
fix(api): replace session user with user id in askGPTPlugins endpoint
docs(LOCAL_INSTALL.md): update guide for local installation and testing
This commit updates the guide for local installation and testing of the
ChatGPT-Clone app. It includes instructions for locally running the app,
updating the app version, and running tests. It also includes a new
option for running the app using Docker. The commit also fixes some
typos and formatting issues.
* add reverseProxy to plugins client
* chore(Dockerfile-app): add Dockerfile for building and running the app in a container
docs: remove outdated guides on Google search and Bing jailbreak mode
docs(LOCAL_INSTALL.md): remove outdated Windows installation instructions and update MeiliSearch configuration file
* fix: handle n/a parsing error better, reduce token waste if no agentic behavior is needed
* style: fix formatting and add parentheses around arrow function parameter
style: change hover background color to white and dark hover background color to gray-700
* chore: re-organize agent dir and files
* feat(ChatAgent.js): add support for PlanAndExecuteAgentExecutor
feat(PlanAndExecuteAgentExecutor.js): add PlanAndExecuteAgentExecutor class
feat(planExecutor.js): add demo for PlanAndExecuteAgentExecutor
* feat: add azure support to plugins
* refactor(utils): add basePath endpoint for genAzureEndpoint
feat(api): add support for Azure OpenAI API in various modules and tools
* feat: add plugin api for fetching available tools
* feat: add data service for getting available plugins
* feat: first iteration plugin store UI
* refactor: rename files to follow proper naming convention
* feat: Plugin store UI components
* feat: create separate user routes, service, controller, and add plugins to user model
* feat: create data service for adding and removing plugins per user
* feat: UI for adding and removing plugins, displaying plugins in dropdown based on what user has installed
* fix: merge conflicts from main
* fix: fix plugin items titles
* fix: tool.value -> tool.pluginKey
* fix: testing returnDirect for self-reflection
* fix: add browser tool to manifest
* refactor(outputParser.js): remove commented out code
feat(outputParser.js): add support for thought input when there is no action input
* handling 'use tool' edge case
* merge main to langchain
* fix(User.js, auth.service.js, localStrategy.js): change deprecated Joi.validate() to schema.validate() method (#322)
* fix(auth.service.js): fixes deprecated error callback in mongoose save method (#323)
* chore: run formatting script with new rules
* refactor: add requiresAuth to manifest, fix uninstall button
* version with plugin auth as dialog modal
* feat: Complete frontend for plugin auth
* frontend styling updates
* feat: api for plugin auth
* feat: Add tooltip with field description to plugin auth form
* fix: issue with plugin that has no auth
* feat(tools): add support for user-specific API keys
This commit adds support for user-specific API keys for the following tools:
- Google Search API
- Web Browser
- SerpAPI
- Zapier
- DALL-E
- Wolfram Alpha API
It also adds support for OpenAI API key for the Web Browser tool.
The `validateTools` function now takes a `user` parameter and checks for user-specific API keys before falling back to environment variables.
The `loadTools` function now takes a `user` parameter and initializes the tools with user-specific API keys if available.
The `manifest.json` file has been updated to include the new `authConfig` fields for the tools that support user-specific API keys.
The `askGPTPlugins.js` file has been updated to use the `validateTools` function with the `user` parameter.
refactor(ChatAgent.js): add user parameter to initialize function and pass it to loadTools function
refactor(tools/index.js): set default value for tools parameter in validateTools function
refactor(askGPTPlugins.js): remove duplicate user variable declaration and use the one from req object
* refactor(ChatAgent.js): await validTool() before pushing to this.tools array
refactor(tools/index.js): use Map instead of Set to store valid tools
refactor(tools/index.js): filter availableTools to only validate tools passed in
refactor(PluginController.js): filter out duplicate plugins by pluginKey
refactor(crypto.js): use environment variables for encryption key and initialization vector
feat(PluginService.js): add null check for pluginAuth in getUserPluginAuthValue()
* feat(api): add credentials key and IV to .env.example for securely storing credentials
* Adds testing for handling tools, introducing a test env to the backend
Fixes bugs & optimizes code as revealed through testing, including:
- wolfram.js: fixes bug where wolfram was not handling authentication
- ChatAgent.js: ChatAgent modified to reflect 'handleTools' changes
- handleTools.js: Moves logic out of index file
- handleTools.js: loadTools: returns only requested tools
- handleTools.js: validTools: correctly returns tools based on authentication
* test(index.test.js): add test to validate a tool from an environment variable
* test(tools): add test for initializing an authenticated tool through Environment Variables
* refactor(ChatAgent.js): remove commented out code and unused imports
* refactor(ChatAgent.js): move instructions to a separate file and import them
fix(ChatAgent.js): replace hardcoded instructions with imported ones
* refactor(ChatAgent.js): change import path for TextStream
refactor(stream.js): remove unused TextStream class
* chore(.gitignore): add .env.test to gitignore
refactor(ChatAgent.js): rename CustomChatAgent to ChatAgent
test(ChatAgent.test.js): add tests for ChatAgent class
refactor(outputParser.js): remove OldOutputParser class
refactor(outputParser.js): rename CustomOutputParser to OutputParser
docs(.env.test.example): add comment explaining how to use OPENAI_API_KEY
refactor(jestSetup.js): use dotenv to load environment variables from .env.test file
* Various optimizations and config, add tests for PluginStoreDialog
* test(ChatAgent.test.js): add test to check if chat history is returned correctly
* test: unit tests for plugin store
* test: add frontend-test script to root package.json
* feat(ChatAgent.js, askGPTPlugins.js): add support for aborting chat requests (in progress)
* test: add more client tests
* feat(ChatAgent): allow plugin requests to be cancelled
* feat(ChatAgent): allow message regeneration
* feat(ChatAgent): remember last selected tools
* Remove plugins we don't yet have from manifest.json
* fix(ChatAgent.js): increase maxAttempts from 1 to 2
fix(ChatAgent.js): change error message to 'Cancelled.' if message was aborted mid-generation
fix(openaiCreateImage.js): replace unwanted characters in input string
fix(handlers.js): compare action.tool in lowercase to 'self-reflection'
* fix(ChatAgent): Fix up plugin I/O formatting for n/a actions
* refactor(Plugin.jsx): remove unused import statement
feat(Plugin.jsx): add Plugin component with svg paths and styles
* refactor: simplify credential encryption/decryption by using a single key and IV for all environments. Update crypto.js and .env.example files accordingly.
* fix(ChatAgent.js): reduce maxAttempts from 2 to 1
feat(ChatAgent.js): add model information to responseMessage object
feat(Message.js): add model field to messageSchema
feat(Message.js): add model field to message object
feat(Message.jsx): pass model information to getIcon function
feat(getIcon.jsx): add Plugin component and handle plugin messages differently
* feat(askGPTPlugins.js): add model property to the ask function response object
feat(EndpointItem.jsx): add message property to the EndpointItem component
feat(MessageHeader.jsx): add Plugin icon to the plugins section
feat(MessageHeader.jsx): change alpha to beta in the plugins section
feat(svg): add Plugin, GPTIcon, and BingIcon components to the svg folder
refactor(EndpointItems.jsx): remove unused import statement
* refactor(googleSearch.js, wolfram.js): change error handling to return a message instead of throwing an error
* refactor(CustomAgent): remove commented code and change return object to include returnValues property
* feat(CustomAgent.js): add currentDateString to createPrompt method options
deps(api/package.json): update langchain to v0.0.81
* fix: do not show pagination if the maxPage is 1
* Add Zapier back to manifest (accidentally removed)
* chore(api): update langchain dependency to version 0.0.84
* feat(DALL-E.js): add DALL-E tool for generating images using OpenAI's DALL-E API
refactor(handleTools.js): update import for DALL-E tool
refactor(index.test.js): update import for DALL-E tool
refactor(stablediffusion.js): add check for image directory existence before saving image
* refactor(CustomAgent): rename instructions prefix variable to gpt3 and add gpt4 instructions
feat(CustomAgent): add support for gpt-4 model
fix(initializeCustomAgent.js): pass model name to createPrompt method
fix(outputParser.js): set selectedTool to 'self-reflection' when tool parsing fails
* style(langchain/tools): update guidelines for image creation in DALL-E and StableDiffusion
- Update guidelines for image creation in DALL-E and StableDiffusion tools
- Emphasize the importance of "showing" and not "telling" the imagery in crafting input
- Update formatting for the example prompt for generating a realistic portrait photo of a man
- Generate images only once per human query unless explicitly requested by the user
* docs(tools): update tool descriptions for DALL-E and Stable Diffusion
- Update the description for DALL-E tool to indicate that it is exclusively for visual content and provide guidelines for generating images with a focus on visual attributes.
- Update the description for Stable Diffusion tool to indicate that it is exclusively for visual content and provide guidelines for generating images with a focus on visual attributes.
* chore(api): update "@waylaidwanderer/chatgpt-api" dependency to version "^1.36.3"
* refactor(ChatAgent.js): use environment variable for reverse proxy url
refactor(ChatAgent.js): use environment variable for openai base path
refactor(instructions.js): update gpt3 and gpt3-v2 instructions
refactor(outputParser.js): update finishToolNameRegex in CustomOutputParser class
* refactor(DALL-E.js): change apiKey and azureKey fields to uppercase
refactor(googleSearch.js): change cx and apiKey fields to uppercase
feat(manifest.json): add authConfig field for Stable Diffusion WebUI API URL
refactor(stablediffusion.js): add url field to constructor and change getServerURL() to this.url
refactor(wolfram.js): change apiKey field to uppercase WOLFRAM_APP_ID
* refactor(handleTools.js): simplify tool loading and add support for custom tool constructors and options
* refactor(handleTools.js): remove commented out code and unused imports
* refactor(handleTools.js, index.js): change file name from wolfram.js to Wolfram.js and selfReflection.js to SelfReflection.js to follow PascalCase convention
* refactor(outputParser.js, askGPTPlugins.js): improve code readability and remove unnecessary comments
* feat(GoogleSearch.js): add GoogleSearchAPI tool to allow agents to use the Google Custom Search API
feat(SelfReflection.js): add SelfReflectionTool to allow agents to reflect on their thoughts and actions
feat(StableDiffusion.js): add StableDiffusionAPI tool to allow agents to generate images using stable diffusion webui's api
feat(Wolfram.js): add WolframAlphaAPI tool for computation, math, curated knowledge & real-time data through WolframAlpha.
* testing openai specs
* doc: fix link in .env.example
* package-update
* fix(MultiSelectDropDown.jsx): handle null or undefined values in availableValues array
* refactor(DALL-E.js, StableDiffusion.js): remove 'dist/' from image path
feat(docker-compose.yml): add comments for reverse proxy configuration
* chore(.gitignore): ignore client/public/images/
fix(DALL-E.js, StableDiffusion.js): change image path from dist/ to public/
feat(index.js): add support for serving static files from client/public/ directory
* fix: remove selected tool when uninstalled
* plugin options in progress
* fix: fix issue with uninstalling a plugin that is in use and typescript errors
* feat(gptPlugins): add Preset support for GPT Plugins endpoint
feat(ChatAgent.js): add support for agentOptions object
feat(convoSchema.js): add agentOptions field to conversation schema
feat(defaults.js): add agentOptions object to defaults
feat(presetSchema.js): add agentOptions field to preset schema
feat(askGPTPlugins.js): add support for agentOptions object in request body
feat(EditPresetDialog.jsx): add support for showing/hiding GPT Plugins agent settings
feat(EditPresetDialog.jsx): add support for setting GPT Plugins agent options
fix(EndpointOptionsDialog.jsx): change endpoint name from 'gptPlugins' to 'Plugins'
feat(AgentSettings.jsx): add AgentSettings component for GPT plugins configuration
feat(client): add GPT Plugins settings component and endpoint to Settings component
fix(client): remove unused imports in GoogleOptions component
feat(PluginsOptions): add support for agent settings and refactor code
feat(PluginsOptions): add GPTIcon to show/hide agent settings button
feat(index.ts): export SVG components
feat(GPTIcon.jsx): add className prop to GPTIcon component
feat(GPTIcon.jsx): import cn function from utils
feat(BingIcon.tsx): export BingIcon component
feat(index.ts): export BingIcon component
feat(index.ts): export MessagesSquared component
refactor(cleanupPreset.js): add default values for agentOptions in gptPlugins endpoint
feat(getDefaultConversation.js, handleSubmit.js): add agentOptions object to conversation object for GPT plugins endpoint. Update default temperature value to 0.8. Add chatGptLabel and promptPrefix properties to conversation object.
* fix: set default convo back to null
* refactor(ChatAgent.js, askGPTPlugins.js, AgentSettings.jsx): change variable names for better readability and remove redundant code
* test: add RecoilRoot to layout-test-utils
* refactor(askGPTPlugins.js): remove redundant code and use endpointOption directly
feat(askGPTPlugins.js): add validation for tools in endpointOption before using it
* chore(ChatAgent.js, Settings.jsx): add agentOptions to saveConvo function and adjust Settings component height
The ChatAgent.js file was modified to include the agentOptions object in the saveConvo function. The Settings.jsx file was modified to adjust the height of the component to ensure that all content is visible.
* refactor(ChatAgent.js): extract reverseProxyUrl option to a class property and add support for it
feat(ChatAgent.js): add support for completionMode option in sendApiMessage method
feat(ChatAgent.js): add support for user-provided promptPrefix in buildPrompt method
* feat(plugins): allow preset change mid conversation
* chore: update OPENAI_KEY to OPENAI_API_KEY in .github/playwright.yml and api/.env.example
refactor(chatgpt-client.js): update OPENAI_KEY to OPENAI_API_KEY
feat(langchain): add demo-aiplugin.js and demo-yaml.js, remove test2.js, test3.js, and test4.js
chore: remove unused test files
fix(titleConvo.js): fix typo in environment variable name
fix(askGPTPlugins.js): fix typo in environment variable name
fix(endpoints.js): fix typo in environment variable name
docs: update installation guide to use OPENAI_API_KEY instead of OPENAI_KEY in .env file
* fix(index.test.js): change import of GoogleSearchAPI to use uppercase G in GoogleSearch
* chore(api): bump langchain version
* feat(PluginController.js): authenticate plugins from environment variables if they are set
feat(PluginStoreDialog.tsx): show plugin auth form only if plugin is not authenticated by env var and require authentication
feat(types.ts): add authenticated field to TPlugin type definition
* docs: update google_search.md and add stable_diffusion.md
* Update stable_diffusion.md
* refactor(Wolfram.js): remove newline characters from query before encoding
docs(wolfram.md): add instructions for setting WOLFRAM_APP_ID in api.env to bypass prompt for AppID in plugin
* refactor(Wolfram.js): replace deprecated replaceAll method with replace method
* Update wolfram.md
* fix(askGPTPlugins): error message will reference correct Parent Message
* refactor(chatgpt-client.js, ChatAgent.js): simplify maxContextTokens calculation and add promptPrefix parameter to buildPrompt method
* docs: initial draft of intro to plugins
* Update introduction.md
* Update introduction.md
* Feature: User/Reg cleanup + Install / Upgrade script for langchain (#427)
* test: login tests
* test: finish login tests
* test: initial tests for registration
* test: registration specs
* feature: Init a app config file
- Simplifies the ENV vars too
- Legacy fallbacks for older builds
* refactor(auth): Refactor log in/out controllers
- Moves both login and logout controllers to their own file
* chore(jwt): Throw warning if secret is default
* feature(frontend): Ability to disable registration
* feature(env): Env in the root + version support
ie .env.prod, .env.dev, .env.test
* feature: Upgrade .env script for users
* chore(config): Refactor and remove legacy env refs
* feature(upgrade): Upgrade script for .env changes
* feature: Install script and upgrade script
* bugfix: Uncomment line to remove old .env file
* chore: rename OPENAI_KEY to OPENAI_API_KEY
* chore: Cleanup config changes/bugs
* bugfix: Fix config and node env issues
* bugfix: Config validation logic
* bugfix: Handle unusual env configs gracefully
* bugfix: Revert route changes and fix registration disable calling
* bugfix: Fix env issues in frontend
* bugfix: Fix login
* bugfix: Fix frontend envs
* bugfix: Fix frontend jest tests
* bugfix: Fix upgrade scripts
* bugfix: Allow install in non-tty envs
* bugfix(windows): Use cross-env to set for windows
* bugfix(env): Handle .env being incorrect to begin with for client domain
* chore(merge-conflict): Update to LibreChat
* chore(merge-conflict): Update to package-lock
---------
Co-authored-by: Daniel D Orlando <dan@danorlando.com>
* chore: comment out unused agent options
* Update langchain plugins docs (#461)
* Update: install docs (LibreChat) (#458)
* Release: rename project from ChatGPT Clone to LibreChat
Release: rename project from ChatGPT Clone to LibreChat
* Release: rename project from ChatGPT Clone to LibreChat
Release: rename project from ChatGPT Clone to LibreChat
* Release: rename project from ChatGPT Clone to LibreChat
Release: rename project from ChatGPT Clone to LibreChat
* Release: rename project from ChatGPT Clone to LibreChat
Release: rename project from ChatGPT Clone to LibreChat
* Update documentation_guidelines.md
* Update introduction.md
add link to readme
* Update stable_diffusion.md
add link back to readme
* Update wolfram.md
add link back to readme
* Update README.md
add Plugins to ToC
* feat(ChatAgent.js): add support for langchainProxy configuration option
Add a new configuration option `langchainProxy` to the ChatAgent class. If the option is set, the `basePath` configuration option of the `ChatOpenAI` instance is set to the base path of `langchainProxy`.
* bugfix(errors): Possible workaround for error flashing (#463)
* Test/user auth system client tests (#462)
* test: login tests
* test: finish login tests
* test: initial tests for registration
* test: registration specs
* chore(api): update langchain dependency to version 0.0.91
* Update introduction.md
* Update introduction.md
* Update introduction.md
* fix: no longer renders html in markdown content
fix: patch XSS vulnerability completely by handling cursor on the frontend without css/html
* fix(Content.jsx): fix cursor logic so it never shows for static messages
* bugfix(langchain): Upgrade script, docker, env and docs (#465)
* bugfix(errors): Remove incorrect manual fix from misunderstanding
* chore(env): Lets not make a .env.prod and use the prod values in the default root .env
- .env.dev will still be created
* chore(upgrade.js): Lets tell the user about .env.dev if we create it
* bugfix(env): Move to full name environments for vite
- .env.prod => .env.production
- .env.dev => .env.development
* chore(env-example): Explain how to get google login working in production
* bugfix(oauth): Minor fix to point isProduction to a correct value
* bugfix: Typo in public
* chore(docs): Update docs to note the changes to .env
* chore(docs): Include note on how to get google auth working in dev and how to disable registration
* bugfix: Fix missing env changes
* bugfix: Fix up docker to work with new env / npm changes
* Update .env.example
Cleanup the env of the palm2 instruction and fix to formating
* chore(docker): Simplify Docker deployments
- Needs work to support dev env/hotreload
* bugfix: Remove volume map for client dir
* chore(env-example): Change instructions to be more user centric
---------
Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
* update: install docs (#466)
* Add files via upload
* Update apis-and-tokens.md
* Update apis-and-tokens.md
* Update docker_install.md
* Update linux_install.md
* Rename apis-and-tokens.md to apis_and_tokens.md
* Update docker_install.md
* Update linux_install.md
* Update mac_install.md
* Update linux_install.md
* Update docker_install.md
* Update windows_install.md
* Update apis_and_tokens.md
* Update mac_install.md
* Update linux_install.md
* Update docker_install.md
* Update README.md
* Update README.md : Breaking Changes
---------
Co-authored-by: Danny Avila <110412045+danny-avila@users.noreply.github.com>
* Update README.md (#468)
add new API/Token docs to Toc
* docs: guide on how to create your own plugin
* Update make_your_own.md
* Update make_your_own.md
* feat(docker): add build args for frontend variables in Dockerfile
feat(docker-compose): add build args for frontend variables in docker-compose.yml
* Update docker_install.md
* Update docker_install.md
* Update docker_install.md
* Update docker_install.md
* docs: update (#469)
* Update: make_your_own.md
* Update README.md
add `make_your_own.md` to ToC
* Update linux_install.md
* Update mac_install.md
* Update windows_install.md
* Update apis_and_tokens.md
* Update docker_install.md
* Update docker_install.md
* Update linux_install.md
* Update mac_install.md
* Update windows_install.md
* Update apis_and_tokens.md
* Update user_auth_system.md
* Update docker_install.md
clean up of repeated information
* Update docker_install.md
* Update docker_install.md
typo
* fix: fix issue with pluginstore next and prev buttons going out of bounds
* fix: add icon for web browser plugin
* docs(GoogleSearch.js): update description of GoogleSearchAPI class to be more descriptive of its functionality
* feat(ask/handlers.js): add cursor to indicate ongoing progress of a long-running task
fix(Content.jsx): handle null content in the message stream by replacing it with an empty string (with a space so a text space is rendered)
* Update README.md
* Update README.md
* fix: plugin option stacking order
* update: web browser icon (#470)
* Delete web-browser.png
* update: web browser icon
* Update readme (#472)
* Update README.md
Discord badge now displays the number of online users
Project description has been updated to reflect current status
Feature section has been updated to reflect current capabilities
Sponsors section is now located just above the contributors section
Roadmap has been removed as it was outdated.
* Delete roadmap.md
Roadmap has been removed to streamline document maintenance.
* Update README.md
* Update README.md
* Delete CHANGELOG.md
* fix: pluginstore in mobile view getting clipped and not scrolling
* docs(linux_install.md): remove duplicate git clone command
* chore(Dockerfile): comment out nginx-client build stage
docs(README.md): update installation instructions and mention docker-compose changes
docs(features/plugins/introduction.md): bold plugin names and add emphasis to notes
* feat: add superscript and subscript support to markdown rendering
refactor: support markdown citations for BingAI
* refactor: support markdown citations for BingAI
---------
Co-authored-by: David Shin <42793498+dncc89@users.noreply.github.com>
Co-authored-by: Daniel D Orlando <dan@danorlando.com>
Co-authored-by: LaraClara <2524209+ClaraLeigh@users.noreply.github.com>
Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
2023-06-10 19:10:03 -04:00
|
|
|
envDir: '../',
|
|
|
|
|
envPrefix: ['VITE_', 'SCRIPT_', 'DOMAIN_', 'ALLOW_'],
|
2024-04-21 10:39:15 -04:00
|
|
|
plugins: [
|
|
|
|
|
react(),
|
2026-03-03 10:25:10 -05:00
|
|
|
{
|
|
|
|
|
name: 'node-polyfills-shims-resolver',
|
|
|
|
|
resolveId(id) {
|
|
|
|
|
return NODE_POLYFILL_SHIMS[id] ?? null;
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-04-21 10:39:15 -04:00
|
|
|
nodePolyfills(),
|
|
|
|
|
VitePWA({
|
|
|
|
|
injectRegister: 'auto', // 'auto' | 'manual' | 'disabled'
|
2024-08-28 12:13:14 -04:00
|
|
|
registerType: 'autoUpdate', // 'prompt' | 'autoUpdate'
|
2024-04-21 10:39:15 -04:00
|
|
|
devOptions: {
|
2025-02-22 23:42:20 +01:00
|
|
|
enabled: false, // disable service worker registration in development mode
|
2024-04-21 10:39:15 -04:00
|
|
|
},
|
2025-02-04 02:54:10 +11:00
|
|
|
useCredentials: true,
|
2025-05-28 09:27:12 -04:00
|
|
|
includeManifestIcons: false,
|
2024-04-21 10:39:15 -04:00
|
|
|
workbox: {
|
2025-05-28 09:27:12 -04:00
|
|
|
globPatterns: [
|
|
|
|
|
'**/*.{js,css,html}',
|
|
|
|
|
'assets/favicon*.png',
|
|
|
|
|
'assets/icon-*.png',
|
|
|
|
|
'assets/apple-touch-icon*.png',
|
|
|
|
|
'assets/maskable-icon.png',
|
|
|
|
|
'manifest.webmanifest',
|
|
|
|
|
],
|
2025-06-20 15:49:24 -04:00
|
|
|
globIgnores: ['images/**/*', '**/*.map', 'index.html'],
|
2025-09-08 21:53:15 -04:00
|
|
|
maximumFileSizeToCacheInBytes: 4 * 1024 * 1024,
|
2025-05-29 10:30:35 -04:00
|
|
|
navigateFallbackDenylist: [/^\/oauth/, /^\/api/],
|
2024-04-21 10:39:15 -04:00
|
|
|
},
|
2025-05-28 09:27:12 -04:00
|
|
|
includeAssets: [],
|
2024-04-21 10:39:15 -04:00
|
|
|
manifest: {
|
|
|
|
|
name: 'LibreChat',
|
|
|
|
|
short_name: 'LibreChat',
|
|
|
|
|
display: 'standalone',
|
|
|
|
|
background_color: '#000000',
|
|
|
|
|
theme_color: '#009688',
|
|
|
|
|
icons: [
|
|
|
|
|
{
|
2025-08-27 07:00:18 +01:00
|
|
|
src: 'assets/favicon-32x32.png',
|
2024-04-21 10:39:15 -04:00
|
|
|
sizes: '32x32',
|
|
|
|
|
type: 'image/png',
|
|
|
|
|
},
|
|
|
|
|
{
|
2025-08-27 07:00:18 +01:00
|
|
|
src: 'assets/favicon-16x16.png',
|
2024-04-21 10:39:15 -04:00
|
|
|
sizes: '16x16',
|
|
|
|
|
type: 'image/png',
|
|
|
|
|
},
|
|
|
|
|
{
|
2025-08-27 07:00:18 +01:00
|
|
|
src: 'assets/apple-touch-icon-180x180.png',
|
2024-04-21 10:39:15 -04:00
|
|
|
sizes: '180x180',
|
|
|
|
|
type: 'image/png',
|
|
|
|
|
},
|
2025-02-23 06:17:35 +08:00
|
|
|
{
|
2025-08-27 07:00:18 +01:00
|
|
|
src: 'assets/icon-192x192.png',
|
2025-02-23 06:17:35 +08:00
|
|
|
sizes: '192x192',
|
2025-02-26 15:02:03 -05:00
|
|
|
type: 'image/png',
|
2025-02-23 06:17:35 +08:00
|
|
|
},
|
2024-04-21 10:39:15 -04:00
|
|
|
{
|
2025-08-27 07:00:18 +01:00
|
|
|
src: 'assets/maskable-icon.png',
|
2024-04-21 10:39:15 -04:00
|
|
|
sizes: '512x512',
|
|
|
|
|
type: 'image/png',
|
|
|
|
|
purpose: 'maskable',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
sourcemapExclude({ excludeNodeModules: true }),
|
2025-02-22 23:42:20 +01:00
|
|
|
compression({
|
2025-03-26 17:16:45 +01:00
|
|
|
threshold: 10240,
|
2025-02-22 23:42:20 +01:00
|
|
|
}),
|
2025-05-29 11:08:42 -04:00
|
|
|
],
|
2025-05-28 09:27:12 -04:00
|
|
|
publicDir: command === 'serve' ? './public' : false,
|
2023-05-18 11:09:31 -07:00
|
|
|
build: {
|
2023-09-10 03:19:19 -04:00
|
|
|
sourcemap: process.env.NODE_ENV === 'development',
|
2023-05-18 11:09:31 -07:00
|
|
|
outDir: './dist',
|
2025-02-22 23:42:20 +01:00
|
|
|
minify: 'terser',
|
2023-05-18 11:09:31 -07:00
|
|
|
rollupOptions: {
|
2025-02-22 23:42:20 +01:00
|
|
|
preserveEntrySignatures: 'strict',
|
2023-05-18 11:09:31 -07:00
|
|
|
output: {
|
2025-02-22 23:42:20 +01:00
|
|
|
manualChunks(id: string) {
|
2025-09-08 21:53:15 -04:00
|
|
|
const normalizedId = id.replace(/\\/g, '/');
|
|
|
|
|
if (normalizedId.includes('node_modules')) {
|
2025-05-24 10:23:17 -04:00
|
|
|
// High-impact chunking for large libraries
|
2025-12-26 19:53:06 -05:00
|
|
|
|
|
|
|
|
// IMPORTANT: mermaid and ALL its dependencies must be in the same chunk
|
|
|
|
|
// to avoid initialization order issues. This includes chevrotain, langium,
|
|
|
|
|
// dagre-d3-es, and their nested lodash-es dependencies.
|
|
|
|
|
if (
|
|
|
|
|
normalizedId.includes('mermaid') ||
|
|
|
|
|
normalizedId.includes('dagre-d3-es') ||
|
|
|
|
|
normalizedId.includes('chevrotain') ||
|
|
|
|
|
normalizedId.includes('langium') ||
|
|
|
|
|
normalizedId.includes('lodash-es')
|
|
|
|
|
) {
|
|
|
|
|
return 'mermaid';
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-08 21:53:15 -04:00
|
|
|
if (normalizedId.includes('@codesandbox/sandpack')) {
|
2025-05-24 10:23:17 -04:00
|
|
|
return 'sandpack';
|
|
|
|
|
}
|
2025-09-08 21:53:15 -04:00
|
|
|
if (normalizedId.includes('react-virtualized')) {
|
2025-05-24 10:23:17 -04:00
|
|
|
return 'virtualization';
|
|
|
|
|
}
|
2025-09-08 21:53:15 -04:00
|
|
|
if (normalizedId.includes('i18next') || normalizedId.includes('react-i18next')) {
|
2025-05-24 10:23:17 -04:00
|
|
|
return 'i18n';
|
|
|
|
|
}
|
2025-12-26 19:53:06 -05:00
|
|
|
// Only regular lodash (not lodash-es which goes to mermaid chunk)
|
|
|
|
|
if (normalizedId.includes('/lodash/')) {
|
2025-05-24 10:23:17 -04:00
|
|
|
return 'utilities';
|
|
|
|
|
}
|
2025-09-08 21:53:15 -04:00
|
|
|
if (normalizedId.includes('date-fns')) {
|
2025-05-24 10:23:17 -04:00
|
|
|
return 'date-utils';
|
|
|
|
|
}
|
2025-09-08 21:53:15 -04:00
|
|
|
if (normalizedId.includes('@dicebear')) {
|
2025-05-24 10:23:17 -04:00
|
|
|
return 'avatars';
|
|
|
|
|
}
|
2026-02-26 16:43:24 -05:00
|
|
|
if (
|
|
|
|
|
normalizedId.includes('react-dnd') ||
|
|
|
|
|
normalizedId.includes('dnd-core') ||
|
|
|
|
|
normalizedId.includes('react-flip-toolkit') ||
|
|
|
|
|
normalizedId.includes('flip-toolkit')
|
|
|
|
|
) {
|
2025-05-24 10:23:17 -04:00
|
|
|
return 'react-interactions';
|
|
|
|
|
}
|
2025-09-08 21:53:15 -04:00
|
|
|
if (normalizedId.includes('react-hook-form')) {
|
2025-05-24 10:23:17 -04:00
|
|
|
return 'forms';
|
|
|
|
|
}
|
2025-09-08 21:53:15 -04:00
|
|
|
if (normalizedId.includes('react-router-dom')) {
|
2025-05-24 10:23:17 -04:00
|
|
|
return 'routing';
|
|
|
|
|
}
|
2025-09-08 21:53:15 -04:00
|
|
|
if (
|
|
|
|
|
normalizedId.includes('qrcode.react') ||
|
|
|
|
|
normalizedId.includes('@marsidev/react-turnstile')
|
|
|
|
|
) {
|
2025-05-24 10:23:17 -04:00
|
|
|
return 'security-ui';
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-08 21:53:15 -04:00
|
|
|
if (normalizedId.includes('@codemirror/view')) {
|
2025-05-24 19:47:17 -04:00
|
|
|
return 'codemirror-view';
|
|
|
|
|
}
|
2025-09-08 21:53:15 -04:00
|
|
|
if (normalizedId.includes('@codemirror/state')) {
|
2025-05-24 19:47:17 -04:00
|
|
|
return 'codemirror-state';
|
|
|
|
|
}
|
2025-09-08 21:53:15 -04:00
|
|
|
if (normalizedId.includes('@codemirror/language')) {
|
2025-05-24 19:47:17 -04:00
|
|
|
return 'codemirror-language';
|
|
|
|
|
}
|
2025-09-08 21:53:15 -04:00
|
|
|
if (normalizedId.includes('@codemirror')) {
|
2025-05-24 19:47:17 -04:00
|
|
|
return 'codemirror-core';
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-08 21:53:15 -04:00
|
|
|
if (
|
|
|
|
|
normalizedId.includes('react-markdown') ||
|
|
|
|
|
normalizedId.includes('remark-') ||
|
|
|
|
|
normalizedId.includes('rehype-')
|
|
|
|
|
) {
|
2025-05-24 19:47:17 -04:00
|
|
|
return 'markdown-processing';
|
|
|
|
|
}
|
2025-09-08 21:53:15 -04:00
|
|
|
if (normalizedId.includes('monaco-editor') || normalizedId.includes('@monaco-editor')) {
|
2025-05-24 19:47:17 -04:00
|
|
|
return 'code-editor';
|
|
|
|
|
}
|
2025-09-08 21:53:15 -04:00
|
|
|
if (normalizedId.includes('react-window') || normalizedId.includes('react-virtual')) {
|
2025-05-24 19:47:17 -04:00
|
|
|
return 'virtualization';
|
|
|
|
|
}
|
2025-09-08 21:53:15 -04:00
|
|
|
if (
|
|
|
|
|
normalizedId.includes('zod') ||
|
|
|
|
|
normalizedId.includes('yup') ||
|
|
|
|
|
normalizedId.includes('joi')
|
|
|
|
|
) {
|
2025-05-24 19:47:17 -04:00
|
|
|
return 'validation';
|
|
|
|
|
}
|
2025-09-08 21:53:15 -04:00
|
|
|
if (
|
|
|
|
|
normalizedId.includes('axios') ||
|
|
|
|
|
normalizedId.includes('ky') ||
|
|
|
|
|
normalizedId.includes('fetch')
|
|
|
|
|
) {
|
2025-05-24 19:47:17 -04:00
|
|
|
return 'http-client';
|
|
|
|
|
}
|
2025-09-08 21:53:15 -04:00
|
|
|
if (
|
|
|
|
|
normalizedId.includes('react-spring') ||
|
|
|
|
|
normalizedId.includes('react-transition-group')
|
|
|
|
|
) {
|
2025-05-24 19:47:17 -04:00
|
|
|
return 'animations';
|
|
|
|
|
}
|
2025-09-08 21:53:15 -04:00
|
|
|
if (normalizedId.includes('react-select') || normalizedId.includes('downshift')) {
|
2025-05-24 19:47:17 -04:00
|
|
|
return 'advanced-inputs';
|
|
|
|
|
}
|
2025-09-08 21:53:15 -04:00
|
|
|
if (normalizedId.includes('heic-to')) {
|
2025-06-18 06:42:15 +05:30
|
|
|
return 'heic-converter';
|
|
|
|
|
}
|
2025-05-24 19:47:17 -04:00
|
|
|
|
2025-05-24 10:23:17 -04:00
|
|
|
// Existing chunks
|
2025-09-08 21:53:15 -04:00
|
|
|
if (normalizedId.includes('@radix-ui')) {
|
2025-02-22 23:42:20 +01:00
|
|
|
return 'radix-ui';
|
|
|
|
|
}
|
2025-09-08 21:53:15 -04:00
|
|
|
if (normalizedId.includes('framer-motion')) {
|
2025-02-22 23:42:20 +01:00
|
|
|
return 'framer-motion';
|
|
|
|
|
}
|
2026-02-26 16:43:24 -05:00
|
|
|
if (
|
|
|
|
|
normalizedId.includes('node_modules/highlight.js') ||
|
|
|
|
|
normalizedId.includes('node_modules/lowlight')
|
|
|
|
|
) {
|
2025-02-22 23:42:20 +01:00
|
|
|
return 'markdown_highlight';
|
|
|
|
|
}
|
2025-09-08 21:53:15 -04:00
|
|
|
if (normalizedId.includes('katex') || normalizedId.includes('node_modules/katex')) {
|
2025-05-24 19:47:17 -04:00
|
|
|
return 'math-katex';
|
|
|
|
|
}
|
2025-09-08 21:53:15 -04:00
|
|
|
if (normalizedId.includes('node_modules/hast-util-raw')) {
|
2025-02-22 23:42:20 +01:00
|
|
|
return 'markdown_large';
|
|
|
|
|
}
|
2025-09-08 21:53:15 -04:00
|
|
|
if (normalizedId.includes('@tanstack')) {
|
2025-02-22 23:42:20 +01:00
|
|
|
return 'tanstack-vendor';
|
|
|
|
|
}
|
2025-09-08 21:53:15 -04:00
|
|
|
if (normalizedId.includes('@headlessui')) {
|
2025-02-22 23:42:20 +01:00
|
|
|
return 'headlessui';
|
|
|
|
|
}
|
|
|
|
|
|
🧩 feat: Redesign Tool Call UI with Contextual Icons, Smart Grouping, and Rich Output Rendering (#12163)
* feat: redesign tool call UI with type-specific icons, smart grouping, and rich output rendering
Replace the generic spinner/checkmark tool call UI with a modern, Cursor-inspired design:
- Add per-tool-type icons (Plug for MCP, Terminal for code, Globe for web search, etc.)
- Group 2+ consecutive tool calls into collapsible "Used N tools" sections
- Stack unique tool icons in grouped headers with overlapping circle design
- Replace raw JSON output with intelligent renderers (table, error, text)
- Restructure ToolCallInfo: output first, parameters collapsible at bottom
- Add shared useExpandCollapse hook for consistent animations
- Add CodeWindowHeader for ExecuteCode windowed view
- Remove FinishedIcon (purple checkmark) entirely
* feat: display custom MCP server icons in tool calls
Add useMCPIconMap hook to resolve MCP server names to their configured
icon paths. ToolIcon and StackedToolIcons now accept custom icon URLs,
showing actual server logos (e.g., Home Assistant, GitHub) instead of
the generic Plug icon for MCP tool calls.
* refactor: unify container styling across code blocks, mermaid, and tool output
Replace hardcoded gray colors with theme tokens throughout:
- CodeBlock: bg-gray-900/700 -> bg-surface-secondary/tertiary + border-border-light
- Mermaid dialog: bg-gray-700 -> bg-surface-secondary, text-gray-200 -> text-text-secondary
- Mermaid containers: rounded-xl -> rounded-lg, remove shadow-md for consistency
- ResultSwitcher: bg-gray-700 -> bg-surface-secondary with border separator
- RunCode: hover:bg-gray-700 -> hover:bg-surface-hover
- ErrorOutput: add border for visual consistency
- MermaidHeader/CodeWindowHeader: consistent focus outlines using border-heavy
* refactor: simplify tool output to plain text, remove custom renderers
Remove over-engineered tool output system (TableOutput, ErrorOutput,
detectOutputType) in favor of simple text extraction. Tool output now
extracts the text content from MCP content blocks and displays it as
clean readable text — no tables, no error styling, no JSON formatting.
Parameters only show key-value badges for simple objects; complex JSON
is hidden instead of dumped raw. Matches Cursor-style simplicity.
* fix: handle error messages and format JSON arrays in tool output
- Strip verbose MCP error prefixes (Error: [MCP][server][tool] tool call
failed: Error POSTing...) and show just the meaningful error message
- Display errors in red text
- Format uniform JSON arrays as readable lists (name — path) instead
of raw JSON dumps
- Format plain JSON objects as key: value lines
* feat: improve JSON display in tool call output and parameters
- Replace flat formatObject with recursive formatValue for proper
indented display of nested JSON structures
- Add ComplexInput component for tool parameters with nested objects,
arrays, or long strings (previously hidden)
- Broaden hasParams check to show parameters for all object types
- Add font-mono to output renderer for better alignment
* feat: add localization keys for tool errors, web search, and code UI
* refactor: move Mermaid components into dedicated directory module
* refactor: extract CodeBar, FloatingCodeBar, and copy utilities from CodeBlock
* feat: replace manual SVG icons with @icons-pack/react-simple-icons
Supports 50+ programming languages with tree-shaken brand icons
instead of hand-crafted SVGs for 19 languages.
* refactor: simplify code execution UI with persistent code toggle
* refactor: use useExpandCollapse hook in Thinking and Reasoning
* feat: improve tool call error states, subtitles, and group summaries
* feat: redesign web search with inline source display
* feat: improve agent handoff with keyboard accessibility
* feat: reorganize exports order in hooks and utils
* refactor: unify CopyCodeButton with animated icon transitions and iconOnly support
* feat: add run code state machine with animated success/error feedback
* refactor: improve ResultSwitcher with lucide icons and accessibility
* refactor: update CopyButton component
* refactor: replace CopyCodeButton with CopyButton component across multiple files
* test: add ImageGen test stubs
* test: add RetrievalCall test stubs
* feat: merge ImageGen with ToolIcon and localized progress text
* feat: modernize RetrievalCall with ToolIcon and collapsible output
* test: add getToolIconType action delimiter tests
* test: add ImageGen collapsible output tests
* feat: add action ToolIcon type with Zap icon
* fix: replace AgentHandoff div with semantic button
* feat: add aria-live regions to tool components
* feat: redesign execute_code tool UI with syntax highlighting and language icons
- Remove filename labels (script.py, main.rs) and line counter from CodeWindowHeader
- Replace generic FileCode icon with language-specific LangIcon
- Add syntax highlighting via highlight.js to code blocks
- Add SquareTerminal icon to ExecuteCode progress text
- Use shared CopyButton component in CodeWindowHeader
- Remove active:scale-95 press animation from CopyButton and RunCode
* feat: dynamic tool status text sizing based on markdown font-size variable
- Add tool-status-text CSS class using calc(0.9 * --markdown-font-size)
- Update progress-text-wrapper to use dynamic sizing instead of base size
- Apply tool-status-text to WebSearch, ToolCallGroup, AgentHandoff, ImageGen
- Replace hardcoded text-sm/text-xs with dynamic class across all tools
- Animate chevron rotation in ProgressText and ToolCallGroup
- Update subtitle text color from tertiary to secondary
* fix: consistent spacing and text styles across all tool components
- Standardize tool status row spacing to my-1/my-1.5 across all components
- Update ToolCallInfo text from tertiary to secondary, add vertical padding
- Animate ToolCallInfo parameters chevron rotation
- Update OutputRenderer link colors from tertiary to secondary
* feat: unify tool call grouping for all tool types
All consecutive tool calls (MCP, execute_code, web_search, image_gen,
file_search, code_interpreter) are now grouped under a single
collapsible "Used N tools" header instead of only grouping generic
tool calls.
- Remove SPECIAL_TOOL_NAMES blacklist from groupToolCalls
- Replace getToolCallData with getToolMeta to handle all tool types
- Use renderPart callback in ToolCallGroup for proper component routing
- Add file_search and code_interpreter mappings to getToolIconType
* feat: friendly tool group labels, more icons, and output copy button
- Show friendly names in group summary (Code, Web Search, Image
Generation) instead of raw tool names
- Display MCP server names instead of individual function names
- Deduplicate labels and show up to 3 with +N overflow
- Increase stacked icons from 3 to 4
- Add icon-only copy button to tool output (OutputRenderer)
* fix: execute_code spacing and syntax-highlighted code visibility
Match ToolCall spacing by using my-1.5 on status line and moving my-2
inside overflow-hidden. Replace broken hljs.highlight() with lowlight
(same engine used by rehype-highlight for markdown code blocks) to
render syntax-highlighted code as React elements. Handle object args
in useParseArgs to support both string and Record arg formats.
* feat: replace showCode with auto-expand tools setting
Replace the execute_code-only "Always show code when using code
interpreter" global toggle with a new "Auto-expand tool details"
setting that controls all tool types. Each tool instance now uses
independent local state initialized from the setting, so expanding
one tool no longer affects others. Applies to ToolCall, ExecuteCode,
ToolCallGroup, and CodeAnalyze components.
* fix: apply auto-expand tools setting to WebSearch and RetrievalCall
* fix: only auto-expand tools when content is available
Defer auto-expansion until tool output or content arrives, preventing
empty bordered containers from showing while tools are still running.
Uses useEffect to expand when output becomes available during streaming.
* feat: redesign file_search tool output, citations, and file preview
- Redesign RetrievalCall with per-file cards using OutputRenderer
(truncated content with show more/less, copy button) matching MCP
tool pattern
- Route file_search tool calls from Agents API to RetrievalCall
instead of generic ToolCall
- Add FilePreviewDialog for viewing files (PDF iframe, text content)
with download option, opened from clickable filenames
- Redesign file citations: FileText icon in badge, relevance and
page numbers in hovercard, click opens file preview instead of
downloading
- Add file preview to message file attachments (Files.tsx)
- Fix hovercard animation to slide top-to-bottom and dismiss
instantly on file click to prevent glitching over dialog
- Add localization keys for relevance, extracted content, preview
- Add top margin to ToolCallGroup
* chore: remove leftover .planning files
* fix: polish FilePreviewDialog, CodeBlock, LangIcon, and Sources
* fix: prevent keyboard focus on collapsed tool content
Add inert attribute to all expand/collapse wrapper divs so
collapsed content is removed from tab order and hidden from
assistive technology. Skip disabled ProgressText buttons from
tab order with tabIndex={-1}.
* feat: integrate file metadata into file_search UI
Pass fileType (MIME) and fileBytes from backend file records through
to the frontend. Add file-type-specific icons, file size display,
pages sorted by relevance, multi-snippet content per file, smart
preview detection by MIME type, and copy button in file preview dialog.
* fix: review fixes — inverted type check, wrong dimension, missing import, fail-open perms, timer leaks, dead code cleanup
* fix: update CodeBlock styling for improved visual consistency
* fix(chat): open composite file citations in preview
* fix(chat): restore file previews for parsed search results
* chore(git): ignore bg-shell artifacts
* fix(chat): restore readable code content in light theme
* style(chat): align code and output surfaces by theme
* chore(i18n): remove 6 unused translation keys
* fix(deps): replace private registry URL with public npm registry in lockfile
* fix: CI lint, build, and test failures
- Add missing scaleImage utility (fixes Vite build error)
- Export scaleImage from utils/index.ts
- Remove unused imports from Part.tsx (FunctionToolCall, CodeToolCall, Agents)
- Fix prettier formatting in Part.tsx (multi-line → single-line imports, conditions)
- Remove excess blank lines in Part.tsx
- Remove unused CodeEditorRef import from Artifacts.tsx
- Add useProgress mock to OpenAIImageGen.test.tsx
- Add scaleImage mock to OpenAIImageGen.test.tsx
- Update OpenAIImageGen tests to match redesigned component structure
- Remove dead collapsible output panel tests from ImageGen.test.tsx
- Add @icons-pack/react-simple-icons to Jest transformIgnorePatterns (ESM fix)
* refactor: reorganize imports order across multiple components for consistency
* fix: add scaleImage tests, delete dead ImageGen wrapper, wire up onUIAction in ToolCallInfo
- Add 7 unit tests for scaleImage utility covering null ref, scaling,
no-upscale, height clamping, landscape, and panoramic images
- Delete unused Content/ImageGen.tsx re-export wrapper (ImageGen is
imported from Parts/OpenAIImageGen via the Parts barrel)
- Wire up onUIAction in ToolCallInfo to use handleUIAction + ask from
useMessagesOperations, matching UIResourceCarousel's behavior
(was previously a silent no-op)
* refactor: optimize imports and enhance lazy loading for language icons
* fix: address review findings for tool call UI redesign
- Fix unstable array-index keys in ToolCallGroup (streaming state corruption)
- Add plain-text fallback in InputRenderer for non-JSON tool args
- Localize FRIENDLY_NAMES via translation keys instead of hardcoded English
- Guard autoCollapse against user-initiated manual expansion
- Fix CODE_INTERPRETER hasOutput to check actual outputs instead of hardcoding true
- Add logger.warn for Citations fail-closed behavior on permission errors
- Add Terminal icon to CodeAnalyze ProgressText for visual consistency
- Fix getMCPServerName to use indexOf instead of fragile split
- Use useLayoutEffect for inert attribute in useExpandCollapse (a11y)
- Memoize style object in useExpandCollapse to avoid defeating React.memo
- Memoize groupSequentialToolCalls in ContentParts to avoid recomputation
- Use source.link as stable key instead of array index in WebSearch
- Hoist rehypePlugins outside CodeMarkdown to prevent per-render recreation
* fix: revert useMemo after conditional returns in ContentParts
The useMemo placed after early returns violated React Rules of Hooks —
hook call count would change when transitioning between edit/view mode.
Reverted to the original plain forEach which is correct and equally
performant since content changes on every streaming token anyway.
* chore: remove unused com_ui_variables_info translation key
* fix: update tests and jest config for ESM compatibility after rebase
- Add ESM-only packages to transformIgnorePatterns (@dicebear, unified
ecosystem, react-dnd, lowlight, etc.) to fix Jest parse failures
introduced by dev rebase
- Update ToolCall.test.tsx to match new component API (CSS
expand/collapse instead of conditional rendering, simplified props)
- Update ToolCallInfo.test.tsx to mock OutputRenderer (avoids ESM
chain), align with current component interface (input/output/attachments)
* refactor: replace @icons-pack/react-simple-icons with inline SVGs
Inline the 51 Simple Icons SVG paths used by LangIcon directly into
langIconPaths.ts, eliminating the runtime dependency on
@icons-pack/react-simple-icons (which requires Node >= 24).
- LangIcon now renders a plain <svg> with the path data instead of
lazy-loading React components from the package
- Removes Suspense/React.lazy overhead for code block language icons
- SVG paths sourced from Simple Icons (CC0 1.0 license)
- Package kept in package.json for now (will be removed separately)
* fix: replace Plug icon with Wrench for MCP tools, remove unused i18n keys
- MCP tools without a custom iconPath now show Wrench instead of Plug,
matching the generic tool fallback and avoiding the "plugin" metaphor
- Remove unused translation keys: com_assistants_action_attempt,
com_assistants_attempt_info, com_assistants_domain_info,
com_ui_ui_resources
* fix: address second review findings
- Combine 3x getToolMeta loop into single toolMetadata pass (ToolCallGroup)
- Extract sortPagesByRelevance to shared util (was duplicated in
FilePreviewDialog and RetrievalCall)
- Deduplicate AGENT_STYLE_TOOLS Set (export from OpenAIImageGen/index.ts)
- Localize "source/sources" in WebSearch aria-label
- Add autoExpand useEffect to CodeAnalyze for live setting changes
- Log download errors in FilePreviewDialog instead of silently swallowing
- Replace @ts-ignore with @ts-expect-error + explanation in Code.tsx
- Remove dead currentContent alias in CodeMarkdown
* chore: remove @icons-pack/react-simple-icons dependency from package.json and package-lock.json
- Deleted the @icons-pack/react-simple-icons entry from both package.json and package-lock.json, following the previous refactor to use inline SVGs for icons.
* fix: address triage audit findings
- Remove unused gIdx variable (ESLint error)
- Fix singular/plural in web search sources aria-label
- Separate inline type import in ToolCallGroup per AGENTS.md
* fix: remove invalid placeholderDimensions prop from Image component
* chore: import order
* chore: import order
* fix: resolve TypeScript errors in PR-touched files
- Remove non-existent placeholderDimensions prop from Image in Files.tsx
- Fix localize count param type (number, not string) in WebSearch.tsx
- Pass full resource object instead of partial in UIResourceCarousel.tsx
- Add 'as const' to toggleSwitchConfigs localizationKey in General.tsx
- Fix SearchResultData type in Citation.test.tsx
- Fix TAttachment and UIResource test fixture types across test files
* docs: document formatBytes difference in FilePreviewDialog
The local formatBytes returns a human-readable string with units
("1.5 MB"), while ~/utils/formatBytes returns a raw number. They
serve different purposes, so the local copy is retained with a
JSDoc comment explaining the distinction.
* fix: address remaining review items
- Replace cancelled IIFE with documented ternary in OpenAIImageGen,
explaining the agent vs legacy path distinction
- Add .catch() fallback to loadLowlight() in useLazyHighlight — falls
back to plain text if the chunk fails to load
- Fix import ordering in ToolCallGroup.tsx (type imports grouped before
local value imports per AGENTS.md)
* fix: blob URL leak and useGetFiles over-fetch
- FilePreviewDialog: add cancelledRef guard to loadPreview so blob URLs
are never created after the dialog closes (prevents orphaned object
URLs on unmount during async PDF fetch)
- RetrievalCall: filter useGetFiles by fileIds from fileSources instead
of fetching the entire user file corpus for display-only name matching
* chore: fix com_nav_auto_expand_tools alphabetical order in translation.json
* fix: render non-object JSON params instead of returning null in InputRenderer
* refactor: render JSON tool output as syntax-highlighted code block
Replace the custom YAML-ish formatValue/formatObjectArray rendering
with JSON.stringify + hljs language-json styling. Structured API
responses (like GitHub search results) now display as proper
syntax-highlighted JSON with indentation instead of a flat key-value
text dump.
- Remove formatValue, formatObjectArray, isUniformObjectArray helpers
- Add isJson flag to extractText return type
- JSON output rendered in <code class="hljs language-json"> block
- Text content blocks (type: "text") still extracted and rendered
as plain text
- Error output unchanged
* fix: extract cancelled IIFE to named function in OpenAIImageGen
Replace nested ternary with a named computeCancelled() function that
documents the agent vs legacy path branching. Resolves eslint
no-nested-ternary warning.
---------
Co-authored-by: Danny Avila <danny@librechat.ai>
2026-03-25 12:31:39 -04:00
|
|
|
if (normalizedId.includes('@icons-pack/react-simple-icons/icons/')) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-22 23:42:20 +01:00
|
|
|
// Everything else falls into a generic vendor chunk.
|
2023-05-18 11:09:31 -07:00
|
|
|
return 'vendor';
|
|
|
|
|
}
|
2025-02-22 23:42:20 +01:00
|
|
|
// Create a separate chunk for all locale files under src/locales.
|
2025-09-08 21:53:15 -04:00
|
|
|
if (normalizedId.includes('/src/locales/')) {
|
2025-02-22 23:42:20 +01:00
|
|
|
return 'locales';
|
|
|
|
|
}
|
|
|
|
|
// Let Rollup decide automatically for any other files.
|
|
|
|
|
return null;
|
2023-07-14 09:36:49 -04:00
|
|
|
},
|
2024-08-28 12:13:14 -04:00
|
|
|
entryFileNames: 'assets/[name].[hash].js',
|
|
|
|
|
chunkFileNames: 'assets/[name].[hash].js',
|
2024-08-30 13:56:49 -04:00
|
|
|
assetFileNames: (assetInfo) => {
|
2025-05-24 10:23:17 -04:00
|
|
|
if (assetInfo.names?.[0] && /\.(woff|woff2|eot|ttf|otf)$/.test(assetInfo.names[0])) {
|
2025-02-22 23:42:20 +01:00
|
|
|
return 'assets/fonts/[name][extname]';
|
2024-08-30 13:56:49 -04:00
|
|
|
}
|
|
|
|
|
return 'assets/[name].[hash][extname]';
|
|
|
|
|
},
|
2023-07-14 09:36:49 -04:00
|
|
|
},
|
2023-12-11 14:48:40 -05:00
|
|
|
/**
|
2025-03-26 17:16:45 +01:00
|
|
|
* Ignore "use client" warning since we are not using SSR
|
2023-12-11 14:48:40 -05:00
|
|
|
* @see {@link https://github.com/TanStack/query/pull/5161#issuecomment-1477389761 Preserve 'use client' directives TanStack/query#5161}
|
|
|
|
|
*/
|
|
|
|
|
onwarn(warning, warn) {
|
2025-02-22 23:42:20 +01:00
|
|
|
if (warning.message.includes('Error when using sourcemap')) {
|
2023-12-11 14:48:40 -05:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
warn(warning);
|
|
|
|
|
},
|
2023-07-14 09:36:49 -04:00
|
|
|
},
|
2025-05-24 10:23:17 -04:00
|
|
|
chunkSizeWarningLimit: 1500,
|
2023-05-18 11:09:31 -07:00
|
|
|
},
|
|
|
|
|
resolve: {
|
|
|
|
|
alias: {
|
2023-07-14 09:36:49 -04:00
|
|
|
'~': path.join(__dirname, 'src/'),
|
2025-05-28 09:27:12 -04:00
|
|
|
$fonts: path.resolve(__dirname, 'public/fonts'),
|
2025-06-18 00:58:51 -04:00
|
|
|
'micromark-extension-math': 'micromark-extension-llm-math',
|
2023-07-14 09:36:49 -04:00
|
|
|
},
|
|
|
|
|
},
|
2025-05-28 09:27:12 -04:00
|
|
|
}));
|
2023-04-07 07:27:05 -07:00
|
|
|
|
|
|
|
|
interface SourcemapExclude {
|
2023-05-18 11:09:31 -07:00
|
|
|
excludeNodeModules?: boolean;
|
2023-04-07 07:27:05 -07:00
|
|
|
}
|
2025-10-23 05:04:49 +09:00
|
|
|
|
2023-04-07 07:27:05 -07:00
|
|
|
export function sourcemapExclude(opts?: SourcemapExclude): Plugin {
|
2023-05-18 11:09:31 -07:00
|
|
|
return {
|
|
|
|
|
name: 'sourcemap-exclude',
|
|
|
|
|
transform(code: string, id: string) {
|
|
|
|
|
if (opts?.excludeNodeModules && id.includes('node_modules')) {
|
|
|
|
|
return {
|
|
|
|
|
code,
|
|
|
|
|
// https://github.com/rollup/rollup/blob/master/docs/plugin-development/index.md#source-code-transformations
|
2023-07-14 09:36:49 -04:00
|
|
|
map: { mappings: '' },
|
2023-05-18 11:09:31 -07:00
|
|
|
};
|
|
|
|
|
}
|
2023-07-14 09:36:49 -04:00
|
|
|
},
|
2023-05-18 11:09:31 -07:00
|
|
|
};
|
2025-02-26 15:02:03 -05:00
|
|
|
}
|