Commit graph

11,619 commits

Author SHA1 Message Date
Gabriel Luiz Freitas Almeida
68288be80e feat (GenericNode): replace validation with SSE validation 2023-06-12 09:31:43 -03:00
Gabriel Luiz Freitas Almeida
eaae1dda27 feat(chatComponent): add SSE context to update data in real-time
The handleBuild function has been refactored to process data in chunks instead of waiting for the entire response to be received. This improves the performance of the function and allows for real-time updates. The SSE context has been added to update the data in real-time as it is received.
🔨 refactor(chatComponent): refactor handleBuild function to process data in chunks
2023-06-12 09:31:01 -03:00
Gabriel Luiz Freitas Almeida
42d5a501bb 🚀 feat(App.tsx): add SSEProvider to App component
🎉 feat(SSEContext.tsx): add SSEContext and SSEProvider components to handle server-sent events
The SSEProvider component was added to the App component to provide the SSEContext to the TabsManagerComponent. The SSEContext component was also added to handle server-sent events. The SSEContext component provides a way to update the sseData state and to access the sseData state from any component that uses the useSSE hook.
2023-06-12 09:30:47 -03:00
Gabriel Luiz Freitas Almeida
036818e9b9 🔧 refactor(chat.py): rename post_build to stream_build to improve semantics
🐛 fix(chat.py): fix generator_build method to yield node_repr and node_id
 feat(chat.py): add valid and id fields to error response to improve error handling
🔧 refactor(manager.py): change logger.exception to logger.error to log exceptions
🔧 refactor(graph/base.py): add logging to generator_build method to improve debugging
🔧 refactor(vertex/base.py): rename cache.base to cache.utils to improve semantics
The post_build method in chat.py was renamed to stream_build to better reflect its functionality. The generator_build method in graph/base.py was fixed to yield node_repr and node_id instead of node._built_object_repr() and node.id. The error response in chat.py now includes valid and id fields to improve error handling. logger.exception in manager.py was changed to logger.error to log exceptions. The generator_build method in graph/base.py now logs the sorted vertices to improve debugging. The cache.base module in vertex/base.py was renamed to cache.utils to better reflect its functionality.
2023-06-12 09:30:20 -03:00
Gabriel Luiz Freitas Almeida
273f452f7b 🔧 chore(chat.py): add SSE support to post_build endpoint
 feat(chat.py): add SSE support to post_build endpoint to stream build progress to the client
The post_build endpoint now returns a StreamingResponse object that streams Server-Sent Events (SSE) to the client. This allows the client to receive build progress updates in real-time. The event_stream function is responsible for generating the SSE events and is called by the StreamingResponse object. The SSE events contain information about the build progress, including whether the build was successful or not, the parameters used to build each node, and the node ID. The chat_manager.set_cache method is called to cache the built graph object.
2023-06-12 07:50:00 -03:00
Gabriel Luiz Freitas Almeida
76a49c8663 🐛 fix(manager.py): change status parameter type from status to int in close_connection method
🔥 refactor(manager.py): remove unused build method and rename set_cache to set_client_cache
🚀 chore(manager.py): add async keyword to close_connection method
The close_connection method now accepts an integer as the status parameter instead of a status enum. The build method was removed as it was not being used. The set_cache method was renamed to set_client_cache to improve semantics. The close_connection method was updated to be an async method.
2023-06-12 07:49:49 -03:00
Gabriel Luiz Freitas Almeida
9ebd02e331 🚀 feat(base.py): add topological_sort method to perform a topological sort of the vertices in the graph
🚀 feat(base.py): add generator_build method to build each node in the graph and yield it
The topological_sort method performs a topological sort of the vertices in the graph, returning a list of vertices in topological order. The generator_build method builds each node in the graph and yields it. These methods are useful for building the graph in a specific order, which is important for certain algorithms that rely on the order of the nodes.
2023-06-12 07:49:35 -03:00
Gabriel Luiz Freitas Almeida
5fe4ac6ffa 🔇 chore(frontend): comment out console.log statements
The console.log statements were commented out in the following files:
- src/frontend/src/components/intComponent/index.tsx
- src/frontend/src/contexts/tabsContext.tsx
- src/frontend/src/modals/EditNodeModal/index.tsx
- src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx
- src/frontend/src/pages/FlowPage/index.tsx

