Commit graph

13,948 commits

Author SHA1 Message Date
Christophe Bornet
942c8dca36
feat: Add ruff rules SIM (#3979)
Add ruff rules SIM
2024-10-02 05:45:41 -07:00
Yuqi Tang
e58b27062c
feat: improve notes design (#3938)
* fix notes style

* fix notes style

* adding ghost node

* [autofix.ci] apply automated fixes

* change cursor position

* update notes related test

* [autofix.ci] apply automated fixes

* adjust shadow block width

* move cursor to middle:

* [autofix.ci] apply automated fixes

* fix padding

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-10-02 05:45:19 -07:00
Jordan Frazier
e19d90bd6c
ci: fix releases with uv (#3971)
* Update scripts

* update the base dep in uv deps

* update nightly scripts

* Add uv creds for publish

* skip tests for now

* fix version

* only build the wheel

* try again

* add uv to python run

* [autofix.ci] apply automated fixes

* use uv cache

* more version fixe

* fixing versions

* fix base version

* Try no frozen?

* skip everything to try docker build

* tag

* frozen

* separate script for updating uv dep

* [autofix.ci] apply automated fixes

* hardcoded versions

* hardcoded versions

* add version to editable package

* build project before docker file runs

* try again

* fix uv patht o build

* don't know why this would mkae a difference

* debug statements

* debug statements

* debug statements

* change path to whl 🤷

* manually move the wheel...

* make dir

* try no sources

* add back tests

* refactor uv to action

* add uv action

* Update nightly build workflow to include uv lock files in version update commit

* Update lint-py workflow to use specific ref for setup-uv action

* Add checkout step to style-check-py GitHub Actions workflow

* Remove redundant GitHub ref syntax in lint-py.yml workflow

* Update lint-py.yml to use specific ref for setup-uv action

* Update action.yml: standardize quotes and remove redundant checkout step

* Add checkout step to GitHub Actions workflows for specific ref handling

- Introduced `actions/checkout@v4` step to multiple workflows to ensure code is checked out at a specific ref.
- Updated `.github/workflows/docker-build.yml`, `.github/workflows/release_nightly.yml`, `.github/workflows/lint-py.yml`, and `.github/workflows/style-check-py.yml` to include the new checkout step.
- Ensured credentials are persisted during the checkout process.

* Add checkout step to Python test workflow with specific ref

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-10-02 05:37:04 -07:00
João
b9bcb09e63
feat: Add OpenSearch VectorStore Component with Ingest and Search Capabilities (#3799)
* update: adding opensearch-py dependency

* feat: adding OpenSearch icon

* feat: adding OpenSearch VectorStore code

* fix: removing unused methods and adding hybrid search capabilities using search method

* update: poetry lock with recent hash added

* fix: removing unused methods and adding hybrid search capabilities using search method

* fix: default value of search_input to an empty string

* fix: adapting code to match make format script
2024-10-01 21:42:55 +00:00
Gabriel Luiz Freitas Almeida
e882f08549
feat: add 'gradient' column to Flow model and database schema (#3944)
Add 'gradient' column to Flow model and database schema
2024-10-01 21:06:19 +00:00
Gabriel Luiz Freitas Almeida
270f609fe7
refactor: enhance tool creation logic and add FeatureFlags (#3662)
* Add `required_inputs` field to `Output` model in `base.py`

* Refactor ComponentTool to ComponentToolkit and enhance tool creation logic

- Replaced `ComponentTool` with `ComponentToolkit` to better encapsulate component-related tools.
- Introduced `build_description` and `_build_output_function` helper functions for dynamic tool creation.
- Updated tool initialization to handle multiple outputs and required inputs using `StructuredTool`.
- Improved schema creation for tool arguments based on component inputs.

* Refactor `to_tool` method to `to_toolkit` to use `ComponentToolkit` instead of `ComponentTool`

* Refactor `ComponentTool` to `ComponentToolkit` in unit tests

- Updated import statements to reflect the new `ComponentToolkit` class.
- Modified test logic to use `ComponentToolkit` for retrieving tools.
- Adjusted assertions to match the new structure and output format.
- Ensured compatibility with `Message` schema for output validation.

* Refactor `test_component_to_tool` to validate `ComponentToolkit` and tool properties

* Refactor `build_description` to include input types in the output format

* Add method to set required inputs for outputs based on method analysis

- Introduced `_set_output_required_inputs` method to determine and set required inputs for each output by analyzing the method's source code.
- Added necessary imports (`ast` and `dedent`) to support the new functionality.

* Update test to assert full tool description in test_component_to_tool.py

* Add unit tests for verifying required inputs of various components

- Added tests to ensure that required inputs for outputs are present in the inputs of `ChatInput`, `ChatOutput`, `SequentialTaskComponent`, `ToolCallingAgentComponent`, and `OpenAIModelComponent`.
- Included helper functions to check if required inputs are in inputs and to assert that all outputs have different required inputs.

* Add RequiredInputsVisitor to identify required inputs in AST nodes

- Introduced RequiredInputsVisitor class to traverse AST nodes and collect required inputs.
- The visitor checks for 'self' attributes matching the provided inputs and adds them to the required_inputs set.

* Refactor required inputs extraction using `RequiredInputsVisitor`

* Add feature flags configuration for toolkit output in settings

* Add toolkit output handling based on feature flag in custom component utils

* Add method to append 'component_as_tool' output in custom component

* Add unit test for toolkit output feature flag in custom component

* Add utility functions for lazy loading and instantiating input types in langflow

- Introduced `get_InputTypesMap` for lazy loading of `InputTypesMap`.
- Added `instantiate_input` function to create instances of input types dynamically.
- Included type checking and error handling for invalid input types.

* Refactor input instantiation logic and update imports

- Removed `instantiate_input` function from `inputs.py` and moved it to `utils.py`.
- Updated imports in `base.py` to reflect the new location of `instantiate_input`.
- Added missing import for `Callable` in `base.py`.

* Refactor import statement to use `instantiate_input` from `langflow.inputs.utils` in test_inputs.py

* Add TOOL_OUTPUT_NAME constant to tools module

* Add type checking and TOOL_OUTPUT_NAME filter in ComponentToolkit

- Introduced `TYPE_CHECKING` for type hints to avoid circular imports.
- Added `TOOL_OUTPUT_NAME` constant to filter specific outputs in `ComponentToolkit`.
- Updated type annotations to use forward references.

* Refactor component toolkit import to avoid circular dependency and use constant for tool output name

* Refactor `ComponentToolkit` class to remove inheritance from `BaseToolkit` and add an initializer for `component`

* Add unit test for ComponentToolkit in test_component_to_tool

- Added `test_component_to_tool_has_no_component_as_tool` to verify that `ComponentToolkit` correctly initializes with a `ChatInput` component and returns the expected tools.

* Refactor toolkit output handling to `custom_component` module

* fix: mypy errors union-attr and arg-type

* Add 'OTHER' field type to schema in langflow/io/schema.py

* Add tool name formatting to ComponentToolkit to ensure valid characters

* Refactor toolkit output handling and add type hint for `to_toolkit` method

* Add `is_interface_component` attribute to vertex types and update import order

* Add tests for ToolCallingAgentComponent and ChatOutput with API key handling

- Updated `test_component_tool` to reflect new description format.
- Added `test_component_tool_with_api_key` to test `ToolCallingAgentComponent` with `ChatOutput` and OpenAI API key.
- Enabled `add_toolkit_output` feature flag for testing.

* Refactor `_find_matching_output_method` to accept `input_name` parameter for more precise input-output matching

* Replace ValueError with warning in build_description function

* use chat_output component directly in set

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 3/3)

* Refactor: Reorder method calls in `__init__` for logical consistency

Moved `set_class_code` method call to ensure output types and required inputs are set before class code initialization.

* Update _format_tool_name to allow '.' in tool names

* Refactor `_format_tool_name` to remove non-alphanumeric characters

* Update test assertions for component tool name and output mapping

* Handle case where 'required_inputs' is empty in 'component_tool.py'

* Refactor import statements for better readability in `base.py`

* [autofix.ci] apply automated fixes

* Add noqa comment to suppress import warning and re-add Any import in base.py

---------

Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-10-01 20:58:51 +00:00
Gabriel Luiz Freitas Almeida
df792cb19d
feat: add endpoint and tests for updating session ID in messages (#3946)
* Add endpoint to update session ID for messages in monitor API

* Add tests for updating session ID in messages endpoint

- Added test to successfully update session ID for all messages with the old session ID.
- Added test to handle case where no messages are found with the given session ID.

---------

Co-authored-by: anovazzi1 <otavio2204@gmail.com>
2024-10-01 12:35:46 -07:00
Cristhian Zanforlin Lousa
7f10a2a201
fix: playground img not working (#3980)
* 🐛 (model.py): fix issue where message.files was not being updated correctly when image_paths is empty in MessageBase class

* 🐛 (model.py): simplify condition for checking if image_paths is not empty to improve readability and maintainability

* [autofix.ci] apply automated fixes

* 🔧 (OutputParser.py): refactor error message handling for unsupported or missing parser to improve readability and maintainability

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-10-01 18:54:11 +00:00
Gabriel Luiz Freitas Almeida
e710b457c3
chore: Refactor error handling in OutputParser for improved readability (#3985)
Refactor: improve readability of error handling in OutputParser
2024-10-01 18:38:22 +00:00
dependabot[bot]
0d2a03920d
build(deps):(deps): bump peter-evans/create-pull-request from 6 to 7 (#3976)
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 6 to 7.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](https://github.com/peter-evans/create-pull-request/compare/v6...v7)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-01 18:31:30 +00:00
dependabot[bot]
a47a089fec
build(deps):(deps): bump install-pinned/ruff from 826c99bfba88282a5506ab737c92253a106c070e to f5afd2b0fca6556debe3e07025fc90e04fb3c44c (#3977)
build(deps):(deps): bump install-pinned/ruff

Bumps [install-pinned/ruff](https://github.com/install-pinned/ruff) from 826c99bfba88282a5506ab737c92253a106c070e to f5afd2b0fca6556debe3e07025fc90e04fb3c44c.
- [Release notes](https://github.com/install-pinned/ruff/releases)
- [Commits](826c99bfba...f5afd2b0fc)

---
updated-dependencies:
- dependency-name: install-pinned/ruff
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-01 18:31:05 +00:00
Christophe Bornet
7b7e5cd1b4
feat: Add ruff rules for return (RET) (#3981)
Add ruff rules for return (RET)
2024-10-01 19:46:48 +02:00
Jordan Frazier
a5bd766626
ref: refactor csv output parser to dynamic single component (#3963)
* refactor csv output parser to dynamic single component

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-10-01 17:05:35 +00:00
Mendon Kissling
34f18185c5
docs: add notes to flows (#3861)
* add-note

* notes

* vector-store-rag-notes

* vector-store-rag-notes

* comma

* comma

* revert

* add-notes

* another-way

* revert

* revert

* fix

* descriptions

* lightbulb

* deployed-size

* size

* size

* resizing-is-true

* targethandle

* double

* set-components

* pin

* notes

* fix

* dont-change-code

* cleanup

* update example

* fix postion on example

* fix-descriptions

* swap-link

* newline-and-lightbulb

* another-docs-link

* play-button

* remove-double

* update NODE_FORMAT_ATTRIBUTES to prevent description updates on examples

* Update AstraDB documentation link

* update documentation on code

*  (chatInputOutputUser-shard-0.spec.ts): update the test to click on the last element with the text "Playground" to ensure correct element is clicked

* 🐛 (Basic Prompting.spec.ts): fix clicking on "Playground" element by selecting the last occurrence to ensure correct element is clicked

*  (Blog Writer.spec.ts): update test to click on the last element with text "Playground" to ensure correct element is clicked on the page

*  (Dynamic Agent.spec.ts): update test to click on the last element with text "Playground" to ensure correct element is clicked on the page

* 🐛 (decisionFlow.spec.ts): fix clicking on "Playground" button by selecting the last element with the text "Playground" to ensure correct element is clicked

* 🐛 (generalBugs-shard-3.spec.ts): fix clicking on "Playground" button by selecting the last occurrence to prevent ambiguity

* 🐛 (generalBugs-shard-0.spec.ts): fix clicking on "Playground" button by selecting the last element with the text "Playground" to ensure correct element is clicked

* 🐛 (general-bugs-shard-3836.spec.ts): fix clicking on "Playground" button by selecting the last element with the text "Playground" to ensure correct element is clicked

*  (chatInputOutputUser-shard-2.spec.ts): update test to click on the last element with text "Playground" to ensure correct interaction with chat input/output feature

*  (stop-button-playground.spec.ts): update test to click on the last occurrence of the text "Playground" to ensure correct element is clicked

* 🐛 (limit-file-size-upload.spec.ts): fix selector to click on the last element with text "Playground" instead of the first one

*  (fileUploadComponent.spec.ts): update test to click on the last element with text "Playground" to ensure correct element is clicked on the page

*  (chatInputOutput.spec.ts): update test to click on the last occurrence of the "Playground" text to ensure correct element is clicked

* 🐛 (generalBugs-shard-9.spec.ts): fix clicking on "Playground" element by selecting the last occurrence to prevent flakiness in tests

* 🐛 (Document QA.spec.ts): fix clicking on "Playground" element by selecting the last occurrence to ensure correct element is clicked

*  (similarity.spec.ts): update click method to target the last occurrence of "Playground" text to ensure correct element is clicked

* 🐛 (Simple Agent.spec.ts): fix clicking on "Playground" button by selecting the last element with the text to avoid ambiguity

*  (textInputOutput.spec.ts): update test script to target the last occurrence of the "Playground" text element to ensure correct interaction with the UI.

*  (Travel Planning Agent.spec.ts): Update the selector for the "Playground" text to ensure the correct element is clicked on the page.

* 🐛 (Vector Store.spec.ts): fix clicking on "Playground" element by selecting the last one to avoid ambiguity

*  (generalBugs-shard-9.spec.ts): add click action on the last element with test id "title-Prompt" to improve test coverage and interaction with the page

---------

Co-authored-by: anovazzi1 <otavio2204@gmail.com>
Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
2024-10-01 16:26:18 +00:00
Christophe Bornet
1668c91433
feat: Add ruff rules for error messages (EM) (#3978)
Add ruff rules for error messages (EM)
2024-10-01 15:38:32 +00:00
Mike Fortman
e63c377283
fix: Only show error state on components w/ errors for node validation (#3968)
* Only show error state on components w/ errors for node validation

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-10-01 10:22:31 -05:00
Patrick Loeber
d19c16462b
fix: enhancements for the AssemblyAI component (#3934)
Enhancements for AssemblyAI component

Co-authored-by: Patrick Loeber <98830383+ploeber@users.noreply.github.com>
2024-10-01 14:28:18 +00:00
Christophe Bornet
d92b3cb12b
feat: Add various ruff rules (#3974)
Add various ruff rules
2024-10-01 05:28:19 -07:00
Cristhian Zanforlin Lousa
2505836e51
fix: consider remove_example_flows param on query on GET flows endpoint (#3967)
🐛 (flows.py): fix logic to remove example flows based on condition to improve data consistency and prevent errors
2024-10-01 09:18:02 -03:00
Christophe Bornet
db9787c086
feat: Add ruff rules for pycodestyle Errors (E) (#3947)
Add ruff rules for pycodestyle Errors (E)
2024-10-01 13:41:30 +02:00
Christophe Bornet
b11207bef3
feat: Add pre-commit hook for ruff (#3960)
Add pre-commit hook
2024-10-01 12:50:19 +02:00
Gabriel Luiz Freitas Almeida
43ad226ddb
chore: update docker images to use uv (#3916)
* fix dev dependencies

* fix dev dependencies

* update lock

* Add langchain-unstructured dependency to pyproject.toml

* Switch to uv-based Docker image and streamline build process

- Use `ghcr.io/astral-sh/uv:python3.12-bookworm-slim` as the base image
- Simplify environment variable setup and remove unnecessary ones
- Install project dependencies using `uv sync` with cache mounts
- Add and copy necessary files for the build process
- Update npm installation and frontend build steps
- Adjust entrypoint and runtime configurations
- Remove redundant user setup and streamline CMD execution

* Refactor Dockerfile to use multi-stage builds for optimized image size

- Introduce a builder stage to install dependencies and build the frontend.
- Use npm ci instead of npm install for more reliable builds.
- Copy built frontend assets to the final image.
- Transition to a runtime stage with a slimmer Python base image.
- Ensure the final image only contains necessary runtime dependencies.

* Switch base image to `ghcr.io/astral-sh/uv:python3.12-bookworm-slim` and update Dockerfile

- Replace `python:3.12.3-slim` with `ghcr.io/astral-sh/uv:python3.12-bookworm-slim` as the base image.
- Enable bytecode compilation and set link mode to copy.
- Update dependency installation process using `uv sync`.
- Simplify frontend build and copy process.
- Add OCI labels for image metadata.
- Update CMD to use `langflow-base` for running the application.

* Update Dockerfile to use uv base image and optimize dependency installation

- Switch base image to `ghcr.io/astral-sh/uv:python3.12-bookworm-slim`
- Combine apt-get commands and clean up to reduce image size
- Replace Poetry with uv for dependency management and caching

* Refactor Dockerfile to use multi-stage build for optimized image size

- Introduce a builder stage using `ghcr.io/astral-sh/uv:python3.12-bookworm-slim`
- Add a runtime stage using `python:3.12.3-slim`
- Copy the virtual environment from the builder stage to the runtime stage
- Remove the `uv` entrypoint to avoid invoking it by default

* Update Dockerfile: Fix indentation and remove redundant ENTRYPOINT reset

* ci: update release workflows to use uv (#3919)

* Update nightly build workflow to use 'uv' for dependency management and caching

- Replace Poetry with 'uv' for dependency installation and project setup
- Add steps to install 'uv' and set up caching for 'uv.lock'
- Modify Python setup to use version specified in 'pyproject.toml'
- Remove Node.js setup steps

* Update release workflow to use uv for dependency management

- Replace Poetry with uv for dependency installation and caching
- Update Python setup to use version specified in pyproject.toml
- Add steps to restore uv cache and install project dependencies using uv
- Adjust publish steps to maintain functionality with new setup

* Replace 'poetry publish' with 'uv publish' in Makefile for consistency

* Update nightly build workflow to use 'uv' for dependency management and caching

* Set up Node.js 20 in release_nightly workflow and update version verification logic

* Update Makefile to use `uv sync --frozen` for backend dependencies installation

* Update Makefile to pass arguments to 'uv build' and remove '--skip-existing' from publish commands

- Modified 'build_langflow' target to accept arguments.
- Removed '--skip-existing' from 'publish_base' and 'publish_base_testpypi' commands.
- Added TODO comments for updating test-pypi repository usage.

* Remove --skip-existing flag from uv publish commands and add TODO comments for test-pypi updates

* new lock

* Update CI workflow to remove version prefix and add build args

- Removed 'v' prefix from version extraction in nightly release workflow.
- Added '--no-sources' argument to the build command in the distribution step.

* Update CI workflow to use 'uv' for versioning and publishing

- Replace 'poetry' with 'uv' for version extraction in release checks

* Update CI workflow to use UV_PUBLISH_TOKEN for PyPI publishing

* Add verification step for 'langflow-nightly' name and version in CI workflow

- Corrected awk commands for extracting 'langflow-base' name and version.
- Added a new step to verify 'langflow-nightly' name and version against expected values.

* feat: Update dev.Dockerfile to use 'uv' for dependency management and caching

* update dockerfiles with --no-editable

---------

Co-authored-by: phact <estevezsebastian@gmail.com>
Co-authored-by: Jordan Frazier <jordan.frazier@datastax.com>
2024-09-30 22:49:25 +00:00
Lucas Oliveira
855694208e
fix: update docs link (#3966)
Fix docs link
2024-09-30 20:29:32 +00:00
Eric Hare
5bddef4eb6
FIX: Use multiline input to allow chaining for query (#3964) 2024-09-30 20:23:27 +00:00
Christophe Bornet
e82de5d89c
feat: Add ruff rules for comprehensions (C4) (#3958)
Add ruff rules for comprehensions (C4)
2024-09-30 13:00:00 -07:00
Edwin Jose
0e80ebd3cd
feat(Weaviate): Enforce capitalized index name (#3791)
feat(Weaviate): Enforce capitalized index name
Checks if the index name is capitalized or not.
2024-09-30 19:53:25 +00:00
Mike Fortman
4eb6bd17bd
fix: Fix Astra API Endpoint Display Name (#3962)
Fix Astra API Endpoint Display  Name
2024-09-30 19:31:33 +00:00
Gabriel Luiz Freitas Almeida
bbeaf68a26
docs: Update CONTRIBUTING.md to mention uv (#3965)
* Remove Poetry check, update uv command, and remove dev target from Makefile

* Update CONTRIBUTING.md to reflect new development setup and remove docker-compose instructions
2024-09-30 12:23:35 -07:00
Ítalo Johnny
f873309004
fix: security file upload (#3923)
* fix: add check user authentication
* fix: add request body multipart boundary validation
2024-09-30 19:14:03 +00:00
Jordan Frazier
059fd9403a
fix: vectorize authentication params (#3954)
Fix vectorize authentication params
2024-09-27 21:36:09 +00:00
Mike Fortman
e1816246b5
feat: add env support for Astra Db components (#3908)
* add env support for Astra Db components

* [autofix.ci] apply automated fixes

* use parse_api_endpoint

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes

* quick cleanup

* merge

* package lock

* reset templates

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-27 16:00:31 -05:00
Cristhian Zanforlin Lousa
ef11e98c8f
fix: force floatInputComponent to send Number (#3953)
🔧 (floatComponent/index.tsx): update handleChange function to convert input value to a number before passing it to onChange function
2024-09-27 20:41:58 +00:00
Gabriel Luiz Freitas Almeida
35d81b7e34
feat: Add components_only parameter to filter flows by components in API endpoint (#3932)
* Add fixture for creating flow component in tests

* Add test for reading flows with components only in test_database.py

* Add `components_only` parameter to filter flows by components in API endpoint
2024-09-27 18:18:24 +00:00
Cristhian Zanforlin Lousa
6db15255a5
feat: improve file uploader size validation - custom hook (#3952)
* 📝 (inputFileComponent/index.tsx): add useFileSizeValidator hook to validate file size before upload to improve code readability and maintainability

* 📝 (chatInput/index.tsx): remove unused imports and refactor file size validation to use a custom hook for better code organization and readability

* 📝 (FileInput/index.tsx): refactor file input component to use a custom hook for file size validation instead of utility store
🔧 (FileInput/index.tsx): remove dependency on utility store for max file size upload and use a custom hook for file size validation instead

*  (use-file-size-validator.tsx): introduce a new custom hook useFileSizeValidator to validate file size before uploading it
2024-09-27 18:01:16 +00:00
Cristhian Zanforlin Lousa
29404c79ba
fix: update storeMessageComponent input types (#3950)
* 📝 (StoreMessage.py): Change StrInput to MessageInput for sender, sender_name, and session_id inputs to improve clarity and consistency in the code.

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-27 14:51:24 -03:00
Eric Hare
077a061a2a
FIX: do not use cached vector store on inserts (#3948) 2024-09-27 16:55:13 +00:00
Gabriel Luiz Freitas Almeida
706f9a0277
refactor: update flaky tests in test_schema.py (#3933)
* Fix flaky tests in `test_schema.py` by using sets for type comparisons

- Updated `post_process_type` function assertions to use sets for more reliable type comparisons.
- Adjusted imports for better code organization.

* Fix import order in test_database.py

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-27 16:45:26 +00:00
Cristhian Zanforlin Lousa
8facb67944
tests: improve tests of store (#3949)
 (store-shard-1.spec.ts): Improve test case for liking and adding components and flows by adding more specific selectors and reducing timeout durations for better performance and reliability
 (store-shard-3.spec.ts): Enhance test case for filtering by type by adding more specific selectors and reducing timeout durations for better performance and reliability
2024-09-27 16:39:39 +00:00
Jordan Frazier
8e50f2fdbb
feat: add csv output parser (#3483)
* Adds the CSV Output Parser

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-09-27 16:36:04 +00:00
Cristhian Zanforlin Lousa
948b150946
feat: truncate parsed uploads to prevent database and frontend blocking caused by excessively large files (#3914)
* 📝 (constants.ts): increase maxSizeFilesInBytes constant value from 10MB to 100MB to allow larger file uploads

* 🐛 (inputFileComponent): fix bug in setting the maximum file size alert message to display the correct file size limit of 100 bytes instead of 10 bytes

* 📝 (schemas.py): Add a new field_serializer method to serialize data in VertexBuildResponse class
📝 (schemas.py): Add a new truncate_text helper function to safely truncate text in nested dictionaries
📝 (model.py): Add a new field_serializer method to serialize outputs in TransactionBase class
📝 (model.py): Add a new truncate_text helper function to safely truncate text in nested dictionaries
📝 (model.py): Add a new field_serializer method to serialize data and artifacts in VertexBuildBase class
📝 (model.py): Add a new truncate_text helper function to safely truncate text in nested dictionaries

* 🐛 (schemas.py): fix truncation length of text fields to 10 characters instead of 99999
🐛 (model.py): fix truncation length of text fields to 10 characters instead of 99999
🐛 (model.py): fix truncation length of text fields to 10 characters instead of 99999
🐛 (index.tsx): truncate resultMessage to 99999 characters and add message if text is too long

* 🔧 (switchOutputView/index.tsx): Use useMemo to memoize resultMessage transformations for performance optimization

* 🐛 (model.py): Fix typo in the path for 'base_retriever' data field
🐛 (model.py): Fix typo in the path for 'base_retriever' data field
🐛 (model.py): Fix typo in the path for 'base_retriever' data field
🐛 (model.py): Fix typo in the path for 'base_retriever' data field
🐛 (index.tsx): Fix logic to correctly handle resultMessageMemoized when it is an object

* 📝 (model.py): refactor truncate_text function to truncate_long_strings for better clarity and consistency
📝 (model.py): update serialize_outputs and serialize_artifacts functions to use truncate_long_strings for string truncation
📝 (model.py): introduce MAX_TEXT_LENGTH constant for defining the maximum length of text to truncate in the models

* 📝 (schemas.py): refactor serialize_data method in VertexBuildResponse class to use a new helper function truncate_long_strings for better code readability and maintainability

* 🔧 (schemas.py): Move the `truncate_long_strings` function to a separate module to improve code organization and reusability
🔧 (model.py): Import the `truncate_long_strings` function from the correct module to fix the reference error
🔧 (model.py): Import the `truncate_long_strings` function from the correct module to fix the reference error

* 📝 (util.py): add function truncate_long_strings to recursively truncate long strings in dictionaries and lists to prevent exceeding the maximum text length.

* 📝 (constants.py): add constant MAX_TEXT_LENGTH with value 99999 for defining maximum text length allowed in the application

* 📝 (model.py): update import path for truncate_long_strings function to match new location in util module

*  (test_truncate_long_strings_on_objects.py): Add unit tests for the function truncate_long_strings to ensure correct behavior when truncating long strings in various data structures
🐛 (switchOutputView/index.tsx): Fix truncation logic to correctly truncate long strings by adding ellipsis at the end instead of displaying additional text about truncation.

* [autofix.ci] apply automated fixes

*  (test_truncate_long_strings_on_objects.py): Update import path for truncate_long_strings function
📝 (test_truncate_long_strings_on_objects.py): Add additional tests for handling negative, zero, and small max_length values in truncate_long_strings function

* ♻️ (schemas.py): refactor import statement to use the updated module name util_strings instead of util for better clarity and consistency.

* 📝 (model.py): Update import path for util_strings module to fix module import error
📝 (util.py): Remove redundant code for truncating long strings and move it to a separate util_strings module for better organization and separation of concerns.

* 📝 (schemas.py): refactor serialize_data method to handle both BaseModel and non-BaseModel data inputs in VertexBuildResponse class

* 📝 (util_strings.py): Update util_strings.py to improve string truncation function for dictionaries and lists
🔧 (test_truncate_long_strings_on_objects.py): Update test cases for string truncation function to cover additional scenarios and edge cases

* Update src/backend/base/langflow/utils/util_strings.py

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>

* 📝 (vite.config.mts): update environment variable MAX_FILE_SIZE to be defined in vite config for frontend to use in the application.

* 📝 (constants.ts): update maxSizeFilesInBytes constant to use process.env.MAX_FILE_SIZE environment variable for configurable file size limit
📝 (constants.ts): add MAX_TEXT_LENGTH constant with a value of 99999 for maximum text length limit

* 📝 (switchOutputView/index.tsx): import MAX_TEXT_LENGTH constant from shared constants file to improve code organization and reusability

*  (langflow/__main__.py): add support for defining maximum file size for upload in MB to improve user experience and prevent large file uploads

* 🐛 (files.py): add validation to check if uploaded file size exceeds the maximum allowed size before processing it

*  (schemas.py): add max_file_size_upload field to ConfigResponse schema to handle maximum file size allowed for upload

* 🔧 (vite.config.mts): remove MAX_FILE_SIZE environment variable configuration as it is no longer needed

*  (base.py): introduce max_file_size_upload setting to limit the file size for uploads in MB

* 🐛 (util.py): add support for setting max_file_size_upload in update_settings function to allow configuring maximum file size for uploads

* 📝 (inputFileComponent/index.tsx): add support for retrieving max file size upload from utility store to improve code modularity and reusability
🐛 (inputFileComponent/index.tsx): fix error handling logic to display error message when uploading a file fails

* 📝 (constants.ts): remove maxSizeFilesInBytes constant as it is no longer used and update MAX_TEXT_LENGTH constant to a higher value

*  (use-get-config.ts): add functionality to set max file size upload value from config response

*  (utilityStore.ts): introduce maxFileSizeUpload property and setMaxFileSizeUpload function to handle maximum file size upload in bytes

*  (frontend): introduce maxFileSizeUpload property and setMaxFileSizeUpload method to handle maximum file size upload functionality in the UtilityStoreType

* ♻️ (util_strings.py): refactor truncate_long_strings function to improve code readability and consistency by removing unnecessary whitespace and aligning assignment operators.

* 🐛 (files.py): fix formatting issue in the raise statement to improve code readability and maintain consistency

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-09-27 15:44:05 +00:00
Gabriel Luiz Freitas Almeida
b34a7c7f02
fix: Handle group nodes in graph sorting (#3929)
* Fix: Handle group nodes in graph sorting

- Added `get_root_of_group_node` function to identify the root of a group node.
- Updated `sort_up_to_vertex` to use `get_root_of_group_node` for handling group nodes.
- Modified `__filter_vertices` to pass `parent_node_map` to `sort_up_to_vertex`.

* Refactor: Update NodeStatus component to handle group nodes and improve build status handling

* [autofix.ci] apply automated fixes

* Update type hint for parent_node_map in sort_up_to_vertex function

---------

Co-authored-by: anovazzi1 <otavio2204@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-27 15:26:20 +00:00
Cristhian Zanforlin Lousa
3ddd123b66
feat: add dynamic metadata to components + search on sidebar (#3945)
*  (frontend_node/base.py): add metadata attribute to store additional information for the component node

*  (constants.py): add 'metadata' attribute to NODE_FORMAT_ATTRIBUTES list to include additional metadata information for nodes in the application.

* 📝 (attributes.py): add new function getattr_return_dict to return a dictionary if the value is of type dict, otherwise return an empty dictionary. Update ATTR_FUNC_MAPPING to include the new function for the "metadata" attribute.

* update basic examples

* 📝 (extraSidebarComponent/index.tsx): refactor handleSearchInput function to improve code readability and maintainability
🐛 (extraSidebarComponent/index.tsx): fix searchInMetadata function to correctly handle nested objects in metadata for search functionality

* 📝 (component.py): add _metadata attribute to CONFIG_ATTRIBUTES list to include it in the configuration attributes
2024-09-27 12:19:35 -03:00
anovazzi1
5dec9cca9b
fix: usePatchUpdateFlow to conditionally refetch queries based on the browser URL (#3915)
* fix usePatchUpdateFlow to conditionally refetch queries based on the browser URL, preventing unecessary request

* [autofix.ci] apply automated fixes

* Refactor PageComponent to remove unnecessary query using useQueryClient

* Refactor usePatchUpdateFlow to conditionally refetch queries based on the browser URL

* [autofix.ci] apply automated fixes

* Refactor PageComponent to remove unnecessary query using useQueryClient

* Implement query cache cleanup on MainPage unmount

* fix spelling

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-27 12:12:49 -03:00
anovazzi1
f906059a72
fix: animation of building edges on build stop (#3937)
fix: remove animation of builidng edges on build stop
2024-09-27 14:44:27 +00:00
Jordan Frazier
1bf6781dc4
fix: use init_subclass instead of metaclass to enforce decorator (#3942)
* Use init_subclass instead of metaclass to enforce decorator

* [autofix.ci] apply automated fixes

* fix imports

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-27 12:06:15 +00:00
Cristhian Zanforlin Lousa
232b0d7d00
fix: truncate text on filter to x icon fits the parent div (#3941)
🔧 (index.tsx): improve layout of sidebarFilterComponent to display type in a more readable way
2024-09-26 20:52:38 +00:00
Cristhian Zanforlin Lousa
11d0f4487b
fix: search for the parent category on sidebar (#3940)
* 📝 (extraSidebarComponent/index.tsx): refactor handleSearchInput function to use a normalizeString helper function for better code readability and maintainability

* ♻️ (extraSidebarComponent/index.tsx): remove unnecessary console.log statement from the code
2024-09-26 16:51:59 -03:00
Gabriel Luiz Freitas Almeida
bf2aadf6a4
refactor: update dependency versions and streamline backend installation commands (#3939)
* Update Makefile to streamline backend dependency installation commands

* Update dependency versions in pyproject.toml for weaviate-client, httpx, and others

* Update dependency versions in pyproject.toml for better compatibility and stability

* new lock

* refactor: streamline backend dependency installation commands

* update examples formatting
2024-09-26 12:23:26 -07:00
Gabriel Luiz Freitas Almeida
b877bc9e08
fix: Add 'langflow' to workspace configuration (#3935)
Add 'langflow' to workspace configuration in pyproject.toml
2024-09-26 12:07:03 -07:00
Mike Fortman
5520cb647b
refactor: Update parameter order and hide token for DS users (#3920)
* Update parameter order and hide token for DS users

* cleanup

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-26 06:31:00 -07:00