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 {
|
impl From<ImageSource> for async_openai::types::ImageInput {
|
||||||
fn into(self) -> async_openai::types::ImageInput {
|
fn from(value: ImageSource) -> Self {
|
||||||
async_openai::types::ImageInput::from_vec_u8(
|
async_openai::types::ImageInput::from_vec_u8(
|
||||||
self.filename,
|
value.filename,
|
||||||
self.bytes,
|
value.bytes,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ pub fn determine_controller(
|
|||||||
) -> ControllerType {
|
) -> ControllerType {
|
||||||
let text = text.trim();
|
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());
|
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());
|
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| {
|
let image_sources: Vec<ImageSource> = conversation.messages.iter().filter_map(|message| {
|
||||||
if let crate::conversation::llm::MessageContent::Image(image_content) = &message.content {
|
if let crate::conversation::llm::MessageContent::Image(image_content) = &message.content {
|
||||||
Some(image_content.into())
|
Some(image_content.clone().into())
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ impl ImageDetails {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Into<ImageSource> for &ImageDetails {
|
impl From<ImageDetails> for ImageSource {
|
||||||
fn into(self) -> ImageSource {
|
fn from(value: ImageDetails) -> Self {
|
||||||
ImageSource::new(self.filename(), self.data.clone(), self.mime.clone())
|
ImageSource::new(value.filename(), value.data.clone(), value.mime.clone())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user