The console.log statements were not necessary and were removed to reduce noise in the console.
2023-06-12 07:05:00 -03:00
Gabriel Luiz Freitas Almeida
a65a88ca45 🐛 fix(vite.config.ts): update validate route to use regex pattern
The validate route was updated to use a regex pattern instead of a string pattern to match all routes that start with "/api/v1/validate/". This change ensures that all routes that match the pattern are correctly routed to the validate endpoint.
2023-06-12 07:03:16 -03:00
Gabriel Luiz Freitas Almeida
f88b14f33d 🚀 feat(chatComponent): add build trigger component to allow users to build a flow
 feat(chatComponent): add loading animation to build trigger component
The BuildTrigger component is added to the chatComponent to allow users to build a flow. The component is triggered by clicking on a button and sends a POST request to the server to build the flow. A loading animation is added to the component to indicate that the flow is being built. The postBuild function is added to the API controller to handle the POST request.
2023-06-11 18:09:17 -03:00
Gabriel Luiz Freitas Almeida
2c0a9aee95 🚸 chore(chatTrigger): add error message when chat is triggered before flow is built
 feat(chatComponent): add BuildTrigger component to check if flow is built before showing ChatTrigger component
The ChatTrigger component now checks if the flow is built before allowing the user to open the chat. If the flow is not built, an error message is displayed instead. The BuildTrigger component is added to check if the flow is built before showing the ChatTrigger component. This improves the user experience by preventing the user from opening the chat before the flow is built.
2023-06-11 18:08:52 -03:00
Gabriel Luiz Freitas Almeida
395af24101 🚀 chore(vite.config.ts): add build route to apiRoutes array
The build route was added to the apiRoutes array to allow the frontend to access the build files.
2023-06-11 18:08:35 -03:00
Gabriel Luiz Freitas Almeida
f2e4a93df5 🐛 fix(base.py): remove unused import of logger
🎨 refactor(run.py): update import statement for compute_dict_hash, load_cache, and memoize_dict
The import of logger in base.py was not being used, so it was removed to improve code readability. In run.py, the import statement for compute_dict_hash, load_cache, and memoize_dict was updated to reflect the new location of these functions in the cache.utils module. This improves the organization of the code and makes it easier to find the relevant functions.
2023-06-11 18:08:20 -03:00
Gabriel Luiz Freitas Almeida
ccf9477b7f 🐛 fix(manager.py): add check for langchain object in process_message to avoid errors
 feat(manager.py): add build method to build langchain object and store it in an in-memory cache
The `process_message` method now checks if the langchain object has been built and stored in the in-memory cache before processing the message. If the object is not found, the connection is closed with an error message. A new `build` method has been added to build the langchain object and store it in an in-memory cache. This method is called before processing any messages.
2023-06-11 18:08:01 -03:00
Gabriel Luiz Freitas Almeida
dacc90d901 🐛 fix(cache/manager.py): change CACHE variable to _cache to follow naming conventions
 feat(cache/utils.py): add support for clearing old cache files and memoization of dictionary functions
