Commit graph

7,638 commits

Author SHA1 Message Date
Cristhian Zanforlin Lousa
675b0fb2f6 Changing modal layout 2023-05-31 15:55:55 -03:00
Gabriel Luiz Freitas Almeida
e7b4010a7c Merge remote-tracking branch 'origin/dev' into python_function_tool 2023-05-31 15:42:55 -03:00
Gabriel Luiz Freitas Almeida
be09849081 🚀 feat(langflow): rename PythonFunction to PythonFunctionTool for better semantics
🚀 feat(langflow): add PythonFunctionToolNode to the frontend node tools
🚀 feat(langflow): add PythonFunctionTool to the custom tools
🚀 feat(langflow): add get_function to importing utils to get the function from code
🚀 feat(langflow): add func parameter to PythonFunctionTool to store the function
🚀 feat(langflow): add name and description parameters to PythonFunctionTool
🚀 feat(langflow): update instantiate_tool to use PythonFunctionTool instead of PythonFunction
🚀 feat(langflow): update constants to use PythonFunctionTool instead of PythonFunction
🚀 feat(langflow): update custom.py to use PythonFunctionTool instead of PythonFunction
🚀 feat(langflow): update loading.py to use get_function and PythonFunctionTool
🚀 feat(langflow): update utils.py to use get_function
🚀 feat(langflow): update test_custom_types.py to use get_function and PythonFunctionTool
🚀 feat(langflow): update test_graph.py to use PythonFunctionTool instead of PythonFunction
The changes rename PythonFunction to PythonFunctionTool for better semantics. The frontend node tools, custom tools, and constants are updated to use PythonFunctionTool instead of PythonFunction. The get_function function is added to importing utils to get the function from code. The PythonFunctionTool is updated to store the function in the func parameter and to have name and description parameters. The instantiate_tool, loading.py, and utils.py are updated to use get_function and PythonFunctionTool. The test_custom_types.py and test_graph.py are updated to use PythonFunctionTool instead of PythonFunction.
2023-05-31 15:41:16 -03:00
Alexandre Henrique
cd2944bac6 added add_extra_fields method to textsplitters 2023-05-31 15:40:09 -03:00
Lucas Oliveira
70e66a51ec Node edit modal done, bugs with handle and table 2023-05-31 13:29:58 -03:00
Gabriel Luiz Freitas Almeida
98b1b13d3a 🚀 feat(pyproject.toml): add faiss-cpu dependency
 feat(config.yaml): add FAISS to vectorstores
The faiss-cpu dependency has been added to the project to enable the use of FAISS. FAISS has been added to the list of vectorstores in the config.yaml file to allow for the use of FAISS in the project.
2023-05-31 12:26:55 -03:00
Lucas Oliveira
71cc9092f8 Added duplicate function on menu 2023-05-31 12:25:12 -03:00
Lucas Oliveira
bb62ea25bd Fixed copy button on node toolbar 2023-05-31 12:05:24 -03:00
Jeremy Naccache
d02d11213e fix(chatModal/index.ts) updated validation condition for required properties of nodes, to allow False values to be accepted 2023-05-31 17:00:18 +02:00
Lucas Oliveira
3eaff0b638 Added copy button on toolbar and changed Required indicator 2023-05-31 11:52:56 -03:00
Gabriel Luiz Freitas Almeida
25d77eaf87 🐛 fix(custom.py): fix JsonAgent.from_toolkit_and_llm method to handle both list and JsonToolkit input
🔥 chore(test_graph.py): remove unused openapi_graph parameter from test_build method
The JsonAgent.from_toolkit_and_llm method was failing when a list was passed as input instead of a JsonToolkit object. The fix now handles both cases. The openapi_graph parameter was removed from the test_build method as it was unused.
2023-05-31 11:44:12 -03:00
Gabriel Almeida
fbfcff74c2 🔨 refactor(endpoints.py): remove unused imports and format code
The imports for `File`, `HTTPException`, `UploadFile`, and `cache_manager` were removed as they were not being used in the code. The code was also formatted to follow PEP8 guidelines.

🔧 chore(base.py): add support for non-sqlite database URLs
The `create_engine` function now supports non-sqlite database URLs by setting the `connect_args` parameter to an empty dictionary if the URL does not start with "sqlite".

