diff --git a/vizro-ai/src/vizro_ai/dashboard/graph/code_generation.py b/vizro-ai/src/vizro_ai/dashboard/graph/code_generation.py index 7f858299d..0fbd826b4 100644 --- a/vizro-ai/src/vizro_ai/dashboard/graph/code_generation.py +++ b/vizro-ai/src/vizro_ai/dashboard/graph/code_generation.py @@ -95,7 +95,7 @@ def _store_df_info(state: GraphState, config: RunnableConfig) -> Dict[str, DfMet cleaned_df_name = re.sub(r"\W+", "_", cleaned_df_name) df_id = cleaned_df_name.strip("_") logger.info(f"df_name: {df_name} --> df_id: {df_id}") - df_metadata[df_id] = {"df_schema": df_schema, "df": df} # TODO: shall be a dataclass + df_metadata[df_id] = {"df_schema": df_schema, "df": df} # TODO: shall be a dataclass return {"df_metadata": df_metadata} diff --git a/vizro-ai/src/vizro_ai/dashboard/nodes/plan.py b/vizro-ai/src/vizro_ai/dashboard/nodes/plan.py index c6a82c2ca..78d29cec0 100644 --- a/vizro-ai/src/vizro_ai/dashboard/nodes/plan.py +++ b/vizro-ai/src/vizro_ai/dashboard/nodes/plan.py @@ -44,10 +44,7 @@ class Component(BaseModel): component_id: str = Field( pattern=r"^[a-z]+(_[a-z]+)?$", description="Small snake case description of this component." ) - page_id: str = Field( - ..., - description="The page id where this component will be placed." - ) + page_id: str = Field(..., description="The page id where this component will be placed.") data_frame: str = Field( ..., description="The name of the dataframe that this component will use. If the dataframe is " @@ -62,13 +59,11 @@ def create(self, model, df_metadata) -> Union[ComponentType, None]: if self.component_type == "Graph": return vm.Graph( - id=self.component_id+"_"+self.page_id, - figure=vizro_ai.plot(df=df_metadata[self.data_frame]["df"], user_input=self.component_description) + id=self.component_id + "_" + self.page_id, + figure=vizro_ai.plot(df=df_metadata[self.data_frame]["df"], user_input=self.component_description), ) elif self.component_type == "AgGrid": - return vm.AgGrid( - id=self.component_id+"_"+self.page_id, - figure=dash_ag_grid(data_frame=self.data_frame)) + return vm.AgGrid(id=self.component_id + "_" + self.page_id, figure=dash_ag_grid(data_frame=self.data_frame)) elif self.component_type == "Card": return _get_proxy_model( query=self.component_description, llm_model=model, result_model=vm.Card, df_metadata=df_metadata diff --git a/vizro-ai/src/vizro_ai/dashboard/utils.py b/vizro-ai/src/vizro_ai/dashboard/utils.py index 3559e5cda..6b4bc8ac3 100644 --- a/vizro-ai/src/vizro_ai/dashboard/utils.py +++ b/vizro-ai/src/vizro_ai/dashboard/utils.py @@ -4,6 +4,7 @@ # import black from typing import Any + import tqdm.std import vizro.models as vm