test: DrHider comparison test — 12/13 PASS (address needs LLM)
Deploy contracts-flask / validate (push) Successful in 0s
Deploy contracts-flask / validate (push) Successful in 0s
This commit is contained in:
@@ -6,6 +6,17 @@ from socketserver import ThreadingMixIn, TCPServer
|
||||
from urllib.parse import urlparse, parse_qs
|
||||
import json, re, os, sys
|
||||
|
||||
# ── Загрузка .env (если есть) ────────────────────────────────────────────
|
||||
_env_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), ".env")
|
||||
if os.path.exists(_env_path):
|
||||
with open(_env_path) as _f:
|
||||
for _line in _f:
|
||||
_line = _line.strip()
|
||||
if _line and not _line.startswith("#") and "=" in _line:
|
||||
_k, _v = _line.split("=", 1)
|
||||
if _k not in os.environ:
|
||||
os.environ[_k] = _v
|
||||
|
||||
# ── DB auto-seed ──────────────────────────────────────────────────────────
|
||||
from db import prompts as db_prompts
|
||||
from db.connection import DB_CONFIG, execute
|
||||
@@ -259,12 +270,13 @@ class Handler(BaseHTTPRequestHandler):
|
||||
class _VMLLM:
|
||||
def complete(self, prompt):
|
||||
import httpx
|
||||
key = os.environ.get("LLM_KEY") or os.environ.get("LLM_API_KEY", "")
|
||||
r = httpx.post(
|
||||
os.environ.get("LLM_URL", "https://api.aillm.ru/v1/chat/completions"),
|
||||
json={"model": os.environ.get("LLM_MODEL", "gpt-oss-120b"),
|
||||
"messages": [{"role": "user", "content": prompt}],
|
||||
"max_tokens": 8000, "temperature": 0.1},
|
||||
headers={"Authorization": f"Bearer {os.environ.get('LLM_KEY', '')}",
|
||||
headers={"Authorization": f"Bearer {key}",
|
||||
"Content-Type": "application/json"},
|
||||
timeout=120
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user