react-agent
react-agent copied to clipboard
Error when generating a new user-story project
Problem
I'm getting the following error when running yarn: backend dev
command for a new user story:
generateComponents start
generateSkeletonCompositionFromStory: generating configuration
generateSkeletonCompositionFromStory: composition saved
generateComponentsConfigurations: generating configuration
TypeError: uiComponents.filter is not a function
at C:\Projects\react.agent\backend\main\react-agent\generateComponentsConfigurations.ts:43:47
at Generator.next (<anonymous>)
at fulfilled (C:\Projects\react.agent\backend\main\react-agent\generateComponentsConfigurations.ts:5:58)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
How to reproduce?
- Create a new directory with any name under
frontend/main/src/react-agent
- Clone the user story.md file from AnalyticsDashboard
- run
yarn: backend dev
command
It seems like the components.json
missing the uiComponent
property for some of the components which leads to an error.
Hi @DvirH With gpt-3.5-turbo, looks like JSON array is returning in uiComponents.components object. Change this line and see result. const existingComponents = uiComponents.components.filter(doesComponentExist);
Updated method :
const getFullConfigurations = async (component: Component) => { try { const uiComponents = await componentsPickerGenerator.pickComponents({ description: JSON.stringify(component), }); // filter non existing components const existingComponents = uiComponents.components.filter(doesComponentExist); return { ...component, uiComponents: existingComponents }; } catch (e) { console.error(e); return component; } };