Skip to content

Commit

Permalink
Merge pull request #171 from MiaVDMGames/main
Browse files Browse the repository at this point in the history
[ Edit ] Changed JSON Syntax for imageUrls to have a object instead of a String.
  • Loading branch information
anasfik authored May 8, 2024
2 parents 4b281d6 + 85f8046 commit f4d3ca7
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,24 @@ class OpenAIChatCompletionChoiceMessageContentItemModel {
final String? text;

/// The image url content of the item.
final String? imageUrl;
final String? url;

/// The image url object.
final Map<String, dynamic>? imageUrl;

final String? imageBase64;

@override
int get hashCode => type.hashCode ^ text.hashCode ^ imageUrl.hashCode;
int get hashCode => type.hashCode ^ text.hashCode ^ imageUrl.hashCode ^ url.hashCode;

/// {@macro openai_chat_completion_choice_message_content_item_model}
OpenAIChatCompletionChoiceMessageContentItemModel._({
required this.type,
this.text,
this.imageUrl,
this.url
this.imageBase64,

});

/// This is used to convert a [Map<String, dynamic>] object to a [OpenAIChatCompletionChoiceMessageContentItemModel] object.
Expand All @@ -33,7 +38,9 @@ class OpenAIChatCompletionChoiceMessageContentItemModel {
type: asMap['type'],
text: asMap['text'],
imageUrl: asMap['image_url'],
url: asMap['url']
imageBase64: asMap['imageBase64'],

);
}

Expand All @@ -51,7 +58,7 @@ class OpenAIChatCompletionChoiceMessageContentItemModel {
) {
return OpenAIChatCompletionChoiceMessageContentItemModel._(
type: 'image_url',
imageUrl: imageUrl,
imageUrl: {'url': imageUrl},
);
}

Expand Down

0 comments on commit f4d3ca7

Please sign in to comment.