✨ feat(nameInputComponent.tsx): add character limit to name input field
The name and description input fields in the ExportModal and FlowSettingsModal components have been refactored into a reusable component called EditFlowSettings. This improves code reusability and reduces code duplication. The EditFlowSettings component also includes a character limit of 50 characters for the name input field to prevent users from entering names that are too long.
The EditFlowSettings component is a form that allows the user to edit the name and description of a flow. It receives the current name and description as props, as well as a list of flows, the current tab ID, and functions to update the name, description, and flow. The component also includes a character limit for the name input and displays an error message if the limit is reached.
Added new OpenAI chat models to the CHAT_OPENAI_MODELS list to improve the quality of the chatbot responses. The new models are "gpt-3.5-turbo-0613", "gpt-3.5-turbo-16k-0613", "gpt-4-0613", and "gpt-4-32k-0613". The existing models "gpt-3.5-turbo" and "gpt-4-32k" were also updated to their latest versions.
The langchain and openai dependencies have been updated to versions 0.0.200 and 0.27.8 respectively. This update is necessary to ensure that the application is using the latest versions of these libraries and to take advantage of any bug fixes or new features that have been added.
The changes in this commit include removing unused imports and formatting the code to improve readability. The handleSaveFlow function was added to save flow changes to the database and display a success message. This function is called when the user clicks the save button.
🎨 style(flowSettingsModal): remove unused imports and format code
The imports for XMarkIcon and FaEraser were removed as they were not being used. The lodash set function was also removed as it was not being used. The getWebSocketUrl function was extracted from the connectWS function to improve readability and maintainability.
🔨 refactor(vite.config): remove unused routes and commented code, remove rewrite function
The menuBar component had some unused imports and code that was removed. A missing semicolon was added to the code. The vite.config file had some unused routes and commented code that was removed. The rewrite function was also removed as it was not needed.
✨ feat(App.tsx): simplify getVersion() function call
The imports and components that are no longer used have been removed to improve the code's readability and maintainability. The getVersion() function call has been simplified to make the code more concise and easier to read.
All API endpoints now have the /api/v1 prefix to improve the semantics of the API and to make it easier to distinguish between the frontend and backend routes.
The import statements for unused components and contexts have been removed to improve code readability and maintainability. The unused variables have also been removed to reduce clutter and improve code quality.
The status codes have been added to the API endpoints to improve the readability of the code and to make it more explicit what the expected response codes are. The status codes have been added to the following endpoints: create_flow, read_flows, read_flow, update_flow, delete_flow, create_flows, upload_file, and download_file.
This commit adds tests for the process_tweaks function in the langflow.processing.process module. The tests cover the following scenarios:
- No tweaks are applied to the graph data
- A single tweak is applied to the graph data
- Multiple tweaks are applied to the graph data
- A tweak is applied to a non-existent parameter in the graph data
The tests ensure that the function processes the tweaks correctly and returns the expected result.
✨ feat(endpoints.py): add flow_id parameter to predict_flow function to allow for running a flow by ID
The predict_flow function now includes a flow_id parameter and a session dependency to allow for running a flow by ID. The flow object is retrieved from the session using the flow_id parameter. If the flow is not found, a ValueError is raised.
🔨 refactor(constants.tsx): change API_URL constant to BASE_API_URL and add flow_id parameter to run_flow function
The API_URL constant has been renamed to BASE_API_URL to better reflect its purpose. The run_flow function now includes a flow_id parameter to allow for running a flow by ID. The flow_id parameter is used to construct the API URL.
The flowId is now passed as an Authorization token in the headers of the API request. This improves security as the flowId is not exposed in the URL. The API_URL now only contains the base URL without the flowId.
The process_tweaks function has been refactored to improve readability and maintainability. The function now takes in two parameters, graph_data and tweaks, and returns the modified graph_data. The tweaks parameter is a dictionary of dictionaries, where the key is the node id and the value is a dictionary of the tweaks. The function processes the graph data to add the tweaks by iterating over the nodes and checking if the node id is in the tweaks dictionary. If it is, the function applies the tweaks to the node by updating the template data with the new values. The function also prints a message to the console to indicate that a tweak has been applied.
The PredictRequest schema now includes an optional tweaks field, which is a dictionary of dictionaries. This field allows for additional customization of the prediction request, such as specifying tool names or descriptions. The tweaks field is optional, and if not provided, the default value is an empty dictionary. The schema_extra attribute has also been updated to include an example of the new tweaks field.
🐛 fix(endpoints.py): change predict endpoint to use Flow object instead of flow_id
🐛 fix(endpoints.py): add support for processing tweaks in predict endpoint
The predict endpoint now requires authentication using HTTPBearer. The flow_id is now extracted from the bearer token instead of being passed as a parameter. This improves security as the flow_id is not exposed in the URL. The predict endpoint now uses the Flow object instead of the flow_id to retrieve the graph data. This improves code readability and reduces the number of database queries. The predict endpoint now supports processing tweaks, which allows for more flexibility in the processing of messages.