sync update from LAN repo (source dhk-1 @ 3e87be55)
This commit is contained in:
1 parent
ab6068a7c1
commit
42f2a26fa8
1482 files changed
+227759
-9584
No files matched your search
+108
-4
@@ -414,6 +414,22 @@ class AgentModuleSettings(BaseModel):
|
||||
model_config = ConfigDict(extra="ignore")
|
||||
|
||||
|
||||
class WxCommonAgentsSettings(BaseModel):
|
||||
"""The gallery category shown in the wx chat route's common-agent panel.
|
||||
|
||||
``None`` keeps the original recommendation logic. ``mine`` and
|
||||
``sentiment`` are built-in category values. Publish-square categories are
|
||||
persisted as ``square:<square_id>`` so they cannot collide with the
|
||||
built-ins.
|
||||
"""
|
||||
|
||||
agent_type: str | None = Field(
|
||||
default=None,
|
||||
description="Selected gallery category; null retains the default recommendation logic",
|
||||
)
|
||||
model_config = ConfigDict(extra="ignore")
|
||||
|
||||
|
||||
class PluginDomainAgentMapping(BaseModel):
|
||||
"""One configured host -> agent mapping for iframe chat auto-selection."""
|
||||
|
||||
@@ -505,14 +521,66 @@ class ModelConcurrencySettings(BaseModel):
|
||||
model_config = ConfigDict(extra="ignore")
|
||||
|
||||
|
||||
class MemoryRuntimeSettings(BaseModel):
|
||||
"""Deployment-wide switch for generic/personal Q&A memory.
|
||||
|
||||
Memory is deliberately opt-in. When this setting is false the lead agent
|
||||
does not mount memory middleware or memory tools, does not inject stored
|
||||
generic memory into prompts, and does not enqueue generic background memory
|
||||
extraction. Project-scoped Q&A memory is an independent subsystem governed
|
||||
by each project's own setting and is intentionally not controlled here.
|
||||
"""
|
||||
|
||||
enabled: bool = Field(
|
||||
default=False,
|
||||
description="Whether generic/personal Q&A memory recall, injection and persistence are enabled.",
|
||||
)
|
||||
model_config = ConfigDict(extra="ignore")
|
||||
|
||||
|
||||
class WriteFileCompatibilitySettings(BaseModel):
|
||||
"""Deployment-wide compatibility for gateways buffering tool arguments."""
|
||||
|
||||
enabled: bool = Field(
|
||||
default=False,
|
||||
description=(
|
||||
"Whether every compatible model uses the buffered-gateway "
|
||||
"write_file streaming adapter."
|
||||
),
|
||||
)
|
||||
model_config = ConfigDict(extra="ignore")
|
||||
|
||||
|
||||
class LocalWikiEncoderSettings(BaseModel):
|
||||
"""Runtime override for the administrator-managed offline Wiki encoder."""
|
||||
|
||||
mode: Literal["configured", "local"] = Field(
|
||||
default="configured",
|
||||
description=(
|
||||
"Use the embedding provider from config.yaml, or explicitly override it "
|
||||
"with the administrator-managed offline BGE-M3 encoder."
|
||||
),
|
||||
)
|
||||
model_path: str = Field(
|
||||
default="",
|
||||
max_length=4096,
|
||||
description="Absolute or project-relative directory containing the offline BGE-M3 ONNX model.",
|
||||
)
|
||||
model_revision: str = Field(
|
||||
default="",
|
||||
max_length=64,
|
||||
description="Opaque revision changed whenever an offline model directory is activated.",
|
||||
)
|
||||
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")
|
||||
|
||||
|
||||
@@ -529,14 +597,23 @@ class SystemSettings(BaseModel):
|
||||
skill_compression: SkillCompressionSettings = Field(default_factory=SkillCompressionSettings)
|
||||
plugin_management: PluginManagementSettings = Field(default_factory=PluginManagementSettings)
|
||||
agent_modules: AgentModuleSettings = Field(default_factory=AgentModuleSettings)
|
||||
wx_common_agents: WxCommonAgentsSettings = Field(default_factory=WxCommonAgentsSettings)
|
||||
concurrency_monitor: ConcurrencyMonitorSettings = Field(default_factory=ConcurrencyMonitorSettings)
|
||||
model_concurrency: ModelConcurrencySettings = Field(default_factory=ModelConcurrencySettings)
|
||||
memory: MemoryRuntimeSettings = Field(default_factory=MemoryRuntimeSettings)
|
||||
write_file_compatibility: WriteFileCompatibilitySettings = Field(
|
||||
default_factory=WriteFileCompatibilitySettings
|
||||
)
|
||||
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(
|
||||
default="v1",
|
||||
description="v1 opens the ordinary WeKnora experience; v2 opens the DeerFlow assistant knowledge base.",
|
||||
description=(
|
||||
"v1 keeps assistant-knowledge day-to-day surfaces admin-only; "
|
||||
"v2 releases them to ordinary users while ordinary knowledge remains the default landing."
|
||||
),
|
||||
)
|
||||
ordinary_knowledge_landing: Literal["wiki", "weknora"] = "wiki"
|
||||
model_config = ConfigDict(extra="ignore")
|
||||
@@ -591,12 +668,39 @@ def get_model_concurrency_settings() -> ModelConcurrencySettings:
|
||||
return ModelConcurrencySettings()
|
||||
|
||||
|
||||
def get_memory_runtime_settings() -> MemoryRuntimeSettings:
|
||||
"""Return the admin-controlled Q&A memory switch, failing closed."""
|
||||
try:
|
||||
return load_system_settings().memory
|
||||
except Exception:
|
||||
logger.debug("Failed to read memory runtime setting; keeping memory disabled", exc_info=True)
|
||||
return MemoryRuntimeSettings()
|
||||
|
||||
|
||||
def get_write_file_compatibility_settings() -> WriteFileCompatibilitySettings:
|
||||
"""Return the global buffered-gateway switch, failing closed."""
|
||||
|
||||
try:
|
||||
return load_system_settings().write_file_compatibility
|
||||
except Exception:
|
||||
logger.debug(
|
||||
"Failed to read write_file compatibility setting; keeping native transport",
|
||||
exc_info=True,
|
||||
)
|
||||
return WriteFileCompatibilitySettings()
|
||||
|
||||
|
||||
def save_system_settings(settings: SystemSettings) -> SystemSettings:
|
||||
"""Persist the settings document atomically, returning the saved value."""
|
||||
path = _settings_path()
|
||||
payload = settings.model_dump(mode="json")
|
||||
with _lock:
|
||||
tmp = path.with_suffix(path.suffix + ".tmp")
|
||||
tmp.write_text(json.dumps(payload, ensure_ascii=False, indent=2), encoding="utf-8")
|
||||
tmp.replace(path)
|
||||
# Multiple Gateway workers share this file. A unique temporary name
|
||||
# prevents their atomic replaces from racing over one common `.tmp`.
|
||||
tmp = path.with_name(f".{path.name}.{uuid4().hex}.tmp")
|
||||
try:
|
||||
tmp.write_text(json.dumps(payload, ensure_ascii=False, indent=2), encoding="utf-8")
|
||||
tmp.replace(path)
|
||||
finally:
|
||||
tmp.unlink(missing_ok=True)
|
||||
return settings
|
||||
Reference in new issue
Block a user