mod client;
mod parser;
mod pull;
mod url;
use agcodex_core::config::Config;
pub use client::OllamaClient;
pub use pull::CliProgressReporter;
pub use pull::PullEvent;
pub use pull::PullProgressReporter;
pub use pull::TuiProgressReporter;
pub const DEFAULT_OSS_MODEL: &str = "gpt-oss:20b";
pub async fn ensure_oss_ready(config: &Config) -> std::io::Result<()> {
let model = config.model.as_ref();
let ollama_client = crate::OllamaClient::try_from_oss_provider(config).await?;
match ollama_client.fetch_models().await {
Ok(models) => {
if !models.iter().any(|m| m == model) {
let mut reporter = crate::CliProgressReporter::new();
ollama_client
.pull_with_reporter(model, &mut reporter)
.await?;
}
}
Err(err) => {
tracing::warn!("Failed to query local models from Ollama: {}.", err);
}
}
Ok(())
}