feat: 知识库文件夹/模板、技能压缩设置与摘要窗口调优
- 知识库新增文件夹与模板支持(模型/仓储/服务/迁移),前端知识管理组件 - 岗位管理模型与接口完善 - 技能新增压缩设置页与相关存储/工具能力 - 系统设置扩展配置项 - 摘要中间件 keep 窗口改用 token 预算(16000),减少重复压缩 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
e6662cf673
commit
5ebbb82d66
54 files changed
+2658
-100
No files matched your search
@@ -170,6 +170,26 @@ class LeaderboardSettings(BaseModel):
|
||||
model_config = ConfigDict(extra="ignore")
|
||||
|
||||
|
||||
class SkillCompressionSettings(BaseModel):
|
||||
"""Admin-configurable skill compression (技能压缩).
|
||||
|
||||
When ``enabled``, only skills explicitly marked 常驻(免压缩) (``always_on``)
|
||||
are injected full-text into the lead agent's system prompt. Every other
|
||||
enabled skill is "compressed": kept out of the prompt body and surfaced to
|
||||
the agent on demand via the ``search_skills`` keyword-retrieval tool (and a
|
||||
compact name index when ``keep_index_in_prompt`` is true). When disabled the
|
||||
behaviour is unchanged — every enabled skill is injected full-text.
|
||||
"""
|
||||
|
||||
enabled: bool = Field(default=False, description="Whether skill compression is active (master switch)")
|
||||
search_top_n: int = Field(default=5, ge=1, le=50, description="Max skills returned by the search_skills tool")
|
||||
keep_index_in_prompt: bool = Field(
|
||||
default=True,
|
||||
description="Whether compressed skills still appear as a compact name-only index in the prompt",
|
||||
)
|
||||
model_config = ConfigDict(extra="ignore")
|
||||
|
||||
|
||||
class SystemSettings(BaseModel):
|
||||
"""Top-level system settings document."""
|
||||
|
||||
@@ -179,6 +199,7 @@ class SystemSettings(BaseModel):
|
||||
appearance: AppearanceSettings = Field(default_factory=AppearanceSettings)
|
||||
citation_display: CitationDisplaySettings = Field(default_factory=CitationDisplaySettings)
|
||||
leaderboard: LeaderboardSettings = Field(default_factory=LeaderboardSettings)
|
||||
skill_compression: SkillCompressionSettings = Field(default_factory=SkillCompressionSettings)
|
||||
model_config = ConfigDict(extra="ignore")
|
||||
|
||||
|
||||
@@ -204,6 +225,15 @@ def load_system_settings() -> SystemSettings:
|
||||
return SystemSettings()
|
||||
|
||||
|
||||
def get_skill_compression_settings() -> SkillCompressionSettings:
|
||||
"""Convenience accessor for the skill-compression block (safe defaults on error)."""
|
||||
try:
|
||||
return load_system_settings().skill_compression
|
||||
except Exception:
|
||||
logger.debug("Failed to read skill compression settings; using defaults", exc_info=True)
|
||||
return SkillCompressionSettings()
|
||||
|
||||
|
||||
def save_system_settings(settings: SystemSettings) -> SystemSettings:
|
||||
"""Persist the settings document atomically, returning the saved value."""
|
||||
path = _settings_path()
|
||||
|
||||
Reference in new issue
Block a user