Commit graph

7,638 commits

Author SHA1 Message Date
Gabriel Luiz Freitas Almeida
faf44eca0e 🔧 refactor(schemas.py): add optional tweaks field to PredictRequest schema
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.
2023-06-13 12:49:11 -03:00
Gabriel Luiz Freitas Almeida
7cc14e83b8 🚀 feat(endpoints.py): add authentication to predict endpoint using HTTPBearer
🐛 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.
2023-06-13 12:48:52 -03:00
Lucas Oliveira
8b6af6b768 Undo and Redo icons changed 2023-06-13 11:41:41 -03:00
Lucas Oliveira
1452e9c7a2 added useUndoRedo to context and added Undo and Redo buttons to header 2023-06-13 11:41:03 -03:00
Cristhian Zanforlin Lousa
ab0209d399 Import shad dialog, CSS in general 2023-06-13 11:22:43 -03:00
Lucas Oliveira
1af07ec453 Fixed flow id after uploading to DB 2023-06-13 11:00:09 -03:00
Lucas Oliveira
d76d0b2d51 Upload and Download Flows done, fixed deleting flow bug 2023-06-13 10:51:10 -03:00
anovazzi1
513174fb3a scroll and general position bug fixed 2023-06-12 22:08:16 -03:00
Lucas Oliveira
35fea98301 Fixed bug with home page overflow 2023-06-12 21:47:56 -03:00
Lucas Oliveira
74954dd4b1 Fixed bug where flow disappears 2023-06-12 21:47:02 -03:00
Lucas Oliveira
91b243779c Added buttons on sidebar and fixed header visual bug 2023-06-12 21:46:21 -03:00
Lucas Oliveira
2d640c8e5a Back button added, chevron with dropdown added to flow name 2023-06-12 21:17:44 -03:00
Lucas Oliveira
e491064662 Removed menubar edit and file, added all into the project name 2023-06-12 20:44:35 -03:00
Gabriel Luiz Freitas Almeida
d14be904ad 🐛 fix(chat.py): raise HTTPException instead of returning JSONResponse on stream_build error
The function stream_build was returning a JSONResponse with an error message when an exception was raised. This is not the correct way to handle errors in FastAPI. Instead, we should raise an HTTPException with the appropriate status code and error message.
2023-06-12 20:43:55 -03:00
Gabriel Luiz Freitas Almeida
7b44b18726 🐛 fix(loading.tsx): fix broken link to the source of the Loading component
The React import is not used in the file, so it has been removed to improve code readability. The link to the source of the Loading component was broken, so it has been fixed to ensure that the component can be used properly.
🔥 chore(loading.tsx): remove unused React import
2023-06-12 20:40:44 -03:00
Gabriel Luiz Freitas Almeida
d300c0b428 💄 style(chat.py): reformat code to improve readability
The unused imports and exception handling for WebSocketDisconnect and WebSocketException were removed from the chat.py file. The code was reformatted to improve readability.
🔥 refactor(chat.py): remove unused imports and exception handling
2023-06-12 20:40:43 -03:00
anovazzi1
a41cc95abb added security check to avoid errors on building empty flows 2023-06-12 20:26:56 -03:00
anovazzi1
62b0b28b7f start websocket from chat only after build 2023-06-12 20:23:52 -03:00
Lucas Oliveira
83e592d4d7 fixed routing, working perfectly 2023-06-12 20:15:07 -03:00
anovazzi1
f9cece1ece lock click on loading state of button 2023-06-12 20:10:40 -03:00
Lucas Oliveira
b45966051a fixed header to new logic 2023-06-12 19:23:34 -03:00
Lucas Oliveira
9408442191 Fixed logic to simplify transition to routes 2023-06-12 19:21:48 -03:00
Cristhian Zanforlin Lousa
7dfffd33e7 dark mode dropdown 2023-06-12 19:12:24 -03:00
Cristhian Zanforlin Lousa
a5d7683442 changing width dropdown 2023-06-12 19:04:59 -03:00
Cristhian Zanforlin Lousa
78ce80098d adjust dark mode and dropdown 2023-06-12 18:55:00 -03:00
anovazzi1
1fdf03c925 validating nodes before sending it to the backend 2023-06-12 18:30:53 -03:00
anovazzi1
72dea88f14 moved validateNodes function to utils 2023-06-12 18:20:52 -03:00
Lucas Oliveira
ceb9b1d155 Added flow id and routes logic 2023-06-12 18:19:05 -03:00
Gabriel Luiz Freitas Almeida
312e0c4834 🐛 fix(GenericNode): set validationStatus to null when relevantData is null
This change fixes a bug where the validationStatus state was not being set to null when relevantData was null. This caused the validationStatus to retain its previous value, which could lead to incorrect validation results being displayed.
2023-06-12 17:05:05 -03:00
Gabriel Luiz Freitas Almeida
fe0c6f7f38 🐛 fix(chat.py): rename websocket_endpoint to chat for better semantics
 feat(chat.py): add build_status endpoint to check if flow_id is in flow_data_store