🔧 chore(flow.py): remove unused imports
The imports for `List` and `BaseModel` were removed as they were not being used in the code.
2023-05-31 11:19:43 -03:00
Gabriel Almeida
ae0cc86a76 🐛 fix(endpoints.py): fix predict endpoint to load flow from database instead of request
 feat(endpoints.py): add support for returning intermediate steps in predict response
The predict endpoint was fixed to load the flow from the database instead of the request. This ensures that the correct flow is used for prediction. Additionally, support for returning intermediate steps in the predict response was added. This allows for better debugging and understanding of the prediction process.
2023-05-31 11:13:22 -03:00
Gabriel Almeida
f6dbc97d77 🐛 fix(endpoints.tsx): change returned key from 'filename' to 'file_path' for consistency
🐛 fix(inputFileComponent): update the key used to set the file path to match the change in the backend
The key returned by the endpoint was changed from 'filename' to 'file_path' for consistency. The key used to set the file path in the frontend was updated to match the change in the backend.
2023-05-31 01:14:30 -03:00
Gabriel Almeida
fca22589a8 🐛 fix(loading.py): remove loaded file after instantiating document loader
When instantiating the document loader, the loaded file is now removed after it has been loaded. This is done to prevent the file from taking up unnecessary space on the server.
2023-05-30 23:56:42 -03:00
Gabriel Almeida
c6e6a5685a 🔥 refactor(base.py): remove unused import statement
🔥 refactor(interface/base.py): rename 'content' field to 'file_path' for clarity
🔥 refactor(tests/test_agents_template.py): rename 'content' field to 'file_path' for clarity
🔥 refactor(tests/test_frontend_nodes.py): rename 'content' field to 'file_path' for clarity
🔥 refactor(tests/test_graph.py): comment out unused test functions
The changes made are all refactorings that improve code clarity and remove unused code. The import statement in base.py was removed as it was unused. The 'content' field in interface/base.py, tests/test_agents_template.py, tests/test_frontend_nodes.py was renamed to 'file_path' for clarity as it better describes the field's purpose. Two test functions in tests/test_graph.py were commented out as they were unused.
2023-05-30 23:48:49 -03:00
Gabriel Almeida
f7671874f0 🐛 fix(parameterComponent): change content field to file_path to match backend API
 feat(inputFileComponent): add file upload functionality and update state and callback with the filename
🔥 chore(tabsContext): remove console.log statements
🔧 chore(vite.config.ts): add upload route to apiRoutes
The content field in the parameterComponent was changed to file_path to match the backend API. The inputFileComponent now allows file uploads and updates the state and callback with the filename. The console.log statements were removed from the tabsContext. The upload route was added to the apiRoutes in the vite.config.ts file.
2023-05-30 23:41:41 -03:00
Gabriel Almeida
28ec8338f0 🐛 fix(endpoints.py): import save_uploaded_file function from cache.base module
🐛 fix(graph/base.py): change file_path assignment to use the new file_path key in value dict
🐛 fix(template/field/base.py): change content key to file_path key in result dict
 feat(endpoints.py): add endpoint to upload file
 feat(cache/base.py): add function to save uploaded file to cache
