Conversation
b49f9ed to
b3ab4aa
Compare
|
pls fix |
| write!( | ||
| f, | ||
| "{}", | ||
| match self { |
There was a problem hiding this comment.
why not just do "webp" why the match
25e2469 to
883df64
Compare
| { | ||
| ImageData::try_from_bytes(bytes.into()) | ||
| } else { | ||
| Err(anyhow::anyhow!("No conversion to image")) |
| { | ||
| ImageData::try_from_bytes(bytes.into()) | ||
| } else { | ||
| Err(anyhow::anyhow!("No conversion to image")) |
| FileType::Jpeg => Ok(Self::Jpeg), | ||
| FileType::Png => Ok(Self::Png), | ||
| FileType::Webp => Ok(Self::WebP), | ||
| _ => Err(anyhow::anyhow!("No conversion")), |
| "jpg" => Ok(Self::Jpg), | ||
| "jpeg" => Ok(Self::Jpeg), | ||
| "png" => Ok(Self::Png), | ||
| _ => Err(anyhow::anyhow!("No conversion")), |
gbirman
left a comment
There was a problem hiding this comment.
Seems chill, some small nits
| "{}", | ||
| match self { | ||
| Self::WebP => "webp", | ||
| Self::Jpg => "Jpg", |
There was a problem hiding this comment.
Why are these capitalized but webp isn't?
There was a problem hiding this comment.
all should be lower case good catch
| } | ||
| } | ||
|
|
||
| impl TryFrom<&str> for ImageFormat { |
There was a problem hiding this comment.
Porque no derive EnumString strum macros? It does this for us
| use crate::traits::TextAttachment; | ||
|
|
||
| #[derive(Debug, Clone, Default)] | ||
| pub struct PromptAttachments(Vec<String>); |
There was a problem hiding this comment.
I'm assuming these are attachment ids? Is it worth new typing that as well for clarity? If not maybe a comment to clarify what the strings are
There was a problem hiding this comment.
No these aren't id's these are the full text of the attachments. The PromptAttachments struct can only be constructed from structs implementing TextAttachment which formats some fetched attachment for AI.
| Base64Image::compress_and_reencode(bytes).map(Self::Bytes) | ||
| } | ||
|
|
||
| pub(crate) fn dangerously_try_from_string(s: String) -> Result<Self, anyhow::Error> { |
Add tighter typing to image attachments.
Add newtype pattern for
TextAttachmentsin preparation of supporting properties.