Skip to main content

otherone_context/
types.rs

1// 作用:定义 combine_context 模块的类型
2// 关联:被 lib.rs 使用
3// 预期结果:提供清晰的类型定义
4
5use otherone_storage::types::DatabaseConfig;
6
7/// Context 加载类型
8#[derive(Debug, Clone, PartialEq, Eq)]
9pub enum ContextLoadType {
10    Database,
11    LocalFile,
12}
13
14/// CombineContext 参数类型
15#[derive(Debug, Clone)]
16pub struct CombineContextOptions {
17    /// 会话 ID
18    pub session_id: String,
19    /// Context 加载类型
20    pub load_type: ContextLoadType,
21    /// AI 提供商类型
22    pub provider: otherone_ai::types::ProviderType,
23    /// 模型的上下文窗口大小
24    pub context_window: u32,
25    /// 触发压缩的阈值百分比(默认 0.8,即 80%)
26    pub threshold_percentage: Option<f32>,
27    /// AI 配置参数(用于压缩 LLM 调用)
28    pub ai: Option<serde_json::Value>,
29    /// 系统提示词
30    pub system_prompt: Option<String>,
31    /// 工具定义数组
32    pub tools: Option<Vec<otherone_ai::types::Tool>>,
33    /// 数据库存储配置(当 load_type 为 database 时必填)
34    pub database_config: Option<DatabaseConfig>,
35}