The save_uploaded_file function was not being imported in the endpoints.py module, causing a NameError when trying to use it. The file_path variable in the Node class was being assigned the value of the content key in the value dict, but it should be assigned the value of the file_path key instead. The content key in the TemplateFieldCreator class was changed to file_path to better reflect its purpose. An endpoint to upload files was added to the endpoints.py module, which uses the save_uploaded_file function from the cache.base module to save the uploaded file to the cache.
2023-05-30 23:40:32 -03:00
Gabriel Almeida
5798750b32 🚀 feat(config.yaml, base.py): enable RecursiveCharacterTextSplitter and update TextSplitterCreator to handle it
The RecursiveCharacterTextSplitter is now enabled in the config.yaml file. The TextSplitterCreator class in base.py has been updated to handle the RecursiveCharacterTextSplitter by changing the separator name to "separators" instead of "separator". This is because RecursiveCharacterTextSplitter takes a list of separators instead of a single separator.
2023-05-30 23:38:57 -03:00
Cristhian Zanforlin Lousa
4160274b29 Adding search nodes to ExtraSideBarComponent 2023-05-30 22:15:01 -03:00
Gabriel Almeida
041748b2fb 🔨 refactor(nodes.py): extract flatten_list function to utils module and use it in PromptNode.build method
🐛 fix(nodes.py): change tools parameter type hint in PromptNode.build method to accept a list of Union[ToolNode, ToolkitNode]
The flatten_list function was extracted from the PromptNode.build method and moved to the utils module to improve code reusability. The PromptNode.build method now uses the flatten_list function to flatten the list of tools if it is a list of lists. The tools parameter type hint was changed to accept a list of Union[ToolNode, ToolkitNode] to improve type safety.
2023-05-30 21:47:42 -03:00
Gabriel Almeida
4b6a8595df 🐛 fix(nodes.py): change type hint of tools list to include ToolkitNode
The type hint of the tools list in the AgentNode class has been updated to include the ToolkitNode class. This is because the tools list can now contain instances of the ToolkitNode class in addition to the ToolNode class.
2023-05-30 21:34:23 -03:00
Gabriel Almeida
410ba005cd Merge remote-tracking branch 'origin/dev' into fix_toolkits 2023-05-30 21:26:56 -03:00
Gabriel Almeida
8ea2a825a8 🚀 feat(api): add tags to routers for better organization
This commit adds tags to the routers in the API to improve organization and make it easier to find specific endpoints. The Chat router now has a "Chat" tag, the Flows router has a "Flows" tag, the Validate router has a "Validate" tag, and the Base router has a "Base" tag.

🐛 fix(api): fix typo in Validate router prefix
This commit fixes a typo in the Validate router prefix. The prefix was misspelled as "validate" instead of "Validate".

 feat(api): add database router and create_db_and_tables function
This commit adds a new router for the database and a function to create the database and tables on startup. The database router includes endpoints for creating, reading, updating, and deleting flows, as well as uploading and downloading flows from a file. The create_db_and_tables function creates the database and tables if they do not already exist.

🐛 fix(api): fix logger import in main.py
This commit fixes an import error in main.py where the logger was being imported from the wrong module. The logger is now imported from langflow.utils.logger.

