From 501ba36b897b92e12dbb106fc5cf7f1d4b9eead3 Mon Sep 17 00:00:00 2001 From: Hitonabi Date: Thu, 25 Jun 2026 14:24:57 +0200 Subject: [PATCH] =?UTF-8?q?feat(2.0):=20W1=20=E2=80=94=20fast-Spur=20ohne?= =?UTF-8?q?=20Thinking=20(flotte=20Antworten)=20+=20tool-call-Cap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gateway injiziert chat_template_kwargs.enable_thinking=false fuer die fast- Spur (Qwen3.6 ist Reasoning-Modell → sonst lahm/leer). heavy behaelt Thinking. Env MC_FAST_NO_THINK. Hermes-Thrash war poisoned Persistent- Session (fresh=clean, 34k statt 249k verifiziert); code_execution.max_tool_ calls 50->20 auf der Box (Historie unangetastet). Co-Authored-By: Claude Opus 4.8 --- backend/config.py | 2 +- backend/routers/gateway_proxy.py | 6 +++++- backend/services/router_logic.py | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/backend/config.py b/backend/config.py index 1290e00..dbf8b73 100644 --- a/backend/config.py +++ b/backend/config.py @@ -52,7 +52,7 @@ PORT = int(os.environ.get("MC_PORT", "9000")) FRONTEND_DIST = Path(os.environ.get("MC_FRONTEND_DIST", str(Path(__file__).resolve().parent.parent / "frontend" / "dist"))) # Version (Phase 0 — Greenfield-Skeleton). -VERSION = "2.0.0-phase6" +VERSION = "2.0.0-w1" # Gemeinsame YAML-Instanz (preserve_quotes hält Kommentare/Quotes in config.yaml). yaml = YAML() diff --git a/backend/routers/gateway_proxy.py b/backend/routers/gateway_proxy.py index d5662bb..5849c77 100644 --- a/backend/routers/gateway_proxy.py +++ b/backend/routers/gateway_proxy.py @@ -12,7 +12,7 @@ from fastapi import APIRouter, Request from fastapi.responses import JSONResponse, StreamingResponse from config import LLAMA_SWAP_URL -from services.router_logic import choose_model +from services.router_logic import FAST, FAST_NO_THINK, choose_model router = APIRouter(prefix="/v1") @@ -32,7 +32,11 @@ async def _proxy(path: str, request: Request): body["model"] = alias routed = {"x-mc-routed-to": alias, "x-mc-route-reason": reason} else: + alias = requested routed = {"x-mc-routed-to": requested} + # fast-Spur: Thinking aus für flotte Antworten (sofern Client es nicht selbst setzt). + if FAST_NO_THINK and alias == FAST and "chat_template_kwargs" not in body: + body["chat_template_kwargs"] = {"enable_thinking": False} url = f"{LLAMA_SWAP_URL}{path}" if body.get("stream"): diff --git a/backend/services/router_logic.py b/backend/services/router_logic.py index 211193f..115e086 100644 --- a/backend/services/router_logic.py +++ b/backend/services/router_logic.py @@ -9,6 +9,9 @@ import re FAST = os.environ.get("MC_ROUTE_FAST", "fast") HEAVY = os.environ.get("MC_ROUTE_HEAVY", "heavy") HEAVY_CHARS = int(os.environ.get("MC_GATEWAY_HEAVY_CHARS", "8000")) +# Thinking auf der fast-Spur ausschalten → flotte Alltags-Antworten (Qwen3.6 ist ein +# Reasoning-Modell). heavy behält Thinking für harte Aufgaben. Abschaltbar via Env. +FAST_NO_THINK = os.environ.get("MC_FAST_NO_THINK", "1") not in ("0", "false", "") _HEAVY_KW = re.compile( r"\b(beweis|prove|theorem|refactor|architect|komplex|complex|schwierig|"