The CACHE variable in CacheManager class has been renamed to _cache to follow naming conventions. The utils.py module now supports clearing old cache files and memoization of dictionary functions. The clear_old_cache_files function removes old cache files if the number of cache files exceeds the max_cache_size. The memoize_dict decorator memoizes dictionary functions and clears the cache when the clear_cache method is called.
2023-06-11 18:07:45 -03:00
Gabriel Luiz Freitas Almeida
02163cf775 feat(flow.py): add InMemoryCache class to implement an in-memory cache with LRU eviction policy
This commit adds a new class InMemoryCache to implement an in-memory cache with a Least Recently Used (LRU) eviction policy. The cache supports setting a maximum size and expiration time for cached items. The cache is thread-safe using a threading Lock. The InMemoryCache class inherits from the BaseCache class and implements the get, set, get_or_set, delete, clear, __contains__, __getitem__, __setitem__, __delitem__, __len__, and __repr__ methods.
2023-06-11 18:07:28 -03:00
Gabriel Luiz Freitas Almeida
a27e5d58dd 🔨 refactor(base.py): refactor BaseCache class to use abstract methods
This commit refactors the BaseCache class to use abstract methods instead of concrete methods. This makes the class more flexible and allows for different implementations of the cache. The abstract methods include get, set, delete, clear, __contains__, __getitem__, __setitem__, and __delitem__.
2023-06-11 18:07:17 -03:00
Gabriel Luiz Freitas Almeida
bdbc46f01d 🐛 fix(chat.py): add exception handling to post_build endpoint
 feat(cache/__init__.py): add InMemoryCache to exported modules
🔖 refactor(endpoints.py): remove unused import statement
The post_build endpoint in chat.py now has exception handling to catch any errors that may occur during the build process. InMemoryCache is now exported as part of the cache module. The endpoints.py file has been refactored to remove an unused import statement.
2023-06-11 18:06:57 -03:00
Snow
a76ef67b0d Restore staticmethod. 2023-06-12 07:03:44 +10:00
Gabriel Luiz Freitas Almeida
efbdd6fee7 🚀 feat(langflow): add version endpoint to API
🐛 fix(langflow): fix version import error in version endpoint
The version endpoint is added to the API to allow clients to retrieve the version of the Langflow package. The version is obtained using the `metadata.version` function from the `importlib` module. In case the package metadata is not available, an empty string is returned. The version endpoint was previously returning an error due to an import error. The error is fixed by importing the `__version__` variable from the `langflow` module.
2023-06-11 12:48:06 -03:00
Gabriel Luiz Freitas Almeida
10fce79bc3 🐛 fix(App.tsx): replace fetch call with getVersion function call to retrieve app version
 feat(App.tsx): add getVersion function to retrieve app version from API
The fetch call to retrieve the app version has been replaced with a call to the getVersion function. This function retrieves the app version from the API. This change improves the code's readability and reduces the amount of code needed to retrieve the app version.

🐛 fix(GenericNode/index.tsx): replace fetch call with postValidateNode function call to validate node
 feat(GenericNode/index.tsx): add postValidateNode function to validate node via API
The fetch call to validate the node has been replaced with a call to the postValidateNode function. This function validates the node via the API. This change improves the code's readability and reduces the amount of code needed to validate the node.

🐛 fix(codeAreaModal/index.tsx): replace checkCode function call with postValidateCode function call to validate code
 feat(codeAreaModal/index.tsx): add postValidateCode function to validate code via API
The checkCode function call to validate the code has been replaced with a call to the postValidateCode function. This function validates the code via the API. This change improves the code's readability and reduces the amount of code needed to validate the code.
2023-06-11 12:17:16 -03:00
Gabriel Luiz Freitas Almeida
21440578a7 🔧 chore(API): add /api/v1/ prefix to API routes
 feat(API): add getVersion function to retrieve the version of the API
The API routes have been updated to include the /api/v1/ prefix to improve semantics and avoid conflicts with other routes. The getVersion function has been added to retrieve the version of the API.
2023-06-11 12:17:00 -03:00
Gabriel Luiz Freitas Almeida
0eaa86c5ca 🔧 chore(__main__.py): add support for loading environment variables from a .env file
The `load_dotenv` function from the `dotenv` package is now used to load environment variables from a `.env` file. This allows for a more flexible configuration of the application as environment variables can be loaded from a file instead of being hardcoded in the code. The `.env` file path can be specified via the `env_file` parameter.
2023-06-11 11:14:43 -03:00
Gabriel Luiz Freitas Almeida
09bd1093dd 🎨 style(constants.tsx): refactor getPythonApiCode, getCurlCode, and getPythonCode to separate functions
 feat(ApiModal): use getPythonApiCode and getCurlCode functions to generate python and curl code
 feat(cardComponent): add RenameLabel component to allow renaming of flow name and description
