refactor: improve code formatting and structure across multiple files

This commit is contained in:
mai1015 2026-02-16 03:35:03 -05:00 committed by Chummy
parent b341fdb368
commit dc5e14d7d2
6 changed files with 24 additions and 16 deletions

View file

@ -72,7 +72,10 @@ enum NativeContentOut {
input: serde_json::Value,
},
#[serde(rename = "tool_result")]
ToolResult { tool_use_id: String, content: String },
ToolResult {
tool_use_id: String,
content: String,
},
}
#[derive(Debug, Serialize)]

View file

@ -356,9 +356,11 @@ impl Provider for OpenRouterProvider {
model: &str,
temperature: f64,
) -> anyhow::Result<ProviderChatResponse> {
let api_key = self.api_key.as_ref().ok_or_else(|| anyhow::anyhow!(
let api_key = self.api_key.as_ref().ok_or_else(|| {
anyhow::anyhow!(
"OpenRouter API key not set. Run `zeroclaw onboard` or set OPENROUTER_API_KEY env var."
))?;
)
})?;
let tools = Self::convert_tools(request.tools);
let native_request = NativeChatRequest {

View file

@ -108,7 +108,8 @@ pub trait Provider: Send + Sync {
model: &str,
temperature: f64,
) -> anyhow::Result<String> {
self.chat_with_system(None, message, model, temperature).await
self.chat_with_system(None, message, model, temperature)
.await
}
/// One-shot chat with optional system prompt.