feat: 完善策略优选项目工作流

This commit is contained in:
Administrator committed 2026-09-09 20:49:59 +08:00
1 parent a26fd32eba
commit 5d6627af50
45 files changed
+7235 -768

No files matched your search

@@ -211,6 +211,7 @@ class AppConfig(BaseModel):
cls._check_config_version(config_data, resolved_path)
config_data = cls.resolve_env_variables(config_data)
cls._resolve_relative_mount_paths(config_data, resolved_path.parent)
cls._apply_database_defaults(config_data)
# Load title config if present
@@ -272,6 +273,36 @@ class AppConfig(BaseModel):
result = cls.model_validate(config_data)
return result
@classmethod
def _resolve_relative_mount_paths(
cls,
config_data: dict[str, Any],
config_dir: Path,
) -> None:
"""Resolve portable sandbox mount paths beside ``config.yaml``.
Deployment copies frequently live at different absolute paths. A
relative ``sandbox.mounts[*].host_path`` therefore means "relative to
the config file", never relative to the process working directory.
Providers continue to receive absolute paths, which keeps both the
local path mapper and Docker bind mounts deterministic.
"""
sandbox = config_data.get("sandbox")
if not isinstance(sandbox, dict):
return
mounts = sandbox.get("mounts")
if not isinstance(mounts, list):
return
for mount in mounts:
if not isinstance(mount, dict):
continue
raw_host_path = mount.get("host_path")
if not isinstance(raw_host_path, str) or not raw_host_path.strip():
continue
host_path = Path(raw_host_path)
if not host_path.is_absolute():
mount["host_path"] = str((config_dir / host_path).resolve())
@classmethod
def _apply_database_defaults(cls, config_data: dict[str, Any]) -> None:
"""Apply config.yaml defaults for persistence when the section is absent."""
@@ -516,6 +516,16 @@ class LocalWikiEncoderSettings(BaseModel):
model_config = ConfigDict(extra="ignore")
class StrategyProjectSettings(BaseModel):
"""Global visibility controls for the strategy-project experience."""
taiwan_strait_demo_enabled: bool = Field(
default=False,
description="Whether Taiwan Strait demo entry points are visible in My Projects.",
)
model_config = ConfigDict(extra="ignore")
class SystemSettings(BaseModel):
"""Top-level system settings document."""
@@ -532,6 +542,7 @@ class SystemSettings(BaseModel):
concurrency_monitor: ConcurrencyMonitorSettings = Field(default_factory=ConcurrencyMonitorSettings)
model_concurrency: ModelConcurrencySettings = Field(default_factory=ModelConcurrencySettings)
local_wiki_encoder: LocalWikiEncoderSettings = Field(default_factory=LocalWikiEncoderSettings)
strategy_projects: StrategyProjectSettings = Field(default_factory=StrategyProjectSettings)
llmwiki: LlmWikiRuntimeOverride = Field(default_factory=LlmWikiRuntimeOverride)
skill_knowledge_auto_sync: SkillKnowledgeAutoSyncSettings = Field(default_factory=SkillKnowledgeAutoSyncSettings)
knowledge_base_product_version: Literal["v1", "v2"] = Field(