feat: refactor sgclaw around zeroclaw compat runtime
This commit is contained in:
30
src/compat/memory_adapter.rs
Normal file
30
src/compat/memory_adapter.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use zeroclaw::config::Config as ZeroClawConfig;
|
||||
use zeroclaw::memory::{self, Memory};
|
||||
|
||||
pub fn configure_embedded_memory(config: &mut ZeroClawConfig) {
|
||||
config.memory.backend = "sqlite".to_string();
|
||||
config.memory.embedding_provider = "none".to_string();
|
||||
config.memory.response_cache_enabled = false;
|
||||
config.memory.snapshot_enabled = false;
|
||||
config.memory.snapshot_on_hygiene = false;
|
||||
|
||||
config.storage.provider.config.provider.clear();
|
||||
config.storage.provider.config.db_url = None;
|
||||
config.storage.provider.config.connect_timeout_secs = None;
|
||||
}
|
||||
|
||||
pub fn build_memory(config: &ZeroClawConfig) -> anyhow::Result<Box<dyn Memory>> {
|
||||
memory::create_memory_with_storage_and_routes(
|
||||
&config.memory,
|
||||
&config.embedding_routes,
|
||||
Some(&config.storage.provider.config),
|
||||
&config.workspace_dir,
|
||||
config.api_key.as_deref(),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn brain_db_path(workspace_dir: &Path) -> PathBuf {
|
||||
workspace_dir.join("memory").join("brain.db")
|
||||
}
|
||||
Reference in New Issue
Block a user