feat: OpenAI-kompatibler Modell-Client für strata
Backend in config.toml wählbar (ollama oder openai), Standard-URL für strata im LAN (192.168.12.4:8082). Nachrichten werden ins OpenAI-Format umgeschrieben, Tool-Antworten bekommen die passende tool_call_id. Test für die Umwandlung grün (42 Unit-Tests). Verbindung zu strata noch nicht möglich: alle drei Adressen lehnen ab. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
@ -21,8 +21,12 @@ pub struct Config {
|
||||
pub tasks_dir: Option<PathBuf>,
|
||||
/// Container-Programm für die Sandbox (Podman-CLI).
|
||||
pub container_runtime: String,
|
||||
/// Modell-Backend: `ollama` oder `openai` (OpenAI-kompatibel, z. B. strata).
|
||||
pub backend: String,
|
||||
/// Ollama-Endpunkt für alle Modelle (Phase 1).
|
||||
pub ollama_url: String,
|
||||
/// OpenAI-kompatibler Endpunkt, vollständige URL inkl. `/v1/chat/completions`.
|
||||
pub openai_url: String,
|
||||
/// Speicherlimit pro Lauf, Podman-Schreibweise.
|
||||
pub sandbox_memory: String,
|
||||
/// CPU-Anteil pro Lauf.
|
||||
@ -36,7 +40,9 @@ impl Default for Config {
|
||||
data_dir: None,
|
||||
tasks_dir: None,
|
||||
container_runtime: "podman".into(),
|
||||
backend: "ollama".into(),
|
||||
ollama_url: "http://127.0.0.1:11434".into(),
|
||||
openai_url: "http://192.168.12.4:8082/v1/chat/completions".into(),
|
||||
sandbox_memory: limits.memory,
|
||||
sandbox_cpus: limits.cpus,
|
||||
}
|
||||
@ -57,6 +63,15 @@ impl Config {
|
||||
toml::from_str(text).map_err(|e| format!("config.toml ist ungültig: {e}"))
|
||||
}
|
||||
|
||||
/// Endpunkt des gewählten Backends.
|
||||
pub fn endpoint_url(&self) -> String {
|
||||
if self.backend == "openai" {
|
||||
self.openai_url.clone()
|
||||
} else {
|
||||
self.ollama_url.clone()
|
||||
}
|
||||
}
|
||||
|
||||
/// Ressourcenlimits der Sandbox aus der Konfiguration.
|
||||
pub fn sandbox_limits(&self) -> Limits {
|
||||
Limits {
|
||||
|
||||
Reference in New Issue
Block a user