|
1 | | -use base64::engine::{Engine, general_purpose::STANDARD as BASE64_STANDARD}; |
2 | 1 | use serde::{Deserialize, Serialize}; |
3 | 2 |
|
4 | 3 | use super::{ |
5 | | - AnnotateAble, Annotations, Icon, Meta, RawEmbeddedResource, RawImageContent, |
| 4 | + AnnotateAble, Annotations, Icon, Meta, RawEmbeddedResource, |
6 | 5 | content::{EmbeddedResource, ImageContent}, |
7 | 6 | resource::ResourceContents, |
8 | 7 | }; |
@@ -138,11 +137,13 @@ impl PromptMessage { |
138 | 137 | meta: Option<crate::model::Meta>, |
139 | 138 | annotations: Option<Annotations>, |
140 | 139 | ) -> Self { |
| 140 | + use base64::{Engine, prelude::BASE64_STANDARD}; |
| 141 | + |
141 | 142 | let base64 = BASE64_STANDARD.encode(data); |
142 | 143 | Self { |
143 | 144 | role, |
144 | 145 | content: PromptMessageContent::Image { |
145 | | - image: RawImageContent { |
| 146 | + image: crate::model::RawImageContent { |
146 | 147 | data: base64, |
147 | 148 | mime_type: mime_type.into(), |
148 | 149 | meta, |
@@ -215,7 +216,7 @@ mod tests { |
215 | 216 |
|
216 | 217 | #[test] |
217 | 218 | fn test_prompt_message_image_serialization() { |
218 | | - let image_content = RawImageContent { |
| 219 | + let image_content = crate::model::RawImageContent { |
219 | 220 | data: "base64data".to_string(), |
220 | 221 | mime_type: "image/png".to_string(), |
221 | 222 | meta: None, |
|
0 commit comments