37 lines
1.5 KiB
Rust
37 lines
1.5 KiB
Rust
use crate::{DateTimeUtc, ProjectId};
|
|
use sea_orm::entity::prelude::*;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
/// Project-level context management settings.
|
|
/// Controls compaction (sliding window) and RAG behavior.
|
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, DeriveEntityModel)]
|
|
#[sea_orm(table_name = "project_context_setting")]
|
|
pub struct Model {
|
|
#[sea_orm(primary_key)]
|
|
pub project_id: ProjectId,
|
|
/// Context window size in tokens (e.g. 128000 for Claude).
|
|
/// When actual usage reaches this * compaction_threshold, trigger compaction.
|
|
pub context_window_tokens: i32,
|
|
/// Trigger compaction when usage exceeds this fraction of context_window_tokens.
|
|
/// Default 0.8 (80%). Valid range: 0.5 - 0.9.
|
|
pub compaction_threshold: f32,
|
|
/// Compressed summary must not exceed this fraction of context_window_tokens.
|
|
/// Default 0.2 (20%). Valid range: 0.05 - 0.3.
|
|
pub compaction_max_summary_ratio: f32,
|
|
/// Enable RAG for room conversations.
|
|
pub rag_enabled: bool,
|
|
/// RAG cross-session: room messages searchable across conversations.
|
|
pub rag_cross_session: bool,
|
|
/// Maximum RAG results to include in context.
|
|
pub rag_max_results: i32,
|
|
/// Minimum relevance score for RAG results (0.0 - 1.0).
|
|
pub rag_min_score: f32,
|
|
pub created_at: DateTimeUtc,
|
|
pub updated_at: DateTimeUtc,
|
|
}
|
|
|
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
pub enum Relation {}
|
|
|
|
impl ActiveModelBehavior for ActiveModel {}
|