feat: add configurable chat display modes
This commit is contained in:
1 parent
3715af3138
commit
40542db400
18 files changed
+421
-121
No files matched your search
+25
-5
@@ -7,10 +7,11 @@ import threading
|
||||
from datetime import datetime
|
||||
from functools import lru_cache
|
||||
from typing import TYPE_CHECKING
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
from deerflow.config.agents_config import load_agent_soul
|
||||
from deerflow.skills.storage import get_or_new_skill_storage
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
from deerflow.config.agents_config import load_agent_soul
|
||||
from deerflow.config.system_settings import load_system_settings
|
||||
from deerflow.skills.storage import get_or_new_skill_storage
|
||||
from deerflow.skills.types import Skill, SkillCategory
|
||||
from deerflow.subagents import get_available_subagent_names
|
||||
|
||||
@@ -498,6 +499,21 @@ _ORDINARY_QA_MARKDOWN_FORMAT_SECTION = """
|
||||
"""
|
||||
|
||||
|
||||
def _ordinary_qa_markdown_format_enabled() -> bool:
|
||||
"""Return the admin-controlled formal Markdown prompt switch.
|
||||
|
||||
Reading the small runtime settings document for each prompt build makes an
|
||||
administrator's change effective for the next run without a process-level
|
||||
cache or restart. Any missing/invalid setting safely falls back to off.
|
||||
"""
|
||||
|
||||
try:
|
||||
return bool(load_system_settings().prompt_prefix.ordinary_qa_markdown_format_enabled)
|
||||
except Exception:
|
||||
logger.debug("Failed to read the ordinary Q&A Markdown format switch; using disabled", exc_info=True)
|
||||
return False
|
||||
|
||||
|
||||
SYSTEM_PROMPT_TEMPLATE = """
|
||||
<role>
|
||||
You are {agent_name}, an internal super agent.
|
||||
@@ -1545,7 +1561,11 @@ When a search, knowledge, skill, or MCP tool returns a result list:
|
||||
)
|
||||
ordinary_qa_format_section = (
|
||||
_ORDINARY_QA_MARKDOWN_FORMAT_SECTION
|
||||
if not is_bootstrap and not writing_mode and not is_notebook_mode and not is_scheduled_run
|
||||
if _ordinary_qa_markdown_format_enabled()
|
||||
and not is_bootstrap
|
||||
and not writing_mode
|
||||
and not is_notebook_mode
|
||||
and not is_scheduled_run
|
||||
else ""
|
||||
)
|
||||
|
||||
|
||||
+9
-1
@@ -153,6 +153,10 @@ class PromptPrefixSettings(BaseModel):
|
||||
enabled: bool = Field(default=False, description="Whether the prefix toggle is offered to users at all")
|
||||
switch_label: str = Field(default="加入立场前缀", description="Toggle label shown in the chat input")
|
||||
prompt_prefix: str = Field(default="", description="Text prepended to the first user message when enabled")
|
||||
ordinary_qa_markdown_format_enabled: bool = Field(
|
||||
default=False,
|
||||
description="Whether the formal Markdown heading rules are injected into ordinary Q&A system prompts.",
|
||||
)
|
||||
model_config = ConfigDict(extra="ignore")
|
||||
|
||||
|
||||
@@ -255,8 +259,12 @@ class AppearanceSettings(BaseModel):
|
||||
|
||||
|
||||
class CitationDisplaySettings(BaseModel):
|
||||
"""System-wide cleanup rules for citation cards and detail dialogs."""
|
||||
"""System-wide controls for citation mode entry and display cleanup."""
|
||||
|
||||
reference_mode_enabled: bool = Field(
|
||||
default=False,
|
||||
description="Whether the reference-mode entry points are exposed to users.",
|
||||
)
|
||||
cleanup_words: list[str] = Field(
|
||||
default_factory=list,
|
||||
description="Words or phrases used to remove noisy advertisement/disclaimer lines from citation display.",
|
||||
|
||||
Reference in new issue
Block a user