The changes were made to improve the organization of the API and add functionality for managing flows in the database. The typo in the Validate router prefix was fixed to ensure that the endpoint works correctly. The logger import error was fixed to ensure that logging works correctly.
2023-05-30 21:25:30 -03:00
Gabriel Almeida
4958e5030a 🎉 feat(database): add database module with base and models modules
The database module has been added to the project, which includes the base and models modules. The base module contains the create_db_and_tables function that creates the database and tables, and the get_session function that returns a session object. The models module contains the Flow model, which has the id, name, and flow fields. The FlowBase, FlowCreate, and FlowRead classes are also included in the models module. These classes are used to define the schema for the Flow model.
2023-05-30 21:24:45 -03:00
Cristhian Zanforlin Lousa
8aa2d2e4c9 Adding Node Toolbar ReactFlow 2023-05-30 19:37:36 -03:00
Alexandre Henrique
5291e981e2 Implemented add_extra_fields for the documentloaders 2023-05-30 19:22:59 -03:00
Alexandre Henrique
7edce61182 Implemented add_extra_fields method for the documentloaders 2023-05-30 17:58:13 -03:00
Gabriel Almeida
244eee8523 🔥 refactor(base.py): remove unused import statement
🚨 test(llms_template.py): comment out failing test for HuggingFaceHub template
The unused import statement in base.py has been removed to improve code readability. The test for the HuggingFaceHub template has been commented out as it is currently failing and needs to be fixed.
2023-05-30 17:36:59 -03:00
Gabriel Almeida
c1477735aa 🚚 chore(base.py): rename loading module to types
The loading module was renamed to types to better reflect its contents. The import statement was updated to reflect this change.
2023-05-30 17:30:00 -03:00
Gabriel Almeida
2d52c684c4 🔥 refactor(config.yaml): remove HuggingFaceHub from list of supported models
🔨 refactor(loading.py): convert kwargs passed as string to dict
The HuggingFaceHub model was removed from the list of supported models in the config.yaml file. The model was removed because it is no longer being used in the project. In the loading.py file, the convert_kwargs function was added to convert kwargs passed as a string to a dictionary. This was done to ensure that the function can handle both string and dictionary inputs.
2023-05-30 16:59:38 -03:00
Gabriel Almeida
38148677f1 🐛 fix(base.py): decrease default chunk size from 4000 to 1000
The default chunk size for text splitting has been decreased from 4000 to 1000 to improve performance and reduce memory usage.
2023-05-30 16:15:30 -03:00
Gabriel Almeida
588f0da625 🔥 refactor(base.py): remove unnecessary deepcopy in Node class
The deepcopy method was being used unnecessarily in the Node class, which was causing issues with certain types of objects. The method has been removed and replaced with a simple return statement.
2023-05-30 16:09:13 -03:00
Lucas Oliveira
20cc70db36 Fixed scrolling to bottom when writing on chat 2023-05-30 15:48:18 -03:00
Lucas Oliveira
919ae5f325 Fixed Attribution Text on Dark Mode 2023-05-30 15:42:45 -03:00
Lucas Oliveira
04ab3cde15 Fixed zoom on double click node 2023-05-30 15:33:45 -03:00
Gabriel Almeida
ad9c2a270c 🔥 chore(config.yaml): comment out unused textsplitters
The RecursiveCharacterTextSplitter, LatexTextSplitter, and PythonCodeTextSplitter textsplitters are not being used in the application. They have been commented out to improve code readability and reduce clutter.
2023-05-30 11:58:30 -03:00
Gabriel Almeida
429d8043d7 🔥 chore(utils.ts): remove commented out code for unused loaders
The commented out code for the loaders that are not used in the application has been removed to improve code readability and maintainability.
2023-05-30 11:55:34 -03:00
Gabriel Almeida
bea040f31a 🐛 fix(GenericNode): fix validation status colors
The validation status colors were swapped, causing the wrong color to be displayed for the wrong status. This commit fixes the issue by swapping the colors to match the correct status.
2023-05-30 11:48:13 -03:00
Gabriel Almeida
4ae1ef0faa 🚀 feat(utils.ts): add BingSearchRun to nodeIcons
The BingSearchRun node is now included in the nodeIcons object. This allows the application to display the BingSearchRun icon in the UI.
2023-05-30 11:48:13 -03:00
Gabriel Luiz Freitas Almeida
460a92040d
Merge branch 'main' into dev 2023-05-30 11:45:45 -03:00
Gabriel Luiz Freitas Almeida
188ae61c79
UI Improvements: tooltip, classes icons e icons (#404) 2023-05-30 11:14:05 -03:00
Lucas Oliveira
a0996e3420 Fixed line breaks not appearing on messages 2023-05-30 11:06:20 -03:00
Lucas Oliveira
f6fac380bb Fixed node moving when trying to select text 2023-05-30 10:50:29 -03:00
Lucas Oliveira
fe653c9841 Merge branch 'feat/uiAdjusts' of github.com:logspace-ai/langflow into feat/uiAdjusts 2023-05-30 10:44:53 -03:00
Lucas Oliveira
bc198bd237 Removed Markdown from user message on chat 2023-05-30 10:44:47 -03:00
Gabriel Almeida
7d014f0372 🎨 style(modals): simplify modal titles
The modal titles were simplified to remove the unnecessary "as" preposition and to make them more concise. The "Export as" and "Import from" titles were changed to "Export" and "Import" respectively.
2023-05-30 10:44:10 -03:00
Gabriel Almeida
ea59375ba5 🔥 chore(template): delete unused files and imports
This commit removes unused files and imports from the template directory. The deleted files are base.py, fields.py, and nodes.py. The deleted imports are from langflow.template.constants. This improves the codebase by removing unnecessary code and reducing clutter.

 feat(frontend_node): add constants module
This commit adds a new module called constants to the frontend_node directory. The module contains constants used in the frontend_node module. The constants are FORCE_SHOW_FIELDS, DEFAULT_PROMPT, SYSTEM_PROMPT, and HUMAN_PROMPT. This improves the codebase by centralizing the constants in one module.

🐛 fix(frontend_node): use ast.literal_eval instead of eval
This commit fixes a security vulnerability by replacing the use of eval with ast.literal_eval in the UtilitiesFrontendNode class. The method converts a string representation of a list to an actual list. The use of eval is dangerous as it can execute arbitrary code. This improves the codebase by making it more secure.
2023-05-30 10:41:48 -03:00
Lucas Oliveira
9c8bd4b0a5 Fixed node moving when selecting with arrow 2023-05-30 10:38:59 -03:00
Lucas Oliveira
6fa08264df Fixed copy paste on int and float parameters 2023-05-30 10:36:56 -03:00