AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(backend): Fix json `to_dict` method on string value
Zamil Majdy1e31136358a9
diff --git a/autogpt_platform/backend/backend/blocks/llm.py b/autogpt_platform/backend/backend/blocks/llm.pyindex 9c43cb5483..ee63d42e75 100644--- a/autogpt_platform/backend/backend/blocks/llm.py+++ b/autogpt_platform/backend/backend/blocks/llm.py@@ -552,7 +552,7 @@ class AIStructuredResponseGeneratorBlock(AIBlockBase):default="",description="The system prompt to provide additional context to the model.",)- conversation_history: list[Any] = SchemaField(+ conversation_history: list[dict] = SchemaField(default=[],description="The conversation history to provide context for the prompt.",)diff --git a/autogpt_platform/backend/backend/blocks/smart_decision_maker.py b/autogpt_platform/backend/backend/blocks/smart_decision_maker.pyindex 1ea03d0aea..f196ca24da 100644--- a/autogpt_platform/backend/backend/blocks/smart_decision_maker.py+++ b/autogpt_platform/backend/backend/blocks/smart_decision_maker.py@@ -53,7 +53,7 @@ class SmartDecisionMakerBlock(Block):default="Thinking carefully step by step decide which function to call. Always choose a function call from the list of function signatures.",description="The system prompt to provide additional context to the model.",)- conversation_history: list[Any] = SchemaField(+ conversation_history: list[dict] = SchemaField(default=[],description="The conversation history to provide context for the prompt.",)diff --git a/autogpt_platform/backend/backend/util/json.py b/autogpt_platform/backend/backend/util/json.pyindex 181f0bc7ed..106d79b99d 100644--- a/autogpt_platform/backend/backend/util/json.py+++ b/autogpt_platform/backend/backend/util/json.py@@ -11,10 +11,6 @@ from .type import type_matchdef to_dict(data) -> dict:if isinstance(data, BaseModel):data = data.model_dump()-- elif isinstance(data, str):- data = loads(data)-return jsonable_encoder(data)