Commit graph

10,900 commits

Author SHA1 Message Date
Edwin Jose
5811857ca2
refactor: Tool Output Management: Add Component-Specific Variable for Conditional Tool Output (#4259)
Implement conditional tool output handling

- Updated `component.py` to check for `FEATURE_FLAGS.add_toolkit_output` and call `_append_tool_output` if the component has the `add_tool_output` attribute set to True.
- Ensured that the tool output behavior is correctly managed based on feature flags and component attributes in `custom_component.py`.
2024-10-23 22:44:00 +00:00
EDllT
735c7330da
feat: Add LM Studio Model and Embeddings Component (#4021) 2024-10-23 18:46:36 +00:00
Mike Fortman
921743da5f
fix: restore radius (#4257)
restore radius
2024-10-23 18:24:35 +00:00
Mike Fortman
e910148907
feat: theme color updates (#4256)
theme color updates
2024-10-23 13:04:48 -05:00
Christophe Bornet
1fb72b826f
feat: Add AstraGraphVectorStoreComponent (#4248)
Add AstraGraphVectorStoreComponent
2024-10-23 15:54:56 +00: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
Cristhian Zanforlin Lousa
9b1c382641
fix: updating components to access secret key with new method get_secret_value() (#4243)
* updating components to access secret key with new method

* [autofix.ci] apply automated fixes

* 📝 (text_embedder.py): Add error messages as constants for better error handling and readability
📝 (text_embedder.py): Improve error handling and validation for embedding model and text content
📝 (text_embedder.py): Ensure proper protocol for the base URL in the embedding model client
📝 (text_embedder.py): Validate the output of embeddings and handle exceptions with logging
📝 (text_embedder.py): Refactor code to encapsulate results in a Data object and update status accordingly
📝 (similarity.spec.ts): Add a delay before clicking the button to run the text output test for better synchronization

* uv fix

* [autofix.ci] apply automated fixes

* 📝 (text_embedder.py): refactor error messages to use inline strings for better readability and maintainability
🐛 (text_embedder.py): fix issue with extracting the first element from embeddings list to ensure correct data handling

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Eric Hare <ericrhare@gmail.com>
2024-10-22 23:21:58 +00:00
Christophe Bornet
f44aca5b41
ref: Fix some ruff rules for private access (SLF) (#4139)
* Add ruff rules for private access (SLF)

* Changes following review

* Rename Vertex._data to Vertex.full_data
2024-10-22 23:04:12 +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
anovazzi1
4bb4f02e5b
feature: add new playground ui (#4193)
* create newmodal.tsx

* Add new icons to styleUtils.ts

* Refactor import path for IOModal in chatComponent/index.tsx

* Refactor import path for IOModal in chatComponent/index.tsx

* Refactor session selector UI in IOFieldView component

* Refactor NodeToolbarComponent to add a minimum width to SelectContent

* Refactor IOModal to use newChatView component for ChatView

* improve html structure to ensure aligment of texts

* Refactor IOModal to improve sidebar behavior and alignment

* add new input

* Add Image icon to nodeIconsLucide in styleUtils.ts

* Refactor uploadFileButton to use Image icon instead of PaperclipIcon

* Refactor chat input layout for improved alignment and behavior

* Refactor buttonSendWrapper component to show a "Stop" button with loading indicator

* add a new TextAreaWrapper component

* add icons and update colors

* Add CornerDownLeft icon to nodeIconsLucide in styleUtils.ts

* Refactor buttonSendWrapper component to use default button state

* create newFilePreview

* Refactor file preview component and update button styling

* Refactor file preview component and update button styling

* fix overflow bug

* Refactor ChatView component to include a lockChat feature and display a flow running message

* [autofix.ci] apply automated fixes

* Refactor ChatView component to fix padding issue

* [autofix.ci] apply automated fixes

* Refactor dependencies in uv.lock to use a more specific version specifier for astra-assistants package

* Refactor ChatView component to import newChatMessage instead of chatMessage

* Refactor IOModal newModal component to conditionally display the session name

* Refactor TextAreaWrapper component to update placeholder text and fix padding issue

* Refactor TextAreaWrapper component to update placeholder text and fix padding issue

* Refactor ChatView component to update lockChat UI and display flow running message

* Refactor ChatView component to update lockChat UI and display flow running message

* Refactor ChatMessage component to update sender name UI and fix message width issue

* Refactor EditMessageButton component to update button UI and add tooltips

* Refactor EditMessageButton component to update button UI and add tooltips

* Refactor EditMessageField component to update UI and add functionality

* update edit message field

* fix group reference

* Refactor CodeTabsComponent to update UI, add functionality, and improve code structure

* Refactor CodeTabsComponent to update UI and improve code structure

* Refactor CodeTabsComponent to simplify and improve UI

* [autofix.ci] apply automated fixes

* Refactor ChatView component to fix UI layout issue

* fix overflow code boundaries problems

* Refactor CSS to update background color variables

* Refactor ChatCodeTabComponent to update UI and improve code structure

* fix broken rebase changes

* [autofix.ci] apply automated fixes

* Refactor EditMessageButton component to remove delete functionality

* Refactor SessionSelector component to update UI and improve code structure

* Refactor SessionSelector component to update UI and improve code structure

* [autofix.ci] apply automated fixes

* refactor session selector to use old code and keep updates on newSessionSelector

* create new button send wrapper

* restore old button send wrapper and update imports

* restore upload file button and create new UploadFileButton

* [autofix.ci] apply automated fixes

* Add feature flag for new IO modal

* Refactor IOModal imports to support feature flag

* update package-lock.json

* [autofix.ci] apply automated fixes

* remove console.log

* Refactor session selector event handlers

* Refactor file deletion in ChatInput component

* [autofix.ci] apply automated fixes

* Refactor file handling in ChatInput component

* [autofix.ci] apply automated fixes

* add user icon to messages

* feat: Add "Run Flow" button to ChatInput component

This commit adds a new button labeled "Run Flow" to the ChatInput component. When clicked, it triggers the sendMessage function with a repeat value of 1. Additionally, if there is no input in the chat, a message is displayed prompting the user to add a Chat Input component to their flow.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-10-22 18:07:27 +00:00
Edwin Jose
21bdad0ffb
fix: Update Azure OpenAI API versions and improve version selection (#4232)
Update Azure OpenAI API versions and improve version selection

This PR updates the `AZURE_OPENAI_API_VERSIONS` list in the `AzureChatOpenAIComponent` class to include the latest GA and preview versions of the Azure OpenAI API. It also improves the default version selection logic.

Changes:
- Updated `AZURE_OPENAI_API_VERSIONS` list:
  - Added the latest GA version: "2024-06-01"
  - Added recent preview versions: "2024-07-01-preview", "2024-08-01-preview", "2024-09-01-preview", "2024-10-01-preview"
  - Removed older versions that are no longer relevant
  - Reordered the list to prioritize newer versions
- Improved the `api_version` DropdownInput:
  - Now sorts options in reverse chronological order
  - Default value now selects the latest non-preview version, falling back to the first version if all are preview

The updated list now reflects the most current API versions as of the latest documentation update, and the improved selection logic ensures users are presented with the most appropriate default version.
2024-10-22 17:24:49 +00:00
Christophe Bornet
b6f74fb275
ref: Move get_settings_service out of Depends() (#4239)
Move get_settings_service out of Depends()
2024-10-22 16:55:40 +00:00
Christophe Bornet
6e39dedaae
ref: Rename component modules to lower case (ruff N999) (#4220)
* Rename component modules to lower case (ruff N999)

* git rename workaround (1/2)

* git rename workaround (2/2)

* Rollback changes on schema __init__

* Fix tests
2024-10-22 16:46:32 +00:00
Ítalo Johnny
51a420f31a
fix: sidebar_categories route (#4237)
chore: add default value to beta attribute
2024-10-22 15:49:12 +00:00
Ítalo Johnny
48148f0df6
fix: logger config and env file loading (#4174)
* fix: logger config and env file loading

* fix: mypy error assignment and arg-type
2024-10-22 14:29:32 +00:00
Christophe Bornet
f0eb7b50a6
ref: Some fixes for ruff rules preview mode (#4197)
* Some fixes for ruff rules preview mode

* Fix mypy error

* More Annotated[] types for fastapi endpoints

* Use type aliases for Depends(get_session) and Depends(get_current_active_user)
2024-10-22 14:04:31 +00:00
dependabot[bot]
e308f8d84d
build(deps): bump hono from 4.6.1 to 4.6.5 in /src/frontend (#4161)
Bumps [hono](https://github.com/honojs/hono) from 4.6.1 to 4.6.5.
- [Release notes](https://github.com/honojs/hono/releases)
- [Commits](https://github.com/honojs/hono/compare/v4.6.1...v4.6.5)

---
updated-dependencies:
- dependency-name: hono
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-22 12:26:41 +00:00
Christophe Bornet
507eda997a
ref: Auto-fix some ruff ANN rules (#4210)
* Auto-fix some ruff ANN rules

* Fix mypy errors

* Changes following review

* Fix ServiceFactory
2024-10-22 13:55:48 +02:00
Christophe Bornet
c85cd91e09
ref: Move get services out of API methods (#4216)
* Move get services out of API methods

* Rollback files API to be able to mock the dependency
2024-10-22 11:27:31 +00:00
Christophe Bornet
349a2b49a4
fix: Use an async client for Redis cache (#4231)
Use an async client for Redis cache
2024-10-21 21:16:06 +00:00
Christophe Bornet
99bcaab9d8
ref: Remove useless fastapi Depends (#4217)
Remove useless fastapi Depends
2024-10-21 20:53:17 +00:00
Deon Sanchez
d48ec86121
feat: app Header Update (#4189)
* feat: add new customization components

- Added CustomOrgSelector component
- Added CustomProfileIcon component
- Added CustomProductSelector component
- Added CustomHeaderMenuItemsTitle component
- Added CustomFeedbackDialog component

This commit adds new customization components to the codebase.

* [autofix.ci] apply automated fixes

* refactor: update AppHeader component styling

* refactor: update AppHeader component styling

* refactor: update HeaderMenu component styling

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-10-21 19:34:07 +00:00
Vinícios Batista da Silva
48b80e146f
fix: Update header button variant based on the active route (#4207) (#4214)
- Added logic to change button variant to "primary" or "secondary"
  based on the current pathname, including the "/flows" route.

Co-authored-by: Mike Fortman <michael.fortman@datastax.com>
2024-10-21 09:17:43 -05:00
Cristhian Zanforlin Lousa
b969818738
feat: pagination improvements + tests (#4163)
* 📝 (utils.py): Add Query import and custom_params function to handle custom pagination parameters
📝 (flows.py): Update read_flows function to handle get_all flag and add error handling for missing folders
📝 (folders.py): Add custom_params dependency to read_folder endpoint for custom pagination handling
📝 (model.py): Remove PaginatedFlowResponse class as it is no longer used, add FlowHeader class to represent flow headers without data

 (test_database.py): Add pagination support for reading flows with different parameters to improve testing coverage and flexibility.

 (test_database.py): add unit tests for reading folders with different scenarios such as pagination, flows, search, and component filter to ensure proper functionality and data retrieval.

* 📝 (utils.py): Add constants MAX_PAGE_SIZE and MIN_PAGE_SIZE for better readability and maintainability
📝 (flows.py): Update get_all parameter default value to True for backward compatibility with frontend
📝 (flows.py): Update error message formatting for clarity
📝 (model.py): Update comments for folder_id, is_component, endpoint_name, and description fields for clarity

*  (test_database.py): Simplify test functions by removing unnecessary parameters and code duplication to improve readability and maintainability.

* formatter

* [autofix.ci] apply automated fixes

* ruff fix

* [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>
2024-10-20 14:04:26 -03:00
Ítalo Johnny
4d7653c451
feat: concat default variables with env values (#4211)
* feat: concat default variables with env values

* fix: prevent duplicate env variables
2024-10-19 21:10:49 +00:00
Christophe Bornet
bac14d99c2
fix: Fix some tests missing client fixture (#4213)
Fix some tests missing client fixture
2024-10-19 21:00:47 +00:00
Christophe Bornet
f96f2eaf8a
ref: Add ALL ruff rules for tests (#4183)
Add ALL ruff rules for tests
2024-10-19 20:41:37 +00:00
Christophe Bornet
140cf890e3
ref: Use pathlib read/write functions (#4177)
Use pathlib read/write functions
2024-10-19 16:05:18 +00:00
Christophe Bornet
bdb4106ac0
ref: Add ruff rules for naming (N) (#4187)
Add ruff rules for naming (N)
2024-10-19 15:52:04 +00:00
Christophe Bornet
f430f98c5c
fix: Fix add_extra_fields() (#4209)
Fix add_extra_fields()
2024-10-19 15:39:03 +00:00
Ítalo Johnny
c24b0d9ac4
fix: handle unsupported LLM exception message (#4199)
* fix: handle unsupported LLM exception message

* Update src/backend/base/langflow/components/agents/ToolCallingAgent.py

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

* [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>
2024-10-19 13:47:31 +00:00
Mike Fortman
e8e226c0dc
feat: Folders Design Uplift (#4122)
* move folders to a full page aside

* new dropdown + styles

* [autofix.ci] apply automated fixes

* design updates

* [autofix.ci] apply automated fixes

* increase empty state width

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
2024-10-18 17:17:49 +00:00
Lucas Oliveira
fdaaf19ba1
fix: override modal not exiting (#4205)
Fixed override modal not exiting
2024-10-18 12:42:05 -03:00
Cristhian Zanforlin Lousa
44f390e987
feat: remove beta tag from categories endpoint (#4202)
🔄 (constants.py): refactor sidebar categories list to improve readability and maintainability by removing unnecessary properties and formatting the dictionary entries for consistency.
2024-10-18 11:46:13 -03: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
Christophe Bornet
e4e1e1bd86
ref: Add missing __init__.py files in tests (#4180)
Add missing __init__.py files in tests
2024-10-17 18:21:56 +00:00
Cristhian Zanforlin Lousa
a6b684f139
feat: add new categories endpoint (#4184)
*  (endpoints.py): Add new endpoint to retrieve sidebar categories for the frontend application.

* 📝 (schemas.py): add SidebarCategory and SidebarCategoriesResponse models to define sidebar categories and response structure for API endpoint.

*  (constants.py): Add sidebar categories with display names, names, icons, and beta status for different components to enhance the user interface and navigation experience.

* 📝 (constants.py): Update icons names to use proper casing for consistency and clarity in the code.
2024-10-17 13:34:05 +00:00
Christophe Bornet
45c8f98692
ref: Auto-fix ruff rules in tests (#4154) 2024-10-16 15:42:36 +00:00
Cristhian Zanforlin Lousa
51b3909d60
feat: add new input type - SliderComponent + tests (#4144) 2024-10-16 14:00:27 +00:00
Cristhian Zanforlin Lousa
ab77ca752b
tests: fix decision flow test (#4143)
* starting fix test

*  (decisionFlow.spec.ts): refactor integration test to remove unnecessary commented out code and improve readability by simplifying and organizing the test steps for creating a flow with decision.
2024-10-16 13:05:31 +00:00
Sebastián Estévez
9213ee21ce
fix: update assistants client import (#4150) 2024-10-16 12:22:38 +00:00
Ítalo Johnny
1a72aa71b6
fix: environment variable loading and improve error handling in DB retrieval (#4168)
* test: rewrite and enable variable loading test

* refactor: simplify environment variable storage logic

* refactor: simplify parameter loading logic from db

* fix: handle additional error case when loading variables
2024-10-16 11:53:40 +00:00
Lucas Oliveira
c670778ecb
fix: toggle and row hover colors (#4169)
* Fix toggle colors

* Fix row hover color
2024-10-16 11:23:09 +00:00
Cristhian Zanforlin Lousa
9a97fc9154
feat: change the Tools color to improve user experience (#4141) 2024-10-16 10:30:35 +00:00
Cristhian Zanforlin Lousa
f14ead9739
fix: StoreMessage.py to prevent errors on Component (#4162)
* 📝 (StoreMessage.py): Update input types in StoreMessageComponent to include StrInput for sender, sender_name, and session_id to improve data handling and consistency.

* 📝 (StoreMessage.py): Update imports to use the correct MessageTextInput class from langflow.inputs.inputs module for sender, sender_name, and session_id inputs in StoreMessageComponent class. This change ensures consistency and improves code readability.
2024-10-16 01:38:26 +00:00
Christophe Bornet
047077cee4
ref: Remove autouse from pytest client fixture (#4158)
Remove autouse from pytest client fixture
2024-10-15 22:55:10 +00:00
Gabriel Luiz Freitas Almeida
2be7c56939
feat: add StructuredOutput component (#4024)
* Add utility functions to build Pydantic models from schema definitions

* Add unit tests for build_model_from_schema function in test_base_model.py

- Implement various test cases to validate the functionality of build_model_from_schema.
- Test cases cover scenarios such as handling valid and empty schemas, managing unknown field types, and processing schemas with missing optional keys.
- Ensure proper handling of nested list and dict types, and verify the function's efficiency with large schemas.
- Confirm that the function raises exceptions for invalid input and handles duplicate field names correctly.

* Refactor tests in `test_base_model.py` to improve type handling and error checking

* Refactor output schema handling to use TableInput and build_model_from_schema

* Update OpenAI model components and hierarchical crew setup

- Refactor `OpenAIModelComponent` to use `TableInput` for `output_schema` and integrate `build_model_from_schema`.
- Modify `HierarchicalCrewComponent` to use unpacking for base inputs.
- Ensure consistent import statements across JSON files.
- Improve error handling and logging for vector store operations.

* Add chat result model with message building and execution logic

- Implement `build_messages_and_runnable` to construct message lists and configure runnable models.
- Add `get_chat_result` to execute language models with input messages, supporting streaming and custom configurations.
- Handle exceptions with optional custom error messages.

* Add "table" to DIRECT_TYPES in constants.py

* Add support for DataFrame input validation in TableInput class

* Add StructuredOutputComponent for generating structured outputs from language models

* Enhance structured output component with improved input descriptions and schema naming

* Convert DataFrame to list of dictionaries in TableInput validation

* Remove pandas dependency and refactor schema handling in structured_output.py

* Remove 'default' field from structured output schema and update field initialization

* Add 'number' and 'text' types to type mapping and remove default value from field creation

* Enhance error handling in structured output building process

* Improve error message for non-BaseModel output in structured_output.py

* Add unit tests for StructuredOutputComponent in helpers module

- Implement various test cases to ensure correct functionality of StructuredOutputComponent.
- Test successful structured output generation, handling of unsupported language models, and correct output model building.
- Validate handling of multiple outputs, empty and invalid output schemas, and nested schemas.
- Include tests for large input values and invalid language model configurations.

* Update description for StructuredOutputComponent to clarify functionality

* Add default values and error handling for structured output in helpers

* Remove unused 'method' parameter from 'with_structured_output' in MockLanguageModel

* refactor: rename test_base_model.py to test_base_model_from_schema.py

Rename the test_base_model.py file to test_base_model_from_schema.py to better reflect its purpose of testing the build_model_from_schema function. This change improves code clarity and maintainability.

* Add type ignore comments to suppress type checking errors

* Add Generic typing to StructuredOutputComponent and fix method call

* Revert "Refactor output schema handling to use TableInput and build_model_from_schema"

This reverts commit 2e84a8608689bcfb519dc589d3eeef852784f3e4.

* Deprecate JSON mode in OpenAIModel output schema documentation

* Remove unused Generic import and add type ignore comment in StructuredOutputComponent

* Refactor OpenAI model components and deprecate output schema

- Refactored `OpenAIModelComponent` to use `operator.ior` and `functools.reduce` for converting `output_schema` to a dictionary.
- Deprecated the `output_schema` field, updating its info to reflect the deprecation.
- Simplified the `_docs_to_data` method in `SplitTextComponent` for better readability.
- Updated import statements and removed unused imports across multiple JSON files.

* Add specific type ignore comments and update exception types in backend code
2024-10-15 21:41:42 +00:00
anovazzi1
c9b9fcf63c
fix: batch updates and scrolling issues (#4167)
* use Flush instead of timeout to prevent batch updates

* fix scroll while streaming

* fix: Use setTimeout instead with flushSync for batch updates in buildUtils.ts

* [autofix.ci] apply automated fixes

* fix: Set selected view field when session is visible in IOModal

* fix: Set selected view field when session is visible in IOModal

* fix: Reset selected view field when closing IOModal

* fix: Update date format in DateReader component

- Pad hours, minutes, and seconds with leading zeros
- Remove AM/PM from the formatted date
- Use 24-hour format for hours in the formatted date

fix: Update session ID generation in IOModal component

- Remove AM/PM from the session ID format
- Use 24-hour format for hours in the session ID

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-10-15 18:23:03 -03: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