Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/litellm_rtksync/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def imprimir_status(settings: Settings) -> int:
print(f" {chave.alias[:25]:<26} {(chave.team_id or '-')[:17]:<18} "
f"{chave.health_status(settings.refresh_margin):<14} {validade}")

print(f"\n[*] Resumo: " + ", ".join(f"{v} {k}" for k, v in resumo.items() if v))
print("\n[*] Resumo: " + ", ".join(f"{v} {k}" for k, v in resumo.items() if v))
print(f"[*] Times: {len(times)} Modelos cadastrados: {len(modelos)}")

relatorio = avaliar(chaves, times, settings.platform_caps())
Expand Down
6 changes: 1 addition & 5 deletions src/litellm_rtksync/config.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
"""Configuração deste sincronizador, toda por variável de ambiente."""

import os
from dataclasses import dataclass, field
from dataclasses import dataclass
from typing import Optional, Tuple

from .identidade import PREFIXO_DE_CONTAINER
from .auth import (
AUTH_PASSWORD_KEY,
AUTH_USER_KEY,
derive_recovery_hash,
ensure_recovery_hash,
hash_password,
read_db_credentials,
resolve_recovery_hash,
validate_password_strength,
Expand Down
1 change: 0 additions & 1 deletion src/litellm_rtksync/sessao.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import base64
import hashlib
import hmac
import os
import secrets
import time
from typing import Optional
Expand Down
2 changes: 1 addition & 1 deletion src/litellm_rtksync/sso.py
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ def testar_conexao_oidc(issuer: str, client_id: str = "", client_secret: str = "
if not _transporte_seguro(val):
return False, f"Endpoint '{endpoint}' não utiliza HTTPS."

return True, f"Conexão OIDC validada com sucesso! Endpoints encontrados."
return True, "Conexão OIDC validada com sucesso! Endpoints encontrados."

testa_conexao_oidc = testar_conexao_oidc

Expand Down
7 changes: 2 additions & 5 deletions src/litellm_rtksync/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,17 @@
import json
import os
import re
import secrets
import sys
import threading
import time
import urllib.error
import urllib.request
from http import HTTPStatus
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from typing import Any, Callable, Dict, List, Optional
from typing import Any, Dict, List, Optional
from urllib.parse import parse_qs, urlencode, urlparse

from .config import Settings
from .i18n import DEFAULT_LANGUAGE, LANGUAGES, normalize_language, translate
from .identidade import NOME_DO_GATEWAY, NOME_DO_PRODUTO
from .identidade import NOME_DO_PRODUTO
from .logs import get_logger
from .prefs import get_preference, set_preference
from . import protecao, sessao, sso
Expand Down
8 changes: 4 additions & 4 deletions tests/test_cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ def test_the_log_carries_the_actions_and_names_what_produced_them(self):
linhas = cron.trigger_now()["log"]
# Só o que tem ação entra: a chave sem achado não polui o histórico.
self.assertEqual(len(linhas), 2)
self.assertTrue(any("limit · producao" in l for l in linhas), linhas)
self.assertTrue(any("model · gpt-4o" in l for l in linhas), linhas)
self.assertTrue(any("acima do teto" in l for l in linhas), linhas)
self.assertTrue(any("limit · producao" in line for line in linhas), linhas)
self.assertTrue(any("model · gpt-4o" in line for line in linhas), linhas)
self.assertTrue(any("acima do teto" in line for line in linhas), linhas)

def test_a_partial_read_failure_reaches_the_history_with_its_reason(self):
"""`errors` é uma lista: uma rota fora do ar não derruba o ciclo inteiro."""
Expand All @@ -83,7 +83,7 @@ def test_a_partial_read_failure_reaches_the_history_with_its_reason(self):
self.assertFalse(entrada["success"])
self.assertIn("modelos: HTTP 404", entrada["error"])
self.assertIn("times: timeout", entrada["error"])
self.assertTrue(any("ERRO: modelos: HTTP 404" in l for l in entrada["log"]))
self.assertTrue(any("ERRO: modelos: HTTP 404" in line for line in entrada["log"]))

def test_a_callback_that_raises_becomes_a_failed_cycle_not_a_dead_scheduler(self):
def ciclo_que_explode():
Expand Down
1 change: 0 additions & 1 deletion tests/test_env_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
defasagem aparece no CI em vez de aparecer em producao.
"""

import os
import pathlib
import re
import unittest
Expand Down
4 changes: 2 additions & 2 deletions tests/test_irmaos_identicos.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@
# leitura para `gateway.py`, e isso continua em aberto.
TETOS_DE_DIVERGENCIA = {
"models.py": 7,
"render.py": 862,
"web.py": 689,
"render.py": 560,
"web.py": 578,
}

# O que cada produto troca de propósito, e que não conta como divergência.
Expand Down
2 changes: 0 additions & 2 deletions tests/test_protecao.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
freio tem de já estar instalado quando ele apertar.
"""

import hashlib
import time
import unittest

from litellm_rtksync import protecao
Expand Down
1 change: 0 additions & 1 deletion tests/test_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"""

import base64
import os
import re
import tempfile
import time
Expand Down
4 changes: 2 additions & 2 deletions tools/registra_gateways.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def registrar(api: AdminAPI, escrever: bool = True) -> int:
chave = os.environ.get(gw["env_var"], "")
if not chave:
log(f" ! {gw['env_var']} não está no ambiente — este gateway fica de fora.")
log(f" A chave sai do painel do gateway (POST /api/keys) e mora no .env.")
log(" A chave sai do painel do gateway (POST /api/keys) e mora no .env.")
continue
log(f" chave {gw['env_var']} = {mascara(chave)}")

Expand Down Expand Up @@ -401,7 +401,7 @@ def testar(api: AdminAPI) -> int:
log(f" ✗ CREDENCIAL: {estado_da_chave}")
falhas += 1
continue
log(f" ✓ credencial aceita pelo gateway (/v1/models)")
log(" ✓ credencial aceita pelo gateway (/v1/models)")
try:
r = api.request("POST", "/v1/chat/completions", {
"model": gw["model_name"],
Expand Down
Loading