Refactor the `load_starter_projects` function in `setup.py` to improve error handling when loading starter projects. Instead of using a try-except block around the `orjson.loads` function, the function now uses a `with` statement to open the file and handle any JSON decoding errors. This ensures that any errors are properly caught and a `ValueError` is raised with the appropriate error message. Additionally, the function now logs a message when a starter project is successfully loaded.
* ✨ (App.tsx): Introduce framer-motion library for animations in the frontend
🔧 (App.tsx): Update import path for useAutoLogin function in controllers/API/queries/auth
🔧 (index.ts): Remove autoLogin function from API controllers as it is now handled by useAutoLogin hook
🔧 (use-get-autologin.ts): Update function name to useAutoLogin and adjust return type
🔧 (use-post-login-user.ts): Update function name to loginUserFn for clarity
🔧 (LoginPage/index.tsx): Update import path for useLoginUser function in controllers/API/queries/auth
🔧 (LoginPage/index.tsx): Update function name to loginUserFn for clarity
🔧 (authStore.ts): Remove unused imports and functions related to autoLogin and login operations
* 📝 (LoginPage/index.tsx): remove unnecessary console.log statement from onSuccess callback in mutate function
* ♻️ (App.tsx): remove unused import statement for 'm' from 'framer-motion' to clean up code and improve readability
* removing abort from request
* [autofix.ci] apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: anovazzi1 <otavio2204@gmail.com>
* ✨ (App.tsx): Add useGetGlobalVariables hook to fetch global variables data
🔧 (addNewVariableButton.tsx): Replace registerGlobalVariable function with usePostGlobalVariables hook for adding new global variables
🔧 (inputGlobalComponent/index.tsx): Replace deleteGlobalVariable function with useDeleteGlobalVariables hook for deleting global variables
🔧 (authContext.tsx): Remove unused getGlobalVariables function and setGlobalVariables state from authContext
🔧 (constants.ts): Add VARIABLES constant for global variables endpoint
🔧 (index.ts): Remove getGlobalVariables, registerGlobalVariable, and deleteGlobalVariable functions from API index
✨ (variables/index.ts): Add use-delete-global-variables hook for deleting global variables
🔧 (use-delete-global-variables.ts): Implement useDeleteGlobalVariables hook for deleting global variables
✨ (use-get-global-variables.ts): Add functionality to fetch and set global variables from API
✨ (use-patch-global-variables.ts): Add functionality to update global variables via API patch request
✨ (use-post-global-variables.ts): Add functionality to create new global variables via API post request
📝 (index.tsx): Import useGetGlobalVariables hook to fetch global variables on login page
📝 (index.tsx): Call mutateGetGlobalVariables function to fetch global variables on successful login
📝 (index.tsx): Import useDeleteGlobalVariables hook to delete global variables on global variables page
📝 (index.tsx): Call mutateDeleteGlobalVariable function to delete selected global variables
📝 (index.tsx): Handle success and error cases for deleting global variables
* Removed console.log
---------
Co-authored-by: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com>
* fix(main.py): handle PydanticSerializationError in JavaScriptMIMETypeMiddleware to provide detailed error message in case of serialization error
* fix(main.py): handle PydanticSerializationError in JavaScriptMIMETypeMiddleware to provide detailed error message in case of serialization error
* improve error handling
* feat: Handle PydanticSerializationError in JavaScriptMIMETypeMiddleware
Refactor the `JavaScriptMIMETypeMiddleware` class in `main.py` to handle the `PydanticSerializationError` exception. This change ensures that a detailed error message is provided in case of a serialization error. The error message is now serialized as a JSON string and included in the `detail` field of the `HTTPException` raised.
* feat: Add tryParseJson function to utils.ts
This commit adds a new function called `tryParseJson` to the `utils.ts` file. The function attempts to parse a JSON string and returns the parsed object. If parsing fails, it returns undefined. This function can be used to safely parse JSON strings without throwing an error.
* fix: Handle error message in buildVertex function
This commit modifies the buildVertex function in buildUtils.ts to handle error messages more effectively. It adds logic to extract the error message from the AxiosError response and parse it as JSON if possible. If the error message is not an array, it converts it into an array. This change ensures that the error message is properly displayed when building a component fails.
* remove console.log
* remove not related code
---------
Co-authored-by: anovazzi1 <otavio2204@gmail.com>
* feat: update GenericNode to include lf_version in node data
* [autofix.ci] apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com>
* refactor(utils.py): simplify data processing logic in build_data_from_result_data function for better readability and maintainability
* feat: set default output type to "chat" in run_flow function
* refactor(FlowTool.py): refactor FlowToolComponent class to inherit from LCToolComponent
* Fixed Flow as Tool component
* Fixed refresh button not appearing at the end
* Added way of connecting SecretStrInput to messages
* Added real_time_refresh when field has button update too
* Refactored SubFlow component
* Fixed FlowTool to only output tool and removed async function def
* fix: two statements in the same line
* [autofix.ci] apply automated fixes
* Fixed lint issues
* fixed dataobj with wrong name
* changed tweaks dict type
* Fixed margin appearing in output too
* Fixed useless button that made styling worse on handlerendercomponent
---------
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
The unnecessary condition in the App component was causing the error modal to not appear when there was an error in the health data. This commit removes the unnecessary condition to ensure that the error modal is displayed correctly.
* Fixed dropdown component showing empty value and not showing dropdown when combobox is true
* Fixed multiselect component showing empty value and not showing dropdown when combobox is true
* Added disabled onChange on multiline and dropdown, with snapshot ignore
* Fixed tooltip skip delay duration that made tooltip on Dropdown unusable
* Fixed size of text inside dropdown and multiselect
---------
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
* Add UI feature flag config
* [autofix.ci] apply automated fixes
* hide general settings if there is nothing to show
* make sure to handle !autoLogin case
* [autofix.ci] apply automated fixes
* missed commit
* [autofix.ci] apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: anovazzi1 <otavio2204@gmail.com>
* refactor: Update useFileDrop hook to handle multiple file drops
The useFileDrop hook in use-on-file-drop.tsx has been updated to handle multiple file drops. It now accepts an array of files instead of a single file, and processes each file individually. This allows for uploading multiple files at once and improves the user experience.
* [autofix.ci] apply automated fixes
* Remove unused console.log
* Removed console.log
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com>
* refactor(utils.py): simplify data processing logic in build_data_from_result_data function for better readability and maintainability
* feat: set default output type to "chat" in run_flow function
* refactor(FlowTool.py): refactor FlowToolComponent class to inherit from LCToolComponent
* Fixed Flow as Tool component
* Fixed FlowTool to only output tool and removed async function def
* [autofix.ci] apply automated fixes
* Fixed lint
---------
Co-authored-by: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com>
Co-authored-by: Lucas Oliveira <lucas.edu.oli@hotmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* feat: Add Athena icon component
Add a new component called AthenaComponent that renders an SVG icon for Athena. This component is imported from the newly created file "athena.jsx" in the "icons/athena" directory. Additionally, an export for the AthenaIcon component is added in the "icons/athena/index.tsx" file.
* Update docs from Notion
* feat: Add RAG (Retrieval-Augmented Generation) components documentation
This commit adds documentation for RAG (Retrieval-Augmented Generation) components. It explains how these components process a user query by retrieving relevant documents and generating a concise summary that addresses the user's question. The documentation includes information about the Vectara component, its parameters, and the Vectara corpus. For more details, refer to the [Vectara documentation](https://docs.vectara.com/docs).
---------
Co-authored-by: ogabrielluiz <ogabrielluiz@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
* check nodes to update on build flow
* feat: update componentsToUpdate logic in flowStore.ts
The `updateComponentsToUpdate` function in `flowStore.ts` has been updated to properly check for outdated nodes. This ensures that components are only updated when necessary, improving performance and preventing unnecessary re-renders.
* [autofix.ci] apply automated fixes
* Update src/frontend/src/stores/flowStore.ts
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
* refactor: update langchain-core to version 0.2.24
* refactor: convert inner messages to BaseMessage in load_lc_prompt method
* refactor: update ChatPromptTemplate instantiation in message.py
* refactor: update langflow-base dependency to use local path for development
* [autofix.ci] apply automated fixes
* refactor: update ChatPromptTemplate instantiation in message.py
* refactor: add async_from_template_and_variables and sync from_template_and_variables
* feat(tests): add unit test for Message schema serialization and prompt loading
* refactor: update langchain-core dependency to version 0.2.24
* chore: new lock
* mypy
* chore: format pyproject
* refactor: rename async_from_template_and_variables to from_template_and_variables in Message class
* refactor: Rename async_from_template_and_variables to from_template_and_variables in Message class
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Nicolò Boschi <boschi1997@gmail.com>
* Updates and changes to the Makefile:
1. Added removal of `frontend` directory inside `src/backend/base/langflow/` and `build` directory inside `src/frontend/` to the `clean_npm_cache` target.
2. Added descriptive comments for the `build_and_install`, `build_and_run`, `fix_codespell`, `setup_poetry`, `unit_tests`, `integration_tests`, and `tests_frontend` targets.
Looking forward to your feedback.
* Improvements: Structure and Functionality Improvements
- Reorganized commands to facilitate understanding of the structure
- Enhanced check_tools to detect the Python version
- Added a multi-environment script to support check_tools
- make init now builds the frontend and runs the application
- Aesthetic improvements in output messages
TO-DO:
- Reorganize container-related commands
- Reorganize other miscellaneous utilities
- Document usage in the application docs
- Prepare the dev environment following the maintainers' recommended practices
* Removed pre-commit as it is no longer used.
* Restored 'patch' command in Makefile, it updates the 'pyproject.toml' with the new project version.
---------
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
* 📝 (flows.py): refactor delete_multiple_flows function to improve readability and efficiency
✨ (use-delete-flows.ts): add useDeleteFlows hook to handle deletion of multiple flows in frontend
♻️ (index.tsx): refactor handleDeleteMultiple function to use useDeleteFlows hook for deleting multiple flows
🔧 (actionsMainPage-shard-1.spec.ts): add test for selecting and deleting a flow in end-to-end tests
* 📝 (flows.py): Remove unused imports and variables to clean up the code and improve readability
♻️ (flows.py): Refactor code to remove unnecessary import and variable declarations, making the code more concise and maintainable
* add unit tests to delete multiple flows with transactions and build
* format
* add assert on tests
feat: Update Textarea component to have full height
The Textarea component was updated to have a full height by adding the "h-full" class to the parent div. This ensures that the textarea takes up the entire available vertical space.
* feat: Add GitLoader Component with advanced filtering options
This commit introduces the GitLoaderComponent, enabling users to load files from a Git repository with advanced filtering options.
GitLoader Component:
- Implementation of the GitLoaderComponent to load files from a Git repository using the `langchain_community.document_loaders.git.GitLoader` module.
- Advanced filtering option using `file_filter` to include or exclude specific files based on their extensions or other criteria.
Examples of `file_filter` usage:
- Include only .py files: `lambda file_path: file_path.endswith('.py')`
- Exclude .py files: `lambda file_path: not file_path.endswith('.py')`
This component ensures a flexible and customizable approach for loading documents from Git repositories, enhancing the user experience with advanced filtering capabilities.
Features:
- Support for loading documents from Git repositories.
- Advanced file filtering options to include or exclude specific files.
* feat: Add GitLoader Component with advanced filtering options
This commit introduces the GitLoaderComponent, enabling users to load files from a Git repository with advanced filtering options.
GitLoader Component:
- Implementation of the GitLoaderComponent to load files from a Git repository using the `langchain_community.document_loaders.git.GitLoader` module.
- Advanced filtering option using `file_filter` to include or exclude specific files based on their extensions or other criteria.
Examples of `file_filter` usage:
- Include only .py files: `lambda file_path: file_path.endswith('.py')`
- Exclude .py files: `lambda file_path: not file_path.endswith('.py')`
This component ensures a flexible and customizable approach for loading documents from Git repositories, enhancing the user experience with advanced filtering capabilities.
Features:
- Support for loading documents from Git repositories.
- Advanced file filtering options to include or exclude specific files.
* fix: Ensure proper evaluation and validation of file_filter in GitLoaderComponent
This commit fixes the issue where the GitLoaderComponent would fail if the file_filter input was not evaluated correctly. Changes include:
- Added a check to ensure that file_filter is a valid string before calling eval.
- Ensured that the evaluated file_filter is callable, otherwise it defaults to None.
* [autofix.ci] apply automated fixes
* feat: Enhance GitLoaderComponent with dynamic inputs, content filtering
- Changed inputs from `StrInput` to `MessageTextInput` to enable dynamic use with agents.
- Added `content_filter` field to allow additional content filtering using regex.
- Updated `file_filter` to support glob format, simplifying usage for users.
- Implemented binary file removal filter to exclude binary files from queries, aligning with the agent's purpose.
* [autofix.ci] apply automated fixes
* [autofix.ci] apply automated fixes (attempt 2/3)
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* fix: tool calling and openai tools do not include chat history
* fix import
* [autofix.ci] apply automated fixes
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* ✨ (constants.ts): add BUILDS endpoint to URLs constants
✨ (index.ts): create index file for builds-related queries
✨ (use-delete-builds.ts): implement useDeleteFLowPool hook for deleting builds
* ✨ (chatView): integrate useDeleteFlowPool hook for deleting flow pool
♻️ (chatView): refactor clearChat function to use mutateFlowPool for deletion
* ♻️ (use-delete-builds.ts): rename useDeleteFLowPool to useDeleteBuilds for clarity
♻️ (index.tsx): update import and usage of useDeleteFLowPool to useDeleteBuilds
* ✨ (API): add use-get-builds query to fetch build data
✨ (PageComponent): integrate use-get-builds query for fetching builds
✨ (flowStore): add setters for inputs, outputs, and hasIO in flowStore
* ♻️ (flowStore.ts): refactor hasIO to derive its value from inputs and outputs
🔥 (flowStore.ts): remove unused resetFlow function to clean up the codebase
* ♻️ (use-get-builds.ts): refactor useGetBuildsQuery to remove unused params
✨ (PageComponent): add logic to handle flow state, inputs, outputs, and viewport
♻️ (flowStore): refactor and add resetFlow method to handle flow state reset
* ✅ (chatComponent): add data-testid attributes for better testability
✅ (generalBugs-shard-3.spec.ts): add end-to-end test for playground button state
---------
Co-authored-by: anovazzi1 <otavio2204@gmail.com>
✨ (headerComponent/index.tsx): Add functionality to handle user logout in the header component
🔧 (api.tsx): Add useLogout and useRefreshAccessToken functions to handle user logout and access token refresh
🔧 (use-post-logout.ts): Implement useLogout function to handle user logout functionality
🔧 (use-post-refresh-access.ts): Implement useRefreshAccessToken function to handle access token refresh
🔧 (authStore.ts): Remove unnecessary imports and update the authStore functionality for user logout and access token management.
Co-authored-by: anovazzi1 <otavio2204@gmail.com>
* ♻️ (crud.py): refactor delete_vertex_builds_by_flow_id function to correctly delete vertex builds by flow_id using relationship attribute instead of column comparison.
* 📝 (generalBugs-shard-0.spec.ts): Remove unnecessary test case and add new test case for chat messages clearing functionality
✨ (generalBugs-shard-8.spec.ts): Add new test case for interacting with API request
✨ (generalBugs-shard-9.spec.ts): Add new test case for testing chat memory functionality