use crate::commands::enrich::extraction::EnrichItemResult;
#[derive(Debug)]
pub(super) enum ReembedTarget {
Memory {
memory_id: i64,
name: String,
memory_type: String,
snippet: String,
},
Entity {
entity_id: i64,
name: String,
entity_type: String,
},
Chunk {
chunk_id: i64,
memory_id: i64,
chunk_idx: i32,
},
}
#[derive(Debug)]
pub(super) struct PendingEmbed {
pub(super) slot: usize,
pub(super) target: ReembedTarget,
pub(super) text: String,
}
pub(super) fn done_result(target: &ReembedTarget, chars: usize) -> EnrichItemResult {
match target {
ReembedTarget::Memory { memory_id, .. } => EnrichItemResult::Done {
memory_id: Some(*memory_id),
entity_id: None,
entities: 0,
rels: 0,
chars_before: Some(chars),
chars_after: Some(chars),
cost: 0.0,
is_oauth: true,
},
ReembedTarget::Entity { entity_id, .. } => EnrichItemResult::Done {
memory_id: None,
entity_id: Some(*entity_id),
entities: 1,
rels: 0,
chars_before: Some(chars),
chars_after: Some(chars),
cost: 0.0,
is_oauth: true,
},
ReembedTarget::Chunk { memory_id, .. } => EnrichItemResult::Done {
memory_id: Some(*memory_id),
entity_id: None,
entities: 0,
rels: 0,
chars_before: Some(chars),
chars_after: Some(chars),
cost: 0.0,
is_oauth: true,
},
}
}