sync update from LAN repo (source dhk-1 @ 3e87be55)

This commit is contained in:
gozeros committed 2026-10-21 15:06:08 +08:00
1 parent ab6068a7c1
commit 42f2a26fa8
1482 files changed
+227759 -9584

No files matched your search

@@ -33,6 +33,8 @@ def test_load_returns_defaults_when_missing(tmp_runtime_home: Path) -> None:
assert settings.prompt_prefix.ordinary_qa_markdown_format_enabled is False
assert settings.citation_display.reference_mode_enabled is False
assert settings.citation_display.cleanup_words == []
assert settings.memory.enabled is False
assert settings.write_file_compatibility.enabled is False
def test_save_then_load_roundtrips(tmp_runtime_home: Path) -> None:
@@ -139,6 +141,44 @@ async def test_citation_display_update_preserves_unspecified_fields(
assert payload["citation_display"]["cleanup_words"] == ["广告", "免责声明"]
@pytest.mark.asyncio
async def test_admin_can_enable_memory_runtime_switch(
tmp_runtime_home: Path,
monkeypatch: pytest.MonkeyPatch,
) -> None:
_patch_admin(monkeypatch)
response = await ss_router.update_memory_runtime_setting(
ss_router.MemoryRuntimeUpdateRequest(enabled=True),
SimpleNamespace(),
)
assert response.enabled is True
assert ss.load_system_settings().memory.enabled is True
@pytest.mark.asyncio
async def test_admin_can_toggle_write_file_compatibility_without_restart(
tmp_runtime_home: Path,
monkeypatch: pytest.MonkeyPatch,
) -> None:
_patch_admin(monkeypatch)
enabled = await ss_router.update_write_file_compatibility_setting(
ss_router.WriteFileCompatibilityUpdateRequest(enabled=True),
SimpleNamespace(),
)
assert enabled.enabled is True
assert ss.get_write_file_compatibility_settings().enabled is True
disabled = await ss_router.update_write_file_compatibility_setting(
ss_router.WriteFileCompatibilityUpdateRequest(enabled=False),
SimpleNamespace(),
)
assert disabled.enabled is False
assert ss.get_write_file_compatibility_settings().enabled is False
def test_prepend_prefix_tags_first_human_without_touching_content() -> None:
graph_input = {"messages": [HumanMessage(content="评价一下中美贸易")]}
out = _prepend_prompt_prefix(graph_input, "你需要站在中方角度")