feat: 报告结构支持检索方向/来源与智能新增,并修复协助卡停轮与宿主跳转
为深度研究报告结构增加检索方向与技能来源、对话式智能新增页与详情排版;澄清中间件在 after_model 可靠结束本轮,避免弱模型出卡后继续生成;任务按钮补充 host 跳转与相关深链能力。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
a5a9c952e8
commit
51afebb394
67 files changed
+4511
-699
No files matched your search
+37
@@ -30,6 +30,11 @@ SourceType = Literal["web", "knowledge", "skill", "mcp", "file", "other"]
|
||||
# runner-driven skill/web tiers searching on their own.
|
||||
CollectionMode = Literal["chat", "legacy"]
|
||||
|
||||
# How the writer treats ``custom_outline``.
|
||||
# ``fixed`` (固定大纲) reproduces the stored headings and hierarchy.
|
||||
# ``adaptive`` (弹性大纲) keeps the current material-driven layout.
|
||||
StructureMode = Literal["fixed", "adaptive"]
|
||||
|
||||
|
||||
# ── server-side bounds (§4.3 / §19.4) ────────────────────────────────────────
|
||||
# Centralised so the router, the executor, and tests all share one truth source.
|
||||
@@ -105,6 +110,16 @@ class DeepResearchConfig(BaseModel):
|
||||
# separate from ``custom_outline`` so prose/style requirements can never be
|
||||
# misread as extra chapter headings by detailed runners.
|
||||
report_instruction: str | None = Field(default=None, max_length=_MAX_REPORT_INSTRUCTION_CHARS)
|
||||
# Writing constraint copied from the selected report structure (结构约束).
|
||||
# Default ``adaptive`` preserves today's material-driven layout.
|
||||
structure_mode: StructureMode = "adaptive"
|
||||
# Optional search facets copied from the selected report structure (检索方向).
|
||||
# Empty → unconstrained query-planning. Non-empty → split retrievable terms
|
||||
# along those facets; never treat the labels themselves as search queries.
|
||||
retrieval_directions: list[str] = Field(default_factory=list)
|
||||
# Optional skill names copied from the selected report structure (检索来源).
|
||||
# Empty → collector / material provider keep today's default sources.
|
||||
retrieval_skills: list[str] = Field(default_factory=list)
|
||||
|
||||
model_config = {"extra": "forbid"}
|
||||
|
||||
@@ -169,6 +184,28 @@ class DeepResearchConfig(BaseModel):
|
||||
cleaned = str(value).replace("\x00", "").replace("\r", "").strip()
|
||||
return cleaned or None
|
||||
|
||||
@field_validator("structure_mode", mode="before")
|
||||
@classmethod
|
||||
def _normalize_structure_mode(cls, value: Any) -> StructureMode:
|
||||
raw = str(value or "").strip().lower()
|
||||
if raw in {"fixed", "canonical", "prescriptive", "rigid"}:
|
||||
return "fixed"
|
||||
return "adaptive"
|
||||
|
||||
@field_validator("retrieval_directions", mode="before")
|
||||
@classmethod
|
||||
def _normalize_retrieval_directions(cls, value: Any) -> list[str]:
|
||||
from deerflow.persistence.report_structures.directions import normalize_retrieval_directions
|
||||
|
||||
return normalize_retrieval_directions(value)
|
||||
|
||||
@field_validator("retrieval_skills", mode="before")
|
||||
@classmethod
|
||||
def _normalize_retrieval_skills(cls, value: Any) -> list[str]:
|
||||
from deerflow.persistence.report_structures.skills import normalize_retrieval_skills
|
||||
|
||||
return normalize_retrieval_skills(value)
|
||||
|
||||
def resolve_model_name(self, role: ModelRole) -> str | None:
|
||||
"""Return the configured model name for a role, or ``None`` for system default."""
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user