feat(qa-center): 问答中心左侧栏改造(0616 需求 2-5)
- 多智能体会商:Step1 落地左栏「业务链(public 前3) + 分析记录」;点链=勾选(autoChainResult),第一步澄清后点「进入研讨」才按链执行
- zzJC/zzXD:独立模块路由 /page/strategy/qa/{zzjc,zzxd},常驻左栏(按 agent 标签分组 + 仅本模块会话的聊天记录),点智能体模块内切换不跳页,默认落地配置类型下首个智能体
- zzJC/zzXD admin 设置:左栏齿轮→单选类型(TDesign)配置面板+智能体预览;后端 system_settings.agent_modules 持久化(GET 开放/PUT admin)+ test_agent_modules
- 课题研究:左栏「研究模板(文章类型) + 笔记本」;模板点击预填表单,笔记本点击设为素材来源(selectedNotebookId 上提 WritingFormContext)
- 通用问答:全量模式历史侧栏默认展开
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
8794c51f88
commit
f39cffcb9a
18 files changed
+1113
-41
No files matched your search
@@ -0,0 +1,60 @@
|
||||
"""Tests for the admin-configured「按类型聚合」module → agent-tag config.
|
||||
|
||||
Backs the zzJC / zzXD module left sidebar (需求 0616 #3/#4): an admin picks
|
||||
which agent tags belong to the module, persisted in ``system_settings.json``.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from deerflow.config import system_settings as ss
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def tmp_runtime_home(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> Path:
|
||||
"""Redirect ``runtime_home()`` to a per-test tmp dir."""
|
||||
|
||||
def fake_home() -> Path:
|
||||
return tmp_path
|
||||
|
||||
monkeypatch.setattr(ss, "runtime_home", fake_home)
|
||||
return tmp_path
|
||||
|
||||
|
||||
def test_load_returns_empty_modules_when_missing(tmp_runtime_home: Path) -> None:
|
||||
settings = ss.load_system_settings()
|
||||
assert settings.agent_modules.modules == {}
|
||||
assert ss.get_module_tag_ids(settings.agent_modules, "zzjc") == []
|
||||
|
||||
|
||||
def test_set_module_tag_ids_dedupes_and_strips() -> None:
|
||||
base = ss.AgentModuleSettings()
|
||||
updated = ss.set_module_tag_ids(base, "zzjc", [" t1 ", "t2", "t1", "", " "])
|
||||
assert updated.modules["zzjc"] == ["t1", "t2"]
|
||||
# Original is untouched (returns a copy).
|
||||
assert base.modules == {}
|
||||
|
||||
|
||||
def test_set_module_tag_ids_keeps_other_modules() -> None:
|
||||
base = ss.set_module_tag_ids(ss.AgentModuleSettings(), "zzjc", ["t1"])
|
||||
both = ss.set_module_tag_ids(base, "zzxd", ["t2", "t3"])
|
||||
assert ss.get_module_tag_ids(both, "zzjc") == ["t1"]
|
||||
assert ss.get_module_tag_ids(both, "zzxd") == ["t2", "t3"]
|
||||
|
||||
|
||||
def test_save_then_load_roundtrips(tmp_runtime_home: Path) -> None:
|
||||
current = ss.load_system_settings()
|
||||
updated = ss.set_module_tag_ids(current.agent_modules, "zzjc", ["tag-a", "tag-b"])
|
||||
ss.save_system_settings(current.model_copy(update={"agent_modules": updated}))
|
||||
|
||||
file_path = tmp_runtime_home / "system_settings.json"
|
||||
assert file_path.is_file()
|
||||
saved = json.loads(file_path.read_text(encoding="utf-8"))
|
||||
assert saved["agent_modules"]["modules"]["zzjc"] == ["tag-a", "tag-b"]
|
||||
|
||||
reloaded = ss.load_system_settings()
|
||||
assert ss.get_module_tag_ids(reloaded.agent_modules, "zzjc") == ["tag-a", "tag-b"]
|
||||
Reference in new issue
Block a user