chore: 提交所有工作进度 — SaaS 后端增强、Admin UI、桌面端集成

包含大量 SaaS 平台改进、Admin 管理后台更新、桌面端集成完善、
文档同步、测试文件重构等内容。为 QA 测试准备干净工作树。
This commit is contained in:
iven
2026-03-29 10:46:26 +08:00
parent 9a5fad2b59
commit 5fdf96c3f5
268 changed files with 22011 additions and 3886 deletions

View File

@@ -54,6 +54,11 @@ pub struct LlmConfig {
/// Temperature
#[serde(default = "default_temperature")]
pub temperature: f32,
/// Context window size in tokens (default: 128000)
/// Used to calculate dynamic compaction threshold.
#[serde(default = "default_context_window")]
pub context_window: u32,
}
impl LlmConfig {
@@ -66,6 +71,7 @@ impl LlmConfig {
api_protocol: ApiProtocol::OpenAI,
max_tokens: default_max_tokens(),
temperature: default_temperature(),
context_window: default_context_window(),
}
}
@@ -140,6 +146,10 @@ fn default_temperature() -> f32 {
0.7
}
fn default_context_window() -> u32 {
128000
}
impl Default for KernelConfig {
fn default() -> Self {
Self {
@@ -151,6 +161,7 @@ impl Default for KernelConfig {
api_protocol: ApiProtocol::OpenAI,
max_tokens: default_max_tokens(),
temperature: default_temperature(),
context_window: default_context_window(),
},
skills_dir: default_skills_dir(),
}
@@ -345,6 +356,17 @@ impl KernelConfig {
pub fn temperature(&self) -> f32 {
self.llm.temperature
}
/// Get context window size in tokens
pub fn context_window(&self) -> u32 {
self.llm.context_window
}
/// Dynamic compaction threshold = context_window * 0.6
/// Leaves 40% headroom for system prompt + response tokens
pub fn compaction_threshold(&self) -> usize {
(self.llm.context_window as f64 * 0.6) as usize
}
}
// === Preset configurations for common providers ===