feat(turbo): add direct LLM chat mode with runtime toggle
Add 极速 mode that streams via /api/direct-chat without the lead agent stack, plus VITE_TURBO_MODE_VISIBLE in runtime-config.js (default off). Also disable global memory, tighten Qwen/vLLM thinking control for flash mode, and force thinking off on the direct-chat endpoint. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
4f7f07504a
commit
d765afe2ac
23 files changed
+1295
-394
No files matched your search
+29
-24
@@ -9,8 +9,8 @@ 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.config.system_settings import load_system_settings
|
||||
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
|
||||
@@ -487,7 +487,7 @@ task(description="Oracle Cloud analysis", prompt="...", subagent_type="general-p
|
||||
</subagent_system>"""
|
||||
|
||||
|
||||
_ORDINARY_QA_MARKDOWN_FORMAT_SECTION = """
|
||||
_ORDINARY_QA_MARKDOWN_FORMAT_SECTION = """
|
||||
<ordinary_qa_markdown_format>
|
||||
当普通问答需要输出带章节结构的较长内容时,必须采用以下 Markdown 规范,以便下载为 Word 后得到正确的自动编号和公文标题格式:
|
||||
- 文档主标题使用 `# 主标题`;主标题只写标题文字,不添加章节编号。
|
||||
@@ -496,19 +496,19 @@ _ORDINARY_QA_MARKDOWN_FORMAT_SECTION = """
|
||||
- 默认禁止使用以 `-`、`*`、`+` 或 `•` 开头的无序圆点列表;并列内容优先改写为完整自然段,确需逐项表达时使用有序列表。只有用户明确要求无序列表时才使用。
|
||||
- 简短问答不必为了套用格式而强行添加标题;本规范只约束实际使用的标题和列表。
|
||||
</ordinary_qa_markdown_format>
|
||||
"""
|
||||
|
||||
|
||||
def _ordinary_qa_markdown_format_enabled() -> bool:
|
||||
"""Return the admin-controlled formal Markdown prompt switch."""
|
||||
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 = """
|
||||
"""
|
||||
|
||||
|
||||
def _ordinary_qa_markdown_format_enabled() -> bool:
|
||||
"""Return the admin-controlled formal Markdown prompt switch."""
|
||||
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.
|
||||
</role>
|
||||
@@ -883,11 +883,16 @@ def _get_memory_context(agent_name: str | None = None, *, app_config: AppConfig
|
||||
return ""
|
||||
try:
|
||||
from deerflow.agents.memory.manager import build_memory_manager
|
||||
from deerflow.config.memory_config import get_effective_memory_config
|
||||
from deerflow.config.memory_config import get_effective_memory_config, get_memory_config
|
||||
from deerflow.runtime.user_context import get_effective_user_id
|
||||
|
||||
if not get_memory_config().enabled:
|
||||
return ""
|
||||
|
||||
user_id = get_effective_user_id()
|
||||
config = get_effective_memory_config(user_id)
|
||||
if not config.enabled or not config.injection.enabled:
|
||||
return ""
|
||||
|
||||
manager = build_memory_manager(
|
||||
user_id=user_id,
|
||||
@@ -1547,13 +1552,13 @@ When a search, knowledge, skill, or MCP tool returns a result list:
|
||||
if rag_mode_enabled
|
||||
else ""
|
||||
)
|
||||
ordinary_qa_format_section = (
|
||||
_ORDINARY_QA_MARKDOWN_FORMAT_SECTION
|
||||
if _ordinary_qa_markdown_format_enabled()
|
||||
and not is_bootstrap
|
||||
and not writing_mode
|
||||
and not is_notebook_mode
|
||||
and not is_scheduled_run
|
||||
ordinary_qa_format_section = (
|
||||
_ORDINARY_QA_MARKDOWN_FORMAT_SECTION
|
||||
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 ""
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user