forked from Rockachopa/Timmy-time-dashboard
Compare commits
1 Commits
kimi/issue
...
kimi/issue
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5361a0385 |
@@ -66,7 +66,7 @@ class Settings(BaseSettings):
|
|||||||
|
|
||||||
# ── Backend selection ────────────────────────────────────────────────────
|
# ── Backend selection ────────────────────────────────────────────────────
|
||||||
# "ollama" — always use Ollama (default, safe everywhere)
|
# "ollama" — always use Ollama (default, safe everywhere)
|
||||||
# "auto" — pick best available local backend, fall back to Ollama
|
# "auto" — auto-detect best available backend
|
||||||
timmy_model_backend: Literal["ollama", "grok", "claude", "auto"] = "ollama"
|
timmy_model_backend: Literal["ollama", "grok", "claude", "auto"] = "ollama"
|
||||||
|
|
||||||
# ── Grok (xAI) — opt-in premium cloud backend ────────────────────────
|
# ── Grok (xAI) — opt-in premium cloud backend ────────────────────────
|
||||||
@@ -469,12 +469,6 @@ def validate_startup(*, force: bool = False) -> None:
|
|||||||
", ".join(_missing),
|
", ".join(_missing),
|
||||||
)
|
)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if "*" in settings.cors_origins:
|
|
||||||
_startup_logger.error(
|
|
||||||
"PRODUCTION SECURITY ERROR: Wildcard '*' in CORS_ORIGINS is not "
|
|
||||||
"allowed in production — set explicit origins via CORS_ORIGINS env var."
|
|
||||||
)
|
|
||||||
sys.exit(1)
|
|
||||||
_startup_logger.info("Production mode: security secrets validated ✓")
|
_startup_logger.info("Production mode: security secrets validated ✓")
|
||||||
else:
|
else:
|
||||||
if not settings.l402_hmac_secret:
|
if not settings.l402_hmac_secret:
|
||||||
|
|||||||
@@ -37,19 +37,6 @@ class TestConfigLazyValidation:
|
|||||||
):
|
):
|
||||||
validate_startup(force=True)
|
validate_startup(force=True)
|
||||||
|
|
||||||
def test_validate_startup_exits_on_cors_wildcard_in_production(self):
|
|
||||||
"""validate_startup() should exit in production when CORS has wildcard."""
|
|
||||||
from config import settings, validate_startup
|
|
||||||
|
|
||||||
with (
|
|
||||||
patch.object(settings, "timmy_env", "production"),
|
|
||||||
patch.object(settings, "l402_hmac_secret", "test-secret-hex-value-32"),
|
|
||||||
patch.object(settings, "l402_macaroon_secret", "test-macaroon-hex-value-32"),
|
|
||||||
patch.object(settings, "cors_origins", ["*"]),
|
|
||||||
pytest.raises(SystemExit),
|
|
||||||
):
|
|
||||||
validate_startup(force=True)
|
|
||||||
|
|
||||||
def test_validate_startup_ok_with_secrets(self):
|
def test_validate_startup_ok_with_secrets(self):
|
||||||
"""validate_startup() should not exit when secrets are set."""
|
"""validate_startup() should not exit when secrets are set."""
|
||||||
from config import settings, validate_startup
|
from config import settings, validate_startup
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ def test_create_timmy_respects_custom_ollama_url():
|
|||||||
mock_settings.ollama_url = custom_url
|
mock_settings.ollama_url = custom_url
|
||||||
mock_settings.ollama_num_ctx = 4096
|
mock_settings.ollama_num_ctx = 4096
|
||||||
mock_settings.timmy_model_backend = "ollama"
|
mock_settings.timmy_model_backend = "ollama"
|
||||||
mock_settings.airllm_model_size = "70b"
|
|
||||||
|
|
||||||
from timmy.agent import create_timmy
|
from timmy.agent import create_timmy
|
||||||
|
|
||||||
@@ -159,7 +158,6 @@ def test_resolve_backend_auto_uses_airllm_on_apple_silicon():
|
|||||||
patch("timmy.agent.settings") as mock_settings,
|
patch("timmy.agent.settings") as mock_settings,
|
||||||
):
|
):
|
||||||
mock_settings.timmy_model_backend = "auto"
|
mock_settings.timmy_model_backend = "auto"
|
||||||
mock_settings.airllm_model_size = "70b"
|
|
||||||
mock_settings.ollama_model = "llama3.2"
|
mock_settings.ollama_model = "llama3.2"
|
||||||
|
|
||||||
from timmy.agent import _resolve_backend
|
from timmy.agent import _resolve_backend
|
||||||
@@ -174,7 +172,6 @@ def test_resolve_backend_auto_falls_back_on_non_apple():
|
|||||||
patch("timmy.agent.settings") as mock_settings,
|
patch("timmy.agent.settings") as mock_settings,
|
||||||
):
|
):
|
||||||
mock_settings.timmy_model_backend = "auto"
|
mock_settings.timmy_model_backend = "auto"
|
||||||
mock_settings.airllm_model_size = "70b"
|
|
||||||
mock_settings.ollama_model = "llama3.2"
|
mock_settings.ollama_model = "llama3.2"
|
||||||
|
|
||||||
from timmy.agent import _resolve_backend
|
from timmy.agent import _resolve_backend
|
||||||
@@ -259,7 +256,6 @@ def test_create_timmy_includes_tools_for_large_model():
|
|||||||
mock_settings.ollama_url = "http://localhost:11434"
|
mock_settings.ollama_url = "http://localhost:11434"
|
||||||
mock_settings.ollama_num_ctx = 4096
|
mock_settings.ollama_num_ctx = 4096
|
||||||
mock_settings.timmy_model_backend = "ollama"
|
mock_settings.timmy_model_backend = "ollama"
|
||||||
mock_settings.airllm_model_size = "70b"
|
|
||||||
mock_settings.telemetry_enabled = False
|
mock_settings.telemetry_enabled = False
|
||||||
|
|
||||||
from timmy.agent import create_timmy
|
from timmy.agent import create_timmy
|
||||||
|
|||||||
Reference in New Issue
Block a user