generated from nhcarrigan/template
fix(ci): resolve clippy too_many_arguments lint errors
This commit is contained in:
+19
-6
@@ -115,18 +115,31 @@ fn build_user_gemini_parts(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct GeminiCallParams {
|
||||||
|
pub mode: String,
|
||||||
|
pub aspect_ratio: Option<String>,
|
||||||
|
pub image_size: String,
|
||||||
|
pub user_text: Option<String>,
|
||||||
|
pub user_image_base64: Option<String>,
|
||||||
|
pub user_image_mime: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn call_gemini(
|
pub async fn call_gemini(
|
||||||
api_key: String,
|
api_key: String,
|
||||||
mode: String,
|
|
||||||
aspect_ratio: Option<String>,
|
|
||||||
image_size: String,
|
|
||||||
history: Vec<ThreadMessage>,
|
history: Vec<ThreadMessage>,
|
||||||
user_text: Option<String>,
|
params: GeminiCallParams,
|
||||||
user_image_base64: Option<String>,
|
|
||||||
user_image_mime: Option<String>,
|
|
||||||
) -> Result<(Vec<MessagePart>, f64), String> {
|
) -> Result<(Vec<MessagePart>, f64), String> {
|
||||||
let client = reqwest::Client::new();
|
let client = reqwest::Client::new();
|
||||||
|
|
||||||
|
let GeminiCallParams {
|
||||||
|
mode,
|
||||||
|
aspect_ratio,
|
||||||
|
image_size,
|
||||||
|
user_text,
|
||||||
|
user_image_base64,
|
||||||
|
user_image_mime,
|
||||||
|
} = params;
|
||||||
|
|
||||||
let is_first_message = history.is_empty();
|
let is_first_message = history.is_empty();
|
||||||
|
|
||||||
let mut contents: Vec<Value> = history
|
let mut contents: Vec<Value> = history
|
||||||
|
|||||||
+10
-7
@@ -1,7 +1,7 @@
|
|||||||
mod gemini;
|
mod gemini;
|
||||||
mod storage;
|
mod storage;
|
||||||
|
|
||||||
use gemini::{call_gemini, read_reference_image_base64};
|
use gemini::{call_gemini, read_reference_image_base64, GeminiCallParams};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use storage::{
|
use storage::{
|
||||||
delete_thread_from_disk, load_config_from_disk, load_threads_from_disk, save_config_to_disk,
|
delete_thread_from_disk, load_config_from_disk, load_threads_from_disk, save_config_to_disk,
|
||||||
@@ -46,6 +46,7 @@ async fn save_config(config: Config) -> Result<(), String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
async fn send_message(
|
async fn send_message(
|
||||||
api_key: String,
|
api_key: String,
|
||||||
mode: String,
|
mode: String,
|
||||||
@@ -58,13 +59,15 @@ async fn send_message(
|
|||||||
) -> Result<SendMessageResult, String> {
|
) -> Result<SendMessageResult, String> {
|
||||||
let (parts, cost_usd) = call_gemini(
|
let (parts, cost_usd) = call_gemini(
|
||||||
api_key,
|
api_key,
|
||||||
mode,
|
|
||||||
aspect_ratio,
|
|
||||||
image_size,
|
|
||||||
history,
|
history,
|
||||||
user_text,
|
GeminiCallParams {
|
||||||
user_image_base64,
|
mode,
|
||||||
user_image_mime,
|
aspect_ratio,
|
||||||
|
image_size,
|
||||||
|
user_text,
|
||||||
|
user_image_base64,
|
||||||
|
user_image_mime,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
Ok(SendMessageResult { parts, cost_usd })
|
Ok(SendMessageResult { parts, cost_usd })
|
||||||
|
|||||||
Reference in New Issue
Block a user