* refactor(base.py): remove unnecessary conditional statements for adding edges to predecessor and successor maps in Graph class
* refactor(graph/base.py): optimize the process of adding vertices to the set and updating the predecessor map in the Graph class
* refactor(graph/base.py): remove unnecessary line that adds vertex_id to vertices_ids set
refactor(graph/base.py): fix indentation for predecessor_map and successor_map dictionaries to improve code readability
* feat: Add vertices_being_run set to RunnableVerticesManager
This commit adds a new set called `vertices_being_run` to the `RunnableVerticesManager` class. This set keeps track of vertices that are currently running. The purpose of this set is to prevent a vertex from being considered runnable if it is already being run.
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
* chore: Remove unnecessary vertex from next_runnable_vertices in RunnableVerticesManager
* feat: Update vertices_to_run logic in retrieve_vertices_order function
This commit updates the logic for retrieving the vertices to run in the `retrieve_vertices_order` function in `chat.py`. The previous implementation used the `list` function to convert the `vertices_to_run` set to a list and then concatenated it with the result of the `get_top_level_vertices` function. The updated logic uses the `union` method to combine the two sets directly. This change improves the efficiency and readability of the code.
* refactor(graph/base.py): optimize the process of adding vertices to the set and updating the predecessor map in the Graph class
* feat: Add aiofiles package for asyncio file support
* fix: add async component in webhook test flow
* refactor: deactivate astra db test
* refactor: remove AstraDB test and related code
* feat: add component that makes an async api call
* chore: Update langsmith and sentry-sdk dependencies to latest versions
fix: Remove redundant superuser only if it has never logged in
The code changes in `utils.py` check if the superuser exists and if it has never logged in. If both conditions are true, the superuser is deleted from the database. This improves the efficiency and security of the application.
* Fixed Check Code Validity to set outdated as false when type does not exist
* feat: Refactor update_template_values function
Refactor the `update_template_values` function to improve code readability and maintainability. Rename the parameters `frontend_template` to `new_template` and `raw_template` to `previous_template` for clarity. Update the variable names within the function accordingly.
* feat(update_template_field): update load_from_db in case field value is not the default
* refactor: update template values in PromptComponent
Update the `update_template_values` function in the `PromptComponent` class to improve code readability and maintainability. Rename the parameters `frontend_template` to `new_template` and `raw_template` to `previous_template` for clarity. Update the variable names within the function accordingly.
---------
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
* feat: update RunnableVerticesManager to include an update_run_state method
* feat: refactor build_run_map method in RunnableVerticesManager
This commit refactors the `build_run_map` method in the `RunnableVerticesManager` class. Instead of directly accessing the `graph` object, it now takes `predecessor_map` and `vertices_to_run` as parameters. This improves code readability and maintainability.
* fix(state): set vertices_to_run and predecessor_map correctly when updating a state
* fix: set inactive vertices to active when updating graph
* fix: add conditions to avoid duplicated vertices in maps
This commit fixes a bug in the Graph class where the predecessor and successor maps were not being updated correctly. The bug caused incorrect mapping of edges in the graph. This fix ensures that the maps are updated properly when adding edges to the graph.
* refactor: fix vertex build response in chat.py
This commit fixes the `build_vertex` function in `chat.py` to correctly handle the `VertexBuildResponse` object. The `inactivated_vertices`, `next_vertices_ids`, and `top_level_vertices` attributes are now converted to lists to remove any duplicate values. This ensures that the response object contains unique values for these attributes. The fix improves the accuracy and reliability of the vertex build process.
* style(graph/base.py): update type annotations for predecessor_map and successor_map variables to improve code readability and maintain consistency
* fix: uncomment code for stopping build in MenuBar component
* chore: update version to 0.0.83 in pyproject.toml
* chore: update version to 1.0.7 in pyproject.toml
---------
Co-authored-by: Cristhian Zanforlin Lousa <72977554+Cristhianzl@users.noreply.github.com>
* fix: add user to database if not already present in health_check
The code changes in `health_check_router.py` add functionality to check if a user with a specific ID exists in the database. If the user does not exist, the code adds the user to the database with the necessary details. This ensures that the user is present in the database for further processing in the health check.
* style(health_check_router): format
♻️ (App.tsx): remove console.log statement from setRetry function
🐛 (fetchErrorComponent): add onClick handler to Retry button to ensure retry logic is executed
* Refactor DirectoryComponent to filter file paths by types
* fix: sets types is_list to True
* chore: Remove Optional from load_directory method signature
* chore: Update return type annotation for load_directory method
* style(GroqModel.py): improve code readability by fixing indentation and adding a comment for type hint ignore in ChatGroq instantiation.
---------
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
* fix(langflow): handle KeyboardInterrupt and terminate process in run function for graceful shutdown
* refactor(langflow): remove unnecessary try-except block and sys.exit calls in run_langflow function
* fix(langflow): handle exceptions properly and exit with appropriate status codes
* refactor: update multiprocess imports in langflow/__main__.py
Adds type ignore
* refactor(base.py): refactor logic to find start_component_id based on multiple keywords for improved flexibility and readability
* feat(schema.py): add WebhookInput component type to INPUT_COMPONENTS list for handling webhook inputs in the graph schema
* refactor(base.py): refactor logic to determine start_component_id based on webhook or chat component presence in input vertices
* refactor: prioritize webhook component for determining start_component_id
* ⚡️ Speed up convert_kwargs() by 9%
To optimize the given Python program, we can focus on a few key areas.
1. **Avoid Repeated Lookups:** Instead of repeatedly looking up keys and values in the dictionary, we can iterate over items directly.
2. **Efficient JSON Parsing:** Using `orjson` is already a good choice for performance. We will handle the exception based on `orjson` capabilities.
3. **In-place Modification:** We can modify the dictionary in place without creating additional lists.
Here is the optimized program.
### Changes Made.
1. **Direct Looping:** We iterate directly over `params.items()` to process keys and values together, which helps avoid multiple lookups.
2. **Exception Handling:** We catch `orjson.JSONDecodeError` directly, avoiding unnecessary import and potential mismatches.
3. **Deferred Removal:** We collect keys to remove in `items_to_remove` and then remove them outside the loop, which helps avoid modification issues during iteration.
This should result in more efficient iteration and handling while reducing overhead from unnecessary operations.
* [autofix.ci] apply automated fixes
---------
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: codeflash-ai[bot] <148906541+codeflash-ai[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* Refactored mutation and query types and callables
* Refactored version and other queries to new way of calling function
* update type declaration to support options
* update getVersionQuery
* [autofix.ci] apply automated fixes
* update type declaration to remove on Fetch options
* remove onFetch from version
* update transactions query
* [autofix.ci] apply automated fixes
---------
Co-authored-by: anovazzi1 <otavio2204@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
* feat: Add outputs to TypeScript test workflow
The recent code changes added outputs to the TypeScript test workflow in order to capture the status of the tests. This will allow for better visibility and tracking of test failures.
* chore: Add conditional step to merge-reports job in TypeScript test workflow
* refactor: add new use-query endpoint of upload files
* extend type for payload callbackSuccess
* [autofix.ci] apply automated fixes
* bugfix: drag and drop image on chat not working
* Refactored query function to use Options
* Used dedicated function as queryFn
* ✨ (API): export use-post-upload-file in files index
♻️ (FileInput): refactor file upload mutation to use onSuccess and onError
♻️ (chatInput): refactor file upload mutation to use onSuccess and onError
♻️ (chatView): refactor file upload mutation to use onSuccess and onError
* ♻️ (use-get-download-images.ts): simplify getDownloadImagesFn function
♻️ (use-get-transactions.ts): simplify getTransactionsFn function
✨ (use-handle-file-change.tsx): add hook to handle file input changes
✨ (use-upload.tsx): add hook to handle file paste events
* Added type on Request Processor
---------
Co-authored-by: anovazzi1 <otavio2204@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Lucas Oliveira <lucas.edu.oli@hotmail.com>
* ✅ (tests): remove redundant test assertions in filterEdge-shard-0.spec.ts
✅ (tests): add new test assertions and remove redundant ones in filterEdge-shard-1.spec.ts
* ✅ (filterSidebar.spec.ts): add test for visibility of helpersID Generator
♻️ (filterSidebar.spec.ts): remove redundant visibility test for textsplittersCharacterTextSplitter
---------
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
* refactor(base.py): refactor logic to find start_component_id based on multiple keywords for improved flexibility and readability
* feat(schema.py): add WebhookInput component type to INPUT_COMPONENTS list for handling webhook inputs in the graph schema
* refactor(base.py): refactor logic to determine start_component_id based on webhook or chat component presence in input vertices
* refactor: prioritize webhook component for determining start_component_id
* feat(utils.py): add function find_start_component_id to find component ID based on priority list of input types
* refactor(graph/base.py): refactor logic to find start component id in Graph class for better readability and maintainability
* test(test_webhook.py): override pytest fixture to check for OpenAI API key in environment variables before running tests
* test(test_webhook.py): update webhook json
* feat(schema.py): update WebhookInput component type name
* refactor: log package run telemetry in simplified_run_flow
* test: add test for webhook flow on run endpoint
* refactor(graph/base.py): skip unbuilt vertices when getting vertex outputs in Graph class
* refactor: simplify data_input assignment in LCTextSplitterComponent
* refactor: remove unused build method in CharacterTextSplitterComponent
* refactor: update imports in CharacterTextSplitter.py
* chore: update conventional-labeler action to version 2.0.0
* chore: add 'bug' label to fix category in release.yml
* chore(conventional-labels.yml): add 'Validate PR' job to validate pull requests before labeling them
chore(conventional-labels.yml): add 'Label PR' job to label pull requests after validation is successful
* chore(conventional-labels.yml): update conditional statement in Label PR job to exclude Bot users from linting and only run if PR validation is successful
* chore(conventional-labels.yml): update type_labels mapping to align with conventional commit keywords for better labeling in GitHub actions.
* fix(conventional-labels.yml): run workflow only on editing the PR
* chore(conventional-labels.yml): do not require an issue reference
* feat: Add GitHub Actions workflow for labeling PRs with Conventional Commits
* feat(release.yml): add release.yml file with predefined categories for changelog to improve consistency and clarity in release notes
* style(release.yml): change 'perf' label to 'performance' for better clarity and consistency across labels in changelog section
* fix(tracing/service.py): remove wait_for_all_tracers call
* refactor: set reasonable timeout for TelemetryService client
* fix: handle HTTP and request errors in TelemetryService
Handle HTTPStatusError and RequestError exceptions separately in the send_telemetry_data method of TelemetryService to provide more specific error messages. Also, catch any unexpected exceptions and log them with an appropriate error message.
* fix: cancel worker task and close client in TelemetryService stop method
Cancel the worker task and close the client in the stop method of TelemetryService to ensure proper cleanup and prevent potential resource leaks. Also handle any exceptions that may occur during the cleanup process and log appropriate error messages.
* style(telemetry/service.py): fix indentation issue in await statement to comply with PEP8 guidelines
* feat(graph): add method to remove vertex from runnables in Graph class
* fix(chat.py): fix issue where vertex was not being removed from runnables list to prevent duplication of results
* fix(chat.py): defines when the end_all_traces call should happen
* chore: update py_autofix.yml workflow to run Ruff Check and Format
* ci(js_autofix.yml): remove unnecessary pull request types to trigger workflow only on changes in src/frontend directory
Handle the case where the artifact type is unknown and the raw value is not None in the post_process_raw function. Set the raw value to "Built Successfully ✨" in this case.