Merge branch 'master' of http://192.168.0.200/knowledge-base-bj/deerflow-code into master-nj
# Conflicts: # frontend-web/src/components/workspace/messages/message-group.tsx # offline-backend-20260512/backend/packages/harness/deerflow/agents/lead_agent/prompt.py
This commit is contained in:
commit
57b6a89f20
21 files changed
+441
-115
No files matched your search
@@ -42,12 +42,17 @@ class PromptPrefixResponse(BaseModel):
|
||||
enabled: bool = Field(..., description="Whether the toggle is exposed to users")
|
||||
switch_label: str = Field(..., description="Toggle label shown in the chat input")
|
||||
prompt_prefix: str = Field(..., description="Prefix text prepended to the first user message")
|
||||
ordinary_qa_markdown_format_enabled: bool = Field(
|
||||
default=False,
|
||||
description="Whether formal Markdown heading rules are injected into ordinary Q&A system prompts",
|
||||
)
|
||||
|
||||
|
||||
class PromptPrefixUpdateRequest(BaseModel):
|
||||
enabled: bool | None = None
|
||||
switch_label: str | None = None
|
||||
prompt_prefix: str | None = None
|
||||
ordinary_qa_markdown_format_enabled: bool | None = None
|
||||
|
||||
|
||||
class PluginDomainAgentMappingItem(BaseModel):
|
||||
@@ -82,10 +87,12 @@ class PrivateSquareUpdateRequest(BaseModel):
|
||||
|
||||
|
||||
class CitationDisplayResponse(BaseModel):
|
||||
reference_mode_enabled: bool = Field(default=False, description="Whether reference-mode entry points are exposed to users")
|
||||
cleanup_words: list[str] = Field(default_factory=list, description="Global citation cleanup words")
|
||||
|
||||
|
||||
class CitationDisplayUpdateRequest(BaseModel):
|
||||
reference_mode_enabled: bool | None = None
|
||||
cleanup_words: list[str] | None = None
|
||||
|
||||
|
||||
@@ -110,6 +117,7 @@ def _to_response(settings: PromptPrefixSettings) -> PromptPrefixResponse:
|
||||
enabled=settings.enabled,
|
||||
switch_label=settings.switch_label,
|
||||
prompt_prefix=settings.prompt_prefix,
|
||||
ordinary_qa_markdown_format_enabled=settings.ordinary_qa_markdown_format_enabled,
|
||||
)
|
||||
|
||||
|
||||
@@ -410,9 +418,12 @@ async def update_leaderboard_settings(
|
||||
|
||||
@router.get("/citation-display", response_model=CitationDisplayResponse)
|
||||
async def get_citation_display() -> CitationDisplayResponse:
|
||||
"""Return global citation display cleanup settings."""
|
||||
"""Return global citation display settings."""
|
||||
settings = load_system_settings().citation_display
|
||||
return CitationDisplayResponse(cleanup_words=settings.cleanup_words)
|
||||
return CitationDisplayResponse(
|
||||
reference_mode_enabled=settings.reference_mode_enabled,
|
||||
cleanup_words=settings.cleanup_words,
|
||||
)
|
||||
|
||||
|
||||
@router.put("/citation-display", response_model=CitationDisplayResponse)
|
||||
@@ -420,14 +431,22 @@ async def update_citation_display(
|
||||
body: CitationDisplayUpdateRequest,
|
||||
request: Request,
|
||||
) -> CitationDisplayResponse:
|
||||
"""Update global citation display cleanup settings. Admin only."""
|
||||
"""Update global citation display settings. Admin only."""
|
||||
await _require_admin(request)
|
||||
|
||||
current = load_system_settings()
|
||||
words = [str(item).strip() for item in (body.cleanup_words or []) if str(item).strip()]
|
||||
updated = current.citation_display.model_copy(update={"cleanup_words": words})
|
||||
fields = body.model_dump(exclude_unset=True)
|
||||
update: dict[str, object] = {}
|
||||
if "reference_mode_enabled" in fields and fields["reference_mode_enabled"] is not None:
|
||||
update["reference_mode_enabled"] = bool(fields["reference_mode_enabled"])
|
||||
if "cleanup_words" in fields and fields["cleanup_words"] is not None:
|
||||
update["cleanup_words"] = [str(item).strip() for item in fields["cleanup_words"] if str(item).strip()]
|
||||
updated = current.citation_display.model_copy(update=update)
|
||||
saved = save_system_settings(current.model_copy(update={"citation_display": updated}))
|
||||
return CitationDisplayResponse(cleanup_words=saved.citation_display.cleanup_words)
|
||||
return CitationDisplayResponse(
|
||||
reference_mode_enabled=saved.citation_display.reference_mode_enabled,
|
||||
cleanup_words=saved.citation_display.cleanup_words,
|
||||
)
|
||||
|
||||
|
||||
@router.get("/private-square", response_model=PrivateSquareStatusResponse)
|
||||
|
||||
Reference in new issue
Block a user