Implement Artifact Class for Enhanced Data Handling (#5585)

This commit is contained in:
hunteraraujo
2023-10-06 14:55:47 -07:00
committed by GitHub
parent a615eda205
commit 0f2126e6f0
4 changed files with 77 additions and 16 deletions

View File

@@ -90,18 +90,10 @@ class _ChatViewState extends State<ChatView> {
key: ValueKey(chat.id),
chat: chat,
onArtifactsButtonPressed: () {
// TODO: Create an actual artifact object
// Loop through each artifact and download it using the artifact_id
for (var artifact in chat.artifacts) {
if (artifact is Map) {
final artifactMap = artifact.cast<String,
dynamic>(); // Cast each item to Map<String, dynamic>
final artifactId = artifactMap['artifact_id']
.toString(); // Get the artifact_id
widget.viewModel.downloadArtifact(
chat.taskId, artifactId); // Download the artifact
}
widget.viewModel
.downloadArtifact(chat.taskId, artifact.artifactId);
}
},
);