fix: resolve clippy warnings and missing struct fields in tests

This commit is contained in:
t8y2 committed 2026-06-16 00:55:32 +08:00
1 parent 5f870be0d9
commit c57e18bf3e
17 files changed
+49 -30

No files matched your search

+4 -6
View File
@@ -47,6 +47,7 @@ fn provider_supports_function_calling(config: &AiConfig) -> bool {
///
/// If the provider does not support function calling (e.g., Ollama), automatically
/// degrades to a text-only completion with schema context injected into the system prompt.
#[allow(clippy::too_many_arguments)]
pub async fn run_agent_loop(
config: &AiConfig,
system_prompt: &str,
@@ -300,7 +301,7 @@ async fn stream_with_tools(
return Err("Agent loop cancelled".to_string());
}
ai::stream_with_tools(config, request, session_id, &tools, cancelled, on_chunk).await
ai::stream_with_tools(config, request, session_id, tools, cancelled, on_chunk).await
}
fn is_context_length_error(error: &str) -> bool {
@@ -324,6 +325,7 @@ fn is_context_length_error(error: &str) -> bool {
///
/// Injects database schema context into the system prompt so the LLM can still
/// give informed answers, then performs a single non-streaming completion.
#[allow(clippy::too_many_arguments)]
async fn run_agent_loop_text_only(
config: &AiConfig,
system_prompt: &str,
@@ -453,16 +455,12 @@ fn context_window_for_model(model: &str) -> u32 {
if m.contains("gpt-4.1") {
return 1_000_000;
}
if m.contains("claude") {
200_000
} else if m.contains("o1") || m.starts_with("o3") || m.starts_with("o4") {
if m.contains("claude") || m.contains("o1") || m.starts_with("o3") || m.starts_with("o4") {
200_000
} else if m.contains("gpt-4") {
128_000
} else if m.contains("gemini") {
1_000_000
} else if m.contains("deepseek") || m.contains("qwen") {
128_000
} else {
128_000
}