Skip to content

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.

Update Ground model to handle optional JSON fields

hunteraraujo5e2e7a11c3c8
diff --git a/frontend/lib/models/skill_tree/ground.dart b/frontend/lib/models/skill_tree/ground.dart
index 2cc61c0dfc..9f449c75f2 100644
--- a/frontend/lib/models/skill_tree/ground.dart
+++ b/frontend/lib/models/skill_tree/ground.dart
@@ -15,11 +15,11 @@ class Ground {
factory Ground.fromJson(Map<String, dynamic> json) {
return Ground(
- answer: json['answer'],
- shouldContain: List<String>.from(json['should_contain']),
- shouldNotContain: List<String>.from(json['should_not_contain']),
- files: List<String>.from(json['files']),
- eval: json['eval'],
+ answer: json['answer'] ?? "",
+ shouldContain: List<String>.from(json['should_contain'] ?? []),
+ shouldNotContain: List<String>.from(json['should_not_contain'] ?? []),
+ files: List<String>.from(json['files'] ?? []),
+ eval: json['eval'] ?? {},
);
}
}