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
@@ -239,3 +239,66 @@ def test_force_disable_thinking_skips_generic_openai_models_without_thinking_sup
|
||||
)
|
||||
|
||||
assert chat_model.extra_body is None
|
||||
|
||||
|
||||
def _extra_body(chat_model) -> dict:
|
||||
body = chat_model.extra_body or {}
|
||||
return body if isinstance(body, dict) else dict(body)
|
||||
|
||||
|
||||
def test_qwen38_flash_mode_disables_default_xhigh_thinking() -> None:
|
||||
"""Qwen3.8 defaults to thinking=xhigh; flash must send enable_thinking=false."""
|
||||
config = AppConfig.model_construct(
|
||||
models=[
|
||||
ModelConfig(
|
||||
name="qwen3.8-27b",
|
||||
use="langchain_openai:ChatOpenAI",
|
||||
model="Qwen/Qwen3.8-27B",
|
||||
api_key="test-key",
|
||||
base_url="http://vllm.example/v1",
|
||||
supports_thinking=False,
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
chat_model = create_chat_model("qwen3.8-27b", thinking_enabled=False, app_config=config)
|
||||
extra_body = _extra_body(chat_model)
|
||||
|
||||
assert extra_body.get("enable_thinking") is False
|
||||
assert extra_body.get("chat_template_kwargs", {}).get("enable_thinking") is False
|
||||
|
||||
|
||||
def test_qwen38_thinking_mode_sends_medium_reasoning_effort() -> None:
|
||||
config = AppConfig.model_construct(
|
||||
models=[
|
||||
ModelConfig(
|
||||
name="qwen3.8-27b",
|
||||
use="langchain_openai:ChatOpenAI",
|
||||
model="qwen3.8-27b",
|
||||
api_key="test-key",
|
||||
base_url="http://vllm.example/v1",
|
||||
supports_thinking=True,
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
chat_model = create_chat_model(
|
||||
"qwen3.8-27b",
|
||||
thinking_enabled=True,
|
||||
reasoning_effort="medium",
|
||||
app_config=config,
|
||||
)
|
||||
extra_body = _extra_body(chat_model)
|
||||
kwargs = extra_body.get("chat_template_kwargs") or {}
|
||||
|
||||
assert extra_body.get("enable_thinking") is True
|
||||
assert kwargs.get("enable_thinking") is True
|
||||
assert kwargs.get("reasoning_effort") == "medium"
|
||||
|
||||
|
||||
def test_extract_reasoning_reads_vllm_reasoning_field() -> None:
|
||||
from deerflow.models.patched_openai import _extract_reasoning_content
|
||||
|
||||
assert _extract_reasoning_content({"reasoning": "先分析问题"}) == "先分析问题"
|
||||
assert _extract_reasoning_content({"reasoning_content": "逐步推理"}) == "逐步推理"
|
||||
assert _extract_reasoning_content({"content": "答案"}) is None
|
||||
Reference in new issue
Block a user