🐛 fix(cardComponent): fix CardDescription height to prevent overflow
The getPythonApiCode, getCurlCode, and getPythonCode functions were refactored into separate functions to improve code readability and maintainability. The ApiModal component now uses the getPythonApiCode and getCurlCode functions to generate the python and curl code. The CardComponent now has a RenameLabel component that allows renaming of the flow name and description. The CardDescription height was also fixed to prevent overflow.
2023-06-11 10:58:10 -03:00
Cristhian Zanforlin Lousa
74b8cbb224 dropdown float, placeholders and inputlist bug fix 2023-06-11 10:48:42 -03:00
Snow
14c4022c15 Update label to indicate a local directory is required. 2023-06-11 15:18:22 +10:00
Snow
b6bd5544c9 Correct loader order. 2023-06-11 13:57:05 +10:00
Snow
1427599b8a Fix: Restore Notion and Slack directory loaders. 2023-06-11 13:48:02 +10:00
Gabriel Luiz Freitas Almeida
445f4013c1 🎨 style(MainPage): add whitespace to button className
The whitespace was added to the button className to improve readability and consistency with the rest of the code.
2023-06-10 16:52:55 -03:00
Gabriel Luiz Freitas Almeida
a95d7d7f6a 🎨 style(cardComponent): update color of card background and icons
💄 style(cardComponent): update layout of card footer and remove unused code
The background color of the card component has been updated to a lighter shade of blue. The icons used for editing and deleting a flow have been updated to use the Lucide icon library. The layout of the card footer has been updated to align the content to the right and remove unused code.
2023-06-10 16:52:30 -03:00
Gabriel Luiz Freitas Almeida
181df91500 🎨 style(menuBar): replace heroicons with lucide-react icons and refactor code to improve readability
 feat(menuBar): add support for custom emoji and color for each flow
