Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions crates/zeph-core/src/agent/context.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::fmt::Write;

use zeph_llm::provider::MessagePart;
use zeph_memory::semantic::estimate_tokens;
use zeph_skills::prompt::format_skills_catalog;
Expand Down Expand Up @@ -49,18 +51,22 @@ impl<P: LlmProvider + Clone + 'static, C: Channel, T: ToolExecutor> Agent<P, C,
return Ok(());
}

let history_text: String = to_compact
let estimated_len: usize = to_compact
.iter()
.map(|m| {
let role = match m.role {
Role::User => "user",
Role::Assistant => "assistant",
Role::System => "system",
};
format!("[{role}]: {}", m.content)
})
.collect::<Vec<_>>()
.join("\n\n");
.map(|m| "[assistant]: ".len() + m.content.len() + 2)
.sum();
let mut history_text = String::with_capacity(estimated_len);
for (i, m) in to_compact.iter().enumerate() {
if i > 0 {
history_text.push_str("\n\n");
}
let role = match m.role {
Role::User => "user",
Role::Assistant => "assistant",
Role::System => "system",
};
let _ = write!(history_text, "[{role}]: {}", m.content);
}

let compaction_prompt = format!(
"Summarize this conversation excerpt into a structured continuation note. \
Expand Down
2 changes: 1 addition & 1 deletion crates/zeph-memory/tests/qdrant_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use zeph_memory::sqlite::SqliteStore;
const QDRANT_GRPC_PORT: ContainerPort = ContainerPort::Tcp(6334);

fn qdrant_image() -> GenericImage {
GenericImage::new("qdrant/qdrant", "v1.13.6")
GenericImage::new("qdrant/qdrant", "v1.16.0")
.with_wait_for(WaitFor::message_on_stdout("gRPC listening"))
.with_exposed_port(QDRANT_GRPC_PORT)
}
Expand Down
Loading