feat: add internal ZCLAW kernel crates to git tracking

This commit is contained in:
iven
2026-03-22 09:26:36 +08:00
parent d72c0f7161
commit 58cd24f85b
36 changed files with 10298 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
//! Local LLM driver (Ollama, LM Studio, vLLM, etc.)
use async_trait::async_trait;
use reqwest::Client;
use zclaw_types::Result;
use super::{CompletionRequest, CompletionResponse, ContentBlock, LlmDriver, StopReason};
/// Local LLM driver for Ollama, LM Studio, vLLM, etc.
pub struct LocalDriver {
client: Client,
base_url: String,
}
impl LocalDriver {
pub fn new(base_url: impl Into<String>) -> Self {
Self {
client: Client::new(),
base_url: base_url.into(),
}
}
pub fn ollama() -> Self {
Self::new("http://localhost:11434/v1")
}
pub fn lm_studio() -> Self {
Self::new("http://localhost:1234/v1")
}
pub fn vllm() -> Self {
Self::new("http://localhost:8000/v1")
}
}
#[async_trait]
impl LlmDriver for LocalDriver {
fn provider(&self) -> &str {
"local"
}
fn is_configured(&self) -> bool {
// Local drivers don't require API keys
true
}
async fn complete(&self, request: CompletionRequest) -> Result<CompletionResponse> {
// TODO: Implement actual API call (OpenAI-compatible)
Ok(CompletionResponse {
content: vec![ContentBlock::Text {
text: "Local driver not yet implemented".to_string(),
}],
model: request.model,
input_tokens: 0,
output_tokens: 0,
stop_reason: StopReason::EndTurn,
})
}
}