mirror of
https://github.com/ghndrx/starlane-router.git
synced 2026-02-10 06:45:01 +00:00
feat: initial commit for starlane-router (FastAPI + Gradient)
This commit is contained in:
21
app/router.py
Normal file
21
app/router.py
Normal file
@@ -0,0 +1,21 @@
|
||||
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"
|
||||
Reference in New Issue
Block a user