44 lines
978 B
Rust
44 lines
978 B
Rust
//! Context compaction for AI sessions and room message history.
|
|
|
|
pub mod auth_fetch;
|
|
pub mod helpers;
|
|
pub mod room_compactor;
|
|
pub mod summarizer;
|
|
pub mod types;
|
|
|
|
use sea_orm::DatabaseConnection;
|
|
|
|
pub use types::{
|
|
CompactConfig, CompactLevel, CompactSummary, MessageSummary, RoomCompactContext,
|
|
RoomCompactRecord, ThresholdResult,
|
|
};
|
|
|
|
#[derive(Clone)]
|
|
pub struct CompactService {
|
|
db: DatabaseConnection,
|
|
ai_client_config: crate::client::AiClientConfig,
|
|
model: String,
|
|
}
|
|
|
|
impl CompactService {
|
|
pub fn new(
|
|
db: DatabaseConnection,
|
|
ai_client_config: crate::client::AiClientConfig,
|
|
model: String,
|
|
) -> Self {
|
|
Self {
|
|
db,
|
|
ai_client_config,
|
|
model,
|
|
}
|
|
}
|
|
|
|
pub fn for_model(&self, model: impl Into<String>) -> Self {
|
|
Self {
|
|
db: self.db.clone(),
|
|
ai_client_config: self.ai_client_config.clone(),
|
|
model: model.into(),
|
|
}
|
|
}
|
|
}
|