Commit graph

13,769 commits

Author SHA1 Message Date
Lucas Oliveira
f2abb944f6
fix: console reported issues (#3660)
* Added key to sidebar buttons

* Added key directrly to sidebar category

* Removed key definition on sidebar category

* Fix error of nested buttons on secretKeyModal

* Fix nested buttons on output modal

* Fix clip-path warning on components

* Fix components cannot be given refs on nodeOutputField

* Removed unused console.log

* Added key on profile pictures map

* Fixed hideOverlay being called when the table is destroyed

* Fixed valueFormatter error on Apply To Fields field on GlobalVariables page

* Updated headers on config page to ensure consistent design
2024-09-02 21:48:05 +00:00
Cristhian Zanforlin Lousa
70af48cfe4
fix: success dialog popping wrong (#3659)
* 🐛 (sideBarFolderButtons/index.tsx): fix success message not being set when files array is empty

* 🐛 (index.tsx): fix issue where success message was not being displayed when uploading files successfully
2024-09-02 14:10:47 -07:00
Cristhian Zanforlin Lousa
706d559003
fix: update Self Query Retriever Component (#3653)
* 🔧 (pyproject.toml): add lark dependency to support parsing and processing of grammars in the project
♻️ (SelfQueryRetriever.py): refactor input types in metadata fields to improve clarity and maintainability

* 📝 (SelfQueryRetriever.py): Update class name and imports for consistency and clarity
📝 (SelfQueryRetriever.py): Refactor input and output definitions for better readability and maintainability
📝 (SelfQueryRetriever.py): Refactor method signatures and variable names for improved code organization and understanding

* [autofix.ci] apply automated fixes

* ♻️ (SelfQueryRetriever.py): Remove unused import 'VectorStore' to clean up the code and improve maintainability.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-02 20:19:37 +00:00
anovazzi1
076f4f0772
fix: update BUNDLES_SIDEBAR_FOLDER_NAMES constant to include "Notion" (#3651)
* chore: update BUNDLES_SIDEBAR_FOLDER_NAMES constant to include "Notion"

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-02 17:18:47 +00:00
Nicolò Boschi
9368aef91e
ci: add tests for text input/output components (#3649)
* ci: add tests for text input/output components

* ci: add tests for text input/output components

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-02 07:33:30 -07:00
Gabriel Luiz Freitas Almeida
3eaad7bc3a
feat: add EventManager to centralize callbacks (#3434)
* refactor: Update MessageBase text attribute based on isinstance check.

* feat: Add update_message function to update a message in the database.

* refactor(chat): Update imports and remove unnecessary config method in ChatComponent.

* refactor: Add stream_message method to ChatComponent.

* refactor: Update method call in ChatOutput component.

* feat: Add callback function to custom component and update build_results signature.

* feat: Add callback parameter to instantiate_class function.

* feat(graph): Add callback functions for sync and async operations.

* feat: Add callback function support to vertex build process.

* feat: Add handling for added message in InterfaceVertex class.

* feat: Add callback support to Graph methods.

* feat(chat): Add callback function to build_vertices function.

* refactor: Simplify update_message function and use session_scope for session management.

* fix: Call set_callback method if available on custom component.

* refactor(chat): Update chat message chunk handling and ID conversion.

* feat: Add null check before setting cache in build_vertex_stream function.

* refactor: Fix send_event_wrapper function and add callback parameter to _build_vertex function.

* refactor: Simplify conditional statement and import order in ChatOutput.

* refactor: move log method to Component class.

* refactor: Simplify CallbackFunction definition.

* feat: Initialize _current_output attribute in Component class.

* feat: store current output name in custom component during processing.

* feat: Add current output and component ID to log data.

* fix: Add condition to check current output before invoking callback.

* refactor: Update callback to log_callback in graph methods.

* feat: Add test for callback graph execution with log messages.

* update projects

* fix(chat.py): fix condition to check if message text is a string before updating message text in the database

* refactor(ChatOutput.py): update ChatOutput class to correctly store and assign the message value to ensure consistency and avoid potential bugs

* refactor(chat.py): update return type of store_message method to return a single Message object instead of a list of Messages
refactor(chat.py): update logic to correctly handle updating and returning a single stored message object instead of a list of messages

* update starter projects

* refactor(component.py): update type hint for name parameter in log method to be more explicit

* feat: Add EventManager class for managing events and event registration

* refactor: Update log_callback to event_manager in custom component classes

* refactor(component.py): rename _log_callback to _event_manager and update method call to on_log for better clarity and consistency

* refactor(chat.py): rename _log_callback method to _event_manager.on_token for clarity and consistency in method naming

* refactor: Rename log_callback to event_manager for clarity and consistency

* refactor: Update Vertex class to use EventManager instead of log_callback for better clarity and consistency

* refactor: update build_flow to use EventManager

* refactor: Update EventManager class to use Protocol for event callbacks

* if event_type is not passed, it uses the default send_event

* Add method to register event functions in EventManager

- Introduced `register_event_function` method to allow passing custom event functions.
- Updated `noop` method to accept `event_type` parameter.
- Adjusted `__getattr__` to return `EventCallback` type.

* update test_callback_graph

* Add unit tests for EventManager in test_event_manager.py

- Added tests for event registration, including default event type, empty string names, and specific event types.
- Added tests for custom event functions and unregistered event access.
- Added tests for event sending, including JSON formatting, empty data, and large payloads.
- Added tests for handling JSON serialization errors and the noop function.

* revert chatOutput change

* Add validation for event function in EventManager

- Introduced `_validate_event_function` method to ensure event functions are callable and have the correct parameters.
- Updated `register_event_function` to use the new validation method.

* Add tests for EventManager's event function validation logic

- Introduce `TestValidateEventFunction` class to test various scenarios for `_validate_event_function`.
- Add tests for valid event functions, non-callable event functions, invalid parameter counts, and parameter type validation.
- Include tests for handling unannotated parameters, flexible arguments, and keyword-only parameters.
- Ensure proper warnings and exceptions are raised for invalid event functions.

* Add type ignore comment to lambda function in test_event_manager.py

* refactor: Update EventManager class to use Protocol for event callbacks

* refactor(event_manager.py): simplify event registration and validation logic to enhance readability and maintainability
feat(event_manager.py): enforce event name conventions and improve callback handling for better error management

* refactor(chat.py): standardize event_manager method calls by using keyword arguments for better clarity and consistency
refactor(chat.py): extract message processing logic into separate methods for improved readability and maintainability
fix(chat.py): ensure proper handling of async iterators in message streaming
refactor(component.py): simplify event logging by removing unnecessary event name parameter in on_log method call

* update event manager tests

* Add callback validation and manager parameter in EventManager

- Introduced `_validate_callback` method to ensure callbacks are callable and have the correct parameters.
- Updated `register_event` to include `manager` parameter in the callback.

* Add support for passing callback through the Graph in test_callback_graph

* fix(event_manager.py): update EventCallback signature to include manager parameter for better context in event handling
2024-09-02 15:41:19 +02:00
Lucas Oliveira
882c35ef6b
fix: stop building with abort controller (#3634)
* Added buildController and stopBuilding controllers

* Used stop building in header Stop button

* Set the build controller in API performstreamingrequest

* added setbuildcontroller to types
2024-09-02 06:36:51 -07:00
Nicolò Boschi
96872f3aa5
chore: refactor and add components integration tests (#3607)
* improve inegration tests

* add fixes

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-09-02 15:21:47 +02:00
anovazzi1
4ee25359a5
feature: add flow notes (#3460)
* feat: Add NoteDraggableComponent to extraSidebarComponent

This commit adds the NoteDraggableComponent to the extraSidebarComponent in the FlowPage. The NoteDraggableComponent allows users to drag and drop sticky note icons onto the page. When a note is dragged, its data is set as "note" in the dataTransfer object. The note has a default text value of null and a noteColor of "yellow". This component enhances the user experience by providing a convenient way to add notes to the page.

* feat: Add NoteNode component for displaying and editing notes

This commit adds the NoteNode component, which is responsible for displaying and editing notes in the FlowPage. The NoteNode component includes functionality for resizing, selecting, and editing the note text. It enhances the user experience by providing a convenient way to add and manage notes on the page.

* feat: Add NoteNode and NoteDraggableComponent for managing notes in FlowPage

This commit adds the NoteNode component, responsible for displaying and editing notes in the FlowPage. It also introduces the NoteDraggableComponent, allowing users to drag and drop sticky note icons onto the page. These components enhance the user experience by providing a convenient way to add and manage notes on the page.

* feat: Add DRAG_EVENTS_CUSTOM_TYPESS constant for custom drag event types

This commit adds the DRAG_EVENTS_CUSTOM_TYPESS constant to the constants file. It defines custom drag event types for the generic node and note node components. This constant enhances the code by providing a centralized place to manage and reference the custom drag event types.

* feat: Add support functions for custom drag event types

* feat: Add support for custom drag event types in PageComponent

This commit adds support for custom drag event types in the PageComponent of the FlowPage. It imports the necessary functions from the utils file and uses them to check if the dragged data has supported node types. This enhancement improves the drag and drop functionality by allowing only supported node types to be dropped on the page.

* feat: Add NoteDataType for managing note data in FlowPage

* refactor: create new types for noteNode

* feat: Update NoteNode component to use new NoteDataType

The NoteNode component in the NoteNode/index.tsx file has been updated to use the new NoteDataType for managing note data in the FlowPage. This change ensures consistency and improves the codebase.

* node with title and description

* feat: Add "note" alias for StickyNote in nodeIconsLucide

This commit adds the "note" alias for the StickyNote icon in the nodeIconsLucide object in the styleUtils.ts file. This alias allows for more intuitive usage of the StickyNote icon by providing an alternative name. It improves code readability and maintainability.

* refactor: Update NodeDescription component to use emptyPlaceholder prop

The NodeDescription component in the GenericNode/components/NodeDescription/index.tsx file has been updated to use the emptyPlaceholder prop. This change allows for more flexibility in customizing the placeholder text when the description is empty. It improves code reusability and enhances the user experience.

* refactor: Remove unused Textarea import in NoteNode component

* add initial resize to note component

* [autofix.ci] apply automated fixes

* refactor: add code validation functionality on tanstack mutation (#3469)

* Added Validate endpoint

* Added API Code Validate type

* Added post validate code hook

* Used mutation instead of API call to validate code

* Removed validate code api call

* refactor: Update NodeName component to use full width in GenericNode

The NodeName component in the GenericNode module has been updated to use the full width of the parent container. This change ensures that the input field or tooltip for the node name occupies the entire available space, improving the visual consistency and user experience.

* refactor: Update NodeDescription component to use full height in GenericNode

The NodeDescription component in the GenericNode module has been updated to use the full height of the parent container. This change ensures that the description text area occupies the entire available space, improving the visual consistency and user experience.

* refactor: Update NodeDescription component to use full height in GenericNode

* refactor: Update NodeDescription component to use full height in GenericNode

* increase size control on note node

* refactor: Update NoteNode component to use constants for min and max dimensions

The NoteNode component in the CustomNodes module has been updated to use the constants for the minimum and maximum dimensions. This change improves code readability and maintainability by centralizing the values in the constants file. The component now uses the NOTE_NODE_MIN_WIDTH, NOTE_NODE_MIN_HEIGHT, NOTE_NODE_MAX_HEIGHT, and NOTE_NODE_MAX_WIDTH constants for setting the dimensions of the NodeResizer and the inline styles. This ensures consistency across the application and makes it easier to adjust the dimensions in the future.

* fix overflow issue

* refactor: update NoteDraggableComponent

The NoteDraggableComponent in the extraSidebarComponent module has been updated to remove unused code and improve functionality. The code for adding a note has been removed as it is no longer needed. Additionally, the component has been updated to use a new design and layout for better user experience. This refactor improves the overall code cleanliness and removes unnecessary clutter.

* refactor: Update NoteNode component to use constants for min and max dimensions

* update component to accept multiple colors

* update note colors

* update min width

* refactor: Update NodeDescription component to accept additional styling options

The NodeDescription component in the GenericNode module has been updated to accept additional styling options. The component now includes the inputClassName, mdClassName, and style props, allowing for more customization of the input and markdown elements. This refactor improves the flexibility and extensibility of the component, making it easier to adapt to different design requirements.

* fix bug on description size

* [autofix.ci] apply automated fixes

* feat: skip note nodes when building vertices"

add check to skip nodes of type NoteNode when building vertices in the graph
this prevents unnecessary processing of note nodes which are not part of the actual graph logic

* fix: update serialization and improve error handling (#3516)

* feat(utils): add support for V1BaseModel in serialize_field

Add support for V1BaseModel instances in the serialize_field function by
checking for a "to_json" method. If the method is not present, return the
attribute values as a dictionary.

* refactor: Update field serializer function and error handling in build_flow function

* fix: no module named 'psycopg2' (#3526)

* fix: add dependecy to Dockerfile

* fix: revert quick fix

* fix: update poetry.lock

* feat: add compression support to frontend and backend (#3484)

* Added compression lib to frontend

* Added compression handling to backend

* Added compression to body requests on frontend

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* refactor: add code validation functionality on tanstack mutation (#3469)

* Added Validate endpoint

* Added API Code Validate type

* Added post validate code hook

* Used mutation instead of API call to validate code

* Removed validate code api call

* refactor: Update NodeName component to use full width in GenericNode

The NodeName component in the GenericNode module has been updated to use the full width of the parent container. This change ensures that the input field or tooltip for the node name occupies the entire available space, improving the visual consistency and user experience.

* fix imports

* refactor: remove unused import in styleUtils.ts

* refactor: update checkOldNodesOutput to include only generic nodes

The checkOldNodesOutput function in reactflowUtils.ts has been updated to include only generic nodes when checking for nodes without outputs. This change ensures that only nodes of type "genericNode" are considered, improving the accuracy of the check and preventing false positives.

* refactor: improve checkOldNodesOutput to include only generic nodes

* [autofix.ci] apply automated fixes

* 📝 (frontend): Add data-testid attribute to elements for testing purposes in NodeDescription, NoteToolbarComponent, NoteNode, and Textarea components
 (frontend): Create end-to-end test for interacting with sticky notes including creating, editing, duplicating, and deleting notes

*  (stop-building.spec.ts): Add a 1-second delay after clicking the stop building button to improve user experience
 (sticky-notes.spec.ts): Add a new end-to-end test for interacting with sticky notes on the main page to ensure functionality and user interaction with sticky notes.

* refactor: update NodeName and GenericNode components to improve UI and code readability

* [autofix.ci] apply automated fixes

* chore: Update NodeDescription component to use dark mode placeholder color

* chore: Update sidebar note component icon to use StickyNote instead of SquarePen

* refactor(main.py): remove unused imports and middleware related to GZip to simplify code and improve readability
feat(main.py): add middleware for configuring logger to improve logging functionality and centralize logging configuration

* add center postion in the flow

* chore: Update NoteNode icon to use SquarePen instead of StickyNote

* [autofix.ci] apply automated fixes

* chore: Update API base URL

* [autofix.ci] apply automated fixes

* chore:  add feature flag for MVPs

* code format

*  (NoteNode/index.tsx): Wrap IconComponent in a div with data-testid "note_icon" for better accessibility and testing
 (PageComponent/index.tsx): Add data-testid "add_note" to ControlButton for easier testing and identification
🔧 (sticky-notes.spec.ts): Update test selectors to use new data-testid "note_icon" and "add_note" for improved test reliability

* chore: Update types-markdown to version 3.7.0.20240822

* feat: Add lazy loading for images in sticky-notes.spec.ts

* [autofix.ci] apply automated fixes

* update poetry lock

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes

* Refactor feature flag import for ENABLE_MVPS across components and tests

* Add skip marker to unimplemented test in test_graph_state_model.py

---------

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>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Ítalo Johnny <italojohnnydosanjos@gmail.com>
Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
2024-09-02 11:53:47 +00:00
Gabriel Luiz Freitas Almeida
bc6e918f49
fix: add tests to cycles in Graph and improve error handling (#3628)
* Add cycle detection and handling in graph edge building process

- Introduced `cycles` property to detect cycles in the graph.
- Modified `_build_edges` and `build_edge` methods to differentiate between `CycleEdge` and `Edge`.
- Updated imports and type hints to support new functionality.

* Add cycle detection and handling in graph processing

- Introduced `is_cyclic` property to check for cycles in the graph.
- Added `_snapshot` method for capturing the current state of the graph.
- Modified `layered_topological_sort` to handle cyclic graphs by starting from a specified start component.
- Updated imports and type hints for better code clarity and functionality.

* Refactor tests and components for improved caching and data handling

- Updated `test_vector_store_rag.py` to use `set_on_output` with `cache=True` and simplified assertions.
- Enhanced `test_memory_chatbot.py` with additional assertions for graph structure and caching.
- Simplified `to_data` method in `base.py` to directly return `_data` without JSON serialization.

* Add unit tests for detecting cycles in graph

- Introduce `test_cycle_in_graph` to verify cyclic behavior in the graph.
- Add `test_cycle_in_graph_max_iterations` to ensure max iterations limit is respected.
- Implement `Concatenate` component for testing purposes.

* Disable output cache in graph tests to allow loops to work

* Refactor: Update VertexStates enum values to uppercase and optimize imports in base.py

* Refactor type hints and improve error handling in `Vertex` class

- Replace `ValueError` with `NoComponentInstance` exception for missing component instances.
- Add `target_handle_name` parameter to `_get_result` method for better result retrieval.
- Refactor type hints to use `collections.abc` for `AsyncIterator`, `Generator`, and `Iterator`.
- Update type hints for `extract_messages_from_artifacts` and `successors_ids` methods to use generic `dict` and `list`.
2024-09-02 11:45:37 +00:00
dependabot[bot]
751edcf5dc
build(deps):(deps): bump install-pinned/ruff from 48a5818c5f7ce30e2822b67fb9c26d3e25d31fab to 826c99bfba88282a5506ab737c92253a106c070e (#3645)
build(deps):(deps): bump install-pinned/ruff

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

---
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-09-02 04:42:58 -07:00
Gabriel Luiz Freitas Almeida
e790925b75
feat(pyproject.toml): update langchain-google-vertexai, langchain-groq, langchain-pinecone, and langchain-mistralai versions to the latest available (#3604)
* feat(pyproject.toml): update langchain-google-vertexai, langchain-groq, langchain-pinecone, and langchain-mistralai versions to the latest available

update markdown and upstash-vector versions

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-31 14:40:29 -07:00
Lucas Oliveira
c9cf9d8304
refactor: update docs link to be modular (#3637)
changed docs link to be modular
2024-08-30 21:51:05 +00:00
Lucas Oliveira
47a9bf3890
fix: add unstructured icon (#3631)
Added Unstructured icon

Co-authored-by: Cristhian Zanforlin Lousa <cristhian.lousa@gmail.com>
2024-08-30 21:41:25 +00:00
Cristhian Zanforlin Lousa
70ac19740a
tests: add new tests to tableComponent (#3627)
* refactor: modularized categories and fixed Discover More not appearing

* refactor: modularized categories and fixed Discover More not appearing

* refactor: modularized categories and fixed Discover More not appearing

* refactor: add end-to-end test for interacting with table input component

* refactor: Remove duplicate ID in filterSidebar.spec.ts and remove commented code in tableInputComponent.spec.ts
2024-08-30 21:35:51 +00:00
Nicolò Boschi
1c87a804bf
chore: improve db session access (#3138)
* chore: improve db session access

* chore: improve db session access

* fix

* [autofix.ci] apply automated fixes

* Refactor session management in test_sqlite_pragmas to use with_session method

---------

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-08-30 14:03:29 -07:00
Lucas Oliveira
27b5f55ef9
refactor: health check endpoint (#3635)
* Changed health check to use /health_check and to be modularized

* Added default value

* Added health constant to default export

* check cors before inserting custom headers

* Added get global variables check on init

* Updated global variables to start with undefined

* Fixed redirect when showGeneralSettings is disabled

* Added isOpen props to custom api generator
2024-08-30 20:40:16 +00:00
Gabriel Luiz Freitas Almeida
15bb39ac9c
chore: Remove PDF extra from unstructured dependency because of pytorch (#3633)
Remove PDF extra from unstructured dependency in pyproject.toml
2024-08-30 13:26:04 -07:00
Lucas Oliveira
a71375c6f9
fix: auto login and logout functionality (#3629)
* Made auto login not call refresh

* Fixed mutation query

* Removed navigation to login on logout function

* Made refresh token set cookie for docker

* Added return to login with custom navigate and added check for refreshing only if its authenticated

* Minor refactor

* Navigate after logout on get autologin

* Removed unused console.log
2024-08-30 18:19:32 +00:00
Lucas Oliveira
3bef9aa633
refactor: custom post loading and add AppAuthenticatedPage (#3632)
* Added post loading hook to appInitPage

* Removed custom post loading

* Changed custom post loading to cusotm post auth

* Adds AppAuthenticatedPage

* Uses AppAuthenticatedPage inside protected route
2024-08-30 17:53:11 +00:00
Vinícios Batista da Silva
387ea32943
feat: Update AI/ML Models list (#3623)
* feat: Update AI/ML Models list

Co-authored-by: Vinícios Batista da Silva <vinicios.batsi@gmail.com>"

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-30 09:10:32 -07:00
Gabriel Luiz Freitas Almeida
1a5752c025
chore: Update lint workflow to use poetry for running Mypy (#3630)
Update lint workflow to run Mypy directly with poetry
2024-08-30 16:03:38 +00:00
Eric Hare
1ed5ce8e26
fix: Dependency update for unstructured component (#3552)
* FIX: Dependency update for unstructured component

* [autofix.ci] apply automated fixes

* Add nltk download script

* chore(pyproject.toml): move nltk_setup script definition to [tool.poetry.scripts] section for better organization and readability

* [autofix.ci] apply automated fixes

* Make nltk resource downloading part of run

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes

* Use logger for nltk messages

* Move the download resources function

* [autofix.ci] apply automated fixes

* Move nltk resource download

* [autofix.ci] apply automated fixes

* Update main.py

* Update poetry lock

* Update main.py

---------

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-08-30 06:48:36 -07:00
Lucas Oliveira
922fd5f645
feat: add gtm to docs (#3622) 2024-08-29 19:35:02 -03:00
Gabriel Luiz Freitas Almeida
f596cc4ad3
feat!: replace Agent starter projects with simpler ones (#3612)
* Add initial setup for "Simple Agent" starter project

- Introduced a new JSON configuration for the "Simple Agent" starter project.
- The flow includes nodes for Chat Input, Chat Output, OpenAI Model, Tool Calling Agent, Calculator Tool, and Python REPL Tool.
- Configured edges to connect these nodes, enabling interaction between different components.
- Added detailed descriptions and configurations for each node to facilitate easy setup and usage.

* Add Travel Planning Agents starter project JSON file

- Introduced a new JSON file for Travel Planning Agents in the starter projects directory.
- The JSON file includes configurations for various nodes such as ChatInput, ChatOutput, OpenAIModel, ToolCallingAgent, SearchAPI, URL Content Fetcher, and CalculatorTool.
- Defined connections between nodes to create a multi-agent system for planning trips.
- Added detailed prompts and configurations for each node to facilitate travel itinerary creation and information retrieval.

* Update example names in newFlowModal to match updated project terminology

* Update agent names in undrawCards component for consistency

* Rename "Complex Agent" to "Dynamic Agent" across frontend and backend components

* format project

*  (Dynamic Agent.spec.ts): Add end-to-end test for Dynamic Agent functionality
 (Simple Agent.spec.ts): Add end-to-end test for Simple Agent functionality
 (Travel Planning Agent.spec.ts): Add end-to-end test for Travel Planning Agent functionality

*  (Travel Planning Agent.spec.ts): Update end-to-end test for Travel Planning Agent to include new interactions and connections for improved test coverage and functionality.

---------

Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
2024-08-29 20:38:11 +00:00
Lucas Oliveira
59b6d8acc0
refactor: health check and error handling (#3620)
* Refactored getHealth to get if any value of health check is not ok

* Added custom health check

* Created generic error component to display error popups

* added useHealthCheck hook

* Updated wrapper page to use health check hook

* Removed custom error

* Added custom loading page for when custom primary loading is not done

* Changed health check to be disabled when flow is building or any request is pending

* Changed text of ttimeout error
2024-08-29 19:40:21 +00:00
Lucas Oliveira
9102c6272f
refactor: added analytics track and custom parameter support (#3617)
* Added analytics track

* Changed post add user to just use the function

* Added tracking in various components

* Added custom parameter support

* Added centered footer
2024-08-29 19:35:17 +00:00
Lucas Oliveira
32d51b69e8
refactor: custom api code generator and fix chat locking when saving (#3618)
* Removed saveLoading from the chat

* Fixed initialSetup that couldnt be null

* Added types for get codes type

* Added new types for getCodes and initialSetup on Tweaks store

* Created a use custom api code to return all code

* Passed the getCodes from the custom hook into initialSetup

* Updated tabs array to receive object

* Update every code to get correct props

* Update tweaks store to handle refactored getCodes and createTabsArray

* Added custom api generator component on top of the codetabscomponent
2024-08-29 19:31:03 +00:00
Marcelo Nunes Alves
10d03360c5
fix: Problem in the description field when using the MariaDB or MySQL (#3431)
* fix: Problem in the description field when using the MariaDB or MySQL database.

* fix: Problem in the description field when using the MariaDB or MySQL database.

* fix: Add the migration script to update description columns type.

* [autofix.ci] apply automated fixes

* Update src/backend/base/langflow/alembic/versions/1d90f8a0efe1_update_description_columns_type.py

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

---------

Co-authored-by: Marcelo Nunes <marcelo.nunes@nava.com.br>
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-08-29 12:10:42 -07:00
Lucas Oliveira
06ea6c408b
refactor: modular navigation and custom api calls (#3613)
* Added customization files

* Added custom API headers and changed logout mutation

* Changed mutationLogout on authGuard

* Renamed feature flags

* Changed auto login to run after primary loading

* Removed unused code

* Added undefined on mutationfunctiontype to have options

* Changed logout to mutationLogout

* Return data on getConfig

* Added custom wrapper

* changed hasStore to be the constant by default

* Added custom header

* Added customParam feature flag

* Fix routes and custom link and navigate to consider absolute and relative paths

* Fixed regex on  tabs search component

* Added CustomNavigate

* Added basename and ports and URLs config

* [autofix.ci] apply automated fixes

* Update config-constants.ts

* Update index.tsx

* Fixed path comparations

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-29 15:05:23 +00:00
Lucas Oliveira
cb1a2f24b3
refactor: modularized categories (#3615)
Modularized category and fixed Discover More not appearing
2024-08-29 11:42:41 -03:00
Lucas Oliveira
af052285ec
refactor: queries loading order and wrapper order (#3603)
* Added loading page

* Removed unused loadings and changed loading to LoadingPage

* Refactored ComponentsComponent to receive info from parent

* refactored headerTabsComponent to receive loading from parent

* Added loading of folders into MyCollectionComponent

* removed unused loading and folderSelected

* updated get config api call to update everything

* Make app wait for autoLogin to be set to execute everything else

* changed API type to not contain params if its undefined

* Updated get autologin to do all logic regarding autologin

* Updated other queries with the new useQueryFunctionType type

* Updated App.tsx with new gets and configurations and added a loader before loading the router

* Made ProtectedRoute refresh on authentication change

* Fixed order of wrappers in order for Auth and  API context to have access to router

* Made loading only exist in one place

* 📝 (folders.spec.ts): remove unused test for adding folder by drag and drop to improve test suite cleanliness and maintainability.

* Fixed flow dropping to another folder

*  (folders.spec.ts): add test for adding folder by drag and drop functionality
🔧 (auto-save-off.spec.ts): add click event for "Save And Exit" button
🔧 (dragAndDrop.spec.ts): change dispatchEvent to getByTestId and add assertions for specific text visibility
🔧 (store-shard-3.spec.ts): increase timeout for page.waitForTimeout to improve test reliability

*  (folders.spec.ts): update test description to be more descriptive and accurate

* test: improve timeout for page.waitForSelector in auto-save-off.spec.ts

* feat: add replace button functionality to main page

The code changes include adding the functionality for the replace button on the main page. This allows users to replace a flow or a component. The replace button is now visible on the page, and clicking on it triggers the appropriate action.

Recent user commits:
- test: improve timeout for page.waitForSelector in auto-save-off.spec.ts
-  (folders.spec.ts): update test description to be more descriptive and accurate
-  (folders.spec.ts): add test for adding folder by drag and drop functionality
- 🔧 (auto-save-off.spec.ts): add click event for "Save And Exit" button
- 🔧 (dragAndDrop.spec.ts): change dispatchEvent to getByTestId and add assertions for specific text visibility
- 🔧 (store-shard-3.spec.ts): increase timeout for page.waitForTimeout to improve test reliability

Recent repository commits:
- test: improve timeout for page.waitForSelector in auto-save-off.spec.ts
-  (folders.spec.ts): update test description to be more descriptive and accurate
-  (folders.spec.ts): add test for adding folder by drag and drop functionality
- 🔧 (auto-save-off.spec.ts): add click event for "Save And Exit" button
- 🔧 (dragAndDrop.spec.ts): change dispatchEvent to getByTestId and add assertions for specific text visibility
- 🔧 (store-shard-3.spec.ts): increase timeout for page.waitForTimeout to improve test reliability
- Fixed flow dropping to another folder
- 📝 (folders.spec.ts): remove unused test for adding folder by drag and drop to improve test suite cleanliness and maintainability.
- Made loading only exist in one place
- Fixed order of wrappers in order for Auth and API context to have access to router
- Made ProtectedRoute refresh on authentication change
- Updated App.tsx with new gets and configurations and added a loader before loading the router
- Updated other queries with the new useQueryFunctionType type

---------

Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
2024-08-29 12:10:26 +00:00
Gabriel Luiz Freitas Almeida
e7a48d58e6
style: Fix type comparison issues in codebase (#3606)
style: fix E721
2024-08-29 11:48:15 +00:00
Nicolò Boschi
1718b3c9ea
ci: make validate pull request action less verbose (#3061) 2024-08-29 01:06:02 +00:00
Gabriel Luiz Freitas Almeida
48fb846a4d
refactor: change typing annotations in tests folder (#3594)
* refactor(log_router.py): change variable type annotation from List to list for better consistency
refactor(utils.py): change variable type annotation from Dict to dict for better consistency
refactor(base.py): change variable type annotation from Optional to Union for better clarity
refactor(callback.py): change variable type annotation from Dict to dict for better consistency
refactor(chat.py): change variable type annotation from Optional to Union for better clarity
refactor(endpoints.py): change variable type annotation from Optional to Union for better clarity
refactor(flows.py): change variable type annotation from List to list for better consistency

refactor(api): update response_model annotations to use lowercase list for consistency and improve readability

refactor(store.py): update type annotations for query parameters in get_components endpoint to improve code readability and maintainability
feat(store.py): add support for type hinting Union and list types in query parameters for better data validation and documentation

* run make format

* refactor(input_mixin.py): update typing annotations for variables to use union types for better clarity and compatibility with Python 3.10
refactor(inputs.py): update typing annotations for variables to use union types and import necessary modules for compatibility with Python 3.10

* refactor(base.py): remove unnecessary imports and update typing for fields in Input and Output classes
feat(base.py): add support for specifying field types more explicitly in Input and Output classes
feat(frontend_node/base.py): enhance typing and field definitions in FrontendNode class
feat(frontend_node/custom_components.py): improve typing and field definitions in CustomComponentFrontendNode and ComponentFrontendNode classes
feat(template/base.py): update typing for fields in Template class and remove unnecessary imports

* refactor(inputs): remove unnecessary Optional import from typing in input_mixin.py and inputs.py files to improve code readability and maintainability

* refactor(schema.py): change 'Type' to 'type' for consistency in type annotations
refactor(schema.py): change 'list' to 'List' and 'Literal' to 'literal' for correct type hinting in create_input_schema function

* refactor(utils.py): change typing annotations from List and Union to list and type to follow PEP 585 standards
refactor(test_schema.py): change typing annotations from List and List to list and list to follow PEP 585 standards
refactor(test_graph.py): change typing annotations from Type and Union to type and Vertex | None to follow PEP 585 standards
refactor(test_io_schema.py): change typing annotations from List and List to list and list to follow PEP 585 standards
refactor(test_custom_component.py): update file reading method to remove unnecessary "r" mode
refactor(test_helper_components.py): update file reading method to remove unnecessary "r" mode
refactor(test_kubernetes_secrets.py): update b64encode method argument to bytes type
refactor(test_template.py): change typing annotations from Optional, List, and Dict to list, dict, and None to follow PEP 585 standards

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-28 19:45:19 +00:00
Gabriel Luiz Freitas Almeida
1883710dd1
chore: update type annotations in template, io and inputs modules (#3593)
* refactor(input_mixin.py): update typing annotations for variables to use union types for better clarity and compatibility with Python 3.10
refactor(inputs.py): update typing annotations for variables to use union types and import necessary modules for compatibility with Python 3.10

* refactor(base.py): remove unnecessary imports and update typing for fields in Input and Output classes
feat(base.py): add support for specifying field types more explicitly in Input and Output classes
feat(frontend_node/base.py): enhance typing and field definitions in FrontendNode class
feat(frontend_node/custom_components.py): improve typing and field definitions in CustomComponentFrontendNode and ComponentFrontendNode classes
feat(template/base.py): update typing for fields in Template class and remove unnecessary imports

* refactor(inputs): remove unnecessary Optional import from typing in input_mixin.py and inputs.py files to improve code readability and maintainability

* refactor(schema.py): change 'Type' to 'type' for consistency in type annotations
refactor(schema.py): change 'list' to 'List' and 'Literal' to 'literal' for correct type hinting in create_input_schema function

* test: fix tests

---------

Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
2024-08-28 19:35:01 +00:00
Gabriel Luiz Freitas Almeida
3e19a3fd36
feat: allow passing a Component to the set method (#3597)
* refactor: Add _find_matching_output_method to Component class

* feat: allow components to be passed in set method

* fix: Add test for graph set method with valid component

* set value variable to the output callable

* refactor: Update test_component.py to use set_component method

This commit refactors the test_component.py file in the custom_component directory. The test_set_invalid_input() function has been renamed to test_set_component() to better reflect its purpose. Additionally, the test_set_component() function now sets the agent parameter using the set_component() method instead of raising a ValueError. This change improves the readability and maintainability of the code.

* refactor: Fix formatting issue in _build_error_string_from_matching_pairs

The _build_error_string_from_matching_pairs method in the Component class had a formatting issue when input types were empty. This commit fixes the issue by adding a check for empty input types and providing an empty list as a fallback. This improves the accuracy and readability of the error string generated by the method.

* fix(component.py): add validation to ensure output method is a string to prevent potential runtime errors
2024-08-28 12:31:14 -07:00
Jordan Frazier
1a0bc3b968
fix: update astra assistants version (#3602)
fixes issue with tree-sitter-python on m1 macs
2024-08-28 12:30:23 -07:00
Gabriel Luiz Freitas Almeida
d7dbf1ae78
refactor(api): change variable type annotations (#3592)
* refactor(log_router.py): change variable type annotation from List to list for better consistency
refactor(utils.py): change variable type annotation from Dict to dict for better consistency
refactor(base.py): change variable type annotation from Optional to Union for better clarity
refactor(callback.py): change variable type annotation from Dict to dict for better consistency
refactor(chat.py): change variable type annotation from Optional to Union for better clarity
refactor(endpoints.py): change variable type annotation from Optional to Union for better clarity
refactor(flows.py): change variable type annotation from List to list for better consistency

refactor(api): update response_model annotations to use lowercase list for consistency and improve readability

refactor(store.py): update type annotations for query parameters in get_components endpoint to improve code readability and maintainability
feat(store.py): add support for type hinting Union and list types in query parameters for better data validation and documentation

* run make format
2024-08-28 19:15:04 +00:00
Cristhian Zanforlin Lousa
7641e81ca3
fix: add retriever input_type on RetrieverToolComponent + tests (#3601)
*  (RetrieverTool.py): add "input_types" field to the configuration of the RetrieverToolComponent class

*  (generalBugs-shard-12.spec.ts): add end-to-end test for connecting RetrieverTool to other components in the application.
2024-08-28 12:02:42 -07:00
Gabriel Luiz Freitas Almeida
9c8dd8e1f0
chore: upgrade type annotations in graph and custom modules (#3591)
* refactor(tests): update import statements in conftest.py to use collections.abc module for better compatibility and maintainability

* run pyupgrade on graph module

* [autofix.ci] apply automated fixes

* refactor(attributes.py): change import statement from 'typing.Callable' to 'collections.abc.Callable' for better compatibility
refactor(code_parser.py): update type annotations to use '|' for Union types for better readability
refactor(base_component.py): update type annotations to use '|' for Union types for better readability
refactor(component.py): change import statement from 'typing.Callable' to 'collections.abc.Callable' for better compatibility
refactor(component.py): update type annotations to use '|' for Union types for better readability
refactor(component.py): update type annotations to use 'list' instead of 'List' for consistency

refactor(custom_component.py): update typing imports and annotations for better readability and consistency

refactor(utils.py): change type hint 'List' to 'list' for consistency and compatibility with Python 3.9

* run make format

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-28 18:48:24 +00:00
Gabriel Luiz Freitas Almeida
5d81e8dce6
refactor: update Makefile commands for improved readability and efficiency (#3596)
* chore(Makefile): redirect output of 'poetry install' and 'npm install' commands to /dev/null to reduce noise
chore(Makefile): redirect output of 'npm run build' command to /dev/null to improve build process efficiency
feat(Makefile): update build_frontend target to include copying built files to backend directory for deployment

* chore(Makefile): refactor lint target to depend on install_backend task for better dependency management
chore(Makefile): refactor frontend, frontendc, backend, build_and_run, build_and_install, and build targets to depend on setup_env task for consistent environment setup before execution

* chore(Makefile): update Makefile commands to use @ symbol for silent execution and improve readability

* chore(Makefile): update Makefile commands to use "@" to suppress command output and improve readability

* chore(Makefile): update run_cli target to include dependencies installation and frontend build steps for better clarity and consistency

* chore(Makefile): add command to delete empty directories in clean_python_cache target
2024-08-28 11:45:56 -07:00
Cristhian Zanforlin Lousa
9ae4e29815
tests: improve delete rows from table message test (#3598)
🐛 (generalBugs-shard-1.spec.ts): Fix timing issues in end-to-end test by adding explicit waits for elements to be visible before interacting with them
2024-08-28 11:38:23 -07:00
Cristhian Zanforlin Lousa
b1f79a5511
tests: Add Integration with starter-projects Endpoint and Vector Store Test (#3599)
*  (App.tsx): Add useGetStarterProjectsQuery hook to fetch starter projects data
📝 (constants.ts): Add STARTER_PROJECTS constant to define the endpoint for starter projects API
📝 (use-get-starter-projects.ts): Create useGetStarterProjectsQuery hook to fetch starter projects data
📝 (index.tsx): Add AppWrapperPage test for drag and drop functionality with starter projects data
📝 (starter-projects.spec.ts): Add end-to-end test for drag and drop functionality with starter projects data

*  (starter-projects.spec.ts): update test description to be more descriptive and specific about the test scenario

* ♻️ (App.tsx): remove unused useGetStarterProjectsQuery hook to clean up code and improve readability

* 🔧 (App.tsx): remove unused import useGetStarterProjectsQuery to clean up code and improve readability
2024-08-28 11:37:50 -07:00
Lucas Oliveira
d6537b724e
refactor: routes and back button (#3600)
* Changed ProtectedRoute to handle refresh token

* Created DashboardWrapperPage to insert header into elements

* Changed routes to be contained by only one ProtectedRoute

* Removed refresh and get version query of App.tsx

* Added loading if user not authenticated in ProtectedAdminRoute

* Changed page layout to not contain header

* Changed AdminPage and FlowPage to not have headers

* Removed unused variables

* Refactored redirectToLastLocation of headerComponent

* Removed unused track last visited path

* changed viewPage to not set onFlowPage since it's used only on header

* Added flow fetching into Playground page

* Fixed back button not working between flows

* Changed duplicate requests to show which request failed

* Refactored useGetBuilds to remove duplicated request

* Re-added get version query and config query

* [autofix.ci] apply automated fixes

* Fix tests that rely on autosave delay

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-08-28 16:52:11 +00:00
Cristhian Zanforlin Lousa
ffff5720d8
fix: Ensure Correct Focus on Playground Chat Input (#3582)
 (textAreaWrapper/index.tsx): add useEffect hook to focus on input when conditions are met
♻️ (AppWrapperPage/index.tsx): remove unnecessary console.log statement
2024-08-28 05:50:48 -07:00
ming
71a9524478
fix: auto_saving_interval type (#3585) 2024-08-28 12:12:37 +00:00
Himanshu Dixit
9e7c2d0100
feat: bump composio version (#3586)
feat: bump composio
2024-08-28 05:00:31 -07:00
Eric Hare
28c94145c7
feat: Add Glean Search API Component (#3532) 2024-08-27 22:03:13 -03:00
anovazzi1
03e95d4522
feat: add notion integration components (#3579) 2024-08-27 22:01:43 -03:00