Make some improvements as suggested by clippy
This commit is contained in:
@@ -53,11 +53,11 @@ impl ImageSource {
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<async_openai::types::ImageInput> for ImageSource {
|
||||
fn into(self) -> async_openai::types::ImageInput {
|
||||
impl From<ImageSource> for async_openai::types::ImageInput {
|
||||
fn from(value: ImageSource) -> Self {
|
||||
async_openai::types::ImageInput::from_vec_u8(
|
||||
self.filename,
|
||||
self.bytes,
|
||||
value.filename,
|
||||
value.bytes,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@ pub fn determine_controller(
|
||||
) -> ControllerType {
|
||||
let text = text.trim();
|
||||
|
||||
if let Some(prompt) = text.strip_prefix(&format!("create")) {
|
||||
if let Some(prompt) = text.strip_prefix("create") {
|
||||
return ControllerType::ImageGeneration(prompt.trim().to_owned());
|
||||
}
|
||||
|
||||
if let Some(prompt) = text.strip_prefix(&format!("edit")) {
|
||||
if let Some(prompt) = text.strip_prefix("edit") {
|
||||
return ControllerType::ImageEdit(prompt.trim().to_owned());
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ pub async fn handle(
|
||||
|
||||
let image_sources: Vec<ImageSource> = conversation.messages.iter().filter_map(|message| {
|
||||
if let crate::conversation::llm::MessageContent::Image(image_content) = &message.content {
|
||||
Some(image_content.into())
|
||||
Some(image_content.clone().into())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
||||
@@ -35,9 +35,9 @@ impl ImageDetails {
|
||||
}
|
||||
}
|
||||
|
||||
impl Into<ImageSource> for &ImageDetails {
|
||||
fn into(self) -> ImageSource {
|
||||
ImageSource::new(self.filename(), self.data.clone(), self.mime.clone())
|
||||
impl From<ImageDetails> for ImageSource {
|
||||
fn from(value: ImageDetails) -> Self {
|
||||
ImageSource::new(value.filename(), value.data.clone(), value.mime.clone())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user