The function name websocket_endpoint was renamed to chat to improve semantics. The new build_status endpoint was added to check if a flow_id is in the flow_data_store. This endpoint returns a JSON response with a boolean value indicating whether the flow_id is built or not. If the flow_id is not in the flow_data_store, a JSON response with a value of False is returned. If an exception occurs, a 500 HTTPException is raised with the exception message as the detail.
2023-06-12 17:04:52 -03:00
Gabriel Luiz Freitas Almeida
de7b2c9f31 🔥 chore(chatComponent): remove unused imports and API call
The import for the postBuild function was removed as it was not being used in the BuildTrigger component. This improves the code's readability and maintainability.

🚀 feat(chatComponent): add useEffect hook to fetch build status and update state
An async function was added to fetch the build status of the flow and update the state of the isBuilt variable. This allows the component to display the correct state of the build trigger button.

👌 refactor(chatComponent): refactor useEffect hook to update isBuilt state when nodes change
The useEffect hook was refactored to update the isBuilt state when the nodes change. This ensures that the build trigger button is disabled when the nodes change, as the flow needs to be rebuilt before it can be triggered again.

🔥 chore(intComponent): remove console.log statement
The console.log statement was removed from the onKeyDown event listener in the IntComponent component. This improves the code's cleanliness and readability.
2023-06-12 17:04:19 -03:00
Gabriel Luiz Freitas Almeida
d381228b83 🚀 feat(API): add BuildStatusTypeAPI to API types and implement getBuildStatus function
The BuildStatusTypeAPI was added to the API types to support the new getBuildStatus function. The getBuildStatus function retrieves the build status of a flow by making a GET request to the server. This function is useful for updating the UI with the current status of a flow.
2023-06-12 17:03:54 -03:00
Gabriel Luiz Freitas Almeida
68e17384c8 🔧 chore(chatModal): extract getWebSocketUrl function to improve readability and maintainability
The getWebSocketUrl function was extracted to improve the readability and maintainability of the code. It takes the chatId and isDevelopment flag as parameters and returns the WebSocket URL based on the current environment. The function uses the window.location object to determine the protocol and host, and the chatEndpoint to construct the URL.
2023-06-12 17:03:36 -03:00
Gabriel Luiz Freitas Almeida
bc499b285d 🚀 feat(api): add BuildStatusTypeAPI to represent the status of a build
The BuildStatusTypeAPI is added to represent the status of a build. It contains a boolean value indicating whether the build was successful or not.
2023-06-12 17:03:22 -03:00
anovazzi1
5857253e71
Refactor frontend API use (#477)
 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-12 16:37:08 -03:00
Cristhian Zanforlin Lousa
0dc8ca8682 bugfixes: darkmode and not saving file/text 2023-06-12 13:57:56 -03:00
Gabriel Luiz Freitas Almeida
585aeeab6e 🔥 refactor(base.py): remove unnecessary build method call in Graph class
The build method call in the for loop of the build_vertices method is unnecessary as the vertices are already sorted and built in the topological_sort method. The yield from statement is used to return the sorted vertices.
2023-06-12 13:05:27 -03:00
Gabriel Luiz Freitas Almeida
64397d2830 🔨 refactor(buildTrigger): change allNodesValid to validationResults array and add finished variable to improve readability
🚀 feat(buildTrigger): add waiting for stream to finish and return validation results for each node
The allNodesValid variable has been changed to a validationResults array to store the validation results for each node. A finished variable has been added to improve readability and to wait for the stream to finish. The function now returns an array of validation results for each node.
2023-06-12 13:05:02 -03:00
Gabriel Luiz Freitas Almeida
baeadf018d feat(chat.py): improve SSE response by adding node id and valid flag
The changes in this commit handle exceptions that may occur when creating a streaming response. The try-except block ensures that any exceptions are caught and an appropriate response is returned. Additionally, the SSE response has been improved by adding a valid flag and node id to the response. This provides more information to the client about the status of the node build and allows for better error handling.
🐛 fix(chat.py): handle exceptions when creating a streaming response
2023-06-12 13:03:46 -03:00
Gabriel Luiz Freitas Almeida
806d815a10 feat(index.tsx): add support for streaming build process using EventSource
The commented out code for the /build/{client_id} endpoint has been removed as it is no longer needed. The new implementation uses the /build/init endpoint to initiate the build process and then establishes an SSE connection using EventSource to stream the build process. This allows for a more efficient and responsive build process as the client can receive updates in real-time.
🔥 chore(chat.py, index.tsx): remove commented out code for /build/{client_id} endpoint
2023-06-12 11:49:59 -03:00
Gabriel Luiz Freitas Almeida
76f1aa8adf 🐛 fix(chat.py): add check for client_id in in_memory_cache before handling websocket
 feat(chat.py): add support for storing graph data and returning a unique session ID for building langchain object
 feat(chat.py): add support for streaming the build process based on stored flow data
The fix adds a check for the client_id in the in_memory_cache before handling the websocket. This ensures that the flow has been built before sending messages.

The first feature adds support for storing graph data and returning a unique session ID for building the langchain object. This allows the user to build the flow and then send messages.

The second feature adds support for streaming the build process based on stored flow data. This allows the user to see the progress of the build process.
2023-06-12 11:49:24 -03:00
Gabriel Luiz Freitas Almeida
6b57e20504 formatting 2023-06-12 09:45:28 -03:00
Gabriel Luiz Freitas Almeida
4f4a0ff4c7 🔨 refactor(chatComponent): refactor handleBuild function to use async/await and extract constants to improve readability
🐛 fix(chatComponent): fix issue with progressEvent not being properly destructured
🚀 feat(chatComponent): add minimum loading time to improve user experience
The handleBuild function was refactored to use async/await and constants were extracted to improve readability. The issue with progressEvent not being properly destructured was fixed. A minimum loading time was added to improve user experience by ensuring that the loading spinner is displayed for at least a certain amount of time.
2023-06-12 09:44:12 -03:00
Gabriel Luiz Freitas Almeida
42d11894a2 🔀 chore(base.py): change return type of generator_build method from List[Vertex] to Generator
The return type of the generator_build method has been changed from List[Vertex] to Generator to improve the semantics of the method. The method now yields each vertex in the graph instead of returning a list of vertices.
2023-06-12 09:35:19 -03:00
Gabriel Luiz Freitas Almeida
a15cc30da5 🔥 refactor(manager.py): remove unused imports and dependencies
🔥 refactor(utils.py): remove unused imports and dependencies
The changes remove unused imports and dependencies from the codebase, which improves the code's readability and maintainability.
2023-06-12 09:33:54 -03:00
Gabriel Luiz Freitas Almeida
25f22ae88c 🔇 chore(frontend): comment out console.log statements
The console.log statements were commented out in the tabsContext.tsx, EditNodeModal/index.tsx, NodeToolbarComponent/index.tsx, and FlowPage/index.tsx files to remove unnecessary logging in the console.
2023-06-12 09:33:03 -03:00
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