Commit graph

61 commits

Author SHA1 Message Date
Christophe Bornet
c0b25fa651
ref: Remove some useless asyncio.to_thread (#5149)
Remove some useless asyncio.to_thread
2024-12-08 20:13:08 +01:00
Christophe Bornet
2f0c67e851
ref: Bump ruff version to 0.8 (#5087) 2024-12-08 11:16:06 +00:00
Ali Saleh
7c01b5a040
feat: Enhance Observability with ArizePhoenixTracer Integration (#5058)
* Added ArizePhoenixTracer

* [autofix.ci] apply automated fixes

* Fixed Ruff Style Check Errors

* add Arize icon

* Fixed Mypy Errors

* Refactor ArizeIcon component to use arrow function syntax

Co-authored-by: Jeff Carpenter <jeffrey.carpenter@datastax.com>
Co-authored-by: Ítalo Johnny <italojohnnydosanjos@gmail.com>
Co-authored-by: anovazzi1 <otavio2204@gmail.com>
2024-12-05 16:09:02 +00:00
Christophe Bornet
c1bd7c89c3
fix: Fix test_get_and_cache_all_types_dict (#5054) 2024-12-05 14:15:21 +01:00
Luis Felipe Salazar Ucros
fcff5e4e48
fix: sambanova streaming (#5002)
fix: add sseclient-py dependency to fix sambanova streaming
2024-12-03 13:28:31 +00:00
Gabriel Luiz Freitas Almeida
712a43958c
fix: updates file size limit to use middleware and add tests for uploads (#4883) 2024-11-28 12:25:26 +00:00
Phil Miesle
654b44347b
adding ability for APIRequest to retry and save to a file (#4677)
* re-adding ability for APIRequest to retry and save to a file

* [autofix.ci] apply automated fixes

* enabling selective inclusion of httpx headers, along with response header

* [autofix.ci] apply automated fixes

* Update api_request.py

* [autofix.ci] apply automated fixes

* Update test_data_components.py

* Update test_data_components.py

* [autofix.ci] apply automated fixes

* Update api_request.py

* Update api_request.py

* Update api_request.py

* Update api_request.py

* Update api_request.py

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Eric Hare <ericrhare@gmail.com>
2024-11-25 19:58:48 -08:00
Christophe Bornet
1ba2e0e71b
ref: Add aiofile to do async file operations (#4705)
Add aiofile to do async file operations
2024-11-25 23:50:25 +00:00
Gabriel Luiz Freitas Almeida
091944095f
chore: Bump package versions for langflow and langflow-base (#4816)
fix: bump package versions to 1.1.1 and 0.1.1 for langflow and langflow-base
2024-11-25 16:14:39 +00:00
Christophe Bornet
a670edd79a
feat: Bump blockbuster to v1.1.1 (#4802)
Bump blockbuster to v1.1.1
2024-11-23 14:44:41 -08:00
Karan Vaidya
3e1b22b23f
feat: improve composio oauth experience (#4613) 2024-11-23 15:23:57 +00:00
Christophe Bornet
ab63ddddbd
ref: Use blockbuster package (#4777)
* Use blockbuster package

* Upgrade blockbuster to v1.1
2024-11-23 15:05:56 +00:00
Sebastián Estévez
061971f913
chore: Tighten up dependencies (#4792)
* take 1 WIP

* remove firecrawl dep from langflow package, only usage appears to be in langflow-base

* langchain-google-genai to 2.0.1 which is what we have now in the lock file

* widen ranges based on old lock file

* lock
2024-11-22 11:37:17 -08:00
Sebastián Estévez
4f27dbd918
chore: speed up whl install in cli tests with uv (#4764)
uv for whl install
2024-11-21 17:19:18 +00:00
Gabriel Luiz Freitas Almeida
be7eac9e00
fix: Gracefully handle missing imports for model components (#4743)
* Handle ImportError for langchain_groq in Groq model initialization

* Refactor model input constants to handle missing imports gracefully

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-11-21 16:41:01 +00:00
Gabriel Luiz Freitas Almeida
9450f8529a
fix: Update dependency versions for pydantic to fix sqlmodel conflict (#4755)
Update dependency versions for pydantic in pyproject.toml
2024-11-21 16:01:14 +00:00
Eric Hare
2fa258068d
fix: CrewAI-based flows with no extra openai (#4683)
* fix: CrewAI-based flows with no extra openai

* [autofix.ci] apply automated fixes

* Clean up the location of the crewai model processing

* [autofix.ci] apply automated fixes

* Properly subclass the tasks and agents method

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-11-18 23:04:07 +00:00
Eric Hare
2cf3881dc6
fix: Upgrade astradb version and graph db component (#4580) 2024-11-13 12:24:25 -08:00
Gabriel Luiz Freitas Almeida
f78d3f40a5
chore: Bump version to 1.1.0 and 0.1.0 for langflow and langflow-base (#4574)
Bump version to 1.1.0 in pyproject.toml files
2024-11-13 10:45:08 -08:00
Gabriel Luiz Freitas Almeida
f8f9b7cace
feat: add SIGTERM handling and update typer dependency (#4548)
* Update `typer` dependency to version 0.13.0 in `pyproject.toml`

* refactor: Simplify exception handling in the CLI

* Enhance lifespan function with clean shutdown and logging improvements

* Add graceful shutdown handling for SIGTERM and SIGINT signals

- Introduce signal handlers to manage SIGTERM and SIGINT for graceful server shutdown.
- Update exception handling to ensure processes terminate properly and log shutdown events.
- Modify server run logic to support signal-based shutdowns, improving reliability.

---------

Co-authored-by: Nadir J <31660040+NadirJ@users.noreply.github.com>
2024-11-12 19:42:18 -05:00
Ítalo Johnny
4f905526ac
feature: update firecrawl components (#4458)
* chore: update Firecrawl components

* chore: update version firecrawl-py dependency
2024-11-12 13:01:43 -08:00
Cristhian Zanforlin Lousa
537a8010f1
fix: Update duckduckgo-search to 6.3.4 and improve tests (#4504)
⬆️ (pyproject.toml): update duckduckgo-search dependency to version 6.3.4
🔧 (duckduckgo.spec.ts): remove test.skip from the test case to enable the test for duckduckgo search component
💡 (duckduckgo.spec.ts): refactor test case to improve readability and remove unnecessary code blocks
2024-11-11 20:34:03 +00:00
João
5a6c556e36
Feat: Adding Mem0 Integration (#4339)
* feat(frontend): adding Mem0 Icon

* feat(dependencies): adding and setting Mem0 dependency

* feat(frontend): adding Mem0 Icon

* feat: adding Mem0 components

* feat(dependencies): adding and setting Mem0 dependency

* Update uv.lock

update uv for memo

* update and delete mem0 removed

update and delete mem0 removed as per suggestion

* update requirement

---------

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
2024-11-11 15:15:09 +00:00
Eric Hare
a4863bbe57
fix: pdf parsing, pass as str instead of posix path (#4448)
* FIX: PyMuPDF for parsing, pass as str instead of posix path

* Switch back to pypdf due to licensing

* Allow specification of the number of threads

* [autofix.ci] apply automated fixes

* Update file.py

* Switch StrInput to IntInput

*  (Document QA.json, Vector Store RAG.json): Update FileComponent class to include IntInput for concurrency_multithreading to control the number of workers for parallel processing. This enhancement allows for better control and optimization of processing tasks.

* ⬆️ (pyproject.toml): upgrade langchain-core dependency from version 0.3.10 to version 0.3.12 to ensure compatibility and leverage new features

* ⬆️ (pyproject.toml): update langchain-core dependency to allow versions greater than or equal to 0.3.12 for compatibility reasons

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-11-08 16:55:06 +00:00
Gabriel Luiz Freitas Almeida
98274633db
fix: remove use of ImagePromptTemplate in image handling and adds image utils (#4467)
* remove poetry.lock

* fix: update langchain-core dependency version to 0.3.15

* feat: add functions to convert images to base64 and create data URLs

* refactor: simplify image URL handling by replacing ImagePromptTemplate with create_data_url function

* Fix image URL structure in data schema to use nested dictionary format

* Add unit tests for Data schema message conversion with text and images

* test: add unit tests for image utility functions to validate base64 conversion and data URL creation

* Refactor image URL generation to use `create_data_url` utility function instead of `ImagePromptTemplate`

* Add unit tests for message handling and image processing in schema module

- Introduce fixtures for temporary cache directory and sample image creation.
- Add tests for message creation from human and AI text.
- Implement tests for messages with single and multiple images.
- Include tests for invalid image paths and messages without sender.
- Add message serialization and conversion tests.
- Ensure cleanup of cache directory after tests.

* Use platformdirs to determine cache directory paths in test_schema_message.py
2024-11-08 08:24:19 -08:00
Edwin Jose
1434786cf6
fix: adding atlassian-python-api to support confluence components (#4430)
adding atlassian-python-api to support confluence components
2024-11-07 21:18:17 +00:00
Cristhian Zanforlin Lousa
73df2182de
fix: General Fixes and Improvements from v1.0.19.2 Fixes Branch (#4411)
* fix: update assistants client import (#4150)

* remove unnecessary patch

* remove unnecessary patch

* compatible release operator

* chore: add opensearch-py dependency (#4134)

Add opensearch-py dependency to pyproject.toml

* patch version

* lock

* lock some packages to speed up pip install

* langflow-base version

* fix: fix retrieverTool component (#4201)

♻️ (RetrieverTool.py): refactor build method signature to accept additional keyword arguments for future extensibility

* Fixed save modal not exiting

* fix: object has no attribute 'set_event_manager' (#4200)

* 🐛 (base.py): fix AttributeError by checking if custom_component has set_event_manager method before calling it

* 📝 (base.py): Import Component from langflow.custom to improve code readability and maintainability
♻️ (base.py): Refactor code to use isinstance() method for checking if custom_component is an instance of Component

* Refactor: Eliminate Global Variables for Improved Code Maintainability_fix_release (#4208)

Refactor: Eliminate Global Variables for Improved Code Maintainability

- Replaced global variables with local variables or class attributes.
- Enhanced code readability and reduced potential side effects.

* fix: Update example (#4204)

update example

* fix: avoids error NameError: name 'MAX_NUMBER_OF_FIELDS' is not defin… (#4203)

fix: avoids error NameError: name 'MAX_NUMBER_OF_FIELDS' is not defined and fixes build method

Co-authored-by: Edwin Jose <edwin.jose@datastax.com>

* fix: unexpected keyword argument 'code' -> SQLExecutor and SQLDatabase (#4230)

🔧 (SQLDatabase.py): update build method signature to accept additional keyword arguments for future extensibility
🔧 (SQLExecutor.py): update method signature to accept additional keyword arguments for future extensibility

* lock httptools to 0.6.4

* Move ChatInput import to within flow_component fixture in conftest.py

* Simplify error message formatting in test cases for data components

* Add readme to dockerfile

* build: dockerfile with entrypoint (#4062)

Adds a dockerfile with an entrypoint for use with Datastax Langflow

* fixes the leading v for checking out commits correctly

* fixes on more version checkout for docker build

*  (authContext.tsx): Add functionality to fetch global variables on authentication
🔧 (api.tsx): Replace universal-cookie import with react-cookie for consistency
🔧 (authStore.ts): Replace universal-cookie import with react-cookie for consistency
🔧 (use-get-global-variables.ts): Add check to only fetch global variables if user is authenticated
 (use-get-mutation-global-variables.ts): Add mutation function to fetch and update global variables
🔧 (authStore.ts): Replace universal-cookie import with react-cookie for consistency

* [autofix.ci] apply automated fixes

* revert changes to workflows

* upgrade lockfile

* update pyproject versions

* update lockfile again

* ⬆️ (pyproject.toml): upgrade langflow-base dependency to version 0.0.99

* ⬆️ (pyproject.toml): downgrade version from 0.0.99 to 0.0.97 to align with project requirements and dependencies.

* ⬆️ (pyproject.toml): downgrade langflow-base dependency version from 0.0.99 to 0.0.97 to resolve compatibility issues

* ⬆️ (uv.lock): downgrade langchain-core package version from 0.3.15 to 0.3.12 to resolve compatibility issues with dependencies

* ⬆️ (pyproject.toml): upgrade langflow-base dependency to version 0.0.99 to utilize the latest features and improvements

---------

Co-authored-by: Sebastián Estévez <estevezsebastian@gmail.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: Lucas Oliveira <lucas.edu.oli@hotmail.com>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Co-authored-by: anovazzi1 <otavio2204@gmail.com>
Co-authored-by: João <38133825+joaoguilhermeS@users.noreply.github.com>
Co-authored-by: Jordan Frazier <jordan.frazier@datastax.com>
Co-authored-by: Jordan Frazier <122494242+jordanrfrazier@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-11-06 17:31:36 +00:00
Christophe Bornet
e853a13d57
feat: Add AsyncSession support for non-blocking db operations (#4408)
* Add AsyncSession support for non-blocking db operations

* Use sqlalchemy extras
2024-11-06 03:21:53 -08:00
Eric Hare
07d8f2e04b
feat: Error handling and multi-file support in File Component (#4353)
* FEAT: Error handling and multi-file support in File Component

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes

* Update file.py

* [autofix.ci] apply automated fixes

* Add support for multithreading in zips

* [autofix.ci] apply automated fixes

* Add PDF processing support

* [autofix.ci] apply automated fixes

* Update file.py

* [autofix.ci] apply automated fixes

* Update file.py

* [autofix.ci] apply automated fixes

* Update file.py

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-11-05 23:10:41 +00:00
Gabriel Luiz Freitas Almeida
f66139a800
refactor: update Ollama components to use langchain-ollama integration (#4369)
* refactor: reorganize langchain dependencies in pyproject.toml

* feat: add langchain-ollama dependency to pyproject.toml

* fix: update imports to use langchain_ollama for OllamaEmbeddings and ChatOllama
2024-11-04 13:00:15 +00:00
Sebastián Estévez
db78e59434
chore: bump assistants and packaging to support e2b 1.0.1 (#4344) 2024-11-02 14:19:37 -03:00
Christophe Bornet
14b3117d6b
feat: Raise exception in tests when blocking code is called in event loop (#4293)
Raise exception in tests when blocking code is called in event loop
2024-11-02 17:03:31 +01:00
Gabriel Luiz Freitas Almeida
a7f28394ae
ci: add CodSpeed workflow and pytest-codspeed for performance testing (#4350) 2024-11-02 13:06:14 +00:00
Eric Hare
0fed08a4cb
bugfix: Handle urls for unstructured #4359 (#4360) 2024-11-01 22:49:53 +00:00
Sebastián Estévez
a03da10750
fix: langfuse upgrade and crew result usage (#4342)
* lanfuse upgrade and crew result usage

*  (Dynamic Agent.spec.ts): Enable tests for checking the presence of required environment variables before running the test suite.

 (Hierarchical Agent.spec.ts): Add integration test for Hierarchical Tasks Agent to ensure proper functionality and behavior
 (Sequential Task Agent.spec.ts): Add integration test for Sequential Tasks Agent to ensure proper functionality and behavior

---------

Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
2024-10-31 15:57:07 -03:00
Gabriel Luiz Freitas Almeida
6ca864931d
ci: add pytest failure annotations (#4324)
* Add pytest-github-actions-annotate-failures to dependencies in pyproject.toml

* feat: add --exclude-warning-annotations option to pytest commands in Makefile

* feat: add pytest-github-actions-annotate-failures to dev dependencies in pyproject.toml and uv.lock

* Add PYTEST_RUN_PATH environment variable to GitHub Actions workflow

* Remove '--exclude-warning-annotations' option from pytest commands in Makefile
2024-10-30 09:29:24 -03:00
Sebastián Estévez
2880f585fb
fix: assistants optional dependencies (#4278)
assistants optional dependencies
2024-10-25 18:35:18 -04:00
Gabriel Luiz Freitas Almeida
e93397d118
chore: update dependencies and enable HTTP/2 support for AsyncClient in tests (#4173)
* Update dependencies in pyproject.toml: fastapi, httpx, python-multipart

* Enable HTTP/2 support for AsyncClient in test configurations
2024-10-23 13:02:06 +00:00
Christophe Bornet
8224bce532
ref: Add ruff rules for bandit (S) (#4111)
* Add ruff rules for bandit (S)

* Changes following review
2024-10-22 22:33:37 +00:00
Eric Hare
6180a6daed
FEAT: Upgrade langchain (0.3.x) and associated packages including langchain-astradb (#4229)
* Start on big langchain dep upgrade

* Update pyproject.toml

* add new lock

* Rebase on post1 changes

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-10-22 18:30:21 +00:00
Sebastián Estévez
4fc4e49c6c
chore: apply changes to pyproject.toml from v1.0.19.1 (#4238)
* apply changes to pyproject.toml from v1.0.19.1

* back out langflow and langflow version for now
2024-10-22 15:16:28 +00:00
Gabriel Luiz Freitas Almeida
12476648f8
fix: add memo to deepcopy call to avoid recursion error (#4194)
Fix deepcopy bug by passing memo to deepcopy calls in custom component
2024-10-18 01:53:23 +00:00
Sebastián Estévez
9213ee21ce
fix: update assistants client import (#4150) 2024-10-16 12:22:38 +00:00
anovazzi1
908c141d97
feature: get messages from messages table for the playground (#3874)
* 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.

* [autofix.ci] apply automated fixes

* 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.

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

* feat: Add callback support to Graph methods.

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

* [autofix.ci] apply automated fixes

* refactor: Update callback to log_callback in graph methods.

* fetching data from messages and builds at the same time, need to remove duplicates

* refactor: Sort chat history by timestamp in ChatView component

* 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

* remove use memo to prevent bugs

* feat: add updateMessagePartial method to MessagesStoreType

* feat: update message partially in MessagesStoreType

This commit adds the `updateMessagePartial` method to the `MessagesStoreType` in `messagesStore.ts`. This method allows updating a specific message by merging the changes with the existing message object.

* feat: add log callback for start message in ChatComponent

* feat: update log_callback name

* feat: add log_callback for message in ChatComponent that are not streaming

* refactor: remove console.log statement in buildFlowVertices function

* refactor: store message in ChatInput after updating flow_id

This commit refactors the `ChatInput` component by moving the logic to store the message after updating the `flow_id` property. This ensures that the message is properly stored in the correct flow. The previous implementation had the logic to store the message before updating the `flow_id`, which could lead to incorrect storage of messages. This change improves the reliability and accuracy of message storage in the `ChatInput` component.

* refactor: move message storage logic in ChatInput after updating flow_id

* refactor: update ChatComponent to use stored_message.id instead of self.graph.flow_id

Update the `ChatComponent` class in `chat.py` to use the `stored_message.id` property instead of `self.graph.flow_id` when logging a message. This ensures that the correct message ID is used for logging purposes. The previous implementation used the flow ID, which could lead to incorrect logging. This change improves the accuracy of message logging in the `ChatComponent`.

* refactor: remove unused code and console.log statements

* raw: temp serializer fix

* streaming working but the message comes in one shot

* refactor: optimize message update in useMessagesStore

Improve the efficiency of updating messages in the `useMessagesStore` function of `messagesStore.ts`. Instead of iterating through the entire message list, this refactor searches for the message to update by iterating backwards from the end. This approach allows for faster message retrieval and update. The code has been modified to use a for loop and break out of the loop once the message is found. This change enhances the performance of the message update process.

* Refactor `serialize_flow_id` method to correctly handle UUID serialization in `message.py`

* Refactor `send_event` method to use `jsonable_encoder` for data serialization

* refactor: optimize message update in useMessagesStore

* streaming working with timeout

* refactor: update buildUtils.ts to use data instead of data.data in addMessage function

* version with reactState for chatHistory

* refactor: update on_message method in ChatComponent

* refactor: update on_message method in ChatComponent

* refactor: Remove unused dependency in package-lock.json

* Refactor chatView component and add hiddenSession prop

* Refactor chatView component and update hiddenSessions prop

* Refactor chatView component to use visibleSessions prop instead of hiddenSessions

* Refactor IOModal component to remove redundant code

* Refactor chatView component to include focusChat prop

* Refactor chatView component to include focusChat prop and trigger focus on chat when new session is set

* Refactor IOModal component to update visible sessions when new session is added

* feat: Add session parameter to buildFlowVertices function

* feat: Add someFlowTemplateFields function

Add the someFlowTemplateFields function to the reactflowUtils module. This function checks if any of the nodes in the provided array have template fields that pass a given validation function.

* feat: Add session parameter to buildFlowVertices function

* feat: Add session parameter to buildFlowVertices function

* update Session logic on ioModal

* Refactor ChatView component: Remove unused eraser button

The eraser button in the ChatView component was removed as it was not being used and served no purpose. This change improves code cleanliness and removes unnecessary code.

* Refactor Vertex class: Inject session_id if provided in inputs

* Refactor build_flow function: Set default session if inputs are empty

* Refactor InputValueRequest schema: Add session parameter

* Refactor IOModal component: Update session logic

* Refactor buildFlowVertices function: Update input handling

* Refactor MessagesStoreType in zustand/messages/index.ts: Remove unused columns property and setColumns method

* Refactor MessagesStoreType: Remove unused columns property and setColumns method

* Refactor SessionView component: Update columns extraction logic

* Refactor ChatView component: Remove unused variables

* Refactor useGetMessagesQuery: Remove unused setColumns method

* Refactor RenderIcons component: Set default value for filteredShortcut prop to prevent bug

* create edit message component for chat view

* Refactor useUpdateMessage: Add refetch option to trigger query refetch

* Refactor IOModal component: Remove unused variables and update useGetMessagesQuery

* Refactor ChatView component: Add session ID to message object

* update chat message to handle message edit

* update types

* fix: Update API call to send entire message object

* Refactor EditMessageField component: Add timeout to onBlur event

* Refactor EditMessageField component: Update layout of edit message field

* create migration

* add fields to data table

* feat: Add "edit" flag to message_dict in update_message API endpoint

* Refactor EditMessageField component: Improve onBlur event handling and add button click flag

* Refactor code to include "edit" flag in message types

* feat: Add EditMessageButton component for editing chat messages

* Refactor ChatMessage component: Add EditMessageButton and improve layout

* fix: Add refetch query for current flow messages not all flows

* Refactor ChatMessage component: Add ShadTooltip for EditMessageButton

* add info into edit message field

* fix: migrate

* fix running chat input directly from the flow

* [autofix.ci] apply automated fixes

* fix edit flag

* Refactor IOModal component to generate a unique session ID based on the current date and time

* [autofix.ci] apply automated fixes

* Refactor IOModal component to improve session management and interaction

* [autofix.ci] apply automated fixes

* Refactor sessionSelector component to improve session management and interaction

* chore: Refactor sessionSelector component to improve session management and interaction

* [autofix.ci] apply automated fixes

* create mutation to handle session rename

* refactor: Rename useUpdateSession to useUpdateSessionName for clarity

* [autofix.ci] apply automated fixes

* Refactor sessionSelector component for improved session management and interaction

* Refactor sessionSelector component to update visible session on session name change

* [autofix.ci] apply automated fixes

* add message related events back

* chore: Add console logs for debugging in buildFlowVertices function

* Refactor IOModal component to update tab trigger label from "Memories" to "Chat"

* improve edit name feature

* Refactor IOModal component button label to "New Chat"

* Refactor sessionSelector component to improve session management and interaction

* Refactor IOModal component to remove unused code and improve session management

* fix typing error

* fix run chat input on component level

* prevent toogle visibility on session menu

* fix bug on rename session while in table view mode

* chore: Update setSelectedView prop type in sessionSelector component

* add first test version not working yet

* fix bug for renaming and deleting session

* refactor: Update sessionSelector component to handle session changes

* improve test

* fix rename session multiple session bugs

* change visible session from array to string

* chore: Update editMessageField component to include margin-right for text span

* [autofix.ci] apply automated fixes

* Update down_revision in Alembic migration script

* Refactor IOModal component to simplify session visibility handling

* Fix comparison operator for filtering error messages in memory.py

* Refactor ChatInput to conditionally store and update messages

* Refactor JSON formatting for improved readability in starter projects

* Add type casting for message_text and import cast from typing module

* Refactor input handling to use direct dictionary access for 'session' and 'input_value' keys

* Allow `update_message` to accept `str` type for `message_id` parameter

* ⬆️ (pyproject.toml): upgrade duckduckgo-search dependency to version 6.3.1 for bug fixes or new features
🔧 (duckduckgo.spec.ts): refactor test to handle multiple possible outcomes when waiting for selectors and improve readability

* Refactor test file: generalBugs-shard-0.spec.ts

* Refactor test file: freeze.spec.ts

* Refactor test files: update element selectors and actions

* Refactor test file: chatInputOutput.spec.ts

* [autofix.ci] apply automated fixes

* Refactor chatMessage component to handle different types of children content on code modal

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
2024-10-15 19:09:12 +00:00
Gabriel Luiz Freitas Almeida
39cc38e82b
chore: add opensearch-py dependency (#4134)
Add opensearch-py dependency to pyproject.toml
2024-10-14 13:02:56 +00:00
Cristhian Zanforlin Lousa
376e4cfdd3
refactor: add pagination on folders (#4020)
* ⬆️ (uv.lock): Update authlib version from 1.3.2 to 1.3.1
⬆️ (uv.lock): Update httpx version from 0.27.2 to 0.27.0
⬆️ (uv.lock): Add new package grpcio-health-checking version 1.62.3

⬆️ (uv.lock): upgrade weaviate-client package from version 3.26.7 to 4.8.1 and add new dependencies grpcio, grpcio-health-checking, grpcio-tools, httpx, and pydantic. Update package source and distribution URLs accordingly.

*  (flows.py): Add pagination support for retrieving a list of flows to improve performance and user experience
📝 (flows.py): Update documentation to reflect changes made for pagination and additional query parameters
📝 (folders.py): Add a new endpoint to retrieve a folder with paginated flows for better organization and readability

*  (model.py): add PaginatedFlowResponse class to handle paginated flow responses in API calls

*  (test_database.py): add support for fetching all flows by adding "get_all" parameter to the request
🐛 (test_database.py): fix endpoint for fetching read-only starter projects to use correct URL path

* packages changes

* packages changes

* 📝 (paginatorComponent/index.tsx): refactor PaginatorComponent to use constants for default values and improve code readability
🐛 (paginatorComponent/index.tsx): fix issue with setting maxPageIndex when pages prop is provided to PaginatorComponent

* 🐛 (storeCardComponent): fix height of store card component to prevent overflow and improve layout aesthetics

*  (constants.ts): introduce new constants for search tabs, pagination settings, and store pagination settings to enhance user experience and improve functionality

*  (use-post-login-user.ts): add queryClient to UseRequestProcessor to enable refetching queries on mutation settled state
📝 (use-post-login-user.ts): update useLoginUser function to include onSettled callback in options to refetch queries after mutation settles

*  (use-get-basic-examples.ts): introduce a new query function to fetch basic examples of flows from the API and update the state with the fetched data.

*  (use-get-refresh-flows.ts): introduce new functionality to fetch and process flows with query parameters for components_only, get_all, folder_id, remove_example_flows, page, and size. This allows for more flexible and specific retrieval of flow data.

*  (use-get-folder.ts): Add support for pagination and filtering options in the useGetFolderQuery function to enhance flexibility and customization for fetching folder data.

* 🔧 (use-get-folders.ts): Remove unused code related to refreshFlows and setStarterProjectId to improve code readability and maintainability
 (use-get-folders.ts): Update useGetFoldersQuery to setFolders with the fetched data instead of filtering out starter projects to simplify the logic and improve performance

*  (use-upload-flow.ts): update refreshFlows function call to include an object with get_all property set to true to fetch all flows when refreshing

* 🔧 (codeAreaModal/index.tsx): remove unused import postCustomComponent to clean up code and improve readability

* 📝 (AdminPage/index.tsx): Update initial page size and index values to use constants for better maintainability
📝 (AdminPage/index.tsx): Update resetFilter function to set page size and index using constants for consistency
📝 (AdminPage/index.tsx): Update logic to handle loading state and empty user list based on isIdle state for better user experience
📝 (AdminPage/index.tsx): Update PaginatorComponent props to use constant for rows count and simplify paginate function assignment

*  (AppInitPage/index.tsx): introduce new queries to fetch basic examples and folders data for improved functionality and user experience

*  (FlowPage/index.tsx): update refreshFlows function call to include a parameter to get all flows at once for better performance.

*  (frontend): introduce flowsPagination and setFlowsPagination functions to manage pagination for flows in the UtilityStoreType

*  (frontend): introduce new 'folders' and 'setFolders' properties to FoldersStoreType to manage folder data efficiently

*  (types.ts): introduce Pagination type to define structure for pagination data in frontend application

*  (frontend): introduce PaginatedFlowsType to represent paginated flow data structure in the application.

*  (frontend): add optional 'pages' property to PaginatorComponentType to allow customization of the number of pages displayed in the paginator

*  (utilityStore.ts): introduce flowsPagination object with default values for page and size to manage pagination in the utility store

*  (foldersStore.tsx): introduce new state 'folders' and setter function 'setFolders' to manage folder data in the store

*  (ViewPage/index.tsx): update refreshFlows function call to include a parameter to get all flows at once, improving efficiency and reducing unnecessary calls to the backend.

* 📝 (StorePage/index.tsx): update constants import to include new pagination constants for better organization
♻️ (StorePage/index.tsx): refactor pagination logic to use new pagination constants for clarity and consistency throughout the file

*  (componentsComponent/index.tsx): Add support for pagination feature in ComponentsComponent to improve user experience and performance.

*  (myCollectionComponent/index.tsx): introduce pagination and search functionality to improve user experience and data handling in the MyCollectionComponent component

*  (Playground/index.tsx): Update refreshFlows function call to include a parameter to get all flows at once for better performance.

*  (entities/index.tsx): introduce PaginatedFolderType to represent a folder with pagination information for better organization and handling of paginated data.

*  (headerTabsSearchComponent/index.tsx): add support for changing tabs and searching functionality in headerTabsSearchComponent
📝 (headerTabsSearchComponent/index.tsx): update tabsOptions to use constant SEARCH_TABS for consistency and reusability

* 📝 (folders.py): Remove redundant import and unused code related to FolderWithPaginatedFlows class
🔧 (folders.py): Update query conditions to use explicit boolean values instead of implicit truthiness for better clarity and readability

* 📝 (folders.py): reorganize imports to improve readability and maintain consistency

* 📝 (flows.py): import FlowSummary model to support new functionality in the API
📝 (flows.py): add header_flows parameter to read_flows function to return a simplified list of flows if set to true

* 📝 (folders.py): remove unnecessary empty line to improve code readability

*  (model.py): introduce new FlowSummary class to represent a summary of flow data for better organization and readability

*  (pagination_model.py): introduce a new model 'FolderWithPaginatedFlows' to represent a folder with paginated flows for better organization and readability.

* 📝 (cardComponent/index.tsx): add missing semicolon to improve code consistency
♻️ (cardComponent/index.tsx): refactor logic to use data parameter directly instead of fetching flow by id to simplify code and improve readability

*  (use-get-refresh-flows.ts): introduce new query parameter 'header_flows' to support fetching header flows in API requests.

*  (use-get-folders.ts): add functionality to refresh flows when fetching folders to ensure data consistency and up-to-date information.

*  (use-upload-flow.ts): add support for fetching header flows along with all flows when refreshing flows in useUploadFlow hook

*  (use-redirect-flow-card-click.tsx): introduce a new custom hook 'useFlowCardClick' to handle flow card click events in the newFlowModal component. This hook utilizes react-router-dom for navigation, custom analytics tracking, and various utility functions to manage flow data and update the UI.

*  (NewFlowCardComponent/index.tsx): refactor onClick event handler into a separate function handleClick for better readability and maintainability

* 📝 (undrawCards/index.tsx): Remove unused imports and variables to clean up the code
♻️ (undrawCards/index.tsx): Refactor onClick event handler to use a separate function for handling flow card click events

*  (flowsManager/index.ts): introduce new state and setter for flowToCanvas to manage the flow displayed on canvas

*  (flowsManagerStore.ts): introduce new feature to set and update the flow to be displayed on the canvas asynchronously

*  (ViewPage/index.tsx): add support for fetching header flows along with all flows when refreshing data to improve data retrieval efficiency

*  (collectionCard/index.tsx): introduce useFlowsManagerStore to manage flows in the application
📝 (collectionCard/index.tsx): update handleClick function to set flow to canvas before navigating to editFlowLink

*  (Playground/index.tsx): add support for fetching header flows along with all flows when refreshing data in the Playground page.

* 🐛 (FlowPage/index.tsx): Fix setCurrentFlow logic to correctly set the current flow based on flowToCanvas value. Add flowToCanvas dependency to useEffect to ensure proper rendering.

*  (use-get-flow.ts): introduce a new file to handle API queries for fetching flow data in the frontend application. This file defines a custom hook 'useGetFlow' that makes a GET request to the API endpoint to retrieve flow data based on the provided flow ID.

* 📝 (flows.py): update import statement to use FlowHeader instead of FlowSummary for better clarity
📝 (flows.py): update response_model in read_flows endpoint to use FlowHeader for consistency and clarity

*  (model.py): rename FlowSummary class to FlowHeader for better clarity and consistency in naming conventions
📝 (model.py): add is_component field to FlowHeader class to indicate if the flow is a component or not

*  (use-get-folder.ts): introduce processFlows function to process flows data
📝 (use-get-folder.ts): add cloneDeep function to safely clone data before processing

* 🔧 (use-get-refresh-flows.ts): refactor useGetRefreshFlows function to simplify processing of dbDataFlows and update state accordingly

*  (FlowPage/index.tsx): Add useGetFlow hook to fetch flow data and update current flow on canvas. Add getFlowToAddToCanvas function to handle fetching and setting flow data on canvas.

*  (nodeToolbarComponent/index.tsx): improve user experience by automatically closing the override modal after successful flow override

*  (use-post-login-user.ts): add queryClient.refetchQueries for "useGetTags" after successful login to update tags data in the frontend.

*  (use-get-flow.ts): add processFlows function to process flow data before returning it to improve code readability and maintainability

* 🐛 (use-get-refresh-flows.ts): fix asynchronous flow to correctly handle data retrieval and processing before setting state and returning flows

*  (use-get-tags.ts): add functionality to set tags in utility store after fetching them from the API

* 📝 (shareModal/index.tsx): Update import statement for useUtilityStore to improve code organization and readability
🔧 (shareModal/index.tsx): Replace useGetTagsQuery with useUtilityStore to manage tags state and remove unnecessary API call for tags data
🔧 (shareModal/index.tsx): Replace references to data with tags variable to ensure consistency and avoid potential bugs
🔧 (shareModal/index.tsx): Update TagsSelector component to use tags variable instead of data for better data management

*  (AppInitPage/index.tsx): introduce useGetTagsQuery to fetch tags data from the store API for AppInitPage.

*  (StorePage/index.tsx): refactor to use useUtilityStore for tags state management instead of useGetTagsQuery for better separation of concerns and code organization. Update TagsSelector component to use tags from useUtilityStore hook.

*  (frontend): introduce Tag type to UtilityStoreType and add tags and setTags functions to manage tags in the store.

*  (types.ts): introduce new Tag type to represent a tag with id and name properties

*  (utilityStore.ts): introduce new 'tags' array and 'setTags' function to manage tags in the utility store

* 📝 (App.css): add a blank line for better readability and consistency in the CSS file

*  (test_database.py): add pagination support for reading flows and folders to improve data retrieval efficiency and user experience

*  (tabsComponent/index.tsx): refactor changeLocation function to use useCallback hook for better performance and stability
 (tabsComponent/index.tsx): update onClick event handler to directly call changeLocation function for cleaner code and improved readability

*  (headerTabsSearchComponent/index.tsx): refactor handleChangeTab, handleSearch, handleInputChange, and handleKeyDown functions to use useCallback for better performance and memoization
📝 (headerTabsSearchComponent/index.tsx): update tabActive prop to use the activeTab prop passed from parent component for consistency and clarity

*  (myCollectionComponent/index.tsx): refactor filter state initialization to dynamically set based on current location pathname
♻️ (myCollectionComponent/index.tsx): refactor onSearch and onChangeTab functions to use useCallback for better performance and memoization

*  (create-query-param-string.ts): introduce a new utility function to build query parameter strings for URLs in the frontend controllers.

*  (use-get-folder.ts): introduce buildQueryStringUrl function to create query parameter strings for API requests
📝 (use-get-folder.ts): add comments to explain the purpose of the code and improve code readability
🔧 (use-get-folder.ts): update useGetFolderQuery function to include additional configuration options for the query, such as refetchOnWindowFocus: false

*  (use-delete-folders.ts): add functionality to update local store after deleting a folder to keep it in sync with the server data

* 📝 (use-post-add-flow.ts): import useFolderStore to access myCollectionId state for refetching queries with the correct folder_id
🐛 (use-post-add-flow.ts): fix queryClient.refetchQueries to include the correct queryKey with folder_id or myCollectionId if response.folder_id is null

*  (use-get-refresh-flows.ts): refactor addQueryParams function to use buildQueryStringUrl utility function for better code readability and maintainability

* ♻️ (flows.py): remove unnecessary commented out code and add pagination functionality to the router for better code organization and readability

* 🔧 (NodeDescription/index.tsx): remove console.log statement for better code cleanliness and readability

*  (index.tsx): Add DialogClose component from @radix-ui/react-dialog to handle cancel action in ConfirmationModal. Refactor handleCancel function to improve code readability and maintainability.

* ♻️ (use-redirect-flow-card-click.tsx): remove unused setFlowToCanvas function to clean up code and improve maintainability

* 📝 (use-patch-update-flow.ts): update onSettled callback to refetch useGetFolders query with the updated folder_id after patching a flow

* 🔧 (use-delete-folders.ts): update onSettled function to correctly refetch queries with the specific folder id when deleting folders

*  (use-get-folder.ts): update useGetFolderQuery to include additional query parameters for pagination and filtering options

* 🔧 (use-post-upload-to-folder.ts): update onSettled callback to refetch useGetFolders query with the correct queryKey and folder_id parameter

*  (use-add-flow.ts): add functionality to refresh flows after adding a new flow to ensure the UI is up to date with the latest data.

*  (AppInitPage/index.tsx): enable fetching basic examples and tags only when isFetched is true to improve performance and reduce unnecessary API calls

*  (myCollectionComponent/index.tsx): refactor onPaginate function to handlePageChange callback for better code organization and readability. Update key prop in ComponentsComponent to include filter and search variables for proper re-rendering.

*  (use-get-folder.ts): add placeholderData option to useGetFolderQuery to provide initial data while fetching folder information

* [autofix.ci] apply automated fixes

* 🐛 (use-post-upload-to-folder.ts): fix queryKey values to correctly refetch queries after uploading a file to a folder

* ⬆️ (folders.spec.ts): increase timeout for waiting in test to improve reliability and prevent flakiness

*  (folders.spec.ts): update selectors to target specific elements by using the first() method to improve test reliability

*  (auto-save-off.spec.ts): update test to match changes in UI for auto-save feature and improve test coverage for hover functionality.

* 📝 (model.py): update model fields to set default values for folder_id, is_component, endpoint_name, and description to None for consistency and clarity

* ♻️ (index.tsx): refactor isUpdatingFolder logic to include isFetchingFolder variable for better accuracy and readability

* 🐛 (index.tsx): fix variable name typo in isLoadingFolder assignment to correctly reference isFetchingFolder

* 🐛 (use-patch-update-flow.ts): fix issue with missing closing parenthesis in queryClient.refetchQueries() method
📝 (use-patch-update-flow.ts): update queryKey in queryClient.refetchQueries() to ["useGetFolder"] to correctly refetch the folder data after updating a flow

*  (use-save-flow.ts): add support for fetching flow data before saving if not already present to ensure data consistency and accuracy

*  (folders.spec.ts): update selectors to target specific elements correctly for testing purposes

*  (use-on-file-drop.tsx): add support for checking flow names in a specific collection to prevent duplicates
♻️ (use-add-flow.ts): refactor to use the same logic for checking flow names in a specific collection to prevent duplicates

*  (index.tsx): Add useIsMutating hook to check if a folder is being deleted to update UI accordingly
♻️ (index.tsx): Refactor logic to determine if a folder is being updated to include check for folder deletion
🔧 (index.tsx): Refactor Select component to use a separate function for handling value change
🔧 (index.tsx): Refactor Button components to disable based on separate variables for first and last page
🔧 (index.ts): Remove unused import and refactor code to use useRef hook for storing the latest folder id in useGetFolderQuery

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-10-11 21:49:20 +00:00
Jordan Frazier
06013ae86a
version: upgrade to 1.0.19 and 0.0.97 (#4104)
* upgrade to 1.0.19 and 0.0.97
2024-10-10 15:15:05 -07:00
Christophe Bornet
da6b5eadbc
ref: Fix ruff rules in preview mode (#4039)
Fix some ruff rules from preview mode
2024-10-08 19:31:13 +00:00
Sebastián Estévez
9adf1ef2e5
Feat: Shared Component Cache Service (#4052)
split branch / PR
2024-10-07 20:58:42 -04:00
Ítalo Johnny
5615356a14
chore: update duckduckgo-search to the 6.3.0 (#4056) 2024-10-07 20:22:33 +00:00