Commit graph

10,618 commits

Author SHA1 Message Date
Gabriel Luiz Freitas Almeida
67207eb171
Fix endpoint URL interpolation issue in getCurlCode (#2026)
* chore: Update getCurlCode to fix endpoint URL interpolation issue
2024-05-30 13:18:56 -07:00
Gabriel Luiz Freitas Almeida
eb68558905
Update utils.py to handle SecretStr field type as str with password and load_from_db attributes (#2005)
* chore: Update utils.py to handle SecretStr field type as str with password and load_from_db attributes

* Update utils.py to handle SecretStr field type as str with password and load_from_db attributes
2024-05-30 12:02:54 -07:00
Gabriel Luiz Freitas Almeida
4c113d5ac0
Add Upstash Vector Store support (#2004)
* docs(migration): add UPSTASH_VECTOR_REST_URL and UPSTASH_VECTOR_REST_TOKEN to the list of default environment variables
pyproject.toml: add upstash-vector package as a dependency with version 0.4.0
src/backend/base/langflow/components/vectorsearch/UpstashSearch.py: create UpstashSearchComponent for implementing a Vector Store using Upstash
src/backend/base/langflow/components/vectorstores/Upstash.py: create UpstashVectorStoreComponent for implementing a Vector Store using Upstash
src/backend/base/langflow/services/settings/constants.py: add UPSTASH_VECTOR_REST_URL and UPSTASH_VECTOR_REST_TOKEN to the list of variables to get from the environment

*  (UpstashSearch.py): Add support for 'number_of_results' and 'text_key' parameters in UpstashSearchComponent to enhance search functionality
♻️ (Upstash.py): Refactor UpstashVectorStoreComponent to include 'text_key' parameter for consistency and improved functionality

* ♻️ (Upstash.py): refactor UpstashVectorStoreComponent to improve code readability and maintainability by restructuring the instantiation of UpstashVectorStore instances based on conditions and adding support for adding documents directly to the instance.

* feat: Update langchain-core, langchainhub, langsmith, and requests dependencies to latest versions
2024-05-30 12:02:40 -07:00
Gabriel Luiz Freitas Almeida
39f86a409a
feat: Add Docker Hub propagation wait and HuggingFace Spaces build restart (#2024)
The code changes include adding a new step in the `.github/workflows/docker-build.yml` file to wait for Docker Hub to propagate. Additionally, a new script `factory_restart_space.py` is added in the `scripts` directory to restart the HuggingFace Spaces build. This script uses the `HfApi` and `rich` libraries to interact with the HuggingFace Hub API and print the space runtime.

Note: The commit message has been generated based on the provided code changes and recent commits.
2024-05-30 12:01:09 -07:00
ogabrielluiz
764fcfcfd1 feat: Add Docker Hub propagation wait and HuggingFace Spaces build restart
The code changes include adding a new step in the `.github/workflows/docker-build.yml` file to wait for Docker Hub to propagate. Additionally, a new script `factory_restart_space.py` is added in the `scripts` directory to restart the HuggingFace Spaces build. This script uses the `HfApi` and `rich` libraries to interact with the HuggingFace Hub API and print the space runtime.

Note: The commit message has been generated based on the provided code changes and recent commits.
2024-05-30 16:00:01 -03:00
Rodrigo Nader
92674a7f03
Update README.md 2024-05-30 15:15:57 -03:00
Mendon Kissling
e22f0c2d9d
[Docs] - Example Components (#2022)
* Remove outdated pages from example folder
* Repopulate with component-of-the-day pages with videos
* Update Notion index image
* Python version 3.10 -> Python >= 3.10
2024-05-30 12:08:35 -04:00
Mendon Kissling
572f26f5a3 strip-old-links 2024-05-30 12:05:38 -04:00
Nicolò Boschi
7abfb0b232
feat: read flows from local directory at startup (#1989)
* feat: read flows from local directory at startup

* cleanup

* add check

* fix

* fix

* fix by endpoint name

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-05-30 08:58:57 -07:00
Nicolò Boschi
44121515ed
fix: create superuser at startup to avoid concurrency issues (#2019)
* fix: create superuser at startup to avoid concurrency issues

* fix import

* fix mypy

* fix mypy
2024-05-30 08:54:48 -07:00
Mendon Kissling
c8716a9c22 Merge branch 'dev' into docs-example-components 2024-05-30 11:51:04 -04:00
Mendon Kissling
b4152c8a5f update-notion-image 2024-05-30 11:38:55 -04:00
Mendon Kissling
d757f1a703 repopulate-examples 2024-05-30 11:35:42 -04:00
Gabriel Luiz Freitas Almeida
94e8bf1e2b
Add support for running flows by endpoint name (#2012)
* feat: Add support for running flows by endpoint name

This commit modifies the `simplified_run_flow` endpoint in `endpoints.py` to allow running flows using the endpoint name instead of the flow ID. It introduces a new route parameter `flow_id_or_name` which can accept either a UUID or a string representing the endpoint name. The code first attempts to parse the parameter as a UUID, and if that fails, it queries the database to find a flow with the matching endpoint name. This change improves the usability of the API by providing an alternative way to identify flows for execution.

* feat: Add endpoint_name field to FlowType

This commit adds the `endpoint_name` field to the `FlowType` interface in the `index.ts` file. The `endpoint_name` field is an optional string that represents the name of the endpoint associated with the flow. This change allows for more flexibility in identifying flows by endpoint name instead of just the flow ID. It improves the usability of the codebase by providing an alternative way to reference flows.

* 🐛 (endpoints.py): change type of flow_id_or_name parameter from Union[str, UUID] to str to simplify the API and improve readability

* feat: Add migration utility functions for table, column, foreign key, and constraint existence checks

This commit adds utility functions to the `migration.py` module in the `langflow.utils` package. These functions provide convenient ways to check the existence of tables, columns, foreign keys, and constraints in a database using SQLAlchemy. The functions `table_exists`, `column_exists`, `foreign_key_exists`, and `constraint_exists` take the table name, column name, foreign key name, and constraint name respectively, along with the SQLAlchemy engine or connection object. They use the `Inspector` class from `sqlalchemy.engine.reflection` to retrieve the necessary information and return a boolean value indicating whether the specified element exists in the database. These utility functions improve the readability and maintainability of the codebase by encapsulating the common existence checks in a reusable and modular way.

* feat: Add unique constraints for per-user folders and flows

This commit adds unique constraints for per-user folders and flows in the database. It introduces the `unique_folder_name` constraint for the `folder` table, ensuring that each user can have only one folder with a specific name. Similarly, it adds the `unique_flow_endpoint_name` and `unique_flow_name` constraints for the `flow` table, enforcing uniqueness of endpoint names and flow names per user. These constraints improve data integrity and prevent duplicate entries in the database, providing a more robust and reliable system.

* feat: Add poetry installation and caching steps to GitHub Actions workflow

This commit updates the GitHub Actions workflow file `action.yml` to include additional steps for installing poetry and caching its dependencies. The `run` step now installs poetry using the specified version and ensures that the poetry binary is available in the PATH. Additionally, the workflow now includes a step to restore pip and poetry cached dependencies using the `actions/cache` action. These changes improve the workflow by providing a more efficient and reliable way to manage poetry dependencies and caching.

* refactor: Improve error handling in update_flow function

This commit improves the error handling in the `update_flow` function in `flows.py`. It adds a new `elif` condition to check if the exception is an instance of `HTTPException` and re-raises it. This ensures that any `HTTPException` raised during the update process is properly handled and returned as a response. Additionally, it removes the unnecessary `else` block and simplifies the code logic. This refactor enhances the reliability and maintainability of the `update_flow` function.
2024-05-30 07:46:28 -07:00
Mendon Kissling
b1505cf4f7 Merge branch 'dev' into docs-example-components 2024-05-30 10:38:49 -04:00
Mendon Kissling
9d2fe80fa9
Update README.md (#2020)
* Link to GCP deployment doc
2024-05-30 10:22:23 -04:00
Mendon Kissling
5f9519b22a
Update README.md
Link to GCP deployment doc
2024-05-30 10:15:08 -04:00
Mendon Kissling
2fe35ef4d0
Readme refactor (#1963)
A refactoring of the README for dev along with content updates, new
badges, and a new leading gif
2024-05-30 10:10:10 -04:00
Mendon Kissling
653885c09b
Update README.md 2024-05-30 09:59:56 -04:00
Gabriel Luiz Freitas Almeida
e5986ec727
Added curl parse to API Request component and fixed dict issues (#2013)
* Refactor code to remove console.log statements

* Refactor code to remove console.log statements

* ⬆️ (pyproject.toml): upgrade uncurl dependency to version 0.0.11

* 📝 (flows.py): Add docstring to the read_flows function to provide information about its purpose, arguments, and return value
📝 (parse.py): Add comments and docstrings to the parse_context function to explain its purpose and how it works
📝 (APIRequest.py): Add a new method update_build_config to handle parsing of curl commands and update build configuration based on the parsed context

* refactor: Improve value change detection logic in DictComponent

* refactor: Improve value change detection logic in DictAreaModal

* refactor: Update APIRequest to handle parsing of curl commands and update build configuration

This commit updates the APIRequest class in APIRequest.py to handle parsing of curl commands and update the build configuration based on the parsed context. It introduces a new method, update_build_config, which parses the curl command using the parse_context function and updates the build configuration with the parsed information. Additionally, it handles JSON decoding errors when parsing the data field of the curl command. This improvement enhances the functionality and flexibility of the APIRequest component.

* feat: Add support for handling headers as dictionaries in APIRequest

* refactor: Parse curl commands and update build configuration in APIRequest

This commit refactors the APIRequest class in APIRequest.py to handle parsing of curl commands and update the build configuration based on the parsed context. It introduces a new method, update_build_config, which parses the curl command using the parse_context function and updates the build configuration with the parsed information. Additionally, it handles JSON decoding errors when parsing the data field of the curl command. This improvement enhances the functionality and flexibility of the APIRequest component.

*  (test_data_components.py): add new test case to parse curl command into build configuration for API requests

* 🐛 (src/backend/base/langflow/components/data/APIRequest.py): fix type hinting issue for bodies variable in APIRequest class
2024-05-30 06:50:31 -07:00
Mendon Kissling
2eef3bc8f6 bump python version 2024-05-30 09:43:21 -04:00
Cristhian Zanforlin Lousa
fb018eda10
Fix Application Crash with Multiple Nested Dict Components in Flow (#2011)
* ♻️ (dictComponent): improve value change detection logic
🐛 (parameterComponent): remove unnecessary console.log statement

* ♻️ (frontend): remove redundant comments and clean up code formatting

♻️ (editNodeModal): refactor to use nodeId instead of passing data directly

* ♻️ (editNodeModal): refactor to use data prop instead of nodeId for better data handling
♻️ (nodeToolbarComponent): refactor to improve code readability and consistency
2024-05-29 19:26:12 -07:00
Gabriel Luiz Freitas Almeida
63314b05f1
(frontend): Remove NATIVE_CATEGORIES constant and simplify logic for checking template code value in GenericNode component (#2008)
This pull request removes the `NATIVE_CATEGORIES` constant and
simplifies the logic for checking the template code value in the
`GenericNode` component. The logic now checks if the
`data.node.template.code.value` exists before proceeding. Additionally,
the logic for checking the template code value has been simplified by
removing the unnecessary check for
`NATIVE_CATEGORIES.includes(types[data.type])`.
2024-05-29 17:26:15 -07:00
ogabrielluiz
1f57845993 🔧 (frontend): Remove NATIVE_CATEGORIES constant and simplify logic for checking template code value in GenericNode component 2024-05-29 11:22:21 -03:00
ogabrielluiz
6e9b5661c8 feat: Update langflow-base to version 0.0.53 and langflow to 1.0.0a42 2024-05-29 11:07:10 -03:00
Gabriel Luiz Freitas Almeida
92a11b7ce4
Fixed Ollama base url handling and Qdrant component (#2007)
This pull request includes several code refactorings to improve the
readability and maintainability of the codebase. The changes include
reordering and organizing the initialization parameters in the
QdrantComponent class, removing unused imports and cleaning up code
formatting in the OllamaModel.py file, updating comments and docstrings
for clarity and consistency in the OllamaModel.py file, and refactoring
the logic for setting the base URL in the get_model method of the
OllamaModel.py file to improve maintainability and readability. These
changes aim to make the codebase more organized and easier to understand
for future development and maintenance.
2024-05-29 06:40:17 -07:00
ogabrielluiz
32e8da3bf4 ♻️ (OllamaModel.py): Remove unused imports and clean up code formatting for better readability
📝 (OllamaModel.py): Update comments and docstrings for clarity and consistency
🔧 (OllamaModel.py): Refactor the logic for setting the base URL in the get_model method to improve maintainability and readability
2024-05-29 10:33:12 -03:00
ogabrielluiz
642acf8172 ♻️ (Qdrant.py): refactor QdrantComponent class to improve code readability and maintainability by reordering and organizing the initialization parameters. 2024-05-29 10:09:45 -03:00
ogabrielluiz
f9026ba8f6 build(pre-release.yml): dynamically set artifact name based on release type input to ensure correct artifact is downloaded 2024-05-28 22:08:49 -03:00
ogabrielluiz
861955bebe chore: Update dependencies to latest versions 2024-05-28 21:52:31 -03:00
Gabriel Luiz Freitas Almeida
36a6d8d23a
chore: Add domain attribute to cookies in login.py and auth.py (#2003) 2024-05-28 17:45:52 -07:00
ogabrielluiz
2a2483d0ee chore: Add domain attribute to cookies in login.py and auth.py 2024-05-28 21:45:29 -03:00
ogabrielluiz
a112d72fc1 chore: Update docker volume mount path for langflow-data in pre.docker-compose.yml 2024-05-28 20:46:46 -03:00
ogabrielluiz
8bc241267d chore(create-release.yml): remove unnecessary version check step to simplify workflow and improve readability 2024-05-28 19:47:46 -03:00
ogabrielluiz
969ac6eb49 chore(create-release.yml): Update Poetry version to 1.8.2 2024-05-28 19:44:50 -03:00
ogabrielluiz
9df2dc72ac chore(create-release.yml): add 'needs: release' to ensure the 'create_release' job runs after the 'release' job 2024-05-28 19:43:07 -03:00
ogabrielluiz
546dd3dbdf feat(create-release.yml): add support for building and uploading different project versions based on release type (base or main) to streamline release process 2024-05-28 19:40:03 -03:00
ogabrielluiz
ce797dbfa0 chore(create-release.yml): update workflow name to 'pre-release.yml' for consistency and clarity 2024-05-28 19:32:54 -03:00
ogabrielluiz
4f684c851c chore(create-release.yml): update action to download artifact to dawidd6/action-download-artifact@v3 for compatibility with workflow Langflow Pre-release (Unified) and add github_token and workflow inputs for authentication and artifact retrieval. 2024-05-28 19:28:42 -03:00
ogabrielluiz
8902b6d09e chore(create-release.yml): rename job name to 'Create Release Job' for clarity
chore(create-release.yml): rename step name to 'Download Artifact' for better readability
chore(create-release.yml): rename step name to 'Create Release Notes' for better understanding of the action's purpose
2024-05-28 19:24:52 -03:00
ogabrielluiz
6e9e67d5c6 chore(pre-release.yml): remove unnecessary dependency on 'call_docker_build' job for 'create_release' job when release_type is 'main' to simplify workflow logic 2024-05-28 19:00:26 -03:00
ogabrielluiz
8d1295b5a1 fix(pre-release.yml): update artifact path based on release type to correctly upload artifacts for different release types 2024-05-28 18:53:19 -03:00
ogabrielluiz
25767de60d refactor: Update version numbers in pyproject.toml files 2024-05-28 18:46:31 -03:00
ogabrielluiz
9965f9a31a feat: Add release_type input to create-release workflow 2024-05-28 18:44:01 -03:00
ogabrielluiz
6070bbb8fc feat(create-release.yml): add GitHub Actions workflow to create a release with version input and release notes generation 2024-05-28 18:38:58 -03:00
Gabriel Luiz Freitas Almeida
482ac3fbfc
Refactor base.py and Dockerfile, and folder column migration (#2002)
* refactor(base.py): handle ImportError when importing is_pre_release function from langflow.version module to prevent crashing the application
feat(base.py): dynamically determine if the version is a pre-release version by checking for 'a', 'b', or 'rc' in the version number

* fix(Dockerfile): add missing backslash to ensure proper chaining of commands

* refactor: Update get_lifespan function to handle ImportError and dynamically determine the version number

The get_lifespan function in main.py has been updated to handle ImportError when importing the __version__ attribute from the langflow.version module. If the import fails, the version number is dynamically determined using the importlib.metadata.version function. This change ensures that the application does not crash when the langflow.version module is not available.

Note: This commit message follows the convention used in the recent user commits.

* chore: Add langflow-pre.db and langflow.db to .dockerignore

* chore: Update .dockerignore to include langflow-pre.db and langflow.db

* refactor: Add folder_id column to flow table and handle folder column migration

This commit adds the folder_id column to the flow table in the database. It also handles the migration of the folder column to the new folder_id column. This change allows for better organization and management of flows within folders.

Note: This commit message follows the convention used in the recent user commits.

* refactor: Update Dockerfiles to include user creation and environment variable

This commit updates the Dockerfiles to include the creation of a user with UID 1000 and the necessary permissions for the /app/langflow directory. It also adds the user's local bin directory to the PATH environment variable. This change improves the security and isolation of the application within the container.

Note: This commit message follows the convention used in the recent user commits.
2024-05-28 14:27:02 -07:00
Gabriel Luiz Freitas Almeida
6d849b449e
update call_docker_build job (#2001)
* refactor: Update SplitTextComponent to store parent and text data in Record object

* chore(pre-release.yml): update call_docker_build job to use langflow-ai/langflow/.github/workflows/docker-build.yml@dev for better workflow organization and consistency

* merge dev
2024-05-28 13:24:12 -07:00
Gabriel Luiz Freitas Almeida
f694f0716f
Fixed freeze implementation (#1983)
* chore: Update utils imports and add cn to nodeToolbarComponent

* fix(utils.py): change key parameter name from 'flow_id' to 'key' for consistency
fix(chat.py): remove unused import 'functools.partial' to improve code readability
refactor(chat.py): remove 'set_cache_coro' partial function and pass 'chat_service' directly to 'build_vertex' method for better code organization
feat(schemas.py): add 'used_frozen_result' field to ResultDataResponse and ResultData classes with default value of False for better tracking of frozen result usage
feat(base.py): add 'chat_service' parameter to 'build_vertex' method in Graph class to allow passing ChatService instance for cache operations
feat(base.py): update 'build_vertex' method in Graph class to handle caching of frozen vertices and set 'used_frozen_result' flag in ResultData class
feat(cache/service.py): change parameter name from 'flow_id' to 'key' in 'set_cache' and 'get_cache' methods for consistency
feat(cache/utils.py): add 'CacheMiss' class to represent cache miss situations for better error handling

* feat: Add check for None before setting 'used_frozen_result' flag in Graph class

* feat: Add frozen effect to buttons and improve code organization

The code changes introduce a frozen effect to buttons by adding new CSS classes and styles. This effect is achieved by applying borders, shadows, and background colors. Additionally, the code is refactored to improve code organization and remove unused imports.

Note: This commit message follows the convention used in the recent user commits.

* feat: Add frozen effect to buttons and improve code organization

* style(applies.css): Update border styles for frozen state to improve visual appearance and consistency
style(applies.css): Adjust opacity of frosted background for better readability
style(tailwind.config.js): Increase opacity of frozen-ring shadow for better visual effect
style(tailwind.config.js): Increase opacity of frosted-ring shadow for better visual effect

* feat(parameterComponent): add snowflake icon to ParameterComponent when node is frozen and not aligned left

* style(applies.css): Update border styles for frozen state and add border to improve visual appearance and consistency
2024-05-28 12:43:14 -07:00
anovazzi1
ee62bd38b7
Update parent disclosure title in ExtraSidebar component (#1987)
chore: Update parent disclosure title in ExtraSidebar component
2024-05-28 12:41:58 -07:00
Gabriel Luiz Freitas Almeida
0c32bbe182
Refactor SplitTextComponent to store parent and text data in Record object (#1998)
refactor: Update SplitTextComponent to store parent and text data in Record object
2024-05-28 12:41:32 -07:00