mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-18 14:34:23 +01:00
Extend Task Model to Include Serialization
This commit adds serialization support to the Task model by including a `toJson` method. This will allow easy conversion of Task objects to a JSON-compatible format, facilitating storage or network transmission.
This commit is contained in:
@@ -45,13 +45,19 @@ class Task {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'task_id': id,
|
||||||
|
'input': title,
|
||||||
|
'additional_input': additionalInput,
|
||||||
|
'artifacts': artifacts,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) =>
|
bool operator ==(Object other) =>
|
||||||
identical(this, other) ||
|
identical(this, other) ||
|
||||||
other is Task &&
|
other is Task && runtimeType == other.runtimeType && id == other.id;
|
||||||
runtimeType == other.runtimeType &&
|
|
||||||
id == other.id &&
|
|
||||||
title == other.title;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => id.hashCode ^ title.hashCode;
|
int get hashCode => id.hashCode ^ title.hashCode;
|
||||||
|
|||||||
Reference in New Issue
Block a user