feat: add configurable chat display modes

This commit is contained in:
吉鑫升 committed 2026-08-31 17:49:48 +08:00
1 parent 3715af3138
commit 40542db400
18 files changed
+421 -121

No files matched your search

@@ -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 ""
)