mirror of
https://github.com/ghndrx/starlane-router.git
synced 2026-02-10 06:45:01 +00:00
21 lines
559 B
Python
21 lines
559 B
Python
from typing import Optional
|
|
from .config import get_route_keywords
|
|
|
|
|
|
def decide_route(*, message: str, explicit_hint: Optional[str] = None) -> str:
|
|
if explicit_hint:
|
|
hint = explicit_hint.strip().lower()
|
|
if hint in {"gradient", "local"}:
|
|
return hint
|
|
|
|
text = (message or "").strip().lower()
|
|
|
|
# Simple heuristic: if message is long or has keywords, use gradient
|
|
if len(text) > 120:
|
|
return "gradient"
|
|
|
|
for kw in get_route_keywords():
|
|
if kw in text:
|
|
return "gradient"
|
|
|
|
return "local" |