mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-15 14:33:33 +08:00
feat: add ecc2 markdown directory memory connector
This commit is contained in:
@@ -109,6 +109,7 @@ pub enum MemoryConnectorConfig {
|
||||
JsonlFile(MemoryConnectorJsonlFileConfig),
|
||||
JsonlDirectory(MemoryConnectorJsonlDirectoryConfig),
|
||||
MarkdownFile(MemoryConnectorMarkdownFileConfig),
|
||||
MarkdownDirectory(MemoryConnectorMarkdownDirectoryConfig),
|
||||
DotenvFile(MemoryConnectorDotenvFileConfig),
|
||||
}
|
||||
|
||||
@@ -140,6 +141,16 @@ pub struct MemoryConnectorMarkdownFileConfig {
|
||||
pub default_observation_type: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct MemoryConnectorMarkdownDirectoryConfig {
|
||||
pub path: PathBuf,
|
||||
pub recurse: bool,
|
||||
pub session_id: Option<String>,
|
||||
pub default_entity_type: Option<String>,
|
||||
pub default_observation_type: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct MemoryConnectorDotenvFileConfig {
|
||||
@@ -1382,6 +1393,43 @@ default_observation_type = "external_note"
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn memory_markdown_directory_connectors_deserialize_from_toml() {
|
||||
let config: Config = toml::from_str(
|
||||
r#"
|
||||
[memory_connectors.workspace_notes]
|
||||
kind = "markdown_directory"
|
||||
path = "/tmp/hermes-memory"
|
||||
recurse = true
|
||||
session_id = "latest"
|
||||
default_entity_type = "note_section"
|
||||
default_observation_type = "external_note"
|
||||
"#,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let connector = config
|
||||
.memory_connectors
|
||||
.get("workspace_notes")
|
||||
.expect("connector should deserialize");
|
||||
match connector {
|
||||
crate::config::MemoryConnectorConfig::MarkdownDirectory(settings) => {
|
||||
assert_eq!(settings.path, PathBuf::from("/tmp/hermes-memory"));
|
||||
assert!(settings.recurse);
|
||||
assert_eq!(settings.session_id.as_deref(), Some("latest"));
|
||||
assert_eq!(
|
||||
settings.default_entity_type.as_deref(),
|
||||
Some("note_section")
|
||||
);
|
||||
assert_eq!(
|
||||
settings.default_observation_type.as_deref(),
|
||||
Some("external_note")
|
||||
);
|
||||
}
|
||||
_ => panic!("expected markdown_directory connector"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn memory_dotenv_file_connectors_deserialize_from_toml() {
|
||||
let config: Config = toml::from_str(
|
||||
|
||||
Reference in New Issue
Block a user