The `save_api_keys` variable has been renamed to `remove_api_keys` to improve the semantics of the code. The new variable name better reflects the functionality of the code, which is to remove API keys from the projects saved in the database.
🔧 chore(__main__.py): change save_api_keys to remove_api_keys to improve semantics
✨ feat(__main__.py): add save_api_keys parameter to serve command to allow users to save API keys in their projects
The update_settings function now accepts a save_api_keys parameter, which allows the user to specify whether or not to save API keys in their projects. The serve command now has a save_api_keys parameter that defaults to True, allowing users to save API keys in their projects. This feature improves the user experience by allowing them to save API keys for future use.
This commit adds a new function called `remove_api_keys` to the `utils.py` file. The function takes in a dictionary representing a flow and removes any API keys from the flow data. The function iterates through each node in the flow and checks if the node contains any API keys. If an API key is found, the function sets the value of the key to `None`. This function is useful for removing sensitive information from flow data before it is stored or transmitted.
The `remove_api_keys` function is now called on the `flow_data` dictionary if the `save_api_keys` setting is False. This ensures that sensitive information is not saved in the database.
The condition to show the password field was not working for the 'tokens' field name. The condition has been updated to include 'tokens' in the field name and show the password field.
The TWEAKS constant is a dictionary that can be used to tweak the flow. It is an optional parameter that can be passed to the run_flow function. The dictionary should be in the format {"OpenAI-XXXXX": {"model_name": "gpt-4"}}. This commit adds documentation to the code to make it easier for developers to understand how to use the TWEAKS constant.
This commit changes the styling of the build trigger button in the Chat Component. The button is now round and has a shadow when hovering. Additionally, the lightning bolt icon is now colored with a gradient rather than a solid color.
The useEffect hook was added to the PageComponent to save the flow when the component unmounts if the flow is pending. This is done to ensure that any changes made to the flow are saved before the component is unmounted. The tabsState and saveFlow functions were also added as dependencies to the hook.
feat(flowSettingsModal/index.tsx): use saveFlow function from TabsContext to save flow changes to database and update state
feat(extraSidebarComponent/index.tsx): use saveFlow function from TabsContext to save flow changes to database and update state
feat(tabs/index.ts): add saveFlow function to TabsContextType to update type definition
The activeTab state was previously a number, but it was causing a type error when passed as a prop to the TabsTrigger component. Changing it to a string fixed the issue. Additionally, the onValueChange prop was added to the Tabs component to update the activeTab state when a new tab is selected.
🐛 fix(ApiModal): change activeTab state from number to string to fix type error
This commit adds a new function called getWebSocketUrl to the ChatModal component. This function generates a WebSocket URL based on the chatId and environment. It determines whether to use the "ws" or "wss" protocol based on whether the current protocol is secure or not. It also determines the host based on whether the environment is development or production. This function will be used to establish a WebSocket connection to the server.
The Save button was not being displayed correctly when the isPending variable was true. The fix changes the order of the classes to correctly display the button as intended.
The 'valid' state variable was not being used, so it was removed. The 'streamNodeData' function was simplified by removing the 'onStreamComplete' callback and instead using a while loop to wait for the stream to finish. The function now returns a boolean indicating whether all nodes in the flow are valid or not.
The updateFlowInDatabase function now has a type added to it, which improves the readability of the code. The code has also been formatted to improve consistency with the rest of the codebase.
🔨 refactor(parameterComponent): remove unused imports and refactor onChange function to handleOnNewValue
✨ feat(tabsContext): add tabsState and setTabsState to TabsContextType and TabsProvider
🔨 refactor(flowSettingsModal): refactor handleSaveFlow function to update flow and setTabsState with isPending false
The update_flow endpoint now returns a FlowRead response model instead of FlowReadWithStyle. The parameterComponent file has been refactored to remove unused imports and to use a handleOnNewValue function to handle onChange events. The TabsContextType and TabsProvider have been updated to include tabsState and setTabsState. The flowSettingsModal has been refactored to update the flow and setTabsState with isPending false.
🔨 refactor(extraSidebarComponent): add tabsState and setTabsState to TabsContextType
🐛 fix(extraSidebarComponent): disable save button when flow is not pending
🐛 fix(extraSidebarComponent): update flow state after saving
The TabsContextType now includes tabsState and setTabsState to allow for the management of the state of each tab. The save button is now disabled when the flow is not pending. The flow state is now updated after saving to reflect the changes made.
The build trigger component now tracks if all nodes are valid during the build process. This is done by adding a state variable called `valid` which is set to true by default. If any node is invalid, the `valid` state is set to false. This ensures that the error message is displayed when there are invalid nodes. The `streamNodeData` function now takes a callback function `onStreamComplete` which is called when the SSE stream is complete. This callback function is used to set the `isBuilt` state variable.
🐛 fix(chatComponent): fix bug where build trigger would not show error message when nodes are invalid
✨ feat(buildTrigger): add error handling to build request
Previously, multiple build requests could be sent simultaneously, which could cause issues. The fix prevents multiple requests from being sent at the same time. Additionally, error handling has been added to the build request to catch any errors that may occur.
The description of CombineDocsChainNode was updated to reflect the actual functionality of the node. The node is now used to load a question answering chain instead of constructing a chain from combined documents.
The console.log statement in the Chat component has been removed as it is no longer needed. Unused imports have also been removed from the BuildTrigger and Chat components to improve code readability and maintainability.
🐛 fix(frontend): add missing semicolon in EditFlowSettingsComponent
The package.json and postcss.config.js files were updated to improve formatting and update dependencies. The EditFlowSettingsComponent had a missing semicolon which was added.
🔧 chore: fix formatting issues in multiple files
The changes in this commit are purely cosmetic and do not affect the functionality of the application. The changes include fixing formatting issues such as indentation, whitespace, and semicolons in multiple files. These changes improve the readability and maintainability of the codebase.
The openai_api_version field value is no longer set as it is not needed. The password field is now set to False for fields not containing 'key' or 'token' in their name to improve security.
🐛 fix(llms.py): remove setting of openai_api_version field value