This commit replaces the heroicons with lucide-react icons to improve the consistency of the icon set used in the application. The code has also been refactored to improve readability. Additionally, support for custom emoji and color for each flow has been added to improve the user experience.
2023-06-10 16:52:09 -03:00
Gabriel Luiz Freitas Almeida
99be4b5470 💄 style(ApiModal): add cURL code snippet to API modal
The flowName prop has been changed to a flow object to improve semantics and make the code more readable. The cURL code snippet has been added to the API modal to provide an alternative way to interact with the API.
🔨 refactor(ApiModal): change flowName prop to flow object to improve semantics
2023-06-10 16:50:23 -03:00
Gabriel Luiz Freitas Almeida
2f73fd9ca5 feat(tabsContext.tsx): add try-catch blocks to handle errors when processing flow data and add saveFlowToDatabase function to save new flows to the database
The tabs trigger border radius has been changed from rounded-sm to rounded-lg to improve the appearance of the tabs. Try-catch blocks have been added to handle errors when processing flow data to prevent the application from breaking. A new function, saveFlowToDatabase, has been added to save new flows to the database. This function is called when a new flow is created, and the ID counter is incremented after the flow is saved. The new flow is then added to the list of flows, and the tab index is set to the new flow.
🎨 style(ui/tabs.tsx): change tabs trigger border radius from rounded-sm to rounded-lg
2023-06-10 16:49:43 -03:00
Gabriel Luiz Freitas Almeida
cdbe2b0401 🐛 fix(endpoints.py): change graph_data variable to use flow_obj.data instead of flow_obj.flow
The graph_data variable was previously assigned to flow_obj.flow, which is incorrect as the flow_obj object does not have a flow attribute. Instead, the correct attribute to use is flow_obj.data.
2023-06-10 16:17:56 -03:00
Gabriel Luiz Freitas Almeida
c76ee24a78 🔨 refactor(API): replace axios with fetch for getVersion and getHealth functions
🔨 refactor(MainPage): remove handleSaveFlow prop from MenuBar component
🔨 refactor(MainPage): export MenuBar component as named export
The axios library is replaced with the fetch API for the getVersion and getHealth functions to reduce the bundle size and improve performance. The handleSaveFlow prop is removed from the MenuBar component as it is not used. The MenuBar component is now exported as a named export to improve code readability and maintainability.
2023-06-09 17:59:29 -03:00
Gabriel Luiz Freitas Almeida
61207db4da 🐛 fix(App.tsx): change fetch URL to relative path to fix incorrect API call
The fetch URL was incorrect and was calling the API with an absolute path instead of a relative path. This caused the API call to fail. The URL has been changed to a relative path to fix the issue.
2023-06-09 17:17:55 -03:00
Gabriel Luiz Freitas Almeida
bc07766575 🔊 chore(base.py): add logger to Graph class
🐛 fix(base.py): improve error message when invalid payload is received
The logger is added to the Graph class to improve debugging capabilities. The error message when an invalid payload is received is improved to include the keys that were found in the payload. This makes it easier to identify the issue and fix it.
2023-06-09 17:08:11 -03:00
Gabriel Luiz Freitas Almeida
bfb4a8e609 🔖 chore(base.py): add display_name field to FrontendNode
The `display_name` field is added to the `FrontendNode` class to allow for a more user-friendly name to be displayed in the UI. If `display_name` is not set, the `name` field will be used instead.
2023-06-09 17:08:01 -03:00
Cristhian Zanforlin Lousa
ef1b19a6d3 Removing unnecessary prop 2023-06-09 16:43:10 -03:00
Cristhian Zanforlin Lousa
244fe5c123 Adjusted state of toggle buttons and inputComp 2023-06-09 16:41:34 -03:00
Gabriel Luiz Freitas Almeida
c216c78b1b
🚀 feat(langflow): add new Retrieval chains (#456) 2023-06-09 16:25:43 -03:00
Gabriel Luiz Freitas Almeida
fdf24f269b
Merge branch 'dev' into agent_and_qa_chain 2023-06-09 16:25:29 -03:00
Gustavo Schaedler
547e10b374 Remove condition for the execution of make publish, the execution is done by GitHub actions 2023-06-09 20:15:00 +01:00
Gustavo Schaedler
8a08ebdbe7 Remove some commented out code + add condition for the execution of make publish 2023-06-09 20:09:25 +01:00
Gabriel Luiz Freitas Almeida
c30bc4f2e0 🔥 chore(frontend): remove @radix-ui/react-slot dependency
The @radix-ui/react-slot dependency was removed from the package.json file.
2023-06-09 15:52:48 -03:00
Gabriel Luiz Freitas Almeida
5c6c39eb49 🚀 feat(menuBar): create a new component to handle the menu bar in the MainPage
The new component MenuBar was created to handle the menu bar in the MainPage. It contains all the logic and UI elements related to the menu bar. The component receives props such as activeTab, setRename, rename, flows, tabIndex, and handleSaveFlow. The handleSaveFlow function was moved from the MainPage component to the MenuBar component. The code related to the menu bar was removed from the MainPage component and replaced by the MenuBar component.
2023-06-09 15:45:08 -03:00
Gabriel Luiz Freitas Almeida
80de5b19ea 🚀 feat(App.tsx): add getVersion function to fetch API version
🚀 feat(API/index.ts): add getVersion function to fetch API version
🚀 feat(cardComponent/index.tsx): add CardComponent to display flow data
🚀 feat(types/flow/index.ts): add FlowStyleType to represent flow styles
The getVersion function was added to fetch the version of the API. The CardComponent was added to display flow data. The FlowStyleType was added to represent flow styles.
2023-06-09 15:44:49 -03:00
Alexandre Henrique Pereira Tavares
b02ed92b84
Implemented add_extra_fields method for the documentloaders (#408) 2023-06-09 15:24:56 -03:00
Alexandre Henrique
f7bdb711f1 Merged frontend_node/llm from origin/dev into add_extra_fields_documentloaders 2023-06-09 15:05:56 -03:00
Gabriel Luiz Freitas Almeida
79d258d7fa Merge remote-tracking branch 'origin/dev' into db 2023-06-09 14:51:18 -03:00