feat: add populate_knowledge batch binary with configurable timeout

Adds a standalone binary that walks a directory and runs the agentic
insight loop over every image/video, skipping files already processed.
Supports --path, --model, --max-iterations, --timeout-secs, --num-ctx,
and --reprocess flags for flexible overnight/VPS batch runs.

Also adds OllamaClient::with_request_timeout() builder method so slow
large models are not cut off by the default 120s limit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Cameron
2026-04-07 16:39:46 -04:00
parent da039bbc49
commit bc3b313e2e
2 changed files with 239 additions and 0 deletions

View File

@@ -73,6 +73,17 @@ impl OllamaClient {
self.num_ctx = num_ctx;
}
/// Replace the HTTP client with one using a custom request timeout.
/// Useful for slow models where the default 120s may be insufficient.
pub fn with_request_timeout(mut self, secs: u64) -> Self {
self.client = Client::builder()
.connect_timeout(Duration::from_secs(5))
.timeout(Duration::from_secs(secs))
.build()
.unwrap_or_else(|_| Client::new());
self
}
/// List available models on an Ollama server (cached for 15 minutes)
pub async fn list_models(url: &str) -> Result<Vec<String>> {
// Check cache first